aboutsummaryrefslogtreecommitdiff
path: root/user/anime/animelist.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-13 15:30:32 +0530
committerVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-13 15:30:32 +0530
commit7dcda8a7344ec5be2b93672ace638515708554de (patch)
treecb72947eed790c73586ef9fd9f7328ce51fbd2a0 /user/anime/animelist.go
parent937f3b8ada85274dfe3842f3dde8aef45c4f3ae7 (diff)
removed fields from GetAnimeList because endpoint does not support that
Diffstat (limited to 'user/anime/animelist.go')
-rw-r--r--user/anime/animelist.go16
1 files changed, 2 insertions, 14 deletions
diff --git a/user/anime/animelist.go b/user/anime/animelist.go
index f25a2a2..2099204 100644
--- a/user/anime/animelist.go
+++ b/user/anime/animelist.go
@@ -23,14 +23,13 @@ import (
"errors"
a "github.com/MikunoNaka/mal2go/anime"
e "github.com/MikunoNaka/mal2go/errhandlers"
- u "github.com/MikunoNaka/mal2go/util"
)
const BASE_URL string = "https://api.myanimelist.net/v2"
const maxListLimit int = 1000
// Get authenticated user's anime list
-func (c AnimeListClient) GetAnimeList(user, status, sort string, limit, offset int, fields []string) (a.AnimeList, error){
+func (c AnimeListClient) GetAnimeList(user, status, sort string, limit, offset int) (a.AnimeList, error){
var userAnimeList a.AnimeList
// error handling for limit and offset
limitsErr := e.LimitsErrHandler(limit, offset, maxListLimit)
@@ -38,12 +37,6 @@ func (c AnimeListClient) GetAnimeList(user, status, sort string, limit, offset i
return userAnimeList, limitsErr
}
- // handle all the errors for the fields
- fields, err := e.FieldsErrHandler(fields)
- if err != nil {
- return userAnimeList, err
- }
-
// checks if valid sort is specified
if !e.IsValidListSort(sort) {
return userAnimeList, errors.New(fmt.Sprintf("GetAnimeList: Invalid sort specified: \"%s\"", sort))
@@ -59,12 +52,7 @@ func (c AnimeListClient) GetAnimeList(user, status, sort string, limit, offset i
user = "@me"
}
- endpoint, _ := u.UrlGenerator(
- BASE_URL + "/users/" + user + "/animelist",
- []string{"status", "sort", "limit", "offset", "fields"},
- [][]string{{status}, {sort}, {strconv.Itoa(limit)}, {strconv.Itoa(offset)}, fields},
- true,
- )
+ endpoint := BASE_URL + "/users/" + user + "/animelist?status=" + status + "&sort=" + sort + "&limit=" + strconv.Itoa(limit) + "&offset=" + strconv.Itoa(offset)
// get data from API
var animeListData AnimeListRaw