The REST manager for the Guilded API.

Example

new RESTManager({ version: 1, token: 'token' });

Hierarchy

  • EventEmitter
    • RESTManager

Constructors

Properties

options: RESTOptions

The options for the REST manager.

proxyUrl?: string

The proxy url of the REST API.

router: Router

The router for the REST API.

token?: string

The auth token for the REST API.

version?: number

The version of the REST API.

Accessors

Methods

  • Make a DELETE request to the REST API.

    Returns

    The response from the REST API.

    Example

    rest.delete('/channels/abc');
    

    Type Parameters

    • R

    Parameters

    • path: string

      The path for the resource.

    Returns Promise<R>

  • Make a request to the REST API.

    Returns

    The response from the REST API.

    Example

    rest.request('/channels/abc', 'GET');
    

    Type Parameters

    • R = any

    • B = any

    • P extends Record<string, any> = Record<string, any>

    Parameters

    • path: string

      The path to the resource.

    • method: string

      The HTTP method.

    • options: FetchOptions<B, P> = {}

      The options for the request.

    • retries: number = 0

      The number of retries.

    Returns Promise<R>

  • Make a GET request to the REST API.

    Returns

    The response from the REST API.

    Example

    rest.get('/channels/abc');
    

    Type Parameters

    • R = any

    • P extends Record<string, any> = Record<string, any>

    Parameters

    • path: string

      The path to the resource.

    • Optional params: P

      The query parameters for the request.

    Returns Promise<R>

  • Make a PATCH request to the REST API.

    Returns

    The response from the REST API.

    Example

    rest.patch('/channels/abc', { name: 'Chat' });
    

    Type Parameters

    • R = any

    • B = any

    Parameters

    • path: string

      The path to the resource.

    • Optional body: B

      The body for the request.

    Returns Promise<R>

  • Make a POST request to the REST API.

    Returns

    The response from the REST API.

    Example

    rest.post('/channels', { name: 'Chat', type: 'chat' });
    

    Type Parameters

    • R = any

    • B = any

    Parameters

    • path: string

      The path to the resource.

    • Optional body: B

      The body for the request.

    Returns Promise<R>

  • Make a PUT request to the REST API.

    Returns

    The response from the REST API.

    Example

    rest.put('/channels/abc/messages/abc', { content: 'Hello world!' });
    

    Type Parameters

    • R = any

    • B = any

    Parameters

    • path: string

      The path to the resource.

    • Optional body: B

      The body for the request.

    Returns Promise<R>