mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #23930 from nickp10/master
Types for jamon/playmusic npm module
This commit is contained in:
Vendored
+325
@@ -0,0 +1,325 @@
|
||||
// Type definitions for playmusic 2.3
|
||||
// Project: https://www.github.com/jamon/playmusic
|
||||
// Definitions by: Nick Paddock <https://github.com/nickp10>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export interface InitOptions {
|
||||
androidId?: string;
|
||||
email?: string;
|
||||
password?: string;
|
||||
masterToken?: string;
|
||||
}
|
||||
|
||||
export interface LoginOptions {
|
||||
androidId?: string;
|
||||
email?: string;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
androidId: string;
|
||||
masterToken: string;
|
||||
}
|
||||
|
||||
export interface LibraryOptions {
|
||||
limit?: number;
|
||||
nextPageToken?: string;
|
||||
}
|
||||
|
||||
export interface LibraryResponse {
|
||||
data?: LibraryData;
|
||||
kind?: string;
|
||||
nextPageToken?: string;
|
||||
}
|
||||
|
||||
export interface LibraryData {
|
||||
items?: LibraryItem[];
|
||||
}
|
||||
|
||||
export interface LibraryItem {
|
||||
album?: string;
|
||||
albumArtist?: string;
|
||||
albumArtRef?: ArtRef[];
|
||||
artist?: string;
|
||||
artistArtRef?: ArtRef[];
|
||||
artistId?: string[];
|
||||
beatsPerMinute?: number;
|
||||
clientId?: string;
|
||||
comment?: string;
|
||||
composer?: string;
|
||||
creationTimestamp?: string;
|
||||
deleted?: boolean;
|
||||
discNumber?: number;
|
||||
durationMillis?: string;
|
||||
estimatedSize?: string;
|
||||
genre?: string;
|
||||
id?: string;
|
||||
kind?: string;
|
||||
lastModifiedTimestamp?: string;
|
||||
nid?: string;
|
||||
playCount?: number;
|
||||
rating?: string;
|
||||
recentTimestamp?: string;
|
||||
storeId?: string;
|
||||
title?: string;
|
||||
totalDiscCount?: number;
|
||||
totalTrackCount?: number;
|
||||
trackNumber?: number;
|
||||
year?: number;
|
||||
}
|
||||
|
||||
export interface ArtRef {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface PlaylistListResponse {
|
||||
data?: PlaylistListData;
|
||||
kind?: string;
|
||||
}
|
||||
|
||||
export interface PlaylistListData {
|
||||
items?: PlaylistListItem[];
|
||||
}
|
||||
|
||||
export interface PlaylistListItem {
|
||||
accessControlled?: boolean;
|
||||
creationTimestamp?: string;
|
||||
deleted?: boolean;
|
||||
description?: string;
|
||||
id?: string;
|
||||
kind?: string;
|
||||
lastModifiedTimestamp?: string;
|
||||
name?: string;
|
||||
ownerName?: string;
|
||||
ownerProfilePhotoUrl?: string;
|
||||
recentTimestamp?: string;
|
||||
shareToken?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface PlaylistOptions {
|
||||
limit?: number;
|
||||
nextPageToken?: string;
|
||||
}
|
||||
|
||||
export interface PlaylistResponse {
|
||||
data?: PlaylistData;
|
||||
kind?: string;
|
||||
nextPageToken?: string;
|
||||
}
|
||||
|
||||
export interface PlaylistData {
|
||||
items?: PlaylistItem[];
|
||||
}
|
||||
|
||||
export interface PlaylistItem {
|
||||
absolutePosition?: string;
|
||||
clientId?: string;
|
||||
creationTimestamp?: string;
|
||||
deleted?: boolean;
|
||||
id?: string;
|
||||
kind?: string;
|
||||
lastModifiedTimestamp?: string;
|
||||
playlistId?: string;
|
||||
source?: string;
|
||||
track?: PlaylistTrack;
|
||||
trackId?: string;
|
||||
}
|
||||
|
||||
export interface PlaylistTrack {
|
||||
album?: string;
|
||||
albumArtist?: string;
|
||||
albumArtRef?: ArtRef[];
|
||||
albumAvailableForPurchase?: boolean;
|
||||
albumId?: string;
|
||||
artist?: string;
|
||||
artistArtRef?: ArtRef[];
|
||||
artistId?: string[];
|
||||
composer?: string;
|
||||
contentType?: string;
|
||||
discNumber?: number;
|
||||
durationMillis?: string;
|
||||
estimatedSize?: string;
|
||||
genre?: string;
|
||||
kind?: string;
|
||||
nid?: string;
|
||||
playCount?: number;
|
||||
storeId?: string;
|
||||
title?: string;
|
||||
trackAvailableForPurchase?: boolean;
|
||||
trackAvailableForSubscription?: boolean;
|
||||
trackNumber?: number;
|
||||
trackType?: string;
|
||||
year?: number;
|
||||
}
|
||||
|
||||
export interface PlaylistMeta {
|
||||
name?: string;
|
||||
description?: string;
|
||||
shareState?: string;
|
||||
}
|
||||
|
||||
export interface MutateResponses {
|
||||
mutate_response?: MutateResponse[];
|
||||
}
|
||||
|
||||
export interface MutateResponse {
|
||||
client_id?: string;
|
||||
id?: string;
|
||||
response_code?: string;
|
||||
}
|
||||
|
||||
export default class PlayMusic {
|
||||
constructor();
|
||||
init(options: InitOptions, callback: (error: Error) => void): void;
|
||||
login(options: LoginOptions, callback: (error: Error, response: LoginResponse) => void): void;
|
||||
|
||||
/**
|
||||
* Returns settings / device ids authorized for account.
|
||||
*
|
||||
* @param callback function(error, response) - success callback
|
||||
*/
|
||||
getSettings(callback: (error: Error, response: any) => void): void;
|
||||
|
||||
/**
|
||||
* Returns list of all tracks.
|
||||
*
|
||||
* @param callback function(error, response) - success callback
|
||||
*/
|
||||
getLibrary(callback: (error: Error, response: LibraryResponse) => void): void;
|
||||
|
||||
/**
|
||||
* Returns list of all tracks.
|
||||
*
|
||||
* @param options object - parameters
|
||||
* @param callback function(error, response) - success callback
|
||||
*/
|
||||
getLibrary(options: LibraryOptions, callback: (error: Error, response: LibraryResponse) => void): void;
|
||||
|
||||
/**
|
||||
* Returns stream URL for a track.
|
||||
*
|
||||
* @param id string - track id, hyphenated is preferred, but "nid" will work for all access tracks (not uploaded ones)
|
||||
* @param callback function(err, streamUrl) - success callback
|
||||
*/
|
||||
getStreamUrl(id: string, callback: (error: Error, streamUrl: string) => void): void;
|
||||
|
||||
/**
|
||||
* Opens and returns a stream object
|
||||
*
|
||||
* @param id string - track id, hyphenated is preferred, but "nid" will work for all access tracks (not uploaded ones)
|
||||
* @param callback function(stream) - success callback
|
||||
*/
|
||||
getStream(id: string, callback: (error: Error, stream: any) => void): void;
|
||||
|
||||
/**
|
||||
* Searches for All Access tracks.
|
||||
*
|
||||
* @param text string - search text
|
||||
* @param maxResults int - max number of results to return
|
||||
* @param callback function(err, searchResults) - success callback
|
||||
*/
|
||||
search(text: string, maxResults: number, callback: (error: Error, searchResults: any) => void): void;
|
||||
|
||||
/**
|
||||
* Returns list of all playlists.
|
||||
*
|
||||
* @param callback function(error, playlists) - success callback
|
||||
*/
|
||||
getPlayLists(callback: (error: Error, response: PlaylistListResponse) => void): void;
|
||||
|
||||
/**
|
||||
* Creates a new playlist.
|
||||
*
|
||||
* @param playlistName string - the playlist name
|
||||
* @param callback function(error, mutateResponses) - success callback
|
||||
*/
|
||||
addPlayList(playlistName: string, callback: (error: Error, mutateResponses: MutateResponses) => void): void;
|
||||
|
||||
/**
|
||||
* Deletes a playlist
|
||||
*
|
||||
* @param playlistId string - the playlist id
|
||||
* @param callback function(err, mutationStatus) - success callback
|
||||
*/
|
||||
deletePlaylist(playlistId: string, callback: (error: Error, mutationStatus: MutateResponses) => void): void;
|
||||
|
||||
/**
|
||||
* Updates a playlist's metadata
|
||||
*
|
||||
* @param playlistId string - the playlist id
|
||||
* @param updates object - data to update the playlist with
|
||||
* @param callback function(err, mutationStatus) - success callback
|
||||
*/
|
||||
updatePlayListMeta(playlistId: string, updates: PlaylistMeta, callback: (error: Error, mutationStatus: MutateResponses) => void): void;
|
||||
|
||||
/**
|
||||
* Adds a track to end of a playlist.
|
||||
*
|
||||
* @param songId string or array of string - the song id(s)
|
||||
* @param playlistId string - the playlist id
|
||||
* @param callback function(error, mutateResponses) - success callback
|
||||
* @param entryBeforeClientId - optional clientId of playlist entry where to add song after
|
||||
* @param entryAfterClientId - optional clientId of playlist entry where to add song before
|
||||
*/
|
||||
addTrackToPlayList(
|
||||
songIds: string | string[],
|
||||
playlistId: string,
|
||||
callback: (error: Error, mutateResponses: MutateResponses) => void,
|
||||
entryBeforeClientId?: string,
|
||||
entryAfterClientId?: string): void;
|
||||
|
||||
/**
|
||||
* Move the specified entry inbetween two specified entries (identified by their clientIds)
|
||||
*
|
||||
* @param entryToMove string - the song id to move
|
||||
* @param entryBeforeClientId - optional clientId of playlist entry where to move song after
|
||||
* @param entryAfterClientId - optional clientId of playlist entry where to move song before
|
||||
* @param callback function(err, playlistEntries) - success callback
|
||||
*/
|
||||
movePlayListEntry(entryToMove: string, entryBeforeClientId: string, entryAfterClientId: string, callback: (error: Error, mutateResponses: MutateResponses) => void): void;
|
||||
|
||||
/**
|
||||
* Increments track's playcount
|
||||
*
|
||||
* @param songId int - the song id. See http://bit.ly/1L4U6oK for id requirements.
|
||||
* @param callback function(err, mutationStatus) - success callback
|
||||
*/
|
||||
incrementTrackPlaycount(songId: string, callback: (error: Error, mutationStatus: MutateResponses) => void): void;
|
||||
|
||||
/**
|
||||
* Change metadata of a track a library
|
||||
* Currently only support changing rating
|
||||
* You need to change a song object with a different rating value:
|
||||
* 5 = thumb up, 1 = thumb down, 0 = no thumb
|
||||
*
|
||||
* @param song object - the track dictionary. You can get from getAllAccessTrack or from getLibrary
|
||||
* @param callback function(err, success) - success callback
|
||||
*/
|
||||
changeTrackMetadata(song: any, callback: (error: Error, success: MutateResponses) => void): void;
|
||||
|
||||
/**
|
||||
* Removes given entry ids from playlist entries.
|
||||
*
|
||||
* @param playlistItemIds string or array of string - the entry id(s). You can get this from getPlayListEntries or PlaylistItem#id.
|
||||
* @param callback function(error, mutateResponses) - success callback
|
||||
*/
|
||||
removePlayListEntry(playlistItemIds: string | string[], callback: (error: Error, mutateResponses: MutateResponses) => void): void;
|
||||
|
||||
/**
|
||||
* Returns tracks on all playlists.
|
||||
*
|
||||
* @param callback function(error, response) - success callback
|
||||
*/
|
||||
getPlayListEntries(callback: (error: Error, response: PlaylistResponse) => void): void;
|
||||
|
||||
/**
|
||||
* Returns tracks on all playlists.
|
||||
*
|
||||
* @param options object - parameters
|
||||
* @param callback function(error, response) - success callback
|
||||
*/
|
||||
getPlayListEntries(options: PlaylistOptions, callback: (error: Error, response: PlaylistResponse) => void): void;
|
||||
}
|
||||
@@ -0,0 +1,357 @@
|
||||
import PlayMusic, * as pm from "playmusic";
|
||||
|
||||
const instance = new PlayMusic();
|
||||
|
||||
instance.init({
|
||||
androidId: "androidId",
|
||||
email: "email",
|
||||
password: "password",
|
||||
masterToken: "masterToken"
|
||||
}, (error: Error) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
});
|
||||
|
||||
instance.login({
|
||||
androidId: "androidId",
|
||||
email: "email",
|
||||
password: "password"
|
||||
}, (error: Error, loginResponse: pm.LoginResponse) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
console.log(loginResponse.androidId);
|
||||
console.log(loginResponse.masterToken);
|
||||
});
|
||||
|
||||
instance.getSettings((error: Error, response: any) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
});
|
||||
|
||||
instance.getLibrary((error: Error, response: pm.LibraryResponse) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
});
|
||||
|
||||
instance.getLibrary({
|
||||
limit: 123,
|
||||
nextPageToken: "nextPageToken"
|
||||
}, (error: Error, response: pm.LibraryResponse) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (response && response.data && response.data.items) {
|
||||
response.data.items.forEach((item: pm.LibraryItem) => {
|
||||
console.log(item.album);
|
||||
console.log(item.albumArtist);
|
||||
if (item.albumArtRef) {
|
||||
console.log(item.albumArtRef[0].url);
|
||||
}
|
||||
console.log(item.artist);
|
||||
if (item.artistArtRef) {
|
||||
console.log(item.artistArtRef[0].url);
|
||||
}
|
||||
if (item.artistId) {
|
||||
console.log(item.artistId.length);
|
||||
}
|
||||
console.log(item.beatsPerMinute);
|
||||
console.log(item.clientId);
|
||||
console.log(item.comment);
|
||||
console.log(item.composer);
|
||||
console.log(item.creationTimestamp);
|
||||
console.log(item.deleted);
|
||||
console.log(item.discNumber);
|
||||
console.log(item.durationMillis);
|
||||
console.log(item.estimatedSize);
|
||||
console.log(item.genre);
|
||||
console.log(item.id);
|
||||
console.log(item.kind);
|
||||
console.log(item.lastModifiedTimestamp);
|
||||
console.log(item.nid);
|
||||
console.log(item.playCount);
|
||||
console.log(item.rating);
|
||||
console.log(item.recentTimestamp);
|
||||
console.log(item.storeId);
|
||||
console.log(item.title);
|
||||
console.log(item.totalDiscCount);
|
||||
console.log(item.totalTrackCount);
|
||||
console.log(item.trackNumber);
|
||||
console.log(item.year);
|
||||
});
|
||||
}
|
||||
console.log(response.kind);
|
||||
console.log(response.nextPageToken);
|
||||
});
|
||||
|
||||
instance.getStreamUrl("id", (error: Error, streamUrl: string) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
console.log(streamUrl);
|
||||
});
|
||||
|
||||
instance.getStream("id", (error: Error, stream: any) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
console.log(stream);
|
||||
});
|
||||
|
||||
instance.search("text", 123, (error: Error, searchResults: any) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
console.log(searchResults);
|
||||
});
|
||||
|
||||
instance.getPlayLists((error: Error, response: pm.PlaylistListResponse) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (response && response.data && response.data.items) {
|
||||
response.data.items.forEach((item: pm.PlaylistListItem) => {
|
||||
console.log(item.accessControlled);
|
||||
console.log(item.creationTimestamp);
|
||||
console.log(item.deleted);
|
||||
console.log(item.description);
|
||||
console.log(item.id);
|
||||
console.log(item.kind);
|
||||
console.log(item.lastModifiedTimestamp);
|
||||
console.log(item.name);
|
||||
console.log(item.ownerName);
|
||||
console.log(item.ownerProfilePhotoUrl);
|
||||
console.log(item.recentTimestamp);
|
||||
console.log(item.shareToken);
|
||||
console.log(item.type);
|
||||
});
|
||||
}
|
||||
console.log(response.kind);
|
||||
});
|
||||
|
||||
instance.addPlayList("playlistName", (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
instance.deletePlaylist("playlistId", (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
instance.updatePlayListMeta("playlistId", {
|
||||
name: "name",
|
||||
description: "description",
|
||||
shareState: "shareState"
|
||||
}, (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
instance.addTrackToPlayList("songId", "playlistId", (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
}, "entryBeforeClientId", "entryAfterClientId");
|
||||
|
||||
instance.addTrackToPlayList(["songId1", "songId2"], "playlistId", (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
}, "entryBeforeClientId", "entryAfterClientId");
|
||||
|
||||
instance.movePlayListEntry("entryToMove", "entryBeforeClientId", "entryAfterClientId", (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
instance.incrementTrackPlaycount("songId", (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
instance.changeTrackMetadata({ }, (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
instance.removePlayListEntry("playlistItemId", (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
instance.removePlayListEntry(["playlistItemId1", "playlistItemId2"], (error: Error, mutateResponses: pm.MutateResponses) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (mutateResponses && mutateResponses.mutate_response) {
|
||||
mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => {
|
||||
console.log(mutateResponse.client_id);
|
||||
console.log(mutateResponse.id);
|
||||
console.log(mutateResponse.response_code);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
instance.getPlayListEntries((error: Error, response: pm.PlaylistResponse) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (response && response.data && response.data.items) {
|
||||
response.data.items.forEach((item: pm.PlaylistItem) => {
|
||||
console.log(item.absolutePosition);
|
||||
console.log(item.clientId);
|
||||
console.log(item.creationTimestamp);
|
||||
console.log(item.deleted);
|
||||
console.log(item.id);
|
||||
console.log(item.kind);
|
||||
console.log(item.lastModifiedTimestamp);
|
||||
console.log(item.playlistId);
|
||||
console.log(item.source);
|
||||
if (item.track) {
|
||||
console.log(item.track.album);
|
||||
console.log(item.track.albumArtist);
|
||||
if (item.track.albumArtRef) {
|
||||
console.log(item.track.albumArtRef[0].url);
|
||||
}
|
||||
console.log(item.track.albumAvailableForPurchase);
|
||||
console.log(item.track.albumId);
|
||||
console.log(item.track.artist);
|
||||
if (item.track.artistArtRef) {
|
||||
console.log(item.track.artistArtRef[0].url);
|
||||
}
|
||||
if (item.track.artistId) {
|
||||
console.log(item.track.artistId.length);
|
||||
}
|
||||
console.log(item.track.composer);
|
||||
console.log(item.track.contentType);
|
||||
console.log(item.track.discNumber);
|
||||
console.log(item.track.durationMillis);
|
||||
console.log(item.track.estimatedSize);
|
||||
console.log(item.track.genre);
|
||||
console.log(item.track.kind);
|
||||
console.log(item.track.nid);
|
||||
console.log(item.track.playCount);
|
||||
console.log(item.track.storeId);
|
||||
console.log(item.track.title);
|
||||
console.log(item.track.trackAvailableForPurchase);
|
||||
console.log(item.track.trackAvailableForSubscription);
|
||||
console.log(item.track.trackNumber);
|
||||
console.log(item.track.trackType);
|
||||
console.log(item.track.year);
|
||||
}
|
||||
console.log(item.trackId);
|
||||
});
|
||||
}
|
||||
console.log(response.kind);
|
||||
console.log(response.nextPageToken);
|
||||
});
|
||||
|
||||
instance.getPlayListEntries({
|
||||
limit: 123,
|
||||
nextPageToken: "nextPageToken"
|
||||
}, (error: Error, response: pm.PlaylistResponse) => {
|
||||
console.log(error.message);
|
||||
console.log(error.name);
|
||||
if (response && response.data && response.data.items) {
|
||||
response.data.items.forEach((item: pm.PlaylistItem) => {
|
||||
console.log(item.absolutePosition);
|
||||
console.log(item.clientId);
|
||||
console.log(item.creationTimestamp);
|
||||
console.log(item.deleted);
|
||||
console.log(item.id);
|
||||
console.log(item.kind);
|
||||
console.log(item.lastModifiedTimestamp);
|
||||
console.log(item.playlistId);
|
||||
console.log(item.source);
|
||||
if (item.track) {
|
||||
console.log(item.track.album);
|
||||
console.log(item.track.albumArtist);
|
||||
if (item.track.albumArtRef) {
|
||||
console.log(item.track.albumArtRef[0].url);
|
||||
}
|
||||
console.log(item.track.albumAvailableForPurchase);
|
||||
console.log(item.track.albumId);
|
||||
console.log(item.track.artist);
|
||||
if (item.track.artistArtRef) {
|
||||
console.log(item.track.artistArtRef[0].url);
|
||||
}
|
||||
if (item.track.artistId) {
|
||||
console.log(item.track.artistId.length);
|
||||
}
|
||||
console.log(item.track.composer);
|
||||
console.log(item.track.contentType);
|
||||
console.log(item.track.discNumber);
|
||||
console.log(item.track.durationMillis);
|
||||
console.log(item.track.estimatedSize);
|
||||
console.log(item.track.genre);
|
||||
console.log(item.track.kind);
|
||||
console.log(item.track.nid);
|
||||
console.log(item.track.playCount);
|
||||
console.log(item.track.storeId);
|
||||
console.log(item.track.title);
|
||||
console.log(item.track.trackAvailableForPurchase);
|
||||
console.log(item.track.trackAvailableForSubscription);
|
||||
console.log(item.track.trackNumber);
|
||||
console.log(item.track.trackType);
|
||||
console.log(item.track.year);
|
||||
}
|
||||
console.log(item.trackId);
|
||||
});
|
||||
}
|
||||
console.log(response.kind);
|
||||
console.log(response.nextPageToken);
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"playmusic-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user