giphy-wrapi
v0.1.0
Published
Wrapper for Giphy Web API
Downloads
8
Maintainers
Readme
Giphy API Wrapper
Client interface for accessing Giphy API.
Installation
Install via npm
npm install giphy-wrapi --save
Usage
Create a client object to connect to Giphy API endpoints.
var giphyWrapi = require('giphy-wrapi');
var client = new giphyWrapi(GIPHY_API_KEY);
// Now you are ready to make API calls to Giphy.
Provide parameters and a callback.
API calls follow this syntax:
client.apigroup.action(queryString, callback);
queryString
- (as required) API method parameters as key-value pairs.
Examples
Search all Giphy GIFs for a word or phrase.
client.gifs.search(
{
q: 'lol cats'
},
function(err, data) {
if (!err) {
console.log(data);
}
}
);
Get GIF by ID.
client.gifs.get('feqkVgjJpYtjy', function(err, data) {
if (!err) {
console.log(data);
}
});
Fetch GIFs currently trending online.
client.gifs.trending(function(err, data) {
if (!err) {
console.log(data);
}
});
Get a random sticker from Giphy's sticker collection.
client.stickers.random(function(err, data) {
if (!err) {
console.log(data);
}
});