Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flyclops/tenor_dart
A package for interfacing with Tenor's GIF search directly in Dart using HTTP.
https://github.com/flyclops/tenor_dart
dart dart-library dartlang flutter flutter-package gif gif-picker gifs http tenor
Last synced: about 1 month ago
JSON representation
A package for interfacing with Tenor's GIF search directly in Dart using HTTP.
- Host: GitHub
- URL: https://github.com/flyclops/tenor_dart
- Owner: Flyclops
- License: bsd-3-clause
- Created: 2024-09-03T13:49:00.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-25T17:17:11.000Z (3 months ago)
- Last Synced: 2024-10-13T08:41:23.224Z (2 months ago)
- Topics: dart, dart-library, dartlang, flutter, flutter-package, gif, gif-picker, gifs, http, tenor
- Language: Dart
- Homepage:
- Size: 5.2 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Tenor Dart
This package integrates [Tenor GIF search](https://tenor.com/) into [Dart](https://dart.dev/) by utilizing the [http](https://pub.dev/packages/http) package to communicate directly with the [Tenor API V2](https://developers.google.com/tenor/guides/quickstart).
Currently supported endpoints include: [search](https://developers.google.com/tenor/guides/endpoints#search), [featured](https://developers.google.com/tenor/guides/endpoints#featured), [categories](https://developers.google.com/tenor/guides/endpoints#categories), [search suggestions](https://developers.google.com/tenor/guides/endpoints#search-suggestions), [autocomplete](https://developers.google.com/tenor/guides/endpoints#autocomplete), [trending search terms](https://developers.google.com/tenor/guides/endpoints#trending-search), [register share](https://developers.google.com/tenor/guides/endpoints#register-share) and [posts](https://developers.google.com/tenor/guides/endpoints#posts).
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](https://developers.google.com/tenor/guides/quickstart).
- Tenor requires proper [attribution](https://developers.google.com/tenor/guides/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](https://console.cloud.google.com)
2. Create a [new project](https://console.cloud.google.com/projectcreate)
3. Go to the Google Cloud Marketplace and find the [Tenor API](https://console.cloud.google.com/marketplace/product/google/tenor.googleapis.com)
4. Click `Enable` to activate it
5. In the navigation menu, go to the `APIs & Services` tab and select [Credentials](https://console.cloud.google.com/apis/credentials)
6. Click `+ Create Credentials` and choose `API key`
7. Copy the generated API key
8. Provide this API key as a parameter to `Tenor(apiKey: 'YOUR_API_KEY')`## 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](https://developers.google.com/tenor/guides/quickstart). It's **strongly recommended** to also pass in a `clientKey` as this will help you distinguish which project is making the requests.
```
final 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](https://github.com/Flyclops/tenor_dart/blob/main/example/lib/main.dart).
Here is how you can get 20 of the latest [featured](https://developers.google.com/tenor/guides/endpoints#featured) GIFs and print the first one.
```
final tenorClient = Tenor(apiKey: 'YOUR_API_KEY', clientKey: 'YOUR_PROJECT_NAME');
final TenorResponse? response = await tenorClient.featured(limit: 20);
final List? 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](https://github.com/Flyclops/tenor_flutter), which is designed based on the [Tenor SDK](https://developers.google.com/tenor/guides/quickstart#launch-search) [guidelines](https://developers.google.com/tenor/guides/attribution).
You can see a live example of it in our mobile game [Domino!](https://flyclops.com/games/domino.html) It's in chat.
## Sponsors
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
- Further improvements## Contributing
If you read this far then you are awesome! There are a multiple ways in which you can [contribute](https://github.com/Flyclops/tenor_dart/blob/main/CONTRIBUTING.md):
- Pick up any issue marked with "[good first issue](https://github.com/flyclops/tenor_dart/issues?q=is:open+is:issue+label:%22good+first+issue%22)"
- Propose any feature, enhancement
- Report a bug
- Fix a bug
- Write and improve some documentation
- Send in a Pull Request 🙏