client

package
v0.12.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package client provides an HTTP API client for the arc server. It wraps REST endpoints for projects, issues, plans, and workspace paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the HTTP API client for the arc issue tracking server. It provides methods for all CRUD operations on projects, issues, dependencies, labels, plans, and comments.

func New

func New(baseURL string) *Client

New creates a new API client configured to connect to the given base URL. The client defaults to a 30-second timeout and "cli" as the actor identity.

func (*Client) AddDependency

func (c *Client) AddDependency(projID, issueID, dependsOnID, depType string) error

AddDependency adds a dependency between two issues. depType should be one of: "blocks", "parent-child", "related", "discovered-from".

func (*Client) CloseIssue

func (c *Client) CloseIssue(projID, id, reason string, cascade bool) (*types.Issue, error)

CloseIssue closes an issue. When cascade is true, open children are closed recursively. When cascade is false and the issue has open children, a *types.OpenChildrenError is returned so the caller can prompt the user.

func (*Client) CreateIssue

func (c *Client) CreateIssue(projID string, req CreateIssueRequest) (*types.Issue, error)

CreateIssue creates a new issue.

func (*Client) CreatePlan added in v0.7.0

func (c *Client) CreatePlan(projID, title, content string) (*types.Plan, error)

CreatePlan creates a new shared plan.

func (*Client) CreateProject added in v0.12.0

func (c *Client) CreateProject(name, prefix, description string) (*types.Project, error)

CreateProject creates a new project.

func (*Client) CreateWorkspace

func (c *Client) CreateWorkspace(projID string, req CreateWorkspaceRequest) (*types.Workspace, error)

CreateWorkspace registers a new workspace (directory path) for a project.

func (*Client) DeleteIssue

func (c *Client) DeleteIssue(projID, id string) error

DeleteIssue deletes an issue.

func (*Client) DeletePlan added in v0.7.0

func (c *Client) DeletePlan(projID, planID string) error

DeletePlan deletes a shared plan.

func (*Client) DeleteProject added in v0.12.0

func (c *Client) DeleteProject(id string) error

DeleteProject deletes a project.

func (*Client) DeleteWorkspace

func (c *Client) DeleteWorkspace(projID, wsID string) error

DeleteWorkspace removes a workspace (directory path) from a project.

func (*Client) GetBlockedIssues

func (c *Client) GetBlockedIssues(projID string, limit int) ([]*types.BlockedIssue, error)

GetBlockedIssues returns blocked issues.

func (*Client) GetIssue

func (c *Client) GetIssue(projID, id string) (*types.Issue, error)

GetIssue retrieves an issue by ID.

func (*Client) GetIssueDetails

func (c *Client) GetIssueDetails(projID, id string) (*types.IssueDetails, error)

GetIssueDetails retrieves an issue with all relational data.

func (*Client) GetPlan added in v0.7.0

func (c *Client) GetPlan(projID, planID string) (*types.Plan, error)

GetPlan retrieves a plan by ID.

func (*Client) GetPlanContext added in v0.7.0

func (c *Client) GetPlanContext(projID, issueID string) (*types.PlanContext, error)

GetPlanContext returns the plan context for an issue.

func (*Client) GetPlanHistory added in v0.7.0

func (c *Client) GetPlanHistory(projID, issueID string) ([]*types.Comment, error)

GetPlanHistory returns the plan version history for an issue.

func (*Client) GetProject added in v0.12.0

func (c *Client) GetProject(id string) (*types.Project, error)

GetProject retrieves a project by ID.

func (*Client) GetProjectStats added in v0.12.0

func (c *Client) GetProjectStats(projID string) (*types.Statistics, error)

GetProjectStats returns project statistics.

func (*Client) GetReadyWork

func (c *Client) GetReadyWork(projID string, limit int, sortPolicy string) ([]*types.Issue, error)

GetReadyWork returns issues ready to work on. sortPolicy can be: "hybrid" (default), "priority", or "oldest".

func (*Client) Health

func (c *Client) Health() error

Health checks the server health by sending a GET /health request.

func (*Client) LinkIssuesToPlan added in v0.7.0

func (c *Client) LinkIssuesToPlan(projID, planID string, issueIDs []string) error

LinkIssuesToPlan links one or more issues to a plan.

func (*Client) ListIssues

func (c *Client) ListIssues(projID string, opts ListIssuesOptions) ([]*types.Issue, error)

ListIssues returns issues for a project.

func (*Client) ListPlans added in v0.7.0

func (c *Client) ListPlans(projID string) ([]*types.Plan, error)

ListPlans returns all shared plans in a project.

func (*Client) ListProjects added in v0.12.0

func (c *Client) ListProjects() ([]*types.Project, error)

ListProjects returns all projects.

func (*Client) ListWorkspaces

func (c *Client) ListWorkspaces(projID string) ([]*types.Workspace, error)

ListWorkspaces returns all workspaces (directory paths) for a project.

func (*Client) MergeProjects added in v0.12.0

func (c *Client) MergeProjects(targetID string, sourceIDs []string) (*types.MergeResult, error)

MergeProjects merges one or more source projects into a target project.

func (*Client) RemoveDependency

func (c *Client) RemoveDependency(projID, issueID, dependsOnID string) error

RemoveDependency removes a dependency between two issues.

func (*Client) ResolveProjectByPath added in v0.12.0

func (c *Client) ResolveProjectByPath(fsPath string) (*types.ProjectResolution, error)

ResolveProjectByPath finds the project associated with a filesystem path.

func (*Client) SetActor

func (c *Client) SetActor(actor string)

SetActor sets the actor identity sent via the X-Actor header on all requests.

func (*Client) SetInlinePlan added in v0.7.0

func (c *Client) SetInlinePlan(projID, issueID, text string) (*types.Comment, error)

SetInlinePlan sets or updates an inline plan on an issue.

func (*Client) UnlinkIssueFromPlan added in v0.7.0

func (c *Client) UnlinkIssueFromPlan(projID, planID, issueID string) error

UnlinkIssueFromPlan removes a link between an issue and a plan.

func (*Client) UpdateIssue

func (c *Client) UpdateIssue(projID, id string, updates map[string]any) (*types.Issue, error)

UpdateIssue updates an issue.

func (*Client) UpdatePlan added in v0.7.0

func (c *Client) UpdatePlan(projID, planID, title, content string) (*types.Plan, error)

UpdatePlan updates a shared plan.

func (*Client) UpdateProject added in v0.12.0

func (c *Client) UpdateProject(id string, updates map[string]any) (*types.Project, error)

UpdateProject updates a project.

func (*Client) UpdateWorkspace added in v0.12.0

func (c *Client) UpdateWorkspace(projID, wsID string, updates map[string]string) (*types.Workspace, error)

UpdateWorkspace updates a workspace's metadata.

type CreateIssueRequest

type CreateIssueRequest struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Priority    int    `json:"priority,omitempty"`
	IssueType   string `json:"issue_type,omitempty"`
	Assignee    string `json:"assignee,omitempty"`
	ParentID    string `json:"parent_id,omitempty"` // For hierarchical child IDs
}

CreateIssueRequest is the request for creating an issue.

type CreateWorkspaceRequest added in v0.12.0

type CreateWorkspaceRequest struct {
	Path      string `json:"path"`
	Label     string `json:"label,omitempty"`
	Hostname  string `json:"hostname,omitempty"`
	GitRemote string `json:"git_remote,omitempty"`
	PathType  string `json:"path_type,omitempty"`
}

CreateWorkspaceRequest is the request for registering a workspace (directory path).

type ListIssuesOptions

type ListIssuesOptions struct {
	Status   string // Filter by status (e.g., "open", "closed")
	Type     string // Filter by issue type (e.g., "bug", "feature")
	Assignee string // Filter by assignee name
	Query    string // Full-text search in title/description
	Limit    int    // Maximum number of results
	Parent   string // Filter by parent issue ID
}

ListIssuesOptions configures issue listing. All fields are optional; zero values are omitted from the query.

Jump to

Keyboard shortcuts

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