Skip to main content
Version: 1.4.1

Rest

ruvyrias


ruvyrias / Rest

Class: Rest

Defined in: src/Rest.ts:74

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.

Constructors

Constructor

new Rest(ruvyrias, node): Rest

Defined in: src/Rest.ts:80

Parameters

ruvyrias

Ruvyrias

node

Node

Returns

Rest

Properties

ruvyrias

ruvyrias: Ruvyrias

Defined in: src/Rest.ts:75


sessionId

sessionId: null | string

Defined in: src/Rest.ts:78


url

url: string

Defined in: src/Rest.ts:76

Methods

delete()

delete(endpoint): Promise<null>

Defined in: src/Rest.ts:193

Performs an HTTP DELETE request to the specified endpoint.

Parameters

endpoint

`/${string}`

The endpoint to make the DELETE request.

Returns

Promise<null>

A Promise that resolves with the response data.


destroyPlayer()

destroyPlayer(guildId): Promise<null>

Defined in: src/Rest.ts:118

Destroys a player for the specified guild.

Parameters

guildId

string

The ID of the guild for which to destroy the player.

Returns

Promise<null>

A Promise that resolves when the player is destroyed.


get()

get(path): Promise<null | RestMethodGet>

Defined in: src/Rest.ts:127

Performs an HTTP GET request to the specified path.

Parameters

path

`/${string}`

The path to make the GET request.

Returns

Promise<null | RestMethodGet>

A Promise that resolves with the response data.


getAllPlayers()

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

Defined in: src/Rest.ts:100

Gets information about all players in the session.

Returns

Promise<null | ErrorResponses | Player[]>

A Promise that resolves to the information about all players.


getRoutePlannerStatus()

getRoutePlannerStatus(): Promise<unknown>

Defined in: src/Rest.ts:213

This function will get the RoutePlanner status

Returns

Promise<unknown>


patch()

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

Defined in: src/Rest.ts:148

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

Parameters

endpoint

`/${string}`

The endpoint to make the PATCH request.

body

any

The data to include in the PATCH request body.

Returns

Promise<null | Player>

A Promise that resolves with the response data.


post()

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

Defined in: src/Rest.ts:171

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

Parameters

endpoint

`/${string}`

The endpoint to make the POST request.

body

any

The data to include in the POST request body.

Returns

Promise<null | Track[]>

A Promise that resolves with the response data.


setSessionId()

setSessionId(sessionId): void

Defined in: src/Rest.ts:92

Sets the session ID for the REST instance.

Parameters

sessionId

string

The session ID to set.

Returns

void


unmarkFailedAddress()

unmarkFailedAddress(address): Promise<unknown>

Defined in: src/Rest.ts:222

This function will Unmark a failed address

Parameters

address

string

The 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


updatePlayer()

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

Defined in: src/Rest.ts:109

Updates a player with the specified options.

Parameters

options

PlayOptions

The options to update the player.

Returns

Promise<null | Player | ErrorResponses>

A Promise that resolves when the player is updated.