export namespace library { export class Album { ID: number; Name: string; ArtistName: string; CoverArtPath: string; CoverArtSmall: string; CoverArtMedium: string; CoverArtLarge: string; Year: number; static createFrom(source: any = {}) { return new Album(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.ID = source["ID"]; this.Name = source["Name"]; this.ArtistName = source["ArtistName"]; this.CoverArtPath = source["CoverArtPath"]; this.CoverArtSmall = source["CoverArtSmall"]; this.CoverArtMedium = source["CoverArtMedium"]; this.CoverArtLarge = source["CoverArtLarge"]; this.Year = source["Year"]; } } export class Track { TrackName: string; ArtistName: string; TrackLength: string; FilePath: string; TrackNumber: number; DiscNumber: number; static createFrom(source: any = {}) { return new Track(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.TrackName = source["TrackName"]; this.ArtistName = source["ArtistName"]; this.TrackLength = source["TrackLength"]; this.FilePath = source["FilePath"]; this.TrackNumber = source["TrackNumber"]; this.DiscNumber = source["DiscNumber"]; } } } export namespace playlist { export class Summary { ID: number; Name: string; static createFrom(source: any = {}) { return new Summary(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.ID = source["ID"]; this.Name = source["Name"]; } } export class Track { ID: number; Position: number; FilePath: string; Title: string; Artist: string; Album: string; CoverArtPath: string; CoverArtSmall: string; CoverArtMedium: string; CoverArtLarge: string; Duration: string; static createFrom(source: any = {}) { return new Track(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.ID = source["ID"]; this.Position = source["Position"]; this.FilePath = source["FilePath"]; this.Title = source["Title"]; this.Artist = source["Artist"]; this.Album = source["Album"]; this.CoverArtPath = source["CoverArtPath"]; this.CoverArtSmall = source["CoverArtSmall"]; this.CoverArtMedium = source["CoverArtMedium"]; this.CoverArtLarge = source["CoverArtLarge"]; this.Duration = source["Duration"]; } } export class WithTracks { Summary: Summary; Tracks: Track[]; static createFrom(source: any = {}) { return new WithTracks(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.Summary = this.convertValues(source["Summary"], Summary); this.Tracks = this.convertValues(source["Tracks"], Track); } 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; } } }