aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--defaults.go2
-rw-r--r--manga_types.go9
-rw-r--r--validators.go9
3 files changed, 15 insertions, 5 deletions
diff --git a/defaults.go b/defaults.go
index c1a71de..5a122cc 100644
--- a/defaults.go
+++ b/defaults.go
@@ -75,7 +75,7 @@ var DefaultMangaFields []string = []string {
"my_list_status",
"num_volumes",
"num_chapters",
- "authors",
+ "authors{first_name,last_name}",
"pictures",
"background",
"related_anime",
diff --git a/manga_types.go b/manga_types.go
index d4c44a6..85a2af8 100644
--- a/manga_types.go
+++ b/manga_types.go
@@ -69,9 +69,12 @@ type MangaRecommendation struct {
}
type Author struct {
- Id int `json:"id"`
- FirstName string `json:"first_name"`
- LastName string `json:"last_name"`
+ Details struct {
+ Id int `json:"id"`
+ FirstName string `json:"first_name"`
+ LastName string `json:"last_name"`
+ } `json:"node"`
+ Role string `json:"role"`
}
type MangaListStatus struct {
diff --git a/validators.go b/validators.go
index dd45014..de4d0a5 100644
--- a/validators.go
+++ b/validators.go
@@ -118,7 +118,14 @@ func validateMangaFields(fields *[]string) error {
}
// check if given fields exist in DefaultAnimeFields
- for _, f := range *fields {
+ for i, f := range *fields {
+ if f == "authors" {
+ f = "authors{first_name,last_name}"
+ x := *fields
+ x[i] = f
+ *fields = x
+ }
+
if !slices.Contains(DefaultMangaFields, f) {
return ErrInvalidField
}