@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,420 lines • 133 kB
JSON
{
"type": "File",
"start": 0,
"end": 1942,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 60,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1942,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 60,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 54
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 8,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 34
}
},
"imported": {
"type": "Identifier",
"start": 8,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 22
},
"identifierName": "GENRE_STATIONS"
},
"name": "GENRE_STATIONS"
},
"local": {
"type": "Identifier",
"start": 26,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 34
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
}
}
],
"source": {
"type": "StringLiteral",
"start": 41,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 54
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
}
},
{
"type": "ImportDeclaration",
"start": 55,
"end": 86,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 31
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 62,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 62,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 75,
"end": 86,
"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 genre stations.\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/genre-stations\n ",
"start": 88,
"end": 194,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 195,
"end": 1942,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 60,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 210,
"end": 1942,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 60,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 216,
"end": 235,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 40
},
"identifierName": "GenreStationFetcher"
},
"name": "GenreStationFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 244,
"end": 251,
"loc": {
"start": {
"line": 8,
"column": 49
},
"end": {
"line": 8,
"column": 56
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 252,
"end": 1942,
"loc": {
"start": {
"line": 8,
"column": 57
},
"end": {
"line": 60,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 289,
"end": 451,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 19,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 289,
"end": 300,
"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": 301,
"end": 305,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 307,
"end": 323,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 307,
"end": 316,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 319,
"end": 323,
"loc": {
"start": {
"line": 12,
"column": 34
},
"end": {
"line": 12,
"column": 38
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 325,
"end": 451,
"loc": {
"start": {
"line": 12,
"column": 40
},
"end": {
"line": 19,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 335,
"end": 357,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 30
}
},
"expression": {
"type": "CallExpression",
"start": 335,
"end": 357,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 30
}
},
"callee": {
"type": "Super",
"start": 335,
"end": 340,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 341,
"end": 345,
"loc": {
"start": {
"line": 13,
"column": 14
},
"end": {
"line": 13,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 347,
"end": 356,
"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": 367,
"end": 402,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 411,
"end": 444,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 41
}
},
"expression": {
"type": "AssignmentExpression",
"start": 411,
"end": 444,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 41
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 411,
"end": 432,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 29
}
},
"object": {
"type": "ThisExpression",
"start": 411,
"end": 415,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 416,
"end": 432,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 29
},
"identifierName": "genre_station_id"
},
"name": "genre_station_id"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 435,
"end": 444,
"loc": {
"start": {
"line": 18,
"column": 32
},
"end": {
"line": 18,
"column": 41
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 367,
"end": 402,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 258,
"end": 284,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 11,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch all genre stations. The result will be paged.\n *\n * @param {number} [limit] - The size for one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.GenreStation.fetchAllGenreStations()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/genre-stations/endpoints/get-genre-stations\n ",
"start": 457,
"end": 851,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 29,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 856,
"end": 1080,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 36,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 856,
"end": 877,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 25
},
"identifierName": "fetchAllGenreStations"
},
"name": "fetchAllGenreStations",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 878,
"end": 895,
"loc": {
"start": {
"line": 30,
"column": 26
},
"end": {
"line": 30,
"column": 43
}
},
"left": {
"type": "Identifier",
"start": 878,
"end": 883,
"loc": {
"start": {
"line": 30,
"column": 26
},
"end": {
"line": 30,
"column": 31
},
"identifierName": "limit"
},
"name": "limit"
},
"right": {
"type": "Identifier",
"start": 886,
"end": 895,
"loc": {
"start": {
"line": 30,
"column": 34
},
"end": {
"line": 30,
"column": 43
},
"identifierName": "undefined"
},
"name": "undefined"
}
},
{
"type": "AssignmentPattern",
"start": 897,
"end": 915,
"loc": {
"start": {
"line": 30,
"column": 45
},
"end": {
"line": 30,
"column": 63
}
},
"left": {
"type": "Identifier",
"start": 897,
"end": 903,
"loc": {
"start": {
"line": 30,
"column": 45
},
"end": {
"line": 30,
"column": 51
},
"identifierName": "offset"
},
"name": "offset"
},
"right": {
"type": "Identifier",
"start": 906,
"end": 915,
"loc": {
"start": {
"line": 30,
"column": 54
},
"end": {
"line": 30,
"column": 63
},
"identifierName": "undefined"
},
"name": "undefined"
}
}
],
"body": {
"type": "BlockStatement",
"start": 917,
"end": 1080,
"loc": {
"start": {
"line": 30,
"column": 65
},
"end": {
"line": 36,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 927,
"end": 1074,
"loc": {
"start": {
"line": 31,
"column": 8
},
"end": {
"line": 35,
"column": 10
}
},
"argument": {
"type": "CallExpression",
"start": 934,
"end": 1074,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 35,
"column": 10
}
},
"callee": {
"type": "MemberExpression",
"start": 934,
"end": 947,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 28
}
},
"object": {
"type": "MemberExpression",
"start": 934,
"end": 943,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 934,
"end": 938,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 939,
"end": 943,
"loc": {
"start": {
"line": 31,
"column": 20
},
"end": {
"line": 31,
"column": 24
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 944,
"end": 947,
"loc": {
"start": {
"line": 31,
"column": 25
},
"end": {
"line": 31,
"column": 28
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 948,
"end": 956,
"loc": {
"start": {
"line": 31,
"column": 29
},
"end": {
"line": 31,
"column": 37
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
{
"type": "ObjectExpression",
"start": 958,
"end": 1073,
"loc": {
"start": {
"line": 31,
"column": 39
},
"end": {
"line": 35,
"column": 9
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 972,
"end": 997,
"loc": {
"start": {
"line": 32,
"column": 12
},
"end": {
"line": 32,
"column": 37
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 972,
"end": 981,
"loc": {
"start": {
"line": 32,
"column": 12
},
"end": {
"line": 32,
"column": 21
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 983,
"end": 997,
"loc": {
"start": {
"line": 32,
"column": 23
},
"end": {
"line": 32,
"column": 37
}
},
"object": {
"type": "ThisExpression",
"start": 983,
"end": 987,
"loc": {
"start": {
"line": 32,
"column": 23
},
"end": {
"line": 32,
"column": 27
}
}
},
"property": {
"type": "Identifier",
"start": 988,
"end": 997,
"loc": {
"start": {
"line": 32,
"column": 28
},
"end": {
"line": 32,
"column": 37
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 1011,
"end": 1023,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 24
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1011,
"end": 1016,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 17
},
"identifierName": "limit"
},
"name": "limit"
},
"value": {
"type": "Identifier",
"start": 1018,
"end": 1023,
"loc": {
"start": {
"line": 33,
"column": 19
},
"end": {
"line": 33,
"column": 24
},
"identifierName": "limit"
},
"name": "limit"
}
},
{
"type": "ObjectProperty",
"start": 1037,
"end": 1051,
"loc": {
"start": {
"line": 34,
"column": 12
},
"end": {
"line": 34,
"column": 26
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1037,
"end": 1043,
"loc": {
"start": {
"line": 34,
"column": 12
},
"end": {
"line": 34,
"column": 18
},
"identifierName": "offset"
},
"name": "offset"
},
"value": {
"type": "Identifier",
"start": 1045,
"end": 1051,
"loc": {
"start": {
"line": 34,
"column": 20
},
"end": {
"line": 34,
"column": 26
},
"identifierName": "offset"
},
"name": "offset"
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch all genre stations. The result will be paged.\n *\n * @param {number} [limit] - The size for one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.GenreStation.fetchAllGenreStations()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/genre-stations/endpoints/get-genre-stations\n ",
"start": 457,
"end": 851,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 29,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the genre station fetcher.\n *\n * @param {string} genre_station_id - The ID of a genre station.\n * @return {GenreStation}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/genre-stations/endpoints/get-genre-stations-station_id\n ",
"start": 1086,
"end": 1362,
"loc": {
"start": {
"line": 38,
"column": 4
},
"end": {
"line": 44,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1367,
"end": 1487,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 48,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1367,
"end": 1384,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 21
},
"identifierName": "setGenreStationID"
},
"name": "setGenreStationID",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1385,
"end": 1401,
"loc": {
"start": {
"line": 45,
"column": 22
},
"end": {
"line": 45,
"column": 38
},
"identifierName": "genre_station_id"
},
"name": "genre_station_id"
}
],
"body": {
"type": "BlockStatement",
"start": 1403,
"end": 1487,
"loc": {
"start": {
"line": 45,
"column": 40
},
"end": {
"line": 48,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1413,
"end": 1453,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 48
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1413,
"end": 1453,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 48
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1413,
"end": 1434,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 29
}
},
"object": {
"type": "ThisExpression",
"start": 1413,
"end": 1417,
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1418,
"end": 1434,
"loc": {
"start": {
"line": 46,
"column": 13
},
"end": {
"line": 46,
"column": 29
},
"identifierName": "genre_station_id"
},
"name": "genre_station_id"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1437,
"end": 1453,
"loc": {
"start": {
"line": 46,
"column": 32
},
"end": {
"line": 46,
"column": 48
},
"identifierName": "genre_station_id"
},
"name": "genre_station_id"
}
}
},
{
"type": "ReturnStatement",
"start": 1470,
"end": 1481,
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 19
}
},
"argument": {
"type": "ThisExpression",
"start": 1477,
"end": 1481,
"loc": {
"start": {
"line": 47,
"column": 15
},
"end": {
"line": 47,
"column": 19
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the genre station fetcher.\n *\n * @param {string} genre_station_id - The ID of a genre station.\n * @return {GenreStation}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/genre-stations/endpoints/get-genre-stations-station_id\n ",
"start": 1086,
"end": 1362,
"loc": {
"start": {
"line": 38,
"column": 4
},
"end": {
"line": 44,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch metadata of the genre station with the genre station fetcher.\n *\n * @return {Promise}\n * @example api.GenreStation.setGenreStationID('TYq3EHFTl-1EOvJM5Y').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/genre-stations/endpo