Documentation ¶
Overview ¶
Package tenorclient provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.9.1 DO NOT EDIT.
Index ¶
- func NewAutocompleteRequest(server string, params *AutocompleteParams) (*http.Request, error)
- func NewCategoriesRequest(server string, params *CategoriesParams) (*http.Request, error)
- func NewGifsRequest(server string, params *GifsParams) (*http.Request, error)
- func NewRandomRequest(server string, params *RandomParams) (*http.Request, error)
- func NewRegisterRequest(server string, params *RegisterParams) (*http.Request, error)
- func NewSearchRequest(server string, params *SearchParams) (*http.Request, error)
- type AnonId
- type ArRange
- type AutocompleteParams
- type AutocompleteResponse
- type AutocompleteResult
- type CategoriesParams
- type CategoriesParamsContentfilter
- type CategoriesParamsType
- type CategoriesResponse
- type CategoriesResult
- type CategoryObject
- type Client
- func (c *Client) Autocomplete(ctx context.Context, params *AutocompleteParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) Categories(ctx context.Context, params *CategoriesParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) Gifs(ctx context.Context, params *GifsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) Random(ctx context.Context, params *RandomParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) Register(ctx context.Context, params *RegisterParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) Search(ctx context.Context, params *SearchParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) AutocompleteWithResponse(ctx context.Context, params *AutocompleteParams, reqEditors ...RequestEditorFn) (*AutocompleteResponse, error)
- func (c *ClientWithResponses) CategoriesWithResponse(ctx context.Context, params *CategoriesParams, reqEditors ...RequestEditorFn) (*CategoriesResponse, error)
- func (c *ClientWithResponses) GifsWithResponse(ctx context.Context, params *GifsParams, reqEditors ...RequestEditorFn) (*GifsResponse, error)
- func (c *ClientWithResponses) RandomWithResponse(ctx context.Context, params *RandomParams, reqEditors ...RequestEditorFn) (*RandomResponse, error)
- func (c *ClientWithResponses) RegisterWithResponse(ctx context.Context, params *RegisterParams, reqEditors ...RequestEditorFn) (*RegisterResponse, error)
- func (c *ClientWithResponses) SearchWithResponse(ctx context.Context, params *SearchParams, reqEditors ...RequestEditorFn) (*SearchResponse, error)
- type ClientWithResponsesInterface
- type Contentfilter
- type GifObject
- type GifsParams
- type GifsParamsMediaFilter
- type GifsResponse
- type HttpRequestDoer
- type Id
- type Ids
- type Key
- type Limit
- type Locale
- type Media
- type MediaFilter
- type MediaObject
- type Next
- type Pos
- type Q
- type RandomParams
- type RandomParamsArRange
- type RandomParamsContentfilter
- type RandomParamsMediaFilter
- type RandomResponse
- type RegisterParams
- type RegisterResponse
- type RegisterResult
- type RequestEditorFn
- type SearchParams
- type SearchParamsArRange
- type SearchParamsContentfilter
- type SearchParamsMediaFilter
- type SearchResponse
- type SearchResult
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAutocompleteRequest ¶
func NewAutocompleteRequest(server string, params *AutocompleteParams) (*http.Request, error)
NewAutocompleteRequest generates requests for Autocomplete
func NewCategoriesRequest ¶
func NewCategoriesRequest(server string, params *CategoriesParams) (*http.Request, error)
NewCategoriesRequest generates requests for Categories
func NewGifsRequest ¶
func NewGifsRequest(server string, params *GifsParams) (*http.Request, error)
NewGifsRequest generates requests for Gifs
func NewRandomRequest ¶
func NewRandomRequest(server string, params *RandomParams) (*http.Request, error)
NewRandomRequest generates requests for Random
func NewRegisterRequest ¶
func NewRegisterRequest(server string, params *RegisterParams) (*http.Request, error)
NewRegisterRequest generates requests for Register
func NewSearchRequest ¶
func NewSearchRequest(server string, params *SearchParams) (*http.Request, error)
NewSearchRequest generates requests for Search
Types ¶
type AutocompleteParams ¶
type AutocompleteParams struct { // a search string Q Q `json:"q"` // client key for privileged API access Key Key `json:"key"` // specify default language to interpret search string; xx is ISO 639-1 language code, _YY (optional) is 2-letter ISO 3166-1 country code Locale *Locale `json:"locale,omitempty"` // fetch up to a specified number of results (max: 50). Limit *Limit `json:"limit,omitempty"` // specify the anonymous_id tied to the given user AnonId *AnonId `json:"anon_id,omitempty"` }
AutocompleteParams defines parameters for Autocomplete.
type AutocompleteResponse ¶
type AutocompleteResponse struct { Body []byte HTTPResponse *http.Response JSON200 *AutocompleteResult }
func ParseAutocompleteResponse ¶
func ParseAutocompleteResponse(rsp *http.Response) (*AutocompleteResponse, error)
ParseAutocompleteResponse parses an HTTP response from a AutocompleteWithResponse call
func (AutocompleteResponse) Status ¶
func (r AutocompleteResponse) Status() string
Status returns HTTPResponse.Status
func (AutocompleteResponse) StatusCode ¶
func (r AutocompleteResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type AutocompleteResult ¶
type AutocompleteResult struct { // An array of suggested search terms. Results []string `json:"results"` }
AutocompleteResult defines model for AutocompleteResult.
type CategoriesParams ¶
type CategoriesParams struct { // client key for privileged API access Key Key `json:"key"` // specify default language to interpret search string; xx is ISO 639-1 language code, _YY (optional) is 2-letter ISO 3166-1 country code Locale *Locale `json:"locale,omitempty"` // (values: featured | emoji | trending ) determines the type of categories returned Type *CategoriesParamsType `json:"type,omitempty"` // (values: off | low | medium | high) specify the content safety filter level Contentfilter *CategoriesParamsContentfilter `json:"contentfilter,omitempty"` // specify the anonymous_id tied to the given user AnonId *AnonId `json:"anon_id,omitempty"` }
CategoriesParams defines parameters for Categories.
type CategoriesParamsContentfilter ¶
type CategoriesParamsContentfilter string
CategoriesParamsContentfilter defines parameters for Categories.
type CategoriesParamsType ¶
type CategoriesParamsType string
CategoriesParamsType defines parameters for Categories.
type CategoriesResponse ¶
type CategoriesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *CategoriesResult }
func ParseCategoriesResponse ¶
func ParseCategoriesResponse(rsp *http.Response) (*CategoriesResponse, error)
ParseCategoriesResponse parses an HTTP response from a CategoriesWithResponse call
func (CategoriesResponse) Status ¶
func (r CategoriesResponse) Status() string
Status returns HTTPResponse.Status
func (CategoriesResponse) StatusCode ¶
func (r CategoriesResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type CategoriesResult ¶
type CategoriesResult struct { // an array of CategoryObjects where the “name” field has been translated to the passed in locale language. Tags []CategoryObject `json:"tags"` }
CategoriesResult defines model for CategoriesResult.
type CategoryObject ¶
type CategoryObject struct { // a url to the media source for the category's example GIF Image string `json:"image"` // Category name to overlay over the image. The name will be translated to match the locale of the corresponding request Name string `json:"name"` // the search url to request if the user selects the category Path string `json:"path"` // the English search term that corresponds to the category Searchterm string `json:"searchterm"` }
CategoryObject defines model for CategoryObject.
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn }
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) Autocomplete ¶
func (c *Client) Autocomplete(ctx context.Context, params *AutocompleteParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) Categories ¶
func (c *Client) Categories(ctx context.Context, params *CategoriesParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) Gifs ¶
func (c *Client) Gifs(ctx context.Context, params *GifsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) Random ¶
func (c *Client) Random(ctx context.Context, params *RandomParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) Register ¶
func (c *Client) Register(ctx context.Context, params *RegisterParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, params *SearchParams, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface { // Autocomplete request Autocomplete(ctx context.Context, params *AutocompleteParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Categories request Categories(ctx context.Context, params *CategoriesParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Gifs request Gifs(ctx context.Context, params *GifsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Random request Random(ctx context.Context, params *RandomParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Register request Register(ctx context.Context, params *RegisterParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Search request Search(ctx context.Context, params *SearchParams, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) AutocompleteWithResponse ¶
func (c *ClientWithResponses) AutocompleteWithResponse(ctx context.Context, params *AutocompleteParams, reqEditors ...RequestEditorFn) (*AutocompleteResponse, error)
AutocompleteWithResponse request returning *AutocompleteResponse
func (*ClientWithResponses) CategoriesWithResponse ¶
func (c *ClientWithResponses) CategoriesWithResponse(ctx context.Context, params *CategoriesParams, reqEditors ...RequestEditorFn) (*CategoriesResponse, error)
CategoriesWithResponse request returning *CategoriesResponse
func (*ClientWithResponses) GifsWithResponse ¶
func (c *ClientWithResponses) GifsWithResponse(ctx context.Context, params *GifsParams, reqEditors ...RequestEditorFn) (*GifsResponse, error)
GifsWithResponse request returning *GifsResponse
func (*ClientWithResponses) RandomWithResponse ¶
func (c *ClientWithResponses) RandomWithResponse(ctx context.Context, params *RandomParams, reqEditors ...RequestEditorFn) (*RandomResponse, error)
RandomWithResponse request returning *RandomResponse
func (*ClientWithResponses) RegisterWithResponse ¶
func (c *ClientWithResponses) RegisterWithResponse(ctx context.Context, params *RegisterParams, reqEditors ...RequestEditorFn) (*RegisterResponse, error)
RegisterWithResponse request returning *RegisterResponse
func (*ClientWithResponses) SearchWithResponse ¶
func (c *ClientWithResponses) SearchWithResponse(ctx context.Context, params *SearchParams, reqEditors ...RequestEditorFn) (*SearchResponse, error)
SearchWithResponse request returning *SearchResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // Autocomplete request AutocompleteWithResponse(ctx context.Context, params *AutocompleteParams, reqEditors ...RequestEditorFn) (*AutocompleteResponse, error) // Categories request CategoriesWithResponse(ctx context.Context, params *CategoriesParams, reqEditors ...RequestEditorFn) (*CategoriesResponse, error) // Gifs request GifsWithResponse(ctx context.Context, params *GifsParams, reqEditors ...RequestEditorFn) (*GifsResponse, error) // Random request RandomWithResponse(ctx context.Context, params *RandomParams, reqEditors ...RequestEditorFn) (*RandomResponse, error) // Register request RegisterWithResponse(ctx context.Context, params *RegisterParams, reqEditors ...RequestEditorFn) (*RegisterResponse, error) // Search request SearchWithResponse(ctx context.Context, params *SearchParams, reqEditors ...RequestEditorFn) (*SearchResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type Contentfilter ¶
type Contentfilter string
Contentfilter defines model for contentfilter.
const ( False Contentfilter = "false" High Contentfilter = "high" Low Contentfilter = "low" Medium Contentfilter = "medium" )
Defines values for Contentfilter.
type GifObject ¶
type GifObject struct { ContentDescription string `json:"content_description"` // a unix timestamp representing when this post was created. Created float32 `json:"created"` // true if this post contains audio (only video formats support audio, the gif image file format can not contain audio information). Hasaudio bool `json:"hasaudio"` // Tenor result identifier Id string `json:"id"` // An array of dictionaries with GIF_FORMAT as the key and MEDIA_OBJECT as the value Media []Media `json:"media"` // an array of tags for the post Tags []string `json:"tags"` Title string `json:"title"` }
GifObject defines model for GifObject.
type GifsParams ¶
type GifsParams struct { // a comma separated list of GIF IDs (max: 50) Ids *Ids `json:"ids,omitempty"` // client key for privileged API access Key Key `json:"key"` // (values: basic | minimal) Reduce the Number of GIF formats returned in the GIF_OBJECT list. // // minimal - tinygif, gif, and mp4. // // basic - nanomp4, tinygif, tinymp4, gif, mp4, and nanogif MediaFilter *GifsParamsMediaFilter `json:"media_filter,omitempty"` // fetch up to a specified number of results (max: 50). Limit *Limit `json:"limit,omitempty"` // get results starting at position "value". Use a non-zero "next" value returned by API results to get the next set of results. pos is not an index and may be an integer, float, or string Pos *Pos `json:"pos,omitempty"` // specify the anonymous_id tied to the given user AnonId *AnonId `json:"anon_id,omitempty"` }
GifsParams defines parameters for Gifs.
type GifsParamsMediaFilter ¶
type GifsParamsMediaFilter string
GifsParamsMediaFilter defines parameters for Gifs.
type GifsResponse ¶
type GifsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *SearchResult }
func ParseGifsResponse ¶
func ParseGifsResponse(rsp *http.Response) (*GifsResponse, error)
ParseGifsResponse parses an HTTP response from a GifsWithResponse call
func (GifsResponse) Status ¶
func (r GifsResponse) Status() string
Status returns HTTPResponse.Status
func (GifsResponse) StatusCode ¶
func (r GifsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type Media ¶
type Media struct { Gif *MediaObject `json:"gif,omitempty"` Loopedmp4 *MediaObject `json:"loopedmp4,omitempty"` Mediumgif *MediaObject `json:"mediumgif,omitempty"` Mp4 *MediaObject `json:"mp4,omitempty"` Nanogif *MediaObject `json:"nanogif,omitempty"` Nanomp4 *MediaObject `json:"nanomp4,omitempty"` Nanowebm *MediaObject `json:"nanowebm,omitempty"` Tinygif *MediaObject `json:"tinygif,omitempty"` Tinymp4 *MediaObject `json:"tinymp4,omitempty"` Tinywebm *MediaObject `json:"tinywebm,omitempty"` Webm *MediaObject `json:"webm,omitempty"` }
Media defines model for Media.
type MediaFilter ¶
type MediaFilter string
MediaFilter defines model for media_filter.
const ( Basic MediaFilter = "basic" Minimal MediaFilter = "minimal" )
Defines values for MediaFilter.
type MediaObject ¶
type MediaObject struct { // width and height in pixels Dims []int `json:"dims"` // a url to a preview image of the media source Preview string `json:"preview"` // size of file in bytes Size int `json:"size"` // a url to the media source Url string `json:"url"` }
MediaObject defines model for MediaObject.
type Next ¶
type Next string
a position identifier to use with the next API query to retrieve the next set of results, or null if there are no further results.
type RandomParams ¶
type RandomParams struct { // a search string Q Q `json:"q"` // client key for privileged API access Key Key `json:"key"` // specify default language to interpret search string; xx is ISO 639-1 language code, _YY (optional) is 2-letter ISO 3166-1 country code Locale *Locale `json:"locale,omitempty"` // (values: off | low | medium | high) specify the content safety filter level Contentfilter *RandomParamsContentfilter `json:"contentfilter,omitempty"` // (values: basic | minimal) Reduce the Number of GIF formats returned in the GIF_OBJECT list. // // minimal - tinygif, gif, and mp4. // // basic - nanomp4, tinygif, tinymp4, gif, mp4, and nanogif MediaFilter *RandomParamsMediaFilter `json:"media_filter,omitempty"` // (values: all | wide | standard ) Filter the response GIF_OBJECT list to only include GIFs with aspect ratios that fit with in the selected range. // // all - no constraints // // wide - 0.42 <= aspect ratio <= 2.36 // // standard - .56 <= aspect ratio <= 1.78 ArRange *RandomParamsArRange `json:"ar_range,omitempty"` // fetch up to a specified number of results (max: 50). Limit *Limit `json:"limit,omitempty"` // get results starting at position "value". Use a non-zero "next" value returned by API results to get the next set of results. pos is not an index and may be an integer, float, or string Pos *Pos `json:"pos,omitempty"` // specify the anonymous_id tied to the given user AnonId *AnonId `json:"anon_id,omitempty"` }
RandomParams defines parameters for Random.
type RandomParamsArRange ¶
type RandomParamsArRange string
RandomParamsArRange defines parameters for Random.
type RandomParamsContentfilter ¶
type RandomParamsContentfilter string
RandomParamsContentfilter defines parameters for Random.
type RandomParamsMediaFilter ¶
type RandomParamsMediaFilter string
RandomParamsMediaFilter defines parameters for Random.
type RandomResponse ¶
type RandomResponse struct { Body []byte HTTPResponse *http.Response JSON200 *SearchResult }
func ParseRandomResponse ¶
func ParseRandomResponse(rsp *http.Response) (*RandomResponse, error)
ParseRandomResponse parses an HTTP response from a RandomWithResponse call
func (RandomResponse) Status ¶
func (r RandomResponse) Status() string
Status returns HTTPResponse.Status
func (RandomResponse) StatusCode ¶
func (r RandomResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RegisterParams ¶
type RegisterParams struct { // client key for privileged API access Key Key `json:"key"` // the id of a GifObject Id *Id `json:"id,omitempty"` // specify default language to interpret search string; xx is ISO 639-1 language code, _YY (optional) is 2-letter ISO 3166-1 country code Locale *Locale `json:"locale,omitempty"` // a search string Q Q `json:"q"` // specify the anonymous_id tied to the given user AnonId *AnonId `json:"anon_id,omitempty"` }
RegisterParams defines parameters for Register.
type RegisterResponse ¶
type RegisterResponse struct { Body []byte HTTPResponse *http.Response JSON200 *RegisterResult }
func ParseRegisterResponse ¶
func ParseRegisterResponse(rsp *http.Response) (*RegisterResponse, error)
ParseRegisterResponse parses an HTTP response from a RegisterWithResponse call
func (RegisterResponse) Status ¶
func (r RegisterResponse) Status() string
Status returns HTTPResponse.Status
func (RegisterResponse) StatusCode ¶
func (r RegisterResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RegisterResult ¶
type RegisterResult struct { // set to "ok" if share registration was successful Status string `json:"status"` }
RegisterResult defines model for RegisterResult.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type SearchParams ¶
type SearchParams struct { // a search string Q Q `json:"q"` // client key for privileged API access Key Key `json:"key"` // specify default language to interpret search string; xx is ISO 639-1 language code, _YY (optional) is 2-letter ISO 3166-1 country code Locale *Locale `json:"locale,omitempty"` // (values: off | low | medium | high) specify the content safety filter level Contentfilter *SearchParamsContentfilter `json:"contentfilter,omitempty"` // (values: basic | minimal) Reduce the Number of GIF formats returned in the GIF_OBJECT list. // // minimal - tinygif, gif, and mp4. // // basic - nanomp4, tinygif, tinymp4, gif, mp4, and nanogif MediaFilter *SearchParamsMediaFilter `json:"media_filter,omitempty"` // (values: all | wide | standard ) Filter the response GIF_OBJECT list to only include GIFs with aspect ratios that fit with in the selected range. // // all - no constraints // // wide - 0.42 <= aspect ratio <= 2.36 // // standard - .56 <= aspect ratio <= 1.78 ArRange *SearchParamsArRange `json:"ar_range,omitempty"` // fetch up to a specified number of results (max: 50). Limit *Limit `json:"limit,omitempty"` // get results starting at position "value". Use a non-zero "next" value returned by API results to get the next set of results. pos is not an index and may be an integer, float, or string Pos *Pos `json:"pos,omitempty"` // specify the anonymous_id tied to the given user AnonId *AnonId `json:"anon_id,omitempty"` }
SearchParams defines parameters for Search.
type SearchParamsArRange ¶
type SearchParamsArRange string
SearchParamsArRange defines parameters for Search.
type SearchParamsContentfilter ¶
type SearchParamsContentfilter string
SearchParamsContentfilter defines parameters for Search.
type SearchParamsMediaFilter ¶
type SearchParamsMediaFilter string
SearchParamsMediaFilter defines parameters for Search.
type SearchResponse ¶
type SearchResponse struct { Body []byte HTTPResponse *http.Response JSON200 *SearchResult }
func ParseSearchResponse ¶
func ParseSearchResponse(rsp *http.Response) (*SearchResponse, error)
ParseSearchResponse parses an HTTP response from a SearchWithResponse call
func (SearchResponse) Status ¶
func (r SearchResponse) Status() string
Status returns HTTPResponse.Status
func (SearchResponse) StatusCode ¶
func (r SearchResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type SearchResult ¶
type SearchResult struct { // a position identifier to use with the next API query to retrieve the next set of results, or null if there are no further results. Next Next `json:"next"` // an array of GifObjects containing the most relevant GIFs for the requested search term - Sorted by relevancy Rank Results []GifObject `json:"results"` }
SearchResult defines model for SearchResult.