Skip to content

Class: RESTClient ​

Defined in: client.ts:7

Extended by ​

Constructors ​

Constructor ​

ts
new RESTClient(baseURL?): RESTClient;

Defined in: client.ts:11

Parameters ​

ParameterTypeDefault value
baseURL?string"/api/v1"

Returns ​

RESTClient

Methods ​

clearToken() ​

ts
clearToken(): void;

Defined in: client.ts:56

clear authentication token

Returns ​

void


delete() ​

ts
delete<T>(url, config?): Promise<T>;

Defined in: client.ts:109

generic delete request

Type Parameters ​

Type ParameterDefault type
Tany

Parameters ​

ParameterType
urlstring
config?AxiosRequestConfig<any, any>

Returns ​

Promise<T>


get() ​

ts
get<T>(url, config?): Promise<T>;

Defined in: client.ts:77

generic get request

Type Parameters ​

Type ParameterDefault type
Tany

Parameters ​

ParameterType
urlstring
config?AxiosRequestConfig<any, any>

Returns ​

Promise<T>


getBaseURL() ​

ts
getBaseURL(): string;

Defined in: client.ts:70

get current base url

Returns ​

string


patch() ​

ts
patch<T>(
   url, 
   data?, 
   config?
): Promise<T>;

Defined in: client.ts:101

generic patch request

Type Parameters ​

Type ParameterDefault type
Tany

Parameters ​

ParameterType
urlstring
data?any
config?AxiosRequestConfig<any, any>

Returns ​

Promise<T>


post() ​

ts
post<T>(
   url, 
   data?, 
   config?
): Promise<T>;

Defined in: client.ts:85

generic post request

Type Parameters ​

Type ParameterDefault type
Tany

Parameters ​

ParameterType
urlstring
data?any
config?AxiosRequestConfig<any, any>

Returns ​

Promise<T>


put() ​

ts
put<T>(
   url, 
   data?, 
   config?
): Promise<T>;

Defined in: client.ts:93

generic put request

Type Parameters ​

Type ParameterDefault type
Tany

Parameters ​

ParameterType
urlstring
data?any
config?AxiosRequestConfig<any, any>

Returns ​

Promise<T>


setBaseURL() ​

ts
setBaseURL(baseURL): void;

Defined in: client.ts:63

set base url for api requests (for dynamic server configuration)

Parameters ​

ParameterType
baseURLstring

Returns ​

void


setClientKind() ​

ts
setClientKind(kind): void;

Defined in: client.ts:48

say which of Refract's apps is making the requests. Only the mobile app says anything: the instance takes a request that doesn't for the desktop kind, which a browser is too.

Parameters ​

ParameterType
kindIClientKind

Returns ​

void


setToken() ​

ts
setToken(token): void;

Defined in: client.ts:39

set authentication token for subsequent requests

Parameters ​

ParameterType
tokenstring | null

Returns ​

void

Released under the GNU Affero General Public License v3.0.