PURISTA API / @purista/core / RestClient
Interface: RestClient
Defined in: packages/core/src/HttpClient/types/RestClient.ts:7
A REST API client which will provide GET, POST, PUT, PATCH, DELETE methods The client provides error and timeout handling and tries to decode the responses
Methods
delete()
delete<
T
>(path
,options
):Promise
<T
>
Defined in: packages/core/src/HttpClient/types/RestClient.ts:60
Make a DELETE request against baseUrl+path Returns body text if response content type is not set to application/json
. If response content type is application/json
, the JSON parsed result will be returned
Type Parameters
• T
Parameters
path
string
options
Returns
Promise
<T
>
get()
get<
T
>(path
,options
):Promise
<T
>
Defined in: packages/core/src/HttpClient/types/RestClient.ts:21
Make a GET request against baseUrl+path Returns body text if response content type is not set to application/json
. If response content type is application/json
, the JSON parsed result will be returned
Type Parameters
• T
Parameters
path
string
options
Returns
Promise
<T
>
patch()
patch<
T
>(path
,payload
,options
):Promise
<T
>
Defined in: packages/core/src/HttpClient/types/RestClient.ts:51
Make a PATCH request against baseUrl+path Returns body text if response content type is not set to application/json
. If response content type is application/json
, the JSON parsed result will be returned
Type Parameters
• T
Parameters
path
string
payload
unknown
options
Returns
Promise
<T
>
post()
post<
T
>(path
,payload
,options
):Promise
<T
>
Defined in: packages/core/src/HttpClient/types/RestClient.ts:31
Make a POST request against baseUrl+path Returns body text if response content type is not set to application/json
. If response content type is application/json
, the JSON parsed result will be returned
Type Parameters
• T
Parameters
path
string
payload
unknown
options
Returns
Promise
<T
>
put()
put<
T
>(path
,payload
,options
):Promise
<T
>
Defined in: packages/core/src/HttpClient/types/RestClient.ts:41
Make a PUT request against baseUrl+path Returns body text if response content type is not set to application/json
. If response content type is application/json
, the JSON parsed result will be returned
Type Parameters
• T
Parameters
path
string
payload
unknown
options
Returns
Promise
<T
>
setBearerToken()
setBearerToken(
token
):void
Defined in: packages/core/src/HttpClient/types/RestClient.ts:12
Set the Auth-Bearer-Token for all following requests
Parameters
token
the bearer token
undefined
| string
Returns
void