Skip to main content

ruvyrias / Exports / Rest

Class: Rest

Provides a RESTful interface for making HTTP requests to interact with the Lavalink server. This class facilitates actions such as retrieving player information, updating player settings, and managing tracks.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Rest(ruvyrias, node): Rest

Parameters

NameType
ruvyriasRuvyrias
nodeNode

Returns

Rest

Defined in

src/Node/Rest.ts:80

Properties

password

Private password: string

Defined in

src/Node/Rest.ts:77


ruvyrias

ruvyrias: Ruvyrias

Defined in

src/Node/Rest.ts:75


sessionId

sessionId: null | string

Defined in

src/Node/Rest.ts:78


url

url: string

Defined in

src/Node/Rest.ts:76

Methods

delete

delete(endpoint): Promise<null>

Performs an HTTP DELETE request to the specified endpoint.

Parameters

NameTypeDescription
endpoint`/${string}`The endpoint to make the DELETE request.

Returns

Promise<null>

A Promise that resolves with the response data.

Defined in

src/Node/Rest.ts:193


destroyPlayer

destroyPlayer(guildId): Promise<null>

Destroys a player for the specified guild.

Parameters

NameTypeDescription
guildIdstringThe ID of the guild for which to destroy the player.

Returns

Promise<null>

A Promise that resolves when the player is destroyed.

Defined in

src/Node/Rest.ts:118


get

get(path): Promise<null | RestMethodGet>

Performs an HTTP GET request to the specified path.

Parameters

NameTypeDescription
path`/${string}`The path to make the GET request.

Returns

Promise<null | RestMethodGet>

A Promise that resolves with the response data.

Defined in

src/Node/Rest.ts:127


getAllPlayers

getAllPlayers(): Promise<null | ErrorResponses | Player[]>

Gets information about all players in the session.

Returns

Promise<null | ErrorResponses | Player[]>

A Promise that resolves to the information about all players.

Defined in

src/Node/Rest.ts:100


getRoutePlannerStatus

getRoutePlannerStatus(): Promise<unknown>

This function will get the RoutePlanner status

Returns

Promise<unknown>

Defined in

src/Node/Rest.ts:213


patch

patch(endpoint, body): Promise<null | Player>

Performs an HTTP PATCH request to the specified endpoint with the provided body.

Parameters

NameTypeDescription
endpoint`/${string}`The endpoint to make the PATCH request.
bodyanyThe data to include in the PATCH request body.

Returns

Promise<null | Player>

A Promise that resolves with the response data.

Defined in

src/Node/Rest.ts:148


post

post(endpoint, body): Promise<null | Track[]>

Performs an HTTP POST request to the specified endpoint with the provided body.

Parameters

NameTypeDescription
endpoint`/${string}`The endpoint to make the POST request.
bodyanyThe data to include in the POST request body.

Returns

Promise<null | Track[]>

A Promise that resolves with the response data.

Defined in

src/Node/Rest.ts:171


setSessionId

setSessionId(sessionId): void

Sets the session ID for the REST instance.

Parameters

NameTypeDescription
sessionIdstringThe session ID to set.

Returns

void

Defined in

src/Node/Rest.ts:92


unmarkFailedAddress

unmarkFailedAddress(address): Promise<unknown>

This function will Unmark a failed address

Parameters

NameTypeDescription
addressstringThe address to unmark as failed. This address must be in the same ip block.

Returns

Promise<unknown>

This function will most likely error if you havn't enabled the route planner

Defined in

src/Node/Rest.ts:222


updatePlayer

updatePlayer(options): Promise<null | Player | ErrorResponses>

Updates a player with the specified options.

Parameters

NameTypeDescription
optionsPlayOptionsThe options to update the player.

Returns

Promise<null | Player | ErrorResponses>

A Promise that resolves when the player is updated.

Defined in

src/Node/Rest.ts:109