api

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClosedStatus added in v0.2.0

func ClosedStatus(list *clickup.List) (string, error)

ClosedStatus returns the status a list uses to mean "done".

ClickUp lists define their own status sets — "complete" only exists on lists that happen to use the default set, so it cannot be assumed. A list's done status is identified by its type ("done", or "closed"), not its name.

func CoerceCustomFieldValue added in v0.2.0

func CoerceCustomFieldValue(f *clickup.CustomField, raw string) (map[string]interface{}, error)

CoerceCustomFieldValue turns a command-line string into the request body ClickUp expects for that field's type. Types differ enough — epoch milliseconds for dates, option uuids for labels — that passing a raw string through would silently write the wrong thing.

func FindCustomField added in v0.2.0

func FindCustomField(fields []clickup.CustomField, nameOrID string) (*clickup.CustomField, error)

FindCustomField resolves a field by id, or by name case-insensitively. An ambiguous name is an error rather than a silent first-match.

func FormatCustomFieldValue added in v0.2.0

func FormatCustomFieldValue(f *clickup.CustomField) string

FormatCustomFieldValue renders a field's current value for display.

func OpenStatus added in v0.2.0

func OpenStatus(list *clickup.List) (string, error)

OpenStatus returns the status a list uses to mean "not started" — the first status of type "open" in board order.

Types

type Client

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

Client wraps the ClickUp API client

func NewClient

func NewClient() (*Client, error)

NewClient creates a new API client

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, listID string, options *TaskCreateOptions) (*clickup.Task, error)

CreateTask creates a new task with simplified options

func (*Client) CreateTaskComment

func (c *Client) CreateTaskComment(ctx context.Context, taskID string, text string, assignee string, notifyAll bool) (*clickup.CreateCommentResponse, error)

CreateTaskComment creates a new comment on a task

func (*Client) DeleteTask

func (c *Client) DeleteTask(ctx context.Context, taskID string) error

DeleteTask deletes a task

func (*Client) DeleteTaskComment

func (c *Client) DeleteTaskComment(ctx context.Context, commentID string) error

DeleteTaskComment deletes a comment

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser(ctx context.Context) (*clickup.User, error)

GetCurrentUser returns the authenticated user

func (*Client) GetCustomFields added in v0.2.0

func (c *Client) GetCustomFields(ctx context.Context, listID string) ([]clickup.CustomField, error)

GetCustomFields returns the custom fields accessible from a list. Fields created at space or folder level are included, which is why the same field id comes back for every list beneath that location.

func (*Client) GetFolderlessLists

func (c *Client) GetFolderlessLists(ctx context.Context, spaceID string) ([]clickup.List, error)

GetFolderlessLists returns lists directly in a space (not in folders)

func (*Client) GetFolders

func (c *Client) GetFolders(ctx context.Context, spaceID string) ([]clickup.Folder, error)

GetFolders returns all folders in a space

func (*Client) GetList added in v0.2.0

func (c *Client) GetList(ctx context.Context, listID string) (*clickup.List, error)

GetList returns a single list, including its status set.

func (*Client) GetLists

func (c *Client) GetLists(ctx context.Context, folderID string) ([]clickup.List, error)

GetLists returns all lists in a folder or space

func (*Client) GetSpaces

func (c *Client) GetSpaces(ctx context.Context, workspaceID string) ([]clickup.Space, error)

GetSpaces returns all spaces in a workspace

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, taskID string) (*clickup.Task, error)

GetTask returns a single task

func (*Client) GetTaskComments

func (c *Client) GetTaskComments(ctx context.Context, taskID string) ([]clickup.Comment, error)

GetTaskComments retrieves all comments for a task

func (*Client) GetTasks

func (c *Client) GetTasks(ctx context.Context, listID string, options *TaskQueryOptions) ([]clickup.Task, error)

GetTasks returns tasks based on query options

func (*Client) GetWorkspaceMembers

func (c *Client) GetWorkspaceMembers(ctx context.Context, workspaceID string) ([]clickup.TeamUser, error)

GetWorkspaceMembers returns all members of a workspace

func (*Client) GetWorkspaces

func (c *Client) GetWorkspaces(ctx context.Context) ([]clickup.Team, error)

GetWorkspaces returns all workspaces the user has access to

func (*Client) RemoveCustomFieldValue added in v0.2.0

func (c *Client) RemoveCustomFieldValue(ctx context.Context, taskID string, fieldID string) error

RemoveCustomFieldValue clears a custom field value on a task.

func (*Client) SetCustomFieldValue added in v0.2.0

func (c *Client) SetCustomFieldValue(ctx context.Context, taskID string, fieldID string, value map[string]interface{}) error

SetCustomFieldValue writes a single custom field value on a task. The value map is the request body, e.g. {"value": "https://github.com/owner/repo"} — build it with CoerceCustomFieldValue rather than by hand.

func (*Client) UpdateTask

func (c *Client) UpdateTask(ctx context.Context, taskID string, options *TaskUpdateOptions) (*clickup.Task, error)

UpdateTask updates an existing task with simplified options

func (*Client) UpdateTaskComment

func (c *Client) UpdateTaskComment(ctx context.Context, commentID string, text string, resolved bool) error

UpdateTaskComment updates an existing comment

func (*Client) UserLookup

func (c *Client) UserLookup() *UserLookup

UserLookup returns the user lookup service

type RateLimiter

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

RateLimiter implements a token bucket rate limiter

func NewRateLimiter

func NewRateLimiter(maxRequests int, per time.Duration) *RateLimiter

NewRateLimiter creates a new rate limiter

func (*RateLimiter) Wait

func (r *RateLimiter) Wait(ctx context.Context) error

Wait blocks until a token is available or context is cancelled

type StatusResolver added in v0.2.0

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

StatusResolver resolves the closed/open status for a task's own list, caching per list so bulk operations across one list make a single call.

func NewStatusResolver added in v0.2.0

func NewStatusResolver(client *Client) *StatusResolver

func (*StatusResolver) ClosedStatusForTask added in v0.2.0

func (r *StatusResolver) ClosedStatusForTask(ctx context.Context, taskID string) (string, error)

ClosedStatusForTask returns the done status of the list the task lives in.

func (*StatusResolver) OpenStatusForTask added in v0.2.0

func (r *StatusResolver) OpenStatusForTask(ctx context.Context, taskID string) (string, error)

OpenStatusForTask returns the open status of the list the task lives in.

type TaskCreateOptions

type TaskCreateOptions struct {
	Name        string
	Description string
	Assignees   []string
	Status      string
	Priority    string
	Tags        []string
	DueDate     string
}

TaskCreateOptions represents options for creating a task

type TaskQueryOptions

type TaskQueryOptions struct {
	Page      int
	Assignees []string
	Statuses  []string
	Tags      []string
	Priority  *int
	DueDate   *time.Time
}

TaskQueryOptions represents options for querying tasks

type TaskUpdateOptions

type TaskUpdateOptions struct {
	Name            string
	Description     string
	Status          string
	Priority        string
	Tags            []string
	DueDate         string
	AddAssignees    []string
	RemoveAssignees []string
}

TaskUpdateOptions represents options for updating a task

func (*TaskUpdateOptions) HasUpdates

func (o *TaskUpdateOptions) HasUpdates() bool

HasUpdates checks if any updates are specified

type UserLookup

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

UserLookup provides user ID lookup functionality

func NewUserLookup

func NewUserLookup(client *Client) *UserLookup

NewUserLookup creates a new user lookup service

func (*UserLookup) ConvertUsernamesToIDs

func (ul *UserLookup) ConvertUsernamesToIDs(usernames []string) ([]int, error)

ConvertUsernamesToIDs converts a list of usernames to user IDs

func (*UserLookup) GetAllUsers

func (ul *UserLookup) GetAllUsers() []*clickup.TeamUser

GetAllUsers returns all cached users

func (*UserLookup) LoadWorkspaceUsers

func (ul *UserLookup) LoadWorkspaceUsers(ctx context.Context, workspaceID string) error

LoadWorkspaceUsers loads all users from a workspace into cache

func (*UserLookup) LookupByID

func (ul *UserLookup) LookupByID(userID int) (*clickup.TeamUser, error)

LookupByID finds a user by ID

func (*UserLookup) LookupByUsername

func (ul *UserLookup) LookupByUsername(username string) (*clickup.TeamUser, error)

LookupByUsername finds a user by username (case-insensitive)

Jump to

Keyboard shortcuts

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