@acceleratxr/core_sdk / ApiClient
Class: ApiClient#
Provides a lightweight wrapper for the axios HTTP client that can perform automatic serialization, header assignment and automatic request retries.
Hierarchy#
ApiClient
Index#
Constructors#
Properties#
Methods#
Constructors#
constructor#
+ new ApiClient(config: Configuration): ApiClient
Defined in src/ApiClient.ts:33
Parameters:#
Name |
Type |
|---|---|
|
Returns: ApiClient
Properties#
axios#
• Private axios: AxiosInstance
Defined in src/ApiClient.ts:31
config#
• Private config: Configuration
Defined in src/ApiClient.ts:32
Methods#
delete#
▸ delete(url: string, query?: any, headers?: any): Promise<void>
Defined in src/ApiClient.ts:64
Sends an HTTP DELETE request to the specified url using the given query and headers values.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<void>
get#
▸ get(url: string, query?: any, headers?: any): Promise<any | undefined>
Defined in src/ApiClient.ts:77
Sends an HTTP GET request to the specified url using the given query and headers values and returns the
HTTP response.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<any | undefined>
The HTTP response.
getList#
▸ getList<T>(url: string, type: {}, query?: any, headers?: any): Promise<T[] | undefined>
Defined in src/ApiClient.ts:106
Sends an HTTP GET request to the specified url using the given query and headers values and returns a
result of the given type.
Type parameters:#
Name |
|---|
|
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
{} |
The class type of the result to return. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<T[] | undefined>
getObject#
▸ getObject<T>(url: string, type: {}, query?: any, headers?: any): Promise<T | undefined>
Defined in src/ApiClient.ts:89
Sends an HTTP GET request to the specified url using the given query and headers values and returns a
result of the given type.
Type parameters:#
Name |
|---|
|
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
{} |
The class type of the result to return. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<T | undefined>
head#
▸ head(url: string, query?: any, headers?: any): Promise<any>
Defined in src/ApiClient.ts:124
Sends an HTTP HEAD request to the specified url using the given query and headers values and returns
the resulting set of response headers.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<any>
post#
▸ post(url: string, body: any, query?: any, headers?: any): Promise<any | undefined>
Defined in src/ApiClient.ts:143
Sends an HTTP POST request to the specified url with the provided body using the given query and
headers values and returns the HTTP response.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The data to send in the body of the request. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<any | undefined>
The HTTP response.
postList#
▸ postList<T>(url: string, body: any, type?: undefined | {}, query?: any, headers?: any): Promise<T[] | undefined>
Defined in src/ApiClient.ts:180
Sends an HTTP POST request to the specified url with the provided body using the given query and
headers values and returns a result of the given type.
Type parameters:#
Name |
|---|
|
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The data to send in the body of the request. |
|
undefined | {} |
The class type of the result to return. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<T[] | undefined>
postObject#
▸ postObject<T>(url: string, body: any, type: {}, query?: any, headers?: any): Promise<T | undefined>
Defined in src/ApiClient.ts:161
Sends an HTTP POST request to the specified url with the provided body using the given query and
headers values and returns a result of the given type.
Type parameters:#
Name |
|---|
|
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The data to send in the body of the request. |
|
{} |
The class type of the result to return. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<T | undefined>
put#
▸ put(url: string, body: any, query?: any, headers?: any): Promise<any | undefined>
Defined in src/ApiClient.ts:200
Sends an HTTP PUT request to the specified url with the provided body using the given query and
headers values and returns the HTTP response.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The data to send in the body of the request. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<any | undefined>
The HTTP response.
putList#
▸ putList<T>(url: string, body: any, type: {}, query?: any, headers?: any): Promise<T[] | undefined>
Defined in src/ApiClient.ts:237
Sends an HTTP PUT request to the specified url with the provided body using the given query and
headers values and returns a result of the given type.
Type parameters:#
Name |
|---|
|
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The data to send in the body of the request. |
|
{} |
The class type of the result to return. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<T[] | undefined>
putObject#
▸ putObject<T>(url: string, body: any, type: {}, query?: any, headers?: any): Promise<T | undefined>
Defined in src/ApiClient.ts:218
Sends an HTTP PUT request to the specified url with the provided body using the given query and
headers values and returns a result of the given type.
Type parameters:#
Name |
|---|
|
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
string |
The url to send the request to. |
|
any |
The data to send in the body of the request. |
|
{} |
The class type of the result to return. |
|
any |
The query parameters to append to the url. |
|
any |
The headers to append to the request. |
Returns: Promise<T | undefined>
send#
▸ send(url: string, method: string, body: any, query?: any, headers?: any, retryDelay: number, retryCount: number): Promise<any>
Defined in src/ApiClient.ts:260
Sends an HTTP request to the specified url with the provided body using the given query and
headers values and returns the HTTP response.
Parameters:#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
string |
- |
The url to send the request to. |
|
string |
- |
The HTTP method to send the request as. |
|
any |
- |
The data to send in the body of the request. |
|
any |
- |
The query parameters to append to the url. |
|
any |
- |
The headers to append to the request. |
|
number |
250 |
The amount of time to wait before the next retry attempt. |
|
number |
0 |
The number of retry attempts that have occurred so far. |
Returns: Promise<any>
The HTTP response.
sendList#
▸ sendList<T>(url: string, method: string, body?: any, type?: undefined | {}, query?: any, headers?: any, retryDelay: number, retryCount: number): Promise<T[] | undefined>
Defined in src/ApiClient.ts:492
Sends an HTTP request to the specified url with the provided body using the given query and
headers values and returns a list of results of the given type.
Type parameters:#
Name |
|---|
|
Parameters:#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
string |
- |
The url to send the request to. |
|
string |
- |
The HTTP method to send the request as. |
|
any |
- |
The data to send in the body of the request. |
|
undefined | {} |
- |
The class type of the result to return. |
|
any |
- |
The query parameters to append to the url. |
|
any |
- |
The headers to append to the request. |
|
number |
250 |
The amount of time to wait before the next retry attempt. |
|
number |
0 |
The number of retry attempts that have occurred so far. |
Returns: Promise<T[] | undefined>
sendObject#
▸ sendObject<T>(url: string, method: string, body: any, type: {}, query?: any, headers?: any, retryDelay: number, retryCount: number): Promise<T | undefined>
Defined in src/ApiClient.ts:373
Sends an HTTP request to the specified url with the provided body using the given query and
headers values and returns a result of the given type.
Type parameters:#
Name |
|---|
|
Parameters:#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
string |
- |
The url to send the request to. |
|
string |
- |
The HTTP method to send the request as. |
|
any |
- |
The data to send in the body of the request. |
|
{} |
- |
The class type of the result to return. |
|
any |
- |
The query parameters to append to the url. |
|
any |
- |
The headers to append to the request. |
|
number |
250 |
The amount of time to wait before the next retry attempt. |
|
number |
0 |
The number of retry attempts that have occurred so far. |
Returns: Promise<T | undefined>