ticktick

package module
v0.0.0-...-95077b4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 7 Imported by: 0

README

go-ticktick

Go Pkg

A go library for ticktick and dida365(滴答清单)

Documentation

Index

Constants

View Source
const (
	MakeSubtaskUrlEndpoint = "/batch/taskParent"  // POST
	MoveTaskUrlEndpoint    = "/batch/taskProject" // POST
)
View Source
const (
	TemplateTime = "2006-01-02T15:04:05.000+0000"
)

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](s []T, e T) bool

list contains

Types

type Client

type Client struct {
	UserName string
	PassWord string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(userName, passWord, server string) (*Client, error)

create a new client, the server can be ticktick, dida365, test

func (*Client) CompleteTask

func (c *Client) CompleteTask(t *TaskItem) (*TaskItem, error)

Complete task, as complete has no field

func (*Client) CreateTask

func (c *Client) CreateTask(t *TaskItem) (*TaskItem, error)

CURD, Create

func (*Client) DeleteTask

func (c *Client) DeleteTask(t *TaskItem) (*TaskItem, error)

CURD, Delete

func (*Client) GetToken

func (c *Client) GetToken() error

get the ticktick token

func (*Client) Init

func (c *Client) Init() error

init the client struct (login, sync)

func (*Client) MakeSubtask

func (c *Client) MakeSubtask(p, t *TaskItem) (*TaskItem, *TaskItem, error)

Make subtask, p is the parent, t is the child, return the parent and child tasks

func (*Client) MoveTask

func (c *Client) MoveTask(t *TaskItem, to string) (*TaskItem, error)

Move task to another project, as directly updating projectId has no effect

func (*Client) SearchTask

func (c *Client) SearchTask(title string, project string, tag string, id string, StartDateNotbefore time.Time, StartDateNotafter time.Time, priority int64) ([]TaskItem, error)

CURD, Read, partial match. if parameter is "", it will have no effect. If priority is -1, it's ignored. If time is zero val, it's ignored. Priority values are: 0,1,3,5 (low -> high)

func (*Client) SetToken

func (c *Client) SetToken(token string)

func (*Client) Sync

func (c *Client) Sync() error

fetch all the user contents

func (*Client) UpdateTask

func (c *Client) UpdateTask(t *TaskItem) (*TaskItem, error)

CURD, Update

type TaskItem

type TaskItem struct {
	Id          string `json:"id"`
	ProjectId   string `json:"projectId"`
	ProjectName string `json:"-"`
	ParentId    string `json:"parentId"`

	Title string `json:"title"`

	IsAllDay  bool     `json:"isAllDay"`
	Tags      []string `json:"tags"`
	Content   string   `json:"content"`
	Desc      string   `json:"desc"`
	AllDay    bool     `json:"allDay"`
	StartDate string   `json:"startDate"` // the dates are all in UTC
	DueDate   string   `json:"dueDate"`   // and will not be influenced by TimeZone
	TimeZone  string   `json:"timeZone"`
	Reminders []string `json:"reminders"`
	Repeat    string   `json:"repeat"`
	Priority  int64    `json:"priority"`
	SortOrder int64    `json:"sortOrder"`
	Kind      string   `json:"kind"`
	Status    int64    `json:"status"`
}

func NewTask

func NewTask(c *Client, title string, content string, startDate time.Time, projectName string) (*TaskItem, error)

Jump to

Keyboard shortcuts

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