tenor_dart 0.0.1 copy "tenor_dart: ^0.0.1" to clipboard
tenor_dart: ^0.0.1 copied to clipboard

A client for interacting with the Tenor API directly in Dart. Supports all the major endpoints such as featured (trending), search, categories, etc.

Tenor Dart #

Tenor Dart Pub Package License BSD 3-Clause Tenor Dart Issues Tenor Dart Issues

This package integrates Tenor GIF search into Dart by utilizing the http package to communicate directly with the Tenor API V2.

Currently supported endpoints include: search, featured, categories, search suggestions, autocomplete, trending search terms, register share and posts.

Tenor Dart Demo

Show some ❤️ and star the repo to support this package.

What to know #

  • In order to start using Tenor Dart you must obtain an API key by registering your project with Tenor.
  • Tenor requires proper attribution for projects using their API. This package does not handle the attribution process, so you will need to take care of it yourself.

Obtaining Tenor API v2 key #

  1. Log in to the Google Cloud Console
  2. Create a new project
  3. Go to the Google Cloud Marketplace and find the Tenor API
  4. Click Enable to activate it
  5. In the navigation menu, go to the APIs & Services tab and select Credentials
  6. Click + Create Credentials and choose API key
  7. Copy the generated API key
  8. Provide this API key as a parameter to TenorClient

Usage #

Installation #

dart pub add tenor_dart

Having trouble? Read the pub.dev installation page.

Import #

Import the package into the dart file where it will be used:

import 'package:tenor_dart/tenor_dart.dart';

Initialize #

You must pass in a valid apiKey provided by Tenor. It's strongly recommended to also pass in a clientKey as this will help you distinguish which project is making the requests.

var tenorClient = Tenor(apiKey: 'YOUR_API_KEY', clientKey: 'YOUR_PROJECT_NAME');

Example #

For an example on each endpoint feel free to check out example/lib/main.dart.

Here is how you can get 20 of the latest featured GIFs and print the first one.

var tenorClient = Tenor(apiKey: 'YOUR_API_KEY', clientKey: 'YOUR_PROJECT_NAME');
final TenorResponse? response = await tenorClient.featured(limit: 20);
final List<TenorResult>? gifs = response?.results;
print(gifs?.first.media.tinygif?.url);

Looking for a UI? #

If you're seeking a ready-made UI solution, check out Tenor Flutter, which is designed based on the Tenor SDK guidelines.

You can see a live example of it in our mobile game Domino! It's in chat.

Sponsors #

Flyclops

Domino!

Flyclops is a independent mobile games studio specializing in casual multi-player games, both asynchronous turn-based, and real-time. Flyclops’s games have been played by millions across the globe.

Domino! is super addictive, fast-paced, multiplayer dominoes done right for iOS and Android. This easy-to-learn but impossible-to-master strategy game is beautifully designed and endlessly entertaining!

What's next? #

  • Documentation
  • Tests (Contributions welcome) ^_^
  • Further improvements
2
likes
150
pub points
40%
popularity

Publisher

verified publisherflyclops.com

A client for interacting with the Tenor API directly in Dart. Supports all the major endpoints such as featured (trending), search, categories, etc.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#gif #tenor

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

http, json_annotation

More

Packages that depend on tenor_dart