spotify-service-rg
Version:
This is a Angular service for connecting to and using Spotify API.
120 lines (119 loc) • 5.83 kB
TypeScript
import { HttpClient } from '@angular/common/http';
export declare class SpotifyRgService {
private readonly http;
private baseUrl;
private token;
private scopes;
private callBackUrl;
private clientId;
constructor(http: HttpClient);
login(): void;
setClientId(clientId: string): void;
setCallBackUrl(callBackUrl: string): void;
setScopes(scopes: string): void;
setToken(token: string): void;
/** @description Returns track
* @param artistId Tracks Spotify ID
*/
getTrack(trackId: string): Promise<Object>;
/** @description Returns tracks
* @param artistId Comma separated list of track ID's in a string.
*/
getTracks(trackIds: string): Promise<Object>;
/** @description Returns album
* @param artistId Albums Spotify ID.
*/
getAlbum(albumId: string): Promise<Object>;
/** @description Returns albums
* @param artistId Comma separated list of album ID's in a string..
*/
getAlbums(albumIds: string): Promise<Object>;
/** @description Returns albums tracks
* @param artistId Albums Spotify ID.
*/
getAlbumsTracks(albumId: string): Promise<Object>;
/** @description Returns artist
* @param artistId Artists spotify ID.
*/
getArtist(artistId: string): Promise<Object>;
/** @description Returns artists
* @param artistId Comma separated list of artist ID's in a string.
*/
getArtists(artistIds: string): Promise<Object>;
/** @description Returns artists albums
* @param artistId Artists Spotify ID.
*/
getArtistsAlbums(artistId: string): Promise<Object>;
/** @description Returns artists top tracks
* @param artistId Artists Spotify ID.
* @param countryCode Country code in 2 char Format. For example FI. Defaults to extracting country code from token.
*/
getArtistsTopTracks(artistId: string, countryCode?: string): Promise<Object>;
/** @description Returns the user assosiated with auth token
* @param userId The Spotify User id
*/
getUserById(userId: string): Promise<Object>;
/** @description Returns the user assosiated with auth token
*/
getUser(): Promise<Object>;
/** @description Returns current users top tracks
* @param timeRange The range of time results are returned from. Use short_term, medium_term or long_term. Defaults to long_term.
* @param count Amount of tracks returned. Max value 50. Defaults to 50.
*/
getUsersTopTracks(timeRange: any, count?: string): any;
/** @description Returns users playlists
* @param userId Users Spotify Id
*/
getUsersPlaylists(userId: string): Promise<Object>;
/** @description Returns recommendations based on seeds. Max 5 seeds allowed (thats total so for example 3 artists and 2 tracks)
* @param seedArtists Comma separated list of artist seed Ids
* @param seedTracks Comma separated list of track seed Ids
*/
getRecommendedTracks(seedArtists: string, seedTracks: string): any;
/** @description Get a list of new album releases featured in Spotify
* @param countryCode Country code in 2 char Format. If not set searches from all.
* @param count Amount of results returned. Defaults to 20.
*/
getNewReleases(countryCode?: string, count?: string): Promise<Object>;
/** @description Get a list of Spotify featured playlists
* @param countryCode Country code in 2 char Format. If not set searches from all.
* @param count Amount of results returned. Defaults to 20.
*/
getFeaturedPlaylists(countryCode?: string, count?: string): Promise<Object>;
/** @description Get a single category used to tag items in Spotify
* @param categoryId Spotifys Category Id
*/
getCategory(categoryId: string): Promise<Object>;
/** @description Get a list of categories used to tag items in Spotify
* @param countryCode Country code in 2 char Format. If not set searches from all.
* @param count Amount of results returned. Defaults to 20.
*/
getCategories(countryCode?: string, count?: string): Promise<Object>;
/** @description Get a list of Spotify playlists tagged with a particular category.
* @param categoryId The Spotify category ID for the category.
* @param countryCode Country code in 2 char Format. If not set searches from all.
* @param count Amount of results returned. Defaults to 20.
*/
getCategorysPlaylists(categoryId: string, countryCode?: string, count?: string): Promise<Object>;
/** @description Creates a playlist
* @param userId Users spotify ID.
* @param name A name for the playlist .
* @param description A description for the playlist.
* @param isPublic Defines if a playlist is public or private
*/
createPlayList(userId: number, name: string, description: string, isPublic: boolean): Promise<Object>;
/** @description Adds tracks to playlist
* @param playlistId Playlist ID.
* @param trackUris Array of spotify track uris. Max 100 tracks can be added at a time.
*/
addTracksToPlaylist(playListId: string, trackUris: string[]): Promise<Object>;
/** @description Returns Spotify Catalog information about artists, albums, tracks or playlists that match a keyword string.
* @param query Search word.
* @param type A comma-separated list of item types to search across. Valid types are album, artist, playlist, and track.
* @param count The count is applied within each type, not on the total response. So count 3 with type album,track returns 3 albums and 3 tracks. Max 50.
*/
search(query: string, types: string, count: string): Promise<Object>;
private apiGet;
private apiPost;
private getHeaders;
}