Drafts Module Reference
New in version 0.0.8.
Control Drafts using JXA-like syntax.
Classes:
|
A class for managing and interacting with Drafts.app. |
|
A draft in Drafts.app. |
|
A wrapper around a list of drafts. |
- class PyXA.apps.Drafts.XADraftsApplication(properties)[source]
Bases:
XASBApplication
,XACanOpenPath
A class for managing and interacting with Drafts.app.
New in version 0.0.8.
Classes:
ObjectType
(value)Object types that can be created using
XADraftsApplication.make()
.Methods:
drafts
([filter])Returns a list of drafts, as PyXA-wrapped objects, matching the given filter.
make
(specifier[, properties, data])Creates a new element of the given specifier class without adding it to any list.
new_draft
(content)Creates a new draft with the given name and content
Attributes:
The name of the application.
The version of Drafts.app.
- class ObjectType(value)[source]
Bases:
Enum
Object types that can be created using
XADraftsApplication.make()
.Attributes:
- DRAFT = 'draft'
- drafts(filter: dict | None = None) XADraftsDraftList [source]
Returns a list of drafts, as PyXA-wrapped objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter drafts by, defaults to None
- Returns:
A PyXA list object wrapping a list of drafts
- Return type:
New in version 0.0.8.
- make(specifier: str | ObjectType, properties: dict | None = None, data: Any | None = None)[source]
Creates a new element of the given specifier class without adding it to any list.
Use
XABase.XAList.push()
to push the element onto a list.- Parameters:
specifier (Union[str, XADraftsApplication.ObjectType]) – The classname of the object to create
properties (dict) – The properties to give the object
data (Any, optional) – The data to initialize the object with, defaults to None
- Returns:
A PyXA wrapped form of the object
- Return type:
New in version 0.0.8.
- property name: str
The name of the application.
- new_draft(content: str) XADraftsDraft [source]
Creates a new draft with the given name and content
- Parameters:
content (str) – The full content of the draft (the first line is the name)
- Returns:
The newly created draft object
- Return type:
New in version 0.0.8.
- property version: str
The version of Drafts.app.
- class PyXA.apps.Drafts.XADraftsDraft(properties)[source]
Bases:
XAObject
A draft in Drafts.app.
New in version 0.0.8.
Attributes:
The date the draft was last accessed.
The content of the draft.
The date the draft was created.
The flagged status of the draft.
The unique identifier of the draft.
The date the draft was last modified.
The first line of the draft.
The URL of the draft.
The tags assigned to the draft.
- property accessed_at: datetime
The date the draft was last accessed.
- property content: str
The content of the draft.
- property created_at: datetime
The date the draft was created.
- property flagged: bool
The flagged status of the draft.
- property id: str
The unique identifier of the draft.
- property modified_at: datetime
The date the draft was last modified.
- property name: str
The first line of the draft.
- property permalink: str
The URL of the draft.
- property tags: list[str]
The tags assigned to the draft.
- class PyXA.apps.Drafts.XADraftsDraftList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of drafts.
New in version 0.0.8.
Methods:
by_accessed_at
(accessed_at)by_content
(content)by_created_at
(created_at)by_flagged
(flagged)by_id
(id)by_modified_at
(modified_at)by_name
(name)by_permalink
(permalink)by_tags
(tags)content
()flagged
()id
()name
()tags
()- by_accessed_at(accessed_at: datetime) XADraftsDraft | None [source]
- by_content(content: str) XADraftsDraft | None [source]
- by_created_at(created_at: datetime) XADraftsDraft | None [source]
- by_flagged(flagged: bool) XADraftsDraft | None [source]
- by_id(id: str) XADraftsDraft | None [source]
- by_modified_at(modified_at: datetime) XADraftsDraft | None [source]
- by_name(name: str) XADraftsDraft | None [source]
- by_permalink(permalink: str) XADraftsDraft | None [source]
- by_tags(tags: list[str]) XADraftsDraft | None [source]