Interface: ProvidenceClient
types/ProvidenceClient.ProvidenceClient
Properties
paginator
• paginator: Paginator
The paginator is an object full of functions that instruct Providence in how to handle pagination for your API.
Defined in
src/base/types/ProvidenceClient.ts:41
Methods
deriveErrors
▸ deriveErrors\<T>(val, knownFields): FormErrorSet\<any>
A function that takes an error raised by netCall and returns a FormErrorSet.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
val |
AxiosError\<unknown, any> |
An error raised by netCall when making a network request. |
knownFields |
keyof T[] |
The fields the current interface is aware of. This makes it easy to notice missing fields your frontend doesn't know about but you received an error for-- the ones you don't provide are put into a global error section instead so your users can report them to you. |
Returns
FormErrorSet\<any>
Defined in
src/base/types/ProvidenceClient.ts:37
deriveForm
▸ deriveForm\<T, K>(args): K
Takes an AxiosResponse from the server and returns the data from the form endpoint.
Type parameters
| Name | Type |
|---|---|
T |
T |
K |
T |
Parameters
| Name | Type |
|---|---|
args |
DeriveFormArgs\<T> |
Returns
K
Defined in
src/base/types/ProvidenceClient.ts:28
deriveList
▸ deriveList\<T>(args): PaginationResult\<T>
Takes an AxiosResponse from the server and returns a list with pagination info.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
args |
DeriveListArgs\<T> |
Returns
PaginationResult\<T>
Defined in
src/base/types/ProvidenceClient.ts:24
deriveSingle
▸ deriveSingle\<T>(args): T
Given an AxiosResponse and the current state of the single module, derive a single from the response.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
args |
DeriveSingleArgs\<T> |
Returns
T
Defined in
src/base/types/ProvidenceClient.ts:20
netCall
▸ netCall\<T, K>(opts): Promise\<AxiosResponse\<K, any, {}>>
A wrapper around Axios's request function. Define this to include things like Authentication headers in your network requests.
Type parameters
| Name | Type |
|---|---|
T |
T |
K |
T |
Parameters
| Name | Type |
|---|---|
opts |
NetCallOptions\<T> |
Returns
Promise\<AxiosResponse\<K, any, {}>>