Skip to main content
Version: v2.8.4

Rest

Constructor

new Magmastream.Rest(node: Node, manager: Manager)
Parameter Type Description Optional
nodeNodeThe node
managerManagerThe Manager instance.

Table of contents

Properties Methods
managerdelete()
passworddestroyPlayer()
nodeget()
urlgetAllPlayers()
sessionIdpatch()
post()
put()
setSessionId()
updatePlayer()
updateSession()

Properties

manager

The Manager instance.

Return: Manager


password

Password of the node.

Return: string


node

The node for the Rest.

Return: Node


url

The url of the node.

Return: string


sessionId

The sessionId of the Node.

Return: string

Methods

delete(endpoint)

async function

Sends a DELETE request to the server to destroy the player.

Return: Promise<unknown>

Parameter Type Description Optional
endpointstringThe endpoint to send the DELETE request to.

destroyPlayer(guildId)

async function

Sends a DELETE request to the server to destroy the player.

Return: Promise<unknown>

Parameter Type Description Optional
guildIdstring as Guild.idThe guild ID of the player to destroy.

get(endpoint)

async function

Sends a GET request to the specified endpoint and returns the response data.

Return: Promise<unknown>

Parameter Type Description Optional
endpointstringThe endpoint to send the GET request to.

getAllPlayers()

async function

Retrieves all the players that are currently running on the node.

Return: Promise<unknown>


put(endpoint, body)

async function

Sends a PUT request to the specified endpoint and returns the response data.

Return: Promise<unknown>

Parameter Type Description Optional
endpointstringThe endpoint to send the PUT request to.
bodyunknownThe data to send in the request body.

setSessionId(sessionId)

async function

Sets the session ID.

This method is used to set the session ID after a resume operation is done.

Return: string

Parameter Type Description Optional
sessionIdstringThe session ID to set.

updatePlayer(options)

async function

Sends a PATCH request to update player related data.

Return: Promise<unknown>

Parameter Type Description Optional
optionsplayOptions{}The options to update the player with.

updateSession(resuming, timeout)

async function

Updates the session status for resuming.

This method sends a PATCH request to update the session's resuming status and timeout.

Return: Promise<unknown>

Parameter Type Description Optional
resumingbooleanIndicates whether the session should be set to resuming.
timeoutnumberThe timeout duration for the session resume.