Rest
SDK exports types for Rest API requests:
ts
import type {
Primitive,
FilterCompareType,
FilterCompareValue,
FilterRangeType,
FilterRangeValue,
FilterDateRangeValue,
FilterValue,
RestFilter,
RestGetParams,
RestPostData,
RestCallType,
RestCallParams
} from '@aspro-cloud/miniapp-jssdk'Types
Primitive
Primitive value
| Type |
|---|
string | number | boolean | null |
FilterCompareType
Comparison kind in value filter
| Value | Description |
|---|---|
'exact_value' | Exact match |
'less' | Less than or equal (maximum value) |
'more' | Greater than or equal (minimum value) |
FilterCompareValue
Value comparison filter
| Property | Type | Description |
|---|---|---|
type | FilterCompareType | Comparison kind 'exact_value' | 'less' | 'more' |
value | Primitive | Comparison value |
FilterRangeType
Comparison kind in range filter
| Value | Description |
|---|---|
'range' | Value range |
FilterRangeValue
Value range filter
| Property | Type | Description |
|---|---|---|
type | FilterRangeType | Comparison kind, accepts only the value 'range' |
start_value | Primitive | Range start |
end_value | Primitive | Range end |
FilterDateRangeValue
Date/time range filter in YYYY-MM-DD HH:mm:ss format
| Property | Type | Description |
|---|---|---|
start_date | string | Period start |
end_date | string | Period end |
FilterValue
Universal filter value
| Type | Description |
|---|---|
Primitive | Primitive[] | FilterCompareValue | FilterRangeValue | FilterDateRangeValue | Filter value |
RestFilter
Filter parameters type for filtering record lists via the Rest.get() method
ts
type RestFilter = Record<string, FilterValue>| Property | Type | Description |
|---|---|---|
[key: string] | FilterValue | Filter value |
RestGetParams
Parameters for the Rest.get() method when retrieving record lists
| Property | Type | Description |
|---|---|---|
limit | number | Maximum number of records per request. Default is 50, maximum is 100 |
page | number | Page number of the request result. Default is 1 |
search | string | Search query |
fields | string[] | List of fields to return in the response |
filter | RestFilter | Filter parameters for the record list |
RestPostData
Data type for the Rest.post() method
ts
type RestPostData = Record<string, any>| Property | Type | Description |
|---|---|---|
[key: string] | any | Data to send |
RestCallType
Request type for the universal Rest.call() method
| Value | Description |
|---|---|
'get' | Rest.get() method |
'post' | Rest.post() method |
RestCallParams
Parameters for the universal Rest.call() method
| Property | Type | Description |
|---|---|---|
type | RestCallType | Request type ('get' or 'post', default is 'post') |
method | string | API method URL, e.g. '/core/user/list' |
params | RestGetParams | RestPostData | Request parameters or data |