mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Move functions into their own, separate files & add docs
This commit is contained in:
parent
d1859b4c25
commit
ec872d8c86
12 changed files with 681 additions and 638 deletions
|
|
@ -8,6 +8,25 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
type CrunchyLists struct {
|
||||
crunchy *Crunchyroll
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue