Skip to content

createLinearClient

createLinearClient(opts): object

Defined in: index.ts:33

Creates a Linear client with teams, issues and projects groups and the raw graphql handle.

LinearClientOptions

object

graphql: LinearGraphQL

issues: object

attach(issueId, url, title): Promise<void>

Attaches a link to the issue. Linear keeps one attachment per issue and url.

string

string

string

Promise<void>

attachmentsForUrl(url): Promise<LinearAttachment[]>

The attachments with exactly this url, which is how a migration finds what it already made.

string

Promise<LinearAttachment[]>

comment(issueId, body, createdAt?): Promise<LinearComment>

Adds a comment; createdAt backdates it.

string

string

string

Promise<LinearComment>

comments(issueId): Promise<LinearComment[]>

Every comment on the issue, oldest first.

string

Promise<LinearComment[]>

create(input): Promise<LinearIssue>

Makes an issue.

LinearIssueCreate

Promise<LinearIssue>

get(ref): Promise<LinearIssue>

One issue by ENG-42 or by id.

string

Promise<LinearIssue>

list(filter?): Promise<LinearIssue[]>

Issues matching the filter, newest update first; stops at limit.

LinearIssueFilter = {}

Promise<LinearIssue[]>

relate(issueId, relatedIssueId, type): Promise<void>

Relates two issues: blocks means issueId blocks relatedIssueId.

string

string

"blocks" | "duplicate" | "related"

Promise<void>

unrelate(relationId): Promise<void>

Deletes a relation by its id (read from an issue’s relations or inverseRelations).

string

Promise<void>

update(id, input): Promise<LinearIssue>

Changes the fields given and leaves the rest.

string

LinearIssueUpdate

Promise<LinearIssue>

projects: object

archive(id): Promise<void>

Archives the project. Reversible with unarchive.

string

Promise<void>

create(input): Promise<LinearProject>

Makes a project for the given teams.

string

string

string

string[]

Promise<LinearProject>

list(): Promise<LinearProject[]>

Every project, archived ones included.

Promise<LinearProject[]>

statuses(): Promise<LinearProjectStatus[]>

The project’s statuses (Backlog, Planned, In Progress, Completed, Canceled, …).

Promise<LinearProjectStatus[]>

unarchive(id): Promise<void>

Brings an archived project back.

string

Promise<void>

teams: object

automation(teamId): Promise<LinearTeamAutomation>

The team’s archive and close settings, which are the automation Linear exposes.

string

Promise<LinearTeamAutomation>

createGitAutomation(input): Promise<LinearGitAutomationState>

Makes a git automation rule (gitAutomationStateCreate); without targetBranchId it applies to all branches.

LinearGitEvent

string

string

string

Promise<LinearGitAutomationState>

createGitTargetBranch(input): Promise<LinearGitTargetBranch>

Makes a target branch for the team (gitAutomationTargetBranchCreate); an exact name unless isRegex.

string

boolean

string

Promise<LinearGitTargetBranch>

createLabel(input): Promise<LinearLabel>

Makes a label; without teamId it is workspace-wide.

string

string

string

Promise<LinearLabel>

createState(teamId, input): Promise<LinearWorkflowState>

Adds a status to the team’s workflow.

string

string

string

string

LinearStateType

Promise<LinearWorkflowState>

find(ref): Promise<LinearTeam | undefined>

A team by its key (ENG), name or id, or undefined.

string

Promise<LinearTeam | undefined>

gitAutomation(teamId): Promise<LinearGitAutomationState[]>

The team’s git automation rules (gitAutomationStates), each with the state and target branch it names.

string

Promise<LinearGitAutomationState[]>

labels(teamId?): Promise<LinearLabel[]>

Labels of the team and the workspace-wide ones.

string

Promise<LinearLabel[]>

list(): Promise<LinearTeam[]>

Every team the token can see.

Promise<LinearTeam[]>

states(teamId): Promise<LinearWorkflowState[]>

The team’s issue statuses, in board order.

string

Promise<LinearWorkflowState[]>

updateAutomation(teamId, input): Promise<LinearTeamAutomation>

Changes the team’s auto-archive and auto-close settings (teamUpdate); a field left out is left alone, a null autoClosePeriod switches auto-close off and a 0 autoArchivePeriod switches auto-archive off. Needs a key with admin access to the team.

string

number

number | null

string

Promise<LinearTeamAutomation>

updateGitAutomation(id, input): Promise<LinearGitAutomationState>

Points an existing git automation rule at another state (gitAutomationStateUpdate).

string

string

Promise<LinearGitAutomationState>

users(): Promise<LinearUser[]>

Every active member of the workspace.

Promise<LinearUser[]>

viewer(): Promise<{ organization: { id: string; name: string; urlKey: string; }; user: LinearUser; }>

The user the token belongs to, and the workspace.

Promise<{ organization: { id: string; name: string; urlKey: string; }; user: LinearUser; }>