mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
feat: REST#raw (#7929)
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
import type { HashData } from './RequestManager';
|
||||
import type { IHandler } from './handlers/IHandler';
|
||||
import { DefaultRestOptions, RESTEvents } from './utils/constants';
|
||||
import { parseResponse } from './utils/utils';
|
||||
|
||||
/**
|
||||
* Options to be passed when creating the REST instance
|
||||
@@ -314,7 +315,16 @@ export class REST extends EventEmitter {
|
||||
* Runs a request from the api
|
||||
* @param options Request options
|
||||
*/
|
||||
public request(options: InternalRequest) {
|
||||
public async request(options: InternalRequest) {
|
||||
const response = await this.raw(options);
|
||||
return parseResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a request from the API, yielding the raw Response object
|
||||
* @param options Request options
|
||||
*/
|
||||
public raw(options: InternalRequest) {
|
||||
return this.requestManager.queueRequest(options);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user