-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-todoist-task.yaml
87 lines (87 loc) · 1.99 KB
/
create-todoist-task.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
settings:
name: create-todoist-task
title: '#_name#'
path: Todoist
desc: '#_desc#'
loglevel: 6
help: "@create-todoist-task"
helplang: ru
params:
- name: content
title: '#_content#'
type: 2
options:
required: true
- name: due
title: '#_duedate#'
type: 2
options:
required: true
- name: desc
title: '#.desc#'
type: 2
options:
optional: true
- name: priority
title: priority
type: 4
options:
optional: true
- name: project
title: project
type: 4
options:
optional: true
- name: section
title: section
type: 4
options:
optional: true
tree:
- name: source-code
values:
code: "str more\nstr due = GetVar(\"due\") \nif Match(due, `^\\d\\d\\d\\d-\\d\\d-\\d\\d$`)
: more = `\"due_date\":\"%{due}\"`\nelse : more = `\"due_string\":\"%{due}\"`\nstr
tmp = GetVar(\"desc\")\nif *tmp? : more += `, \"description\": \"%{tmp}\"`\ntmp
= GetVar(\"project\")\nif *tmp? : more += `, \"project_id\": %{int(tmp)}`\ntmp
= GetVar(\"section\")\nif *tmp? : more += `, \"section_id\": %{int(tmp)}`\ntmp
= GetVar(\"priority\")\nif *tmp? : more += `, \"priority\": %{int(tmp)}`\nSetVar(\"more\",
more)"
- name: send-json-request
values:
_optional: 'response: resp'
headers:
- name: Authorization
value: 'Bearer #todoist.token#'
jsondata: |-
{
"content": "#content#",
#more#
}
url: '#todoist.api#/tasks'
varname: ret
- name: source-code
open: true
values:
code: |-
int status = int(Macro("#resp.statuscode#"))
if status < 200 || status > 299 {
%body%
}
children:
- name: error.eonza
values:
_ifcond: ""
code: "1"
text: '#resp#'
langs:
en:
_content: Content
_desc: Create Todoist task
_duedate: Due Date
_name: Create Todoist Task
ru:
_content: Содержание
_desc: Создать Todoist задачу
_duedate: Срок выполнения
_name: Создать Todoist задачу