aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-24 21:40:43 +0530
committerVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-24 21:40:43 +0530
commit314d9bf6cad4bebec431a217c23016680c56179b (patch)
treea08e45454724d84c3dab6f07cd04bf4bf37e87a9
parente4f90575f920cbd429814dfc27a775c0666bf718 (diff)
moved DefaultListStatus back to each package seperately
-rw-r--r--anime/anime.structs.go24
-rw-r--r--manga/manga.structs.go11
-rw-r--r--user/anime/animelist.go8
-rw-r--r--util/structs.go11
4 files changed, 32 insertions, 22 deletions
diff --git a/anime/anime.structs.go b/anime/anime.structs.go
index 039af12..4132989 100644
--- a/anime/anime.structs.go
+++ b/anime/anime.structs.go
@@ -47,7 +47,16 @@ type Recommendation struct {
}
type ListStatus struct {
- u.DefaultListStatus
+ Status string `json:"status"`
+ Score int `json:"score"`
+ StartDate string `json:"start_date"`
+ FinishDate string `json:"finish_date"`
+ Priority int `json:"priority"`
+ Tags string `json:"tags"`
+ Comments string `json:"comments"`
+ UpdatedAt string `json:"updated_at"`
+
+ // these fields are exclusive to anime
EpWatched int `json:"num_watched_episodes"`
IsRewatching bool `json:"is_rewatching"`
TimesRewatched int `json:"num_times_rewatched"`
@@ -68,16 +77,19 @@ type Anime struct {
NumListUsers int `json:"num_list_users"`
NumScoringUsers int `json:"num_scoring_users"`
/* NsfwStatus potential values:
- * white = sfw
- * gray = probably nsfw
- * black = nsfw */
+ * white = sfw
+ * gray = probably nsfw
+ * black = nsfw */
NsfwStatus string `json:"nsfw"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
MediaType string `json:"media_type"`
Status string `json:"status"`
- Genres []u.Genre `json:"genres"`
- ListStatus ListStatus `json:"my_list_status"`
+ Genres []u.Genre `json:"genres"`
+ /* MyListStatus refers to the authenticated user's info
+ * while ListStatus can be used for other users */
+ MyListStatus ListStatus `json:"my_list_status"`
+ ListStatus ListStatus `json:"list_status"`
NumEpisodes int `json:"num_episodes"`
StartSeason Season `json:"start_season"`
Broadcast Broadcast `json:"broadcast"`
diff --git a/manga/manga.structs.go b/manga/manga.structs.go
index 7c33c2b..2fb5b29 100644
--- a/manga/manga.structs.go
+++ b/manga/manga.structs.go
@@ -27,7 +27,16 @@ type Author struct {
}
type ListStatus struct {
- util.DefaultListStatus
+ Status string `json:"status"`
+ Score int `json:"score"`
+ StartDate string `json:"start_date"`
+ FinishDate string `json:"finish_date"`
+ Priority int `json:"priority"`
+ Tags string `json:"tags"`
+ Comments string `json:"comments"`
+ UpdatedAt string `json:"updated_at"`
+
+ // thsese fields are exclusive to manga
VolumesRead int `json:"num_volumes_read"`
ChaptersRead int `json:"num_chapters_read"`
IsRereading bool `json:"is_rereading"`
diff --git a/user/anime/animelist.go b/user/anime/animelist.go
index b27efc0..f9ddff5 100644
--- a/user/anime/animelist.go
+++ b/user/anime/animelist.go
@@ -73,13 +73,13 @@ func (c Client) GetAnimeList(user, status, sort string, limit, offset int) (a.An
data := c.requestHandler(endpoint, "GET")
json.Unmarshal([]byte(data), &animeListData)
- // set MyListStatus for each element and add it to array
+ // set ListStatus for each element and add it to array
var animes []a.Anime
for _, element := range animeListData.Data {
- a := element.Anime
- a.ListStatus = element.ListStatus
+ anime := element.Anime
+ anime.ListStatus = element.ListStatus
- animes = append(animes, a)
+ animes = append(animes, anime)
}
// finally create AnimeList
diff --git a/util/structs.go b/util/structs.go
index 1483d3f..600ec94 100644
--- a/util/structs.go
+++ b/util/structs.go
@@ -77,17 +77,6 @@ type Genre struct {
Name string `json:"name"`
}
-type DefaultListStatus struct {
- Status string `json:"status"`
- Score int `json:"score"`
- StartDate string `json:"start_date"`
- FinishDate string `json:"finish_date"`
- Priority int `json:"priority"`
- Tags string `json:"tags"`
- Comments string `json:"comments"`
- UpdatedAt string `json:"updated_at"`
-}
-
type AltTitles struct {
Synonyms []string `json:"synonyms"`
En string `json:"en"`