From b748f30e9d9b5be9fc372947c6f6c3a3e0338bd4 Mon Sep 17 00:00:00 2001 From: heycatch Date: Wed, 11 Sep 2024 13:42:13 +0400 Subject: [PATCH] fixed the struct for UserRatesSchema() and updated the docs --- api/graphql.go | 33 ++++++++++++--------------------- graphql/README.md | 4 ++-- graphql/README_en.md | 4 ++-- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/api/graphql.go b/api/graphql.go index b438352..307f6a5 100644 --- a/api/graphql.go +++ b/api/graphql.go @@ -102,27 +102,18 @@ type MangasGraphQL struct { } type UserRatesGraphQL struct { - Anime AnimesGraphQL `json:"anime"` - Manga MangasGraphQL `json:"manga"` - Id string `json:"id"` - Text string `json:"text"` - CreatedAt string `json:"createdAt"` - UpdatedAt string `json:"updatedAt"` - Rewatches int `json:"rewatches"` - Score float32 `json:"score"` - Status UserRatesStatusGraphQL `json:"status"` - Episodes int `json:"episodes"` - Chapters int `json:"chapters"` - Volumes int `json:"volumes"` -} - -type UserRatesStatusGraphQL struct { - Planned string `json:"planned"` - Watching string `json:"watching"` - Rewatching string `json:"rewatching"` - Completed string `json:"completed"` - On_hold string `json:"on_hold"` - Dropped string `json:"dropped"` + Anime AnimesGraphQL `json:"anime"` + Manga MangasGraphQL `json:"manga"` + Id string `json:"id"` + Text string `json:"text"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + Rewatches int `json:"rewatches"` + Score int `json:"score"` + Status string `json:"status"` + Episodes int `json:"episodes"` + Chapters int `json:"chapters"` + Volumes int `json:"volumes"` } type AiredOnGraphQL struct { diff --git a/graphql/README.md b/graphql/README.md index 48b24c6..aa53760 100644 --- a/graphql/README.md +++ b/graphql/README.md @@ -274,7 +274,7 @@ func main() { // Про доступные значения можно почитать в описании функции: graph.Values(); // Про доступные параметры интерфейса можно почитать в описании функции: graph.UserRatesSchema(); schema, err := graph.UserRatesSchema( - graph.Values("id", "text", "score", "createdAt", "anime{name}"), + graph.Values("id", "text", "score", "createdAt", "anime{id name}"), 181833, graph.UserRatesOrder(shiki.GRAPHQL_ORDER_FIELD_ID, shiki.GRAPHQL_ORDER_ORDER_DESC), 1, 10, shiki.MY_LIST_COMPLETED, shiki.TARGET_TYPE_ANIME, ) @@ -293,7 +293,7 @@ func main() { fmt.Println(ur.Errors) // Стандартный вывод нашего поиска, ничего нового. for _, v := range ur.Data.UserRates { - fmt.Println(v.Id, v.Text, v.Score, v.CreatedAt, v.Anime.Name) + fmt.Println(v.Id, v.Text, v.Score, v.CreatedAt, v.Anime.Id, v.Anime.Name) } } ``` diff --git a/graphql/README_en.md b/graphql/README_en.md index 26ce3d5..bff069a 100644 --- a/graphql/README_en.md +++ b/graphql/README_en.md @@ -271,7 +271,7 @@ func main() { // The available values can be found in the function description: graph.Values(); // The available interface parameters can be found in the function description: graph.UserRatesSchema(); schema, err := graph.UserRatesSchema( - graph.Values("id", "text", "score", "createdAt", "anime{name}"), + graph.Values("id", "text", "score", "createdAt", "anime{id name}"), 181833, graph.UserRatesOrder(shiki.GRAPHQL_ORDER_FIELD_ID, shiki.GRAPHQL_ORDER_ORDER_DESC), 1, 10, shiki.MY_LIST_COMPLETED, shiki.TARGET_TYPE_ANIME, ) @@ -290,7 +290,7 @@ func main() { fmt.Println(ur.Errors) // Standard output of our search, nothing new. for _, v := range ur.Data.UserRates { - fmt.Println(v.Id, v.Text, v.Score, v.CreatedAt, v.Anime.Name) + fmt.Println(v.Id, v.Text, v.Score, v.CreatedAt, v.Anime.Id, v.Anime.Name) } } ```