@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,447 lines (1,446 loc) • 108 kB
JSON
{
"type": "File",
"start": 0,
"end": 1412,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 52,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1412,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 52,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 8,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 26
}
},
"imported": {
"type": "Identifier",
"start": 8,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "TRACKS"
},
"name": "TRACKS"
},
"local": {
"type": "Identifier",
"start": 18,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
}
}
],
"source": {
"type": "StringLiteral",
"start": 33,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 46
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
}
},
{
"type": "ImportDeclaration",
"start": 47,
"end": 78,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 31
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 54,
"end": 61,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 54,
"end": 61,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 67,
"end": 78,
"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 * Get metadata of a track.\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/tracks\n ",
"start": 80,
"end": 182,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 183,
"end": 1412,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 52,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 198,
"end": 1412,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 52,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 204,
"end": 216,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 33
},
"identifierName": "TrackFetcher"
},
"name": "TrackFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 225,
"end": 232,
"loc": {
"start": {
"line": 8,
"column": 42
},
"end": {
"line": 8,
"column": 49
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 233,
"end": 1412,
"loc": {
"start": {
"line": 8,
"column": 50
},
"end": {
"line": 52,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 270,
"end": 422,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 19,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 270,
"end": 281,
"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": 282,
"end": 286,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 288,
"end": 304,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 288,
"end": 297,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 300,
"end": 304,
"loc": {
"start": {
"line": 12,
"column": 34
},
"end": {
"line": 12,
"column": 38
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 306,
"end": 422,
"loc": {
"start": {
"line": 12,
"column": 40
},
"end": {
"line": 19,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 316,
"end": 338,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 30
}
},
"expression": {
"type": "CallExpression",
"start": 316,
"end": 338,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 30
}
},
"callee": {
"type": "Super",
"start": 316,
"end": 321,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 322,
"end": 326,
"loc": {
"start": {
"line": 13,
"column": 14
},
"end": {
"line": 13,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 328,
"end": 337,
"loc": {
"start": {
"line": 13,
"column": 20
},
"end": {
"line": 13,
"column": 29
},
"identifierName": "territory"
},
"name": "territory"
}
],
"trailingComments": null
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 348,
"end": 382,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 391,
"end": 416,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 33
}
},
"expression": {
"type": "AssignmentExpression",
"start": 391,
"end": 416,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 33
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 391,
"end": 404,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 391,
"end": 395,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 396,
"end": 404,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 21
},
"identifierName": "track_id"
},
"name": "track_id"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 407,
"end": 416,
"loc": {
"start": {
"line": 18,
"column": 24
},
"end": {
"line": 18,
"column": 33
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 348,
"end": 382,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 239,
"end": 265,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 11,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the track fetcher's track ID.\n *\n * @param {string} track_id - The ID of a track.\n * @return {Track}\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/tracks/endpoints/get-tracks-track_id\n ",
"start": 428,
"end": 664,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 669,
"end": 750,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 31,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 669,
"end": 679,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 28,
"column": 14
},
"identifierName": "setTrackID"
},
"name": "setTrackID",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 680,
"end": 688,
"loc": {
"start": {
"line": 28,
"column": 15
},
"end": {
"line": 28,
"column": 23
},
"identifierName": "track_id"
},
"name": "track_id"
}
],
"body": {
"type": "BlockStatement",
"start": 690,
"end": 750,
"loc": {
"start": {
"line": 28,
"column": 25
},
"end": {
"line": 31,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 700,
"end": 724,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 700,
"end": 724,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 32
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 700,
"end": 713,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 700,
"end": 704,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 705,
"end": 713,
"loc": {
"start": {
"line": 29,
"column": 13
},
"end": {
"line": 29,
"column": 21
},
"identifierName": "track_id"
},
"name": "track_id"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 716,
"end": 724,
"loc": {
"start": {
"line": 29,
"column": 24
},
"end": {
"line": 29,
"column": 32
},
"identifierName": "track_id"
},
"name": "track_id"
}
}
},
{
"type": "ReturnStatement",
"start": 733,
"end": 744,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 19
}
},
"argument": {
"type": "ThisExpression",
"start": 740,
"end": 744,
"loc": {
"start": {
"line": 30,
"column": 15
},
"end": {
"line": 30,
"column": 19
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the track fetcher's track ID.\n *\n * @param {string} track_id - The ID of a track.\n * @return {Track}\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/tracks/endpoints/get-tracks-track_id\n ",
"start": 428,
"end": 664,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get metadata of the track with the track fetcher.\n *\n * @return {Promise}\n * @example api.Track.setTrackID('KpnEGVHEsGgkoB0MBk').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/tracks/endpoints/get-tracks-track_id\n ",
"start": 756,
"end": 1032,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 39,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1037,
"end": 1144,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 42,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1037,
"end": 1050,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"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": 1053,
"end": 1144,
"loc": {
"start": {
"line": 40,
"column": 20
},
"end": {
"line": 42,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1063,
"end": 1138,
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 83
}
},
"argument": {
"type": "CallExpression",
"start": 1070,
"end": 1138,
"loc": {
"start": {
"line": 41,
"column": 15
},
"end": {
"line": 41,
"column": 83
}
},
"callee": {
"type": "MemberExpression",
"start": 1070,
"end": 1083,
"loc": {
"start": {
"line": 41,
"column": 15
},
"end": {
"line": 41,
"column": 28
}
},
"object": {
"type": "MemberExpression",
"start": 1070,
"end": 1079,
"loc": {
"start": {
"line": 41,
"column": 15
},
"end": {
"line": 41,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 1070,
"end": 1074,
"loc": {
"start": {
"line": 41,
"column": 15
},
"end": {
"line": 41,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 1075,
"end": 1079,
"loc": {
"start": {
"line": 41,
"column": 20
},
"end": {
"line": 41,
"column": 24
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 1080,
"end": 1083,
"loc": {
"start": {
"line": 41,
"column": 25
},
"end": {
"line": 41,
"column": 28
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 1084,
"end": 1108,
"loc": {
"start": {
"line": 41,
"column": 29
},
"end": {
"line": 41,
"column": 53
}
},
"left": {
"type": "Identifier",
"start": 1084,
"end": 1092,
"loc": {
"start": {
"line": 41,
"column": 29
},
"end": {
"line": 41,
"column": 37
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
"operator": "+",
"right": {
"type": "MemberExpression",
"start": 1095,
"end": 1108,
"loc": {
"start": {
"line": 41,
"column": 40
},
"end": {
"line": 41,
"column": 53
}
},
"object": {
"type": "ThisExpression",
"start": 1095,
"end": 1099,
"loc": {
"start": {
"line": 41,
"column": 40
},
"end": {
"line": 41,
"column": 44
}
}
},
"property": {
"type": "Identifier",
"start": 1100,
"end": 1108,
"loc": {
"start": {
"line": 41,
"column": 45
},
"end": {
"line": 41,
"column": 53
},
"identifierName": "track_id"
},
"name": "track_id"
},
"computed": false
}
},
{
"type": "ObjectExpression",
"start": 1110,
"end": 1137,
"loc": {
"start": {
"line": 41,
"column": 55
},
"end": {
"line": 41,
"column": 82
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 1111,
"end": 1136,
"loc": {
"start": {
"line": 41,
"column": 56
},
"end": {
"line": 41,
"column": 81
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1111,
"end": 1120,
"loc": {
"start": {
"line": 41,
"column": 56
},
"end": {
"line": 41,
"column": 65
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 1122,
"end": 1136,
"loc": {
"start": {
"line": 41,
"column": 67
},
"end": {
"line": 41,
"column": 81
}
},
"object": {
"type": "ThisExpression",
"start": 1122,
"end": 1126,
"loc": {
"start": {
"line": 41,
"column": 67
},
"end": {
"line": 41,
"column": 71
}
}
},
"property": {
"type": "Identifier",
"start": 1127,
"end": 1136,
"loc": {
"start": {
"line": 41,
"column": 72
},
"end": {
"line": 41,
"column": 81
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get metadata of the track with the track fetcher.\n *\n * @return {Promise}\n * @example api.Track.setTrackID('KpnEGVHEsGgkoB0MBk').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/tracks/endpoints/get-tracks-track_id\n ",
"start": 756,
"end": 1032,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 39,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get KKBOX web widget uri of the track.\n * @example https://widget.kkbox.com/v1/?id=8sD5pE4dV0Zqmmler6&type=song\n * @return {string}\n ",
"start": 1150,
"end": 1308,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 48,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1313,
"end": 1410,
"loc": {
"start": {
"line": 49,
"column": 4
},
"end": {
"line": 51,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1313,
"end": 1325,
"loc": {
"start": {
"line": 49,
"column": 4
},
"end": {
"line": 49,
"column": 16
},
"identifierName": "getWidgetUri"
},
"name": "getWidgetUri",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1327,
"end": 1410,
"loc": {
"start": {
"line": 49,
"column": 18
},
"end": {
"line": 51,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1337,
"end": 1404,
"loc": {
"start": {
"line": 50,
"column": 8
},
"end": {
"line": 50,
"column": 75
}
},
"argument": {
"type": "TemplateLiteral",
"start": 1344,
"end": 1404,
"loc": {
"start": {
"line": 50,
"column": 15
},
"end": {
"line": 50,
"column": 75
}
},
"expressions": [
{
"type": "MemberExpression",
"start": 1379,
"end": 1392,
"loc": {
"start": {
"line": 50,
"column": 50
},
"end": {
"line": 50,
"column": 63
}
},
"object": {
"type": "ThisExpression",
"start": 1379,
"end": 1383,
"loc": {
"start": {
"line": 50,
"column": 50
},
"end": {
"line": 50,
"column": 54
}
}
},
"property": {
"type": "Identifier",
"start": 1384,
"end": 1392,
"loc": {
"start": {
"line": 50,
"column": 55
},
"end": {
"line": 50,
"column": 63
},
"identifierName": "track_id"
},
"name": "track_id"
},
"computed": false
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 1345,
"end": 1377,
"loc": {
"start": {
"line": 50,
"column": 16
},
"end": {
"line": 50,
"column": 48
}
},
"value": {
"raw": "https://widget.kkbox.com/v1/?id=",