mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Add crunchylists endpoint
This commit is contained in:
parent
aa088cb318
commit
72484c78af
2 changed files with 167 additions and 0 deletions
|
|
@ -893,6 +893,25 @@ func (c *Crunchyroll) Watchlist(options WatchlistOptions, limit uint) ([]*Watchl
|
|||
return watchlistEntries, nil
|
||||
}
|
||||
|
||||
func (c *Crunchyroll) CrunchyLists() (*CrunchyLists, error) {
|
||||
endpoint := fmt.Sprintf("https://beta.crunchyroll.com/content/v1/custom-lists/%s?locale=%s", c.Config.AccountID, c.Locale)
|
||||
resp, err := c.request(endpoint, http.MethodGet)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
crunchyLists := &CrunchyLists{
|
||||
crunchy: c,
|
||||
}
|
||||
json.NewDecoder(resp.Body).Decode(crunchyLists)
|
||||
for _, item := range crunchyLists.Items {
|
||||
item.crunchy = c
|
||||
}
|
||||
|
||||
return crunchyLists, nil
|
||||
}
|
||||
|
||||
// Account returns information about the currently logged in crunchyroll account.
|
||||
func (c *Crunchyroll) Account() (*Account, error) {
|
||||
resp, err := c.request("https://beta.crunchyroll.com/accounts/v1/me", http.MethodGet)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue