Add the `genres` field to AniList GraphQL queries and type definitions: - Add genres field to GetAniListItem query for fetching single anime details - Add genres field to AniListSearch query for search results - Add genres field to GetAniListUserWatchingList query for user's watch list - Update MediaList type definition to include Genres []string field This enhancement allows the application to retrieve and display anime genre information from the AniList API, providing users with better categorization and discovery capabilities.
214 lines
6.1 KiB
Go
214 lines
6.1 KiB
Go
package main
|
|
|
|
type AniListJWT struct {
|
|
TokenType string `json:"token_type"`
|
|
ExpiresIn int `json:"expires_in"`
|
|
AccessToken string `json:"access_token"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
}
|
|
|
|
type AniListUser struct {
|
|
Data struct {
|
|
Viewer struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
Avatar struct {
|
|
Large string `json:"large"`
|
|
Medium string `json:"medium"`
|
|
} `json:"avatar"`
|
|
BannerImage string `json:"bannerImage"`
|
|
SiteUrl string `json:"siteUrl"`
|
|
} `json:"Viewer"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type AniListCurrentUserWatchList struct {
|
|
Data struct {
|
|
Page struct {
|
|
PageInfo struct {
|
|
Total int `json:"total"`
|
|
PerPage int `json:"perPage"`
|
|
CurrentPage int `json:"currentPage"`
|
|
LastPage int `json:"lastPage"`
|
|
HasNextPage bool `json:"hasNextPage"`
|
|
} `json:"pageInfo"`
|
|
MediaList []MediaList `json:"mediaList"`
|
|
} `json:"Page"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type AniListGetSingleAnime struct {
|
|
Data struct {
|
|
MediaList MediaList `json:"MediaList"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type AniListUpdateReturn struct {
|
|
Data struct {
|
|
SaveMediaListEntry MediaList `json:"SaveMediaListEntry"`
|
|
}
|
|
}
|
|
|
|
type MediaList struct {
|
|
ID int `json:"id"`
|
|
MediaID int `json:"mediaId"`
|
|
UserID int `json:"userId"`
|
|
Media struct {
|
|
ID int `json:"id"`
|
|
IDMal int `json:"idMal"`
|
|
Title struct {
|
|
Romaji string `json:"romaji"`
|
|
English string `json:"english"`
|
|
Native string `json:"native"`
|
|
} `json:"title"`
|
|
Description string `json:"description"`
|
|
CoverImage struct {
|
|
Large string `json:"large"`
|
|
} `json:"coverImage"`
|
|
Season string `json:"season"`
|
|
SeasonYear int `json:"seasonYear"`
|
|
Status string `json:"status"`
|
|
Episodes int `json:"episodes"`
|
|
NextAiringEpisode struct {
|
|
AiringAt int `json:"airingAt"`
|
|
TimeUntilAiring int `json:"timeUntilAiring"`
|
|
Episode int `json:"episode"`
|
|
} `json:"nextAiringEpisode"`
|
|
Genres []string `json:"genres"`
|
|
Tags []struct {
|
|
Id int `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Rank int `json:"rank"`
|
|
IsMediaSpoiler bool `json:"isMediaSpoiler"`
|
|
IsAdult bool `json:"isAdult"`
|
|
} `json:"tags"`
|
|
IsAdult bool `json:"isAdult"`
|
|
} `json:"media"`
|
|
Status string `json:"status"`
|
|
StartedAt struct {
|
|
Year int `json:"year"`
|
|
Month int `json:"month"`
|
|
Day int `json:"day"`
|
|
} `json:"startedAt"`
|
|
CompletedAt struct {
|
|
Year int `json:"year"`
|
|
Month int `json:"month"`
|
|
Day int `json:"day"`
|
|
} `json:"completedAt"`
|
|
Notes string `json:"notes"`
|
|
Progress int `json:"progress"`
|
|
Score float64 `json:"score"`
|
|
Repeat int `json:"repeat"`
|
|
User struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
Avatar struct {
|
|
Large string `json:"large"`
|
|
Medium string `json:"medium"`
|
|
} `json:"avatar"`
|
|
Statistics struct {
|
|
Anime struct {
|
|
Count int `json:"count"`
|
|
Statuses []struct {
|
|
Status string `json:"status"`
|
|
Count int `json:"count"`
|
|
} `json:"statuses"`
|
|
} `json:"anime"`
|
|
} `json:"statistics"`
|
|
} `json:"user"`
|
|
}
|
|
|
|
type StartedAt struct {
|
|
Year int `json:"year"`
|
|
Month int `json:"month"`
|
|
Day int `json:"day"`
|
|
}
|
|
type CompletedAt struct {
|
|
Year int `json:"year"`
|
|
Month int `json:"month"`
|
|
Day int `json:"day"`
|
|
}
|
|
type AniListUpdateVariables struct {
|
|
MediaId int `json:"mediaId"`
|
|
Progress int `json:"progress"`
|
|
Status string `json:"status"`
|
|
Score float64 `json:"score"`
|
|
Repeat int `json:"repeat"`
|
|
Notes string `json:"notes"`
|
|
StartedAt StartedAt `json:"startedAt"`
|
|
CompletedAt CompletedAt `json:"completedAt"`
|
|
}
|
|
|
|
type DeleteAniListReturn struct {
|
|
Data struct {
|
|
DeleteMediaListEntry struct {
|
|
Deleted bool `json:"deleted"`
|
|
} `json:"DeleteMediaListEntry"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
//var MediaListSort = struct {
|
|
// MediaId string
|
|
// MediaIdDesc string
|
|
// Score string
|
|
// ScoreDesc string
|
|
// Status string
|
|
// StatusDesc string
|
|
// Progress string
|
|
// ProgressDesc string
|
|
// ProgressVolumes string
|
|
// ProgressVolumesDesc string
|
|
// Repeat string
|
|
// RepeatDesc string
|
|
// Priority string
|
|
// PriorityDesc string
|
|
// StartedOn string
|
|
// StartedOnDesc string
|
|
// FinishedOn string
|
|
// FinishedOnDesc string
|
|
// AddedTime string
|
|
// AddedTimeDesc string
|
|
// UpdatedTime string
|
|
// UpdatedTimeDesc string
|
|
// MediaTitleRomaji string
|
|
// MediaTitleRomajiDesc string
|
|
// MediaTitleEnglish string
|
|
// MediaTitleEnglishDesc string
|
|
// MediaTitleNative string
|
|
// MediaTitleNativeDesc string
|
|
// MediaPopularity string
|
|
// MediaPopularityDesc string
|
|
//}{
|
|
// MediaId: "MEDIA_ID",
|
|
// MediaIdDesc: "MEDIA_ID_DESC",
|
|
// Score: "SCORE",
|
|
// ScoreDesc: "SCORE_DESC",
|
|
// Status: "STATUS",
|
|
// StatusDesc: "STATUS_DESC",
|
|
// Progress: "PROGRESS",
|
|
// ProgressDesc: "PROGRESS_DESC",
|
|
// ProgressVolumes: "PROGRESS_VOLUMES",
|
|
// ProgressVolumesDesc: "PROGRESS_VOLUMES_DESC",
|
|
// Repeat: "REPEAT",
|
|
// RepeatDesc: "REPEAT_DESC",
|
|
// Priority: "PRIORITY",
|
|
// PriorityDesc: "PRIORITY_DESC",
|
|
// StartedOn: "STARTED_ON",
|
|
// StartedOnDesc: "STARTED_ON_DESC",
|
|
// FinishedOn: "FINISHED_ON",
|
|
// FinishedOnDesc: "FINISHED_ON_DESC",
|
|
// AddedTime: "ADDED_TIME",
|
|
// AddedTimeDesc: "ADDED_TIME_DESC",
|
|
// UpdatedTime: "UPDATED_TIME",
|
|
// UpdatedTimeDesc: "UPDATED_TIME_DESC",
|
|
// MediaTitleRomaji: "MEDIA_TITLE_ROMAJI",
|
|
// MediaTitleRomajiDesc: "MEDIA_TITLE_ROMAJI_DESC",
|
|
// MediaTitleEnglish: "MEDIA_TITLE_ENGLISH",
|
|
// MediaTitleEnglishDesc: "MEDIA_TITLE_ENGLISH_DESC",
|
|
// MediaTitleNative: "MEDIA_TITLE_NATIVE",
|
|
// MediaTitleNativeDesc: "MEDIA_TITLE_NATIVE_DESC",
|
|
// MediaPopularity: "MEDIA_POPULARITY",
|
|
// MediaPopularityDesc: "MEDIA_POPULARITY_DESC",
|
|
//}
|