Skip to content

Commit

Permalink
reaction doc example
Browse files Browse the repository at this point in the history
  • Loading branch information
milt committed Jan 23, 2024
1 parent f7c2a46 commit b878692
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions doc/reactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,64 @@ Booleans compose multiple rules together. Booleans are objects with a single key

`template` describes the xAPI statement the reaction will produce. It is identical to an xAPI statement, except that object properties may be substituted with `$templatePath`. This is a path that points to a value in a statement matched by `conditions`, using the same syntax as an `identityPaths` path. In the above example, the `$templatePath` points to the actor `mbox` for the actor matched by condition `a`.

## Example

Given the reaction specified above, if the following statements are posted to the LRS:

``` json
[
{
"actor": {
"mbox": "mailto:[email protected]"
},
"verb": {
"id": "https://example.com/verbs/completed"
},
"object": {
"id": "https://example.com/activities/a",
"objectType": "Activity"
},
"result": {
"success": true
},
"timestamp": "2024-01-23T01:00:00.000Z"
},
{
"actor": {
"mbox": "mailto:[email protected]"
},
"verb": {
"id": "https://example.com/verbs/completed"
},
"object": {
"id": "https://example.com/activities/b",
"objectType": "Activity"
},
"result": {
"success": true
},
"timestamp": "2024-01-23T02:00:00.000Z"
}
]

```

Then the following statement will be added subsequently (note that some unrelated fields are removed for clarity):

``` json
{
"actor": {
"mbox": "mailto:[email protected]"
},
"verb": {
"id": "https://example.com/verbs/completed"
},
"object": {
"id": "https://example.com/activities/a-and-b",
"objectType": "Activity"
}
}

```

[<- Back to Index](index.md)

0 comments on commit b878692

Please sign in to comment.