internal

package
v0.0.0-...-5a35ea5 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UseGoogleTasks bool

	GoogleTasksClientVar *GoogleTasksClient
)

Functions

func ExportToGoogle

func ExportToGoogle(tasks []Task) error

func InitializeGoogleTasks

func InitializeGoogleTasks() error

InitializeGoogleTasks sets up the Google Tasks API client and cache

func NewModel

func NewModel(tasks []Task, client *GoogleTasksClient) model

NewModel initializes the Bubble Tea model with tasks

func RunTaskUI

func RunTaskUI(tasks []Task, client *GoogleTasksClient)

RunTaskUI starts the Bubble Tea program

func SaveGoogleTasks

func SaveGoogleTasks(tasks []Task) error

func SaveTasks

func SaveTasks(tasks []Task) error

SaveTasks saves the tasks to a JSON file in the configured storage path

func SaveToLocal

func SaveToLocal(tasks []Task) error

func SetCurrentModel

func SetCurrentModel(m *model)

func SetGlobalConfig

func SetGlobalConfig(config *GodoConfig)

Types

type GodoConfig

type GodoConfig struct {
	StoragePath        string `config:"StoragePath"`
	GoogleClientID     string `config:"GoogleClientID"`
	GoogleClientSecret string `config:"GoogleClientSecret"`
	GoogleTokenPath    string `config:"GoogleTokenPath"`
}

GodoConfig struct with field names that match the config keys

func GetGlobalConfig

func GetGlobalConfig() *GodoConfig

func LoadConfig

func LoadConfig(configPath string) (GodoConfig, error)

LoadConfig reads or creates the config file, adds missing fields, and returns the populated CurdConfig struct

type GoogleTasksCache

type GoogleTasksCache struct {
	Tasks    []Task
	LastSync time.Time
	// contains filtered or unexported fields
}

GoogleTasksCache holds the cached tasks and handles background updates

type GoogleTasksClient

type GoogleTasksClient struct {
	// contains filtered or unexported fields
}

GoogleTasksClient wraps Google Tasks service

func NewGoogleTasksClient

func NewGoogleTasksClient(service *v1.Service) *GoogleTasksClient

NewGoogleTasksClient returns a new GoogleTasksClient instance

func (*GoogleTasksClient) CreateTask

func (c *GoogleTasksClient) CreateTask(task Task, listID string) (Task, error)

CreateTask creates a new task in the specified task list

func (*GoogleTasksClient) DeleteTask

func (c *GoogleTasksClient) DeleteTask(taskID string) error

DeleteTask deletes a task from the first task list

func (*GoogleTasksClient) LoadTasks

func (c *GoogleTasksClient) LoadTasks() ([]Task, error)

LoadTasks retrieves tasks from the first task list

func (*GoogleTasksClient) UpdateTask

func (c *GoogleTasksClient) UpdateTask(task Task) error

UpdateTask updates an existing task in the first task list

type Task

type Task struct {
	Id            string    `json:"id"`
	Title         string    `json:"title"`
	Description   string    `json:"description"`
	Notes         string    `json:"notes"`
	Status        string    `json:"status"`
	Completed     bool      `json:"completed"`
	CreatedAt     time.Time `json:"createdAt"`
	DueDate       time.Time `json:"dueDate"`
	CompletedDate time.Time `json:"completedDate"`
	Parent        string    `json:"parent"`
	Position      string    `json:"position"`
	Kind          string    `json:"kind"`
	SelfLink      string    `json:"selfLink"`
	Etag          string    `json:"etag"`
	Updated       time.Time `json:"updated"`
	Created       time.Time `json:"created"`
	Deleted       bool      `json:"deleted"`
	Tasks         []Task    `json:"tasks"`
	Links         []struct {
		Type string `json:"type"`
		Desc string `json:"description"`
		Link string `json:"link"`
	} `json:"links"`
}

Task represents a task or subtask

func ImportFromLocal

func ImportFromLocal() ([]Task, error)

func ImportTasks

func ImportTasks() ([]Task, error)

func LoadTasks

func LoadTasks() ([]Task, error)

LoadTasks loads tasks from the JSON file in the configured storage path

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳