Class: Leash::Integration::LinearClient

Inherits:
Object
  • Object
show all
Defined in:
lib/leash/integration/linear.rb

Instance Method Summary collapse

Constructor Details

#initialize(leash) ⇒ LinearClient

Create a new Linear integration client.

Parameters:

  • leash (Leash::Client)

    the Leash SDK client



11
12
13
# File 'lib/leash/integration/linear.rb', line 11

def initialize(leash)
  @leash = leash
end

Instance Method Details

#linear_auth_callback(code) ⇒ Object

Handle OAuth callback

Parameters:

  • code (String)

    OAuth authorization code

Returns:

  • (Object)


19
20
21
22
23
24
# File 'lib/leash/integration/linear.rb', line 19

def linear_auth_callback(code)
  params = {
    'code' => code
  }.compact
  @leash.call('linear', 'linear_auth_callback', params)
end

#linear_bulk_update_issues(issueids, update) ⇒ Object

Update multiple issues at once

Parameters:

  • issueids (Array)

    List of issue UUIDs to update (not issue identifiers like ‘ENG-123’)

  • update (Hash)

Returns:

  • (Object)


71
72
73
74
75
76
77
# File 'lib/leash/integration/linear.rb', line 71

def linear_bulk_update_issues(issueids, update)
  params = {
    'issueIds' => issueids,
    'update' => update
  }.compact
  @leash.call('linear', 'linear_bulk_update_issues', params)
end

#linear_create_comment(body, issueid) ⇒ Object

Creates a new comment on an issue

Parameters:

  • body (String)

    Comment text content

  • issueid (String)

    ID of the issue to comment on

Returns:

  • (Object)


226
227
228
229
230
231
232
# File 'lib/leash/integration/linear.rb', line 226

def linear_create_comment(body, issueid)
  params = {
    'body' => body,
    'issueId' => issueid
  }.compact
  @leash.call('linear', 'linear_create_comment', params)
end

#linear_create_customer_need_from_attachment(attachmentid, title: nil, description: nil, teamid: nil) ⇒ Object

Creates a new customer need from an attachment

Parameters:

  • attachmentid (String)

    ID of the attachment

  • title (String, nil) (defaults to: nil)

    Title for the customer need

  • description (String, nil) (defaults to: nil)

    Description for the customer need

  • teamid (String, nil) (defaults to: nil)

    Team ID for the customer need

Returns:

  • (Object)


289
290
291
292
293
294
295
296
297
# File 'lib/leash/integration/linear.rb', line 289

def linear_create_customer_need_from_attachment(attachmentid, title: nil, description: nil, teamid: nil)
  params = {
    'attachmentId' => attachmentid,
    'title' => title,
    'description' => description,
    'teamId' => teamid
  }.compact
  @leash.call('linear', 'linear_create_customer_need_from_attachment', params)
end

#linear_create_issue(title, description, teamid, parentid: nil, labelids: nil, assigneeid: nil, priority: nil, createasuser: nil, displayiconurl: nil) ⇒ Object

Create a new issue in Linear

Parameters:

  • title (String)

    Issue title

  • description (String)

    Issue description

  • teamid (String)

    Team ID (UUID)

  • parentid (String, nil) (defaults to: nil)

    Parent issue ID (UUID, not issue identifier)

  • labelids (Array, nil) (defaults to: nil)

    Label UUIDs to apply, eg [‘a1eb5aed-7425-4ea5-98ec-dfab52381e0e’]

  • assigneeid (String, nil) (defaults to: nil)

    Assignee user ID (UUID)

  • priority (Float, nil) (defaults to: nil)

    Issue priority (0-4)

  • createasuser (String, nil) (defaults to: nil)

    Name to display for the created issue

  • displayiconurl (String, nil) (defaults to: nil)

    URL of the avatar to display

Returns:

  • (Object)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/leash/integration/linear.rb', line 38

def linear_create_issue(title, description, teamid, parentid: nil, labelids: nil, assigneeid: nil, priority: nil, createasuser: nil, displayiconurl: nil)
  params = {
    'title' => title,
    'description' => description,
    'teamId' => teamid,
    'parentId' => parentid,
    'labelIds' => labelids,
    'assigneeId' => assigneeid,
    'priority' => priority,
    'createAsUser' => createasuser,
    'displayIconUrl' => displayiconurl
  }.compact
  @leash.call('linear', 'linear_create_issue', params)
end

#linear_create_issues(issues) ⇒ Object

Create multiple issues at once

Parameters:

  • issues (Array)

    List of issues to create

Returns:

  • (Object)


214
215
216
217
218
219
# File 'lib/leash/integration/linear.rb', line 214

def linear_create_issues(issues)
  params = {
    'issues' => issues
  }.compact
  @leash.call('linear', 'linear_create_issues', params)
end

#linear_create_project_milestone(projectid, name, description: nil, targetdate: nil, sortorder: nil) ⇒ Object

Create a new project milestone

Parameters:

  • projectid (String)

    Project ID to create milestone for

  • name (String)

    Milestone name

  • description (String, nil) (defaults to: nil)

    Milestone description

  • targetdate (String, nil) (defaults to: nil)

    Target completion date (ISO format)

  • sortorder (Float, nil) (defaults to: nil)

    Sort order for the milestone

Returns:

  • (Object)


332
333
334
335
336
337
338
339
340
341
# File 'lib/leash/integration/linear.rb', line 332

def linear_create_project_milestone(projectid, name, description: nil, targetdate: nil, sortorder: nil)
  params = {
    'projectId' => projectid,
    'name' => name,
    'description' => description,
    'targetDate' => targetdate,
    'sortOrder' => sortorder
  }.compact
  @leash.call('linear', 'linear_create_project_milestone', params)
end

#linear_create_project_with_issues(project, issues) ⇒ Object

Create a new project with associated issues. Note: Project requires teamIds (array) not teamId (single value).

Parameters:

  • project (Hash)
  • issues (Array)

    List of issues to create with this project

Returns:

  • (Object)


58
59
60
61
62
63
64
# File 'lib/leash/integration/linear.rb', line 58

def linear_create_project_with_issues(project, issues)
  params = {
    'project' => project,
    'issues' => issues
  }.compact
  @leash.call('linear', 'linear_create_project_with_issues', params)
end

#linear_delete_comment(id) ⇒ Object

Deletes a comment

Parameters:

  • id (String)

    Comment ID to delete

Returns:

  • (Object)


251
252
253
254
255
256
# File 'lib/leash/integration/linear.rb', line 251

def linear_delete_comment(id)
  params = {
    'id' => id
  }.compact
  @leash.call('linear', 'linear_delete_comment', params)
end

#linear_delete_issue(id) ⇒ Object

Delete an issue

Parameters:

  • id (String)

    Issue UUID (not issue identifier like ‘ENG-123’)

Returns:

  • (Object)


181
182
183
184
185
186
# File 'lib/leash/integration/linear.rb', line 181

def linear_delete_issue(id)
  params = {
    'id' => id
  }.compact
  @leash.call('linear', 'linear_delete_issue', params)
end

#linear_delete_project_milestone(id) ⇒ Object

Delete a project milestone

Parameters:

  • id (String)

    Milestone ID to delete

Returns:

  • (Object)


366
367
368
369
370
371
# File 'lib/leash/integration/linear.rb', line 366

def linear_delete_project_milestone(id)
  params = {
    'id' => id
  }.compact
  @leash.call('linear', 'linear_delete_project_milestone', params)
end

#linear_edit_issue(issueid, title: nil, description: nil, stateid: nil, priority: nil, assigneeid: nil, labelids: nil, projectid: nil, projectmilestoneid: nil, estimate: nil, duedate: nil, parentid: nil, sortorder: nil) ⇒ Object

Edit an existing issue, updating any of its fields. Note: When setting projectMilestoneId, you must also set projectId.

Parameters:

  • issueid (String)

    Required: The UUID of the issue to update

  • title (String, nil) (defaults to: nil)

    The issue title

  • description (String, nil) (defaults to: nil)

    The issue description in markdown format

  • stateid (String, nil) (defaults to: nil)

    UUID of the target state

  • priority (Float, nil) (defaults to: nil)

    Issue priority (0=No priority, 1=Urgent, 2=High, 3=Normal, 4=Low)

  • assigneeid (String, nil) (defaults to: nil)

    UUID of the user to assign the issue to

  • labelids (Array, nil) (defaults to: nil)

    Array of label UUIDs (replaces existing labels)

  • projectid (String, nil) (defaults to: nil)

    UUID of the project to associate with the issue

  • projectmilestoneid (String, nil) (defaults to: nil)

    UUID of the project milestone to associate with the issue. Note: Requires projectId to be set when using this field

  • estimate (Float, nil) (defaults to: nil)

    The estimated complexity points for the issue

  • duedate (String, nil) (defaults to: nil)

    The due date in YYYY-MM-DD format

  • parentid (String, nil) (defaults to: nil)

    UUID of the parent issue

  • sortorder (Float, nil) (defaults to: nil)

    Position of the issue relative to other issues

Returns:

  • (Object)


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/leash/integration/linear.rb', line 95

def linear_edit_issue(issueid, title: nil, description: nil, stateid: nil, priority: nil, assigneeid: nil, labelids: nil, projectid: nil, projectmilestoneid: nil, estimate: nil, duedate: nil, parentid: nil, sortorder: nil)
  params = {
    'issueId' => issueid,
    'title' => title,
    'description' => description,
    'stateId' => stateid,
    'priority' => priority,
    'assigneeId' => assigneeid,
    'labelIds' => labelids,
    'projectId' => projectid,
    'projectMilestoneId' => projectmilestoneid,
    'estimate' => estimate,
    'dueDate' => duedate,
    'parentId' => parentid,
    'sortOrder' => sortorder
  }.compact
  @leash.call('linear', 'linear_edit_issue', params)
end

#linear_get_issue(identifier) ⇒ Object

Get a single issue by identifier, including all comments

Parameters:

  • identifier (String)

    Issue identifier (e.g., ‘ENG-123’)

Returns:

  • (Object)


154
155
156
157
158
159
# File 'lib/leash/integration/linear.rb', line 154

def linear_get_issue(identifier)
  params = {
    'identifier' => identifier
  }.compact
  @leash.call('linear', 'linear_get_issue', params)
end

#linear_get_project(id) ⇒ Object

Get project information

Parameters:

  • id (String)

    Project identifier

Returns:

  • (Object)


192
193
194
195
196
197
# File 'lib/leash/integration/linear.rb', line 192

def linear_get_project(id)
  params = {
    'id' => id
  }.compact
  @leash.call('linear', 'linear_get_project', params)
end

#linear_get_project_milestones(projectid, filter: nil, first: nil, after: nil, last: nil, before: nil, includearchived: nil, orderby: nil) ⇒ Object

Get milestones for a project with filtering and pagination

Parameters:

  • projectid (String)

    Project ID to get milestones for

  • filter (Hash, nil) (defaults to: nil)

    Optional filter criteria

  • first (Float, nil) (defaults to: nil)

    Number of items to return (used with after)

  • after (String, nil) (defaults to: nil)

    Cursor for forward pagination

  • last (Float, nil) (defaults to: nil)

    Number of items to return (used with before)

  • before (String, nil) (defaults to: nil)

    Cursor for backward pagination

  • includearchived (Boolean, nil) (defaults to: nil)

    Include archived milestones

  • orderby (String, nil) (defaults to: nil)

    Field to order by (createdAt or updatedAt)

Returns:

  • (Object)


310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/leash/integration/linear.rb', line 310

def linear_get_project_milestones(projectid, filter: nil, first: nil, after: nil, last: nil, before: nil, includearchived: nil, orderby: nil)
  params = {
    'projectId' => projectid,
    'filter' => filter,
    'first' => first,
    'after' => after,
    'last' => last,
    'before' => before,
    'includeArchived' => includearchived,
    'orderBy' => orderby
  }.compact
  @leash.call('linear', 'linear_get_project_milestones', params)
end

#linear_get_teamsObject

Get all teams with their states and labels

Returns:

  • (Object)


164
165
166
167
# File 'lib/leash/integration/linear.rb', line 164

def linear_get_teams
  params = {}
  @leash.call('linear', 'linear_get_teams', params)
end

#linear_get_userObject

Get current user information

Returns:

  • (Object)


172
173
174
175
# File 'lib/leash/integration/linear.rb', line 172

def linear_get_user
  params = {}
  @leash.call('linear', 'linear_get_user', params)
end

#linear_list_projects(filter: nil) ⇒ Object

List all projects or filter them by criteria

Parameters:

  • filter (Hash, nil) (defaults to: nil)

    Optional filter criteria for projects

Returns:

  • (Object)


203
204
205
206
207
208
# File 'lib/leash/integration/linear.rb', line 203

def linear_list_projects(filter: nil)
  params = {
    'filter' => filter
  }.compact
  @leash.call('linear', 'linear_list_projects', params)
end

#linear_resolve_comment(id, resolvingcommentid: nil) ⇒ Object

Resolves a comment

Parameters:

  • id (String)

    Comment ID to resolve

  • resolvingcommentid (String, nil) (defaults to: nil)

    Optional ID of a resolving comment

Returns:

  • (Object)


263
264
265
266
267
268
269
# File 'lib/leash/integration/linear.rb', line 263

def linear_resolve_comment(id, resolvingcommentid: nil)
  params = {
    'id' => id,
    'resolvingCommentId' => resolvingcommentid
  }.compact
  @leash.call('linear', 'linear_resolve_comment', params)
end

#linear_search_issues(query: nil, teamids: nil, assigneeids: nil, states: nil, priority: nil, first: nil, after: nil, orderby: nil) ⇒ Object

Search for issues with filtering and pagination

Parameters:

  • query (String, nil) (defaults to: nil)

    Search query string

  • teamids (Array, nil) (defaults to: nil)

    Filter by team IDs

  • assigneeids (Array, nil) (defaults to: nil)

    Filter by assignee IDs

  • states (Array, nil) (defaults to: nil)

    Filter by state names

  • priority (Float, nil) (defaults to: nil)

    Filter by priority (0-4)

  • first (Float, nil) (defaults to: nil)

    Number of issues to return (default: 50)

  • after (String, nil) (defaults to: nil)

    Cursor for pagination

  • orderby (String, nil) (defaults to: nil)

    Field to order by (default: updatedAt)

Returns:

  • (Object)


125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/leash/integration/linear.rb', line 125

def linear_search_issues(query: nil, teamids: nil, assigneeids: nil, states: nil, priority: nil, first: nil, after: nil, orderby: nil)
  params = {
    'query' => query,
    'teamIds' => teamids,
    'assigneeIds' => assigneeids,
    'states' => states,
    'priority' => priority,
    'first' => first,
    'after' => after,
    'orderBy' => orderby
  }.compact
  @leash.call('linear', 'linear_search_issues', params)
end

#linear_search_issues_by_identifier(identifiers) ⇒ Object

Search for issues by their identifiers (e.g., [“ENG-78”, “ENG-79”])

Parameters:

  • identifiers (Array)

    Array of issue identifiers to search for

Returns:

  • (Object)


143
144
145
146
147
148
# File 'lib/leash/integration/linear.rb', line 143

def linear_search_issues_by_identifier(identifiers)
  params = {
    'identifiers' => identifiers
  }.compact
  @leash.call('linear', 'linear_search_issues_by_identifier', params)
end

#linear_unresolve_comment(id) ⇒ Object

Unresolves a comment

Parameters:

  • id (String)

    Comment ID to unresolve

Returns:

  • (Object)


275
276
277
278
279
280
# File 'lib/leash/integration/linear.rb', line 275

def linear_unresolve_comment(id)
  params = {
    'id' => id
  }.compact
  @leash.call('linear', 'linear_unresolve_comment', params)
end

#linear_update_comment(id, input) ⇒ Object

Updates an existing comment

Parameters:

  • id (String)

    Comment ID

  • input (Hash)

Returns:

  • (Object)


239
240
241
242
243
244
245
# File 'lib/leash/integration/linear.rb', line 239

def linear_update_comment(id, input)
  params = {
    'id' => id,
    'input' => input
  }.compact
  @leash.call('linear', 'linear_update_comment', params)
end

#linear_update_project_milestone(id, name: nil, description: nil, targetdate: nil, sortorder: nil) ⇒ Object

Update a project milestone

Parameters:

  • id (String)

    Milestone ID to update

  • name (String, nil) (defaults to: nil)

    New milestone name

  • description (String, nil) (defaults to: nil)

    New milestone description

  • targetdate (String, nil) (defaults to: nil)

    New target completion date (ISO format)

  • sortorder (Float, nil) (defaults to: nil)

    New sort order

Returns:

  • (Object)


351
352
353
354
355
356
357
358
359
360
# File 'lib/leash/integration/linear.rb', line 351

def linear_update_project_milestone(id, name: nil, description: nil, targetdate: nil, sortorder: nil)
  params = {
    'id' => id,
    'name' => name,
    'description' => description,
    'targetDate' => targetdate,
    'sortOrder' => sortorder
  }.compact
  @leash.call('linear', 'linear_update_project_milestone', params)
end