api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL = "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
}

func NewClient

func NewClient(authHeader string) *Client

NewClient creates a new Linear API client

func (*Client) Execute

func (c *Client) Execute(ctx context.Context, query string, variables map[string]interface{}, result interface{}) error

Execute performs a GraphQL request

func (*Client) GetIssue

func (c *Client) GetIssue(ctx context.Context, id string) (*Issue, error)

GetIssue returns a single issue by ID

func (*Client) GetIssues

func (c *Client) GetIssues(ctx context.Context, filter map[string]interface{}, first int, after string) (*Issues, error)

GetIssues returns a list of issues with optional filtering

func (*Client) GetProjects

func (c *Client) GetProjects(ctx context.Context, filter map[string]interface{}, first int, after string) (*Projects, error)

GetProjects returns a list of projects

func (*Client) GetRateLimit

func (c *Client) GetRateLimit(ctx context.Context) (*RateLimit, error)

Rate limiting helper

func (*Client) GetTeams

func (c *Client) GetTeams(ctx context.Context, first int, after string) (*Teams, error)

GetTeams returns a list of teams

func (*Client) GetViewer

func (c *Client) GetViewer(ctx context.Context) (*User, error)

GetViewer returns the current authenticated user

type GraphQLError

type GraphQLError struct {
	Message   string                 `json:"message"`
	Locations []GraphQLErrorLocation `json:"locations,omitempty"`
	Path      []interface{}          `json:"path,omitempty"`
}

type GraphQLErrorLocation

type GraphQLErrorLocation struct {
	Line   int `json:"line"`
	Column int `json:"column"`
}

type GraphQLRequest

type GraphQLRequest struct {
	Query     string                 `json:"query"`
	Variables map[string]interface{} `json:"variables,omitempty"`
}

type GraphQLResponse

type GraphQLResponse struct {
	Data   json.RawMessage `json:"data"`
	Errors []GraphQLError  `json:"errors,omitempty"`
}

type Issue

type Issue struct {
	ID          string    `json:"id"`
	Identifier  string    `json:"identifier"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Priority    int       `json:"priority"`
	Estimate    *float64  `json:"estimate"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	DueDate     *string   `json:"dueDate"`
	State       *State    `json:"state"`
	Assignee    *User     `json:"assignee"`
	Team        *Team     `json:"team"`
	Labels      *Labels   `json:"labels"`
}

Issue represents a Linear issue

type Issues

type Issues struct {
	Nodes    []Issue  `json:"nodes"`
	PageInfo PageInfo `json:"pageInfo"`
}

Paginated collections

type Label

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

type Labels

type Labels struct {
	Nodes []Label `json:"nodes"`
}

type PageInfo

type PageInfo struct {
	HasNextPage bool   `json:"hasNextPage"`
	EndCursor   string `json:"endCursor"`
}

type Project

type Project struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	State       string  `json:"state"`
	Progress    float64 `json:"progress"`
	StartDate   *string `json:"startDate"`
	TargetDate  *string `json:"targetDate"`
	Lead        *User   `json:"lead"`
	Teams       *Teams  `json:"teams"`
}

Project represents a Linear project

type Projects

type Projects struct {
	Nodes    []Project `json:"nodes"`
	PageInfo PageInfo  `json:"pageInfo"`
}

type RateLimit

type RateLimit struct {
	Limit     int       `json:"limit"`
	Remaining int       `json:"remaining"`
	Reset     time.Time `json:"reset"`
}

type State

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

State represents an issue state

type Team

type Team struct {
	ID          string `json:"id"`
	Key         string `json:"key"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Private     bool   `json:"private"`
	IssueCount  int    `json:"issueCount"`
}

Team represents a Linear team

type Teams

type Teams struct {
	Nodes    []Team   `json:"nodes"`
	PageInfo PageInfo `json:"pageInfo"`
}

type User

type User struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	AvatarURL string `json:"avatarUrl"`
	IsMe      bool   `json:"isMe"`
	Active    bool   `json:"active"`
	Admin     bool   `json:"admin"`
}

User represents a Linear user

type Users

type Users struct {
	Nodes    []User   `json:"nodes"`
	PageInfo PageInfo `json:"pageInfo"`
}

Jump to

Keyboard shortcuts

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