### Install go-lunatask Package Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 This command installs the go-lunatask package using the go get command. It is the standard way to add Go modules to your project. ```go go get git.secluded.site/go-lunatask@latest ``` -------------------------------- ### Go: Build New Lunatask Note Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 Starts the creation process for a new note. Returns a builder object to define the note's properties. ```go func (c *Client) NewNote() *NoteBuilder ``` -------------------------------- ### Create a Task using TaskBuilder in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 This example demonstrates creating a new task using the TaskBuilder. It shows how to chain methods to set task properties like name, area, status, and estimate before creating the task. ```go task, err := client.NewTask("Review PR"). InArea(areaID). WithStatus(lunatask.StatusNext). WithEstimate(30). Create(ctx) ``` -------------------------------- ### Get Workflow Description - Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Returns a human-readable description of the workflow, intended for use in LLMs. This method helps in providing contextual information about the workflow's purpose. ```go func (w Workflow) Description() string ``` -------------------------------- ### Get Workflow Description (Go) Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index The Description method provides a human-readable string description for a given Workflow value, intended for use with LLMs. It returns a string. ```go func (w Workflow) Description() string { // ... implementation details ... } ``` -------------------------------- ### Motivation Parsing Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Allows parsing a Motivation value from a string representation. It also provides a String method to get the string representation of a Motivation value. ```go type Motivation func ParseMotivation(str string) (Motivation, error) func (m Motivation) String() string ``` -------------------------------- ### Go: Build New Lunatask Task Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 Starts the creation of a new task, requiring a name for the task. A builder object is provided to define the task's details. ```go func (c *Client) NewTask(name string) *TaskBuilder ``` -------------------------------- ### Date Utility Functions Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Provides utility functions for working with dates. This includes creating dates from time.Time, parsing date strings, getting the current date, and handling JSON marshaling/unmarshaling. ```go type Date func NewDate(t time.Time) Date func ParseDate(s string) (Date, error) func Today() Date func (d Date) MarshalJSON() ([]byte, error) func (d *Date) String() string func (d *Date) UnmarshalJSON(data []byte) error ``` -------------------------------- ### Create New Note or Person Builder in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Provides methods on the `Client` to start building new `Note` or `Person` objects. These methods return builder instances that allow for setting various properties before the object is created via a `Create` call. `NewNote` returns a `NoteBuilder`, and `NewPerson` requires first and last names and returns a `PersonBuilder`. ```go func (c *Client) NewNote() *NoteBuilder func (c *Client) NewPerson(firstName, lastName string) *PersonBuilder ``` -------------------------------- ### Client Initialization and Options Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Provides documentation for initializing the Lunatask client and configuring its behavior with various options. ```APIDOC ## Client Initialization and Options ### NewClient Creates a new Lunatask client. * **Parameters** * `accessToken` (string) - Required - The access token for authentication. * `opts` (...Option) - Optional - A variadic list of options to configure the client. ### Options * **BaseURL(url string) Option** Sets the base URL for the API. * **HTTPClient(client *http.Client) Option** Sets a custom HTTP client. * **UserAgent(ua string) Option** Sets the User-Agent header. ``` -------------------------------- ### Get String Representation of Eisenhower Quadrant in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Method to get a human-readable string description of an Eisenhower quadrant. This function is useful for displaying task priority information to users or for logging purposes. ```go func (e Eisenhower) String() string ``` -------------------------------- ### Basic Usage of go-lunatask Client Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 This Go code snippet demonstrates the basic usage of the go-lunatask client. It shows how to create a new client using an API token, verify credentials by pinging the server, and create a new task. The code handles potential errors during client creation and task creation, and includes logic for when a task already exists. ```go package main import ( "context" "log" "os" "git.secluded.site/go-lunatask" ) func main() { client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN"), lunatask.UserAgent("MyApp/1.0")) // Verify credentials if _, err := client.Ping(context.Background()); err != nil { log.Fatal(err) } // Create a task task, err := client.NewTask("Review pull requests").Create(context.Background()) if err != nil { log.Fatal(err) } if task == nil { log.Println("Task already exists") } } ``` -------------------------------- ### Get Task Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Retrieves a specific task by its unique identifier. ```APIDOC ## GET /tasks/{taskID} ### Description Fetches a task by its ID. Name and Note will be null (E2EE). ### Method GET ### Endpoint `/tasks/{taskID}` ### Parameters #### Path Parameters - **taskID** (string) - Required - The unique identifier of the task to retrieve. ### Response #### Success Response (200) - **Task** (object) - The retrieved task. - **ID** (string) - The unique identifier of the task. - **Name** (string) - The name of the task. Will be null (E2EE). - **Note** (string) - The note associated with the task. Will be null (E2EE). - **DueDate** (string) - The due date of the task (YYYY-MM-DD format). - **CompletedAt** (string) - The timestamp when the task was completed (ISO 8601 format). - **CreatedAt** (string) - The timestamp when the task was created (ISO 8601 format). - **UpdatedAt** (string) - The timestamp when the task was last updated (ISO 8601 format). #### Response Example ```json { "ID": "task-456", "Name": null, "Note": null, "DueDate": "2023-11-15", "CompletedAt": null, "CreatedAt": "2023-10-27T10:00:00Z", "UpdatedAt": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Initialize go-lunatask Client and Ping Server Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 This Go snippet shows how to initialize the go-lunatask client with an API token and a custom user agent. It then demonstrates verifying the client's connection to the Lunatask API by pinging the server, logging any errors encountered. ```go client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN"), lunatask.UserAgent("MyApp/1.0")) if _, err := client.Ping(ctx); err != nil { log.Fatal(err) } ``` -------------------------------- ### Get Person Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Retrieves a specific person by their unique identifier. ```APIDOC ## GET /people/{personID} ### Description Fetches a person by their ID. Name fields will be null (E2EE). ### Method GET ### Endpoint `/people/{personID}` ### Parameters #### Path Parameters - **personID** (string) - Required - The unique identifier of the person to retrieve. ### Response #### Success Response (200) - **Person** (object) - The retrieved person. - **ID** (string) - The unique identifier of the person. - **Name** (object) - The name of the person. Fields will be null (E2EE). - **First** (string) - **Last** (string) - **CreatedAt** (string) - The timestamp when the person was created (ISO 8601 format). - **UpdatedAt** (string) - The timestamp when the person was last updated (ISO 8601 format). #### Response Example ```json { "ID": "person-123", "Name": { "First": null, "Last": null }, "CreatedAt": "2023-10-27T10:00:00Z", "UpdatedAt": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Get Note Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Retrieves a specific note by its unique identifier. ```APIDOC ## GET /notes/{noteID} ### Description Fetches a note by its ID. Name and Content will be null (E2EE). ### Method GET ### Endpoint `/notes/{noteID}` ### Parameters #### Path Parameters - **noteID** (string) - Required - The unique identifier of the note to retrieve. ### Response #### Success Response (200) - **Note** (object) - The retrieved note. - **ID** (string) - The unique identifier of the note. - **Name** (string) - The name of the note. Will be null (E2EE). - **Content** (string) - The content of the note. Will be null (E2EE). - **CreatedAt** (string) - The timestamp when the note was created (ISO 8601 format). - **UpdatedAt** (string) - The timestamp when the note was last updated (ISO 8601 format). #### Response Example ```json { "ID": "note-789", "Name": null, "Content": null, "CreatedAt": "2023-10-27T10:00:00Z", "UpdatedAt": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Client Initialization Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 Provides information on how to initialize the Lunatask API client. ```APIDOC ## Client Initialization ### Description Handles communication with the Lunatask API. A Client is safe for concurrent use. ### Function `NewClient(accessToken string, opts ...Option) *Client` ### Usage NewClient creates a new Lunatask API client. Generate an access token in the Lunatask desktop app under Settings → Access tokens. ``` -------------------------------- ### New Note Builder Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Initiates the construction of a new note. ```APIDOC ## POST /notes/new ### Description Starts building a note. ### Method POST ### Endpoint `/notes/new` ### Response #### Success Response (201) - **NoteBuilder** (object) - An object to build the note. #### Response Example ```json { "message": "Note builder created." } ``` ``` -------------------------------- ### Get Person Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Fetches a person by their ID. Name fields will be null due to end-to-end encryption. ```APIDOC ## GET /people/{personID} ### Description Fetches a person by their ID. Name fields will be null (E2EE). ### Method GET ### Endpoint `/people/{personID}` ### Parameters #### Path Parameters - **personID** (string) - Required - The unique identifier of the person to retrieve. ### Response #### Success Response (200) - **Person** (*Person) - The retrieved person object. Name fields will be null. #### Response Example ```json { "id": "person123", "firstName": null, "lastName": null, "email": "john.doe@example.com" } ``` ``` -------------------------------- ### Get Task Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Fetches a task by its ID. Name and Note fields will be null due to end-to-end encryption. ```APIDOC ## GET /tasks/{taskID} ### Description Fetches a task by its ID. Name and Note fields will be null (E2EE). ### Method GET ### Endpoint `/tasks/{taskID}` ### Parameters #### Path Parameters - **taskID** (string) - Required - The unique identifier of the task to retrieve. ### Response #### Success Response (200) - **Task** (*Task) - The retrieved task object. Name and Note will be null. #### Response Example ```json { "id": "task456", "name": null, "note": null, "completed": false, "dueDate": "2023-10-31" } ``` ``` -------------------------------- ### Get Note Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Fetches a note by its ID. Name and Content fields will be null due to end-to-end encryption. ```APIDOC ## GET /notes/{noteID} ### Description Fetches a note by its ID. Name and Content fields will be null (E2EE). ### Method GET ### Endpoint `/notes/{noteID}` ### Parameters #### Path Parameters - **noteID** (string) - Required - The unique identifier of the note to retrieve. ### Response #### Success Response (200) - **Note** (*Note) - The retrieved note object. Name and Content will be null. #### Response Example ```json { "id": "note789", "name": null, "content": null, "createdAt": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### New Note Builder Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Initiates the process of building a new note. ```APIDOC ## POST /notes ### Description Starts building a new note. ### Method POST ### Endpoint `/notes` ### Response #### Success Response (201) - **NoteBuilder** (*NoteBuilder) - A builder object to construct the note. #### Response Example ```json { "message": "Note builder created" } ``` ``` -------------------------------- ### Get All Task Statuses - Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index AllTaskStatuses returns a slice containing all valid task status values, ordered according to the workflow sequence. ```go func AllTaskStatuses() []TaskStatus // Example: statuses := AllTaskStatuses() ``` -------------------------------- ### Task Builder Methods for Task Creation Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Provides methods to configure and create a Task using the TaskBuilder. This includes setting properties like completion time, importance, urgency, priority, scheduling, estimates, notes, status, and linking to goals or areas. It also supports setting custom fields like Eisenhower matrix values, motivation, and source information. ```go func (b *TaskBuilder) CompletedAt(t time.Time) *TaskBuilder func (b *TaskBuilder) Create(ctx context.Context) (*Task, error) func (b *TaskBuilder) FromSource(source, sourceID string) *TaskBuilder func (b *TaskBuilder) Important() *TaskBuilder func (b *TaskBuilder) InArea(areaID string) *TaskBuilder func (b *TaskBuilder) InGoal(goalID string) *TaskBuilder func (b *TaskBuilder) NotImportant() *TaskBuilder func (b *TaskBuilder) NotUrgent() *TaskBuilder func (b *TaskBuilder) Priority(p Priority) *TaskBuilder func (b *TaskBuilder) ScheduledOn(date Date) *TaskBuilder func (b *TaskBuilder) Urgent() *TaskBuilder func (b *TaskBuilder) WithEisenhower(eisenhower Eisenhower) *TaskBuilder func (b *TaskBuilder) WithEstimate(minutes int) *TaskBuilder func (b *TaskBuilder) WithMotivation(motivation Motivation) *TaskBuilder func (b *TaskBuilder) WithNote(note string) *TaskBuilder func (b *TaskBuilder) WithStatus(status TaskStatus) *TaskBuilder ``` -------------------------------- ### Get Source Filter for Tasks in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index The GetSource method on ListTasksOptions returns the source integration filter for tasks. It implements the SourceFilter interface. ```go func (o *ListTasksOptions) GetSource() *string ``` -------------------------------- ### New Task Builder Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Initiates the construction of a new task with the provided name. ```APIDOC ## POST /tasks/new ### Description Starts building a task with the given name. ### Method POST ### Endpoint `/tasks/new` ### Parameters #### Request Body - **name** (string) - Required - The name of the task. ### Request Example ```json { "name": "Complete project proposal" } ``` ### Response #### Success Response (201) - **TaskBuilder** (object) - An object to build the task. #### Response Example ```json { "message": "Task builder created." } ``` ``` -------------------------------- ### Get Source Filter for People in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index The GetSource method on ListPeopleOptions returns the source integration filter for people. It implements the SourceFilter interface. ```go func (o *ListPeopleOptions) GetSource() *string ``` -------------------------------- ### NoteBuilder Methods for Creation and Properties in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Provides methods for the `NoteBuilder` to set properties like content, name, and source, and to specify the notebook. The `Create` method finalizes the note creation process. ```go func (b *NoteBuilder) Create(ctx context.Context) (*Note, error) func (b *NoteBuilder) FromSource(source, sourceID string) *NoteBuilder func (b *NoteBuilder) InNotebook(notebookID string) *NoteBuilder func (b *NoteBuilder) WithContent(content string) *NoteBuilder func (b *NoteBuilder) WithName(name string) *NoteBuilder ``` -------------------------------- ### Client Initialization and Operations Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Provides details on how to initialize the Lunatask API client and perform operations such as deleting notes. ```APIDOC ## Lunatask API Client The `Client` type handles communication with the Lunatask API. It is safe for concurrent use. ### Initialization - **`NewClient(accessToken string, opts ...Option) *Client`** - Creates a new Lunatask API client. - `accessToken`: Required. Generate an access token in the Lunatask desktop app under Settings → Access tokens. - `opts`: Optional. Additional options for client configuration. ### Operations #### Delete Note - **`(*Client) DeleteNote(ctx context.Context, noteID string) (*Note, error)`** - Removes a note and returns its final state. - `ctx`: The request context. - `noteID`: The ID of the note to delete. - Returns a pointer to the deleted `Note` object or an error if the operation fails. ``` -------------------------------- ### Get Source Filter for Notes in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index The GetSource method on ListNotesOptions returns the source integration filter for notes. It implements the SourceFilter interface. ```go func (o *ListNotesOptions) GetSource() *string ``` -------------------------------- ### Get Source ID Filter for Tasks in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index The GetSourceID method on ListTasksOptions returns the source ID filter for tasks. It implements the SourceFilter interface. ```go func (o *ListTasksOptions) GetSourceID() *string ``` -------------------------------- ### Client Options Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Defines options for configuring the Lunatask client. This includes setting a custom base URL, an HTTP client, and a user agent. ```go type Option func BaseURL(url string) Option func HTTPClient(client *http.Client) Option func UserAgent(ua string) Option ``` -------------------------------- ### Get Source ID Filter for People in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index The GetSourceID method on ListPeopleOptions returns the source ID filter for people. It implements the SourceFilter interface. ```go func (o *ListPeopleOptions) GetSourceID() *string ``` -------------------------------- ### New Task Builder Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Initiates the process of building a new task with the provided name. ```APIDOC ## POST /tasks ### Description Starts building a task with the given name. ### Method POST ### Endpoint `/tasks` ### Parameters #### Request Body - **name** (string) - Required - The name of the task. ### Response #### Success Response (201) - **TaskBuilder** (*TaskBuilder) - A builder object to construct the task. #### Response Example ```json { "message": "Task builder created for 'Complete report'" } ``` ``` -------------------------------- ### Create a New Note with Go Lunatask NoteBuilder Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 Demonstrates how to use the NoteBuilder to construct and create a new note. It supports setting the name, content, and notebook via method chaining. Note fields are encrypted client-side. ```go note, err := client.NewNote(). WithName("Meeting notes"). WithContent("# Summary\n\n..."). InNotebook(notebookID). Create(ctx) ``` -------------------------------- ### Get Source ID Filter for Notes in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index The GetSourceID method on ListNotesOptions returns the source ID filter for notes. It implements the SourceFilter interface. ```go func (o *ListNotesOptions) GetSourceID() *string ``` -------------------------------- ### Option Functions Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Functions to configure the Lunatask client options. ```APIDOC ## Option Functions Functions to configure the Lunatask client options. ### `BaseURL` - **Description**: Sets the base URL for the API. - **Method**: `func BaseURL(url string) Option` - **Parameters**: - `url` (string) - Required - The base URL. ### `HTTPClient` - **Description**: Sets a custom HTTP client. - **Method**: `func HTTPClient(client *http.Client) Option` - **Parameters**: - `client` (*http.Client) - Required - The HTTP client. ### `UserAgent` - **Description**: Sets the User-Agent header for requests. - **Method**: `func UserAgent(ua string) Option` - **Parameters**: - `ua` (string) - Required - The User-Agent string. ``` -------------------------------- ### Convert Workflow to String (Go) Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index The String method returns the string representation of a Workflow value. This is the standard way to get the underlying string for a Workflow type. ```go func (w Workflow) String() string { // ... implementation details ... } ``` -------------------------------- ### Builder Methods Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Methods for building complex objects like journal entries, notes, people, and tasks. ```APIDOC ## Builder Methods Methods for building complex objects like journal entries, notes, people, and tasks. ### `JournalEntryBuilder.Create` - **Description**: Creates a journal entry. - **Method**: `func (b *JournalEntryBuilder) Create(ctx context.Context) (*JournalEntry, error)` - **Parameters**: - `ctx` (context.Context) - Required - The context for the request. ### `JournalEntryBuilder.WithContent` - **Description**: Sets the content for a journal entry. - **Method**: `func (b *JournalEntryBuilder) WithContent(content string) *JournalEntryBuilder` - **Parameters**: - `content` (string) - Required - The content of the journal entry. ### `JournalEntryBuilder.WithName` - **Description**: Sets the name for a journal entry. - **Method**: `func (b *JournalEntryBuilder) WithName(name string) *JournalEntryBuilder` - **Parameters**: - `name` (string) - Required - The name of the journal entry. ### `NoteBuilder.Create` - **Description**: Creates a note. - **Method**: `func (b *NoteBuilder) Create(ctx context.Context) (*Note, error)` - **Parameters**: - `ctx` (context.Context) - Required - The context for the request. ### `NoteBuilder.FromSource` - **Description**: Sets the source and source ID for a note. - **Method**: `func (b *NoteBuilder) FromSource(source, sourceID string) *NoteBuilder` - **Parameters**: - `source` (string) - Required - The source of the note. - `sourceID` (string) - Required - The ID of the note in the source system. ### `NoteBuilder.InNotebook` - **Description**: Sets the notebook for a note. - **Method**: `func (b *NoteBuilder) InNotebook(notebookID string) *NoteBuilder` - **Parameters**: - `notebookID` (string) - Required - The ID of the notebook. ### `NoteBuilder.WithContent` - **Description**: Sets the content for a note. - **Method**: `func (b *NoteBuilder) WithContent(content string) *NoteBuilder` - **Parameters**: - `content` (string) - Required - The content of the note. ### `NoteBuilder.WithName` - **Description**: Sets the name for a note. - **Method**: `func (b *NoteBuilder) WithName(name string) *NoteBuilder` - **Parameters**: - `name` (string) - Required - The name of the note. ### `NoteUpdateBuilder.InNotebook` - **Description**: Sets the notebook for a note update. - **Method**: `func (b *NoteUpdateBuilder) InNotebook(notebookID string) *NoteUpdateBuilder` - **Parameters**: - `notebookID` (string) - Required - The ID of the notebook. ### `NoteUpdateBuilder.OnDate` - **Description**: Sets the date for a note update. - **Method**: `func (b *NoteUpdateBuilder) OnDate(date Date) *NoteUpdateBuilder` - **Parameters**: - `date` (Date) - Required - The date for the note update. ### `NoteUpdateBuilder.Update` - **Description**: Updates an existing note. - **Method**: `func (b *NoteUpdateBuilder) Update(ctx context.Context) (*Note, error)` - **Parameters**: - `ctx` (context.Context) - Required - The context for the request. ### `NoteUpdateBuilder.WithContent` - **Description**: Sets the content for a note update. - **Method**: `func (b *NoteUpdateBuilder) WithContent(content string) *NoteUpdateBuilder` - **Parameters**: - `content` (string) - Required - The content of the note update. ### `NoteUpdateBuilder.WithName` - **Description**: Sets the name for a note update. - **Method**: `func (b *NoteUpdateBuilder) WithName(name string) *NoteUpdateBuilder` - **Parameters**: - `name` (string) - Required - The name of the note update. ### `PersonBuilder.Create` - **Description**: Creates a person. - **Method**: `func (b *PersonBuilder) Create(ctx context.Context) (*Person, error)` - **Parameters**: - `ctx` (context.Context) - Required - The context for the request. ### `PersonBuilder.FromSource` - **Description**: Sets the source and source ID for a person. - **Method**: `func (b *PersonBuilder) FromSource(source, sourceID string) *PersonBuilder` - **Parameters**: - `source` (string) - Required - The source of the person. - `sourceID` (string) - Required - The ID of the person in the source system. ### `PersonBuilder.WithCustomField` - **Description**: Adds a custom field to a person. - **Method**: `func (b *PersonBuilder) WithCustomField(key string, value any) *PersonBuilder` - **Parameters**: - `key` (string) - Required - The key of the custom field. - `value` (any) - Required - The value of the custom field. ### `PersonBuilder.WithRelationshipStrength` - **Description**: Sets the relationship strength for a person. - **Method**: `func (b *PersonBuilder) WithRelationshipStrength(strength RelationshipStrength) *PersonBuilder` - **Parameters**: - `strength` (RelationshipStrength) - Required - The strength of the relationship. ### `PersonUpdateBuilder.FirstName` - **Description**: Sets the first name for a person update. - **Method**: `func (b *PersonUpdateBuilder) FirstName(firstName string) *PersonUpdateBuilder` - **Parameters**: - `firstName` (string) - Required - The first name. ### `PersonUpdateBuilder.LastName` - **Description**: Sets the last name for a person update. - **Method**: `func (b *PersonUpdateBuilder) LastName(lastName string) *PersonUpdateBuilder` - **Parameters**: - `lastName` (string) - Required - The last name. ### `TaskBuilder.Create` - **Description**: Creates a task. - **Method**: `func (b *TaskBuilder) Create(ctx context.Context) (*Task, error)` - **Parameters**: - `ctx` (context.Context) - Required - The context for the request. ### `TaskBuilder.FromSource` - **Description**: Sets the source and source ID for a task. - **Method**: `func (b *TaskBuilder) FromSource(source, sourceID string) *TaskBuilder` - **Parameters**: - `source` (string) - Required - The source of the task. - `sourceID` (string) - Required - The ID of the task in the source system. ### `TaskBuilder.InProject` - **Description**: Sets the project for a task. - **Method**: `func (b *TaskBuilder) InProject(projectID string) *TaskBuilder` - **Parameters**: - `projectID` (string) - Required - The ID of the project. ### `TaskBuilder.WithDescription` - **Description**: Sets the description for a task. - **Method**: `func (b *TaskBuilder) WithDescription(description string) *TaskBuilder` - **Parameters**: - `description` (string) - Required - The description of the task. ### `TaskBuilder.WithName` - **Description**: Sets the name for a task. - **Method**: `func (b *TaskBuilder) WithName(name string) *TaskBuilder` - **Parameters**: - `name` (string) - Required - The name of the task. ### `TaskUpdateBuilder.Description` - **Description**: Sets the description for a task update. - **Method**: `func (b *TaskUpdateBuilder) Description(description string) *TaskUpdateBuilder` - **Parameters**: - `description` (string) - Required - The description of the task update. ### `TaskUpdateBuilder.Name` - **Description**: Sets the name for a task update. - **Method**: `func (b *TaskUpdateBuilder) Name(name string) *TaskUpdateBuilder` - **Parameters**: - `name` (string) - Required - The name of the task update. ### `TaskUpdateBuilder.Update` - **Description**: Updates an existing task. - **Method**: `func (b *TaskUpdateBuilder) Update(ctx context.Context) (*Task, error)` - **Parameters**: - `ctx` (context.Context) - Required - The context for the request. ### `TimelineNoteBuilder.Create` - **Description**: Creates a timeline note. - **Method**: `func (b *TimelineNoteBuilder) Create(ctx context.Context) (*PersonTimelineNote, error)` - **Parameters**: - `ctx` (context.Context) - Required - The context for the request. ### `TimelineNoteBuilder.WithContent` - **Description**: Sets the content for a timeline note. - **Method**: `func (b *TimelineNoteBuilder) WithContent(content string) *TimelineNoteBuilder` - **Parameters**: - `content` (string) - Required - The content of the timeline note. ``` -------------------------------- ### New Person Builder Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Initiates the construction of a new person entry with the provided first and last names. ```APIDOC ## POST /people/new ### Description Starts building a person entry with the given name. ### Method POST ### Endpoint `/people/new` ### Parameters #### Request Body - **firstName** (string) - Required - The first name of the person. - **lastName** (string) - Required - The last name of the person. ### Request Example ```json { "firstName": "John", "lastName": "Doe" } ``` ### Response #### Success Response (201) - **PersonBuilder** (object) - An object to build the person entry. #### Response Example ```json { "message": "Person builder created." } ``` ``` -------------------------------- ### RelationshipStrength Enum and Methods (Go) Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Defines the RelationshipStrength enum, providing functions to get all strengths and parse from a string. It also includes a method for string representation. ```go type RelationshipStrength func AllRelationshipStrengths() []RelationshipStrength func ParseRelationshipStrength(str string) (RelationshipStrength, error) func (r RelationshipStrength) String() string ``` -------------------------------- ### Contributing to go-lunatask with Patch Requests Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 This section outlines the contribution process for go-lunatask using patch requests via SSH. It details how to clone the repository, make changes, and submit patch requests or revisions to existing ones using the pr.pico.sh tool. It also shows how to list existing patch requests. ```bash # Clone this repo, make your changes, and commit them # Create a new patch request with git format-patch origin/main --stdout | ssh pr.pico.sh pr create amolith/go-lunatask # After potential feedback, submit a revision to an existing patch request with git format-patch origin/main --stdout | ssh pr.pico.sh pr add {prID} # List patch requests ssh pr.pico.sh pr ls amolith/go-lunatask ``` -------------------------------- ### Get Source Filter for ListOptions in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 Retrieves the source filter value from ListNotesOptions, ListPeopleOptions, or ListTasksOptions. Implements the SourceFilter interface, returning a pointer to a string. ```go func (o *ListNotesOptions) GetSource() *string { return o.Source } func (o *ListPeopleOptions) GetSource() *string { return o.Source } func (o *ListTasksOptions) GetSource() *string { return o.Source } ``` -------------------------------- ### Source Tracking Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Provides functionality for tracking entity origins. ```APIDOC ## Source API ### Description This section details the `Source` and `SourceFilter` types for tracking entity origins. ### Types #### `Source` struct `Source` tracks where an entity originated, useful for syncing with external systems. The values are free-form strings you define. **Fields:** - **Source** (string): The name of the source system. - **SourceID** (string): The unique identifier within the source system. #### `SourceFilter` interface `SourceFilter` provides optional source filtering for list operations. **Methods:** - **GetSource()** (*string): Returns the source name filter. - **GetSourceID()** (*string): Returns the source ID filter. ``` -------------------------------- ### Resource Handling Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Manages resource types for deep links and reference parsing. ```APIDOC ## Resource API ### Description This section covers the `Resource` type and functions for handling deep links and references within Lunatask. ### Types #### `Resource` string `Resource` represents a Lunatask resource type for deep links. **Constants:** - `ResourceArea`: Represents areas. - `ResourceGoal`: Represents goals. - `ResourceTask`: Represents tasks. - `ResourceNote`: Represents notes. - `ResourcePerson`: Represents people. - `ResourceNotebook`: Represents notebooks. - `ResourceUnknown`: Returned when parsing a raw UUID without resource context. ### Functions #### `ParseDeepLink(input string)` - **Description**: Extracts resource type and UUID from input. - **Deprecated**: Use `ParseReference` instead. - **Method**: POST (Conceptual) - **Endpoint**: N/A (Function call) - **Parameters**: - **Path Parameters**: None - **Query Parameters**: None - **Request Body**: None - **Request Example**: N/A - **Response**: - **Success Response (200)**: `Resource` type, UUID string, and nil error if successful. - **Error Response**: `error` if parsing fails. #### `ParseReference(input string)` - **Description**: Extracts resource type and UUID from a Lunatask deep link or plain UUID. Accepts `lunatask://tasks/uuid` or plain UUID strings. When a plain UUID is provided, the resource type will be `ResourceUnknown`. The UUID is validated to be a well-formed UUID string. - **Method**: POST (Conceptual) - **Endpoint**: N/A (Function call) - **Parameters**: - **Path Parameters**: None - **Query Parameters**: None - **Request Body**: None - **Request Example**: N/A - **Response**: - **Success Response (200)**: `Resource` type, UUID string, and nil error if successful. - **Error Response**: `error` if parsing fails. #### `(Resource) String()` - **Description**: Returns the resource type as a string. - **Method**: N/A (Method on type) - **Endpoint**: N/A #### `(Resource) Valid()` - **Description**: Reports whether `r` is a known resource type. - **Method**: N/A (Method on type) - **Endpoint**: N/A ``` -------------------------------- ### Go: Get Today's Date Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 Returns the current date in the local time zone as a `Date` object. This function simplifies obtaining the current date. ```go func Today() Date ``` -------------------------------- ### Get All Valid Workflow Values (Go) Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Workflows returns a slice containing all predefined valid Workflow values. This function is useful for enumerating available workflow types. ```go func Workflows() []Workflow { // ... implementation details ... } ``` -------------------------------- ### Note Builder Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 A builder for creating Note objects. It supports setting the name, content, notebook, source, and source ID before creating the note. ```go type NoteBuilder func (b *NoteBuilder) Create(ctx context.Context) (*Note, error) func (b *NoteBuilder) FromSource(source, sourceID string) *NoteBuilder func (b *NoteBuilder) InNotebook(notebookID string) *NoteBuilder func (b *NoteBuilder) WithContent(content string) *NoteBuilder func (b *NoteBuilder) WithName(name string) *NoteBuilder ``` -------------------------------- ### New Person Builder Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Initiates the process of building a new person entry with the provided first and last names. ```APIDOC ## POST /people ### Description Starts building a person entry with the given name. ### Method POST ### Endpoint `/people` ### Parameters #### Request Body - **firstName** (string) - Required - The first name of the person. - **lastName** (string) - Required - The last name of the person. ### Response #### Success Response (201) - **PersonBuilder** (*PersonBuilder) - A builder object to construct the person entry. #### Response Example ```json { "message": "Person builder created for John Doe" } ``` ``` -------------------------------- ### Helper Functions Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Utility functions for building deep links, validating IDs, and checking task completion. ```APIDOC ## Helper Functions Utility functions for building deep links, validating IDs, and checking task completion. ### `BuildDeepLink` - **Description**: Builds a deep link for a given resource and ID. - **Method**: `func BuildDeepLink(resource Resource, id string) (string, error)` - **Parameters**: - `resource` (Resource) - Required - The resource type. - `id` (string) - Required - The ID of the resource. ### `IsOldCompleted` - **Description**: Checks if a task is old and completed. - **Method**: `func IsOldCompleted(task Task, today time.Time) bool` - **Parameters**: - `task` (Task) - Required - The task to check. - `today` (time.Time) - Required - The current date. ### `ValidateUUID` - **Description**: Validates if a string is a valid UUID. - **Method**: `func ValidateUUID(id string) error` - **Parameters**: - `id` (string) - Required - The string to validate. ``` -------------------------------- ### Get All Available Motivations in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Retrieves a slice containing all predefined `Motivation` types. This function is useful for populating selection lists or providing available motivation options. ```go func AllMotivations() []Motivation ``` -------------------------------- ### Get String Representation of Priority (Go) Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 The String method for the Priority type returns its lowercase string name (e.g., 'high', 'normal'), providing a human-readable representation. ```go func (p *Priority) String() string { // ... implementation details ... } ``` -------------------------------- ### Client Option Functions in Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Provides functional options for configuring the `Client`. These include setting a custom base URL, an HTTP client, or a user agent string. ```go func BaseURL(url string) Option func HTTPClient(client *http.Client) Option func UserAgent(ua string) Option ``` -------------------------------- ### Go: Build New Lunatask Person Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1 Starts the process of building a new person entry, requiring the first and last names. A builder object is returned for further customization. ```go func (c *Client) NewPerson(firstName, lastName string) *PersonBuilder ``` -------------------------------- ### List Options Methods Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index Methods for accessing options used in list operations. ```APIDOC ## List Options Methods Methods for accessing options used in list operations. ### `ListNotesOptions.GetSource` - **Description**: Gets the source filter for listing notes. - **Method**: `func (o *ListNotesOptions) GetSource() *string` ### `ListNotesOptions.GetSourceID` - **Description**: Gets the source ID filter for listing notes. - **Method**: `func (o *ListNotesOptions) GetSourceID() *string` ### `ListPeopleOptions.GetSource` - **Description**: Gets the source filter for listing people. - **Method**: `func (o *ListPeopleOptions) GetSource() *string` ### `ListPeopleOptions.GetSourceID` - **Description**: Gets the source ID filter for listing people. - **Method**: `func (o *ListPeopleOptions) GetSourceID() *string` ### `ListTasksOptions.GetSource` - **Description**: Gets the source filter for listing tasks. - **Method**: `func (o *ListTasksOptions) GetSource() *string` ### `ListTasksOptions.GetSourceID` - **Description**: Gets the source ID filter for listing tasks. - **Method**: `func (o *ListTasksOptions) GetSourceID() *string` ``` -------------------------------- ### Get Valid Task Statuses for a Workflow (Go) Source: https://pkg.go.dev/git.secluded.site/go-lunatask/index ValidStatuses returns a slice of TaskStatus that are applicable to a specific Workflow. This helps in determining the valid states a task can be in for a given workflow. ```go func (w Workflow) ValidStatuses() []TaskStatus { // ... implementation details ... } ``` -------------------------------- ### TaskBuilder Methods Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Methods for configuring a new task using a builder pattern. ```APIDOC ## TaskBuilder Methods ### Description Methods for configuring a new task using a builder pattern. ### Method Builder Chaining ### Endpoints N/A (Used in code construction) ### Parameters #### FromSource - **source** (string) - Description: Tags the task with a free-form origin identifier. - **sourceID** (string) - Description: Identifier for the source. #### InArea - **areaID** (string) - Description: Assigns the task to an area. IDs are in the area's settings. #### InGoal - **goalID** (string) - Description: Assigns the task to a goal. IDs are in the goal's settings. #### Priority - **p** (Priority) - Description: Sets the priority level. Use Priority* constants. #### ScheduledOn - **date** (Date) - Description: Sets when the task should appear on the schedule. #### WithEstimate - **minutes** (int) - Description: Sets the expected duration in minutes (0–720). #### WithMotivation - **motivation** (Motivation) - Description: Sets why this task matters. Use Motivation* constants. #### WithNote - **note** (string) - Description: Attaches a Markdown note to the task. #### WithStatus - **status** (TaskStatus) - Description: Sets the workflow status. Use Status* constants. #### Important Marks the task as important. #### NotImportant Marks the task as not important. #### Urgent Marks the task as urgent. #### NotUrgent Marks the task as not urgent. #### WithEisenhower - **eisenhower** (Eisenhower) - Description: Sets the Eisenhower matrix quadrant directly. ### Request Example ```go task, err := client.NewTask(). FromSource("script", "123"). Important(). InArea("area-id"). InGoal("goal-id"). ScheduledOn(date). // Assuming date is a valid time.Time or custom Date type WithEstimate(30). WithMotivation(lunatask.MotivationMust). WithNote("# This is a note"). WithStatus(lunatask.StatusNext). Create(ctx) ``` ### Response #### Success Response (200) - **Task** (object) - The created task object. #### Response Example ```json { "id": "task-id", "description": "Example task", "status": "next", "priority": "high", "estimated_minutes": 30 } ``` ``` -------------------------------- ### Create Journal Entry with Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Demonstrates how to construct and create a journal entry using the JournalEntryBuilder. The content is client-side encrypted and will be null when read back from the API. It utilizes method chaining for setting content and name before creation. ```go type JournalEntry struct { ID string `json:"id"` DateOn Date `json:"date_on"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } type JournalEntryBuilder struct { // contains filtered or unexported fields } func (b *JournalEntryBuilder) WithContent(content string) *JournalEntryBuilder { // ... implementation details not shown for brevity } func (b *JournalEntryBuilder) WithName(name string) *JournalEntryBuilder { // ... implementation details not shown for brevity } func (b *JournalEntryBuilder) Create(ctx context.Context) (*JournalEntry, error) { // ... implementation details not shown for brevity } // Example usage: // entry, err := client.NewJournalEntry(lunatask.Today()). // WithContent("Shipped the new feature!"). // Create(ctx) ``` -------------------------------- ### Get Valid Task Statuses for Workflow - Go Source: https://pkg.go.dev/git.secluded.site/go-lunatask/%40v0.1.0-rc9 Returns a slice of TaskStatus values that are applicable to the current workflow. This method helps in enforcing workflow-specific constraints on task statuses. ```go func (w Workflow) ValidStatuses() []TaskStatus ```