radioco-api
Advanced tools
Comparing version 0.1.1 to 0.2.0
import type { StationHistory, StationNextTrack, StationRequestableTracks, StationSchedule, StationStatus } from "./types"; | ||
export declare class RadioCo { | ||
/** | ||
* Get the track history of a station | ||
* @param stationId Station ID | ||
* @returns Track history | ||
*/ | ||
getStationHistory(stationId: string): Promise<StationHistory>; | ||
/** | ||
* Gets the next track to be played on a station | ||
* @param stationId Station ID | ||
* @returns Next track to be played | ||
*/ | ||
getNextTrack(stationId: string): Promise<StationNextTrack>; | ||
requestTrack(stationId: string, trackId: number): Promise<void>; | ||
/** | ||
* Request a track to be played on a station | ||
* @param stationId Station ID | ||
* @param trackId Requested track ID | ||
* @param deviceIdentifier Optional device fingerprint ID to associate with the request | ||
* @returns Nothing | ||
*/ | ||
requestTrack(stationId: string, trackId: number, deviceIdentifier?: string): Promise<void>; | ||
/** | ||
* Get the requestable tracks of a station | ||
* @param stationId Station ID | ||
* @returns Available tracks to be requested | ||
*/ | ||
getRequestableTracks(stationId: string): Promise<StationRequestableTracks>; | ||
/** | ||
* Get the status of a station | ||
* @param stationId Station ID | ||
* @returns Station status | ||
*/ | ||
getStationStatus(stationId: string): Promise<StationStatus>; | ||
/** | ||
* Get the schedule of a station | ||
* @param stationId Station ID | ||
* @returns Station schedule | ||
*/ | ||
getStationSchedule(stationId: string): Promise<StationSchedule>; | ||
} |
@@ -13,2 +13,6 @@ "use strict"; | ||
baseURL: API_BASE_URL, | ||
headers: { | ||
"User-Agent": "Radio.co API Client https://github.com/jamesatjaminit/radioco-api", | ||
...request.headers, | ||
}, | ||
}); | ||
@@ -22,2 +26,7 @@ const responseJson = await response.data; | ||
class RadioCo { | ||
/** | ||
* Get the track history of a station | ||
* @param stationId Station ID | ||
* @returns Track history | ||
*/ | ||
async getStationHistory(stationId) { | ||
@@ -29,2 +38,7 @@ return (await makeRequest({ | ||
} | ||
/** | ||
* Gets the next track to be played on a station | ||
* @param stationId Station ID | ||
* @returns Next track to be played | ||
*/ | ||
async getNextTrack(stationId) { | ||
@@ -36,3 +50,10 @@ return (await makeRequest({ | ||
} | ||
async requestTrack(stationId, trackId) { | ||
/** | ||
* Request a track to be played on a station | ||
* @param stationId Station ID | ||
* @param trackId Requested track ID | ||
* @param deviceIdentifier Optional device fingerprint ID to associate with the request | ||
* @returns Nothing | ||
*/ | ||
async requestTrack(stationId, trackId, deviceIdentifier) { | ||
return (await makeRequest({ | ||
@@ -43,2 +64,3 @@ method: "POST", | ||
"content-type": "application/json", | ||
"device-identifier": deviceIdentifier ?? "", | ||
}, | ||
@@ -50,2 +72,7 @@ data: JSON.stringify({ | ||
} | ||
/** | ||
* Get the requestable tracks of a station | ||
* @param stationId Station ID | ||
* @returns Available tracks to be requested | ||
*/ | ||
async getRequestableTracks(stationId) { | ||
@@ -57,2 +84,7 @@ return (await makeRequest({ | ||
} | ||
/** | ||
* Get the status of a station | ||
* @param stationId Station ID | ||
* @returns Station status | ||
*/ | ||
async getStationStatus(stationId) { | ||
@@ -64,2 +96,7 @@ return (await makeRequest({ | ||
} | ||
/** | ||
* Get the schedule of a station | ||
* @param stationId Station ID | ||
* @returns Station schedule | ||
*/ | ||
async getStationSchedule(stationId) { | ||
@@ -66,0 +103,0 @@ return (await makeRequest({ |
{ | ||
"name": "radioco-api", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "An API wrapper for radio.co", | ||
@@ -5,0 +5,0 @@ "repository": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9979
237
0