Skip to main content
Version: v2.8.2

Rest

Constructorโ€‹

new Magmastream.Rest(node: Node, manager: Manager)
Parameter Type Description
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)โ€‹

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)โ€‹

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)โ€‹

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()โ€‹

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

Return: Promise<unknown>


put(endpoint, body)โ€‹

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)โ€‹

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)โ€‹

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)โ€‹

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.