Documentation
¶
Index ¶
- Constants
- Variables
- func ActionExists(name string) (bool, error)
- func Active() (string, error)
- func Append(uuid, text string, opt ModifyOptions) error
- func Archive(uuid string) error
- func Configure(app AppInfo, timeout time.Duration)
- func Count(query string, filter Filter, opt QueryOptions, workspace string) (int, error)
- func Create(text string, opt CreateOptions) (string, error)
- func CurrentWorkspace() (string, error)
- func DraftExists(uuid string) (bool, error)
- func InspectDictionary(data []byte) (map[string]bool, []string, error)
- func IsRunning() (bool, error)
- func Move(uuid, folder string) error
- func OpenWorkspace(name string) error
- func PreflightMutation(action, uuid string, flagType *int) error
- func Prepend(uuid, text string, opt ModifyOptions) error
- func RemoveTags(uuid string, tags ...string) error
- func RenameWorkspace(name, newName string) error
- func Replace(uuid, text string) error
- func ReplaceIfUnchanged(uuid, text, original string) error
- func RunActionOnDraft(action, uuid string) error
- func Select(uuid string) error
- func SetFlagType(uuid string, flagType int) error
- func SetFlagged(uuid string, flagged bool) error
- func Tag(uuid string, tags ...string) error
- func Trash(uuid string) error
- func ValidateDraft(d Draft) error
- func ValidateName(name string) error
- func ValidateUUID(uuid string) error
- func WorkspaceExists(name string) (bool, error)
- func Workspaces() ([]string, error)
- type ActionRunResult
- type AppInfo
- type CreateOptions
- type Draft
- type Error
- type Filter
- type Folder
- type ModifyOptions
- type NamedResource
- type QueryOptions
- type Sort
Constants ¶
const Separator = '|'
Variables ¶
Functions ¶
func ActionExists ¶
ActionExists reports whether a Drafts action exists by name.
func Append ¶
func Append(uuid, text string, opt ModifyOptions) error
func CurrentWorkspace ¶
func DraftExists ¶
DraftExists reports whether a Drafts draft exists for the given UUID.
func InspectDictionary ¶
InspectDictionary uses Apple event codes, including builds with duplicate names.
func OpenWorkspace ¶
func PreflightMutation ¶
PreflightMutation performs only read operations before reserving an idempotency key.
func Prepend ¶
func Prepend(uuid, text string, opt ModifyOptions) error
func RemoveTags ¶
func RenameWorkspace ¶
RenameWorkspace changes a dictionary-supported workspace name without inventing workspace creation or configuration APIs that the dictionary does not expose.
func ReplaceIfUnchanged ¶
func RunActionOnDraft ¶
RunActionOnDraft runs an action on an existing draft.
func SetFlagType ¶
func SetFlagged ¶
func ValidateDraft ¶
ValidateDraft verifies untrusted structured data without accessing an application.
func ValidateName ¶
func ValidateUUID ¶
func WorkspaceExists ¶
WorkspaceExists reports whether a Drafts workspace exists by name.
func Workspaces ¶
Types ¶
type ActionRunResult ¶
type ActionRunResult struct {
UUID string `json:"uuid"`
CreatedDraft bool `json:"createdDraft"`
Status string `json:"status"`
}
func RunAction ¶
func RunAction(action, text string) (ActionRunResult, error)
RunAction creates a persistent draft. Action execution is submitted, not guaranteed completed.
type AppInfo ¶
type AppInfo struct {
Path string `json:"path"`
BundleID string `json:"bundle_id"`
Version string `json:"version"`
Build string `json:"build"`
Channel string `json:"channel"`
Capabilities map[string]bool `json:"capabilities"`
Warnings []string `json:"warnings,omitempty"`
}
AppInfo describes the installed application, never its user library.
func DiscoverApps ¶
func InspectApp ¶
InspectApp reads only application metadata and the scripting dictionary.
type CreateOptions ¶
type Draft ¶
type Draft struct {
AccessedAt string `json:"accessedAt,omitempty"`
FlagType *int `json:"flagType,omitempty"`
UUID string `json:"uuid"`
Content string `json:"content"`
Title string `json:"title"`
Tags []string `json:"tags"`
IsFlagged bool `json:"isFlagged"`
IsArchived bool `json:"isArchived"`
IsTrashed bool `json:"isTrashed"`
Folder string `json:"folder"`
CreatedAt string `json:"createdAt"`
ModifiedAt string `json:"modifiedAt"`
CreatedLatitude float64 `json:"createdLatitude"`
CreatedLongitude float64 `json:"createdLongitude"`
ModifiedLatitude float64 `json:"modifiedLatitude"`
ModifiedLongitude float64 `json:"modifiedLongitude"`
Permalink string `json:"permalink"`
}
func QueryWorkspace ¶
func QueryWorkspace(workspace, query string, filter Filter, opt QueryOptions) ([]Draft, error)
type Error ¶
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
Hint string `json:"hint,omitempty"`
UUID string `json:"uuid,omitempty"`
Completed []string `json:"completed,omitempty"`
RetrySafe bool `json:"retry_safe"`
AppleScriptCode int `json:"applescript_code,omitempty"`
Cause error `json:"-"`
}
type ModifyOptions ¶
type NamedResource ¶
type NamedResource struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Permalink string `json:"permalink,omitempty"`
}
func Actions ¶
func Actions() ([]NamedResource, error)
func Resources ¶
func Resources(kind string) ([]NamedResource, error)
func Tags ¶
func Tags() ([]NamedResource, error)