-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorg-sync.el
More file actions
47 lines (32 loc) · 1.31 KB
/
org-sync.el
File metadata and controls
47 lines (32 loc) · 1.31 KB
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
(load-file "./org-api.el")
(load-file "./todoist.el")
;;Search TODO items
;; (defvar todos (org-ql-select "~/Projects/org-files/journal/2022.org"
;; '(and
;; (todo)
;; (ancestors (heading "Task")) )))
(defvar tasks (org-ql-select "./tests/test.org"
'(and (ancestors (heading "TO DO List")))))
(print (tasks-waiting-sync tasks))
(print (parse-headlines tasks))
(plist-get (car (cdr (org-element-property :deadline (car todos)))) :raw-value)
(plist-get (car (cdr (org-element-property :deadline (car todos)))) :repeater-type)
(car (cdr (org-element-property :deadline (car todos))))
(print (push-tasks tasks))
(request-response-data (todoist-query "POST" "/sync" `(("sync_token" . "*") ("resource_types" . "[\"items\"]") ("commands" . ,(json-encode (tasks-waiting-sync tasks))))))
(defun complete-tasks (tasks)
;; Given a list complete the tasksa
(mapcar
(lambda (task)
(if (equal (get-headline-prop task :todo-type) 'todo)
(update-headline-todo task "DONE")
(message "fail")))
tasks))
(complete-tasks todos)
(defun recurring-types (tasks)
;; Given a list complete the tasks
(mapcar
(lambda (task)
(print (parse-org-timestamp (cdr (org-element-property :deadline task)))))
tasks))
(recurring-types tasks)