https://github.com/cielsachen/tenor-api-wrapper
Tenor API Wrapper provides a simple way to interact with the Tenor API (v2).
https://github.com/cielsachen/tenor-api-wrapper
api-wrapper nodejs tenor tenor-api typescript wrapper
Last synced: 4 months ago
JSON representation
Tenor API Wrapper provides a simple way to interact with the Tenor API (v2).
- Host: GitHub
- URL: https://github.com/cielsachen/tenor-api-wrapper
- Owner: CielSachen
- License: mit
- Created: 2024-05-01T16:04:17.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-22T09:09:03.000Z (about 1 year ago)
- Last Synced: 2024-05-22T12:50:55.146Z (about 1 year ago)
- Topics: api-wrapper, nodejs, tenor, tenor-api, typescript, wrapper
- Language: TypeScript
- Homepage:
- Size: 87.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Tenor API Wrapper
[](https://github.com/nodejs/node)
[](https://github.com/prettier/prettier)A Node.js package that provides a wrapper for simplifying interactions with [Tenor's API (v2)](https://developers.google.com/tenor/guides/quickstart). It handles getting GIFs, GIF categories, search terms, and registering GIF share events.
## Installation
> [!IMPORTANT]
> My packages are available in GitHub packages, **NOT** npm; therefore, you must define the registry of the `@cielsachen` namespace in a `.npmrc` file:
>
> ```properties
> @cielsachen:registry=https://npm.pkg.github.com
> ``````bash
pnpm add @cielsachen/tenor-api-wrapper
```## Usage
> [!WARNING]
> Because this package does not have validations for the parameters passed onto the methods, [TypeScript](https://www.typescriptlang.org/) is required.This package exports the `TenorApi` class; you must create a new instance of this class and passing your Tenor API key as its first argument:
```ts
import { TenorApi } from "@cielsachen/tenor-api-wrapper";const tenorApi = new TenorApi(process.end.TENOR_KEY);
```You can also set global parameters by passing an object containing the parameters as the second argument:
```ts
const tenorApi = new TenorApi(process.end.TENOR_KEY, {
clientKey: "my_test_app",
locale: "ko",
});
```### Example
Here's a simple example of getting eight GIFs:
```ts
import { TenorApi } from "@cielsachen/tenor-api-wrapper";const tenorApi = new TenorApi(process.end.TENOR_KEY, {
clientKey: "my_test_app",
});try {
const { results: gifs } = tenorApi.getGifsBySearch("excited", { limit 8 });// Handle the gifs.
} catch (error) {
// Handle any thrown errors.
}
```