npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ibl-client

v1.0.2

Published

Rest Client for the iPlayer Business Layer

Downloads

20

Readme

ibl-client

Client library written in Node.js for the iPlayer Business Layer (iBL)

Installation

npm install ibl-client

Usage

const client = require('@ibl/client').createClient({
  stats: require('@ibl/stats'),
  logger: require('@ibl/logger'),
});

client.getEpisodes()
  .then(console.log)
  .catch(console.error);

client.getEpisodes((err, episodes) => {
  if (err) {
    console.error(err);
    return;
  }
  console.log(episodes)
});

API

.createClient

Creates a new client.

Parameters
  • opts - An options object
Options

createClient supports all of the options supported by ibl-rest-client.

.createCustomClient

Creates a new client with a pre-configured http client.

Parameters
  • delegate - pre-configured http client

Programmes

client.getProgrammes(programmePids, opts, cb) -> Promise

Parameters
  • programmePids - An Programme PID or an array of Programme PIDs
  • opts - optional - An object containing request parameters
    • rights
    • availability
    • initial_child_count
  • cb - optional - A function that is called with an error object and an array of programmes
Returns
  • If the Promise fulfills, the fulfillment value is an array of Programmes

Programme Episodes

client.getProgrammeEpisodes(programmePid, opts, cb) -> Promise

Parameters
  • programmePid - A Programme PID
  • opts - optional - An object containing request parameters
  • cb - optional - A function that is called with an error object and programme_episodes object
Returns
  • If the Promise fulfills, the fulfillment value is the programme_episodes object

client.getEpisodeRecommendations(episodePid, opts, cb) -> Promise

Parameters
  • episodePid - A Episode PID
  • opts - optional - An object containing request parameters
Returns
  • If the Promise fulfills, the fulfillment value is the episode_recommendations object
  • cb - optional - A function that is called with an error object and episode_recommendations object

Episodes

client.getEpisodes(episodePids, opts, cb) -> Promise

Parameters
  • episodesPids - An Episode PID or an array of Episode PIDs
  • opts - optional - An object containing request parameters
    • rights
    • availability
  • cb - optional - A function that is called with an error object and an array of episodes
Returns
  • If the Promise fulfills, the fulfillment value is an array of episodes

Category Programmes

client.categoryProgrammes(category, opts, cb) -> Promise

Parameters
  • category - ibl category
  • opts - optional - An object containing request parameters
    • rights
    • availability
    • sort
    • sort_direction
    • initial_child_count
    • page
    • per_page
  • cb - optional - A function that is called with an error object and a category_programmes object
Returns
  • If the Promise fulfills, the fulfillment value is a category_programmes object

Group Episodes

client.getGroupEpisodes(groupPid, opts, cb) -> Promise

Parameters
  • groupPid - A Group PID
  • opts - optional - An object containing request parameters
    • rights
    • page
    • per_page
  • cb - optional - A function that is called with an error object and a group_episodes object
Returns
  • If the Promise fulfills, the fulfillment value is the group_episodes object

Popular Episodes

client.getPopularEpisodes(groupPid, opts, cb) -> Promise

Parameters
  • opts - optional - An object containing request parameters
    • rights
    • page
    • per_page
  • cb - optional - A function that is called with an error object and a group_episodes object
Returns
  • If the Promise fulfills, the fulfillment value is the group_episodes object

Category Highlights

client.getCategoryHighlights(categoryId, opts, cb) -> Promise

Parameters
  • categoryId - An iBL category
  • opts - optional - An object containing request parameters
    • rights
    • mixin
  • cb - optional - A function that is called with an error object and a category_highlights object
Returns
  • If the Promise fulfills, the fulfillment value is the category_highlights object

Channel Highlights

client.getChannelHighlights(channelId, opts, cb) -> Promise

Parameters
  • channelId - An iBL category
  • opts - optional - An object containing request parameters
    • rights
    • mixin
    • isLive
  • cb - optional - A function that is called with an error object and a channel_highlights object
Returns
  • If the Promise fulfills, the fulfillment value is the channel_highlights object

Home Highlights

client.getHomeHighlights(opts, cb) -> Promise

Parameters
  • opts - optional - An object containing request parameters
    • rights
    • mixin
  • cb - optional - A function that is called with an error object and a home_highlights object
Returns
  • If the Promise fulfills, the fulfillment value is the home_highlights object

Categories

client.getCategories(id, opts, cb) -> Promise

Parameters
  • categoryId - An iBL category id
  • cb - optional - A function that is called with an error object and a list of categories or a category object
Returns
  • If the Promise fulfills, the fulfillment value is the list of channels or a channel object

Channels

client.getChannels(id, opts, cb) -> Promise

Parameters
  • channelId - An iBL channel id
  • cb - optional - A function that is called with an error object and a list of channels or a channel object
Returns
  • If the Promise fulfills, the fulfillment value is the list of channels or a channel object

Channel Broadcasts

client.getChannelBroadcasts(id, opts, cb) -> Promise

Parameters
  • channelId - An iBL channel id
  • opts - optional - An object containing request parameters
    • rights
    • page
    • per_page
  • cb - optional - A function that is called with an error object and a broadcast object
Returns
  • If the Promise fulfills, the fulfillment value is a broadcast object

Test

npm test

To generate a test coverage report:

npm run coverage