api

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	// Project methods
	GetProjects(ctx context.Context) ([]Project, error)
	GetProject(ctx context.Context, projectID string) (*Project, error)

	// Todo methods
	GetProjectTodoSet(ctx context.Context, projectID string) (*TodoSet, error)
	GetTodoLists(ctx context.Context, projectID string, todoSetID int64) ([]TodoList, error)
	GetTodoList(ctx context.Context, projectID string, todoListID int64) (*TodoList, error)
	GetTodos(ctx context.Context, projectID string, todoListID int64) ([]Todo, error)
	GetAllTodos(ctx context.Context, projectID string, todoListID int64) ([]Todo, error)
	GetTodo(ctx context.Context, projectID string, todoID int64) (*Todo, error)
	GetTodoGroups(ctx context.Context, projectID string, todoListID int64) ([]TodoGroup, error)
	CreateTodo(ctx context.Context, projectID string, todoListID int64, req TodoCreateRequest) (*Todo, error)
	UpdateTodo(ctx context.Context, projectID string, todoID int64, req TodoUpdateRequest) (*Todo, error)
	CreateTodoList(ctx context.Context, projectID string, todoSetID int64, req TodoListCreateRequest) (*TodoList, error)
	UpdateTodoList(ctx context.Context, projectID string, todoListID int64, req TodoListUpdateRequest) (*TodoList, error)
	CreateTodoGroup(ctx context.Context, projectID string, todoListID int64, req TodoGroupCreateRequest) (*TodoGroup, error)
	RepositionTodoGroup(ctx context.Context, projectID string, groupID int64, position int) error
	RepositionTodo(ctx context.Context, projectID string, todoID int64, position int) error
	CompleteTodo(ctx context.Context, projectID string, todoID int64) error
	UncompleteTodo(ctx context.Context, projectID string, todoID int64) error

	// Campfire methods
	ListCampfires(ctx context.Context, projectID string) ([]Campfire, error)
	GetCampfire(ctx context.Context, projectID string, campfireID int64) (*Campfire, error)
	GetCampfireByName(ctx context.Context, projectID string, name string) (*Campfire, error)
	GetCampfireLines(ctx context.Context, projectID string, campfireID int64, limit int) ([]CampfireLine, error)
	PostCampfireLine(ctx context.Context, projectID string, campfireID int64, content string) (*CampfireLine, error)
	DeleteCampfireLine(ctx context.Context, projectID string, campfireID int64, lineID int64) error

	// Card table methods
	GetProjectCardTable(ctx context.Context, projectID string) (*CardTable, error)
	GetCardTable(ctx context.Context, projectID string, cardTableID int64) (*CardTable, error)
	GetCardsInColumn(ctx context.Context, projectID string, columnID int64) ([]Card, error)
	GetCard(ctx context.Context, projectID string, cardID int64) (*Card, error)
	CreateCard(ctx context.Context, projectID string, columnID int64, req CardCreateRequest) (*Card, error)
	UpdateCard(ctx context.Context, projectID string, cardID int64, req CardUpdateRequest) (*Card, error)
	MoveCard(ctx context.Context, projectID string, cardID int64, columnID int64) error
	ArchiveCard(ctx context.Context, projectID string, cardID int64) error

	// Card step methods
	CreateStep(ctx context.Context, projectID string, cardID int64, req StepCreateRequest) (*Step, error)
	UpdateStep(ctx context.Context, projectID string, stepID int64, req StepUpdateRequest) (*Step, error)
	SetStepCompletion(ctx context.Context, projectID string, stepID int64, completed bool) error
	MoveStep(ctx context.Context, projectID string, cardID int64, stepID int64, position int) error
	DeleteStep(ctx context.Context, projectID string, stepID int64) error

	// People methods
	GetProjectPeople(ctx context.Context, projectID string) ([]Person, error)
	GetPerson(ctx context.Context, personID int64) (*Person, error)
	GetMyProfile(ctx context.Context) (*Person, error)
}

APIClient defines the interface for interacting with the Basecamp API

type AttachmentOperations added in v0.10.0

type AttachmentOperations interface {
	UploadAttachment(filename string, data []byte, contentType string) (*AttachmentUploadResponse, error)
}

AttachmentOperations defines attachment-specific operations

type AttachmentUploadResponse added in v0.10.0

type AttachmentUploadResponse struct {
	AttachableSGID string `json:"attachable_sgid"`
	Filename       string `json:"filename"`
	ContentType    string `json:"content_type"`
	ByteSize       int64  `json:"byte_size"`
}

AttachmentUploadResponse represents the response from the attachments endpoint.

type Campfire

type Campfire struct {
	ID        int64     `json:"id"`
	Name      string    `json:"title"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	LinesURL  string    `json:"lines_url"`
	URL       string    `json:"url"`
	Bucket    struct {
		ID   int64  `json:"id"`
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"bucket"`
	Creator Person `json:"creator"`
}

Campfire represents a Basecamp campfire (chat room)

type CampfireLine

type CampfireLine struct {
	ID        int64     `json:"id"`
	Status    string    `json:"status"`
	Content   string    `json:"content"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	URL       string    `json:"url"`
	Creator   Person    `json:"creator"`
	Parent    struct {
		ID    int64  `json:"id"`
		Title string `json:"title"`
		Type  string `json:"type"`
		URL   string `json:"url"`
	} `json:"parent"`
}

CampfireLine represents a message in a campfire

type CampfireLineCreate

type CampfireLineCreate struct {
	Content string `json:"content"`
}

CampfireLineCreate represents the request body for creating a campfire line

type CampfireOperations

type CampfireOperations interface {
	ListCampfires(ctx context.Context, projectID string) ([]Campfire, error)
	GetCampfire(ctx context.Context, projectID string, campfireID int64) (*Campfire, error)
	GetCampfireByName(ctx context.Context, projectID string, name string) (*Campfire, error)
	GetCampfireLines(ctx context.Context, projectID string, campfireID int64, limit int) ([]CampfireLine, error)
	PostCampfireLine(ctx context.Context, projectID string, campfireID int64, content string) (*CampfireLine, error)
	DeleteCampfireLine(ctx context.Context, projectID string, campfireID int64, lineID int64) error
}

CampfireOperations defines campfire-specific operations

type Card

type Card struct {
	ID            int64     `json:"id"`
	Title         string    `json:"title"`
	Content       string    `json:"content"`
	Status        string    `json:"status"`
	DueOn         *string   `json:"due_on,omitempty"`
	Assignees     []Person  `json:"assignees"`
	Steps         []Step    `json:"steps"`
	StepsCount    int       `json:"steps_count"`
	CommentsCount int       `json:"comments_count"`
	Creator       *Person   `json:"creator"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	Parent        *Column   `json:"parent"`
	URL           string    `json:"url"`
}

Card represents a card in a card table

type CardCreateRequest

type CardCreateRequest struct {
	Title   string  `json:"title"`
	Content string  `json:"content,omitempty"`
	DueOn   *string `json:"due_on,omitempty"`
	Notify  bool    `json:"notify,omitempty"`
}

CardCreateRequest represents the payload for creating a new card

type CardMoveRequest

type CardMoveRequest struct {
	ColumnID int64 `json:"column_id"`
}

CardMoveRequest represents the payload for moving a card

type CardOperations

type CardOperations interface {
	GetProjectCardTable(ctx context.Context, projectID string) (*CardTable, error)
	GetCardTable(ctx context.Context, projectID string, cardTableID int64) (*CardTable, error)
	GetCardsInColumn(ctx context.Context, projectID string, columnID int64) ([]Card, error)
	GetCard(ctx context.Context, projectID string, cardID int64) (*Card, error)
	CreateCard(ctx context.Context, projectID string, columnID int64, req CardCreateRequest) (*Card, error)
	UpdateCard(ctx context.Context, projectID string, cardID int64, req CardUpdateRequest) (*Card, error)
	MoveCard(ctx context.Context, projectID string, cardID int64, columnID int64) error
	ArchiveCard(ctx context.Context, projectID string, cardID int64) error
}

CardOperations defines card table-specific operations

type CardTable

type CardTable struct {
	ID          int64     `json:"id"`
	Title       string    `json:"title"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Status      string    `json:"status"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	Lists       []Column  `json:"lists"`
	CardsCount  int       `json:"cards_count"`
	URL         string    `json:"url"`
}

CardTable represents a Basecamp card table (kanban board)

type CardUpdateRequest

type CardUpdateRequest struct {
	Title       string  `json:"title,omitempty"`
	Content     string  `json:"content,omitempty"`
	DueOn       *string `json:"due_on,omitempty"`
	AssigneeIDs []int64 `json:"assignee_ids,omitempty"`
}

CardUpdateRequest represents the payload for updating a card

type Client

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

func NewClient

func NewClient(accountID, accessToken string) *Client

NewClient creates a new API client Deprecated: Use NewModularClient instead for better separation of concerns

func (*Client) ArchiveCard

func (c *Client) ArchiveCard(ctx context.Context, projectID string, cardID int64) error

ArchiveCard archives a card

func (*Client) CompleteTodo

func (c *Client) CompleteTodo(ctx context.Context, projectID string, todoID int64) error

CompleteTodo marks a todo as complete

func (*Client) CreateCard

func (c *Client) CreateCard(ctx context.Context, projectID string, columnID int64, req CardCreateRequest) (*Card, error)

CreateCard creates a new card in a column

func (*Client) CreateColumn

func (c *Client) CreateColumn(ctx context.Context, projectID string, cardTableID int64, req ColumnCreateRequest) (*Column, error)

CreateColumn creates a new column in a card table

func (*Client) CreateComment added in v0.7.0

func (c *Client) CreateComment(ctx context.Context, projectID string, recordingID int64, req CommentCreateRequest) (*Comment, error)

CreateComment creates a new comment on a recording

func (*Client) CreateDocument added in v0.7.0

func (c *Client) CreateDocument(ctx context.Context, projectID string, vaultID int64, req DocumentCreateRequest) (*Document, error)

CreateDocument creates a new document in a vault

func (*Client) CreateMessage added in v0.5.0

func (c *Client) CreateMessage(ctx context.Context, projectID string, messageBoardID int64, req MessageCreateRequest) (*Message, error)

CreateMessage creates a new message on a message board

func (*Client) CreateStep

func (c *Client) CreateStep(ctx context.Context, projectID string, cardID int64, req StepCreateRequest) (*Step, error)

CreateStep creates a new step in a card

func (*Client) CreateTodo

func (c *Client) CreateTodo(ctx context.Context, projectID string, todoListID int64, req TodoCreateRequest) (*Todo, error)

CreateTodo creates a new todo in a todo list

func (*Client) CreateTodoGroup added in v0.7.2

func (c *Client) CreateTodoGroup(ctx context.Context, projectID string, todoListID int64, req TodoGroupCreateRequest) (*TodoGroup, error)

CreateTodoGroup creates a new group within a todo list

func (*Client) CreateTodoList

func (c *Client) CreateTodoList(ctx context.Context, projectID string, todoSetID int64, req TodoListCreateRequest) (*TodoList, error)

CreateTodoList creates a new todo list in a project

func (*Client) Delete

func (c *Client) Delete(path string) error

func (*Client) DeleteCampfireLine

func (c *Client) DeleteCampfireLine(ctx context.Context, projectID string, campfireID int64, lineID int64) error

DeleteCampfireLine deletes a message from a campfire

func (*Client) DeleteDocument added in v0.7.0

func (c *Client) DeleteDocument(ctx context.Context, projectID string, documentID int64) error

DeleteDocument deletes a document

func (*Client) DeleteMessage added in v0.5.0

func (c *Client) DeleteMessage(ctx context.Context, projectID string, messageID int64) error

DeleteMessage deletes a message

func (*Client) DeleteStep

func (c *Client) DeleteStep(ctx context.Context, projectID string, stepID int64) error

DeleteStep deletes a step (archive it)

func (*Client) Get

func (c *Client) Get(path string, result interface{}) error

func (*Client) GetAllTodos

func (c *Client) GetAllTodos(ctx context.Context, projectID string, todoListID int64) ([]Todo, error)

GetAllTodos fetches all todos in a todo list including completed ones

func (*Client) GetCampfire

func (c *Client) GetCampfire(ctx context.Context, projectID string, campfireID int64) (*Campfire, error)

GetCampfire returns a specific campfire

func (*Client) GetCampfireByName

func (c *Client) GetCampfireByName(ctx context.Context, projectID string, name string) (*Campfire, error)

GetCampfireByName finds a campfire by name (case-insensitive partial match)

func (*Client) GetCampfireLines

func (c *Client) GetCampfireLines(ctx context.Context, projectID string, campfireID int64, limit int) ([]CampfireLine, error)

GetCampfireLines returns messages from a campfire

func (*Client) GetCard

func (c *Client) GetCard(ctx context.Context, projectID string, cardID int64) (*Card, error)

GetCard fetches a single card by ID

func (*Client) GetCardTable

func (c *Client) GetCardTable(ctx context.Context, projectID string, cardTableID int64) (*CardTable, error)

GetCardTable fetches a card table by ID

func (*Client) GetCardsInColumn

func (c *Client) GetCardsInColumn(ctx context.Context, projectID string, columnID int64) ([]Card, error)

GetCardsInColumn fetches all cards in a specific column

func (*Client) GetComment added in v0.7.0

func (c *Client) GetComment(ctx context.Context, projectID string, commentID int64) (*Comment, error)

GetComment returns a specific comment

func (*Client) GetDocument added in v0.7.0

func (c *Client) GetDocument(ctx context.Context, projectID string, documentID int64) (*Document, error)

GetDocument returns a specific document

func (*Client) GetMessage added in v0.5.0

func (c *Client) GetMessage(ctx context.Context, projectID string, messageID int64) (*Message, error)

GetMessage returns a specific message

func (*Client) GetMessageBoard added in v0.5.0

func (c *Client) GetMessageBoard(ctx context.Context, projectID string) (*MessageBoard, error)

GetMessageBoard returns the message board for a project

func (*Client) GetMyProfile added in v0.10.0

func (c *Client) GetMyProfile(ctx context.Context) (*Person, error)

GetMyProfile fetches the current user's profile

func (*Client) GetPerson

func (c *Client) GetPerson(ctx context.Context, personID int64) (*Person, error)

GetPerson fetches a specific person by ID

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, projectID string) (*Project, error)

GetProject fetches a single project by ID

func (*Client) GetProjectCardTable

func (c *Client) GetProjectCardTable(ctx context.Context, projectID string) (*CardTable, error)

GetProjectCardTable fetches the card table for a project

func (*Client) GetProjectPeople

func (c *Client) GetProjectPeople(ctx context.Context, projectID string) ([]Person, error)

GetProjectPeople fetches all people associated with a project

func (*Client) GetProjectTodoSet

func (c *Client) GetProjectTodoSet(ctx context.Context, projectID string) (*TodoSet, error)

GetProjectTodoSet fetches the todo set for a project

func (*Client) GetProjects

func (c *Client) GetProjects(ctx context.Context) ([]Project, error)

GetProjects fetches all projects for the account (handles pagination)

func (*Client) GetTodo

func (c *Client) GetTodo(ctx context.Context, projectID string, todoID int64) (*Todo, error)

GetTodo fetches a single todo by ID

func (*Client) GetTodoGroups

func (c *Client) GetTodoGroups(ctx context.Context, projectID string, todoListID int64) ([]TodoGroup, error)

GetTodoGroups fetches all groups in a todo list

func (*Client) GetTodoList

func (c *Client) GetTodoList(ctx context.Context, projectID string, todoListID int64) (*TodoList, error)

GetTodoList fetches a single todo list by ID

func (*Client) GetTodoLists

func (c *Client) GetTodoLists(ctx context.Context, projectID string, todoSetID int64) ([]TodoList, error)

GetTodoLists fetches all todo lists in a todo set

func (*Client) GetTodos

func (c *Client) GetTodos(ctx context.Context, projectID string, todoListID int64) ([]Todo, error)

GetTodos fetches all todos in a todo list

func (*Client) GetVault added in v0.7.0

func (c *Client) GetVault(ctx context.Context, projectID string) (*Vault, error)

GetVault returns the document vault for a project

func (*Client) ListCampfires

func (c *Client) ListCampfires(ctx context.Context, projectID string) ([]Campfire, error)

ListCampfires returns all campfires for a project

func (*Client) ListComments added in v0.7.0

func (c *Client) ListComments(ctx context.Context, projectID string, recordingID int64) ([]Comment, error)

ListComments returns all comments for a recording

func (*Client) ListDocuments added in v0.7.0

func (c *Client) ListDocuments(ctx context.Context, projectID string, vaultID int64) ([]Document, error)

ListDocuments returns all documents in a vault

func (*Client) ListMessageCategories added in v0.5.0

func (c *Client) ListMessageCategories(ctx context.Context, projectID string, messageBoardID int64) ([]MessageCategory, error)

ListMessageCategories returns all categories for a message board

func (*Client) ListMessages added in v0.5.0

func (c *Client) ListMessages(ctx context.Context, projectID string, messageBoardID int64) ([]Message, error)

ListMessages returns all messages on a message board

func (*Client) MoveCard

func (c *Client) MoveCard(ctx context.Context, projectID string, cardID int64, columnID int64) error

MoveCard moves a card to a different column

func (*Client) MoveColumn

func (c *Client) MoveColumn(ctx context.Context, projectID string, cardTableID int64, sourceID, targetID int64, position string) error

MoveColumn moves a column to a different position

func (*Client) MoveStep

func (c *Client) MoveStep(ctx context.Context, projectID string, cardID int64, stepID int64, position int) error

MoveStep repositions a step within a card

func (*Client) PinMessage added in v0.10.0

func (c *Client) PinMessage(ctx context.Context, projectID string, messageID int64) error

PinMessage pins a message to the top of the message board

func (*Client) Post

func (c *Client) Post(path string, payload interface{}, result interface{}) error

func (*Client) PostCampfireLine

func (c *Client) PostCampfireLine(ctx context.Context, projectID string, campfireID int64, content string) (*CampfireLine, error)

PostCampfireLine posts a new message to a campfire

func (*Client) Put

func (c *Client) Put(path string, payload interface{}, result interface{}) error

func (*Client) RemoveColumnOnHold added in v0.10.0

func (c *Client) RemoveColumnOnHold(ctx context.Context, projectID string, columnID int64) error

RemoveColumnOnHold removes the on-hold status from a column

func (*Client) RepositionTodo added in v0.9.0

func (c *Client) RepositionTodo(ctx context.Context, projectID string, todoID int64, position int) error

RepositionTodo repositions a todo within its list

func (*Client) RepositionTodoGroup added in v0.7.2

func (c *Client) RepositionTodoGroup(ctx context.Context, projectID string, groupID int64, position int) error

RepositionTodoGroup repositions a group within a todo list

func (*Client) SetColumnColor

func (c *Client) SetColumnColor(ctx context.Context, projectID string, columnID int64, color string) error

SetColumnColor sets the color of a column

func (*Client) SetColumnOnHold added in v0.10.0

func (c *Client) SetColumnOnHold(ctx context.Context, projectID string, columnID int64) error

SetColumnOnHold marks a column as on-hold

func (*Client) SetStepCompletion

func (c *Client) SetStepCompletion(ctx context.Context, projectID string, stepID int64, completed bool) error

SetStepCompletion sets the completion status of a step

func (*Client) UncompleteTodo

func (c *Client) UncompleteTodo(ctx context.Context, projectID string, todoID int64) error

UncompleteTodo marks a todo as incomplete

func (*Client) UnpinMessage added in v0.10.0

func (c *Client) UnpinMessage(ctx context.Context, projectID string, messageID int64) error

UnpinMessage unpins a message from the top of the message board

func (*Client) UpdateCard

func (c *Client) UpdateCard(ctx context.Context, projectID string, cardID int64, req CardUpdateRequest) (*Card, error)

UpdateCard updates a card

func (*Client) UpdateColumn

func (c *Client) UpdateColumn(ctx context.Context, projectID string, columnID int64, req ColumnUpdateRequest) (*Column, error)

UpdateColumn updates a column

func (*Client) UpdateComment added in v0.7.0

func (c *Client) UpdateComment(ctx context.Context, projectID string, commentID int64, req CommentUpdateRequest) (*Comment, error)

UpdateComment updates an existing comment

func (*Client) UpdateDocument added in v0.7.0

func (c *Client) UpdateDocument(ctx context.Context, projectID string, documentID int64, req DocumentUpdateRequest) (*Document, error)

UpdateDocument updates an existing document

func (*Client) UpdateMessage added in v0.5.0

func (c *Client) UpdateMessage(ctx context.Context, projectID string, messageID int64, req MessageUpdateRequest) (*Message, error)

UpdateMessage updates an existing message

func (*Client) UpdateStep

func (c *Client) UpdateStep(ctx context.Context, projectID string, stepID int64, req StepUpdateRequest) (*Step, error)

UpdateStep updates a step

func (*Client) UpdateTodo added in v0.9.0

func (c *Client) UpdateTodo(ctx context.Context, projectID string, todoID int64, req TodoUpdateRequest) (*Todo, error)

UpdateTodo updates an existing todo

func (*Client) UpdateTodoList added in v0.9.0

func (c *Client) UpdateTodoList(ctx context.Context, projectID string, todoListID int64, req TodoListUpdateRequest) (*TodoList, error)

UpdateTodoList updates an existing todo list

func (*Client) UploadAttachment added in v0.10.0

func (c *Client) UploadAttachment(filename string, data []byte, contentType string) (*AttachmentUploadResponse, error)

UploadAttachment uploads raw file data to Basecamp and returns the attachable SGID. contentType is optional; if empty, http.DetectContentType is used as a fallback.

type Column

type Column struct {
	ID         int64        `json:"id"`
	Title      string       `json:"title"`
	Name       string       `json:"name"`
	Type       string       `json:"type"`
	Color      string       `json:"color,omitempty"`
	Status     string       `json:"status"`
	OnHold     OnHoldStatus `json:"on_hold"`
	CardsCount int          `json:"cards_count"`
	CardsURL   string       `json:"cards_url"`
	CreatedAt  time.Time    `json:"created_at"`
	UpdatedAt  time.Time    `json:"updated_at"`
}

Column represents a column in a card table

type ColumnColorRequest

type ColumnColorRequest struct {
	Color string `json:"color"`
}

ColumnColorRequest represents the payload for changing a column's color

type ColumnCreateRequest

type ColumnCreateRequest struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
}

ColumnCreateRequest represents the payload for creating a new column

type ColumnMoveRequest

type ColumnMoveRequest struct {
	SourceID int64  `json:"source_id"`
	TargetID int64  `json:"target_id"`
	Position string `json:"position,omitempty"` // "before" or "after"
}

ColumnMoveRequest represents the payload for moving a column

type ColumnOperations

type ColumnOperations interface {
	CreateColumn(ctx context.Context, projectID string, cardTableID int64, req ColumnCreateRequest) (*Column, error)
	UpdateColumn(ctx context.Context, projectID string, columnID int64, req ColumnUpdateRequest) (*Column, error)
	SetColumnColor(ctx context.Context, projectID string, columnID int64, color string) error
	MoveColumn(ctx context.Context, projectID string, cardTableID int64, sourceID, targetID int64, position string) error
	SetColumnOnHold(ctx context.Context, projectID string, columnID int64) error
	RemoveColumnOnHold(ctx context.Context, projectID string, columnID int64) error
}

ColumnOperations defines column-specific operations

type ColumnUpdateRequest

type ColumnUpdateRequest struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

ColumnUpdateRequest represents the payload for updating a column

type Comment added in v0.7.0

type Comment struct {
	ID        int64     `json:"id"`
	Content   string    `json:"content"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Creator   Person    `json:"creator"`
	Parent    struct {
		ID    int64  `json:"id"`
		Title string `json:"title"`
		Type  string `json:"type"`
		URL   string `json:"url"`
	} `json:"parent"`
	URL string `json:"url"`
}

Comment represents a Basecamp comment

type CommentCreateRequest added in v0.7.0

type CommentCreateRequest struct {
	Content string `json:"content"`
}

CommentCreateRequest represents the payload for creating a comment

type CommentOperations added in v0.7.0

type CommentOperations interface {
	ListComments(ctx context.Context, projectID string, recordingID int64) ([]Comment, error)
	GetComment(ctx context.Context, projectID string, commentID int64) (*Comment, error)
	CreateComment(ctx context.Context, projectID string, recordingID int64, req CommentCreateRequest) (*Comment, error)
	UpdateComment(ctx context.Context, projectID string, commentID int64, req CommentUpdateRequest) (*Comment, error)
}

CommentOperations defines comment-specific operations

type CommentUpdateRequest added in v0.7.0

type CommentUpdateRequest struct {
	Content string `json:"content"`
}

CommentUpdateRequest represents the payload for updating a comment

type Company added in v0.10.0

type Company struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

Company represents a Basecamp company/organization

type Document added in v0.7.0

type Document struct {
	ID        int64     `json:"id"`
	Title     string    `json:"title"`
	Content   string    `json:"content"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Creator   Person    `json:"creator"`
	Parent    struct {
		ID    int64  `json:"id"`
		Title string `json:"title"`
		Type  string `json:"type"`
		URL   string `json:"url"`
	} `json:"parent"`
	CommentsCount    int    `json:"comments_count"`
	VisibleToClients bool   `json:"visible_to_clients"`
	URL              string `json:"url"`
}

Document represents a Basecamp document

type DocumentCreateRequest added in v0.7.0

type DocumentCreateRequest struct {
	Title   string `json:"title"`
	Content string `json:"content"`
	Status  string `json:"status,omitempty"` // draft or active
}

DocumentCreateRequest represents the payload for creating a new document

type DocumentUpdateRequest added in v0.7.0

type DocumentUpdateRequest struct {
	Title   string `json:"title,omitempty"`
	Content string `json:"content,omitempty"`
}

DocumentUpdateRequest represents the payload for updating a document

type LinkEntry added in v0.7.0

type LinkEntry struct {
	URL    string
	Params map[string]string
}

LinkEntry represents a single entry in a Link header

type Message added in v0.5.0

type Message struct {
	ID        int64     `json:"id"`
	Subject   string    `json:"subject"`
	Content   string    `json:"content"`
	Status    string    `json:"status"`
	Pinned    bool      `json:"pinned"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Creator   Person    `json:"creator"`
	Parent    struct {
		ID    int64  `json:"id"`
		Title string `json:"title"`
		Type  string `json:"type"`
		URL   string `json:"url"`
	} `json:"parent"`
	Category      *MessageCategory `json:"category"`
	CommentsCount int              `json:"comments_count"`
	URL           string           `json:"url"`
}

Message represents a Basecamp message

type MessageBoard added in v0.5.0

type MessageBoard struct {
	ID            int64     `json:"id"`
	Title         string    `json:"title"`
	Name          string    `json:"name"`
	Status        string    `json:"status"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	MessagesURL   string    `json:"messages_url"`
	URL           string    `json:"url"`
	MessagesCount int       `json:"messages_count"`
	Bucket        struct {
		ID   int64  `json:"id"`
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"bucket"`
	Creator Person `json:"creator"`
}

MessageBoard represents a Basecamp message board

type MessageCategory added in v0.5.0

type MessageCategory struct {
	ID    int64  `json:"id"`
	Name  string `json:"name"`
	Icon  string `json:"icon"`
	Color string `json:"color"`
}

MessageCategory represents a message category

type MessageCreateRequest added in v0.5.0

type MessageCreateRequest struct {
	Subject    string `json:"subject"`
	Content    string `json:"content"`
	Status     string `json:"status,omitempty"` // must be "active" - Basecamp API does not support draft messages
	CategoryID *int64 `json:"category_id,omitempty"`
}

MessageCreateRequest represents the payload for creating a new message

type MessageUpdateRequest added in v0.5.0

type MessageUpdateRequest struct {
	Subject    string `json:"subject,omitempty"`
	Content    string `json:"content,omitempty"`
	CategoryID *int64 `json:"category_id,omitempty"`
}

MessageUpdateRequest represents the payload for updating a message

type ModularClient

type ModularClient struct {
	*Client // Embed the existing client for now
}

ModularClient provides access to all API operations through focused interfaces

func NewModularClient

func NewModularClient(accountID, accessToken string) *ModularClient

NewModularClient creates a new modular client that exposes focused interfaces

func (*ModularClient) Attachments added in v0.10.0

func (c *ModularClient) Attachments() AttachmentOperations

Attachments returns the attachment operations interface

func (*ModularClient) Campfires

func (c *ModularClient) Campfires() CampfireOperations

Campfires returns the campfire operations interface

func (*ModularClient) Cards

func (c *ModularClient) Cards() CardOperations

Cards returns the card operations interface

func (*ModularClient) Columns

func (c *ModularClient) Columns() ColumnOperations

Columns returns the column operations interface

func (*ModularClient) Comments added in v0.7.0

func (c *ModularClient) Comments() CommentOperations

Comments returns the comment operations interface

func (*ModularClient) People

func (c *ModularClient) People() PeopleOperations

People returns the people operations interface

func (*ModularClient) Projects

func (c *ModularClient) Projects() ProjectOperations

Projects returns the project operations interface

func (*ModularClient) Steps

func (c *ModularClient) Steps() StepOperations

Steps returns the step operations interface

func (*ModularClient) Todos

func (c *ModularClient) Todos() TodoOperations

Todos returns the todo operations interface

type OnHoldStatus added in v0.7.1

type OnHoldStatus struct {
	Enabled bool `json:"enabled"`
}

OnHoldStatus represents the on_hold status of a column

type PaginatedRequest

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

PaginatedRequest handles paginated requests to the Basecamp API

func NewPaginatedRequest

func NewPaginatedRequest(client *Client) *PaginatedRequest

NewPaginatedRequest creates a new paginated request handler

func (*PaginatedRequest) GetAll

func (pr *PaginatedRequest) GetAll(path string, result any) error

GetAll fetches all pages of results from a paginated endpoint The result parameter must be a pointer to a slice

func (*PaginatedRequest) GetPage

func (pr *PaginatedRequest) GetPage(path string, page int, result any) error

GetPage fetches a single page of results Note: For new code, prefer using GetAll() which handles pagination automatically. This method is kept for backwards compatibility and specific use cases.

type PeopleOperations

type PeopleOperations interface {
	GetProjectPeople(ctx context.Context, projectID string) ([]Person, error)
	GetPerson(ctx context.Context, personID int64) (*Person, error)
}

PeopleOperations defines people-specific operations

type Person

type Person struct {
	ID           int64    `json:"id"`
	Name         string   `json:"name"`
	EmailAddress string   `json:"email_address"`
	Title        string   `json:"title"`
	AvatarURL    string   `json:"avatar_url"`
	Company      *Company `json:"company,omitempty"`
	CreatedAt    string   `json:"created_at,omitempty"`
	Admin        bool     `json:"admin,omitempty"`
	Owner        bool     `json:"owner,omitempty"`
}

Person represents a Basecamp user

type Project

type Project struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Purpose     string `json:"purpose"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
}

Project represents a Basecamp project

type ProjectOperations

type ProjectOperations interface {
	GetProjects(ctx context.Context) ([]Project, error)
	GetProject(ctx context.Context, projectID string) (*Project, error)
}

ProjectOperations defines project-specific operations

type RateLimiter

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

RateLimiter implements a token bucket algorithm for rate limiting Basecamp allows 50 requests per 10 seconds

func GetRateLimiter

func GetRateLimiter() *RateLimiter

GetRateLimiter returns the global rate limiter instance

func NewRateLimiter

func NewRateLimiter(maxTokens int, refillDuration time.Duration) *RateLimiter

NewRateLimiter creates a new rate limiter

func (*RateLimiter) Reset

func (rl *RateLimiter) Reset()

Reset resets the rate limiter to full capacity

func (*RateLimiter) TryAcquire

func (rl *RateLimiter) TryAcquire() bool

TryAcquire attempts to acquire a token without blocking

func (*RateLimiter) Wait

func (rl *RateLimiter) Wait()

Wait blocks until a token is available

type Step

type Step struct {
	ID        int64     `json:"id"`
	Title     string    `json:"title"`
	Status    string    `json:"status"`
	Completed bool      `json:"completed"`
	DueOn     *string   `json:"due_on,omitempty"`
	Assignees []Person  `json:"assignees"`
	Creator   *Person   `json:"creator"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Step represents a step within a card

type StepCompletionRequest

type StepCompletionRequest struct {
	Completion string `json:"completion"` // "on" or "off"
}

StepCompletionRequest represents the payload for changing step completion

type StepCreateRequest

type StepCreateRequest struct {
	Title     string  `json:"title"`
	DueOn     *string `json:"due_on,omitempty"`
	Assignees string  `json:"assignees,omitempty"` // comma-separated list of person IDs
}

StepCreateRequest represents the payload for creating a new step

type StepOperations

type StepOperations interface {
	CreateStep(ctx context.Context, projectID string, cardID int64, req StepCreateRequest) (*Step, error)
	UpdateStep(ctx context.Context, projectID string, stepID int64, req StepUpdateRequest) (*Step, error)
	SetStepCompletion(ctx context.Context, projectID string, stepID int64, completed bool) error
	MoveStep(ctx context.Context, projectID string, cardID int64, stepID int64, position int) error
	DeleteStep(ctx context.Context, projectID string, stepID int64) error
}

StepOperations defines card step-specific operations

type StepPositionRequest

type StepPositionRequest struct {
	SourceID int64 `json:"source_id"`
	Position int   `json:"position"` // zero-indexed
}

StepPositionRequest represents the payload for repositioning a step

type StepUpdateRequest

type StepUpdateRequest struct {
	Title     string  `json:"title,omitempty"`
	DueOn     *string `json:"due_on,omitempty"`
	Assignees string  `json:"assignees,omitempty"`
}

StepUpdateRequest represents the payload for updating a step

type Todo

type Todo struct {
	ID          int64    `json:"id"`
	Title       string   `json:"title"`
	Content     string   `json:"content"`
	Description string   `json:"description"`
	CreatedAt   string   `json:"created_at"`
	UpdatedAt   string   `json:"updated_at"`
	Completed   bool     `json:"completed"`
	DueOn       *string  `json:"due_on"`
	StartsOn    *string  `json:"starts_on"`
	TodolistID  int64    `json:"todolist_id"`
	Creator     *Person  `json:"creator"`
	Assignees   []Person `json:"assignees"`
}

Todo represents a Basecamp todo item

type TodoCreateRequest

type TodoCreateRequest struct {
	Content     string  `json:"content"`
	Description string  `json:"description,omitempty"`
	DueOn       *string `json:"due_on,omitempty"`
	StartsOn    *string `json:"starts_on,omitempty"`
	AssigneeIDs []int64 `json:"assignee_ids,omitempty"`
}

TodoCreateRequest represents the payload for creating a new todo

type TodoGroup

type TodoGroup struct {
	ID             int64  `json:"id"`
	Title          string `json:"title"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	CreatedAt      string `json:"created_at"`
	UpdatedAt      string `json:"updated_at"`
	Completed      bool   `json:"completed"`
	CompletedRatio string `json:"completed_ratio"`
	TodosCount     int    `json:"todos_count"`
	TodosURL       string `json:"todos_url"`
	Position       int    `json:"position"`
}

TodoGroup represents a group of todos within a todo list

type TodoGroupCreateRequest added in v0.7.2

type TodoGroupCreateRequest struct {
	Name string `json:"name"`
}

TodoGroupCreateRequest represents the payload for creating a new todo group

type TodoGroupRepositionRequest added in v0.7.2

type TodoGroupRepositionRequest struct {
	Position int `json:"position"`
}

TodoGroupRepositionRequest represents the payload for repositioning a group

type TodoList

type TodoList struct {
	ID             int64  `json:"id"`
	Title          string `json:"title"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	CreatedAt      string `json:"created_at"`
	UpdatedAt      string `json:"updated_at"`
	Completed      bool   `json:"completed"`
	CompletedRatio string `json:"completed_ratio"`
	TodosCount     int    `json:"todos_count"`
	TodosURL       string `json:"todos_url"`
	GroupsURL      string `json:"groups_url"`
}

TodoList represents a Basecamp todo list

type TodoListCreateRequest

type TodoListCreateRequest struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

TodoListCreateRequest represents the payload for creating a new todo list

type TodoListUpdateRequest added in v0.9.0

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

TodoListUpdateRequest represents the payload for updating an existing todo list

type TodoOperations

type TodoOperations interface {
	GetProjectTodoSet(ctx context.Context, projectID string) (*TodoSet, error)
	GetTodoLists(ctx context.Context, projectID string, todoSetID int64) ([]TodoList, error)
	GetTodoList(ctx context.Context, projectID string, todoListID int64) (*TodoList, error)
	GetTodos(ctx context.Context, projectID string, todoListID int64) ([]Todo, error)
	GetAllTodos(ctx context.Context, projectID string, todoListID int64) ([]Todo, error)
	GetTodo(ctx context.Context, projectID string, todoID int64) (*Todo, error)
	GetTodoGroups(ctx context.Context, projectID string, todoListID int64) ([]TodoGroup, error)
	CreateTodo(ctx context.Context, projectID string, todoListID int64, req TodoCreateRequest) (*Todo, error)
	UpdateTodo(ctx context.Context, projectID string, todoID int64, req TodoUpdateRequest) (*Todo, error)
	CreateTodoList(ctx context.Context, projectID string, todoSetID int64, req TodoListCreateRequest) (*TodoList, error)
	UpdateTodoList(ctx context.Context, projectID string, todoListID int64, req TodoListUpdateRequest) (*TodoList, error)
	CreateTodoGroup(ctx context.Context, projectID string, todoListID int64, req TodoGroupCreateRequest) (*TodoGroup, error)
	RepositionTodoGroup(ctx context.Context, projectID string, groupID int64, position int) error
	RepositionTodo(ctx context.Context, projectID string, todoID int64, position int) error
	CompleteTodo(ctx context.Context, projectID string, todoID int64) error
	UncompleteTodo(ctx context.Context, projectID string, todoID int64) error
}

TodoOperations defines todo-specific operations

type TodoPositionRequest added in v0.9.0

type TodoPositionRequest struct {
	Position int `json:"position"`
}

TodoPositionRequest represents the payload for repositioning a todo

type TodoSet

type TodoSet struct {
	ID           int64  `json:"id"`
	Title        string `json:"title"`
	Name         string `json:"name"`
	CreatedAt    string `json:"created_at"`
	UpdatedAt    string `json:"updated_at"`
	TodolistsURL string `json:"todolists_url"`
}

TodoSet represents a Basecamp todo set (container for todo lists)

type TodoUpdateRequest added in v0.9.0

type TodoUpdateRequest struct {
	Content                 string  `json:"content,omitempty"`
	Description             string  `json:"description,omitempty"`
	DueOn                   *string `json:"due_on,omitempty"`
	StartsOn                *string `json:"starts_on,omitempty"`
	AssigneeIDs             []int64 `json:"assignee_ids,omitempty"`
	CompletionSubscriberIDs []int64 `json:"completion_subscriber_ids,omitempty"`
}

TodoUpdateRequest represents the payload for updating an existing todo

type Vault added in v0.7.0

type Vault struct {
	ID             int64     `json:"id"`
	Title          string    `json:"title"`
	Name           string    `json:"name"`
	Status         string    `json:"status"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	DocumentsURL   string    `json:"documents_url"`
	URL            string    `json:"url"`
	DocumentsCount int       `json:"documents_count"`
	Bucket         struct {
		ID   int64  `json:"id"`
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"bucket"`
	Creator Person `json:"creator"`
}

Vault represents a Basecamp document vault

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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