0.5.0 • Published 6 years ago

@jych/gif-provider v0.5.0

Weekly downloads
8
License
ISC
Repository
gitlab
Last release
6 years ago

gif-provider

gif-provider is a JavaScript module that allows you to querying various gif APIs. Queries can be done to a single API at a time, or to multiple, with the results aggregated.

The module currently supports fetching gifs from Giphy and Tenor. Other APIs may be added in the future.

You can easily extend gif-provider to support other APIs, either by contributing on GitHub, or by implementing your own GifProvider class.

See the API documenntation here.

Installation

npm install --save @jych/gif-provider

Getting Started

Installing

In Node and CommonJS build systems:

const {GiphyGifProvider} = require('@jych/gif-provider');

In ES6 Modules and Typescript:

import {GiphyGifProvider} from 'jych/gif-provider';

Example Usage

Querying Giphy:

const {GiphyGifProvider} = require('@jych/gif-provider');

const gifProvider = new GiphyGifProvider();

gifProvider.search("rat mouse")
.then( gifs => {
    // ...
} );

Querying multiple sites:

const {CompositeGifProvider, GifProviderFactory} = require('@jych/gif-provider');

const providers = GifProviderFactory.getProviders([ "giphy", "tenor", "some-other-site" ];
const gifProvider = new CompositeGifProvider(providers);

gifProvider.search("rat mouse")
 .then( gifs => {
     
     // gifs is a flat array of results from each site
     // ...
 } );

Docs

A full copy of the docs can be generated for offline use:

npm install @jych/gif-provider
cd node_modules/@jych/gif-provider
npm install
npm run generate-docs
open docs/index.html
0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago