Skip to main content

lineark_sdk/generated/
client_impl.rs

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