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 issues.
73    ///
74    /// Full type: [`Issue`](super::types::Issue)
75    pub fn issues<T>(&self) -> IssuesQueryBuilder<'_, T> {
76        crate::generated::queries::issues(self)
77    }
78    /// One specific issue.
79    ///
80    /// Full type: [`Issue`](super::types::Issue)
81    pub async fn issue<T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>>(
82        &self,
83        id: String,
84    ) -> Result<T, LinearError> {
85        crate::generated::queries::issue::<T>(self, id).await
86    }
87    /// All issue relationships.
88    ///
89    /// Full type: [`IssueRelation`](super::types::IssueRelation)
90    pub fn issue_relations<T>(&self) -> IssueRelationsQueryBuilder<'_, T> {
91        crate::generated::queries::issue_relations(self)
92    }
93    /// One specific issue relation.
94    ///
95    /// Full type: [`IssueRelation`](super::types::IssueRelation)
96    pub async fn issue_relation<
97        T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>,
98    >(
99        &self,
100        id: String,
101    ) -> Result<T, LinearError> {
102        crate::generated::queries::issue_relation::<T>(self, id).await
103    }
104    /// All issue labels.
105    ///
106    /// Full type: [`IssueLabel`](super::types::IssueLabel)
107    pub fn issue_labels<T>(&self) -> IssueLabelsQueryBuilder<'_, T> {
108        crate::generated::queries::issue_labels(self)
109    }
110    /// All documents in the workspace.
111    ///
112    /// Full type: [`Document`](super::types::Document)
113    pub fn documents<T>(&self) -> DocumentsQueryBuilder<'_, T> {
114        crate::generated::queries::documents(self)
115    }
116    /// One specific document.
117    ///
118    /// Full type: [`Document`](super::types::Document)
119    pub async fn document<
120        T: DeserializeOwned + GraphQLFields<FullType = super::types::Document>,
121    >(
122        &self,
123        id: String,
124    ) -> Result<T, LinearError> {
125        crate::generated::queries::document::<T>(self, id).await
126    }
127    /// All cycles.
128    ///
129    /// Full type: [`Cycle`](super::types::Cycle)
130    pub fn cycles<T>(&self) -> CyclesQueryBuilder<'_, T> {
131        crate::generated::queries::cycles(self)
132    }
133    /// One specific cycle.
134    ///
135    /// Full type: [`Cycle`](super::types::Cycle)
136    pub async fn cycle<T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>(
137        &self,
138        id: String,
139    ) -> Result<T, LinearError> {
140        crate::generated::queries::cycle::<T>(self, id).await
141    }
142    /// XHR request payload to upload an images, video and other attachments directly to Linear's cloud storage.
143    pub async fn file_upload(
144        &self,
145        meta_data: Option<serde_json::Value>,
146        make_public: Option<bool>,
147        size: i64,
148        content_type: String,
149        filename: String,
150    ) -> Result<serde_json::Value, LinearError> {
151        crate::generated::mutations::file_upload(
152            self,
153            meta_data,
154            make_public,
155            size,
156            content_type,
157            filename,
158        )
159        .await
160    }
161    /// Upload an image from an URL to Linear.
162    pub async fn image_upload_from_url(
163        &self,
164        url: String,
165    ) -> Result<serde_json::Value, LinearError> {
166        crate::generated::mutations::image_upload_from_url(self, url).await
167    }
168    /// Creates a new issue.
169    ///
170    /// Full type: [`Issue`](super::types::Issue)
171    pub async fn issue_create<
172        T: serde::de::DeserializeOwned
173            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
174    >(
175        &self,
176        input: IssueCreateInput,
177    ) -> Result<T, LinearError> {
178        crate::generated::mutations::issue_create::<T>(self, input).await
179    }
180    /// Updates an issue.
181    ///
182    /// Full type: [`Issue`](super::types::Issue)
183    pub async fn issue_update<
184        T: serde::de::DeserializeOwned
185            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
186    >(
187        &self,
188        input: IssueUpdateInput,
189        id: String,
190    ) -> Result<T, LinearError> {
191        crate::generated::mutations::issue_update::<T>(self, input, id).await
192    }
193    /// Archives an issue.
194    ///
195    /// Full type: [`Issue`](super::types::Issue)
196    pub async fn issue_archive<
197        T: serde::de::DeserializeOwned
198            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
199    >(
200        &self,
201        trash: Option<bool>,
202        id: String,
203    ) -> Result<T, LinearError> {
204        crate::generated::mutations::issue_archive::<T>(self, trash, id).await
205    }
206    /// Unarchives an issue.
207    ///
208    /// Full type: [`Issue`](super::types::Issue)
209    pub async fn issue_unarchive<
210        T: serde::de::DeserializeOwned
211            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
212    >(
213        &self,
214        id: String,
215    ) -> Result<T, LinearError> {
216        crate::generated::mutations::issue_unarchive::<T>(self, id).await
217    }
218    /// Deletes (trashes) an issue.
219    ///
220    /// Full type: [`Issue`](super::types::Issue)
221    pub async fn issue_delete<
222        T: serde::de::DeserializeOwned
223            + crate::field_selection::GraphQLFields<FullType = super::types::Issue>,
224    >(
225        &self,
226        permanently_delete: Option<bool>,
227        id: String,
228    ) -> Result<T, LinearError> {
229        crate::generated::mutations::issue_delete::<T>(self, permanently_delete, id).await
230    }
231    /// Creates a new issue relation.
232    ///
233    /// Full type: [`IssueRelation`](super::types::IssueRelation)
234    pub async fn issue_relation_create<
235        T: serde::de::DeserializeOwned
236            + crate::field_selection::GraphQLFields<FullType = super::types::IssueRelation>,
237    >(
238        &self,
239        override_created_at: Option<serde_json::Value>,
240        input: IssueRelationCreateInput,
241    ) -> Result<T, LinearError> {
242        crate::generated::mutations::issue_relation_create::<T>(self, override_created_at, input)
243            .await
244    }
245    /// Creates a new document.
246    ///
247    /// Full type: [`Document`](super::types::Document)
248    pub async fn document_create<
249        T: serde::de::DeserializeOwned
250            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
251    >(
252        &self,
253        input: DocumentCreateInput,
254    ) -> Result<T, LinearError> {
255        crate::generated::mutations::document_create::<T>(self, input).await
256    }
257    /// Updates a document.
258    ///
259    /// Full type: [`Document`](super::types::Document)
260    pub async fn document_update<
261        T: serde::de::DeserializeOwned
262            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
263    >(
264        &self,
265        input: DocumentUpdateInput,
266        id: String,
267    ) -> Result<T, LinearError> {
268        crate::generated::mutations::document_update::<T>(self, input, id).await
269    }
270    /// Deletes (trashes) a document.
271    ///
272    /// Full type: [`Document`](super::types::Document)
273    pub async fn document_delete<
274        T: serde::de::DeserializeOwned
275            + crate::field_selection::GraphQLFields<FullType = super::types::Document>,
276    >(
277        &self,
278        id: String,
279    ) -> Result<T, LinearError> {
280        crate::generated::mutations::document_delete::<T>(self, id).await
281    }
282    /// Creates a new comment.
283    ///
284    /// Full type: [`Comment`](super::types::Comment)
285    pub async fn comment_create<
286        T: serde::de::DeserializeOwned
287            + crate::field_selection::GraphQLFields<FullType = super::types::Comment>,
288    >(
289        &self,
290        input: CommentCreateInput,
291    ) -> Result<T, LinearError> {
292        crate::generated::mutations::comment_create::<T>(self, input).await
293    }
294}