lineark-sdk 3.0.1

Typed, async-first Rust SDK for the Linear GraphQL API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
//! Generated `impl Client` delegation methods.
//!
//! This module provides thin wrapper methods on [`Client`] that
//! delegate to the standalone functions in [`queries`](super::queries) and
//! [`mutations`](super::mutations).
//!
//! Generated by lineark-codegen — do not edit.
#![allow(clippy::too_many_arguments)]
use super::inputs::*;
use super::queries::*;
use crate::client::Client;
use crate::error::LinearError;
use crate::field_selection::GraphQLFields;
use serde::de::DeserializeOwned;
impl Client {
    /// All issue workflow states (issue statuses). Returns a paginated list of workflow states visible to the authenticated user, across all teams they have access to.
    ///
    /// Full type: [`WorkflowState`](super::types::WorkflowState)
    pub fn workflow_states<T>(&self) -> WorkflowStatesQueryBuilder<'_, T> {
        crate::generated::queries::workflow_states(self)
    }
    /// All users in the workspace. Supports filtering, sorting, and pagination.
    ///
    /// Full type: [`User`](super::types::User)
    pub fn users<T>(&self) -> UsersQueryBuilder<'_, T> {
        crate::generated::queries::users(self)
    }
    /// The currently authenticated user making the API request.
    ///
    /// Full type: [`User`](super::types::User)
    pub async fn whoami<T: DeserializeOwned + GraphQLFields<FullType = super::types::User>>(
        &self,
    ) -> Result<T, LinearError> {
        crate::generated::queries::whoami::<T>(self).await
    }
    /// Returns all projects in the workspace, with optional filtering and sorting.
    ///
    /// Full type: [`Project`](super::types::Project)
    pub fn projects<T>(&self) -> ProjectsQueryBuilder<'_, T> {
        crate::generated::queries::projects(self)
    }
    /// Returns a single project by its identifier or URL slug.
    ///
    /// Full type: [`Project`](super::types::Project)
    pub async fn project<T: DeserializeOwned + GraphQLFields<FullType = super::types::Project>>(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::queries::project::<T>(self, id).await
    }
    /// All teams whose issues the user can access. This includes public teams and private teams the user is a member of. This may differ from `administrableTeams`, which returns teams whose settings the user can change but whose issues they don't necessarily have access to.
    ///
    /// Full type: [`Team`](super::types::Team)
    pub fn teams<T>(&self) -> TeamsQueryBuilder<'_, T> {
        crate::generated::queries::teams(self)
    }
    /// Fetches a specific team by its ID.
    ///
    /// Full type: [`Team`](super::types::Team)
    pub async fn team<T: DeserializeOwned + GraphQLFields<FullType = super::types::Team>>(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::queries::team::<T>(self, id).await
    }
    /// Search issues by text query using full-text and vector search. Results are ranked by relevance unless an orderBy parameter is specified. Supports optional issue filters and comment inclusion. Rate-limited to 30 requests per minute.
    ///
    /// Full type: [`IssueSearchResult`](super::types::IssueSearchResult)
    pub fn search_issues<T>(&self, term: impl Into<String>) -> SearchIssuesQueryBuilder<'_, T> {
        crate::generated::queries::search_issues(self, term)
    }
    /// Returns all project statuses in the workspace.
    ///
    /// Full type: [`ProjectStatus`](super::types::ProjectStatus)
    pub fn project_statuses<T>(&self) -> ProjectStatusesQueryBuilder<'_, T> {
        crate::generated::queries::project_statuses(self)
    }
    /// Returns all project milestones in the workspace, with optional filtering.
    ///
    /// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
    pub fn project_milestones<T>(&self) -> ProjectMilestonesQueryBuilder<'_, T> {
        crate::generated::queries::project_milestones(self)
    }
    /// Returns a single project milestone by its identifier.
    ///
    /// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
    pub async fn project_milestone<
        T: DeserializeOwned + GraphQLFields<FullType = super::types::ProjectMilestone>,
    >(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::queries::project_milestone::<T>(self, id).await
    }
    /// Returns all project labels in the workspace, with optional filtering.
    ///
    /// Full type: [`ProjectLabel`](super::types::ProjectLabel)
    pub fn project_labels<T>(&self) -> ProjectLabelsQueryBuilder<'_, T> {
        crate::generated::queries::project_labels(self)
    }
    /// All issues. Returns a paginated list of issues visible to the authenticated user. Can be filtered by various criteria including team, assignee, state, labels, project, and cycle.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub fn issues<T>(&self) -> IssuesQueryBuilder<'_, T> {
        crate::generated::queries::issues(self)
    }
    /// One specific issue, looked up by its unique identifier.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub async fn issue<T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>>(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::queries::issue::<T>(self, id).await
    }
    /// Find issue based on the VCS branch name.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub async fn issue_vcs_branch_search<
        T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>,
    >(
        &self,
        branch_name: String,
    ) -> Result<Option<T>, LinearError> {
        crate::generated::queries::issue_vcs_branch_search::<T>(self, branch_name).await
    }
    /// All issue relations. Returns a paginated list of all issue relations (blocks, blocked by, relates to, duplicates) visible to the authenticated user.
    ///
    /// Full type: [`IssueRelation`](super::types::IssueRelation)
    pub fn issue_relations<T>(&self) -> IssueRelationsQueryBuilder<'_, T> {
        crate::generated::queries::issue_relations(self)
    }
    /// One specific issue relation, looked up by its unique identifier.
    ///
    /// Full type: [`IssueRelation`](super::types::IssueRelation)
    pub async fn issue_relation<
        T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>,
    >(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::queries::issue_relation::<T>(self, id).await
    }
    /// All issue labels. Returns a paginated list of labels visible to the authenticated user, including both workspace-level and team-scoped labels.
    ///
    /// Full type: [`IssueLabel`](super::types::IssueLabel)
    pub fn issue_labels<T>(&self) -> IssueLabelsQueryBuilder<'_, T> {
        crate::generated::queries::issue_labels(self)
    }
    /// All documents the user has access to in the workspace.
    ///
    /// Full type: [`Document`](super::types::Document)
    pub fn documents<T>(&self) -> DocumentsQueryBuilder<'_, T> {
        crate::generated::queries::documents(self)
    }
    /// A specific document by ID or slug.
    ///
    /// Full type: [`Document`](super::types::Document)
    pub async fn document<
        T: DeserializeOwned + GraphQLFields<FullType = super::types::Document>,
    >(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::queries::document::<T>(self, id).await
    }
    /// All cycles accessible to the user.
    ///
    /// Full type: [`Cycle`](super::types::Cycle)
    pub fn cycles<T>(&self) -> CyclesQueryBuilder<'_, T> {
        crate::generated::queries::cycles(self)
    }
    /// One specific cycle, looked up by ID or slug.
    ///
    /// Full type: [`Cycle`](super::types::Cycle)
    pub async fn cycle<T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::queries::cycle::<T>(self, id).await
    }
    /// XHR request payload to upload an images, video and other attachments directly to Linear's cloud storage.
    pub async fn file_upload(
        &self,
        meta_data: Option<serde_json::Value>,
        make_public: Option<bool>,
        size: i64,
        content_type: String,
        filename: String,
    ) -> Result<serde_json::Value, LinearError> {
        crate::generated::mutations::file_upload(
            self,
            meta_data,
            make_public,
            size,
            content_type,
            filename,
        )
        .await
    }
    /// Upload an image from an URL to Linear.
    pub async fn image_upload_from_url(
        &self,
        url: String,
    ) -> Result<serde_json::Value, LinearError> {
        crate::generated::mutations::image_upload_from_url(self, url).await
    }
    /// Creates a new project.
    ///
    /// Full type: [`Project`](super::types::Project)
    pub async fn project_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Project>,
    >(
        &self,
        slack_channel_name: Option<String>,
        input: ProjectCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::project_create::<T>(self, slack_channel_name, input).await
    }
    /// Updates a project.
    ///
    /// Full type: [`Project`](super::types::Project)
    pub async fn project_update<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Project>,
    >(
        &self,
        input: ProjectUpdateInput,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::project_update::<T>(self, input, id).await
    }
    /// Deletes (trashes) a project. The project can be restored later with projectUnarchive.
    ///
    /// Full type: [`Project`](super::types::Project)
    pub async fn project_delete<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Project>,
    >(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::project_delete::<T>(self, id).await
    }
    /// Creates a new team. The user who creates the team will automatically be added as a member and owner of the newly created team. Default workflow states, labels, and other team resources are created alongside the team.
    ///
    /// Full type: [`Team`](super::types::Team)
    pub async fn team_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Team>,
    >(
        &self,
        copy_settings_from_team_id: Option<String>,
        input: TeamCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::team_create::<T>(self, copy_settings_from_team_id, input).await
    }
    /// Updates a team's settings, properties, or configuration. Requires team owner or workspace admin permissions for most changes.
    ///
    /// Full type: [`Team`](super::types::Team)
    pub async fn team_update<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Team>,
    >(
        &self,
        mapping: Option<InheritanceEntityMapping>,
        input: TeamUpdateInput,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::team_update::<T>(self, mapping, input, id).await
    }
    /// Archives a team and schedules its data for deletion. Requires team owner or workspace admin permissions.
    pub async fn team_delete(&self, id: String) -> Result<serde_json::Value, LinearError> {
        crate::generated::mutations::team_delete(self, id).await
    }
    /// Creates a new team membership, adding a user to a team. Validates that the user is not already a member, the team is not archived or retired, and the requesting user has permission to add members.
    ///
    /// Full type: [`TeamMembership`](super::types::TeamMembership)
    pub async fn team_membership_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::TeamMembership>,
    >(
        &self,
        input: TeamMembershipCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::team_membership_create::<T>(self, input).await
    }
    /// Deletes a team membership, removing the user from the team. Users can remove their own membership, or team owners and workspace admins can remove other members.
    pub async fn team_membership_delete(
        &self,
        also_leave_parent_teams: Option<bool>,
        id: String,
    ) -> Result<serde_json::Value, LinearError> {
        crate::generated::mutations::team_membership_delete(self, also_leave_parent_teams, id).await
    }
    /// Creates a new project milestone.
    ///
    /// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
    pub async fn project_milestone_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::ProjectMilestone>,
    >(
        &self,
        input: ProjectMilestoneCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::project_milestone_create::<T>(self, input).await
    }
    /// Updates a project milestone.
    ///
    /// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
    pub async fn project_milestone_update<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::ProjectMilestone>,
    >(
        &self,
        input: ProjectMilestoneUpdateInput,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::project_milestone_update::<T>(self, input, id).await
    }
    /// Deletes a project milestone.
    pub async fn project_milestone_delete(
        &self,
        id: String,
    ) -> Result<serde_json::Value, LinearError> {
        crate::generated::mutations::project_milestone_delete(self, id).await
    }
    /// Creates a new issue.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub async fn issue_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
    >(
        &self,
        input: IssueCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::issue_create::<T>(self, input).await
    }
    /// Updates an issue.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub async fn issue_update<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
    >(
        &self,
        input: IssueUpdateInput,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::issue_update::<T>(self, input, id).await
    }
    /// Updates multiple issues at once.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub async fn issue_batch_update<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
    >(
        &self,
        input: IssueUpdateInput,
        ids: Vec<String>,
    ) -> Result<Vec<T>, LinearError> {
        crate::generated::mutations::issue_batch_update::<T>(self, input, ids).await
    }
    /// Archives an issue.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub async fn issue_archive<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
    >(
        &self,
        trash: Option<bool>,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::issue_archive::<T>(self, trash, id).await
    }
    /// Unarchives an issue.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub async fn issue_unarchive<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
    >(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::issue_unarchive::<T>(self, id).await
    }
    /// Deletes (trashes) an issue.
    ///
    /// Full type: [`Issue`](super::types::Issue)
    pub async fn issue_delete<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
    >(
        &self,
        permanently_delete: Option<bool>,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::issue_delete::<T>(self, permanently_delete, id).await
    }
    /// Creates a new issue relation.
    ///
    /// Full type: [`IssueRelation`](super::types::IssueRelation)
    pub async fn issue_relation_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::IssueRelation>,
    >(
        &self,
        override_created_at: Option<serde_json::Value>,
        input: IssueRelationCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::issue_relation_create::<T>(self, override_created_at, input)
            .await
    }
    /// Deletes an issue relation.
    pub async fn issue_relation_delete(
        &self,
        id: String,
    ) -> Result<serde_json::Value, LinearError> {
        crate::generated::mutations::issue_relation_delete(self, id).await
    }
    /// Creates a new label.
    ///
    /// Full type: [`IssueLabel`](super::types::IssueLabel)
    pub async fn issue_label_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::IssueLabel>,
    >(
        &self,
        replace_team_labels: Option<bool>,
        input: IssueLabelCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::issue_label_create::<T>(self, replace_team_labels, input).await
    }
    /// Updates a label.
    ///
    /// Full type: [`IssueLabel`](super::types::IssueLabel)
    pub async fn issue_label_update<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::IssueLabel>,
    >(
        &self,
        replace_team_labels: Option<bool>,
        input: IssueLabelUpdateInput,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::issue_label_update::<T>(self, replace_team_labels, input, id)
            .await
    }
    /// Deletes an issue label.
    pub async fn issue_label_delete(&self, id: String) -> Result<serde_json::Value, LinearError> {
        crate::generated::mutations::issue_label_delete(self, id).await
    }
    /// Creates a new document.
    ///
    /// Full type: [`Document`](super::types::Document)
    pub async fn document_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
    >(
        &self,
        input: DocumentCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::document_create::<T>(self, input).await
    }
    /// Updates a document.
    ///
    /// Full type: [`Document`](super::types::Document)
    pub async fn document_update<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
    >(
        &self,
        input: DocumentUpdateInput,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::document_update::<T>(self, input, id).await
    }
    /// Deletes (trashes) a document. The document is marked as trashed and archived, but not permanently removed.
    ///
    /// Full type: [`Document`](super::types::Document)
    pub async fn document_delete<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
    >(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::document_delete::<T>(self, id).await
    }
    /// Creates a new comment.
    ///
    /// Full type: [`Comment`](super::types::Comment)
    pub async fn comment_create<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Comment>,
    >(
        &self,
        input: CommentCreateInput,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::comment_create::<T>(self, input).await
    }
    /// Updates a comment.
    ///
    /// Full type: [`Comment`](super::types::Comment)
    pub async fn comment_update<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Comment>,
    >(
        &self,
        skip_edited_at: Option<bool>,
        input: CommentUpdateInput,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::comment_update::<T>(self, skip_edited_at, input, id).await
    }
    /// Deletes a comment.
    pub async fn comment_delete(&self, id: String) -> Result<serde_json::Value, LinearError> {
        crate::generated::mutations::comment_delete(self, id).await
    }
    /// Resolves a comment thread. Marks the root comment as resolved by the current user.
    ///
    /// Full type: [`Comment`](super::types::Comment)
    pub async fn comment_resolve<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Comment>,
    >(
        &self,
        resolving_comment_id: Option<String>,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::comment_resolve::<T>(self, resolving_comment_id, id).await
    }
    /// Unresolves a previously resolved comment thread. Clears the resolved state on the root comment.
    ///
    /// Full type: [`Comment`](super::types::Comment)
    pub async fn comment_unresolve<
        T: serde::de::DeserializeOwned
            + crate::field_selection::GraphQLFields<FullType = super::types::Comment>,
    >(
        &self,
        id: String,
    ) -> Result<T, LinearError> {
        crate::generated::mutations::comment_unresolve::<T>(self, id).await
    }
}