169 lines
4.8 KiB
TypeScript
Executable File
169 lines
4.8 KiB
TypeScript
Executable File
export namespace models {
|
|
|
|
export class ColorScheme {
|
|
primary: string;
|
|
secondary: string;
|
|
ternary: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ColorScheme(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.primary = source["primary"];
|
|
this.secondary = source["secondary"];
|
|
this.ternary = source["ternary"];
|
|
}
|
|
}
|
|
export class Developer {
|
|
id: string;
|
|
name: string;
|
|
link: string;
|
|
picture: string;
|
|
role: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Developer(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.name = source["name"];
|
|
this.link = source["link"];
|
|
this.picture = source["picture"];
|
|
this.role = source["role"];
|
|
}
|
|
}
|
|
export class Game {
|
|
id: string;
|
|
title: string;
|
|
description: string;
|
|
version: string;
|
|
players: string;
|
|
release: string;
|
|
modification: string;
|
|
publicRepositoryLink: string;
|
|
itchLink: string;
|
|
genres: string;
|
|
collections: string;
|
|
executable: string;
|
|
thumbnailPath: string;
|
|
logoPath: string;
|
|
backgroundImagePath: string;
|
|
mediaPaths: string[];
|
|
audioPath: string;
|
|
developers: Developer[];
|
|
colorScheme: ColorScheme;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Game(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.title = source["title"];
|
|
this.description = source["description"];
|
|
this.version = source["version"];
|
|
this.players = source["players"];
|
|
this.release = source["release"];
|
|
this.modification = source["modification"];
|
|
this.publicRepositoryLink = source["publicRepositoryLink"];
|
|
this.itchLink = source["itchLink"];
|
|
this.genres = source["genres"];
|
|
this.collections = source["collections"];
|
|
this.executable = source["executable"];
|
|
this.thumbnailPath = source["thumbnailPath"];
|
|
this.logoPath = source["logoPath"];
|
|
this.backgroundImagePath = source["backgroundImagePath"];
|
|
this.mediaPaths = source["mediaPaths"];
|
|
this.audioPath = source["audioPath"];
|
|
this.developers = this.convertValues(source["developers"], Developer);
|
|
this.colorScheme = this.convertValues(source["colorScheme"], ColorScheme);
|
|
}
|
|
|
|
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 Metadata {
|
|
Collection: string;
|
|
Launch: string;
|
|
Id: string;
|
|
Game: string;
|
|
Version: string;
|
|
Description: string;
|
|
Players: string;
|
|
ThumbnailPath: string;
|
|
ImagePath: string;
|
|
Release: string;
|
|
Modification: string;
|
|
Files: string;
|
|
PublicRepositoryLink: string;
|
|
Genres: string;
|
|
Developers: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Metadata(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Collection = source["Collection"];
|
|
this.Launch = source["Launch"];
|
|
this.Id = source["Id"];
|
|
this.Game = source["Game"];
|
|
this.Version = source["Version"];
|
|
this.Description = source["Description"];
|
|
this.Players = source["Players"];
|
|
this.ThumbnailPath = source["ThumbnailPath"];
|
|
this.ImagePath = source["ImagePath"];
|
|
this.Release = source["Release"];
|
|
this.Modification = source["Modification"];
|
|
this.Files = source["Files"];
|
|
this.PublicRepositoryLink = source["PublicRepositoryLink"];
|
|
this.Genres = source["Genres"];
|
|
this.Developers = source["Developers"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace provider {
|
|
|
|
export class FileBlob {
|
|
Name: string;
|
|
MimeType: string;
|
|
Data: number[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new FileBlob(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Name = source["Name"];
|
|
this.MimeType = source["MimeType"];
|
|
this.Data = source["Data"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|