Ops
Operations are used during the requests to handle specific actions. You can pass multiple operations in one request.
You can find all the supported operations below:
Operation | Definition |
---|---|
Value | ["value", <literal: any>] Returns a literal value directly as a result. |
Take | ["take", <number: int, expression(int)>, <result: expression(array)>] Takes a number of items from an resulting expression array and returns them. |
And | ["and", <check1: expression(boolean)>, ...<checkN: expression(boolean)>] Runs AND operation returing true if all check values are true. |
Or | ["or", <check1: expression(boolean)>, ...<checkN: expression(boolean)>] Runs OR operation returning first true value from check . |
Not | ["not", <check: expression(boolean)>] Runs NOT operation on result of check . |
Get | ["get", <key: string, expression(string)>, <result: expression(array)> [, <default: expression(any)>]] Gets a value specified by key from a result . |
Compare | ["compare", <valueA: expression(any)>, <operation: string, expression(string)>, <valueB: expression(any)>] Compares results of valueA and valueB by using operation |
If Else | ["ifElse", <check: expression(boolean)>, <trueResult: expression(any)>, <falseResult: expression(any)>] Evaluates check and returns trueResult if true or falseResult if false. |
Map | ["map", <key: string, expression(string)>, <value: string, expression(string)>, <result: expression(array)>] Maps result to key-value list where key is specified by key and value is specified by value |
Object | ["object", <object: array[key -> expression(any)]>] Evaluates all expressions in an object and returns the result with same populated keys. |
Coalesce | ["coalesce", <result1: expression(any)>, ...<resultN: expression(any)>] Evaluates results sequentially one by one and stops and returns on first non-null result. |
Merge | ["merge", <result1: expression(array)>, ...<resultN: expression(array)>] Merges resulting arrays in result1, ..., resultN into one array. |
Sort | ["sort", <by: expression(string, int), string, int>, <direction: expression(string), string>, <from: expression(array)>] or ["sort", <direction: expression(string), string>, <from: expression(array)>] Sorts result in ascending or descending order. |
Sequence | ["sequence", <item1: expression(any)>, ...<itemN: expression(any)>] Evaluates all items in a sequence and returns the result of the last item. |
Var | ["var", <name: expression(string), string> [, <value: expression(any)>]] Gets or sets a variable to be used during a request. |
Cast | ["cast", <into: expression(string), string>, <from: expression(any)>] Converts one value into another. |
Run | ["run", <name: expression(string), string>, <data: expression(any), string, int, float, null, bool>] Runs one action and returns it's result. |
List | ["list", <name: expression(string), string>, <data: expression(array)>] Runs list action returning paginated data. |