import { RESTManager } from "https://deno.land/x/harmony@v2.6.0/src/rest/manager.ts";
An easier to use interface for interacting with Discord REST API.
Constructors
new
RESTManager(options?: RESTOptions)Properties
api: APIMap
API Map - easy to use way for interacting with Discord API.
Examples:
-
rest.api.users['123'].get().then(userPayload => doSomething)
-
rest.api.guilds['123'].channels.post({ name: 'my-channel', type: 0 }).then(channelPayload => {})
readonly
optional
client: ClientOptional Harmony Client object
endpoints: RESTEndpoints
readonly
handlers: Collection<string, BucketHandler>tokenType: TokenType
Token Type of the Token if any
Methods
delete(): Promise<any>
url: string,
body?: unknown,
maxRetries?,
bucket?: string | null,
rawResponse?: boolean,
options?: RequestOptions,
Makes a DELETE Request to API
get(): Promise<any>
url: string,
body?: unknown,
maxRetries?,
bucket?: string | null,
rawResponse?: boolean,
options?: RequestOptions,
Makes a GET Request to API
make(): Promise<any>
method: RequestMethods,
url: string,
body?: unknown,
_maxRetries?,
bucket?: string | null,
rawResponse?: boolean,
options?: RequestOptions,
Makes a Request to Discord API.
patch(): Promise<any>
url: string,
body?: unknown,
maxRetries?,
bucket?: string | null,
rawResponse?: boolean,
options?: RequestOptions,
Makes a PATCH Request to API
post(): Promise<any>
url: string,
body?: unknown,
maxRetries?,
bucket?: string | null,
rawResponse?: boolean,
options?: RequestOptions,
Makes a POST Request to API
put(): Promise<any>
url: string,
body?: unknown,
maxRetries?,
bucket?: string | null,
rawResponse?: boolean,
options?: RequestOptions,
Makes a PUT Request to API
request<T = any>(): Promise<T>
resolveBucket(url: string): string
setTimeout(fn: (...args: unknown[]) => unknown, ms: number): number