tenor

Creator: coderz1093

Last updated:

Add to Cart

Description:

tenor

Tenor #

















Fetch, Search GIF more easily and customised manner from Tenor #
This library is MIT licensed, which means you can use it anywhere without any consent from justkawal, because we believe in Open-Source #
Table of Contents #

Installing
Usage
Upcoming Features

Lets Get Started #
1. Depend on it #
Add this to your package's pubspec.yaml file:
dependencies:
tenor:
copied to clipboard
2. Install it #
You can install packages from the command line:
with pub:
$ pub get
copied to clipboard
with Flutter:
$ flutter packages get
copied to clipboard
3. Import it #
Now in your Dart code, you can use:
import 'package:tenor/tenor.dart';
copied to clipboard
Usage #
Initialize Tenor #
Initialize Tenor library
Tenor tenor = Tenor(apiKey: 'ApiKey', language: TenorLanguage.English);
copied to clipboard
Select the Language Codes #
TenorLanguage provides codes for different ISO 639-1 language code
var englishCode = TenorLanguage.English;

copied to clipboard
Fetch Trending GIF #
Returns response containing a list of the current global trending GIFs. The trending stream is updated regularly throughout the day.
Important: limit: 1 <= limit <= 50
// Future<TenorResponse?> requestTrendingGIF({
// int limit = 20,
// ContentFilter contentFilter = ContentFilter.off,
// GifSize size = GifSize.all,
// MediaFilter mediaFilter = MediaFilter.minimal,
// })

Tenor tenor = Tenor(apiKey: 'Tenor Api');

// fetch trending Gif
TenorResponse? res = await tenor.requestTrendingGIF(limit: 5);
res?.results.forEach((TenorResult tenorResult) {
var title = tenorResult.title;
var media = tenorResult.media;
print('$title: gif : ${media?.gif?.previewUrl?.toString()}');
});
copied to clipboard
Search GIF #
Returns response containing a list of the searched Gif from Tenor.
Important: limit: 1 <= limit <= 50
// Future<TenorResponse?> searchGIF(
// String search, {
// int limit = 20,
// ContentFilter contentFilter = ContentFilter.off,
// GifSize size = GifSize.all,
// MediaFilter mediaFilter = MediaFilter.minimal,
// })

Tenor tenor = Tenor(apiKey: 'Tenor Api');

// search Gif
TenorResponse? res = await tenor.searchGIF('universe', limit: 5);
res?.results.forEach((TenorResult tenorResult) {
var title = tenorResult.title;
var media = tenorResult.media;
print('$title: gif : ${media?.gif?.previewUrl?.toString()}');
});
copied to clipboard
Fetch Random GIF #
Get a randomized list of GIFs for a given search term. This differs from the search function which returns a rank ordered list of GIFs for a given search term.
Important: limit: 1 <= limit <= 50
// Future<TenorResponse?> randomGIF(
// String search, {
// int limit = 20,
// ContentFilter contentFilter = ContentFilter.off,
// GifSize size = GifSize.all,
// MediaFilter mediaFilter = MediaFilter.minimal,
// })

Tenor tenor = Tenor(apiKey: 'Tenor Api');

// random Gif
TenorResponse? res = await tenor.randomGIF('universe', limit: 5);
res?.results.forEach((TenorResult tenorResult) {
var title = tenorResult.title;
var media = tenorResult.media;
print('$title: gif : ${media?.gif?.previewUrl?.toString()}');
});
copied to clipboard
Search Suggestions #
Search suggestions helps a user narrow their search or discover related search terms to find a more precise GIF. Results are returned in order of what is most likely to drive a share for a given term, based on historic user search and share behavior.
Important: limit: 1 <= limit <= 50
// Future<List<String>> searchSuggestions(
// String search, {
// int limit = 20,
// })

Tenor tenor = Tenor(apiKey: 'Tenor Api');

// suggestions
List<String> suggestions = await tenor.searchSuggestions('universe', limit: 5);
copied to clipboard
Trending search #
Returns response containing a list of the current trending search terms. The list is updated Hourly by Tenor’s AI.
Important: limit: 1 <= limit <= 50
// Future<List<String>> trendingSearch(
// int limit = 20,
// })

Tenor tenor = Tenor(apiKey: 'Tenor Api');

// trending search results
List<String> suggestions = await tenor.trendingSearch(limit: 5);
copied to clipboard
Auto complete #
Returns response containing a list of completed search terms given a partial search term. The list is sorted by Tenor’s AI and the number of results will decrease as Tenor’s AI becomes more certain.
Important: limit: 1 <= limit <= 50
// Future<List<String>> autoComplete(
// String search, {
// int limit = 20,
// })

Tenor tenor = Tenor(apiKey: 'Tenor Api');

// auto complete results
List<String> autoCompleted = await tenor.autoComplete('un', limit: 5);
copied to clipboard
Fetching Categories #
Requests Categories from tenor
// Future<List<TenorCategories?>> requestCategories({
// ContentFilter contentFilter = ContentFilter.off,
// CategoryType categoryType = CategoryType.featured,
// })

Tenor tenor = Tenor(apiKey: 'Tenor Api');

// list of categories
List<TenorCategories?> categories = await tenor.requestCategories();
copied to clipboard



Fetching Options #



key
description




limit
eg. limit the number of GIF to be fetched. limit can vary from 1 to 50


contentFilter
(values: off, low, medium, high) specify the content safety filter level. eg. contentFilter: ContentFilter.low


mediaFilter
(values: basic, minimal) Reduce the Number of GIF formats returned in response. minimal- (tinygif, gif, and mp4). basic- (nanomp4, tinygif, tinymp4, gif, mp4, and nanogif) eg. mediaFilter: MediaFilter.minimal


size
GIFs with aspect ratios that fit with in the selected range. values: (all, wide, standard), all - no constraints, wide - 0.42 <= aspect ratio <= 2.36, standard - .56 <= aspect ratio <= 1.78



Fetch Next Set of GIF Response #
fetchNext() is used to get next set of response for the current query
// Future<TenorResponse?> fetchNext({int limit = 20});

// here the fetchNext function is used to call next set of GIF which is sequenced after current response

TenorResponse? firstSetResponse = await tenor. /*.... Functions used to get TenorResponse? ....*/

TenorResponse? nextResult = await firstSetResponse?.fetchNext();

nextResult?.results.forEach((tenorResult) {
var title = tenorResult.title;
var media = tenorResult.media;
print('$title: gif : ${media?.gif?.previewUrl?.toString()}');
});
copied to clipboard
Fetching Next Options #



key
description




limit
eg. limit the number of GIF to be fetched. limit can vary from 1 to 50



Donate #

A Mac M1 would be sufficient. 😆
Paypal: https://paypal.me/kawal7415

What's next ? 🤔 #

We are thinking what we should give next after giving all these features. ( Your donation would help me to collect money to buy Mac M1 for faster work. )
If you have any new feature request then go ahead and ping me, I'll integrate it.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.