APIRequest
A class representing a request to the API
Properties
.attachments
A list of attachments to send
type attachments = Attachment[];
- See Attachment
.baseUrl
The base url of this request
type baseUrl = string;
.body
The JSON body to send
type body = Json | undefined;
- See Json
- See undefinedopen in new window
.headers
Headers to be sent in the request
type headers = OutgoingHttpHeaders;
.method
Method used for this request
type method = RequestMethod;
- See RequestMethod
.path
The path of this request
type path = Path;
- See 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;
- See RequestStatus
- Default value is
RequestStatus.Pending
get .route
The route of this request
type route = Path;
- See Path
get .url
The full URL of this request
type url = URL;
Constructor
new APIRequest(rest, path, method, options);
Parameter | Default | Description | Type | Required |
---|---|---|---|---|
rest | - | The rest that instantiated this | Rest | true |
path | - | The path to request | Path | true |
method | - | The method of the request | RequestMethod | true |
options | {} | Options for this request | RequestOptions | false |
Functions
addAttachments(attachments)
Add some attachments to this request
Parameter | Description | Type | Optional |
---|---|---|---|
attachments | Attachments to add | Attachment[] | false |
Returns the new request
APIRequest;
- See APIRequest
editHeaders(headers)
Edit headers for this request
Parameter | Description | Type | Optional |
---|---|---|---|
headers | Headers to add/remove | OutgoingHttpHeaders open in new window | false |
Returns the new request
APIRequest;
- See APIRequest
removeAttachments(attachments)
Remove some attachments from this request
Parameter | Description | Type | Optional |
---|---|---|---|
attachments | Attachments to remove | string[] open in new window | false |
Returns the new request
APIRequest;
- See 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>
- See Response