ApiUserResource
@auvious/common / Exports / ApiUserResource
Class: ApiUserResource
Api resource implementation for auvious' services. This instance should be used for saving & reading on a specific resource over HTTP.
Hierarchy
↳
ApiUserResource
Table of contents
Constructors
Properties
Accessors
Methods
- _apiCall
- _appendReadHeaders
- _appendWriteHeaders
- create
- createGeneric
- delete
- deleteById
- deleteByIdGeneric
- deleteGeneric
- get
- getById
- getByIdGeneric
- getGeneric
- getMe
- getPaged
- getPagedGeneric
- getUserById
- getUserOrganizations
- update
- updateById
- updateByIdGeneric
- updateGeneric
Constructors
constructor
• new ApiUserResource(client, version?)
Parameters
| Name | Type | Default value |
|---|---|---|
client | AuviousCommon | undefined |
version | string | "1.0" |
Overrides
Properties
_client
• Protected _client: AuviousCommon
Inherited from
_postman
• Protected _postman: Postman
Inherited from
_route
• Protected _route: string
Inherited from
_version
• Protected _version: string
Inherited from
log
• Protected log: Logger
Inherited from
USER_ROUTE
▪ Static Private Readonly USER_ROUTE: string = "/security/user"
Accessors
parentClient
• get parentClient(): AuviousCommon
Gets the parent client of the api resource.
Returns
Inherited from
ApiResource.parentClient
route
• get route(): string
Gets the resource default route. This is what is this._appended on the server url, before any route parameters.
.eg an api resource of route '/api/user' will get from http://server.url/api/user
Returns
string
Inherited from
ApiResource.route
version
• get version(): string
Gets the resource default version. This should be set in every request's X-REQUESTED-VERSION header.
Returns
string
Inherited from
ApiResource.version
Methods
_apiCall
▸ Protected _apiCall<ResourceT>(ResourceTctor, method, config, retries?, initialDelay?): Promise<ResourceT>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type | Default value |
|---|---|---|
ResourceTctor | (args: any) => ResourceT | undefined |
method | string | undefined |
config | any | undefined |
retries | number | 3 |
initialDelay | number | 500 |
Returns
Promise<ResourceT>
Inherited from
_appendReadHeaders
▸ Protected _appendReadHeaders(config): void
Parameters
| Name | Type |
|---|---|
config | any |
Returns
void
Inherited from
ApiResource._appendReadHeaders
_appendWriteHeaders
▸ Protected _appendWriteHeaders(config): void
Parameters
| Name | Type |
|---|---|
config | any |
Returns
void
Inherited from
ApiResource._appendWriteHeaders
create
▸ create(data, config?): Promise<any>
Parameters
| Name | Type |
|---|---|
data | any |
config | any |
Returns
Promise<any>
Inherited from
createGeneric
▸ createGeneric<ResourceT>(ResourceTctor, data, config?): Promise<ResourceT>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type |
|---|---|
ResourceTctor | (args: any) => ResourceT |
data | any |
config | any |
Returns
Promise<ResourceT>
Inherited from
delete
▸ delete(config?): Promise<any>
Parameters
| Name | Type |
|---|---|
config | any |
Returns
Promise<any>
Inherited from
deleteById
▸ deleteById(id, config?): Promise<any>
Parameters
| Name | Type |
|---|---|
id | string |
config | any |
Returns
Promise<any>
Inherited from
deleteByIdGeneric
▸ deleteByIdGeneric<ResourceT>(ResourceTctor, id, config?): Promise<ResourceT>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type |
|---|---|
ResourceTctor | (args: any) => ResourceT |
id | string |
config | any |
Returns
Promise<ResourceT>
Inherited from
deleteGeneric
▸ deleteGeneric<ResourceT>(ResourceTctor, config?): Promise<ResourceT>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type |
|---|---|
ResourceTctor | (args: any) => ResourceT |
config | any |
Returns
Promise<ResourceT>
Inherited from
get
▸ get(config?): Promise<any>
Just GET the god-damn thing.
Parameters
| Name | Type | Description |
|---|---|---|
config | any | axios compatible config |
Returns
Promise<any>
http response body
Inherited from
getById
▸ getById(id, config?): Promise<any>
Parameters
| Name | Type |
|---|---|
id | string |
config | any |
Returns
Promise<any>
Inherited from
getByIdGeneric
▸ getByIdGeneric<ResourceT>(ResourceTctor, id, config?): Promise<ResourceT>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type |
|---|---|
ResourceTctor | (args: any) => ResourceT |
id | string |
config | any |
Returns
Promise<ResourceT>
Inherited from
getGeneric
▸ getGeneric<ResourceT>(ResourceTctor, config?): Promise<any>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type |
|---|---|
ResourceTctor | (args: any) => ResourceT |
config | any |
Returns
Promise<any>
Inherited from
getMe
▸ getMe(): Promise<IUser>
Returns
Promise<IUser>
getPaged
▸ getPaged(page, size, config?): Promise<any>
Parameters
| Name | Type |
|---|---|
page | number |
size | number |
config | any |
Returns
Promise<any>
Inherited from
getPagedGeneric
▸ getPagedGeneric<ResourceT>(ResourceTctor, page, size, config?): Promise<ResourceT>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type |
|---|---|
ResourceTctor | (args: any) => ResourceT |
page | number |
size | number |
config | any |
Returns
Promise<ResourceT>
Inherited from
getUserById
▸ getUserById(userId): Promise<IUser>
Parameters
| Name | Type |
|---|---|
userId | string |
Returns
Promise<IUser>
getUserOrganizations
▸ getUserOrganizations(clientId, username, password): Promise<IUser[]>
Parameters
| Name | Type |
|---|---|
clientId | string |
username | string |
password | string |
Returns
Promise<IUser[]>
update
▸ update(data, config?): Promise<any>
Parameters
| Name | Type |
|---|---|
data | any |
config | any |
Returns
Promise<any>
Inherited from
updateById
▸ updateById(id, data, config?): Promise<any>
Parameters
| Name | Type |
|---|---|
id | string |
data | any |
config | any |
Returns
Promise<any>
Inherited from
updateByIdGeneric
▸ updateByIdGeneric<ResourceT>(ResourceTctor, id, data, config?): Promise<ResourceT>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type |
|---|---|
ResourceTctor | (args: any) => ResourceT |
id | string |
data | any |
config | any |
Returns
Promise<ResourceT>
Inherited from
updateGeneric
▸ updateGeneric<ResourceT>(ResourceTctor, data, config?): Promise<ResourceT>
Type parameters
| Name | Type |
|---|---|
ResourceT | extends ApiResourceModel<ResourceT> |
Parameters
| Name | Type |
|---|---|
ResourceTctor | (args: any) => ResourceT |
data | any |
config | any |
Returns
Promise<ResourceT>