Class RESTClientInternal

A client for interacting with the Eludris REST API.

Hierarchy

  • RESTClient

Constructors

  • Create a new REST client.

    Parameters

    • apiUrl: string

      The base api URL to use.

    Returns RESTClient

    Example

    import { RESTClient } from 'eludris.js';

    const rest = new RESTClient({});

Properties

apiUrl: string

The base URL used for requests.

authToken: undefined | string = undefined

The auth token used.

instanceInfo: undefined | InstanceInfo = undefined

The instance info.

rateLimitBuckets: Map<ValidRoutes, {
    remaining: number;
    reset_at: number;
}> = ...

The rate limit buckets.

Type declaration

  • remaining: number
  • reset_at: number

Methods

  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<User>

  • Parameters

    Returns Promise<void>

  • Parameters

    • __namedParameters: {
          id: number;
      }
      • id: number

    Returns Promise<Blob>

  • Parameters

    • __namedParameters: {
          bucket: string;
          id: number;
      }
      • bucket: string
      • id: number

    Returns Promise<Blob>

  • Parameters

    • __namedParameters: {
          name: string;
      }
      • name: string

    Returns Promise<Blob>

  • Parameters

    • to: "api" | "cdn"
    • route: ValidRoutes
    • path: string
    • options: RequestInit = ...

    Returns Promise<Response>

  • Type Parameters

    • T

    Parameters

    • baseUrl: "api" | "cdn"
    • route: ValidRoutes
    • path: string
    • options: RequestInit = {}

    Returns Promise<T>

  • Parameters

    • __namedParameters: {
          id: number;
      }
      • id: number

    Returns Promise<FileData>

  • Parameters

    • __namedParameters: {
          withRateLimits: boolean;
      }
      • withRateLimits: boolean

    Returns Promise<InstanceInfo>

  • Returns Promise<Session[]>

  • Parameters

    • __namedParameters: {
          userId: number;
      }
      • userId: number

    Returns Promise<User>

  • Parameters

    • __namedParameters: {
          username: string;
      }
      • username: string

    Returns Promise<User>

  • Parameters

    • response: Response
    • route: ValidRoutes

    Returns void

  • Parameters

    • route: ValidRoutes
    • id: string

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<User>

  • Parameters

    Returns Promise<User>

    Link

    eludris-api-types.UpdateUser

  • Parameters

    Returns Promise<FileData>

  • Parameters

    • __namedParameters: {
          bucket: string;
      } & FileUpload

    Returns Promise<FileData>

  • Verify your email address.

    Parameters

    • code: {
          code: number;
      }

      The code to verify.

      • code: number

    Returns Promise<void>