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    /// All issue relationships.
105    ///
106    /// Full type: [`IssueRelation`](super::types::IssueRelation)
107    pub fn issue_relations<T>(&self) -> IssueRelationsQueryBuilder<'_, T> {
108        crate::generated::queries::issue_relations(self)
109    }
110    /// One specific issue relation.
111    ///
112    /// Full type: [`IssueRelation`](super::types::IssueRelation)
113    pub async fn issue_relation<
114        T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>,
115    >(
116        &self,
117        id: String,
118    ) -> Result<T, LinearError> {
119        crate::generated::queries::issue_relation::<T>(self, id).await
120    }
121    /// All issue labels.
122    ///
123    /// Full type: [`IssueLabel`](super::types::IssueLabel)
124    pub fn issue_labels<T>(&self) -> IssueLabelsQueryBuilder<'_, T> {
125        crate::generated::queries::issue_labels(self)
126    }
127    /// All documents in the workspace.
128    ///
129    /// Full type: [`Document`](super::types::Document)
130    pub fn documents<T>(&self) -> DocumentsQueryBuilder<'_, T> {
131        crate::generated::queries::documents(self)
132    }
133    /// One specific document.
134    ///
135    /// Full type: [`Document`](super::types::Document)
136    pub async fn document<
137        T: DeserializeOwned + GraphQLFields<FullType = super::types::Document>,
138    >(
139        &self,
140        id: String,
141    ) -> Result<T, LinearError> {
142        crate::generated::queries::document::<T>(self, id).await
143    }
144    /// All cycles.
145    ///
146    /// Full type: [`Cycle`](super::types::Cycle)
147    pub fn cycles<T>(&self) -> CyclesQueryBuilder<'_, T> {
148        crate::generated::queries::cycles(self)
149    }
150    /// One specific cycle.
151    ///
152    /// Full type: [`Cycle`](super::types::Cycle)
153    pub async fn cycle<T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>(
154        &self,
155        id: String,
156    ) -> Result<T, LinearError> {
157        crate::generated::queries::cycle::<T>(self, id).await
158    }
159    /// XHR request payload to upload an images, video and other attachments directly to Linear's cloud storage.
160    pub async fn file_upload(
161        &self,
162        meta_data: Option<serde_json::Value>,
163        make_public: Option<bool>,
164        size: i64,
165        content_type: String,
166        filename: String,
167    ) -> Result<serde_json::Value, LinearError> {
168        crate::generated::mutations::file_upload(
169            self,
170            meta_data,
171            make_public,
172            size,
173            content_type,
174            filename,
175        )
176        .await
177    }
178    /// Upload an image from an URL to Linear.
179    pub async fn image_upload_from_url(
180        &self,
181        url: String,
182    ) -> Result<serde_json::Value, LinearError> {
183        crate::generated::mutations::image_upload_from_url(self, url).await
184    }
185    /// Creates a new comment.
186    ///
187    /// Full type: [`Comment`](super::types::Comment)
188    pub async fn comment_create<
189        T: serde::de::DeserializeOwned
190            + crate::field_selection::GraphQLFields<FullType = super::types::Comment>,
191    >(
192        &self,
193        input: CommentCreateInput,
194    ) -> Result<T, LinearError> {
195        crate::generated::mutations::comment_create::<T>(self, input).await
196    }
197    /// Deletes a comment.
198    pub async fn comment_delete(&self, id: String) -> Result<serde_json::Value, LinearError> {
199        crate::generated::mutations::comment_delete(self, id).await
200    }
201    /// Creates a new project.
202    ///
203    /// Full type: [`Project`](super::types::Project)
204    pub async fn project_create<
205        T: serde::de::DeserializeOwned
206            + crate::field_selection::GraphQLFields<FullType = super::types::Project>,
207    >(
208        &self,
209        slack_channel_name: Option<String>,
210        input: ProjectCreateInput,
211    ) -> Result<T, LinearError> {
212        crate::generated::mutations::project_create::<T>(self, slack_channel_name, input).await
213    }
214    /// Updates a project.
215    ///
216    /// Full type: [`Project`](super::types::Project)
217    pub async fn project_update<
218        T: serde::de::DeserializeOwned
219            + crate::field_selection::GraphQLFields<FullType = super::types::Project>,
220    >(
221        &self,
222        input: ProjectUpdateInput,
223        id: String,
224    ) -> Result<T, LinearError> {
225        crate::generated::mutations::project_update::<T>(self, input, id).await
226    }
227    /// Deletes (trashes) a project.
228    ///
229    /// Full type: [`Project`](super::types::Project)
230    pub async fn project_delete<
231        T: serde::de::DeserializeOwned
232            + crate::field_selection::GraphQLFields<FullType = super::types::Project>,
233    >(
234        &self,
235        id: String,
236    ) -> Result<T, LinearError> {
237        crate::generated::mutations::project_delete::<T>(self, id).await
238    }
239    /// Creates a new team. The user who creates the team will automatically be added as a member to the newly created team.
240    ///
241    /// Full type: [`Team`](super::types::Team)
242    pub async fn team_create<
243        T: serde::de::DeserializeOwned
244            + crate::field_selection::GraphQLFields<FullType = super::types::Team>,
245    >(
246        &self,
247        copy_settings_from_team_id: Option<String>,
248        input: TeamCreateInput,
249    ) -> Result<T, LinearError> {
250        crate::generated::mutations::team_create::<T>(self, copy_settings_from_team_id, input).await
251    }
252    /// Updates a team.
253    ///
254    /// Full type: [`Team`](super::types::Team)
255    pub async fn team_update<
256        T: serde::de::DeserializeOwned
257            + crate::field_selection::GraphQLFields<FullType = super::types::Team>,
258    >(
259        &self,
260        mapping: Option<InheritanceEntityMapping>,
261        input: TeamUpdateInput,
262        id: String,
263    ) -> Result<T, LinearError> {
264        crate::generated::mutations::team_update::<T>(self, mapping, input, id).await
265    }
266    /// Deletes a team.
267    pub async fn team_delete(&self, id: String) -> Result<serde_json::Value, LinearError> {
268        crate::generated::mutations::team_delete(self, id).await
269    }
270    /// Creates a new team membership.
271    ///
272    /// Full type: [`TeamMembership`](super::types::TeamMembership)
273    pub async fn team_membership_create<
274        T: serde::de::DeserializeOwned
275            + crate::field_selection::GraphQLFields<FullType = super::types::TeamMembership>,
276    >(
277        &self,
278        input: TeamMembershipCreateInput,
279    ) -> Result<T, LinearError> {
280        crate::generated::mutations::team_membership_create::<T>(self, input).await
281    }
282    /// Deletes a team membership.
283    pub async fn team_membership_delete(
284        &self,
285        also_leave_parent_teams: Option<bool>,
286        id: String,
287    ) -> Result<serde_json::Value, LinearError> {
288        crate::generated::mutations::team_membership_delete(self, also_leave_parent_teams, id).await
289    }
290    /// Creates a new project milestone.
291    ///
292    /// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
293    pub async fn project_milestone_create<
294        T: serde::de::DeserializeOwned
295            + crate::field_selection::GraphQLFields<FullType = super::types::ProjectMilestone>,
296    >(
297        &self,
298        input: ProjectMilestoneCreateInput,
299    ) -> Result<T, LinearError> {
300        crate::generated::mutations::project_milestone_create::<T>(self, input).await
301    }
302    /// Updates a project milestone.
303    ///
304    /// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
305    pub async fn project_milestone_update<
306        T: serde::de::DeserializeOwned
307            + crate::field_selection::GraphQLFields<FullType = super::types::ProjectMilestone>,
308    >(
309        &self,
310        input: ProjectMilestoneUpdateInput,
311        id: String,
312    ) -> Result<T, LinearError> {
313        crate::generated::mutations::project_milestone_update::<T>(self, input, id).await
314    }
315    /// Deletes a project milestone.
316    pub async fn project_milestone_delete(
317        &self,
318        id: String,
319    ) -> Result<serde_json::Value, LinearError> {
320        crate::generated::mutations::project_milestone_delete(self, id).await
321    }
322    /// Creates a new issue.
323    ///
324    /// Full type: [`Issue`](super::types::Issue)
325    pub async fn issue_create<
326        T: serde::de::DeserializeOwned
327            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
328    >(
329        &self,
330        input: IssueCreateInput,
331    ) -> Result<T, LinearError> {
332        crate::generated::mutations::issue_create::<T>(self, input).await
333    }
334    /// Updates an issue.
335    ///
336    /// Full type: [`Issue`](super::types::Issue)
337    pub async fn issue_update<
338        T: serde::de::DeserializeOwned
339            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
340    >(
341        &self,
342        input: IssueUpdateInput,
343        id: String,
344    ) -> Result<T, LinearError> {
345        crate::generated::mutations::issue_update::<T>(self, input, id).await
346    }
347    /// Archives an issue.
348    ///
349    /// Full type: [`Issue`](super::types::Issue)
350    pub async fn issue_archive<
351        T: serde::de::DeserializeOwned
352            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
353    >(
354        &self,
355        trash: Option<bool>,
356        id: String,
357    ) -> Result<T, LinearError> {
358        crate::generated::mutations::issue_archive::<T>(self, trash, id).await
359    }
360    /// Unarchives an issue.
361    ///
362    /// Full type: [`Issue`](super::types::Issue)
363    pub async fn issue_unarchive<
364        T: serde::de::DeserializeOwned
365            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
366    >(
367        &self,
368        id: String,
369    ) -> Result<T, LinearError> {
370        crate::generated::mutations::issue_unarchive::<T>(self, id).await
371    }
372    /// Deletes (trashes) an issue.
373    ///
374    /// Full type: [`Issue`](super::types::Issue)
375    pub async fn issue_delete<
376        T: serde::de::DeserializeOwned
377            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
378    >(
379        &self,
380        permanently_delete: Option<bool>,
381        id: String,
382    ) -> Result<T, LinearError> {
383        crate::generated::mutations::issue_delete::<T>(self, permanently_delete, id).await
384    }
385    /// Creates a new issue relation.
386    ///
387    /// Full type: [`IssueRelation`](super::types::IssueRelation)
388    pub async fn issue_relation_create<
389        T: serde::de::DeserializeOwned
390            + crate::field_selection::GraphQLFields<FullType = super::types::IssueRelation>,
391    >(
392        &self,
393        override_created_at: Option<serde_json::Value>,
394        input: IssueRelationCreateInput,
395    ) -> Result<T, LinearError> {
396        crate::generated::mutations::issue_relation_create::<T>(self, override_created_at, input)
397            .await
398    }
399    /// Creates a new document.
400    ///
401    /// Full type: [`Document`](super::types::Document)
402    pub async fn document_create<
403        T: serde::de::DeserializeOwned
404            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
405    >(
406        &self,
407        input: DocumentCreateInput,
408    ) -> Result<T, LinearError> {
409        crate::generated::mutations::document_create::<T>(self, input).await
410    }
411    /// Updates a document.
412    ///
413    /// Full type: [`Document`](super::types::Document)
414    pub async fn document_update<
415        T: serde::de::DeserializeOwned
416            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
417    >(
418        &self,
419        input: DocumentUpdateInput,
420        id: String,
421    ) -> Result<T, LinearError> {
422        crate::generated::mutations::document_update::<T>(self, input, id).await
423    }
424    /// Deletes (trashes) a document.
425    ///
426    /// Full type: [`Document`](super::types::Document)
427    pub async fn document_delete<
428        T: serde::de::DeserializeOwned
429            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
430    >(
431        &self,
432        id: String,
433    ) -> Result<T, LinearError> {
434        crate::generated::mutations::document_delete::<T>(self, id).await
435    }
436}