|
| 1 | +#+TITLE: Public Receiver |
| 2 | +#+AUTHOR: Orgzly Revived |
| 3 | +#+OPTIONS: html-postamble:nil num:nil H:10 |
| 4 | + |
| 5 | +/For integration with [[https://tasker.joaoapps.com/][Tasker]], [[https://llamalab.com/automate/][Automate]], etc./ |
| 6 | + |
| 7 | +* Table of Contents |
| 8 | +- [[#types][Types]] |
| 9 | + - [[#arguments-extras][Arguments (Extras)]] |
| 10 | + - [[#json-types][JSON types]] |
| 11 | +- [[#actions][Actions]] |
| 12 | + - [[#add_note][ ~ADD_NOTE~ ]] |
| 13 | + - [[#add_saved_search][ ~ADD_SAVED_SEARCH~ ]] |
| 14 | + - [[#delete_note--delete_notes][ ~DELETE_NOTE~ / ~DELETE_NOTES~ ]] |
| 15 | + - [[#delete_saved_search][ ~DELETE_SAVED_SEARCH~ ]] |
| 16 | + - [[#edit_note][ ~EDIT_NOTE~ ]] |
| 17 | + - [[#edit_saved_search][ ~EDIT_SAVED_SEARCH~ ]] |
| 18 | + - [[#get_books][ ~GET_BOOKS~ ]] |
| 19 | + - [[#get_note][ ~GET_NOTE~ ]] |
| 20 | + - [[#get_saved_searches][ ~GET_SAVED_SEARCHES~ ]] |
| 21 | + - [[#get_widgets][ ~GET_WIDGETS~ ]] |
| 22 | + - [[#move_note--move_notes][ ~MOVE_NOTE~ / ~MOVE_NOTES~ ]] |
| 23 | + - [[#move_saved_search][ ~MOVE_SAVED_SEARCH~ ]] |
| 24 | + - [[#refile_note--refile_notes][ ~REFILE_NOTE~ / ~REFILE_NOTES~ ]] |
| 25 | + - [[#search][ ~SEARCH~ ]] |
| 26 | + - [[#set_widget][ ~SET_WIDGET~ ]] |
| 27 | + |
| 28 | +* Types |
| 29 | +** Arguments (Extras) |
| 30 | +The "arguments" to an action are supplied via the ~extras~ in the intent. |
| 31 | + |
| 32 | +| Key | Type | Description | |
| 33 | +|-----------------------------------+--------------+------------------------------------------------------------------------------------------------------------------------| |
| 34 | +| ~BOOK_ID~, ~PARENT_BOOK_ID~ | long | The internal ID of a notebook | |
| 35 | +| ~BOOK_NAME~, ~PARENT_BOOK_NAME~ | string | The name of a notebook | |
| 36 | +| ~DIRECTION~ | string | The direction in which to move something | |
| 37 | +| ~NOTE_ID~, ~PARENT_NOTE_ID~ | long | The internal ID of a note | |
| 38 | +| ~NOTE_IDS~ | long array | A list of internal note IDs | |
| 39 | +| ~NOTE_PATH~, ~PARENT_NOTE_PATH~ | string | The path to a note, e.g. "My Book/Parent Note/Target Note" | |
| 40 | +| ~NOTE_PATHS~ | string array | A list of note paths | |
| 41 | +| ~NOTE_PAYLOAD~ | string | The contents of a new/edited note, in stringified JSON format; see the ~NotePayload~ type | |
| 42 | +| ~NOTE_QUERY~, ~PARENT_NOTE_QUERY~ | string | An Orgzly search query to identify a note; errors if the query yields multiple notes | |
| 43 | +| ~PLACEMENT~ | string | Where to place a note relative to another; one of ~"ABOVE"~, ~"UNDER"~, ~"UNDER_AS_FIRST"~, ~"BELOW"~, ~"UNSPECIFIED"~ | |
| 44 | +| ~SAVED_SEARCH_ID~ | long | The internal ID of a saved search | |
| 45 | +| ~SAVED_SEARCH_NAME~ | string | The name of a saved search | |
| 46 | +| ~SAVED_SEARCH_NEW_NAME~ | string | The name for a new/edited saved search | |
| 47 | +| ~SAVED_SEARCH_NEW_QUERY~ | string | The search query for a new/edited saved search | |
| 48 | +| ~QUERY~ | string | An Orgzly search query | |
| 49 | +| ~WIDGET_ID~ | int | The internal ID of a home screen widget | |
| 50 | + |
| 51 | +** JSON types |
| 52 | +These are given in the style of TypeScript types. |
| 53 | + |
| 54 | +*** Book (Notebook) |
| 55 | +#+BEGIN_SRC typescript |
| 56 | +type Book = { |
| 57 | + id: number, // Notebook ID in Orgzly's internal database |
| 58 | + title: string, // Notebook title |
| 59 | +} |
| 60 | +#+END_SRC |
| 61 | + |
| 62 | +*** Note |
| 63 | +#+BEGIN_SRC typescript |
| 64 | +type Note = { |
| 65 | + id: number, // Note ID in Orgzly's internal database |
| 66 | + title: string, // Note title |
| 67 | + content: string | null, // Note content |
| 68 | + tags: string[], // Own tags - inherited tags are not included |
| 69 | + inheritedTags: string[], // Tags inherited from parent notes |
| 70 | + bookName: string, // The containing notebook's name |
| 71 | + scheduled: Timestamp | null, // Scheduled timestamp |
| 72 | + deadline: Timestamp | null, // Deadline timestamp |
| 73 | + closed: Timestamp | null, // Closed timestamp |
| 74 | + priority: string | null, // Priority string, e.g. "A", "B", "C" |
| 75 | + state: string | null, // To-do state, e.g. "TODO", "DONE" |
| 76 | + createdAt: number | null, // UNIX timestamp of the note's creation |
| 77 | + properties: Record<string, string>, // Map of the note's PROPERTIES |
| 78 | +} |
| 79 | +#+END_SRC |
| 80 | + |
| 81 | +*** Note payload |
| 82 | +#+BEGIN_SRC typescript |
| 83 | +type NotePayload = { |
| 84 | + NOTE_PAYLOAD: { |
| 85 | + title: string, // Note title |
| 86 | + content?: string, // Note content |
| 87 | + state?: string, // To-do state e.g. "TODO", "DONE" |
| 88 | + priority?: string, // Priority string e.g. "A", "B", "C" |
| 89 | + scheduled?: string, // Scheduled timestamp (in Org format) |
| 90 | + deadline?: string, // Deadline timestamp (in Org format) |
| 91 | + closed?: string, // Closed timestamp (in Org format) |
| 92 | + tags?: string, // A space-separated list of tags |
| 93 | + properties?: Record<string, string>, // A map of properties |
| 94 | + } |
| 95 | +} |
| 96 | +#+END_SRC |
| 97 | + |
| 98 | +*** Response |
| 99 | +#+BEGIN_SRC typescript |
| 100 | +type Response<Data> = { |
| 101 | + success: true, // Success case |
| 102 | + result: Data | null, // Response data; see response types for specific actions |
| 103 | +} | { |
| 104 | + success: false, // Failure case |
| 105 | + result: string, // An error message |
| 106 | +} |
| 107 | +#+END_SRC |
| 108 | + |
| 109 | +*** Saved search |
| 110 | +#+BEGIN_SRC typescript |
| 111 | +type SavedSearch = { |
| 112 | + id: number, // Saved search ID in Orgzly's internal database |
| 113 | + name: string, // Saved search name |
| 114 | + position: number, // Position in the list of saved searches |
| 115 | + query: string, // The search's query |
| 116 | +} |
| 117 | +#+END_SRC |
| 118 | + |
| 119 | +*** Timestamp |
| 120 | +#+BEGIN_SRC typescript |
| 121 | +type Timestamp = { |
| 122 | + rangeString: string, // Full timestamp string |
| 123 | + timeTimestamp: number, // UNIX timestamp of the start of the time range |
| 124 | + timeString: string | null, // String of the stamp's start time |
| 125 | + timeEndString: string | null, // String of the stamp's end time |
| 126 | +} |
| 127 | +#+END_SRC |
| 128 | + |
| 129 | +* Actions |
| 130 | +In practice, all actions should be prefixed with ~"com.orgzly.android."~ , e.g. ~"com.orgzly.android.ADD_NOTE"~ |
| 131 | + |
| 132 | +** ~ADD_NOTE~ |
| 133 | +Adds a new note. |
| 134 | + |
| 135 | +*Arguments:* |
| 136 | +- One of: |
| 137 | + - ~PARENT_BOOK_ID~ |
| 138 | + - ~PARENT_BOOK_NAME~ |
| 139 | + - ~PARENT_NOTE_ID~ and ~PLACEMENT~ |
| 140 | + - ~PARENT_NOTE_PATH~ and ~PLACEMENT~ |
| 141 | + - ~PARENT_NOTE_QUERY~ and ~PLACEMENT~ |
| 142 | +- ~NOTE_PAYLOAD~ |
| 143 | + |
| 144 | +*Returns:* |
| 145 | +The internal ID of the newly-created note. |
| 146 | +#+BEGIN_SRC typescript |
| 147 | +type AddNoteResponse = Response<number> |
| 148 | +#+END_SRC |
| 149 | + |
| 150 | +** ~ADD_SAVED_SEARCH~ |
| 151 | +Adds a new saved search. |
| 152 | + |
| 153 | +*Arguments:* |
| 154 | +- ~SAVED_SEARCH_NEW_NAME~ |
| 155 | +- ~SAVED_SEARCH_NEW_QUERY~ |
| 156 | + |
| 157 | +*Returns:* |
| 158 | +The internal ID of the newly-created saved search. |
| 159 | +#+BEGIN_SRC typescript |
| 160 | +type AddSavedSearchResponse = Response<number> |
| 161 | +#+END_SRC |
| 162 | + |
| 163 | +** ~DELETE_NOTE~ / ~DELETE_NOTES~ |
| 164 | +Deletes one or more notes. |
| 165 | + |
| 166 | +*Arguments:* |
| 167 | +- One of: |
| 168 | + - ~NOTE_ID~ |
| 169 | + - ~NOTE_IDS~ |
| 170 | + - ~NOTE_PATH~ |
| 171 | + - ~NOTE_PATHS~ |
| 172 | + |
| 173 | +*Returns:* |
| 174 | +Nothing. |
| 175 | +#+BEGIN_SRC typescript |
| 176 | +type DeleteNoteResponse = Response<null> |
| 177 | +#+END_SRC |
| 178 | + |
| 179 | +** ~DELETE_SAVED_SEARCH~ |
| 180 | +Deletes a saved search. |
| 181 | + |
| 182 | +*Arguments:* |
| 183 | +- One of: |
| 184 | + - ~SAVED_SEARCH_ID~ |
| 185 | + - ~SAVED_SEARCH_NAME~ |
| 186 | + |
| 187 | +*Returns:* |
| 188 | +Nothing. |
| 189 | +#+BEGIN_SRC typescript |
| 190 | +type DeleteSavedSearchResponse = Response<null> |
| 191 | +#+END_SRC |
| 192 | + |
| 193 | +** ~EDIT_NOTE~ |
| 194 | +Edits a note. |
| 195 | + |
| 196 | +*Arguments:* |
| 197 | +- One of: |
| 198 | + - ~NOTE_ID~ |
| 199 | + - ~NOTE_PATH~ |
| 200 | + - ~NOTE_QUERY~ |
| 201 | +- ~NOTE_PAYLOAD~ |
| 202 | + |
| 203 | +*Returns:* |
| 204 | +Nothing. |
| 205 | +#+BEGIN_SRC typescript |
| 206 | +type EditNoteResponse = Response<null> |
| 207 | +#+END_SRC |
| 208 | + |
| 209 | +** ~EDIT_SAVED_SEARCH~ |
| 210 | +Edits a saved search. |
| 211 | + |
| 212 | +*Arguments:* |
| 213 | +- One of: |
| 214 | + - ~SAVED_SEARCH_ID~ |
| 215 | + - ~SAVED_SEARCH_NAME~ |
| 216 | +- ~SAVED_SEARCH_NEW_NAME~; optional - left unchanged if absent |
| 217 | +- ~SAVED_SEARCH_NEW_QUERY~; optional - left unchanged if absent |
| 218 | + |
| 219 | +*Returns:* |
| 220 | +Nothing. |
| 221 | +#+BEGIN_SRC typescript |
| 222 | +type EditSavedSearchResponse = Response<null> |
| 223 | +#+END_SRC |
| 224 | + |
| 225 | +** ~GET_BOOKS~ |
| 226 | +Retrieves a list of all notebooks. |
| 227 | + |
| 228 | +*Arguments:* |
| 229 | +None. |
| 230 | + |
| 231 | +*Returns:* |
| 232 | +A list of all notebooks. |
| 233 | +#+BEGIN_SRC typescript |
| 234 | +type GetBooksResponse = Response<Book[]> |
| 235 | +#+END_SRC |
| 236 | + |
| 237 | +** ~GET_NOTE~ |
| 238 | +Retrieves a note. |
| 239 | + |
| 240 | +*Arguments:* |
| 241 | +- One of: |
| 242 | + - ~NOTE_ID~ |
| 243 | + - ~NOTE_PATH~ |
| 244 | + - ~NOTE_QUERY~ |
| 245 | + |
| 246 | +*Returns:* |
| 247 | +The specified note. |
| 248 | +#+BEGIN_SRC typescript |
| 249 | +type GetNoteResponse = Response<Note> |
| 250 | +#+END_SRC |
| 251 | + |
| 252 | +** ~GET_SAVED_SEARCHES~ |
| 253 | +Retrieves a list of all saved searches. |
| 254 | + |
| 255 | +*Arguments:* |
| 256 | +None. |
| 257 | + |
| 258 | +*Returns:* |
| 259 | +A list of all saved searches. |
| 260 | +#+BEGIN_SRC typescript |
| 261 | +type GetSavedSearchesResponse = Response<SavedSearch[]> |
| 262 | +#+END_SRC |
| 263 | + |
| 264 | +** ~GET_WIDGETS~ |
| 265 | +Retrieves a list of all home screen widgets. |
| 266 | + |
| 267 | +*Arguments:* |
| 268 | +None. |
| 269 | + |
| 270 | +*Returns:* |
| 271 | +A map of internal widget IDs to the saved search they're set to |
| 272 | +#+BEGIN_SRC typescript |
| 273 | +type GetWidgetsResponse = Response<Record<int, SavedSearch>> |
| 274 | +#+END_SRC |
| 275 | + |
| 276 | +** ~MOVE_NOTE~ / ~MOVE_NOTES~ |
| 277 | +Moves one or more notes in the specified direction. |
| 278 | + |
| 279 | +*Arguments:* |
| 280 | +- One of: |
| 281 | + - ~NOTE_ID~ |
| 282 | + - ~NOTE_IDS~ |
| 283 | + - ~NOTE_PATH~ |
| 284 | + - ~NOTE_PATHS~ |
| 285 | +- ~DIRECTION~; one of ~"UP"~, ~"DOWN"~, ~"LEFT"~ or ~"RIGHT"~ |
| 286 | + |
| 287 | +*Returns:* |
| 288 | +Nothing. |
| 289 | +#+BEGIN_SRC typescript |
| 290 | +type MoveNoteResponse = Response<null> |
| 291 | +#+END_SRC |
| 292 | + |
| 293 | +** ~MOVE_SAVED_SEARCH~ |
| 294 | +Moves a saved search up or down in the list of saved searches. |
| 295 | + |
| 296 | +*Arguments:* |
| 297 | +- One of: |
| 298 | + - ~SAVED_SEARCH_ID~ |
| 299 | + - ~SAVED_SEARCH_NAME~ |
| 300 | +- ~DIRECTION~; either ~"UP"~ or ~"DOWN"~ |
| 301 | + |
| 302 | +*Returns:* |
| 303 | +Nothing. |
| 304 | +#+BEGIN_SRC typescript |
| 305 | +type MoveSavedSearchResponse = Response<null> |
| 306 | +#+END_SRC |
| 307 | + |
| 308 | +** ~REFILE_NOTE~ / ~REFILE_NOTES~ |
| 309 | +Refiles one or more notes to a specified location. |
| 310 | + |
| 311 | +*Arguments:* |
| 312 | +- One of: |
| 313 | + - ~NOTE_ID~ |
| 314 | + - ~NOTE_IDS~ |
| 315 | + - ~NOTE_PATH~ |
| 316 | + - ~NOTE_PATHS~ |
| 317 | +- One of: |
| 318 | + - ~PARENT_BOOK_ID~ |
| 319 | + - ~PARENT_BOOK_NAME~ |
| 320 | + - ~PARENT_NOTE_ID~ and ~PLACEMENT~ |
| 321 | + - ~PARENT_NOTE_PATH~ and ~PLACEMENT~ |
| 322 | + - ~PARENT_NOTE_QUERY~ and ~PLACEMENT~ |
| 323 | + |
| 324 | +*Returns:* |
| 325 | +Nothing. |
| 326 | +#+BEGIN_SRC typescript |
| 327 | +type RefileNoteResponse = Response<null> |
| 328 | +#+END_SRC |
| 329 | + |
| 330 | +** ~SEARCH~ |
| 331 | +Runs a search query, retrieving the results. |
| 332 | + |
| 333 | +*Arguments:* |
| 334 | +- ~QUERY~ |
| 335 | + |
| 336 | +*Returns:* |
| 337 | +A list of notes matching the query. |
| 338 | +#+BEGIN_SRC typescript |
| 339 | +type SearchResponse = Response<Note[]> |
| 340 | +#+END_SRC |
| 341 | + |
| 342 | +** ~SET_WIDGET~ |
| 343 | +Sets the saved search displayed by a home screen widget. |
| 344 | + |
| 345 | +*Arguments:* |
| 346 | +- ~WIDGET_ID~ |
| 347 | +- One of: |
| 348 | + - ~SAVED_SEARCH_ID~ |
| 349 | + - ~SAVED_SEARCH_NAME~ |
| 350 | + |
| 351 | +*Returns:* |
| 352 | +Nothing. |
| 353 | +#+BEGIN_SRC typescript |
| 354 | +type SetWidgetResponse = Response<null> |
| 355 | +#+END_SRC |
0 commit comments