Interfaces · @purista/core

RestClient

REST API client abstraction for JSON-oriented HTTP calls.

Signature

RestClient.ts typescript
interface RestClient

Methods

6 entries

delete

Method

Source
delete.ts typescript
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

Source
get.ts typescript
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

Source
patch.ts typescript
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

Source
post.ts typescript
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

Source
put.ts typescript
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

Source
setBearerToken.ts typescript
setBearerToken(token: string | undefined): void

Set the Auth-Bearer-Token for all following requests