metadata

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package metadata provides Tasks list parsing and structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	Title     string     `json:"title"`
	Notes     string     `json:"notes,omitempty"`
	Status    string     `json:"status"` // "completed" or "needsAction"
	Due       time.Time  `json:"due,omitempty"`
	Completed time.Time  `json:"completed,omitempty"`
	Parent    string     `json:"parent,omitempty"`   // ID of parent task
	Position  string     `json:"position,omitempty"` // Position within parent/list
	Links     []TaskLink `json:"links,omitempty"`
	IsDeleted bool       `json:"deleted,omitempty"`
	Updated   time.Time  `json:"updated"`
}

Task represents a single task within a list.

func (*Task) FormatCompletedDate

func (t *Task) FormatCompletedDate(layout string) string

FormatCompletedDate formats the completed date using the given layout.

func (*Task) FormatDueDate

func (t *Task) FormatDueDate(layout string) string

FormatDueDate formats the due date using the given layout.

func (*Task) GetCheckboxSymbol

func (t *Task) GetCheckboxSymbol() string

GetCheckboxSymbol returns the appropriate checkbox symbol for markdown.

func (*Task) HasDueDate

func (t *Task) HasDueDate() bool

HasDueDate returns true if the task has a due date set.

func (t *Task) HasLinks() bool

HasLinks returns true if the task has associated links.

func (*Task) HasNotes

func (t *Task) HasNotes() bool

HasNotes returns true if the task has notes.

func (*Task) HasParent

func (t *Task) HasParent() bool

HasParent returns true if the task is a subtask.

func (*Task) IsCompleted

func (t *Task) IsCompleted() bool

IsCompleted returns true if the task is marked as completed.

func (*Task) ToMarkdown

func (t *Task) ToMarkdown(indent int) string

ToMarkdown converts the task to markdown format.

type TaskLink struct {
	Description string `json:"description,omitempty"`
	URL         string `json:"link"`
	Type        string `json:"type,omitempty"`
}

TaskLink represents a link associated with a task.

type TaskList

type TaskList struct {
	Title        string    `json:"title"`
	LastModified time.Time `json:"last_modified"`
	Tasks        []Task    `json:"tasks"`
}

TaskList represents a Google Tasks list with all its metadata.

func ParseTasksJSON

func ParseTasksJSON(reader io.Reader) (*TaskList, error)

ParseTasksJSON parses a Google Tasks JSON file.

func (*TaskList) BuildHierarchy

func (l *TaskList) BuildHierarchy() []Task

BuildHierarchy organizes tasks into a tree structure based on Parent field. Returns top-level tasks with their subtasks properly nested.

func (*TaskList) CountCompleted

func (l *TaskList) CountCompleted() int

CountCompleted returns the number of completed tasks in the list.

func (*TaskList) CountPending

func (l *TaskList) CountPending() int

CountPending returns the number of pending tasks in the list.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL