Skip to main content
Version: v2.7.5

Rest

Constructorโ€‹

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

Table of contentsโ€‹

Properties Methods
managerdelete()
destroyPlayer()
get()
getAllPlayers()
patch()
post()
put()
setSessionId()
updatePlayer()
updateSession()

Propertiesโ€‹

managerโ€‹

The Manager instance.

Returns: Manager

Methodsโ€‹

delete()โ€‹

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

Returns: Promise<unknown>

Parameter Type Description
guildIdstring as GuildIDThe guild ID of the player to destroy.

destroyPlayer()โ€‹

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

Returns: Promise<unknown>

Parameter Type Description
guildIdstring as GuildIDThe guild ID of the player to destroy.

get()โ€‹

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

Returns: Promise<unknown>

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

getAllPlayers()โ€‹

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

Returns: Promise<unknown>

path()โ€‹

Sends a PATCH request to update player related data.

Returns: Promise<unknown>

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

put()โ€‹

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

Returns: Promise<unknown>

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

setSessionId()โ€‹

Sets the session ID.

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

Returns: string

Parameter Type Description
sessionIdstringThe session ID to set.

updatePlayer()โ€‹

Sends a PATCH request to update player related data.

Returns: Promise<unknown>

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

updateSession()โ€‹

Updates the session status for resuming.

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

Returns: Promise<unknown>

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