...
For all functions, enter the parameters in the order listed.
Italicized parameters are optional.
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.
Parameters
Parameter | Datatype | Description |
---|---|---|
name | String | Name of the pico to search for |
Returns
An array containing a map for each returned pico. Each map contains:
parent_eci: The ECI from the
...
pico to the respective child. Should be used for parent-child interaction.
name: The child pico's name
id: The id of the child pico
eci: The main wrangler ECI for the child pico
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" } ] */ |
...
Returns a map giving basic meta information about the pico. This information includes the pico's ID, ECI, and name.
Returns
A map giving basic information about a pico with the following contents:
id: The ID of the pico
eci: The main wrangler ECI of the pico
name: The name of the pico
Code Block | ||||
---|---|---|---|---|
| ||||
myself_result = wrangler:myself() /* { "id": "cjhtji2op009hpkrq35bcpodh", "eci": "4bUS9W4HY5S1YfsAM9Ygw5", "name": "Front Porch" } */ |
...
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.
Parameters
Parameter | Datatype | Description |
---|---|---|
eci | String | The ECI to send the event query to |
mod | String | The ruleset to send the event query to |
func | String | The name of the function to query |
params | ObjectMap | 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). |
Returns
The result of the function queried for.
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 } |
...
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 requiredRaised Events are events that the rule will directly raise.
Sent Events are events that the rule will send elsewhere.
Italicized attributes are optional.
Ruleset Events
installRulesets
...
Domain:
...
wrangler
...
Type:
...
install_rulesets_requested
...
Installs the given rulesets in the pico that receives this event.eventAttrs:
Attributes
Attribute | Datatype | Required | Additional Description |
---|---|---|---|
<rids>rids<array> | OR <string> Array YESString | The array is an array of strings, where each string represents the name of the ruleset (the RID) RIDs of the rulesets to be installed . You may alternatively provide a single string that is separated by semicolons. Multiple rulesets are not requiredon this 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"). |
Directives Returned
...
Code Block |
---|
send_directive("rulesets installed", { "rids": /* An array of rids that were installed*/ }); |
Raised Events
...
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"). |