Skip to content

Commit

Permalink
docs: add io.cozy.triggers docummentation 📚
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorylegarec committed Apr 5, 2018
1 parent 7fb9b8d commit 883c5ae
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Table of contents
- [Photos Albums](io.cozy.photos.albums.md): photos albums
- [Remote requests](io.cozy.remote.requests.md): logs of requests via the remote doctypes
- [Sessions Logins](io.cozy.sessions.logins.md): sessions logins entry
- [Triggers](io.cozy.triggers.md): Job triggers

## Metadata

Expand Down
37 changes: 37 additions & 0 deletions docs/io.cozy.triggers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[Table of contents](README.md#table-of-contents)

# Triggers doctype

`io.cozy.triggers` documents are used by the stack to configure [how and when a job should be runned](https://github.com/cozy/cozy-stack/blob/master/docs/jobs.md).

This is a special doctype which can only be created from an app. We are using it in [Cozy-Collect](http://github.com/cozy/cozy-collect/) to manage konnectors scheduling.

## Attributes

| Attribute | Role |
|-----------|------|
|`arguments`| Arguments related to the `type` attribute. For example it's a cron configuration when the `type` is set to `@cron`. |
|`debounce`| Amount of time until the job cannot be run again. This attribute is used to limite the amount of jobs in a burst. |
|`message`| Parameters to pass to the the worker. For example, when the `worker` is set to `konnector`, `message` contains the related konnector and the related account. |
|`options`| Parameters related to the job.|
|`type`| Type of trigger. Can be `@at`, `@cron`, `@event`, `@every`, and `@in`. See the [stack documentation](https://github.com/cozy/cozy-stack/blob/master/docs/jobs.md) for more informations.
|`worker`| Type of worker. Can be `konnector` or `sendmail`.|


## Example

Trigger configured to run the konnector [Debug](http://github.com/cozy/cozy-konnector-debug/) with the [`io.cozy.accounts`](io.cozy.accounts.md) document having the id `53fe4d0e4f6d3be99ba7a5d2580081a8`.

```json
{
"type": "@cron",
"worker": "konnector",
"arguments": "0 45 4 * * 3",
"debounce": "",
"options": null,
"message": {
"konnector": "debug",
"account": "53fe4d0e4f6d3be99ba7a5d2580081a8"
}
}
```

0 comments on commit 883c5ae

Please sign in to comment.