Documentation
¶
Overview ¶
Package kanboard provides a Go client for the Kanboard JSON-RPC API.
This library offers both a fluent API for convenient, chainable operations and direct API methods for lower-level access. The client is safe for concurrent use by multiple goroutines.
Quick Start ¶
Create a client with API token authentication:
client := kanboard.NewClient("https://kanboard.example.com").
WithAPIToken("your-api-token")
Authentication ¶
The library supports two authentication methods:
- API Token: Use Client.WithAPIToken for token-based auth (recommended)
- Basic Auth: Use Client.WithBasicAuth for username/password auth
Fluent API ¶
Use Client.Board for project-scoped operations:
board := client.Board(projectID)
tasks, _ := board.GetTasks(ctx, kanboard.StatusActive)
task, _ := board.CreateTaskFromParams(ctx,
kanboard.NewTask("Title").WithDescription("Details"))
Use Client.Task for task-scoped operations:
task := client.Task(taskID) task.MoveToNextColumn(ctx) task.AddTag(ctx, "reviewed") task.AddComment(ctx, userID, "Comment text")
Task Creation ¶
Use TaskParams for fluent task creation:
params := kanboard.NewTask("Title").
WithDescription("Details").
WithPriority(2).
WithTags("urgent", "backend")
Error Handling ¶
The library provides typed errors and helper functions:
task, err := client.GetTask(ctx, taskID)
if kanboard.IsNotFound(err) {
// Handle not found
}
if kanboard.IsUnauthorized(err) {
// Handle auth failure
}
Thread Safety ¶
The Client is safe for concurrent use. Request IDs are generated atomically.
Tag Operations ¶
Warning: Kanboard's setTaskTags API replaces all tags. The TaskScope.AddTag and TaskScope.RemoveTag methods use read-modify-write internally and are not atomic. Concurrent tag modifications may cause data loss.
Index ¶
- Constants
- Variables
- func IsAPIError(err error) bool
- func IsNotFound(err error) bool
- func IsOperationFailed(err error) bool
- func IsUnauthorized(err error) bool
- type APIError
- type Authenticator
- type BoardScope
- func (b *BoardScope) CreateCategory(ctx context.Context, name string, colorID string) (int, error)
- func (b *BoardScope) CreateTask(ctx context.Context, req CreateTaskRequest) (*Task, error)
- func (b *BoardScope) CreateTaskFromParams(ctx context.Context, params *TaskParams) (*Task, error)
- func (b *BoardScope) GetCategories(ctx context.Context) ([]Category, error)
- func (b *BoardScope) GetCategoryByName(ctx context.Context, name string) (*Category, error)
- func (b *BoardScope) GetColumns(ctx context.Context) ([]Column, error)
- func (b *BoardScope) GetTasks(ctx context.Context, status TaskStatus) ([]Task, error)
- func (b *BoardScope) SearchTasks(ctx context.Context, query string) ([]Task, error)
- type Category
- type Client
- func (c *Client) Board(projectID int) *BoardScope
- func (c *Client) CloseTask(ctx context.Context, taskID int) error
- func (c *Client) CreateCategory(ctx context.Context, projectID int, name string, colorID string) (int, error)
- func (c *Client) CreateComment(ctx context.Context, taskID, userID int, content string) (*Comment, error)
- func (c *Client) CreateTag(ctx context.Context, projectID int, name, colorID string) (int, error)
- func (c *Client) CreateTask(ctx context.Context, req CreateTaskRequest) (*Task, error)
- func (c *Client) CreateTaskFile(ctx context.Context, projectID, taskID int, filename string, content []byte) (int, error)
- func (c *Client) CreateTaskLink(ctx context.Context, taskID, oppositeTaskID, linkID int) (int, error)
- func (c *Client) DownloadTaskFile(ctx context.Context, fileID int) ([]byte, error)
- func (c *Client) GetAllCategories(ctx context.Context, projectID int) ([]Category, error)
- func (c *Client) GetAllComments(ctx context.Context, taskID int) ([]Comment, error)
- func (c *Client) GetAllProjects(ctx context.Context) ([]Project, error)
- func (c *Client) GetAllTags(ctx context.Context) ([]Tag, error)
- func (c *Client) GetAllTaskFiles(ctx context.Context, taskID int) ([]TaskFile, error)
- func (c *Client) GetAllTaskLinks(ctx context.Context, taskID int) ([]TaskLink, error)
- func (c *Client) GetAllTasks(ctx context.Context, projectID int, status TaskStatus) ([]Task, error)
- func (c *Client) GetCategory(ctx context.Context, categoryID int) (*Category, error)
- func (c *Client) GetCategoryByName(ctx context.Context, projectID int, name string) (*Category, error)
- func (c *Client) GetColorList(ctx context.Context) (map[string]string, error)
- func (c *Client) GetColumn(ctx context.Context, columnID int) (*Column, error)
- func (c *Client) GetColumns(ctx context.Context, projectID int) ([]Column, error)
- func (c *Client) GetComment(ctx context.Context, commentID int) (*Comment, error)
- func (c *Client) GetProjectByID(ctx context.Context, projectID int) (*Project, error)
- func (c *Client) GetProjectByName(ctx context.Context, name string) (*Project, error)
- func (c *Client) GetTagsByProject(ctx context.Context, projectID int) ([]Tag, error)
- func (c *Client) GetTask(ctx context.Context, taskID int) (*Task, error)
- func (c *Client) GetTaskByReference(ctx context.Context, projectID int, reference string) (*Task, error)
- func (c *Client) GetTaskFile(ctx context.Context, fileID int) (*TaskFile, error)
- func (c *Client) GetTaskTags(ctx context.Context, taskID int) (map[int]string, error)
- func (c *Client) GetTimezone(ctx context.Context) (string, error)
- func (c *Client) MoveTaskPosition(ctx context.Context, projectID, taskID, columnID, position, swimlaneID int) error
- func (c *Client) MoveTaskToProject(ctx context.Context, taskID, projectID int) error
- func (c *Client) OpenTask(ctx context.Context, taskID int) error
- func (c *Client) RemoveAllTaskFiles(ctx context.Context, taskID int) error
- func (c *Client) RemoveCategory(ctx context.Context, categoryID int) error
- func (c *Client) RemoveComment(ctx context.Context, commentID int) error
- func (c *Client) RemoveTag(ctx context.Context, tagID int) error
- func (c *Client) RemoveTaskFile(ctx context.Context, fileID int) error
- func (c *Client) RemoveTaskLink(ctx context.Context, taskLinkID int) error
- func (c *Client) SearchTasks(ctx context.Context, projectID int, query string) ([]Task, error)
- func (c *Client) SearchTasksGlobally(ctx context.Context, query string) ([]Task, error)
- func (c *Client) SetTaskTags(ctx context.Context, projectID, taskID int, tags []string) error
- func (c *Client) Task(taskID int) *TaskScope
- func (c *Client) UpdateCategory(ctx context.Context, categoryID int, name string, colorID string) error
- func (c *Client) UpdateComment(ctx context.Context, commentID int, content string) error
- func (c *Client) UpdateTag(ctx context.Context, tagID int, name, colorID string) error
- func (c *Client) UpdateTask(ctx context.Context, req UpdateTaskRequest) error
- func (c *Client) UpdateTaskFromParams(ctx context.Context, taskID int, params *TaskUpdateParams) error
- func (c *Client) WithAPIToken(token string) *Client
- func (c *Client) WithAPITokenUser(token, user string) *Client
- func (c *Client) WithAuthHeader(headerName string) *Client
- func (c *Client) WithBasicAuth(username, password string) *Client
- func (c *Client) WithHTTPClient(client *http.Client) *Client
- func (c *Client) WithLogger(logger *slog.Logger) *Client
- func (c *Client) WithTimeout(timeout time.Duration) *Client
- func (c *Client) WithTimezone() *Client
- type Column
- type Comment
- type CreateTaskRequest
- type IntOrFalse
- type JSONRPCError
- type JSONRPCRequest
- type JSONRPCResponse
- type OperationFailedError
- type Project
- type StringBool
- type StringInt
- type StringInt64
- type Tag
- type Task
- type TaskFile
- type TaskLink
- type TaskParams
- func (p *TaskParams) InColumn(columnID int) *TaskParams
- func (p *TaskParams) InSwimlane(swimlaneID int) *TaskParams
- func (p *TaskParams) WithCategory(categoryID int) *TaskParams
- func (p *TaskParams) WithColor(colorID string) *TaskParams
- func (p *TaskParams) WithCreator(creatorID int) *TaskParams
- func (p *TaskParams) WithDescription(desc string) *TaskParams
- func (p *TaskParams) WithDueDate(date time.Time) *TaskParams
- func (p *TaskParams) WithOwner(ownerID int) *TaskParams
- func (p *TaskParams) WithPriority(priority int) *TaskParams
- func (p *TaskParams) WithReference(ref string) *TaskParams
- func (p *TaskParams) WithScore(score int) *TaskParams
- func (p *TaskParams) WithStartDate(date time.Time) *TaskParams
- func (p *TaskParams) WithTags(tags ...string) *TaskParams
- type TaskScope
- func (t *TaskScope) AddComment(ctx context.Context, userID int, content string) (*Comment, error)
- func (t *TaskScope) AddTag(ctx context.Context, tag string) error
- func (t *TaskScope) ClearTags(ctx context.Context) error
- func (t *TaskScope) Close(ctx context.Context) error
- func (t *TaskScope) DownloadFile(ctx context.Context, fileID int) ([]byte, error)
- func (t *TaskScope) Get(ctx context.Context) (*Task, error)
- func (t *TaskScope) GetComments(ctx context.Context) ([]Comment, error)
- func (t *TaskScope) GetFile(ctx context.Context, fileID int) (*TaskFile, error)
- func (t *TaskScope) GetFiles(ctx context.Context) ([]TaskFile, error)
- func (t *TaskScope) GetLinks(ctx context.Context) ([]TaskLink, error)
- func (t *TaskScope) GetTags(ctx context.Context) (map[int]string, error)
- func (t *TaskScope) HasTag(ctx context.Context, tag string) (bool, error)
- func (t *TaskScope) LinkTo(ctx context.Context, oppositeTaskID, linkID int) error
- func (t *TaskScope) MoveToColumn(ctx context.Context, columnID int) error
- func (t *TaskScope) MoveToNextColumn(ctx context.Context) error
- func (t *TaskScope) MoveToPreviousColumn(ctx context.Context) error
- func (t *TaskScope) MoveToProject(ctx context.Context, projectID int) error
- func (t *TaskScope) Open(ctx context.Context) error
- func (t *TaskScope) RemoveAllFiles(ctx context.Context) error
- func (t *TaskScope) RemoveFile(ctx context.Context, fileID int) error
- func (t *TaskScope) RemoveTag(ctx context.Context, tag string) error
- func (t *TaskScope) SetTags(ctx context.Context, tags ...string) error
- func (t *TaskScope) Update(ctx context.Context, params *TaskUpdateParams) error
- func (t *TaskScope) UploadFile(ctx context.Context, filename string, content []byte) (int, error)
- type TaskStatus
- type TaskUpdateParams
- func (p *TaskUpdateParams) ClearCategory() *TaskUpdateParams
- func (p *TaskUpdateParams) ClearDueDate() *TaskUpdateParams
- func (p *TaskUpdateParams) ClearOwner() *TaskUpdateParams
- func (p *TaskUpdateParams) ClearStartDate() *TaskUpdateParams
- func (p *TaskUpdateParams) SetCategory(categoryID int) *TaskUpdateParams
- func (p *TaskUpdateParams) SetColor(colorID string) *TaskUpdateParams
- func (p *TaskUpdateParams) SetDescription(desc string) *TaskUpdateParams
- func (p *TaskUpdateParams) SetDueDate(date time.Time) *TaskUpdateParams
- func (p *TaskUpdateParams) SetOwner(ownerID int) *TaskUpdateParams
- func (p *TaskUpdateParams) SetPriority(priority int) *TaskUpdateParams
- func (p *TaskUpdateParams) SetReference(ref string) *TaskUpdateParams
- func (p *TaskUpdateParams) SetScore(score int) *TaskUpdateParams
- func (p *TaskUpdateParams) SetStartDate(date time.Time) *TaskUpdateParams
- func (p *TaskUpdateParams) SetTags(tags ...string) *TaskUpdateParams
- func (p *TaskUpdateParams) SetTitle(title string) *TaskUpdateParams
- type Timestamp
- type UpdateTaskRequest
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout is the default HTTP timeout for API requests.
Variables ¶
var ( // ErrConnectionFailed indicates a connection to the Kanboard server failed. ErrConnectionFailed = errors.New("connection to Kanboard server failed") // ErrTimeout indicates a request timed out. ErrTimeout = errors.New("request timed out") // ErrTooManyRedirects indicates the server returned too many redirects. ErrTooManyRedirects = errors.New("too many redirects") )
Network errors
var ( ErrUnauthorized = errors.New("authentication failed: invalid credentials") // ErrForbidden indicates insufficient permissions. ErrForbidden = errors.New("access forbidden: insufficient permissions") )
Authentication errors
var ( // ErrNotFound indicates a resource was not found. ErrNotFound = errors.New("resource not found") // ErrProjectNotFound indicates the specified project was not found. ErrProjectNotFound = errors.New("project not found") // ErrTaskNotFound indicates the specified task was not found. ErrTaskNotFound = errors.New("task not found") // ErrColumnNotFound indicates the specified column was not found. ErrColumnNotFound = errors.New("column not found") // ErrCommentNotFound indicates the specified comment was not found. ErrCommentNotFound = errors.New("comment not found") // ErrCategoryNotFound indicates the specified category was not found. ErrCategoryNotFound = errors.New("category not found") )
Resource errors
var ( // ErrAlreadyInLastColumn indicates a task is already in the last column. ErrAlreadyInLastColumn = errors.New("task is already in the last column") // ErrAlreadyInFirstColumn indicates a task is already in the first column. ErrAlreadyInFirstColumn = errors.New("task is already in the first column") // ErrTaskClosed indicates a task is already closed. ErrTaskClosed = errors.New("task is already closed") // ErrTaskOpen indicates a task is already open. ErrTaskOpen = errors.New("task is already open") )
Logic errors
var ( // ErrEmptyTitle indicates a task title cannot be empty. ErrEmptyTitle = errors.New("task title cannot be empty") // ErrInvalidProjectID indicates an invalid project ID was provided. ErrInvalidProjectID = errors.New("invalid project ID") )
Validation errors
Functions ¶
func IsAPIError ¶
IsAPIError returns true if the error is an APIError from the Kanboard API.
func IsNotFound ¶
IsNotFound returns true if the error indicates a resource was not found.
func IsOperationFailed ¶ added in v1.0.1
IsOperationFailed returns true if the error is an OperationFailedError.
func IsUnauthorized ¶
IsUnauthorized returns true if the error indicates an authentication failure.
Types ¶
type Authenticator ¶
Authenticator applies authentication to HTTP requests.
type BoardScope ¶
type BoardScope struct {
// contains filtered or unexported fields
}
BoardScope provides fluent project-scoped operations.
func (*BoardScope) CreateCategory ¶ added in v1.3.0
CreateCategory creates a new category in the project and returns its ID.
func (*BoardScope) CreateTask ¶
func (b *BoardScope) CreateTask(ctx context.Context, req CreateTaskRequest) (*Task, error)
CreateTask creates a new task in the project. The ProjectID field in the request is overwritten with the board's project ID.
func (*BoardScope) CreateTaskFromParams ¶
func (b *BoardScope) CreateTaskFromParams(ctx context.Context, params *TaskParams) (*Task, error)
CreateTaskFromParams creates a new task in the project using TaskParams. This provides a fluent interface for task creation.
func (*BoardScope) GetCategories ¶
func (b *BoardScope) GetCategories(ctx context.Context) ([]Category, error)
GetCategories returns all categories for the project.
func (*BoardScope) GetCategoryByName ¶ added in v1.3.0
GetCategoryByName returns a category by name within the project.
func (*BoardScope) GetColumns ¶
func (b *BoardScope) GetColumns(ctx context.Context) ([]Column, error)
GetColumns returns all columns for the project, sorted by position.
func (*BoardScope) GetTasks ¶
func (b *BoardScope) GetTasks(ctx context.Context, status TaskStatus) ([]Task, error)
GetTasks returns all tasks for the project with the specified status.
func (*BoardScope) SearchTasks ¶
SearchTasks searches for tasks in the project using Kanboard query syntax.
type Category ¶
type Category struct {
ID StringInt `json:"id"`
Name string `json:"name"`
ProjectID StringInt `json:"project_id"`
ColorID string `json:"color_id"`
}
Category represents a Kanboard category.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Kanboard API client. It is safe for concurrent use by multiple goroutines.
func NewClient ¶
NewClient creates a new Kanboard API client. The baseURL should be the base URL of the Kanboard instance (e.g., "https://kanboard.example.com"). The path /jsonrpc.php is appended automatically. Supports subdirectory installations (e.g., "https://example.com/kanboard" → POST https://example.com/kanboard/jsonrpc.php).
func (*Client) Board ¶
func (c *Client) Board(projectID int) *BoardScope
Board returns a BoardScope for fluent project-scoped operations.
func (*Client) CloseTask ¶
CloseTask closes a task (sets it to inactive). Returns ErrTaskClosed if the task is already closed.
func (*Client) CreateCategory ¶ added in v1.3.0
func (c *Client) CreateCategory(ctx context.Context, projectID int, name string, colorID string) (int, error)
CreateCategory creates a new category and returns its ID.
func (*Client) CreateComment ¶
func (c *Client) CreateComment(ctx context.Context, taskID, userID int, content string) (*Comment, error)
CreateComment creates a new comment on a task and returns the created comment.
func (*Client) CreateTask ¶
CreateTask creates a new task and returns the created task.
func (*Client) CreateTaskFile ¶
func (c *Client) CreateTaskFile(ctx context.Context, projectID, taskID int, filename string, content []byte) (int, error)
CreateTaskFile uploads a file to a task. The file content is automatically base64 encoded. Returns the ID of the created file.
func (*Client) CreateTaskLink ¶
func (c *Client) CreateTaskLink(ctx context.Context, taskID, oppositeTaskID, linkID int) (int, error)
CreateTaskLink creates a link between two tasks. The linkID specifies the type of relationship (e.g., "blocks", "is blocked by"). Returns the ID of the created link.
func (*Client) DownloadTaskFile ¶
DownloadTaskFile downloads a file's content by its ID. The content is returned as raw bytes (decoded from base64).
func (*Client) GetAllCategories ¶
GetAllCategories returns all categories for a project.
func (*Client) GetAllComments ¶
GetAllComments returns all comments for a task.
func (*Client) GetAllProjects ¶
GetAllProjects returns all projects accessible to the authenticated user.
func (*Client) GetAllTags ¶
GetAllTags returns all tags in the system.
func (*Client) GetAllTaskFiles ¶
GetAllTaskFiles returns all files attached to a task.
func (*Client) GetAllTaskLinks ¶
GetAllTaskLinks returns all links for a task.
func (*Client) GetAllTasks ¶
GetAllTasks returns all tasks for a project with the specified status.
func (*Client) GetCategory ¶
GetCategory returns a category by its ID. Returns ErrCategoryNotFound if the category does not exist.
func (*Client) GetCategoryByName ¶ added in v1.3.0
func (c *Client) GetCategoryByName(ctx context.Context, projectID int, name string) (*Category, error)
GetCategoryByName returns a category by name within a project. Returns ErrCategoryNotFound if no category matches.
func (*Client) GetColorList ¶ added in v1.0.1
GetColorList returns the available task colors. Returns a map of color_id to display name (e.g., "yellow" -> "Yellow").
func (*Client) GetColumn ¶
GetColumn returns a column by its ID. Returns ErrColumnNotFound if the column does not exist.
func (*Client) GetColumns ¶
GetColumns returns all columns for a project, sorted by position.
func (*Client) GetComment ¶
GetComment returns a comment by its ID. Returns ErrCommentNotFound if the comment does not exist.
func (*Client) GetProjectByID ¶
GetProjectByID returns a project by its ID. Returns ErrProjectNotFound if the project does not exist.
func (*Client) GetProjectByName ¶
GetProjectByName returns a project by its name. Returns ErrProjectNotFound if the project does not exist.
func (*Client) GetTagsByProject ¶
GetTagsByProject returns all tags for a specific project.
func (*Client) GetTask ¶
GetTask returns a task by its ID. Returns ErrTaskNotFound if the task does not exist.
func (*Client) GetTaskByReference ¶ added in v1.4.0
func (c *Client) GetTaskByReference(ctx context.Context, projectID int, reference string) (*Task, error)
GetTaskByReference returns a task by its external reference within a project. Returns ErrTaskNotFound if no task matches the reference.
func (*Client) GetTaskFile ¶ added in v1.1.0
GetTaskFile returns a single file's metadata by its ID.
func (*Client) GetTaskTags ¶
GetTaskTags returns the tags assigned to a task as a map of tagID to tag name.
func (*Client) GetTimezone ¶ added in v1.5.0
GetTimezone returns the server's configured timezone string (e.g., "UTC", "Europe/Berlin").
func (*Client) MoveTaskPosition ¶
func (c *Client) MoveTaskPosition(ctx context.Context, projectID, taskID, columnID, position, swimlaneID int) error
MoveTaskPosition moves a task to a specific position within a column and swimlane. Use position=1 for first position, position=0 to append at end.
func (*Client) MoveTaskToProject ¶
MoveTaskToProject moves a task to a different project.
func (*Client) OpenTask ¶
OpenTask opens a task (sets it to active). Returns ErrTaskOpen if the task is already open.
func (*Client) RemoveAllTaskFiles ¶ added in v1.1.0
RemoveAllTaskFiles removes all files attached to a task.
func (*Client) RemoveCategory ¶ added in v1.3.0
RemoveCategory deletes a category.
func (*Client) RemoveComment ¶
RemoveComment deletes a comment.
func (*Client) RemoveTaskFile ¶
RemoveTaskFile deletes a file from a task.
func (*Client) RemoveTaskLink ¶
RemoveTaskLink deletes a task link.
func (*Client) SearchTasks ¶
SearchTasks searches for tasks in a project using Kanboard's query syntax. The query supports filters like: status:open, assignee:me, color:red, etc.
func (*Client) SearchTasksGlobally ¶
SearchTasksGlobally searches for tasks across all accessible projects. The search is executed in parallel across all projects using errgroup. If any project search fails, all ongoing searches are cancelled.
func (*Client) SetTaskTags ¶
SetTaskTags sets the tags for a task, replacing all existing tags. Tags are specified by name. Non-existent tags will be auto-created.
func (*Client) UpdateCategory ¶ added in v1.3.0
func (c *Client) UpdateCategory(ctx context.Context, categoryID int, name string, colorID string) error
UpdateCategory updates a category's name and optionally its color.
func (*Client) UpdateComment ¶
UpdateComment updates the content of a comment.
func (*Client) UpdateTask ¶
func (c *Client) UpdateTask(ctx context.Context, req UpdateTaskRequest) error
UpdateTask updates an existing task. Only non-nil fields in the request will be updated.
func (*Client) UpdateTaskFromParams ¶
func (c *Client) UpdateTaskFromParams(ctx context.Context, taskID int, params *TaskUpdateParams) error
UpdateTaskFromParams updates an existing task using TaskUpdateParams. This provides a fluent interface for task updates.
func (*Client) WithAPIToken ¶
WithAPIToken configures the client to use API token authentication. Uses "jsonrpc" as the username for HTTP Basic Auth.
func (*Client) WithAPITokenUser ¶
WithAPITokenUser configures the client to use API token authentication with a custom username. If user is empty, "jsonrpc" will be used as the default.
func (*Client) WithAuthHeader ¶
WithAuthHeader configures a custom header name for authentication. If not set, the standard "Authorization" header is used. This must be called before configuring authentication (WithAPIToken, WithBasicAuth, etc.). Example: WithAuthHeader("X-API-Auth")
func (*Client) WithBasicAuth ¶
WithBasicAuth configures the client to use username/password authentication.
func (*Client) WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client. This replaces the default client entirely, including timeout and redirect settings. Note: The custom client's CheckRedirect handler will be used instead of the built-in redirect handler that preserves authentication headers.
func (*Client) WithLogger ¶
WithLogger sets the logger for debug output. If set, the client will log request/response details at debug level.
func (*Client) WithTimeout ¶
WithTimeout sets the HTTP client timeout. This creates a new HTTP client with the specified timeout.
func (*Client) WithTimezone ¶ added in v1.5.0
WithTimezone enables automatic timestamp conversion. On the first API call, the client fetches the server's timezone via getTimezone and converts all Timestamp fields in responses to that timezone.
type Column ¶
type Column struct {
ID StringInt `json:"id"`
Title string `json:"title"`
Position StringInt `json:"position"`
ProjectID StringInt `json:"project_id"`
TaskLimit StringInt `json:"task_limit"`
Description string `json:"description"`
}
Column represents a Kanboard column.
type Comment ¶
type Comment struct {
ID StringInt `json:"id"`
TaskID StringInt `json:"task_id"`
UserID StringInt `json:"user_id"`
DateCreation Timestamp `json:"date_creation"`
Content string `json:"comment"`
Username string `json:"username"`
Name string `json:"name"`
Email string `json:"email"`
AvatarPath string `json:"avatar_path"`
}
Comment represents a Kanboard comment.
type CreateTaskRequest ¶
type CreateTaskRequest struct {
Title string `json:"title"`
ProjectID int `json:"project_id"`
Description string `json:"description,omitempty"`
ColumnID int `json:"column_id,omitempty"`
OwnerID int `json:"owner_id,omitempty"`
CreatorID int `json:"creator_id,omitempty"`
ColorID string `json:"color_id,omitempty"`
CategoryID int `json:"category_id,omitempty"`
DateDue int64 `json:"date_due,omitempty"`
Score int `json:"score,omitempty"`
SwimlaneID int `json:"swimlane_id,omitempty"`
Priority int `json:"priority,omitempty"`
Reference string `json:"reference,omitempty"`
Tags []string `json:"tags,omitempty"`
DateStarted int64 `json:"date_started,omitempty"`
RecurrenceStatus int `json:"recurrence_status,omitempty"`
RecurrenceTrigger int `json:"recurrence_trigger,omitempty"`
RecurrenceFactor int `json:"recurrence_factor,omitempty"`
RecurrenceTimeframe int `json:"recurrence_timeframe,omitempty"`
RecurrenceBasedate int `json:"recurrence_basedate,omitempty"`
}
CreateTaskRequest is the request payload for creating a task.
type IntOrFalse ¶
type IntOrFalse int
IntOrFalse is an int that can be unmarshaled from a JSON int or false. Kanboard API returns false on failure, int (ID) on success for create operations.
func (*IntOrFalse) UnmarshalJSON ¶
func (i *IntOrFalse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type JSONRPCError ¶
JSONRPCError represents a JSON-RPC 2.0 error.
func (*JSONRPCError) Error ¶
func (e *JSONRPCError) Error() string
Error implements the error interface.
type JSONRPCRequest ¶
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
ID int64 `json:"id"`
Params interface{} `json:"params,omitempty"`
}
JSONRPCRequest represents a JSON-RPC 2.0 request.
type JSONRPCResponse ¶
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"`
ID int64 `json:"id"`
Result json.RawMessage `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
JSONRPCResponse represents a JSON-RPC 2.0 response.
type OperationFailedError ¶ added in v1.0.1
OperationFailedError represents an API operation that returned false without details. The Kanboard API often returns only true/false without explaining why an operation failed.
func (*OperationFailedError) Error ¶ added in v1.0.1
func (e *OperationFailedError) Error() string
Error implements the error interface.
type Project ¶
type Project struct {
ID StringInt `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
IsActive StringBool `json:"is_active"`
Token string `json:"token"`
LastModified Timestamp `json:"last_modified"`
IsPublic StringBool `json:"is_public"`
IsPrivate StringBool `json:"is_private"`
DefaultSwimlane string `json:"default_swimlane"`
ShowDefaultSwimlane StringBool `json:"show_default_swimlane"`
Identifier string `json:"identifier"`
StartDate Timestamp `json:"start_date"`
EndDate Timestamp `json:"end_date"`
OwnerID StringInt `json:"owner_id"`
PriorityDefault StringInt `json:"priority_default"`
PriorityStart StringInt `json:"priority_start"`
PriorityEnd StringInt `json:"priority_end"`
Email string `json:"email"`
}
Project represents a Kanboard project (board).
type StringBool ¶
type StringBool bool
StringBool is a bool that can be unmarshaled from a string "0" or "1".
func (StringBool) MarshalJSON ¶
func (b StringBool) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*StringBool) UnmarshalJSON ¶
func (b *StringBool) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type StringInt ¶
type StringInt int
StringInt is an int that can be unmarshaled from a JSON string.
func (*StringInt) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type StringInt64 ¶
type StringInt64 int64
StringInt64 is an int64 that can be unmarshaled from a JSON string.
func (*StringInt64) UnmarshalJSON ¶
func (i *StringInt64) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Tag ¶
type Tag struct {
ID StringInt `json:"id"`
Name string `json:"name"`
ProjectID StringInt `json:"project_id"`
ColorID string `json:"color_id"`
}
Tag represents a Kanboard tag.
type Task ¶
type Task struct {
ID StringInt `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
DateCreation Timestamp `json:"date_creation"`
DateModification Timestamp `json:"date_modification"`
DateCompleted Timestamp `json:"date_completed"`
DateStarted Timestamp `json:"date_started"`
DateDue Timestamp `json:"date_due"`
DateMoved Timestamp `json:"date_moved"`
ColorID string `json:"color_id"`
ProjectID StringInt `json:"project_id"`
ColumnID StringInt `json:"column_id"`
OwnerID StringInt `json:"owner_id"`
CreatorID StringInt `json:"creator_id"`
Position StringInt `json:"position"`
IsActive StringBool `json:"is_active"`
Score StringInt `json:"score"`
CategoryID StringInt `json:"category_id"`
SwimlaneID StringInt `json:"swimlane_id"`
Priority StringInt `json:"priority"`
Reference string `json:"reference"`
RecurrenceStatus StringInt `json:"recurrence_status"`
RecurrenceTrigger StringInt `json:"recurrence_trigger"`
RecurrenceFactor StringInt `json:"recurrence_factor"`
RecurrenceTimeframe StringInt `json:"recurrence_timeframe"`
RecurrenceBasedate StringInt `json:"recurrence_basedate"`
RecurrenceParent StringInt `json:"recurrence_parent"`
RecurrenceChild StringInt `json:"recurrence_child"`
}
Task represents a Kanboard task.
type TaskFile ¶
type TaskFile struct {
ID StringInt `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
IsImage StringBool `json:"is_image"`
TaskID StringInt `json:"task_id"`
DateCreation Timestamp `json:"date_creation"`
UserID StringInt `json:"user_id"`
Size StringInt64 `json:"size"`
Username string `json:"username"` // Only returned by getAllTaskFiles
UserName string `json:"user_name"` // Only returned by getAllTaskFiles
}
TaskFile represents a file attached to a task.
type TaskLink ¶
type TaskLink struct {
ID StringInt `json:"id"`
LinkID StringInt `json:"link_id"`
TaskID StringInt `json:"task_id"`
OppositeTaskID StringInt `json:"opposite_task_id"`
Label string `json:"label"`
Title string `json:"title"`
}
TaskLink represents a link between two tasks.
type TaskParams ¶
type TaskParams struct {
// contains filtered or unexported fields
}
TaskParams is a fluent builder for task creation configuration. It is a pure configuration object with no I/O.
func NewTask ¶
func NewTask(title string) *TaskParams
NewTask creates a new TaskParams with the given title.
func (*TaskParams) InColumn ¶
func (p *TaskParams) InColumn(columnID int) *TaskParams
InColumn sets the column ID for the task.
func (*TaskParams) InSwimlane ¶
func (p *TaskParams) InSwimlane(swimlaneID int) *TaskParams
InSwimlane sets the swimlane ID for the task.
func (*TaskParams) WithCategory ¶
func (p *TaskParams) WithCategory(categoryID int) *TaskParams
WithCategory sets the category ID for the task.
func (*TaskParams) WithColor ¶
func (p *TaskParams) WithColor(colorID string) *TaskParams
WithColor sets the color ID for the task.
func (*TaskParams) WithCreator ¶
func (p *TaskParams) WithCreator(creatorID int) *TaskParams
WithCreator sets the creator ID for the task.
func (*TaskParams) WithDescription ¶
func (p *TaskParams) WithDescription(desc string) *TaskParams
WithDescription sets the task description.
func (*TaskParams) WithDueDate ¶
func (p *TaskParams) WithDueDate(date time.Time) *TaskParams
WithDueDate sets the due date for the task.
func (*TaskParams) WithOwner ¶
func (p *TaskParams) WithOwner(ownerID int) *TaskParams
WithOwner sets the owner (assignee) ID for the task.
func (*TaskParams) WithPriority ¶
func (p *TaskParams) WithPriority(priority int) *TaskParams
WithPriority sets the priority for the task.
func (*TaskParams) WithReference ¶
func (p *TaskParams) WithReference(ref string) *TaskParams
WithReference sets the external reference for the task.
func (*TaskParams) WithScore ¶
func (p *TaskParams) WithScore(score int) *TaskParams
WithScore sets the complexity score for the task.
func (*TaskParams) WithStartDate ¶
func (p *TaskParams) WithStartDate(date time.Time) *TaskParams
WithStartDate sets the start date for the task.
func (*TaskParams) WithTags ¶
func (p *TaskParams) WithTags(tags ...string) *TaskParams
WithTags sets the tags for the task.
type TaskScope ¶
type TaskScope struct {
// contains filtered or unexported fields
}
TaskScope provides fluent task-scoped operations.
func (*TaskScope) AddComment ¶
AddComment adds a comment to this task and returns the created comment. The userID is the ID of the user creating the comment.
func (*TaskScope) AddTag ¶
AddTag adds a tag to this task using a read-modify-write pattern. If the tag already exists on the task, this is a no-op (idempotent).
WARNING: This operation is not atomic. Concurrent tag modifications may cause data loss.
func (*TaskScope) ClearTags ¶
ClearTags removes all tags from this task.
WARNING: This operation is not atomic. Concurrent tag modifications may cause data loss.
func (*TaskScope) DownloadFile ¶ added in v1.1.0
DownloadFile downloads a file's content by ID.
func (*TaskScope) GetComments ¶
GetComments returns all comments for this task.
func (*TaskScope) GetTags ¶
GetTags returns the tags assigned to this task as a map of tagID to tag name.
func (*TaskScope) LinkTo ¶
LinkTo creates a link from this task to another task. The linkID specifies the type of relationship (e.g., "blocks", "is blocked by").
func (*TaskScope) MoveToColumn ¶
MoveToColumn moves the task to a different column. The task is placed at the end of the column (position=0). Requires the project ID to be fetched from the task.
func (*TaskScope) MoveToNextColumn ¶
MoveToNextColumn moves the task to the next column in the workflow. Columns are ordered by their position field. Returns ErrAlreadyInLastColumn if the task is already in the last column.
func (*TaskScope) MoveToPreviousColumn ¶
MoveToPreviousColumn moves the task to the previous column in the workflow. Columns are ordered by their position field. Returns ErrAlreadyInFirstColumn if the task is already in the first column.
func (*TaskScope) MoveToProject ¶
MoveToProject moves the task to a different project.
func (*TaskScope) RemoveAllFiles ¶ added in v1.1.0
RemoveAllFiles removes all files from this task.
func (*TaskScope) RemoveFile ¶ added in v1.1.0
RemoveFile removes a file by ID.
func (*TaskScope) RemoveTag ¶
RemoveTag removes a tag from this task using a read-modify-write pattern. If the tag doesn't exist on the task, this is a no-op (idempotent).
WARNING: This operation is not atomic. Concurrent tag modifications may cause data loss.
func (*TaskScope) SetTags ¶
SetTags sets the tags for this task, replacing all existing tags. Tags are specified by name. Non-existent tags will be auto-created.
WARNING: This operation is not atomic. Concurrent tag modifications may cause data loss.
type TaskStatus ¶
type TaskStatus int
TaskStatus represents the status of a task.
const ( // StatusActive represents an open/active task. StatusActive TaskStatus = 1 // StatusInactive represents a closed/inactive task. StatusInactive TaskStatus = 0 )
type TaskUpdateParams ¶
type TaskUpdateParams struct {
// contains filtered or unexported fields
}
TaskUpdateParams is a fluent builder for task update configuration. Only set fields are included in the update request.
func NewTaskUpdate ¶
func NewTaskUpdate() *TaskUpdateParams
NewTaskUpdate creates a new TaskUpdateParams.
func (*TaskUpdateParams) ClearCategory ¶
func (p *TaskUpdateParams) ClearCategory() *TaskUpdateParams
ClearCategory removes the category from the task.
func (*TaskUpdateParams) ClearDueDate ¶
func (p *TaskUpdateParams) ClearDueDate() *TaskUpdateParams
ClearDueDate clears the due date from the task.
func (*TaskUpdateParams) ClearOwner ¶
func (p *TaskUpdateParams) ClearOwner() *TaskUpdateParams
ClearOwner removes the owner from the task.
func (*TaskUpdateParams) ClearStartDate ¶
func (p *TaskUpdateParams) ClearStartDate() *TaskUpdateParams
ClearStartDate clears the start date from the task.
func (*TaskUpdateParams) SetCategory ¶
func (p *TaskUpdateParams) SetCategory(categoryID int) *TaskUpdateParams
SetCategory sets the category ID for the task.
func (*TaskUpdateParams) SetColor ¶
func (p *TaskUpdateParams) SetColor(colorID string) *TaskUpdateParams
SetColor sets the color ID for the task.
func (*TaskUpdateParams) SetDescription ¶
func (p *TaskUpdateParams) SetDescription(desc string) *TaskUpdateParams
SetDescription sets the task description.
func (*TaskUpdateParams) SetDueDate ¶
func (p *TaskUpdateParams) SetDueDate(date time.Time) *TaskUpdateParams
SetDueDate sets the due date for the task.
func (*TaskUpdateParams) SetOwner ¶
func (p *TaskUpdateParams) SetOwner(ownerID int) *TaskUpdateParams
SetOwner sets the owner (assignee) ID for the task.
func (*TaskUpdateParams) SetPriority ¶
func (p *TaskUpdateParams) SetPriority(priority int) *TaskUpdateParams
SetPriority sets the priority for the task.
func (*TaskUpdateParams) SetReference ¶
func (p *TaskUpdateParams) SetReference(ref string) *TaskUpdateParams
SetReference sets the external reference for the task.
func (*TaskUpdateParams) SetScore ¶
func (p *TaskUpdateParams) SetScore(score int) *TaskUpdateParams
SetScore sets the complexity score for the task.
func (*TaskUpdateParams) SetStartDate ¶
func (p *TaskUpdateParams) SetStartDate(date time.Time) *TaskUpdateParams
SetStartDate sets the start date for the task.
func (*TaskUpdateParams) SetTags ¶
func (p *TaskUpdateParams) SetTags(tags ...string) *TaskUpdateParams
SetTags sets the tags for the task. This replaces all existing tags on the task. Call with no arguments to clear all tags.
func (*TaskUpdateParams) SetTitle ¶
func (p *TaskUpdateParams) SetTitle(title string) *TaskUpdateParams
SetTitle sets the task title.
type Timestamp ¶
Timestamp wraps time.Time and handles Kanboard's Unix timestamp JSON format. Kanboard returns timestamps as Unix integers, with 0 or empty strings for null values.
func (Timestamp) MarshalJSON ¶
MarshalJSON implements json.Marshaler. Returns 0 for zero time, otherwise returns Unix timestamp.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. Supports Unix timestamps as integers, empty strings, "0" strings, and zero values.
type UpdateTaskRequest ¶
type UpdateTaskRequest struct {
ID int `json:"id"`
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
ColorID *string `json:"color_id,omitempty"`
OwnerID *int `json:"owner_id,omitempty"`
CategoryID *int `json:"category_id,omitempty"`
DateDue *int64 `json:"date_due,omitempty"`
Score *int `json:"score,omitempty"`
Priority *int `json:"priority,omitempty"`
Reference *string `json:"reference,omitempty"`
DateStarted *int64 `json:"date_started,omitempty"`
RecurrenceStatus *int `json:"recurrence_status,omitempty"`
RecurrenceTrigger *int `json:"recurrence_trigger,omitempty"`
RecurrenceFactor *int `json:"recurrence_factor,omitempty"`
RecurrenceTimeframe *int `json:"recurrence_timeframe,omitempty"`
RecurrenceBasedate *int `json:"recurrence_basedate,omitempty"`
Tags []string `json:"tags,omitempty"`
}
UpdateTaskRequest is the request payload for updating a task. Pointer fields allow distinguishing between "not set" and "set to zero value".
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
basic
command
Example: basic demonstrates basic client setup and simple operations.
|
Example: basic demonstrates basic client setup and simple operations. |
|
fluent
command
Example: fluent demonstrates the fluent API for task management.
|
Example: fluent demonstrates the fluent API for task management. |
|
search
command
Example: search demonstrates search functionality.
|
Example: search demonstrates search functionality. |