linear

package
v0.0.16-test-debug-6 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const APIEndpoint = "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(ctx context.Context, apiKey string) (*Client, error)

func (*Client) AddMemberToTeam added in v0.0.6

func (c *Client) AddMemberToTeam(ctx context.Context, teamId, userId string) (string, error)

func (*Client) Authorize

Authorize returns permissions of user calling the API.

func (*Client) BulkCreateIssues added in v0.0.10

func (c *Client) BulkCreateIssues(ctx context.Context, payloads []CreateIssuePayload) ([]Issue, error)

func (*Client) CreateIssue added in v0.0.10

func (c *Client) CreateIssue(ctx context.Context, payload CreateIssuePayload) (*Issue, error)

func (*Client) CreateIssueLabel added in v0.0.10

func (c *Client) CreateIssueLabel(ctx context.Context, labelName string) (*IssueLabel, *http.Response, *v2.RateLimitDescription, error)

func (*Client) GetIssue added in v0.0.10

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

func (*Client) GetIssueLabel added in v0.0.10

func (c *Client) GetIssueLabel(ctx context.Context, labelName string) (*IssueLabel, *http.Response, *v2.RateLimitDescription, error)

func (*Client) GetOrganization

func (c *Client) GetOrganization(ctx context.Context, paginationVars PaginationVars) (Organization, Tokens, *http.Response, *v2.RateLimitDescription, error)

GetOrganization returns a single Linear organization.

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, getProjectVars GetProjectVars) (Project, Tokens, *http.Response, *v2.RateLimitDescription, error)

GetProject returns single Project details.

func (*Client) GetProjects

func (c *Client) GetProjects(ctx context.Context, getResourceVars GetResourcesVars) ([]Project, string, *http.Response, *v2.RateLimitDescription, error)

GetProjects returns all projects from Linear organization.

func (*Client) GetTeam

func (c *Client) GetTeam(ctx context.Context, getTeamVars GetTeamVars) (Team, string, *http.Response, *v2.RateLimitDescription, error)

GetTeam returns single Team details.

func (*Client) GetTeamMemberships added in v0.0.6

func (c *Client) GetTeamMemberships(ctx context.Context, getTeamVars GetTeamVars) ([]TeamMembership, string, *http.Response, *v2.RateLimitDescription, error)

GetTeamMemberships returns team memberships from Linear organization.

func (*Client) GetTeams

func (c *Client) GetTeams(ctx context.Context, getResourceVars GetResourcesVars) ([]Team, string, *http.Response, *v2.RateLimitDescription, error)

GetTeams returns all teams from Linear organization.

func (*Client) GetUsers

func (c *Client) GetUsers(ctx context.Context, getResourceVars GetResourcesVars) ([]User, string, *http.Response, *v2.RateLimitDescription, error)

GetUsers returns all users from Linear organization.

func (*Client) ListIssueFields added in v0.0.10

func (c *Client) ListIssueFields(ctx context.Context) ([]IssueField, string, *http.Response, *v2.RateLimitDescription, error)

func (*Client) ListIssuesByIDs added in v0.0.10

func (c *Client) ListIssuesByIDs(ctx context.Context, issueIDs []string) ([]Issue, *http.Response, *v2.RateLimitDescription, error)

func (*Client) ListTeamWorkflowStates added in v0.0.10

func (c *Client) ListTeamWorkflowStates(ctx context.Context, getTeamsVars GetTeamsVars) ([]Team, string, *http.Response, *v2.RateLimitDescription, error)

ListTeamWorkflowStates returns workflow states for specific teams.

func (*Client) RemoveTeamMembership added in v0.0.6

func (c *Client) RemoveTeamMembership(ctx context.Context, teamMembershipId string) (bool, error)

type CreateIssuePayload added in v0.0.10

type CreateIssuePayload struct {
	TeamId       string
	Title        string
	Description  string
	LabelIDs     []string
	FieldOptions map[string]interface{}
}

type FieldOption added in v0.0.10

type FieldOption func(createIssuePayload *CreateIssuePayload)

type GetProjectVars

type GetProjectVars struct {
	First      int    `json:"first,omitempty"`
	UsersAfter string `json:"usersAfter,omitempty"`
	TeamsAfter string `json:"teamsAfter,omitempty"`
	ProjectId  string `json:"projectId,omitempty"`
}

type GetResourcesVars

type GetResourcesVars struct {
	First int    `json:"first,omitempty"`
	After string `json:"after,omitempty"`
}

type GetTeamVars

type GetTeamVars struct {
	TeamId string `json:"teamId"`
	After  string `json:"after,omitempty"`
	First  int    `json:"first,omitempty"`
}

type GetTeamsVars added in v0.0.10

type GetTeamsVars struct {
	TeamIDs []string `json:"teamIds,omitempty"`
	After   string   `json:"after,omitempty"`
	First   int      `json:"first,omitempty"`
}

type GraphQLError

type GraphQLError struct {
	Error  string `json:"error"`
	Errors []struct {
		Message string `json:"message"`
	} `json:"errors"`
}

func (*GraphQLError) Message added in v0.0.7

func (e *GraphQLError) Message() string

type GraphQLIssueFieldsResponse added in v0.0.10

type GraphQLIssueFieldsResponse struct {
	Data struct {
		Type struct {
			InputFields []IssueField `json:"inputFields"`
		} `json:"__type"`
	} `json:"data"`
}

type GraphQLIssueLabelsResponse added in v0.0.10

type GraphQLIssueLabelsResponse struct {
	Data struct {
		IssueLabels struct {
			Nodes []IssueLabel `json:"nodes"`
		} `json:"issueLabels"`
	} `json:"data"`
}

type GraphQLIssuesResponse added in v0.0.10

type GraphQLIssuesResponse struct {
	Data struct {
		Issues struct {
			Nodes []Issue `json:"nodes"`
		} `json:"issues"`
	} `json:"data"`
}

type GraphQLOrganizationResponse

type GraphQLOrganizationResponse struct {
	Data struct {
		Organization Organization `json:"organization"`
	} `json:"data"`
}

type GraphQLProjectResponse

type GraphQLProjectResponse struct {
	Data struct {
		Project Project `json:"project"`
	} `json:"data"`
}

type GraphQLProjectsResponse

type GraphQLProjectsResponse struct {
	Data struct {
		Projects Projects `json:"projects"`
	} `json:"data"`
}

type GraphQLTeamResponse

type GraphQLTeamResponse struct {
	Data struct {
		Team Team `json:"team"`
	} `json:"data"`
}

type GraphQLTeamsResponse

type GraphQLTeamsResponse struct {
	Data struct {
		Teams Teams `json:"teams"`
	} `json:"data"`
}

type GraphQLUsersResponse

type GraphQLUsersResponse struct {
	Data struct {
		Users Users `json:"users"`
	} `json:"data"`
}

type GraphQLViewerResponse

type GraphQLViewerResponse struct {
	Data struct {
		Viewer ViewerPermissions `json:"viewer"`
	} `json:"data"`
}

type Issue added in v0.0.10

type Issue struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	State       struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"state"`
	Labels struct {
		Nodes []struct {
			ID   string `json:"id"`
			Name string `json:"name"`
		} `json:"nodes"`
	} `json:"labels,omitempty"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	URL       string    `json:"url"`
}

type IssueField added in v0.0.10

type IssueField struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Type        IssueFieldType `json:"type"`
}

type IssueFieldEnumValue added in v0.0.10

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

type IssueFieldType added in v0.0.10

type IssueFieldType struct {
	Name        string                `json:"name"`
	Description string                `json:"description"`
	Kind        string                `json:"kind"`
	OfType      *IssueFieldType       `json:"ofType,omitempty"`
	EnumValues  []IssueFieldEnumValue `json:"enumValues,omitempty"`
}

type IssueLabel added in v0.0.10

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

type Organization

type Organization struct {
	ID           string      `json:"id"`
	Name         string      `json:"name"`
	SamlEnabled  bool        `json:"samlEnabled"`
	ScimEnabled  bool        `json:"scimEnabled"`
	Subscription interface{} `json:"subscription"`
	URLKey       string      `json:"urlKey"`
	UserCount    int         `json:"userCount"`
	Users        struct {
		Nodes    []User   `json:"nodes"`
		PageInfo PageInfo `json:"pageInfo"`
	} `json:"users"`
	Teams struct {
		Nodes    []Team   `json:"nodes"`
		PageInfo PageInfo `json:"pageInfo"`
	} `json:"teams"`
}

type PageInfo

type PageInfo struct {
	EndCursor       string `json:"endCursor"`
	HasNextPage     bool   `json:"hasNextPage"`
	HasPreviousPage bool   `json:"hasPreviousPage"`
	StartCursor     string `json:"startCursor"`
}

type PageState

type PageState struct {
	Token          string `json:"token"`
	ResourceTypeID string `json:"resource_type_id"`
	ResourceID     string `json:"resource_id"`
}

type PaginationVars

type PaginationVars struct {
	First      int    `json:"first,omitempty"`
	UsersAfter string `json:"usersAfter,omitempty"`
	TeamsAfter string `json:"teamsAfter,omitempty"`
}

type Project

type Project struct {
	Description string `json:"description"`
	ID          string `json:"id"`
	Name        string `json:"name"`
	SlugID      string `json:"slugId"`
	URL         string `json:"url"`
	Teams       struct {
		Nodes    []Team   `json:"nodes"`
		PageInfo PageInfo `json:"pageInfo"`
	} `json:"teams"`
	Members struct {
		Nodes    []User   `json:"nodes"`
		PageInfo PageInfo `json:"pageInfo"`
	} `json:"members"`
}

type ProjectTokensState

type ProjectTokensState struct {
	States       []PageState `json:"states"`
	CurrentState PageState   `json:"current_state"`
}

type Projects

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

type SuccessResponse added in v0.0.6

type SuccessResponse struct {
	Success bool `json:"success"`
}

type Team

type Team struct {
	ID          string      `json:"id"`
	Name        string      `json:"name"`
	Key         string      `json:"key"`
	Description interface{} `json:"description"`
	Memberships struct {
		Nodes    []TeamMembership `json:"nodes"`
		PageInfo PageInfo         `json:"pageInfo"`
	}
	States struct {
		Nodes    []WorkflowState `json:"nodes"`
		PageInfo PageInfo        `json:"pageInfo"`
	} `json:"states,omitempty"`
}

type TeamMembership added in v0.0.6

type TeamMembership struct {
	ID   string `json:"id"`
	User User   `json:"user"`
	Team Team   `json:"team"`
}

type Teams

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

type Tokens

type Tokens struct {
	UsersToken string `json:"usersToken,omitempty"`
	TeamsToken string `json:"teamsToken,omitempty"`
}

type User

type User struct {
	Active       bool         `json:"active"`
	Admin        bool         `json:"admin"`
	DisplayName  string       `json:"displayName"`
	Email        string       `json:"email"`
	Guest        bool         `json:"guest"`
	ID           string       `json:"id"`
	IsMe         bool         `json:"isMe"`
	Name         string       `json:"name"`
	URL          string       `json:"url"`
	Description  interface{}  `json:"description"`
	Organization Organization `json:"organization"`
	Teams        struct {
		Nodes []Team `json:"nodes"`
	} `json:"teams"`
}

type Users

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

type ViewerPermissions

type ViewerPermissions struct {
	Guest bool   `json:"guest"`
	Admin bool   `json:"admin"`
	ID    string `json:"id"`
}

type WorkflowState added in v0.0.10

type WorkflowState struct {
	ID       string       `json:"id"`
	Name     string       `json:"name"`
	Color    string       `json:"color"`
	Type     WorkflowType `json:"type"`
	Position float64      `json:"position"`
}

type WorkflowType added in v0.0.10

type WorkflowType string
const (
	Backlog   WorkflowType = "backlog"
	Unstarted WorkflowType = "unstarted"
	Started   WorkflowType = "started"
	Completed WorkflowType = "completed"
	Canceled  WorkflowType = "canceled"
)

Jump to

Keyboard shortcuts

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