Rest
Table of Contentsโ
Class Definitionโ
export class Rest {}
Propertiesโ
Property Type Description isNodeLinkboolean Whether the Rest instance is a NodeLink instance. managerManagerThe manager instance. nodeNodeThe node instance. passwordstring The password used to connect to the node. sessionIdstring The session ID. urlstring The URI of the node.
Constructorโ
new Rest(node: Node, manager: Manager)
Parameter Type Description Optional nodeNodeThe node instance. managerManagerThe manager instance.
Methodsโ
delete()โ
async delete(endpoint: string): Promise<unknown>Sends a DELETE request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint to delete. Returnsโ
Return Description Promise<unknown> The promise that resolves to the response.
destroyPlayer()โ
async destroyPlayer(guildId: string): Promise<unknown>Sends a DELETE request to the server to destroy the player.
Parametersโ
Parameter Type Description Optional guildIdstring The guild ID. Returnsโ
Return Description Promise<unknown> The promise that resolves to the response.
get()โ
async get(endpoint: string): Promise<unknown>Sends a GET request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint to get. Returnsโ
Return Description Promise<unknown> The promise that resolves to the response.
getPlayer()โ
async getPlayer(guildId: string): Promise<LavaPlayer>Sends a GET request to the server to get a player.
Parametersโ
Parameter Type Description Optional guildIdstring The guild ID. Returnsโ
Return Description Promise<LavaPlayer> The promise that resolves to the lavalink player.
patch()โ
async patch(endpoint: string, body: unknown): Promise<unknown>Sends a PATCH request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint to patch. bodyunknown The body to patch. Returnsโ
Return Description Promise<unknown> The promise that resolves to the response.
post()โ
async post(endpoint: string, body: unknown): Promise<unknown>Sends a POST request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint to post. bodyunknown The body to post. Returnsโ
Return Description Promise<unknown> The promise that resolves to the response.
put()โ
async put(endpoint: string, body: unknown): Promise<unknown>Sends a PUT request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint to put. bodyunknown The body to put. Returnsโ
Return Description Promise<unknown> The promise that resolves to the response.
setSessionId()โ
setSessionId(sessionId: string): stringSets the session ID.
Parametersโ
Parameter Type Description Optional sessionIdstring The session ID to set. Returnsโ
Return Description string The session ID.
updatePlayer()โ
async updatePlayer(options: RestPlayOptions): Promise<unknown>Sends a PATCH request to the server to update the player.
Parametersโ
Parameter Type Description Optional optionsRestPlayOptionsThe options to update. Returnsโ
Return Description Promise<unknown> The promise that resolves to the response.
updateSession()โ
async updateSession(resuming: boolean, timeout: number): Promise<unknown>Sends a PATCH request to update the session's resuming status and timeout.
Parametersโ
Parameter Type Description Optional resumingboolean Whether the session is resuming. timeoutnumber The session timeout. Returnsโ
Return Description Promise<unknown> The promise that resolves to the response.