api

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAgentWebSocketURL

func BuildAgentWebSocketURL(baseURL string, token string) (string, error)

func ConnectStream

func ConnectStream(ctx context.Context, streamURL string) (*websocket.Conn, error)

func SendStreamChunk

func SendStreamChunk(ctx context.Context, conn StreamConn, cardID, text, chunkType string, sequence int) error

Types

type APIError

type APIError struct {
	Message    string
	Code       string
	StatusCode int
}

func (*APIError) Error

func (e *APIError) Error() string

type ActivityOptions

type ActivityOptions struct {
	Since  string
	Offset int
	Limit  int
	Actor  string
	Source string
	Period string
	Board  string
}

type BoardLabelCatalog added in v0.10.0

type BoardLabelCatalog struct {
	ID     string  `json:"id"`
	Labels []Label `json:"labels"`
}

BoardLabelCatalog is the subset of a board response required to validate card labels.

type CardLabelState added in v0.10.0

type CardLabelState struct {
	ID    string `json:"id"`
	Board struct {
		ID string `json:"id"`
	} `json:"board"`
	Labels []Label `json:"labels"`
}

CardLabelState is the subset of a card response required to reconcile its label set.

type CardMetadata added in v0.11.0

type CardMetadata struct {
	ID               string                     `json:"id"`
	Metadata         map[string]json.RawMessage `json:"metadata"`
	MetadataRevision int64                      `json:"metadata_revision"`
}

CardMetadata retains JSON numbers without converting them to floating point.

type CardPatch

type CardPatch struct {
	Title       *string
	Description *string
	DueDate     *string
	AssigneeID  *string
	AssigneeSet bool
}

type Client

type Client struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL, token string) *Client

func (*Client) AddCardLabel added in v0.10.0

func (c *Client) AddCardLabel(ctx context.Context, cardID, labelID string) error
func (c *Client) AddCardLink(ctx context.Context, cardID, linkURL, displayText string) (json.RawMessage, error)

func (*Client) AddComment

func (c *Client) AddComment(ctx context.Context, cardID, content string) (json.RawMessage, error)

func (*Client) AddCommentOnce added in v0.11.0

func (c *Client) AddCommentOnce(ctx context.Context, cardID, content string) (json.RawMessage, error)

AddCommentOnce avoids retrying a non-idempotent comment creation request.

func (*Client) AddTodo

func (c *Client) AddTodo(ctx context.Context, cardID, checklistID, title string) (json.RawMessage, error)

func (*Client) AddTodos

func (c *Client) AddTodos(ctx context.Context, cardID, checklistTitle string, items []string) (json.RawMessage, error)

func (*Client) ArchiveBoard

func (c *Client) ArchiveBoard(ctx context.Context, boardID string) (json.RawMessage, error)

func (*Client) ArchiveCard

func (c *Client) ArchiveCard(ctx context.Context, cardID string) (json.RawMessage, error)

func (*Client) BoardCardSearch

func (c *Client) BoardCardSearch(ctx context.Context, boardID, query string, limit int) (json.RawMessage, error)

func (*Client) CompleteTodo

func (c *Client) CompleteTodo(ctx context.Context, cardID, todoID string) (json.RawMessage, error)

func (*Client) CreateCard

func (c *Client) CreateCard(ctx context.Context, boardID, listID, title, description string) (json.RawMessage, error)

func (*Client) CreateChecklist

func (c *Client) CreateChecklist(ctx context.Context, cardID, title string) (json.RawMessage, error)

func (*Client) CreateList

func (c *Client) CreateList(ctx context.Context, boardID, name string) (json.RawMessage, error)
func (c *Client) DeleteCardLink(ctx context.Context, cardID, linkID string) error

func (*Client) DeleteComment

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

func (*Client) DownloadAttachment added in v0.13.1

func (c *Client) DownloadAttachment(ctx context.Context, cardID, attachmentID string, dst io.Writer) error

DownloadAttachment resolves the authenticated API redirect, then streams the object without forwarding the board token or API cookies to object storage.

func (*Client) ExtractChecklistToCards

func (c *Client) ExtractChecklistToCards(ctx context.Context, sourceCardID, checklistID, targetListID, prefix string) (json.RawMessage, error)

func (*Client) ExtractTodosToCards

func (c *Client) ExtractTodosToCards(ctx context.Context, sourceCardID, targetListID, prefix string) (json.RawMessage, error)

func (*Client) GetActivity

func (c *Client) GetActivity(ctx context.Context, opts ActivityOptions) (json.RawMessage, error)

func (*Client) GetAttachment

func (c *Client) GetAttachment(ctx context.Context, cardID, attachmentID string) (json.RawMessage, error)

func (*Client) GetBoard

func (c *Client) GetBoard(ctx context.Context, boardID string, includeArchived bool) (json.RawMessage, error)

func (*Client) GetBoardActivity

func (c *Client) GetBoardActivity(ctx context.Context, boardID string, opts ActivityOptions) (json.RawMessage, error)

func (*Client) GetBoardActivityMarkdown

func (c *Client) GetBoardActivityMarkdown(ctx context.Context, boardID string, opts ActivityOptions) (string, error)

func (*Client) GetBoardLabelCatalog added in v0.10.0

func (c *Client) GetBoardLabelCatalog(ctx context.Context, boardID string) (BoardLabelCatalog, error)

func (*Client) GetBoardLabels

func (c *Client) GetBoardLabels(ctx context.Context, boardID string) (json.RawMessage, error)

func (*Client) GetBoardMarkdown

func (c *Client) GetBoardMarkdown(ctx context.Context, boardID string, includeArchived bool) (string, error)

func (*Client) GetCard

func (c *Client) GetCard(ctx context.Context, cardID string) (json.RawMessage, error)

func (*Client) GetCardActivity

func (c *Client) GetCardActivity(ctx context.Context, cardID string, opts ActivityOptions) (json.RawMessage, error)

func (*Client) GetCardLabelState added in v0.10.0

func (c *Client) GetCardLabelState(ctx context.Context, cardID string) (CardLabelState, error)

func (*Client) GetCardMarkdown

func (c *Client) GetCardMarkdown(ctx context.Context, cardID string) (string, error)

func (*Client) GetCardMetadata added in v0.11.0

func (c *Client) GetCardMetadata(ctx context.Context, cardID string) (CardMetadata, error)

func (*Client) GetComment

func (c *Client) GetComment(ctx context.Context, cardID, commentID string) (json.RawMessage, error)

func (*Client) ListAttachments

func (c *Client) ListAttachments(ctx context.Context, cardID string) (json.RawMessage, error)

func (*Client) ListBoards

func (c *Client) ListBoards(ctx context.Context) (json.RawMessage, error)

func (*Client) ListBoardsMarkdown

func (c *Client) ListBoardsMarkdown(ctx context.Context) (string, error)
func (c *Client) ListCardLinks(ctx context.Context, cardID string) (json.RawMessage, error)

func (*Client) MoveCard

func (c *Client) MoveCard(ctx context.Context, cardID, listID string, position *int) (json.RawMessage, error)

func (*Client) MoveCardToBoard

func (c *Client) MoveCardToBoard(ctx context.Context, cardID, boardID string) (json.RawMessage, error)

func (*Client) MoveList

func (c *Client) MoveList(ctx context.Context, listID string, position int) (json.RawMessage, error)

func (*Client) RegisterSkills

func (c *Client) RegisterSkills(ctx context.Context, skills []SkillPayload) (json.RawMessage, error)

func (*Client) RemoveCardLabel added in v0.10.0

func (c *Client) RemoveCardLabel(ctx context.Context, cardID, labelID string) error

func (*Client) ReopenTodo

func (c *Client) ReopenTodo(ctx context.Context, cardID, todoID string) (json.RawMessage, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, path string, body any, out any) error

func (*Client) RequestMarkdown

func (c *Client) RequestMarkdown(ctx context.Context, path string) (string, error)

func (*Client) RequestRaw

func (c *Client) RequestRaw(ctx context.Context, method, path string, body any) (json.RawMessage, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string, opts SearchOptions) (json.RawMessage, error)

func (*Client) SetNoRetry added in v0.11.0

func (c *Client) SetNoRetry(noRetry bool)

SetNoRetry configures the client to make at most one transport attempt for each logical request. It also leaves redirect responses untouched so an authenticated request cannot be replayed at a redirect target.

func (*Client) ToggleBoardFavorite

func (c *Client) ToggleBoardFavorite(ctx context.Context, boardID string) (json.RawMessage, error)

func (*Client) ToggleReaction

func (c *Client) ToggleReaction(ctx context.Context, cardID, commentID, emoji string) (json.RawMessage, error)

func (*Client) UnarchiveBoard

func (c *Client) UnarchiveBoard(ctx context.Context, boardID string) (json.RawMessage, error)

func (*Client) UnarchiveCard

func (c *Client) UnarchiveCard(ctx context.Context, cardID string) (json.RawMessage, error)

func (*Client) UpdateBoard

func (c *Client) UpdateBoard(ctx context.Context, boardID, name string) (json.RawMessage, error)

func (*Client) UpdateCard

func (c *Client) UpdateCard(ctx context.Context, cardID string, patch CardPatch) (json.RawMessage, error)
func (c *Client) UpdateCardLink(ctx context.Context, cardID, linkID string, patch LinkPatch) (json.RawMessage, error)

func (*Client) UpdateCardMetadata added in v0.11.0

func (c *Client) UpdateCardMetadata(ctx context.Context, cardID string, patch MetadataPatch) (json.RawMessage, error)

func (*Client) UpdateTodo

func (c *Client) UpdateTodo(ctx context.Context, cardID, checklistID, itemID string, patch TodoPatch) (json.RawMessage, error)

func (*Client) UploadAttachment

func (c *Client) UploadAttachment(ctx context.Context, cardID, filePath string) (json.RawMessage, error)

func (*Client) UploadFileContent

func (c *Client) UploadFileContent(ctx context.Context, cardID, filename string, content []byte, contentType string) (json.RawMessage, error)

func (*Client) UploadMarkdownContent

func (c *Client) UploadMarkdownContent(ctx context.Context, cardID, filename, content string) (json.RawMessage, error)

type ConnectedMessage

type ConnectedMessage struct {
	Type             string   `json:"type"`
	AgentID          string   `json:"agent_id"`
	SubscribedBoards []string `json:"subscribed_boards"`
}

type Label added in v0.10.0

type Label struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

Label is the minimal label representation returned by card and board detail endpoints.

type LinkPatch

type LinkPatch struct {
	URL         *string
	DisplayText *string
}

type MetadataPatch added in v0.11.0

type MetadataPatch struct {
	Set              map[string]json.RawMessage `json:"set,omitempty"`
	Remove           []string                   `json:"remove,omitempty"`
	ExpectedRevision int64                      `json:"expected_revision"`
}

type SearchOptions

type SearchOptions struct {
	Workspace       string
	IncludeArchived bool
	Limit           int
	Offset          int
}

type SkillPayload

type SkillPayload struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type StatusPingPayload

type StatusPingPayload struct {
	Type            string   `json:"type"`
	Subscription    any      `json:"subscription"`
	ActiveCards     []string `json:"active_cards"`
	ActiveCardCount int      `json:"active_card_count"`
}

type StreamConn

type StreamConn interface {
	WriteJSON(v any) error
	SetWriteDeadline(t time.Time) error
	Close() error
}

type TodoPatch

type TodoPatch struct {
	Title       *string
	IsCompleted *bool
	DueDate     *string
	AssigneeIDs []string
	AssigneeSet bool
}

type WebSocketClient

type WebSocketClient struct {
	BaseURL string
	Token   string
	Dialer  *websocket.Dialer
	Conn    *websocket.Conn

	OnConnected  func(ConnectedMessage)
	OnBoardEvent func(json.RawMessage)
	OnError      func(string)
}

func NewWebSocketClient

func NewWebSocketClient(baseURL string, token string) *WebSocketClient

func (*WebSocketClient) Connect

func (c *WebSocketClient) Connect(ctx context.Context) (*websocket.Conn, error)

func (*WebSocketClient) ReadLoop

func (c *WebSocketClient) ReadLoop(ctx context.Context, conn *websocket.Conn) error

func (*WebSocketClient) Run

func (c *WebSocketClient) Run(ctx context.Context) error

func (*WebSocketClient) SendStatusPing

func (c *WebSocketClient) SendStatusPing(ctx context.Context, subscription any, activeCards []string) error

Jump to

Keyboard shortcuts

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