@kkbox/kkbox-js-sdk
Version:
KKBOX Open API developer SDK for JavaScript. Use it to easily access KKBOX open API to get various metadata about KKBOX's tracks, albums, artists, playlists and stations.
1,453 lines (1,452 loc) • 154 kB
JSON
{
"type": "File",
"start": 0,
"end": 2213,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 74,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2213,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 74,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 49
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 8,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 29
}
},
"imported": {
"type": "Identifier",
"start": 8,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "PLAYLISTS"
},
"name": "PLAYLISTS"
},
"local": {
"type": "Identifier",
"start": 21,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 29
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
}
}
],
"source": {
"type": "StringLiteral",
"start": 36,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 49
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
}
},
{
"type": "ImportDeclaration",
"start": 50,
"end": 81,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 31
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 57,
"end": 64,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 57,
"end": 64,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 70,
"end": 81,
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 31
}
},
"extra": {
"rawValue": "./Fetcher",
"raw": "'./Fetcher'"
},
"value": "./Fetcher",
"leadingComments": null,
"trailingComments": null
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Show user's self private playlists.\n * @see https://docs.kkbox.codes/docs/me-playlists\n ",
"start": 83,
"end": 180,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 181,
"end": 2213,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 74,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 196,
"end": 2213,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 74,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 202,
"end": 219,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 38
},
"identifierName": "MyPlaylistFetcher"
},
"name": "MyPlaylistFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 228,
"end": 235,
"loc": {
"start": {
"line": 8,
"column": 47
},
"end": {
"line": 8,
"column": 54
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 236,
"end": 2213,
"loc": {
"start": {
"line": 8,
"column": 55
},
"end": {
"line": 74,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 273,
"end": 407,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 19,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 273,
"end": 284,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 285,
"end": 289,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 20
},
"identifierName": "http"
},
"name": "http"
}
],
"body": {
"type": "BlockStatement",
"start": 291,
"end": 407,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 19,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 301,
"end": 312,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 19
}
},
"expression": {
"type": "CallExpression",
"start": 301,
"end": 312,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 19
}
},
"callee": {
"type": "Super",
"start": 301,
"end": 306,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 307,
"end": 311,
"loc": {
"start": {
"line": 13,
"column": 14
},
"end": {
"line": 13,
"column": 18
},
"identifierName": "http"
},
"name": "http"
}
],
"trailingComments": null
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 322,
"end": 356,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 365,
"end": 401,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 44
}
},
"expression": {
"type": "AssignmentExpression",
"start": 365,
"end": 401,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 44
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 365,
"end": 389,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 32
}
},
"object": {
"type": "ThisExpression",
"start": 365,
"end": 369,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 370,
"end": 389,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 32
},
"identifierName": "private_playlist_id"
},
"name": "private_playlist_id"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 392,
"end": 401,
"loc": {
"start": {
"line": 18,
"column": 35
},
"end": {
"line": 18,
"column": 44
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 322,
"end": 356,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 242,
"end": 268,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 11,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch user's self private playlists. Result will be paged.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.meFetcher.PlaylistFetcher.fetchAllMyPlaylists()\n * @see https://docs.kkbox.codes/docs/me-playlists\n ",
"start": 413,
"end": 770,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 29,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 775,
"end": 946,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 35,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 775,
"end": 794,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 23
},
"identifierName": "fetchAllMyPlaylists"
},
"name": "fetchAllMyPlaylists",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 795,
"end": 812,
"loc": {
"start": {
"line": 30,
"column": 24
},
"end": {
"line": 30,
"column": 41
}
},
"left": {
"type": "Identifier",
"start": 795,
"end": 800,
"loc": {
"start": {
"line": 30,
"column": 24
},
"end": {
"line": 30,
"column": 29
},
"identifierName": "limit"
},
"name": "limit"
},
"right": {
"type": "Identifier",
"start": 803,
"end": 812,
"loc": {
"start": {
"line": 30,
"column": 32
},
"end": {
"line": 30,
"column": 41
},
"identifierName": "undefined"
},
"name": "undefined"
}
},
{
"type": "AssignmentPattern",
"start": 814,
"end": 832,
"loc": {
"start": {
"line": 30,
"column": 43
},
"end": {
"line": 30,
"column": 61
}
},
"left": {
"type": "Identifier",
"start": 814,
"end": 820,
"loc": {
"start": {
"line": 30,
"column": 43
},
"end": {
"line": 30,
"column": 49
},
"identifierName": "offset"
},
"name": "offset"
},
"right": {
"type": "Identifier",
"start": 823,
"end": 832,
"loc": {
"start": {
"line": 30,
"column": 52
},
"end": {
"line": 30,
"column": 61
},
"identifierName": "undefined"
},
"name": "undefined"
}
}
],
"body": {
"type": "BlockStatement",
"start": 834,
"end": 946,
"loc": {
"start": {
"line": 30,
"column": 63
},
"end": {
"line": 35,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 844,
"end": 940,
"loc": {
"start": {
"line": 31,
"column": 8
},
"end": {
"line": 34,
"column": 10
}
},
"argument": {
"type": "CallExpression",
"start": 851,
"end": 940,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 34,
"column": 10
}
},
"callee": {
"type": "MemberExpression",
"start": 851,
"end": 864,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 28
}
},
"object": {
"type": "MemberExpression",
"start": 851,
"end": 860,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 851,
"end": 855,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 856,
"end": 860,
"loc": {
"start": {
"line": 31,
"column": 20
},
"end": {
"line": 31,
"column": 24
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 861,
"end": 864,
"loc": {
"start": {
"line": 31,
"column": 25
},
"end": {
"line": 31,
"column": 28
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 865,
"end": 873,
"loc": {
"start": {
"line": 31,
"column": 29
},
"end": {
"line": 31,
"column": 37
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
{
"type": "ObjectExpression",
"start": 875,
"end": 939,
"loc": {
"start": {
"line": 31,
"column": 39
},
"end": {
"line": 34,
"column": 9
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 889,
"end": 901,
"loc": {
"start": {
"line": 32,
"column": 12
},
"end": {
"line": 32,
"column": 24
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 889,
"end": 894,
"loc": {
"start": {
"line": 32,
"column": 12
},
"end": {
"line": 32,
"column": 17
},
"identifierName": "limit"
},
"name": "limit"
},
"value": {
"type": "Identifier",
"start": 896,
"end": 901,
"loc": {
"start": {
"line": 32,
"column": 19
},
"end": {
"line": 32,
"column": 24
},
"identifierName": "limit"
},
"name": "limit"
}
},
{
"type": "ObjectProperty",
"start": 915,
"end": 929,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 26
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 915,
"end": 921,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 18
},
"identifierName": "offset"
},
"name": "offset"
},
"value": {
"type": "Identifier",
"start": 923,
"end": 929,
"loc": {
"start": {
"line": 33,
"column": 20
},
"end": {
"line": 33,
"column": 26
},
"identifierName": "offset"
},
"name": "offset"
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch user's self private playlists. Result will be paged.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.meFetcher.PlaylistFetcher.fetchAllMyPlaylists()\n * @see https://docs.kkbox.codes/docs/me-playlists\n ",
"start": 413,
"end": 770,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 29,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the private playlist fetcher.\n *\n * @param {string} private_playlist_id - Private playlist id.\n * @return {Playlist}\n * @see https://docs.kkbox.codes/docs/me-playlist-id\n ",
"start": 952,
"end": 1161,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 43,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1166,
"end": 1285,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 47,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1166,
"end": 1181,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 19
},
"identifierName": "setMyPlaylistID"
},
"name": "setMyPlaylistID",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1182,
"end": 1201,
"loc": {
"start": {
"line": 44,
"column": 20
},
"end": {
"line": 44,
"column": 39
},
"identifierName": "private_playlist_id"
},
"name": "private_playlist_id"
}
],
"body": {
"type": "BlockStatement",
"start": 1203,
"end": 1285,
"loc": {
"start": {
"line": 44,
"column": 41
},
"end": {
"line": 47,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1213,
"end": 1259,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 54
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1213,
"end": 1259,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 54
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1213,
"end": 1237,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 32
}
},
"object": {
"type": "ThisExpression",
"start": 1213,
"end": 1217,
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1218,
"end": 1237,
"loc": {
"start": {
"line": 45,
"column": 13
},
"end": {
"line": 45,
"column": 32
},
"identifierName": "private_playlist_id"
},
"name": "private_playlist_id"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1240,
"end": 1259,
"loc": {
"start": {
"line": 45,
"column": 35
},
"end": {
"line": 45,
"column": 54
},
"identifierName": "private_playlist_id"
},
"name": "private_playlist_id"
}
}
},
{
"type": "ReturnStatement",
"start": 1268,
"end": 1279,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 19
}
},
"argument": {
"type": "ThisExpression",
"start": 1275,
"end": 1279,
"loc": {
"start": {
"line": 46,
"column": 15
},
"end": {
"line": 46,
"column": 19
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the private playlist fetcher.\n *\n * @param {string} private_playlist_id - Private playlist id.\n * @return {Playlist}\n * @see https://docs.kkbox.codes/docs/me-playlist-id\n ",
"start": 952,
"end": 1161,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 43,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch private playlist metadata of the private playlist fetcher.\n *\n * @return {Promise}\n * @example api.meFetcher.PlaylistFetcher.setMyPlaylistID('H_UG1vQDgWbBJWKg1x').fetchMetadata()\n ",
"start": 1291,
"end": 1506,
"loc": {
"start": {
"line": 49,
"column": 4
},
"end": {
"line": 54,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1511,
"end": 1600,
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 57,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1511,
"end": 1524,
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 17
},
"identifierName": "fetchMetadata"
},
"name": "fetchMetadata",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1527,
"end": 1600,
"loc": {
"start": {
"line": 55,
"column": 20
},
"end": {
"line": 57,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1537,
"end": 1594,
"loc": {
"start": {
"line": 56,
"column": 8
},
"end": {
"line": 56,
"column": 65
}
},
"argument": {
"type": "CallExpression",
"start": 1544,
"end": 1594,
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 65
}
},
"callee": {
"type": "MemberExpression",
"start": 1544,
"end": 1557,
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 28
}
},
"object": {
"type": "MemberExpression",
"start": 1544,
"end": 1553,
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 1544,
"end": 1548,
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 1549,
"end": 1553,
"loc": {
"start": {
"line": 56,
"column": 20
},
"end": {
"line": 56,
"column": 24
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 1554,
"end": 1557,
"loc": {
"start": {
"line": 56,
"column": 25
},
"end": {
"line": 56,
"column": 28
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 1558,
"end": 1593,