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

edison-giphy-js-sdk-core

v1.0.5

Published

The **Giphy Core SDK** is a wrapper around [Giphy API](https://github.com/Giphy/GiphyAPI).

Downloads

2

Readme

Giphy Core SDK for JS

The Giphy Core SDK is a wrapper around Giphy API.

Build Status npm version Downloads

Giphy is the best way to search, share, and discover GIFs on the Internet. Similar to the way other search engines work, the majority of our content comes from indexing based on the best and most popular GIFs and search terms across the web. We organize all those GIFs so you can find the good content easier and share it out through your social channels. We also feature some of our favorite GIF artists and work with brands to create and promote their original GIF content.

Getting Started

Supported End-points

Setup

Require Module

npm

npm install --save giphy-js-sdk-core

Initialize Giphy SDK

var GphApiClient = require('giphy-js-sdk-core')
client = GphApiClient("YOUR_API_KEY")

Search Endpoint

Search all Giphy GIFs for a word or phrase. Punctuation will be stripped and ignored.

Required Params

  • "q" - string - search query term or phrase

Optional Params

  • "limit" - integer - number of results to return, maximum 100. Default 25.
  • "offset" - integer - results offset, defaults to 0.
  • "rating" - string - limit results to those rated (y,g, pg, pg-13 or r).
  • "lang" - string - specify default country for regional content; format is 2-letter ISO 639-1 country code. See list of supported languages here
  • "fmt" - string - return results in html or json format (useful for viewing responses as GIFs to debug/test)
  • "sort" - string - the sort order of the results returned (recent | relevant)
/// Gif Search
client.search('gifs', {"q": "cats"})
  .then((response) => {
    response.data.forEach((gifObject) => {
      console.log(gifObject)
    })
  })
  .catch((err) => {

  })

/// Sticker Search
client.search('stickers', {"q": "cats"})
  .then((response) => {

  })
  .catch((err) => {

  })

Trending Endpoint

Fetch GIFs currently trending online. Hand curated by the Giphy editorial team. The data returned mirrors the GIFs showcased on the Giphy homepage. Required Params

  • none

Optional Params

  • "limit" - integer - number of results to return, maximum 100. Default 25.
  • "rating" - string - limit results to those rated (y,g, pg, pg-13 or r).
  • "fmt" - string - return results in html or json format (useful for viewing responses as GIFs to debug/test)
/// Trending Gifs
client.trending("gifs", {})
  .then((response) => {

  })
  .catch((err) => {

  })

/// Trending Stickers
client.trending("stickers", {})
  .then((response) => {

  })
  .catch((err) => {

  })

Translate Endpoint

The translate API draws on search, but uses the Giphy "special sauce" to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. Example implementations of translate can be found in the Giphy Slack, Hipchat, Wire, or Dasher integrations. Use a plus or url encode for phrases. Required Params

  • "s" - string - term or phrase to translate into a GIF

Optional Params

  • "rating" - (optional) limit results to those rated (y,g, pg, pg-13 or r).
  • "lang" - (optional) specify default country for regional content; format is 2-letter ISO 639-1 country code. See list of supported langauges here
  • "fmt" - (optional) return results in html or json format (useful for viewing responses as GIFs to debug/test)
/// Translate to a Gif
client.translate('gifs', {"s": 'cool'})
  .then((response) => {

  })
  .catch((err) => {

  })

/// Translate to a Sticker
client.translate('stickers', {"s": 'cool'})
  .then((response) => {

  })
  .catch((err) => {

  })

Random Endpoint

Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the Giphy catalog. Required Params

  • none

Optional Params

  • "tag" - string - the GIF tag to limit randomness by
  • "rating" - string - limit results to those rated (y,g, pg, pg-13 or r).
  • "fmt" - (optional) return results in html or json format (useful for viewing responses as GIFs to debug/test)
/// Random Gif
client.random('gifs', {})
  .then((response) => {

  })
  .catch((err) => {

  })
  
/// Random Sticker
client.random('stickers', {})
  .then((response) => {

  })
  .catch((err) => {

  })

Get GIF by ID Endpoint

Returns meta data about a GIF, by GIF id. In the below example, the GIF ID is "feqkVgjJpYtjy" Required Params

  • none

Optional Params

  • none
/// Gif by Id
client.gifByID("feqkVgjJpYtjy")
  .then((response) => {

  })
  .catch((err) => {

  })

Get GIFs by IDs Endpoint

A multiget version of the get GIF by ID endpoint. In this case the IDs are feqkVgjJpYtjy and 7rzbxdu0ZEXLy. Required Params

  • "ids" - a comma separated list of IDs to fetch GIF size data.

Optional Params

  • none
/// Gifs by Ids

client.gifsByIDs({"ids": ["feqkVgjJpYtjy", "7rzbxdu0ZEXLy"]})
  .then((response) => {

  })
  .catch((err) => {

  })

Categories Endpoint

Fetch Giphy categories Required Params

  • none

Optional Params

  • "limit" - integer - number of results to return, maximum 100. Default 25.
  • "offset" - integer - results offset, defaults to 0.
/// Gifs by Ids

client.categoriesForGifs({})
  .then((response) => {

  })
  .catch((err) => {

  })

Subcategories Endpoint

Get Subcategories for GIFs given a category. You will need this subcategory object to pull GIFs for this category. Required Params

  • none

Optional Params

  • "limit" - integer - number of results to return, maximum 100. Default 25.
  • "offset" - integer - results offset, defaults to 0.
/// Gifs by Ids

client.subCategoriesForGifs("tv", {})
  .then((response) => {

  })
  .catch((err) => {

  })

Subcategory Content Endpoint

Get GIFs for a given Sub-Category. Required Params

  • none

Optional Params

  • "limit" - integer - number of results to return, maximum 100. Default 25.
  • "offset" - integer - results offset, defaults to 0.
/// Gifs by Ids

client.gifsByCategories("tv", "'the office'", {})
  .then((response) => {

  })
  .catch((err) => {

  })

Term Suggestions Endpoint

Get term suggestions given a search term, or a substring. Required Params

  • none

Optional Params

  • none
/// Gifs by Ids

client.termSuggestions("cool")
  .then((response) => {
 
  })
  .catch((err) => {
 
  })