distype - v3.0.0
    Preparing search index...

    Class RestBucketInternal

    A rest bucket. Used for rate limiting requests.

    Index

    Constructors

    • Create a rest bucket.

      Parameters

      • id: `${string}(${string})`

        The bucket's ID.

      • bucketHash: string

        The bucket's unique RestBucketHash hash.

      • majorParameter: string

        The RestMajorParameter major parameter associated with the bucket.

      • manager: Rest

        The rest manager the bucket is bound to.

      Returns RestBucket

    Properties

    allowedRequestsPerRatelimit: number = Infinity

    The number of allowed requests per a rate limit interval.

    bucketHash: string

    The bucket's unique RestBucketHash hash.

    id: `${string}(${string})`

    The bucket's ID.

    majorParameter: string

    The RestMajorParameter major parameter associated with the bucket.

    manager: Rest

    The rest manager the bucket is bound to.

    requestsLeft: number = 1

    The current number of requests left.

    resetAt: number = -1

    A unix millisecond timestamp at which the rate limit resets.

    system: "Rest Bucket" = ...

    The system string used for logging.

    RATELIMIT_HEADERS: {
        BUCKET: string;
        GLOBAL: string;
        GLOBAL_RETRY_AFTER: string;
        LIMIT: string;
        REMAINING: string;
        RESET: string;
        RESET_AFTER: string;
        SCOPE: string;
    } = ...

    Rest rate limit headers. Headers are lowercase to allow for easier comparison (receivedHeader.toLowerCase() === REST_RATELIMIT_HEADERS.HEADER), as some http libraries return headers in all uppercase or all lowercase.

    Accessors

    • get ratelimited(): { any: boolean; global: boolean; local: boolean }

      Get information on the bucket's current rate limit restrictions.

      Returns { any: boolean; global: boolean; local: boolean }

    Methods

    • Make a rest request with this bucket's rate limits.

      Parameters

      • method: RestMethod

        The request's method.

      • route: `/${string}`

        The requests's route, relative to the base Discord API URL. (Example: /channels/123456789000000000)

      • routeHash:
            | `GET;${string}`
            | `POST;${string}`
            | `PUT;${string}`
            | `DELETE;${string}`
            | `PATCH;${string}`

        The request's route hash.

      • options: RestRequestData

        Request options.

      Returns Promise<RestMakeResponse>

      Response data.