The 1.6.1 fix exposed a latent decoding bug: AniList returns airingSchedule.nodes and relations.nodes as arrays, but the Go Media struct declared Nodes as single structs. Every full-media response failed json.Unmarshal partway through - the update path turned that into a rejected promise which skipped the MAL and Simkl syncs and all table updates, while page loads silently continued with partially decoded data (the reason the old tags/genres copy workaround existed). - Media.AiringSchedule.Nodes is now []AiringScheduleNode and Media.Relations is an exported []MediaRelation (previously an unexported field silently dropped by encoding/json); title and fuzzy-date sub-structs promoted to named types. - Regenerate wailsjs models for the new shapes. - Anime.svelte: handleSubmit and deleteEntries now wrap each service in its own try/catch surfaced via setApiError/ErrorModal, so one service failing can no longer skip the others; removed the obsolete tags/genres copy workaround. - AniListUpdateEntry/AniListDeleteEntry log HTTP status and response body on failure for terminal diagnostics. Bump productVersion to 1.6.2.
975 lines
31 KiB
TypeScript
Executable File
975 lines
31 KiB
TypeScript
Executable File
export namespace main {
|
|
|
|
export class AiringScheduleNode {
|
|
id: number;
|
|
airingAt: number;
|
|
timeUntilAiring: number;
|
|
episode: number;
|
|
mediaId: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new AiringScheduleNode(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.airingAt = source["airingAt"];
|
|
this.timeUntilAiring = source["timeUntilAiring"];
|
|
this.episode = source["episode"];
|
|
this.mediaId = source["mediaId"];
|
|
}
|
|
}
|
|
export class AniListCurrentUserWatchList {
|
|
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 []main.;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new AniListCurrentUserWatchList(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.data = this.convertValues(source["data"], Object);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class AniListGetSingleAnime {
|
|
data: struct { MediaList main.;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new AniListGetSingleAnime(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.data = this.convertValues(source["data"], Object);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class CompletedAt {
|
|
year: number;
|
|
month: number;
|
|
day: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new CompletedAt(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.year = source["year"];
|
|
this.month = source["month"];
|
|
this.day = source["day"];
|
|
}
|
|
}
|
|
export class StartedAt {
|
|
year: number;
|
|
month: number;
|
|
day: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new StartedAt(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.year = source["year"];
|
|
this.month = source["month"];
|
|
this.day = source["day"];
|
|
}
|
|
}
|
|
export class AniListUpdateVariables {
|
|
mediaId: number;
|
|
progress: number;
|
|
status: string;
|
|
score: number;
|
|
repeat: number;
|
|
notes: string;
|
|
startedAt: StartedAt;
|
|
completedAt: CompletedAt;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new AniListUpdateVariables(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.mediaId = source["mediaId"];
|
|
this.progress = source["progress"];
|
|
this.status = source["status"];
|
|
this.score = source["score"];
|
|
this.repeat = source["repeat"];
|
|
this.notes = source["notes"];
|
|
this.startedAt = this.convertValues(source["startedAt"], StartedAt);
|
|
this.completedAt = this.convertValues(source["completedAt"], CompletedAt);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class AniListUser {
|
|
// Go type: 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\"" }
|
|
data: any;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new AniListUser(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.data = this.convertValues(source["data"], Object);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
export class DeleteAniListReturn {
|
|
// Go type: struct { DeleteMediaListEntry struct { Deleted bool "json:\"deleted\"" } "json:\"DeleteMediaListEntry\"" }
|
|
data: any;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new DeleteAniListReturn(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.data = this.convertValues(source["data"], Object);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class MALAnime {
|
|
id: id;
|
|
title: title;
|
|
main_picture: mainPicture;
|
|
alternative_titles: alternativeTitles;
|
|
start_date: startDate;
|
|
end_date: endDate;
|
|
synopsis: synopsis;
|
|
mean: mean;
|
|
rank: rank;
|
|
popularity: popularity;
|
|
num_list_users: numListUsers;
|
|
num_scoring_users: numScoringUsers;
|
|
nsfw: nsfw;
|
|
genres: genres;
|
|
created_at: createdAt;
|
|
updated_at: updatedAt;
|
|
media_type: mediaType;
|
|
status: status;
|
|
my_list_status: MalListStatus;
|
|
num_episodes: numEpisodes;
|
|
start_season: startSeason;
|
|
broadcast: broadcast;
|
|
source: source;
|
|
average_episode_duration: averageEpisodeDuration;
|
|
rating: rating;
|
|
studios: studios;
|
|
pictures: pictures;
|
|
background: background;
|
|
related_anime: relatedAnime;
|
|
recommendations: recommendations;
|
|
Statistics: struct { NumListUsers int "json:\"num_list_users\" ts_type:\"numListUsers\""; Status struct { Watching main.;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MALAnime(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.title = source["title"];
|
|
this.main_picture = source["main_picture"];
|
|
this.alternative_titles = source["alternative_titles"];
|
|
this.start_date = source["start_date"];
|
|
this.end_date = source["end_date"];
|
|
this.synopsis = source["synopsis"];
|
|
this.mean = source["mean"];
|
|
this.rank = source["rank"];
|
|
this.popularity = source["popularity"];
|
|
this.num_list_users = source["num_list_users"];
|
|
this.num_scoring_users = source["num_scoring_users"];
|
|
this.nsfw = source["nsfw"];
|
|
this.genres = source["genres"];
|
|
this.created_at = source["created_at"];
|
|
this.updated_at = source["updated_at"];
|
|
this.media_type = source["media_type"];
|
|
this.status = source["status"];
|
|
this.my_list_status = source["my_list_status"];
|
|
this.num_episodes = source["num_episodes"];
|
|
this.start_season = source["start_season"];
|
|
this.broadcast = source["broadcast"];
|
|
this.source = source["source"];
|
|
this.average_episode_duration = source["average_episode_duration"];
|
|
this.rating = source["rating"];
|
|
this.studios = source["studios"];
|
|
this.pictures = source["pictures"];
|
|
this.background = source["background"];
|
|
this.related_anime = source["related_anime"];
|
|
this.recommendations = source["recommendations"];
|
|
this.Statistics = this.convertValues(source["Statistics"], Object);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class MALUploadStatus {
|
|
status: string;
|
|
is_rewatching: boolean;
|
|
score: number;
|
|
num_watched_episodes: number;
|
|
num_times_rewatched: number;
|
|
comments: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MALUploadStatus(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.status = source["status"];
|
|
this.is_rewatching = source["is_rewatching"];
|
|
this.score = source["score"];
|
|
this.num_watched_episodes = source["num_watched_episodes"];
|
|
this.num_times_rewatched = source["num_times_rewatched"];
|
|
this.comments = source["comments"];
|
|
}
|
|
}
|
|
export class MALWatchlist {
|
|
data: data;
|
|
paging: paging;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MALWatchlist(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.data = source["data"];
|
|
this.paging = source["paging"];
|
|
}
|
|
}
|
|
export class MalListStatus {
|
|
status: status;
|
|
score: score;
|
|
num_episodes_watched: numEpisodesWatched;
|
|
is_rewatching: isRewatching;
|
|
start_date: startDate;
|
|
finish_date: finishDate;
|
|
priority: priority;
|
|
num_times_rewatched: numTimesRewatched;
|
|
rewatch_value: rewatchValue;
|
|
tags: tags;
|
|
comments: comments;
|
|
updated_at: updatedAt;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MalListStatus(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.status = source["status"];
|
|
this.score = source["score"];
|
|
this.num_episodes_watched = source["num_episodes_watched"];
|
|
this.is_rewatching = source["is_rewatching"];
|
|
this.start_date = source["start_date"];
|
|
this.finish_date = source["finish_date"];
|
|
this.priority = source["priority"];
|
|
this.num_times_rewatched = source["num_times_rewatched"];
|
|
this.rewatch_value = source["rewatch_value"];
|
|
this.tags = source["tags"];
|
|
this.comments = source["comments"];
|
|
this.updated_at = source["updated_at"];
|
|
}
|
|
}
|
|
export class {
|
|
id: number;
|
|
name: string;
|
|
description: string;
|
|
rank: number;
|
|
isMediaSpoiler: boolean;
|
|
isAdult: boolean;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new (source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.name = source["name"];
|
|
this.description = source["description"];
|
|
this.rank = source["rank"];
|
|
this.isMediaSpoiler = source["isMediaSpoiler"];
|
|
this.isAdult = source["isAdult"];
|
|
}
|
|
}
|
|
export class MediaAiringSchedule {
|
|
nodes: AiringScheduleNode[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MediaAiringSchedule(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.nodes = this.convertValues(source["nodes"], AiringScheduleNode);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class MediaFuzzyDate {
|
|
year: number;
|
|
month: number;
|
|
day: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MediaFuzzyDate(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.year = source["year"];
|
|
this.month = source["month"];
|
|
this.day = source["day"];
|
|
}
|
|
}
|
|
export class MediaRelation {
|
|
id: number;
|
|
title: MediaTitle;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MediaRelation(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.title = this.convertValues(source["title"], MediaTitle);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class MediaRelations {
|
|
nodes: MediaRelation[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MediaRelations(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.nodes = this.convertValues(source["nodes"], MediaRelation);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class MediaTitle {
|
|
userPreferred: string;
|
|
romaji: string;
|
|
english: string;
|
|
native: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MediaTitle(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.userPreferred = source["userPreferred"];
|
|
this.romaji = source["romaji"];
|
|
this.english = source["english"];
|
|
this.native = source["native"];
|
|
}
|
|
}
|
|
export class Media {
|
|
id: number;
|
|
idMal: number;
|
|
title: MediaTitle;
|
|
description: string;
|
|
// Go type: struct { ExtraLarge string; Large string "json:\"large\""; Medium string; Color string }
|
|
coverImage: any;
|
|
BannerImage: string;
|
|
Format: string;
|
|
season: string;
|
|
seasonYear: number;
|
|
status: string;
|
|
episodes: number;
|
|
Duration: number;
|
|
CountryOfOrigin: string;
|
|
Source: string;
|
|
Synonyms: string[];
|
|
AverageScore: number;
|
|
MeanScore: number;
|
|
Popularity: number;
|
|
Trending: number;
|
|
Favourites: number;
|
|
relations: MediaRelations;
|
|
startDate: MediaFuzzyDate;
|
|
endDate: MediaFuzzyDate;
|
|
// Go type: struct { AiringAt int "json:\"airingAt\""; TimeUntilAiring int "json:\"timeUntilAiring\""; Episode int "json:\"episode\"" }
|
|
nextAiringEpisode: any;
|
|
airingSchedule: MediaAiringSchedule;
|
|
genres: string[];
|
|
tags: [];
|
|
isAdult: boolean;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Media(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.idMal = source["idMal"];
|
|
this.title = this.convertValues(source["title"], MediaTitle);
|
|
this.description = source["description"];
|
|
this.coverImage = this.convertValues(source["coverImage"], Object);
|
|
this.BannerImage = source["BannerImage"];
|
|
this.Format = source["Format"];
|
|
this.season = source["season"];
|
|
this.seasonYear = source["seasonYear"];
|
|
this.status = source["status"];
|
|
this.episodes = source["episodes"];
|
|
this.Duration = source["Duration"];
|
|
this.CountryOfOrigin = source["CountryOfOrigin"];
|
|
this.Source = source["Source"];
|
|
this.Synonyms = source["Synonyms"];
|
|
this.AverageScore = source["AverageScore"];
|
|
this.MeanScore = source["MeanScore"];
|
|
this.Popularity = source["Popularity"];
|
|
this.Trending = source["Trending"];
|
|
this.Favourites = source["Favourites"];
|
|
this.relations = this.convertValues(source["relations"], MediaRelations);
|
|
this.startDate = this.convertValues(source["startDate"], MediaFuzzyDate);
|
|
this.endDate = this.convertValues(source["endDate"], MediaFuzzyDate);
|
|
this.nextAiringEpisode = this.convertValues(source["nextAiringEpisode"], Object);
|
|
this.airingSchedule = this.convertValues(source["airingSchedule"], MediaAiringSchedule);
|
|
this.genres = source["genres"];
|
|
this.tags = this.convertValues(source["tags"], );
|
|
this.isAdult = source["isAdult"];
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
|
|
export class MediaList {
|
|
id: number;
|
|
mediaId: number;
|
|
userId: number;
|
|
status: string;
|
|
media: Media;
|
|
// Go type: struct { Year int "json:\"year\""; Month int "json:\"month\""; Day int "json:\"day\"" }
|
|
startedAt: any;
|
|
// Go type: struct { Year int "json:\"year\""; Month int "json:\"month\""; Day int "json:\"day\"" }
|
|
completedAt: any;
|
|
notes: string;
|
|
progress: number;
|
|
score: number;
|
|
repeat: number;
|
|
// Go type: 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\"" }
|
|
user: any;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MediaList(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.mediaId = source["mediaId"];
|
|
this.userId = source["userId"];
|
|
this.status = source["status"];
|
|
this.media = this.convertValues(source["media"], Media);
|
|
this.startedAt = this.convertValues(source["startedAt"], Object);
|
|
this.completedAt = this.convertValues(source["completedAt"], Object);
|
|
this.notes = source["notes"];
|
|
this.progress = source["progress"];
|
|
this.score = source["score"];
|
|
this.repeat = source["repeat"];
|
|
this.user = this.convertValues(source["user"], Object);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export class MyAnimeListUser {
|
|
id: id;
|
|
name: name;
|
|
picture: picture;
|
|
gender: gender;
|
|
birthday: birthday;
|
|
location: location;
|
|
joined_at: joinedAt;
|
|
num_items_watching: numItemsWatching;
|
|
num_items_completed: numItemsCompleted;
|
|
num_items_on_hold: numItemsOnHold;
|
|
num_items_dropped: numItemsDropped;
|
|
num_items_plan_to_watch: numItemsPlanToWatch;
|
|
num_items: numItems;
|
|
num_days_watched: numDaysWatched;
|
|
num_days_watching: numDaysWatching;
|
|
num_days_completed: numDaysCompleted;
|
|
num_days_on_hold: numDaysOnHold;
|
|
num_days_dropped: numDaysDropped;
|
|
num_days: numDays;
|
|
num_episodes: numEpisodes;
|
|
num_times_rewatched: numTimesRewatched;
|
|
mean_score: meanScore;
|
|
time_zone: timeZone;
|
|
is_supporter: isSupporter;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new MyAnimeListUser(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.name = source["name"];
|
|
this.picture = source["picture"];
|
|
this.gender = source["gender"];
|
|
this.birthday = source["birthday"];
|
|
this.location = source["location"];
|
|
this.joined_at = source["joined_at"];
|
|
this.num_items_watching = source["num_items_watching"];
|
|
this.num_items_completed = source["num_items_completed"];
|
|
this.num_items_on_hold = source["num_items_on_hold"];
|
|
this.num_items_dropped = source["num_items_dropped"];
|
|
this.num_items_plan_to_watch = source["num_items_plan_to_watch"];
|
|
this.num_items = source["num_items"];
|
|
this.num_days_watched = source["num_days_watched"];
|
|
this.num_days_watching = source["num_days_watching"];
|
|
this.num_days_completed = source["num_days_completed"];
|
|
this.num_days_on_hold = source["num_days_on_hold"];
|
|
this.num_days_dropped = source["num_days_dropped"];
|
|
this.num_days = source["num_days"];
|
|
this.num_episodes = source["num_episodes"];
|
|
this.num_times_rewatched = source["num_times_rewatched"];
|
|
this.mean_score = source["mean_score"];
|
|
this.time_zone = source["time_zone"];
|
|
this.is_supporter = source["is_supporter"];
|
|
}
|
|
}
|
|
export class SimklAnime {
|
|
last_watched_at: last_watched_at;
|
|
status: status;
|
|
user_rating: user_rating;
|
|
last_watched: last_watched;
|
|
next_to_watch: next_to_watch;
|
|
watched_episodes_count: watched_episodes_count;
|
|
total_episodes_count: total_episodes_count;
|
|
not_aired_episodes_count: not_aired_episodes_count;
|
|
show: show;
|
|
anime_type: anime_type;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new SimklAnime(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.last_watched_at = source["last_watched_at"];
|
|
this.status = source["status"];
|
|
this.user_rating = source["user_rating"];
|
|
this.last_watched = source["last_watched"];
|
|
this.next_to_watch = source["next_to_watch"];
|
|
this.watched_episodes_count = source["watched_episodes_count"];
|
|
this.total_episodes_count = source["total_episodes_count"];
|
|
this.not_aired_episodes_count = source["not_aired_episodes_count"];
|
|
this.show = source["show"];
|
|
this.anime_type = source["anime_type"];
|
|
}
|
|
}
|
|
export class SimklUser {
|
|
user: user;
|
|
account: account;
|
|
connections: connections;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new SimklUser(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.user = source["user"];
|
|
this.account = source["account"];
|
|
this.connections = source["connections"];
|
|
}
|
|
}
|
|
export class SimklWatchListType {
|
|
anime: anime;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new SimklWatchListType(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.anime = source["anime"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace struct { MediaList main {
|
|
|
|
export class {
|
|
MediaList: main.MediaList;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new (source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.MediaList = this.convertValues(source["MediaList"], main.MediaList);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace struct { Node main {
|
|
|
|
export class {
|
|
node: node;
|
|
num_recommendations: numRecommendations;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new (source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.node = source["node"];
|
|
this.num_recommendations = source["num_recommendations"];
|
|
}
|
|
}
|
|
export class {
|
|
node: node;
|
|
relation_type: relationType;
|
|
relation_type_formatted: relationTypeFormatted;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new (source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.node = source["node"];
|
|
this.relation_type = source["relation_type"];
|
|
this.relation_type_formatted = source["relation_type_formatted"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace struct { Node struct { Id int "json:\"id\" ts_type:\"id\""; Title string "json:\"title\" ts_type:\"title\""; MainPicture struct { Medium string "json:\"medium\" ts_type:\"medium\""; Large string "json:\"large\" ts_type:\"large\"" } "json:\"main_picture\" ts_type:\"mainPicture\"" } "json:\"node\" ts_type:\"node\""; ListStatus struct { Status string "json:\"status\" ts_type:\"status\""; Score int "json:\"score\" ts_type:\"score\""; NumEpisodesWatched int "json:\"num_episodes_watched\" ts_type:\"numEpisodesWatched\""; IsRewatching bool "json:\"is_rewatching\" ts_type:\"isRewatching\""; UpdatedAt time {
|
|
|
|
export class {
|
|
node: node;
|
|
list_status: listStatus;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new (source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.node = source["node"];
|
|
this.list_status = source["list_status"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace struct { NumListUsers int "json:\"num_list_users\" ts_type:\"numListUsers\""; Status struct { Watching main {
|
|
|
|
export class {
|
|
num_list_users: numListUsers;
|
|
Status: struct { Watching main.;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new (source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.num_list_users = source["num_list_users"];
|
|
this.Status = this.convertValues(source["Status"], Object);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace struct { Status string "json:\"status\" ts_type:\"status\""; Score int "json:\"score\" ts_type:\"score\""; NumEpisodesWatched int "json:\"num_episodes_watched\" ts_type:\"numEpisodesWatched\""; IsRewatching bool "json:\"is_rewatching\" ts_type:\"isRewatching\""; UpdatedAt time {
|
|
|
|
export class {
|
|
status: status;
|
|
score: score;
|
|
num_episodes_watched: numEpisodesWatched;
|
|
is_rewatching: isRewatching;
|
|
updated_at: updatedAt;
|
|
start_date: startDate;
|
|
finish_date: finishDate;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new (source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.status = source["status"];
|
|
this.score = source["score"];
|
|
this.num_episodes_watched = source["num_episodes_watched"];
|
|
this.is_rewatching = source["is_rewatching"];
|
|
this.updated_at = source["updated_at"];
|
|
this.start_date = source["start_date"];
|
|
this.finish_date = source["finish_date"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace struct { Watching main {
|
|
|
|
export class {
|
|
watching: string;
|
|
completed: string;
|
|
on_hold: string;
|
|
dropped: string;
|
|
plan_to_watch: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new (source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.watching = source["watching"];
|
|
this.completed = source["completed"];
|
|
this.on_hold = source["on_hold"];
|
|
this.dropped = source["dropped"];
|
|
this.plan_to_watch = source["plan_to_watch"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|