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

lgi-guide-sdk

v0.2.8

Published

Kraken API client library

Downloads

13

Readme

Kraken beta logo

TV Guide JS SDK

Provides a simple way to retrieve TV schedule data.

Basic concepts

SDK contains few public classes representing API entities:

  • Video (a piece of video material, could be movie or news issue etc.)
  • Broadcast (a piece of video at a particular time on a particular channel)

Broadcast always include video.

Entities are query builders encapsulating data retrieval functions, filtering, sorting and paging in order to provide simple API facade.

Usage examples

####Regions#### Always specify region before start.

LGI.Guide.config.region = 'NL';

Following regions are supported:

  • NL Netherlands
  • IE Ireland
  • HU Hungary

####Basic example#### Let's look at the most basic example - getting list of broadcasts for Netherlands without any filtering or sorting:

var broadcastsData = LGI.Guide.Video.create()
	.findOne(dataReceivedCallback);
	

Response:

[
	{selfLink: Object},
	{selfLink: Object},
	{selfLink: Object},
	{selfLink: Object}
]

Probably you are wondered with result containing only _selfLink property. This happen because it is important to minimize response size by getting only data you really need.

####Specifying fields to retrieve#### Let`s specify fields to retrieve as following:

LGI.Guide.Video.create()
	.fields(LGI.Guide.Video.ID, LGI.Guide.Video.TITLE)
	.findOne(dataReceivedCallback);
	

Response:

[
	{id: "7shi89fww", title: "Oorlogsverhalen (3)", selfLink: Object},
	{id: "3yaqesymo", title: "Millivres - Point of View", selfLink: Object},
	{id: "5jzc9n9c1", title: "Mahabharat", selfLink: Object},
	{id: "9l2i1y2sb", title: "Baggage Battles", selfLink: Object}
]

Much better! Now we have videos with IDs and titles.

####Limiting response size#### You can limit number of broadcasts or videos in response.

LGI.Guide.Broadcast.create()
	.fields(LGI.Guide.Broadcast.ID, LGI.Guide.Broadcast.TITLE)
	.limit(2)
	.findOne(dataReceivedCallback);

####Paging and difference between findOne, findAll and findNext methods#### API supports paging and three data retrieval methods are supported:

  • findOne - retrieves first page of data,
  • findNext - retrieves next page of data,
  • findAll - retrieves all data pages available for your request.

You can set particular page size by using limit().

####Filtering#### Most advanced tool for specific data retrieval is filtering. In this example we will get only broadcasts with category equal to sports.

LGI.Guide.Broadcast.create()
	.filter(LGI.Guide.Broadcast.category.isEqual('sports'))
	.findAll(dataReceivedCallback);

####Sorting#### This will retrieve a page of broadcasts sorted by popularity:

LGI.Guide.Broadcast.create()
	.fields(LGI.Guide.Broadcast.ID, LGI.Guide.Broadcast.TITLE)
    .sort(LGI.Guide.Broadcast.POPULARITY, 'desc')
    .findOne(dataReceivedCallback);

Almost all fields are sortable.

Explore JSDoc for available fields lists and more information.

Bug tracker

Have a bug? Please create an issue on GitHub