API reference - Liutos/cuckoo GitHub Wiki
There're several objects in cuckoo
:
- context. Stored in table
t_context
, briefly represents the current environment; - remind. Stored in table
t_remind
, the date and time specification of the notification; - repeat. Stored in table
t_repeat
, tellcuckoo
how to generate the next remind; - task. Stored in table
t_task
, describe the thing to be reminded.
Each object has its own APIs.
You can create and retrive contexts through HTTP APIs.
POST /context
Content-Type: application/json
{
"name": "context name"
}
When create successfully, responds 201.
GET /context?name=${name}&sort=${sort}
-
name
. Optional. If set, the resulting contexts' name must equal to it; -
sort
. Optional. If set, must be form<field>:<direction>
, and control the resulting contexts' order. Default iscreate_at:desc
.
GET /context/current
Responds
{
"context": "name"
}
You can create, retrive, and update reminds.
POST /remind
Content-Type: application/json
{
"duration": 0,
"restricted_hours": [],
"restrictedWdays": [],
"timestamp": 0,
"repeat_type": ""
}
-
duration
. Optional, means the display duration of a notification window. Not supported by all reminders; -
restricted_hours
. Optional. If set, must be a numeric array contains 24 elements. Controls whether the remind should be triggered at specific hours; -
restrictedWdays
. Optional. Likerestricted_hours
but controls which day should reminds be triggered; -
timestamp
. Required, the target time a remind should be triggered; -
repeat_type
. Optional. Controls how the next remind be generated.
If create successfully, responds 201 and the remind object.
GET /remind/:id
-
id
means theid
field of target remind object and its nested repeat object.
PATCH /remind/:id
Content-Type: application/json
{
"duration": 0,
"restricted_hours": [],
"restrictedWdays": [],
"timestamp": 0,
"repeat_type": ""
}
When update successfully, responds 204.
You can create, delete, retrive, and update tasks.
POST /task
Content-Type: application/json
{
"brief": "",
"context_id": 0,
"detail": "",
"device": "",
"icon": "",
"icon_file": "",
"remind_id": 0
}
-
brief
. Required, a short description of the task; -
context_id
. Optional. If set, means the task should be reminded only when the context match; -
detail
. Optional, a long description of the task; -
device
. Optional, currently the only valid value ismobilePhone
, means the notification should be push to cellphone. The only supported way for pushing is by WeChat account; -
icon
. Optional, the link of a icon to be show in notification window; -
icon_file
. Optional, the path of a icon file to be show in Alfred's Workflow result list; -
remind_id
. Optional but recommended, means the id of the remind object attached to this task.
Responds 201 and the task object when create successfully.
DELETE /task/:id
Remove the specific task.
GET /task/:id
GET /task?brief=${brief}&context_id=${context_id}&detail=${detail}&sort=${sort}&state=${state}
-
state
. Optional, returns only tasks whosestate
match.
GET /task/following?contextId=${}
-
contextId
. Optional, returns only tasks whosecontext_id
field match.
PATCH /task/:id
Content-Type: application/json
{
"brief": "",
"context_id": 0,
"detail": "",
"device": "",
"icon": "",
"icon_file": "",
"remind_id": 0
"state": ""
}