From 02752551dec484dd0e2b6f50158f516fd5d5c39d Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 31 Jan 2022 00:06:46 +0530 Subject: Completed Get Anime Ranking API route --- anime/anime.structs.go | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 anime/anime.structs.go (limited to 'anime/anime.structs.go') diff --git a/anime/anime.structs.go b/anime/anime.structs.go new file mode 100644 index 0000000..bb35ded --- /dev/null +++ b/anime/anime.structs.go @@ -0,0 +1,92 @@ +package anime + +type AnimePicture struct { + Medium string `json:"large"` + Large string `json:"medium"` +} + +type StatusStatistics struct { + Watching int `json:"watching"` + Completed int `json:"completed"` + OnHold int `json:"on_hold"` + Dropped int `json:"dropped"` + PlanToWatch int `json:"plan_to_watch"` +} + +type AnimeStatistics struct { + Status StatusStatistics `json:"status"` + NumListUsers int `json:"num_list_users"` +} + +type Genre struct { + Id int `json:"id"` + Name string `json:"name"` +} + +type ListStatus struct { + Status string `json:"status"` + Score int `json:"score"` + EpWatched int `json:"num_episodes_watched"` + IsRewatching bool `json:"is_rewatching"` + UpdatedAt string `json:"updated_at"` +} + +type Season struct { + Year int `json:"year"` + Name string `json:"season"` +} + +type Broadcast struct { + Day string `json:"day_of_the_week"` + Time string `json:"start_time"` +} + +type Related struct { + Anime Anime `json:"node"` + RelationType string `json:"relation_type"` + RelationTypeFormatted string `json:"relation_type_formatted"` +} + +type Studio struct { + Id int `json:"id"` + Name string `json:"name"` +} + +type Recommendation struct { + Anime Anime `json:"node"` + Num int `json:"num_recommendations"` +} + +type Anime struct { + Id int `json:"id"` + Title string `json:"title"` + MainPicture AnimePicture `json:"main_picture"` + AltTitles []string `json:"alternative_titles"` + StartDate string `json:"start_date"` + EndDate string `json:"end_date"` + Synopsis string `json:"synopsis"` + MeanScore float32 `json:"mean"` + Rank int `json:"rank"` + Popularity int `json:"popularity"` + NumListUsers int `json:"num_list_users"` + NumScoringUsers int `json:"num_scoring_users"` + NsfwStatus string `json:"nsfw"` // find out what values are there + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + MediaType string `json:"media_type"` + Status string `json:"status"` + Genres []Genre `json:"genres"` + MyListStatus ListStatus `json:"my_list_status"` + NumEpisodes int `json:"num_episodes"` + StartSeason Season `json:"start_season"` + Broadcast Broadcast `json:"broadcast"` + Source string `json:"source"` + DurationSeconds int `json:"average_episode_duration"` + Rating string `json:"rating"` + Pictures []AnimePicture `json:"pictures"` + Background string `json:"background"` + RelatedAnime []Related `json:"related_anime"` + Recommendations []Recommendation `json:"recommendations"` + Studios []Studio `json:"studios"` + Statistics AnimeStatistics `json:"statistics"` +} -- cgit v1.2.3 From a835f9b0b8b714a76d8b2f9c49b84f7042ddbd6a Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 31 Jan 2022 10:35:43 +0530 Subject: distributed code among multiple files for simplicity --- anime/anime.structs.go | 1 + 1 file changed, 1 insertion(+) (limited to 'anime/anime.structs.go') diff --git a/anime/anime.structs.go b/anime/anime.structs.go index bb35ded..a5e7d8e 100644 --- a/anime/anime.structs.go +++ b/anime/anime.structs.go @@ -61,6 +61,7 @@ type Anime struct { Id int `json:"id"` Title string `json:"title"` MainPicture AnimePicture `json:"main_picture"` + // TODO: AltTitles should also have options for JP and EN Titles AltTitles []string `json:"alternative_titles"` StartDate string `json:"start_date"` EndDate string `json:"end_date"` -- cgit v1.2.3 From caa17299f9f70addca805eb94a8174efcdda6985 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 31 Jan 2022 12:06:52 +0530 Subject: Adding copyright declarations to every file --- anime/anime.structs.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'anime/anime.structs.go') diff --git a/anime/anime.structs.go b/anime/anime.structs.go index a5e7d8e..596f16e 100644 --- a/anime/anime.structs.go +++ b/anime/anime.structs.go @@ -1,3 +1,19 @@ +/* mal2go - MyAnimeList V2 API wrapper for Go + * Copyright (C) 2022 Vidhu Kant Sharma + + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + package anime type AnimePicture struct { -- cgit v1.2.3 From f2d4bf9de9808f08f523ea2c741f385830960214 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 31 Jan 2022 22:07:21 +0530 Subject: Fixed Alternate Titles not loading --- anime/anime.structs.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'anime/anime.structs.go') diff --git a/anime/anime.structs.go b/anime/anime.structs.go index 596f16e..3b468d1 100644 --- a/anime/anime.structs.go +++ b/anime/anime.structs.go @@ -73,12 +73,17 @@ type Recommendation struct { Num int `json:"num_recommendations"` } +type AltTitles struct { + Synonyms []string `json:"synonyms"` + En string `json:"en"` + Ja string `json:"ja"` +} + type Anime struct { Id int `json:"id"` Title string `json:"title"` MainPicture AnimePicture `json:"main_picture"` - // TODO: AltTitles should also have options for JP and EN Titles - AltTitles []string `json:"alternative_titles"` + AltTitles AltTitles `json:"alternative_titles"` StartDate string `json:"start_date"` EndDate string `json:"end_date"` Synopsis string `json:"synopsis"` @@ -99,6 +104,7 @@ type Anime struct { Broadcast Broadcast `json:"broadcast"` Source string `json:"source"` DurationSeconds int `json:"average_episode_duration"` + // Rating as in R, PG13, etc Rating string `json:"rating"` Pictures []AnimePicture `json:"pictures"` Background string `json:"background"` -- cgit v1.2.3 From a01c567bf41778a5ca4c7d5b77eb375d4f058d63 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 5 Feb 2022 13:33:00 +0530 Subject: fixed Statistics.Status.* showing 0 instead of correct data --- anime/anime.structs.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'anime/anime.structs.go') diff --git a/anime/anime.structs.go b/anime/anime.structs.go index 3b468d1..2db1b19 100644 --- a/anime/anime.structs.go +++ b/anime/anime.structs.go @@ -22,11 +22,11 @@ type AnimePicture struct { } type StatusStatistics struct { - Watching int `json:"watching"` - Completed int `json:"completed"` - OnHold int `json:"on_hold"` - Dropped int `json:"dropped"` - PlanToWatch int `json:"plan_to_watch"` + Watching string `json:"watching"` + Completed string `json:"completed"` + OnHold string `json:"on_hold"` + Dropped string `json:"dropped"` + PlanToWatch string `json:"plan_to_watch"` } type AnimeStatistics struct { -- cgit v1.2.3 From b876e67c2b21631231a06a4f7c929cb212d01595 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 5 Feb 2022 14:18:46 +0530 Subject: implemented searching to MAL --- anime/anime.structs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'anime/anime.structs.go') diff --git a/anime/anime.structs.go b/anime/anime.structs.go index 2db1b19..d9d4221 100644 --- a/anime/anime.structs.go +++ b/anime/anime.structs.go @@ -92,7 +92,11 @@ type Anime struct { Popularity int `json:"popularity"` NumListUsers int `json:"num_list_users"` NumScoringUsers int `json:"num_scoring_users"` - NsfwStatus string `json:"nsfw"` // find out what values are there + /* NsfwStatus potential values: + * 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"` -- cgit v1.2.3 From f3ec24145da97fa7e4a5687503a6f46d59ff8c2a Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 5 Feb 2022 21:52:30 +0530 Subject: added function to get seasonal anime and added fields support to all the endpoints that have it --- anime/anime.structs.go | 5 ----- 1 file changed, 5 deletions(-) (limited to 'anime/anime.structs.go') diff --git a/anime/anime.structs.go b/anime/anime.structs.go index d9d4221..1599e6d 100644 --- a/anime/anime.structs.go +++ b/anime/anime.structs.go @@ -47,11 +47,6 @@ type ListStatus struct { UpdatedAt string `json:"updated_at"` } -type Season struct { - Year int `json:"year"` - Name string `json:"season"` -} - type Broadcast struct { Day string `json:"day_of_the_week"` Time string `json:"start_time"` -- cgit v1.2.3