5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-14 05:00:27 +00:00
matterbridge/vendor/github.com/peterhellberg/giphy/trending.go

24 lines
457 B
Go
Raw Normal View History

2016-04-10 21:39:38 +00:00
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
}