mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-21 02:22:34 +01: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
|
|
}
|