Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) ArchiveIssue(ctx context.Context, issueID string) error
- func (c *Client) CreateComment(ctx context.Context, input CreateCommentInput) (Comment, error)
- func (c *Client) CreateIssue(ctx context.Context, input CreateIssueInput) (Issue, error)
- func (c *Client) Endpoint() string
- func (c *Client) FetchIssueByID(ctx context.Context, id string) (Issue, error)
- func (c *Client) FetchIssues(ctx context.Context, params FetchIssuesParams) ([]Issue, error)
- func (c *Client) GetCurrentUser(ctx context.Context) (User, error)
- func (c *Client) ListIssueLabels(ctx context.Context, teamID string) ([]IssueLabel, error)
- func (c *Client) ListProjects(ctx context.Context, teamID string) ([]Project, error)
- func (c *Client) ListTeamLabels(ctx context.Context, teamID string) ([]IssueLabel, error)
- func (c *Client) ListTeams(ctx context.Context) ([]Team, error)
- func (c *Client) ListUsers(ctx context.Context, teamID string) ([]User, error)
- func (c *Client) ListWorkflowStates(ctx context.Context, teamID string) ([]WorkflowState, error)
- func (c *Client) ListWorkspaceLabels(ctx context.Context) ([]IssueLabel, error)
- func (c *Client) UnarchiveIssue(ctx context.Context, issueID string) error
- func (c *Client) UpdateIssue(ctx context.Context, input UpdateIssueInput) (Issue, error)
- type ClientConfig
- type Comment
- type CommentCreateInput
- type CreateCommentInput
- type CreateIssueInput
- type FetchIssuesParams
- type Issue
- type IssueChildRef
- type IssueCreateInput
- type IssueFilter
- type IssueLabel
- type IssueRef
- type IssueUpdateInput
- type PaginationOrderBy
- type Project
- type Team
- type UpdateIssueInput
- type User
- type WorkflowState
Constants ¶
const (
// DefaultEndpoint is the default Linear API GraphQL endpoint.
DefaultEndpoint = "https://api.linear.app/graphql"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for interacting with the Linear GraphQL API.
func NewClient ¶
func NewClient(cfg ClientConfig) *Client
NewClient creates a new Linear API client with the provided configuration.
func NewClientWithToken ¶
NewClientWithToken creates a new Linear API client with just a token (convenience method).
func (*Client) ArchiveIssue ¶
ArchiveIssue archives an issue.
func (*Client) CreateComment ¶
CreateComment creates a new comment on an issue.
func (*Client) CreateIssue ¶
CreateIssue creates a new issue.
func (*Client) FetchIssueByID ¶
FetchIssueByID fetches a single issue by its ID.
func (*Client) FetchIssues ¶
FetchIssues fetches issues with optional filtering and sorting.
func (*Client) GetCurrentUser ¶
GetCurrentUser fetches the current authenticated user.
func (*Client) ListIssueLabels ¶
ListIssueLabels fetches both workspace and team labels, merges them, and returns a sorted list. Labels are de-duplicated by ID, with team labels taking precedence.
func (*Client) ListProjects ¶
ListProjects fetches all projects for a team.
func (*Client) ListTeamLabels ¶
ListTeamLabels fetches labels scoped to a specific team.
func (*Client) ListWorkflowStates ¶
ListWorkflowStates fetches all workflow states for a team.
func (*Client) ListWorkspaceLabels ¶
func (c *Client) ListWorkspaceLabels(ctx context.Context) ([]IssueLabel, error)
ListWorkspaceLabels fetches all workspace-level labels (not scoped to a team).
func (*Client) UnarchiveIssue ¶
UnarchiveIssue unarchives an issue.
func (*Client) UpdateIssue ¶
UpdateIssue updates an existing issue.
type ClientConfig ¶
type ClientConfig struct {
// Token is the Linear API key for authentication.
Token string
// Endpoint is the GraphQL API endpoint (defaults to Linear's production endpoint).
Endpoint string
// HTTPClient is an optional custom HTTP client (useful for testing).
HTTPClient *http.Client
// Timeout is the HTTP request timeout (defaults to 30s).
Timeout time.Duration
}
ClientConfig contains configuration for creating a new Linear API client.
type Comment ¶
type Comment struct {
ID string
Body string
CreatedAt time.Time
UpdatedAt time.Time
Author User
IssueID string
}
Comment represents a comment on a Linear issue.
type CommentCreateInput ¶ added in v0.2.0
type CommentCreateInput map[string]interface{}
CommentCreateInput is a custom scalar type for Linear's CommentCreateInput. The Go type name must match the GraphQL type name exactly.
func (CommentCreateInput) GetGraphQLType ¶ added in v0.2.0
func (CommentCreateInput) GetGraphQLType() string
GetGraphQLType returns the GraphQL type name for the input.
func (CommentCreateInput) MarshalJSON ¶ added in v0.2.0
func (c CommentCreateInput) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for CommentCreateInput.
type CreateCommentInput ¶
CreateCommentInput contains input for creating a new comment.
type CreateIssueInput ¶
type CreateIssueInput struct {
TeamID string
Title string
Description string
ProjectID string
StateID string
AssigneeID string
Priority int
ParentID string // Parent issue ID (empty for top-level issues)
}
CreateIssueInput contains input for creating a new issue.
type FetchIssuesParams ¶
type FetchIssuesParams struct {
TeamID string
ProjectID string
Search string
// OrderBy specifies the sort order. Valid API values are "updatedAt" and "createdAt".
// "priority" is also supported and will be sorted client-side after fetching.
OrderBy string
First int
}
FetchIssuesParams contains parameters for fetching issues.
type Issue ¶
type Issue struct {
ID string
Identifier string
Title string
Description string
State string
StateID string
Assignee string
AssigneeID string
Priority int
UpdatedAt time.Time
CreatedAt time.Time
TeamID string
ProjectID string
URL string
Archived bool
Labels []IssueLabel
Parent *IssueRef // Parent issue reference (nil if top-level)
Children []IssueChildRef // Child/sub-issue references
Comments []Comment // Comments on this issue
}
Issue represents a Linear issue.
type IssueChildRef ¶
IssueChildRef represents a lightweight reference to a child issue.
type IssueCreateInput ¶
type IssueCreateInput map[string]interface{}
IssueCreateInput is a custom scalar type for Linear's IssueCreateInput. The Go type name must match the GraphQL type name exactly.
func (IssueCreateInput) GetGraphQLType ¶
func (IssueCreateInput) GetGraphQLType() string
GetGraphQLType returns the GraphQL type name for the input.
func (IssueCreateInput) MarshalJSON ¶
func (i IssueCreateInput) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for IssueCreateInput.
type IssueFilter ¶
type IssueFilter map[string]interface{}
IssueFilter is a custom scalar type for Linear's IssueFilter input. It allows passing complex filter objects to the GraphQL API.
func (IssueFilter) GetGraphQLType ¶
func (IssueFilter) GetGraphQLType() string
GetGraphQLType returns the GraphQL type name for the filter.
func (IssueFilter) MarshalJSON ¶
func (f IssueFilter) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for IssueFilter.
type IssueLabel ¶
IssueLabel represents a label that can be applied to issues.
type IssueUpdateInput ¶
type IssueUpdateInput map[string]interface{}
IssueUpdateInput is a custom scalar type for Linear's IssueUpdateInput. The Go type name must match the GraphQL type name exactly.
func (IssueUpdateInput) GetGraphQLType ¶
func (IssueUpdateInput) GetGraphQLType() string
GetGraphQLType returns the GraphQL type name for the input.
func (IssueUpdateInput) MarshalJSON ¶
func (i IssueUpdateInput) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for IssueUpdateInput.
type PaginationOrderBy ¶
type PaginationOrderBy string
PaginationOrderBy is a custom type for Linear's PaginationOrderBy enum. Valid values are "createdAt" and "updatedAt".
const ( OrderByCreatedAt PaginationOrderBy = "createdAt" OrderByUpdatedAt PaginationOrderBy = "updatedAt" )
Common PaginationOrderBy values.
func (PaginationOrderBy) GetGraphQLType ¶
func (PaginationOrderBy) GetGraphQLType() string
GetGraphQLType returns the GraphQL type name for the enum.
type UpdateIssueInput ¶
type UpdateIssueInput struct {
ID string
Title *string
Description *string
StateID *string
AssigneeID *string
Priority *int
LabelIDs *[]string // nil = no change, empty slice = clear all, non-empty = set labels
ParentID *string // nil = no change, empty string = clear parent, non-empty = set parent
}
UpdateIssueInput contains input for updating an issue.