mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
feat(api): fetch listens from spotify
This commit is contained in:
parent
f253a66f86
commit
f2065d3f1f
54 changed files with 1180 additions and 256 deletions
67
src/sources/spotify/spotify-api/entities/album-object.ts
Normal file
67
src/sources/spotify/spotify-api/entities/album-object.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { PagingObject } from "./paging-object";
|
||||
import { SimplifiedTrackObject } from "./simplified-track-object";
|
||||
import { SimplifiedArtistObject } from "./simplified-artist-object";
|
||||
|
||||
// tslint:disable: variable-name
|
||||
|
||||
export class AlbumObject {
|
||||
/**
|
||||
* A list of the genres used to classify the album.
|
||||
* For example: "Prog Rock" , "Post-Grunge".
|
||||
* (If not yet classified, the array is empty.)
|
||||
*/
|
||||
genres: string[];
|
||||
|
||||
/**
|
||||
* The artists of the album.
|
||||
* Each artist object includes a link in href to more detailed information about the artist.
|
||||
*/
|
||||
artists: SimplifiedArtistObject[];
|
||||
|
||||
/**
|
||||
* A link to the Web API endpoint providing full details of the album.
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The Spotify ID for the album.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The label for the album.
|
||||
*/
|
||||
label: string;
|
||||
|
||||
/**
|
||||
* The name of the album.
|
||||
* In case of an album takedown, the value may be an empty string.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The object type: "album".
|
||||
*/
|
||||
type: "album";
|
||||
|
||||
/**
|
||||
* The Spotify URI for the album.
|
||||
*/
|
||||
uri: string;
|
||||
|
||||
/**
|
||||
* The date the album was first released, for example `1981`.
|
||||
* Depending on the precision, it might be shown as `1981-12` or `1981-12-15`.
|
||||
*/
|
||||
release_date: string;
|
||||
|
||||
/**
|
||||
* The precision with which `release_date` value is known: `year` , `month` , or `day`.
|
||||
*/
|
||||
release_date_precision: "year" | "month" | "day";
|
||||
|
||||
/**
|
||||
* The tracks of the album.
|
||||
*/
|
||||
tracks: PagingObject<SimplifiedTrackObject>;
|
||||
}
|
||||
32
src/sources/spotify/spotify-api/entities/artist-object.ts
Normal file
32
src/sources/spotify/spotify-api/entities/artist-object.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
export class ArtistObject {
|
||||
/**
|
||||
* A list of the genres the artist is associated with.
|
||||
* For example: "Prog Rock" , "Post-Grunge".
|
||||
* (If not yet classified, the array is empty.)
|
||||
*/
|
||||
genres: string[];
|
||||
/**
|
||||
* A link to the Web API endpoint providing full details of the artist.
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The Spotify ID for the artist.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The name of the artist.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The object type: "artist".
|
||||
*/
|
||||
type: "artist";
|
||||
|
||||
/**
|
||||
* The Spotify URI for the artist.
|
||||
*/
|
||||
uri: string;
|
||||
}
|
||||
25
src/sources/spotify/spotify-api/entities/context-object.ts
Normal file
25
src/sources/spotify/spotify-api/entities/context-object.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { ExternalUrlObject } from "./external-url-object";
|
||||
|
||||
// tslint:disable variable-name
|
||||
|
||||
export class ContextObject {
|
||||
/**
|
||||
* External URLs for this context.
|
||||
*/
|
||||
external_urls: ExternalUrlObject;
|
||||
|
||||
/**
|
||||
* A link to the Web API endpoint providing full details of the track.
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The object type, e.g. "artist", "playlist", "album".
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The Spotify URI for the context.
|
||||
*/
|
||||
uri: string;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
export class ExternalUrlObject {
|
||||
// No documentation for this exists
|
||||
}
|
||||
36
src/sources/spotify/spotify-api/entities/paging-object.ts
Normal file
36
src/sources/spotify/spotify-api/entities/paging-object.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
export class PagingObject<T = any> {
|
||||
/**
|
||||
* A link to the Web API endpoint returning the full result of the request
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The requested data
|
||||
*/
|
||||
items: T[];
|
||||
|
||||
/**
|
||||
* The maximum number of items in the response (as set in the query or by default).
|
||||
*/
|
||||
limit: number;
|
||||
|
||||
/**
|
||||
* URL to the next page of items. ( null if none)
|
||||
*/
|
||||
next: string;
|
||||
|
||||
/**
|
||||
* The offset of the items returned (as set in the query or by default)
|
||||
*/
|
||||
offset: number;
|
||||
|
||||
/**
|
||||
* URL to the previous page of items. ( null if none)
|
||||
*/
|
||||
previous: string;
|
||||
|
||||
/**
|
||||
* The total number of items available to return.
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import { ContextObject } from "./context-object";
|
||||
import { SimplifiedTrackObject } from "./simplified-track-object";
|
||||
|
||||
// tslint:disable variable-name
|
||||
|
||||
export class PlayHistoryObject {
|
||||
/**
|
||||
* The context the track was played from.
|
||||
*/
|
||||
context: ContextObject;
|
||||
|
||||
/**
|
||||
* The date and time the track was played.
|
||||
*/
|
||||
played_at: string;
|
||||
|
||||
/**
|
||||
* The track the user listened to.
|
||||
*/
|
||||
track: SimplifiedTrackObject;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// tslint:disable: variable-name
|
||||
|
||||
export class SimplifiedAlbumObject {
|
||||
album_type: "album" | "single" | "compilation";
|
||||
|
||||
/**
|
||||
* A link to the Web API endpoint providing full details of the album.
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The Spotify ID for the album.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The name of the album. In case of an album takedown, the value may be an empty string.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The object type: "album".
|
||||
*/
|
||||
type: "album";
|
||||
|
||||
/**
|
||||
* The Spotify URI for the album.
|
||||
*/
|
||||
uri: string;
|
||||
|
||||
/**
|
||||
* The date the album was first released, for example `1981`.
|
||||
* Depending on the precision, it might be shown as `1981-12` or `1981-12-15`.
|
||||
*/
|
||||
release_date: string;
|
||||
|
||||
/**
|
||||
* The precision with which `release_date` value is known: `year` , `month` , or `day`.
|
||||
*/
|
||||
release_date_precision: "year" | "month" | "day";
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
export class SimplifiedArtistObject {
|
||||
/**
|
||||
* A link to the Web API endpoint providing full details of the artist.
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The Spotify ID for the artist.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The name of the artist.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The object type: "artist".
|
||||
*/
|
||||
type: "artist";
|
||||
|
||||
/**
|
||||
* The Spotify URI for the artist.
|
||||
*/
|
||||
uri: string;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
export class SimplifiedTrackObject {
|
||||
/**
|
||||
* The Spotify ID for the track.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The name of the track.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The Spotify URI for the track.
|
||||
*/
|
||||
uri: string;
|
||||
}
|
||||
46
src/sources/spotify/spotify-api/entities/track-object.ts
Normal file
46
src/sources/spotify/spotify-api/entities/track-object.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { SimplifiedAlbumObject } from "./simplified-album-object";
|
||||
import { SimplifiedArtistObject } from "./simplified-artist-object";
|
||||
|
||||
// tslint:disable: variable-name
|
||||
|
||||
export class TrackObject {
|
||||
/**
|
||||
* The album on which the track appears. The album object includes a link in href to full information about the album.
|
||||
*/
|
||||
album: SimplifiedAlbumObject;
|
||||
|
||||
/**
|
||||
* The album on which the track appears. The album object includes a link in href to full information about the album.
|
||||
*/
|
||||
artists: SimplifiedArtistObject[];
|
||||
|
||||
/**
|
||||
* The track length in milliseconds.
|
||||
*/
|
||||
duration_ms: number;
|
||||
|
||||
/**
|
||||
* A link to the Web API endpoint providing full details of the track.
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The Spotify ID for the track.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The name of the track.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The object type: "track".
|
||||
*/
|
||||
type: "track";
|
||||
|
||||
/**
|
||||
* The Spotify URI for the track.
|
||||
*/
|
||||
uri: string;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue