...
For all functions, enter the parameters in the order listed.
children
...
Returns an array of the children of the pico. Has optional parameter "name" which returns just the attributes for the child with the specific name if it exists, otherwise it returns attributes on every child if not provided. It gives attributes:
...
Code Block | ||||
---|---|---|---|---|
| ||||
children = wrangler:children() /* [ { "parent_eci": "CyrmdG4PkiVYRUo2K69k2E", "name": "Section CS462-1 Pico", "id": "cjh6pbzun005zvde06bwy2pci", "eci": "JfcEBxEK5WDKA69Bvach4Y" }, { "parent_eci": "Tg5ULPBYByJjsEoKpfsbQ2", "name": "Section CS462-2 Pico", "id": "cjh6pc28r0067vde04qd23t6o", "eci": "56S414r4Uq4kGx6Xi1qmSs" } ] */ |
myself
...
Returns a map giving basic meta information about the pico. This information includes the pico's ID, ECI, and name.
...
A user friendly way to make an HTTP request between picos. It provides cleanup and returns the error if the returned HTTP status was not 200.
It is mainly used to programmatically call functions inside of other picos from inside a rule. However, do not have a pico query itself, or have two picos query each other simultaneously. See Accessing a Function Shared by Another Pico for more information.
Parameter | Datatype |
---|
...
Description | ||
---|---|---|
eci | String | The ECI to send the event to |
mod | String | The ruleset to send the event to |
func | String | The name of the function to query |
params | Object | The parameters to be passed to the function on the target pico. Given as an object with parameter name mapped to argument value. |
_host | String | The target pico's host |
_path | String | An optional different path for the beginning of the underlying URL |
_root_url | String | The root URL for the request. Defaults to meta:host (the pico engine itself). |
Code Block | ||||
---|---|---|---|---|
| ||||
pre {
eci = event:attr("eci")
wellknown = wrangler:skyQuery( eci , "io.picolabs.subscription", "wellKnown_Rx")
}
if wellknown{"error"}.isnull() then
noop()
always {
ent:savedWellknown := wellknown;
}
/*
Query the the function wellKnown_Rx() in the ruleset "io.picolabs.subscription" through the pico ECI given in the event attribute "eci".
*/
pre {
eci = eci_to_other_pico;
args = {"arg1": val1, "arg2": val2};
answer = Wrangler:skyQuery(eci,"my.ruleset.id","myFunction",args);
}
if answer{"error"}.isnull() then noop();
fired {
// process using answer
} |
Defactions
Events/Rules
When a rule raises an event in the postlude, it will also pass along all the attributes it received (including any attributes not used in that event) in addition to any new information that may be relevant to other rules.
Bolded attributes are required.
Ruleset Events
installRulesets
...
Domain | Type | Attributes Added | ||
---|---|---|---|---|
wrangler | ruleset_added |
|
Sent Events:
None
Pico Events
createChild
(Domain: wrangler, Type: child_creation or new_child_request)
Creates a new child for this pico with optional arguments for the child's name, and rulesets to install on it upon creation.
Attribute | Datatype | Description |
---|---|---|
name | String | The name for the new child pico. Will generate a random name if not provided. |
rids | String String Array | The RIDs of the rulesets to be installed on the new child pico. Each RID can be an entry in an array, or in a semicolon denoted list (e.g. "io.picolabs.ruleset_one;io.picolabs.ruleset_two"). |