mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-14 16:40:26 +00:00
24 lines
457 B
Go
24 lines
457 B
Go
package giphy
|
|
|
|
import "fmt"
|
|
|
|
// Trending returns a trending response from the Giphy API
|
|
func (c *Client) Trending(args ...[]string) (Trending, error) {
|
|
path := fmt.Sprintf("/gifs/trending?limit=%v", c.Limit)
|
|
req, err := c.NewRequest(path)
|
|
if err != nil {
|
|
return Trending{}, err
|
|
}
|
|
|
|
var res Trending
|
|
if _, err = c.Do(req, &res); err != nil {
|
|
return res, err
|
|
}
|
|
|
|
if len(res.Data) == 0 {
|
|
return res, ErrNoTrendingImagesFound
|
|
}
|
|
|
|
return res, nil
|
|
}
|