summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/peterhellberg/giphy/trending.go
blob: 671e0d5126bdd4003668a0e9bfed3e511fa928f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
}