Giter Club home page Giter Club logo

gif-provider's Introduction

⚠️ This package is no longer maintained.

gif-provider

A JavaScript module to search for gifs

npm package License: MIT

gif-provider is a JavaScript module that allows you to query 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 class implementing the GifStrategy interface.

The module includes its own optional typings for TypeScript.

See the API documentation here.

Example Usage

const {
    GifProviderBuilder,
    GiphyStrategy,
    TenorStrategy,
    GiphyClient,
    TenorClient,
} = require('@jych/gif-provider');

const builder = new GifProviderBuilder();

// Querying Giphy

const giphyStrategy = new GiphyStrategy(
    GiphyClient.init('my-giphy-api-key').some()
);

builder.addStrategy(giphyStrategy);

const gifProvider = builder.build();

const gifs = await gifProvider.search("rat mouse"); // gifs is an array of results from giphy

// Querying Giphy and Tenor

const tenorStrategy = new TenorStrategy(
    TenorClient.init('my-tenor-api-key').some()
);

builder.addStrategy(tenorStrategy);

const gifProvider2 = builder.build();

const gifs = await gifProvider.search("rat mouse"); // gifs is a flat array of results from each site

Docs

Generate a local copy of the docs for offline use:

yarn install
yarn generate-docs
open docs/index.html

Contributing

This package is no longer being maintained.

Contributions, issues and feature requests are no longer welcome! Feel free to check the issues page for an idea of where to get started. Contributors must follow the contributing guide and code of conduct.

License

Copyright © 2020 James Young.
This project is MIT licensed. See LICENSE for more details.

gif-provider's People

Contributors

jamescallumyoung avatar mariandaniel24 avatar saravananselvamohan avatar sethetter avatar

Stargazers

 avatar

Watchers

 avatar  avatar

gif-provider's Issues

Add formatting

In order to satisfy the linting / formatting requirement of #7, we need to add a formatter and linter to the project.

Eslint, via ezlint is recommended for the linter.
Prettier is recommended for the formatter.
Husky is recommended for automattion.

Enable strict option in TypeScript config

Is your feature request related to a problem? Please describe.
N/A

Describe the solution you'd like
In order to improve the developer experience, the strict option in tsconfig should be set to true. The strict option enables all other 'strict' checks and is the recommended way to use TypeScript.

This change will require the package to be recompiled so any compile-time issues can be caught.

Describe alternatives you've considered
We could leave it as-is but strict is recomended by TS.

Additional context
N/A

Evaluate using GitHub Actions for publishing to NPM

Publishing is currently done manually whenever a new version is ready. GitHub Actions could provide an automated method for publishing updates to NPM.

Additionally, GH Actions provides an out-of-the-box action for publishing to NPM that it may be possible to use, that also publishes the module to the GH project-repo too (a nice-to-have).

We would have to look into how version tagging works. It is imperative that the NPM releases are not messed up by any changes.

Migrate to yarn

We prefer yarn over NPM as it is more feature-rich and more popular in the JS/TS community. As a result, we want to migrate this project to use yarn.

  • replace uses of npm with yarn in package.json
  • replace package-lock.json with yarn.lock
  • update the documentation

Reduce build size

Is your feature request related to a problem? Please describe.
The build size will grow quite a lot if #17 is merged due to adding the ramda and monet libraries.

Describe the solution you'd like
Add rollup to the build step (using @rollup/plugin-typescript) to reduce the bundle size through tree-shaking and dead code elimination.

Describe alternatives you've considered
Webpack is another popular bundler though it's treeshaking is reportedly worse.
Snowpack is an another up-and-coming alternative.

Additional context
Tree-shaking may be improved (even without a bundler) by optimising imports when building ES modules.

Evaluate usage of publish-please

We decided to use publish-pleasebased on experience with it at the time this project was created. As the NPM ecosystem has matured in that time, it seems sensible to (re)evaluate the use of publish-please over just using yarn publish.

Support Gfycat

Is your feature request related to a problem? Please describe.
N/A

Describe the solution you'd like
Gifcat is one of the biggest Gif sites, and has an API available. We should support Gyfcat as a provider backend.

The solution MUST follow the patterns used elsewhere in the project. In particular, the Strategy Pattern (TS example) MUST be used as in the GiphyStrategy. Ideally, the Client would be implemented as a Singleton (TS example) too.

Describe alternatives you've considered
N/A

Additional context
From a cursory glance, their API looked more complex than Giphy and Tenor's.
An suitable NPM package may already be available for Gfycat since they are so popular.

Implement a CI pipeline

A CI /CD pipeline that enables robust automated testing, reporting, and releasing is required.

Current status:

  • depedency updates are managed by Dependabot
  • releases are done manually
  • tests are run manually
  • formating (linting & pretty-printing) is not done

The ideal solution would tackle all of the above formatting (pretty-printing and linting), and testing. Release management will be tackled in a seperate CD issue.

Remove old GitLab config files

This project was previously hosted on GitLab and some GitLab-specific config files can still be found in the repo. These should be removed.

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.