service

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package service provides a service layer between interfaces (CLI/MCP) and the Linear client. It handles business logic, validation, identifier resolution, and response formatting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzeInput

type AnalyzeInput struct {
	TeamID                string
	CycleCount            int
	AssigneeID            string
	IncludeRecommendation bool
}

AnalyzeInput represents input for cycle analysis

type CreateCycleInput

type CreateCycleInput struct {
	TeamID      string
	Name        string
	Description string
	StartsAt    string
	EndsAt      string
}

CreateCycleInput represents input for creating a cycle

type CreateIssueInput

type CreateIssueInput struct {
	Title       string
	Description string
	TeamID      string
	StateID     string
	AssigneeID  string
	ProjectID   string
	ParentID    string
	CycleID     string
	Priority    *int
	Estimate    *float64
	DueDate     string
	LabelIDs    []string
	DependsOn   []string // Issue identifiers this issue depends on (stored in metadata)
	BlockedBy   []string // Issue identifiers that block this issue (stored in metadata)
}

CreateIssueInput represents input for creating an issue

type CreateProjectInput

type CreateProjectInput struct {
	Name        string
	Description string
	TeamID      string
	State       string // planned, started, paused, completed, canceled
	LeadID      string // Project lead user ID
	StartDate   string // Start date YYYY-MM-DD
	EndDate     string // Target end date YYYY-MM-DD
}

CreateProjectInput represents input for creating a project

type CycleFilters

type CycleFilters struct {
	TeamID   string
	IsActive *bool
	IsFuture *bool
	IsPast   *bool
	Limit    int
	After    string
	Format   format.Format
}

CycleFilters represents filters for searching cycles

type CycleService

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

CycleService handles cycle-related operations

func NewCycleService

func NewCycleService(client *linear.Client, formatter *format.Formatter) *CycleService

NewCycleService creates a new CycleService

func (*CycleService) Analyze

func (s *CycleService) Analyze(input *AnalyzeInput) (string, error)

Analyze performs cycle analytics for capacity planning

func (*CycleService) Create

func (s *CycleService) Create(input *CreateCycleInput) (string, error)

Create creates a new cycle

func (*CycleService) Get

func (s *CycleService) Get(cycleIDOrNumber string, teamID string, outputFormat format.Format) (string, error)

Get retrieves a single cycle by ID, number, or name

func (*CycleService) Search

func (s *CycleService) Search(filters *CycleFilters) (string, error)

Search searches for cycles with the given filters

type IssueService

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

IssueService handles issue-related operations

func NewIssueService

func NewIssueService(client *linear.Client, formatter *format.Formatter) *IssueService

NewIssueService creates a new IssueService

func (*IssueService) AddComment

func (s *IssueService) AddComment(identifier, body string) (string, error)

AddComment adds a comment to an issue

func (*IssueService) AddReaction

func (s *IssueService) AddReaction(targetID, emoji string) error

AddReaction adds a reaction to an issue or comment

func (*IssueService) Create

func (s *IssueService) Create(input *CreateIssueInput) (string, error)

Create creates a new issue

func (*IssueService) Get

func (s *IssueService) Get(identifier string, outputFormat format.Format) (string, error)

Get retrieves a single issue by identifier (e.g., "CEN-123")

func (*IssueService) GetComments

func (s *IssueService) GetComments(identifier string) (string, error)

GetComments returns comments for an issue

func (*IssueService) GetIssueID

func (s *IssueService) GetIssueID(identifier string) (string, error)

GetIssueID resolves an issue identifier to its UUID

func (*IssueService) ListAssigned

func (s *IssueService) ListAssigned(limit int, outputFormat format.Format) (string, error)

ListAssigned lists issues assigned to the current user

func (*IssueService) ListAssignedWithPagination

func (s *IssueService) ListAssignedWithPagination(pagination *linear.PaginationInput) (string, error)

ListAssignedWithPagination lists assigned issues with offset-based pagination

func (*IssueService) ReplyToComment

func (s *IssueService) ReplyToComment(issueIdentifier, parentCommentID, body string) (*linear.Comment, error)

ReplyToComment replies to an existing comment

func (*IssueService) Search

func (s *IssueService) Search(filters *SearchFilters) (string, error)

Search searches for issues with the given filters

func (*IssueService) Update

func (s *IssueService) Update(identifier string, input *UpdateIssueInput) (string, error)

Update updates an existing issue

type ProjectService

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

ProjectService handles project-related operations

func NewProjectService

func NewProjectService(client *linear.Client, formatter *format.Formatter) *ProjectService

NewProjectService creates a new ProjectService

func (*ProjectService) Create

func (s *ProjectService) Create(input *CreateProjectInput) (string, error)

Create creates a new project

func (*ProjectService) Get

func (s *ProjectService) Get(projectID string) (string, error)

Get retrieves a single project by ID

func (*ProjectService) ListAll

func (s *ProjectService) ListAll(limit int) (string, error)

ListAll lists all projects in the workspace

func (*ProjectService) ListUserProjects

func (s *ProjectService) ListUserProjects(limit int) (string, error)

ListUserProjects lists projects that have issues assigned to the user

func (*ProjectService) Update

func (s *ProjectService) Update(projectID string, input *UpdateProjectInput) (string, error)

Update updates an existing project

type SearchFilters

type SearchFilters struct {
	TeamID     string
	AssigneeID string
	CycleID    string
	StateIDs   []string
	LabelIDs   []string
	Priority   *int
	SearchTerm string
	Limit      int
	After      string
	Format     format.Format
}

SearchFilters represents filters for searching issues

type SearchOptions added in v1.2.0

type SearchOptions struct {
	EntityType string
	TextQuery  string

	// Standard filters
	TeamID     string
	StateIDs   []string
	Priority   *int
	AssigneeID string
	CycleID    string
	LabelIDs   []string

	// Dependency filters (NEW)
	BlockedBy   string // Issue ID that blocks results
	Blocks      string // Issue ID that results block
	HasBlockers bool   // Filter to issues with blockers
	HasDeps     bool   // Filter to issues with dependencies
	HasCircular bool   // Filter to issues in circular deps
	MaxDepth    int    // Max dependency depth

	// Pagination
	Limit  int
	After  string
	Format format.Format
}

SearchOptions represents unified search parameters

type SearchService added in v1.2.0

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

SearchService handles unified search operations across entities

func NewSearchService added in v1.2.0

func NewSearchService(client *linear.Client, formatter *format.Formatter) *SearchService

NewSearchService creates a new SearchService

func (*SearchService) Search added in v1.2.0

func (s *SearchService) Search(opts *SearchOptions) (string, error)

Search performs unified search across entities

type Services

type Services struct {
	Issues   *IssueService
	Projects *ProjectService
	Cycles   *CycleService
	Teams    *TeamService
	Users    *UserService
	Search   *SearchService
}

Services holds all service instances

func New

func New(client *linear.Client) *Services

New creates all services with a shared Linear client and formatter

func (*Services) Client

func (s *Services) Client() *linear.Client

Client returns the underlying Linear client for advanced operations

type TeamService

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

TeamService handles team-related operations

func NewTeamService

func NewTeamService(client *linear.Client, formatter *format.Formatter) *TeamService

NewTeamService creates a new TeamService

func (*TeamService) Get

func (s *TeamService) Get(identifier string) (string, error)

Get retrieves a single team by ID or key

func (*TeamService) GetLabels

func (s *TeamService) GetLabels(identifier string) (string, error)

GetLabels returns labels for a team

func (*TeamService) GetWorkflowStates

func (s *TeamService) GetWorkflowStates(identifier string) (string, error)

GetWorkflowStates returns workflow states for a team

func (*TeamService) ListAll

func (s *TeamService) ListAll() (string, error)

ListAll lists all teams in the workspace

type UpdateIssueInput

type UpdateIssueInput struct {
	Title       *string
	Description *string
	StateID     *string
	AssigneeID  *string
	ProjectID   *string
	ParentID    *string
	TeamID      *string
	CycleID     *string
	Priority    *int
	Estimate    *float64
	DueDate     *string
	LabelIDs    []string
	DependsOn   []string // Issue identifiers this issue depends on (stored in metadata)
	BlockedBy   []string // Issue identifiers that block this issue (stored in metadata)
}

UpdateIssueInput represents input for updating an issue

type UpdateProjectInput

type UpdateProjectInput struct {
	Name        *string
	Description *string
	State       *string // planned, started, paused, completed, canceled
	LeadID      *string // Project lead user ID
	StartDate   *string // Start date YYYY-MM-DD
	EndDate     *string // Target end date YYYY-MM-DD
}

UpdateProjectInput represents input for updating a project

type UserFilters

type UserFilters struct {
	TeamID     string
	ActiveOnly *bool
	Limit      int
	After      string
}

UserFilters represents filters for searching users

type UserService

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

UserService handles user-related operations

func NewUserService

func NewUserService(client *linear.Client, formatter *format.Formatter) *UserService

NewUserService creates a new UserService

func (*UserService) Get

func (s *UserService) Get(identifier string) (string, error)

Get retrieves a single user by identifier (email, name, or ID)

func (*UserService) GetViewer

func (s *UserService) GetViewer() (string, error)

GetViewer returns the current authenticated user

func (*UserService) ResolveByName

func (s *UserService) ResolveByName(name string) (string, error)

ResolveByName resolves a user by name and returns their ID Supports: - "me" - returns current authenticated user - Email addresses: "john@company.com" - Display names: "John Doe" - Partial names: "John" (errors if ambiguous with suggestions)

Returns error with multiple user names if ambiguous

func (*UserService) Search

func (s *UserService) Search(filters *UserFilters) (string, error)

Search searches for users with the given filters

Jump to

Keyboard shortcuts

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