@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,443 lines (1,442 loc) • 167 kB
JSON
{
"type": "File",
"start": 0,
"end": 2065,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 78,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2065,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 78,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 59,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 59
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 9,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 37
}
},
"imported": {
"type": "Identifier",
"start": 9,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 25
},
"identifierName": "SHARED_PLAYLISTS"
},
"name": "SHARED_PLAYLISTS"
},
"local": {
"type": "Identifier",
"start": 29,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 37
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
}
}
],
"source": {
"type": "StringLiteral",
"start": 45,
"end": 58,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 1,
"column": 58
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
}
},
{
"type": "ImportDeclaration",
"start": 60,
"end": 92,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 32
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 67,
"end": 74,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 67,
"end": 74,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 80,
"end": 91,
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 31
}
},
"extra": {
"rawValue": "./Fetcher",
"raw": "'./Fetcher'"
},
"value": "./Fetcher"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get playlist metadata.\n * @see https://docs-en.kkbox.codes/v1.1/reference#shared-playlists\n ",
"start": 94,
"end": 195,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 196,
"end": 2064,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 77,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 211,
"end": 2064,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 77,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 217,
"end": 238,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 42
},
"identifierName": "SharedPlaylistFetcher"
},
"name": "SharedPlaylistFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 247,
"end": 254,
"loc": {
"start": {
"line": 8,
"column": 51
},
"end": {
"line": 8,
"column": 58
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 255,
"end": 2064,
"loc": {
"start": {
"line": 8,
"column": 59
},
"end": {
"line": 77,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 284,
"end": 418,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 19,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 284,
"end": 295,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 296,
"end": 300,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 302,
"end": 318,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 36
}
},
"left": {
"type": "Identifier",
"start": 302,
"end": 311,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 29
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 314,
"end": 318,
"loc": {
"start": {
"line": 12,
"column": 32
},
"end": {
"line": 12,
"column": 36
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 320,
"end": 418,
"loc": {
"start": {
"line": 12,
"column": 38
},
"end": {
"line": 19,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 326,
"end": 349,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 27
}
},
"expression": {
"type": "CallExpression",
"start": 326,
"end": 348,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 26
}
},
"callee": {
"type": "Super",
"start": 326,
"end": 331,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 9
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 332,
"end": 336,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 14
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 338,
"end": 347,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 25
},
"identifierName": "territory"
},
"name": "territory"
}
]
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 355,
"end": 381,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 386,
"end": 414,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 386,
"end": 413,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 31
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 386,
"end": 401,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 386,
"end": 390,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 391,
"end": 401,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 19
},
"identifierName": "playlistID"
},
"name": "playlistID"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 404,
"end": 413,
"loc": {
"start": {
"line": 18,
"column": 22
},
"end": {
"line": 18,
"column": 31
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 355,
"end": 381,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 259,
"end": 281,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the shared playlist fetcher.\n *\n * @param {string} playlistID - The ID of a playlist.\n * @return {SharedPlaylistFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#sharedplaylists-playlist_id\n ",
"start": 422,
"end": 649,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 652,
"end": 734,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 31,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 652,
"end": 665,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 15
},
"identifierName": "setPlaylistID"
},
"name": "setPlaylistID",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 666,
"end": 676,
"loc": {
"start": {
"line": 28,
"column": 16
},
"end": {
"line": 28,
"column": 26
},
"identifierName": "playlistID"
},
"name": "playlistID"
}
],
"body": {
"type": "BlockStatement",
"start": 678,
"end": 734,
"loc": {
"start": {
"line": 28,
"column": 28
},
"end": {
"line": 31,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 684,
"end": 713,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 33
}
},
"expression": {
"type": "AssignmentExpression",
"start": 684,
"end": 712,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 32
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 684,
"end": 699,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 684,
"end": 688,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 689,
"end": 699,
"loc": {
"start": {
"line": 29,
"column": 9
},
"end": {
"line": 29,
"column": 19
},
"identifierName": "playlistID"
},
"name": "playlistID"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 702,
"end": 712,
"loc": {
"start": {
"line": 29,
"column": 22
},
"end": {
"line": 29,
"column": 32
},
"identifierName": "playlistID"
},
"name": "playlistID"
}
}
},
{
"type": "ReturnStatement",
"start": 718,
"end": 730,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 16
}
},
"argument": {
"type": "ThisExpression",
"start": 725,
"end": 729,
"loc": {
"start": {
"line": 30,
"column": 11
},
"end": {
"line": 30,
"column": 15
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the shared playlist fetcher.\n *\n * @param {string} playlistID - The ID of a playlist.\n * @return {SharedPlaylistFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#sharedplaylists-playlist_id\n ",
"start": 422,
"end": 649,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch metadata of the shared playlist with the shared playlist fetcher.\n *\n * @return {Promise}\n * @example\n * api.sharedPlaylistFetcher\n * .setPlaylistID('4nUZM-TY2aVxZ2xaA-')\n * .fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#sharedplaylists-playlist_id\n ",
"start": 738,
"end": 1050,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 42,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1053,
"end": 1175,
"loc": {
"start": {
"line": 43,
"column": 2
},
"end": {
"line": 47,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1053,
"end": 1066,
"loc": {
"start": {
"line": 43,
"column": 2
},
"end": {
"line": 43,
"column": 15
},
"identifierName": "fetchMetadata"
},
"name": "fetchMetadata",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1069,
"end": 1175,
"loc": {
"start": {
"line": 43,
"column": 18
},
"end": {
"line": 47,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1075,
"end": 1171,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 46,
"column": 7
}
},
"argument": {
"type": "CallExpression",
"start": 1082,
"end": 1170,
"loc": {
"start": {
"line": 44,
"column": 11
},
"end": {
"line": 46,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 1082,
"end": 1095,
"loc": {
"start": {
"line": 44,
"column": 11
},
"end": {
"line": 44,
"column": 24
}
},
"object": {
"type": "MemberExpression",
"start": 1082,
"end": 1091,
"loc": {
"start": {
"line": 44,
"column": 11
},
"end": {
"line": 44,
"column": 20
}
},
"object": {
"type": "ThisExpression",
"start": 1082,
"end": 1086,
"loc": {
"start": {
"line": 44,
"column": 11
},
"end": {
"line": 44,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 1087,
"end": 1091,
"loc": {
"start": {
"line": 44,
"column": 16
},
"end": {
"line": 44,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 1092,
"end": 1095,
"loc": {
"start": {
"line": 44,
"column": 21
},
"end": {
"line": 44,
"column": 24
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 1096,
"end": 1128,
"loc": {
"start": {
"line": 44,
"column": 25
},
"end": {
"line": 44,
"column": 57
}
},
"left": {
"type": "BinaryExpression",
"start": 1096,
"end": 1110,
"loc": {
"start": {
"line": 44,
"column": 25
},
"end": {
"line": 44,
"column": 39
}
},
"left": {
"type": "Identifier",
"start": 1096,
"end": 1104,
"loc": {
"start": {
"line": 44,
"column": 25
},
"end": {
"line": 44,
"column": 33
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
"operator": "+",
"right": {
"type": "StringLiteral",
"start": 1107,
"end": 1110,
"loc": {
"start": {
"line": 44,
"column": 36
},
"end": {
"line": 44,
"column": 39
}
},
"extra": {
"rawValue": "/",
"raw": "'/'"
},
"value": "/"
}
},
"operator": "+",
"right": {
"type": "MemberExpression",
"start": 1113,
"end": 1128,
"loc": {
"start": {
"line": 44,
"column": 42
},
"end": {
"line": 44,
"column": 57
}
},
"object": {
"type": "ThisExpression",
"start": 1113,
"end": 1117,
"loc": {
"start": {
"line": 44,
"column": 42
},
"end": {
"line": 44,
"column": 46
}
}
},
"property": {
"type": "Identifier",
"start": 1118,
"end": 1128,
"loc": {
"start": {
"line": 44,
"column": 47
},
"end": {
"line": 44,
"column": 57
},
"identifierName": "playlistID"
},
"name": "playlistID"
},
"computed": false
}
},
{
"type": "ObjectExpression",
"start": 1130,
"end": 1169,
"loc": {
"start": {
"line": 44,
"column": 59
},
"end": {
"line": 46,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 1138,
"end": 1163,
"loc": {
"start": {
"line": 45,
"column": 6
},
"end": {
"line": 45,
"column": 31
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1138,
"end": 1147,
"loc": {
"start": {
"line": 45,
"column": 6
},
"end": {
"line": 45,
"column": 15
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 1149,
"end": 1163,
"loc": {
"start": {
"line": 45,
"column": 17
},
"end": {
"line": 45,
"column": 31
}
},
"object": {
"type": "ThisExpression",
"start": 1149,
"end": 1153,
"loc": {
"start": {
"line": 45,
"column": 17
},
"end": {
"line": 45,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"start": 1154,
"end": 1163,
"loc": {
"start": {
"line": 45,
"column": 22
},
"end": {
"line": 45,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch metadata of the shared playlist with the shared playlist fetcher.\n *\n * @return {Promise}\n * @example\n * api.sharedPlaylistFetcher\n * .setPlaylistID('4nUZM-TY2aVxZ2xaA-')\n * .fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#sharedplaylists-playlist_id\n ",
"start": 738,
"end": 1050,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 42,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get KKBOX web widget uri of the playlist.\n * @example https://widget.kkbox.com/v1/?id=KmjwNXizu5MxHFSloP&type=playlist\n * @return {string}\n ",
"start": 1179,
"end": 1336,
"loc": {
"start": {
"line": 49,
"column": 2
},
"end": {
"line": 53,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1339,
"end": 1438,
"loc": {
"start": {
"line": 54,
"column": 2
},
"end": {
"line": 56,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1339,
"end": 1351,
"loc": {
"start": {
"line": 54,
"column": 2
},
"end": {
"line": 54,
"column": 14
},
"identifierName": "getWidgetUri"
},
"name": "getWidgetUri",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1354,
"end": 1438,
"loc": {
"start": {
"line": 54,
"column": 17
},
"end": {
"line": 56,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1360,
"end": 1434,
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 78
}
},
"argument": {
"type": "TemplateLiteral",
"start": 1367,
"end": 1433,
"loc": {
"start": {
"line": 55,
"column": 11
},
"end": {
"line": 55,
"column": 77
}
},
"expressions": [
{
"type": "MemberExpression",
"start": 1402,
"end": 1417,
"loc": {
"start": {
"line": 55,
"column": 46
},
"end": {
"line": 55,
"column": 61
}
},
"object": {
"type": "ThisExpression",
"start": 1402,
"end": 1406,
"loc": {
"start": {
"line": 55,
"column": 46
},
"end": {
"line": 55,
"column": 50
}
}
},