Class TenorClient
A client for interacting with the Tenor API
Inheritance
Inherited Members
Namespace: Tenor
Assembly: Tenor.dll
Syntax
public class TenorClient
Constructors
| Improve this Doc View SourceTenorClient(String)
Create a new client
Declaration
public TenorClient(string apiKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | apiKey | Key for calls to the API |
TenorClient(String, IHttpClientFactory)
Create a new client
Declaration
public TenorClient(string apiKey, IHttpClientFactory clientFactory)
Parameters
Type | Name | Description |
---|---|---|
System.String | apiKey | Key for calls to the API |
IHttpClientFactory | clientFactory | HTTP client provider to use |
TenorClient(String, HttpClient)
Create a new client
Declaration
public TenorClient(string apiKey, HttpClient httpClient)
Parameters
Type | Name | Description |
---|---|---|
System.String | apiKey | Key for calls to the API |
System.Net.Http.HttpClient | httpClient | Existing HTTP client to use |
TenorClient(TenorConfiguration)
Create a new client
Declaration
public TenorClient(TenorConfiguration config)
Parameters
Type | Name | Description |
---|---|---|
TenorConfiguration | config | Configuration settings to use for client |
TenorClient(TenorConfiguration, IHttpClientFactory)
Create a new client
Declaration
public TenorClient(TenorConfiguration config, IHttpClientFactory clientFactory)
Parameters
Type | Name | Description |
---|---|---|
TenorConfiguration | config | Configuration settings to use for client |
IHttpClientFactory | clientFactory | HTTP client provider to use |
TenorClient(TenorConfiguration, HttpClient)
Create a new client
Declaration
public TenorClient(TenorConfiguration config, HttpClient httpClient)
Parameters
Type | Name | Description |
---|---|---|
TenorConfiguration | config | Configuration settings to use for client |
System.Net.Http.HttpClient | httpClient | Existing HTTP client to use |
Methods
| Improve this Doc View SourceGetAutocompleteSuggestionsAsync(String, Nullable<Int32>)
Get autocomplete suggestions for a partial query
Declaration
public Task<IEnumerable<string>> GetAutocompleteSuggestionsAsync(string query, int? limit = default(int? ))
Parameters
Type | Name | Description |
---|---|---|
System.String | query | Partial query |
System.Nullable<System.Int32> | limit | Maximum number of suggestions to retrieve |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>> | Suggested search queries in provided culture |
GetCategoriesAsync()
Declaration
public Task<CategoryResult> GetCategoriesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<CategoryResult> |
GetPostAsync(String)
Get a single post by ID
Declaration
public Task<ImagePost> GetPostAsync(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | ID of the post |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ImagePost> | A single post, if found |
GetPostsAsync(IEnumerable<String>, Nullable<Int32>)
Get a collection of posts by ID
Declaration
public Task<GifQueryResult> GetPostsAsync(IEnumerable<string> ids, int? limit = default(int? ))
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | ids | IDs of the posts |
System.Nullable<System.Int32> | limit | Maximum # of posts to fetch |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<GifQueryResult> | Matching posts |
GetPostsAsync(String[])
Get a collection of posts by ID
Declaration
public Task<GifQueryResult> GetPostsAsync(params string[] ids)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | ids | IDs of the posts |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<GifQueryResult> | Matching posts |
GetRandomPostsAsync(String, Nullable<Int32>, String)
Get random GIFs matching a search query
Declaration
public Task<GifQueryResult> GetRandomPostsAsync(string query, int? limit = default(int? ), string position = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | Query to search on |
System.Nullable<System.Int32> | limit | Maximum number of posts to retrieve |
System.String | position | Position to start search from when using pagination |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<GifQueryResult> | Result set |
GetSearchSuggestionsAsync(String, Nullable<Int32>)
Get related search suggestions to your current query
Declaration
public Task<IEnumerable<string>> GetSearchSuggestionsAsync(string query, int? limit = default(int? ))
Parameters
Type | Name | Description |
---|---|---|
System.String | query | Current query |
System.Nullable<System.Int32> | limit | Maximum number of suggestions |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>> | Suggested search queries in provided culture |
GetTrendingPostsAsync(Nullable<Int32>, String)
Get a list of the current global trending GIFs
Declaration
public Task<GifQueryResult> GetTrendingPostsAsync(int? limit = default(int? ), string position = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | limit | Maximum number of posts to retrieve |
System.String | position | Position to start search from when using pagination |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<GifQueryResult> | Result set |
Remarks
The trending stream is updated regularly throughout the day
GetTrendingTermsAsync(Nullable<Int32>)
Get currently trending search terms
Declaration
public Task<IEnumerable<string>> GetTrendingTermsAsync(int? limit = default(int? ))
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | limit | Maximum number of search terms to retrieve |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>> | Suggested search queries in provided culture |
RecordShareAsync(String, String)
Tell tenor that a GIF has been shared
Declaration
public Task RecordShareAsync(string id, string query)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | ID of post that was shared |
System.String | query | Query that was used when searching |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
This helps Tenor's analytics to improve search results
SearchAsync(String, Nullable<Int32>, String)
Perform a search for GIFs by keywords
Declaration
public Task<SearchResult> SearchAsync(string query, int? limit = default(int? ), string position = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | Query to search on |
System.Nullable<System.Int32> | limit | Maximum number of posts to retrieve |
System.String | position | Position to start search from when using pagination |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<SearchResult> | Result set |
SearchAsync(Category, Nullable<Int32>, String)
Search for GIFs by tag
Declaration
public Task<SearchResult> SearchAsync(Category category, int? limit = default(int? ), string position = null)
Parameters
Type | Name | Description |
---|---|---|
Category | category | Category to search by |
System.Nullable<System.Int32> | limit | Maximum number of posts to retrieve |
System.String | position | Position to start search from when using pagination |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<SearchResult> | Result set |