Giter Club home page Giter Club logo

fetch-gifs's Introduction

FetchGifs

experimental Build Status

We help you fetch your GIFs, just pass in the search term and you are good to go! Fetch-gif requires a search term and optional arguments(offset and limit) and returns a Promise!

Getting Started?

Simple! Just run: npm install -save fetch-gifs

A Simple Request

let name = 'star wars';

fetchGifs(name).then(res => {
  console.log(res);
})
.catch(error => {
  console.log(error);
});

A Simple Response

{
  data: [
    0: {
      "large": "https://media1.giphy.com/media/SG5W75KgppVq8/giphy.gif",
      "large_fixed": "https://media1.giphy.com/media/SG5W75KgppVq8/giphy_s.gif",
      "medium": "...",
      "medium_fixed": "https://...",
      "small: "https://...",
      "small_fixed": "https://..."
    },
    1: { ... }
    2: { ... }
  ],
  more: true
}

More on FetchGifs

We limited the number of gifs served to each user to 30, do you need more or less? Let's try writing something else

const name = 'star wars';
const limit = 20;

fetchGifs(name, { limit }).then(res => {
  console.log(res); // res.data length equals 20
})
.catch(error => {
  console.log(error);
});
Making use of offset?

The default offset is set to 0. Let's try searching from the the 20th position to the 40th

const name = 'star wars';
const limit = 20;
const offset = 40;

fetchGifs(name, { offset, limit }).then(res => {
  console.log(res); // res.data length equals 20, starts from position 20, stops at 40
})
.catch(error => {
  console.log(error);
});

Not using NodeJS?

You can also make use of fetch-gifs, just grab our latest release here

Example

Contributing

Contributing to this repo is simple. We prefer single quotes, descriptive commit messages, commiting to a new branch indicating what changed e.g fix/fixed-async-flow, feature/added-test, feat/added-test. Push the new branch!

fetch-gifs's People

Contributors

ooade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fetch-gifs's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.