Interfaces · @purista/core
RestClient
REST API client abstraction for JSON-oriented HTTP calls.
Signature
interface RestClient Methods
6 entries
delete
Method
delete<T>(path: string, options: HttpClientRequestOptions): Promise<T> 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
get
Method
get<T>(path: string, options: HttpClientRequestOptions): Promise<T> 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
patch
Method
patch<T>(path: string, payload: unknown, options: HttpClientRequestOptions): Promise<T> 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
post
Method
post<T>(path: string, payload: unknown, options: HttpClientRequestOptions): Promise<T> 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
put
Method
put<T>(path: string, payload: unknown, options: HttpClientRequestOptions): Promise<T> 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
setBearerToken
Method
setBearerToken(token: string | undefined): void Set the Auth-Bearer-Token for all following requests