1.4.18 • Published 6 years ago

gfycat-sdk v1.4.18

Weekly downloads
2,335
License
MIT
Repository
github
Last release
6 years ago

gfycat-sdk

NPM

Build Status

Javascript API wrapper for Gfycat.com API that supports callbacks and promises.

Installation

npm install gfycat-sdk --save

Usage

Obtain a client_id and client_secret for your integration from the Gfycat developers portal.

const Gfycat = require('gfycat-sdk');

var gfycat = new Gfycat({clientId: YOUR_CLIENT_ID, clientSecret: YOUR_CLIENT_SECRET});

For security reasons, we suggest storing the client id and secret in a secure location.

Methods

Authenticate

Returns a callback, or promise that resolves to the api authentication token that is valid for 1 hour

Callback

gfycat.authenticate((err, data) => {
  //Your app is now authenticated
  assert.equal(data.access_token, gfycat.token);
  console.log('token', gfycat.token);
})

Promise

gfycat.authenticate().then(res => {
  //Your app is now authenticated
  assert.equal(res.access_token, gfycat.token);
  console.log('token', gfycat.token);
});

Search

Returns a promise that resolves to a gfycats object. API supports pagination using cursors and count/first. The optional random attribute will randomize the result returned by the API - do not supply pagination attributes with this.

let options = {
  search_text: 'hello',
  count: 20,
  first: 30
};

gfycat.search(options).then(data => {
  console.log('gfycats', data);
});

Get User Details

Returns user account information by username

let options = {
  userId: 'myUsername'
};

gfycat.getUserDetails(options).then(data => {
  console.log(data);
});

Get Gfycat Details

Return Gfycat json by gfycat name

let options = {
  gfyId: 'richpepperyferret'
};

gfycat.getGifDetails(options).then(data => console.log(data))

Get Related Content

Return a list of Gfycats related to the one provided.

let options = {
  gfyId: 'richpepperyferret'
};

gfycat.getRelatedContent(options).then(data => console.log(data))

Get User Feed

Return the gfycats uploaded and shared by a given username.

let options = {
  userId: 'myUsername'
};

gfycat.userFeed(options).then(data => console.log(data))

Get Trending GIFs

Return JSON of currently trending gifs

let options = {
  count: 10,
  cursor: ''
}

gfycat.trendingGifs(options).then(data => console.log(data))

Get Trending Tags

Return JSON of currently trending tags

let options = {
  count: 10,
  populated: false
}

gfycat.trendingTags(options).then(data => console.log(data))
1.4.18

6 years ago

1.4.17

6 years ago

1.4.16

6 years ago

1.4.15

6 years ago

1.4.14

6 years ago

1.4.13

6 years ago

1.4.12

6 years ago

1.4.11

6 years ago

1.4.10

7 years ago

1.4.9

7 years ago

1.4.8

7 years ago

1.4.7

7 years ago

1.4.6

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago