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
- delete
- destroyPlayer
- get
- getAllPlayers
- getRoutePlannerStatus
- patch
- post
- setSessionId
- unmarkFailedAddress
- updatePlayer
Constructors
constructor
• new Rest(ruvyrias
, node
): Rest
Parameters
Name | Type |
---|---|
ruvyrias | Ruvyrias |
node | Node |
Returns
Defined in
Properties
password
• Private
password: string
Defined in
ruvyrias
• ruvyrias: Ruvyrias
Defined in
sessionId
• sessionId: null
| string
Defined in
url
• url: string
Defined in
Methods
delete
▸ delete(endpoint
): Promise
<null
>
Performs an HTTP DELETE request to the specified endpoint.
Parameters
Name | Type | Description |
---|---|---|
endpoint | `/${string}` | The endpoint to make the DELETE request. |
Returns
Promise
<null
>
A Promise that resolves with the response data.
Defined in
destroyPlayer
▸ destroyPlayer(guildId
): Promise
<null
>
Destroys a player for the specified guild.
Parameters
Name | Type | Description |
---|---|---|
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.
Defined in
get
▸ get(path
): Promise
<null
| RestMethodGet
>
Performs an HTTP GET request to the specified path.
Parameters
Name | Type | Description |
---|---|---|
path | `/${string}` | The path to make the GET request. |
Returns
Promise
<null
| RestMethodGet
>
A Promise that resolves with the response data.
Defined in
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
getRoutePlannerStatus
▸ getRoutePlannerStatus(): Promise
<unknown
>
This function will get the RoutePlanner status
Returns
Promise
<unknown
>
Defined in
patch
▸ patch(endpoint
, body
): Promise
<null
| Player
>
Performs an HTTP PATCH request to the specified endpoint with the provided body.
Parameters
Name | Type | Description |
---|---|---|
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.
Defined in
post
▸ post(endpoint
, body
): Promise
<null
| Track
[]>
Performs an HTTP POST request to the specified endpoint with the provided body.
Parameters
Name | Type | Description |
---|---|---|
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.
Defined in
setSessionId
▸ setSessionId(sessionId
): void
Sets the session ID for the REST instance.
Parameters
Name | Type | Description |
---|---|---|
sessionId | string | The session ID to set. |
Returns
void
Defined in
unmarkFailedAddress
▸ unmarkFailedAddress(address
): Promise
<unknown
>
This function will Unmark a failed address
Parameters
Name | Type | Description |
---|---|---|
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
Defined in
updatePlayer
▸ updatePlayer(options
): Promise
<null
| Player
| ErrorResponses
>
Updates a player with the specified options.
Parameters
Name | Type | Description |
---|---|---|
options | PlayOptions | The options to update the player. |
Returns
Promise
<null
| Player
| ErrorResponses
>
A Promise that resolves when the player is updated.