APIRequest

A class representing a request to the API

Properties

.attachments

A list of attachments to send

type attachments = Attachment[];

.baseUrl

The base url of this request

type baseUrl = string;

.body

The JSON body to send

type body = Json | undefined;

.headers

Headers to be sent in the request

type headers = OutgoingHttpHeaders;

.method

Method used for this request

type method = RequestMethod;

.path

The path of this request

type path = Path;

.query

Query applied to the request

type query = URLSearchParams;

.rest

The rest manager that instantiated this

type rest = Rest;

.status

The status of this request

type status = RequestStatus;

get .route

The route of this request

type route = Path;

get .url

The full URL of this request

type url = URL;

Constructor

new APIRequest(rest, path, method, options);
ParameterDefaultDescriptionTypeRequired
rest-The rest that instantiated thisResttrue
path-The path to requestPathtrue
method-The method of the requestRequestMethodtrue
options{}Options for this requestRequestOptionsfalse

Functions

addAttachments(attachments)

Add some attachments to this request

ParameterDescriptionTypeOptional
attachmentsAttachments to addAttachment[]false

Returns the new request

APIRequest;

editHeaders(headers)

Edit headers for this request

ParameterDescriptionTypeOptional
headersHeaders to add/removeOutgoingHttpHeadersopen in new windowfalse

Returns the new request

APIRequest;

removeAttachments(attachments)

Remove some attachments from this request

ParameterDescriptionTypeOptional
attachmentsAttachments to removestring[]open in new windowfalse

Returns the new request

APIRequest;

send()

Send the request to the API

Returns a promise with the data received from the API or null if there is no data

Promise<Response>
Last Updated:
Contributors: NotReallyEight