Documentation ¶
Overview ¶
gophy is a simple library designed to give easy access to the Giphy API. gophy aims to have 100% API coverage with a full test suite.
Index ¶
- type Client
- func (c *Client) GetGifById(id string) (*Gif, error)
- func (c *Client) GetGifsById(ids ...string) ([]*Gif, error)
- func (c *Client) SearchGifs(q string, rating string, limit int, offset int) ([]*Gif, int, error)
- func (c *Client) SearchStickers(q string, rating string, limit int, offset int) ([]*Gif, int, error)
- func (c *Client) TranslateGif(q string, rating string) (*Gif, error)
- func (c *Client) TranslateSticker(q string, rating string) (*Gif, error)
- func (c *Client) TrendingGifs(rating string, limit int) ([]*Gif, error)
- func (c *Client) TrendingStickers(rating string, limit int) ([]*Gif, error)
- type ClientOptions
- type Gif
- type ImageData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(co *ClientOptions) *Client
func (*Client) GetGifById ¶
GetGifById returns a single GIF from the Giphy API.
func (*Client) GetGifsById ¶
GetGifsById returns a number of GIFs from the Giphy API. This method accepts a maximum of 100 ids.
func (*Client) SearchGifs ¶
SearchGifs searches the Giphy API for GIFs with the specified options. Returns a slice containing the returned gifs, the total number of images available for the specified query (so that you can paginate your requests as required), and an error if one occured.
func (*Client) SearchStickers ¶
func (c *Client) SearchStickers(q string, rating string, limit int, offset int) ([]*Gif, int, error)
SearchStickers replicates the functionality and requirements of the classic Giphy search, but returns animated stickers rather than gifs.
func (*Client) TranslateGif ¶
TranslateGif is prototype endpoint for using Giphy as a translation engine for a GIF dialect. The translate API draws on search, but uses the Giphy "special sauce" to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. Returns a single GIF from the Giphy API.
func (*Client) TranslateSticker ¶
TranslateSticker replicates the functionality and requirements of the classic Giphy translate endpoint, but returns animated stickers rather than gifs.
func (*Client) TrendingGifs ¶
TrendingGifs fetches GIFs currently trending online. The data returned mirrors that used to create The Hot 100 list of GIFs on Giphy.
type ClientOptions ¶
ClientOptions is used when initialising a new `Client` instance via the `NewClient` function. All values are optional.
type Gif ¶
type Gif struct { Type string `json:"type"` Id string `json:"id"` URL string `json:"url"` Tags string `json:"tags"` BitlyGifURL string `json:"bitly_gif_url"` BitlyFullscreenURL string `json:"bitly_fullscreen_url"` BitlyTiledURL string `json:"bitly_tiled_url"` Images struct { Original ImageData `json:"original"` FixedHeight ImageData `json:"fixed_height"` FixedHeightStill ImageData `json:"fixed_height_still"` FixedHeightDownsampled ImageData `json:"fixed_height_downsampled"` FixedWidth ImageData `json:"fixed_width"` FixedwidthStill ImageData `json:"fixed_width_still"` FixedwidthDownsampled ImageData `json:"fixed_width_downsampled"` } `json:"images"` }