-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport-todoist.yaml
149 lines (149 loc) · 3.13 KB
/
export-todoist.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
settings:
name: export-todoist
title: '#_name#'
path: Todoist
desc: '#_desc#'
loglevel: 6
help: "@export-todoist"
helplang: ru
params:
- name: path
title: '#.path#'
type: 2
- name: zipname
title: '#_zipname#'
type: 2
options:
initial: todoist
default: todoist
required: true
tree:
- name: set-variables
values:
list:
- value: '#.temppath#/todoist'
var: temp
- value: ""
var: comments
- name: set-log-level
disable: true
values:
level: LOG_WARN
- name: create-dir
values:
path: '#temp#'
- name: foreach-line
open: true
values:
text: |-
projects
sections
tasks
labels
varname: item
children:
- name: httprequest
values:
headers:
- name: Authorization
value: 'Bearer #todoist.token#'
method: GET
pars: []
url: '#todoist.api#/#item#'
varname: ret
- name: write-file
values:
filename: '#temp#/#item#.json'
name: ret
- name: source-code
open: true
values:
_desc: Export comments
_ifcond: GetVar("item") == "projects" || GetVar("item") == "tasks"
code: '%body%'
children:
- name: parse-json
values:
resultvar: list
value: '#ret#'
- name: foreach
open: true
values:
varitem: data
varname: list
children:
- name: if.eonza
open: true
values:
_ifcond: int(Macro("#data.comment_count#")) > 0
elsevar: ""
list: []
children:
- name: httprequest
values:
headers:
- name: Authorization
value: 'Bearer #todoist.token#'
method: GET
pars: []
url: '#todoist.api#/comments?task_id=#data.id#'
varname: comment
- name: set-variable
values:
list:
- func: append
param: '#comment#,'
name: comments
subst: "1"
value: ""
- name: if.eonza
open: true
values:
list:
- cmp: equal
next: "0"
not: true
value: ""
var: comments
children:
- name: source-code
values:
code: |
SetVar("comments", TrimRight(GetVar("comments"), ","))
- name: write-file
values:
append: false
filename: '#temp#/comments.json'
name: ""
text: |-
[
#comments#
]
- name: source-code
values:
code: |-
str path = GetVar("path")
str zipname = GetVar("zipname")
if *zipname == 0 : zipname = "todoist"
if Ext(zipname) != "zip" : zipname += ".zip"
if *path? : zipname = JoinPath(path, zipname)
SetVar("resfile", zipname)
- name: create-archive
values:
path: '#temp#'
pattern: '*.json'
recursive: false
zname: '#resfile#'
ztype: zip
- name: delete-dir
values:
path: '#temp#'
langs:
en:
_desc: Export Todoist projects and tasks to zip
_name: Export Todoist
_zipname: Archive name (.zip)
ru:
_desc: Экспорт Todoist проектов и задач в zip
_name: Экспорт Todoist
_zipname: Имя архива (.zip)