Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ellis committed Jul 12, 2023
1 parent e101798 commit 54bb2d0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
30 changes: 15 additions & 15 deletions org-notion.el
Original file line number Diff line number Diff line change
Expand Up @@ -902,11 +902,11 @@ are lists of values."
:documentation "The symbol used to maintain a hashtable
of org-notion instances. The instance hashtable
is treated as a variable, with new instanaces
added to it.")
added to it."))
:documentation "Mixin used to cache object instances based on
`eieio-instance-tracker'. Inheritors must override
`cache' which is a variable used to cache instances."
:abstract t))
:abstract t)

(cl-defmethod cache-instance ((this org-notion-cache) &rest _slots)
"Make sure OBJ is in our cache. Optional argument SLOTS are the
Expand Down Expand Up @@ -1156,13 +1156,13 @@ a bot. Identified by the `:id' slot.")
(created_time
:initarg :created_time
:documentation "Datetime when this block was created.")
(last_edited_by
(updated_by
:initform nil
:initarg :last_edited_by
:initarg :updated_by
:type (or org-notion-user null)
:documentation "Last user to edit this block.")
(last_edited_time
:initarg :last_edited_time
(updated_time
:initarg :updated_time
:documentation "Datetime when this block was last edited.")
(icon
:initform nil
Expand Down Expand Up @@ -1211,8 +1211,8 @@ a bot. Identified by the `:id' slot.")
(alist-get 'title json))))) ; this is a vector
:created_by (alist-get 'created_by json)
:created_time (alist-get 'created_time json)
:last_edited_by (alist-get 'last_edited_by json)
:last_edited_time (alist-get 'last_edited_time json)
:updated_by (alist-get 'last_edited_by json)
:updated_time (alist-get 'last_edited_time json)
:icon (alist-get 'icon json)
:cover (alist-get 'cover json)
:properties (alist-get 'properties json)
Expand All @@ -1233,16 +1233,16 @@ a bot. Identified by the `:id' slot.")

(cl-defmethod org-notion-to-org ((obj org-notion-database) &optional type)
"Convert database to org-element TYPE."
(with-slots (id title created updated icon cover properties parent url) obj
(with-slots (id title created_by created_time updated_by updated_time icon cover properties parent url) obj
;; TODO 2023-01-07: we can do better here
(let ((props
(when (or id icon cover created updated url)
(when (or id icon cover created_time updated_time url)
(org-notion--property-drawer
`((id . ,id)
(icon . ,icon)
(cover . ,cover)
(created . ,created)
(updated . ,updated)
(created . ,created_time)
(updated . ,updated_time)
(url . ,url))))))
(pcase type
((or 'nil 'heading)
Expand All @@ -1259,7 +1259,7 @@ a bot. Identified by the `:id' slot.")

(cl-defmethod org-notion-from-org ((obj org-notion-database) &optional str)
"Parse STR org element into an `org-notion-database' OBJ."
(with-slots (id title created updated icon cover properties parent url) obj
(with-slots (id title created_by created_time updated_by updated_time icon cover properties parent url) obj
(with-temp-buffer
(insert str)
(let* ((elt (caddr (org-element-parse-buffer)))
Expand Down Expand Up @@ -1655,13 +1655,13 @@ enabled."
)))))))

;;;###autoload
(defun org-notion-get-user (id)
(defun org-notion-get-user (&optional id)
"Get user with given ID from workspace."
(interactive)
(org-notion-dispatch
(org-notion-request
:method 'user
:data id
:data (or id (oref org-notion-current-user :id))
:callback (org-notion-with-callback
(when (equal (cdar json-data) "user")
(org-notion-from-json (org-notion-user) json-data))))))
Expand Down
21 changes: 16 additions & 5 deletions README.org → readme.org
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#+TITLE: org-notion
#+DATE: 2023-01-15
#+DATE: 2023-07-12
#+DESCRIPTION: Notion.so Org-mode Extension
#+AUTHOR: ellis
#+EMAIL: [email protected]

* Overview
[[https://orgmode.org/][Org-mode]] is the [[https://www.gnu.org/software/emacs/][GNU Emacs]] major-mode for keeping notes, maintaining
TODO lists, and project planning. It is a very powerful text-based
system for organizing your life in plaintext.
Expand All @@ -15,7 +15,14 @@ realtime collaboration, and as of 2021 an [[https://developers.notion.com/][offi
=org-notion= is an Emacs package that uses this API to integrate the
beauty of Notion with your Org-mode workflow.

* Overview
** Status
+ state :: ON HOLD
This package is not yet complete. I plan to continue development in
the next few months but am open to contribs and chatting about
design/features in the meantime. Check the [[*Dev Log][Dev Log]] for updates.
* TODO Introduction

* Design
This package wraps the full Notion API with support for all web
requests and object types. The requests are dispatched via the methods
specializing on the =org-notion-request= EIEIO class instance. The
Expand Down Expand Up @@ -83,7 +90,7 @@ recommended as it avoids the prompt and is more secure. You can
disable the check if you wish to temporarily use a different token
with =(setq org-notion-check-auth-source nil)=.

* Usage
* TODO Usage
The autoloaded functions in this package provide the high-level
interface. Most notable of these is =org-notion-mode=, which is a
minor-mode you can add as a hook to =org-mode=.
Expand Down Expand Up @@ -117,7 +124,11 @@ defauls are show below.
- Prior Art
- [[https://github.com/ahungry/org-jira][ahungry/org-jira]]
- [[https://github.com/RadekMolenda/org-notion][RadekMolenda/org-notion]]

* Dev Log
** [2023-07-12 Wed] project state
I haven't done much with this project (sorry!) in the past several
months. It's been a busy start to the year with a series of
developments that have taken priority.
* COMMENT notes
** v2 roadmap
*** user capabilities
Expand Down

0 comments on commit 54bb2d0

Please sign in to comment.