Tenor API Wrapper is a Node.js package that provides a simple way to interact with the Tenor API (v2). It wraps the various endpoints of the Tenor API and creates functions for each, allowing for quick and easy access without the need to manually handle the fetching and parsing of data.
pnpm add @cielsachen/tenor-api-wrapper
This package is published on GitHub packages, not npm. Therefore, you will need to configure your package manager to install this package from GitHub packages. Furthermore, an authentication token is required to install it.
An example using .npmrc
:
@cielsachen:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
import { Tenor } from "@cielsachen/tenor-api-wrapper";
const tenor = new Tenor(process.env.TENOR_KEY);
try {
const response = await tenor.fetchGifsByQuery("excited", {
client_key: "my_test_app",
limit: "8",
});
console.log(response.results);
} catch (err) {
console.error(err);
}
This is an example using the Search endpoint, which is wrapped by the fetchGifsByQuery()
method; it fetches a maximum of 8 different GIFs related to the search term/query "excited."
Typings and JSDoc descriptions were taken from Tenor's API Documentation and Google Cloud's APIs Errors Documentation.
Coming soon!