Skip to content

Latest commit

 

History

History
355 lines (298 loc) · 10.7 KB

public-receiver.org

File metadata and controls

355 lines (298 loc) · 10.7 KB

Public Receiver

For integration with Tasker, Automate, etc.

Table of Contents

Types

Arguments (Extras)

The “arguments” to an action are supplied via the extras in the intent.

KeyTypeDescription
BOOK_ID, PARENT_BOOK_IDlongThe internal ID of a notebook
BOOK_NAME, PARENT_BOOK_NAMEstringThe name of a notebook
DIRECTIONstringThe direction in which to move something
NOTE_ID, PARENT_NOTE_IDlongThe internal ID of a note
NOTE_IDSlong arrayA list of internal note IDs
NOTE_PATH, PARENT_NOTE_PATHstringThe path to a note, e.g. “My Book/Parent Note/Target Note”
NOTE_PATHSstring arrayA list of note paths
NOTE_PAYLOADstringThe contents of a new/edited note, in stringified JSON format; see the NotePayload type
NOTE_QUERY, PARENT_NOTE_QUERYstringAn Orgzly search query to identify a note; errors if the query yields multiple notes
PLACEMENTstringWhere to place a note relative to another; one of ​"ABOVE"​, ​"UNDER"​, ​"UNDER_AS_FIRST"​, ​"BELOW"​, ​"UNSPECIFIED"​
SAVED_SEARCH_IDlongThe internal ID of a saved search
SAVED_SEARCH_NAMEstringThe name of a saved search
SAVED_SEARCH_NEW_NAMEstringThe name for a new/edited saved search
SAVED_SEARCH_NEW_QUERYstringThe search query for a new/edited saved search
QUERYstringAn Orgzly search query
WIDGET_IDintThe internal ID of a home screen widget

JSON types

These are given in the style of TypeScript types.

Book (Notebook)

type Book = {
  id: number,  // Notebook ID in Orgzly's internal database
  title: string,  // Notebook title
}

Note

type Note = {
  id: number,  // Note ID in Orgzly's internal database
  title: string,  // Note title
  content: string | null,  // Note content
  tags: string[],  // Own tags - inherited tags are not included
  inheritedTags: string[],  // Tags inherited from parent notes
  bookName: string,  // The containing notebook's name
  scheduled: Timestamp | null,  // Scheduled timestamp
  deadline: Timestamp | null,  // Deadline timestamp
  closed: Timestamp | null,  // Closed timestamp
  priority: string | null,  // Priority string, e.g. "A", "B", "C"
  state: string | null,  // To-do state, e.g. "TODO", "DONE"
  createdAt: number | null,  // UNIX timestamp of the note's creation
  properties: Record<string, string>,  // Map of the note's PROPERTIES
}

Note payload

type NotePayload = {
  NOTE_PAYLOAD: {
    title: string,  // Note title
    content?: string,  // Note content
    state?: string,  // To-do state e.g. "TODO", "DONE"
    priority?: string,  // Priority string e.g. "A", "B", "C"
    scheduled?: string,  // Scheduled timestamp (in Org format)
    deadline?: string,  // Deadline timestamp (in Org format)
    closed?: string,  // Closed timestamp (in Org format)
    tags?: string,  // A space-separated list of tags
    properties?: Record<string, string>,  // A map of properties
  }
}

Response

type Response<Data> = {
  success: true,  // Success case
  result: Data | null,  // Response data; see response types for specific actions
} | {
  success: false,  // Failure case
  result: string,  // An error message
}

Saved search

type SavedSearch = {
  id: number,  // Saved search ID in Orgzly's internal database
  name: string,  // Saved search name
  position: number,  // Position in the list of saved searches
  query: string,  // The search's query
}

Timestamp

type Timestamp = {
  rangeString: string,  // Full timestamp string
  timeTimestamp: number,  // UNIX timestamp of the start of the time range
  timeString: string | null,  // String of the stamp's start time
  timeEndString: string | null, // String of the stamp's end time
}

Actions

In practice, all actions should be prefixed with ​"com.orgzly.android."​ , e.g. ​"com.orgzly.android.ADD_NOTE"​

ADD_NOTE

Adds a new note.

Arguments:

  • One of:
    • PARENT_BOOK_ID
    • PARENT_BOOK_NAME
    • PARENT_NOTE_ID and PLACEMENT
    • PARENT_NOTE_PATH and PLACEMENT
    • PARENT_NOTE_QUERY and PLACEMENT
  • NOTE_PAYLOAD

Returns: The internal ID of the newly-created note.

type AddNoteResponse = Response<number>

ADD_SAVED_SEARCH

Adds a new saved search.

Arguments:

  • SAVED_SEARCH_NEW_NAME
  • SAVED_SEARCH_NEW_QUERY

Returns: The internal ID of the newly-created saved search.

type AddSavedSearchResponse = Response<number>

DELETE_NOTE / DELETE_NOTES

Deletes one or more notes.

Arguments:

  • One of:
    • NOTE_ID
    • NOTE_IDS
    • NOTE_PATH
    • NOTE_PATHS

Returns: Nothing.

type DeleteNoteResponse = Response<null>

DELETE_SAVED_SEARCH

Deletes a saved search.

Arguments:

  • One of:
    • SAVED_SEARCH_ID
    • SAVED_SEARCH_NAME

Returns: Nothing.

type DeleteSavedSearchResponse = Response<null>

EDIT_NOTE

Edits a note.

Arguments:

  • One of:
    • NOTE_ID
    • NOTE_PATH
    • NOTE_QUERY
  • NOTE_PAYLOAD

Returns: Nothing.

type EditNoteResponse = Response<null>

EDIT_SAVED_SEARCH

Edits a saved search.

Arguments:

  • One of:
    • SAVED_SEARCH_ID
    • SAVED_SEARCH_NAME
  • SAVED_SEARCH_NEW_NAME; optional - left unchanged if absent
  • SAVED_SEARCH_NEW_QUERY; optional - left unchanged if absent

Returns: Nothing.

type EditSavedSearchResponse = Response<null>

GET_BOOKS

Retrieves a list of all notebooks.

Arguments: None.

Returns: A list of all notebooks.

type GetBooksResponse = Response<Book[]>

GET_NOTE

Retrieves a note.

Arguments:

  • One of:
    • NOTE_ID
    • NOTE_PATH
    • NOTE_QUERY

Returns: The specified note.

type GetNoteResponse = Response<Note>

GET_SAVED_SEARCHES

Retrieves a list of all saved searches.

Arguments: None.

Returns: A list of all saved searches.

type GetSavedSearchesResponse = Response<SavedSearch[]>

GET_WIDGETS

Retrieves a list of all home screen widgets.

Arguments: None.

Returns: A map of internal widget IDs to the saved search they’re set to

type GetWidgetsResponse = Response<Record<int, SavedSearch>>

MOVE_NOTE / MOVE_NOTES

Moves one or more notes in the specified direction.

Arguments:

  • One of:
    • NOTE_ID
    • NOTE_IDS
    • NOTE_PATH
    • NOTE_PATHS
  • DIRECTION; one of ​"UP"​, ​"DOWN"​, ​"LEFT"​ or ​"RIGHT"​

Returns: Nothing.

type MoveNoteResponse = Response<null>

MOVE_SAVED_SEARCH

Moves a saved search up or down in the list of saved searches.

Arguments:

  • One of:
    • SAVED_SEARCH_ID
    • SAVED_SEARCH_NAME
  • DIRECTION; either ​"UP"​ or ​"DOWN"​

Returns: Nothing.

type MoveSavedSearchResponse = Response<null>

REFILE_NOTE / REFILE_NOTES

Refiles one or more notes to a specified location.

Arguments:

  • One of:
    • NOTE_ID
    • NOTE_IDS
    • NOTE_PATH
    • NOTE_PATHS
  • One of:
    • PARENT_BOOK_ID
    • PARENT_BOOK_NAME
    • PARENT_NOTE_ID and PLACEMENT
    • PARENT_NOTE_PATH and PLACEMENT
    • PARENT_NOTE_QUERY and PLACEMENT

Returns: Nothing.

type RefileNoteResponse = Response<null>

SEARCH

Runs a search query, retrieving the results.

Arguments:

  • QUERY

Returns: A list of notes matching the query.

type SearchResponse = Response<Note[]>

SET_WIDGET

Sets the saved search displayed by a home screen widget.

Arguments:

  • WIDGET_ID
  • One of:
    • SAVED_SEARCH_ID
    • SAVED_SEARCH_NAME

Returns: Nothing.

type SetWidgetResponse = Response<null>