Skip to content

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

ValueDescription
'exact_value'Exact match
'less'Less than or equal (maximum value)
'more'Greater than or equal (minimum value)

FilterCompareValue

Value comparison filter

PropertyTypeDescription
typeFilterCompareTypeComparison kind 'exact_value' | 'less' | 'more'
valuePrimitiveComparison value

FilterRangeType

Comparison kind in range filter

ValueDescription
'range'Value range

FilterRangeValue

Value range filter

PropertyTypeDescription
typeFilterRangeTypeComparison kind, accepts only the value 'range'
start_valuePrimitiveRange start
end_valuePrimitiveRange end

FilterDateRangeValue

Date/time range filter in YYYY-MM-DD HH:mm:ss format

PropertyTypeDescription
start_datestringPeriod start
end_datestringPeriod end

FilterValue

Universal filter value

TypeDescription
Primitive | Primitive[] | FilterCompareValue | FilterRangeValue | FilterDateRangeValueFilter value

RestFilter

Filter parameters type for filtering record lists via the Rest.get() method

ts
type RestFilter = Record<string, FilterValue>
PropertyTypeDescription
[key: string]FilterValueFilter value

RestGetParams

Parameters for the Rest.get() method when retrieving record lists

PropertyTypeDescription
limitnumberMaximum number of records per request. Default is 50, maximum is 100
pagenumberPage number of the request result. Default is 1
searchstringSearch query
fieldsstring[]List of fields to return in the response
filterRestFilterFilter parameters for the record list

RestPostData

Data type for the Rest.post() method

ts
type RestPostData = Record<string, any>
PropertyTypeDescription
[key: string]anyData to send

RestCallType

Request type for the universal Rest.call() method

ValueDescription
'get'Rest.get() method
'post'Rest.post() method

RestCallParams

Parameters for the universal Rest.call() method

PropertyTypeDescription
typeRestCallTypeRequest type ('get' or 'post', default is 'post')
methodstringAPI method URL, e.g. '/core/user/list'
paramsRestGetParams | RestPostDataRequest parameters or data

Published under the MIT license.