Skip to main content

lineark_sdk/generated/
queries.rs

1//! Generated query functions and builder types.
2//!
3//! All query functions are generic over `T: DeserializeOwned + GraphQLFields`.
4//! Pass the generated type for full-schema queries, or define your own
5//! lean struct for zero-overfetch.
6//!
7//! Generated by lineark-codegen — do not edit.
8use super::enums::*;
9use super::inputs::*;
10use crate::client::Client;
11use crate::error::LinearError;
12use crate::field_selection::GraphQLFields;
13use crate::pagination::Connection;
14use serde::de::DeserializeOwned;
15/// Query builder: All issue workflow states.
16///
17/// Full type: [`WorkflowState`](super::types::WorkflowState)
18///
19/// Use setter methods to configure optional parameters, then call
20/// [`.send()`](Self::send) to execute the query.
21#[must_use]
22pub struct WorkflowStatesQueryBuilder<'a, T> {
23    client: &'a Client,
24    filter: Option<WorkflowStateFilter>,
25    before: Option<String>,
26    after: Option<String>,
27    first: Option<i64>,
28    last: Option<i64>,
29    include_archived: Option<bool>,
30    order_by: Option<PaginationOrderBy>,
31    _marker: std::marker::PhantomData<T>,
32}
33impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::WorkflowState>>
34    WorkflowStatesQueryBuilder<'a, T>
35{
36    pub fn filter(mut self, value: WorkflowStateFilter) -> Self {
37        self.filter = Some(value);
38        self
39    }
40    pub fn before(mut self, value: impl Into<String>) -> Self {
41        self.before = Some(value.into());
42        self
43    }
44    pub fn after(mut self, value: impl Into<String>) -> Self {
45        self.after = Some(value.into());
46        self
47    }
48    pub fn first(mut self, value: i64) -> Self {
49        self.first = Some(value);
50        self
51    }
52    pub fn last(mut self, value: i64) -> Self {
53        self.last = Some(value);
54        self
55    }
56    pub fn include_archived(mut self, value: bool) -> Self {
57        self.include_archived = Some(value);
58        self
59    }
60    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
61        self.order_by = Some(value);
62        self
63    }
64    pub async fn send(self) -> Result<Connection<T>, LinearError> {
65        let mut map = serde_json::Map::new();
66        if let Some(ref v) = self.filter {
67            map.insert("filter".to_string(), serde_json::json!(v));
68        }
69        if let Some(ref v) = self.before {
70            map.insert("before".to_string(), serde_json::json!(v));
71        }
72        if let Some(ref v) = self.after {
73            map.insert("after".to_string(), serde_json::json!(v));
74        }
75        if let Some(ref v) = self.first {
76            map.insert("first".to_string(), serde_json::json!(v));
77        }
78        if let Some(ref v) = self.last {
79            map.insert("last".to_string(), serde_json::json!(v));
80        }
81        if let Some(ref v) = self.include_archived {
82            map.insert("includeArchived".to_string(), serde_json::json!(v));
83        }
84        if let Some(ref v) = self.order_by {
85            map.insert("orderBy".to_string(), serde_json::json!(v));
86        }
87        let variables = serde_json::Value::Object(map);
88        let selection = T::selection();
89        let query = format!(
90            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
91            "WorkflowStates",
92            "$filter: WorkflowStateFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
93            "workflowStates",
94            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
95            selection
96        );
97        self.client
98            .execute_connection::<T>(&query, variables, "workflowStates")
99            .await
100    }
101}
102/// Query builder: All users for the organization.
103///
104/// Full type: [`User`](super::types::User)
105///
106/// Use setter methods to configure optional parameters, then call
107/// [`.send()`](Self::send) to execute the query.
108#[must_use]
109pub struct UsersQueryBuilder<'a, T> {
110    client: &'a Client,
111    filter: Option<UserFilter>,
112    include_disabled: Option<bool>,
113    before: Option<String>,
114    after: Option<String>,
115    first: Option<i64>,
116    last: Option<i64>,
117    include_archived: Option<bool>,
118    order_by: Option<PaginationOrderBy>,
119    sort: Option<UserSortInput>,
120    _marker: std::marker::PhantomData<T>,
121}
122impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::User>>
123    UsersQueryBuilder<'a, T>
124{
125    pub fn filter(mut self, value: UserFilter) -> Self {
126        self.filter = Some(value);
127        self
128    }
129    pub fn include_disabled(mut self, value: bool) -> Self {
130        self.include_disabled = Some(value);
131        self
132    }
133    pub fn before(mut self, value: impl Into<String>) -> Self {
134        self.before = Some(value.into());
135        self
136    }
137    pub fn after(mut self, value: impl Into<String>) -> Self {
138        self.after = Some(value.into());
139        self
140    }
141    pub fn first(mut self, value: i64) -> Self {
142        self.first = Some(value);
143        self
144    }
145    pub fn last(mut self, value: i64) -> Self {
146        self.last = Some(value);
147        self
148    }
149    pub fn include_archived(mut self, value: bool) -> Self {
150        self.include_archived = Some(value);
151        self
152    }
153    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
154        self.order_by = Some(value);
155        self
156    }
157    pub fn sort(mut self, value: UserSortInput) -> Self {
158        self.sort = Some(value);
159        self
160    }
161    pub async fn send(self) -> Result<Connection<T>, LinearError> {
162        let mut map = serde_json::Map::new();
163        if let Some(ref v) = self.filter {
164            map.insert("filter".to_string(), serde_json::json!(v));
165        }
166        if let Some(ref v) = self.include_disabled {
167            map.insert("includeDisabled".to_string(), serde_json::json!(v));
168        }
169        if let Some(ref v) = self.before {
170            map.insert("before".to_string(), serde_json::json!(v));
171        }
172        if let Some(ref v) = self.after {
173            map.insert("after".to_string(), serde_json::json!(v));
174        }
175        if let Some(ref v) = self.first {
176            map.insert("first".to_string(), serde_json::json!(v));
177        }
178        if let Some(ref v) = self.last {
179            map.insert("last".to_string(), serde_json::json!(v));
180        }
181        if let Some(ref v) = self.include_archived {
182            map.insert("includeArchived".to_string(), serde_json::json!(v));
183        }
184        if let Some(ref v) = self.order_by {
185            map.insert("orderBy".to_string(), serde_json::json!(v));
186        }
187        if let Some(ref v) = self.sort {
188            map.insert("sort".to_string(), serde_json::json!(v));
189        }
190        let variables = serde_json::Value::Object(map);
191        let selection = T::selection();
192        let query = format!(
193            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
194            "Users",
195            "$filter: UserFilter, $includeDisabled: Boolean, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [UserSortInput!]",
196            "users",
197            "filter: $filter, includeDisabled: $includeDisabled, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort",
198            selection
199        );
200        self.client
201            .execute_connection::<T>(&query, variables, "users")
202            .await
203    }
204}
205/// Query builder: All projects.
206///
207/// Full type: [`Project`](super::types::Project)
208///
209/// Use setter methods to configure optional parameters, then call
210/// [`.send()`](Self::send) to execute the query.
211#[must_use]
212pub struct ProjectsQueryBuilder<'a, T> {
213    client: &'a Client,
214    filter: Option<ProjectFilter>,
215    before: Option<String>,
216    after: Option<String>,
217    first: Option<i64>,
218    last: Option<i64>,
219    include_archived: Option<bool>,
220    order_by: Option<PaginationOrderBy>,
221    sort: Option<ProjectSortInput>,
222    _marker: std::marker::PhantomData<T>,
223}
224impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Project>>
225    ProjectsQueryBuilder<'a, T>
226{
227    pub fn filter(mut self, value: ProjectFilter) -> Self {
228        self.filter = Some(value);
229        self
230    }
231    pub fn before(mut self, value: impl Into<String>) -> Self {
232        self.before = Some(value.into());
233        self
234    }
235    pub fn after(mut self, value: impl Into<String>) -> Self {
236        self.after = Some(value.into());
237        self
238    }
239    pub fn first(mut self, value: i64) -> Self {
240        self.first = Some(value);
241        self
242    }
243    pub fn last(mut self, value: i64) -> Self {
244        self.last = Some(value);
245        self
246    }
247    pub fn include_archived(mut self, value: bool) -> Self {
248        self.include_archived = Some(value);
249        self
250    }
251    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
252        self.order_by = Some(value);
253        self
254    }
255    pub fn sort(mut self, value: ProjectSortInput) -> Self {
256        self.sort = Some(value);
257        self
258    }
259    pub async fn send(self) -> Result<Connection<T>, LinearError> {
260        let mut map = serde_json::Map::new();
261        if let Some(ref v) = self.filter {
262            map.insert("filter".to_string(), serde_json::json!(v));
263        }
264        if let Some(ref v) = self.before {
265            map.insert("before".to_string(), serde_json::json!(v));
266        }
267        if let Some(ref v) = self.after {
268            map.insert("after".to_string(), serde_json::json!(v));
269        }
270        if let Some(ref v) = self.first {
271            map.insert("first".to_string(), serde_json::json!(v));
272        }
273        if let Some(ref v) = self.last {
274            map.insert("last".to_string(), serde_json::json!(v));
275        }
276        if let Some(ref v) = self.include_archived {
277            map.insert("includeArchived".to_string(), serde_json::json!(v));
278        }
279        if let Some(ref v) = self.order_by {
280            map.insert("orderBy".to_string(), serde_json::json!(v));
281        }
282        if let Some(ref v) = self.sort {
283            map.insert("sort".to_string(), serde_json::json!(v));
284        }
285        let variables = serde_json::Value::Object(map);
286        let selection = T::selection();
287        let query = format!(
288            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
289            "Projects",
290            "$filter: ProjectFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [ProjectSortInput!]",
291            "projects",
292            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort",
293            selection
294        );
295        self.client
296            .execute_connection::<T>(&query, variables, "projects")
297            .await
298    }
299}
300/// Query builder: 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.
301///
302/// Full type: [`Team`](super::types::Team)
303///
304/// Use setter methods to configure optional parameters, then call
305/// [`.send()`](Self::send) to execute the query.
306#[must_use]
307pub struct TeamsQueryBuilder<'a, T> {
308    client: &'a Client,
309    filter: Option<TeamFilter>,
310    before: Option<String>,
311    after: Option<String>,
312    first: Option<i64>,
313    last: Option<i64>,
314    include_archived: Option<bool>,
315    order_by: Option<PaginationOrderBy>,
316    _marker: std::marker::PhantomData<T>,
317}
318impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Team>>
319    TeamsQueryBuilder<'a, T>
320{
321    pub fn filter(mut self, value: TeamFilter) -> Self {
322        self.filter = Some(value);
323        self
324    }
325    pub fn before(mut self, value: impl Into<String>) -> Self {
326        self.before = Some(value.into());
327        self
328    }
329    pub fn after(mut self, value: impl Into<String>) -> Self {
330        self.after = Some(value.into());
331        self
332    }
333    pub fn first(mut self, value: i64) -> Self {
334        self.first = Some(value);
335        self
336    }
337    pub fn last(mut self, value: i64) -> Self {
338        self.last = Some(value);
339        self
340    }
341    pub fn include_archived(mut self, value: bool) -> Self {
342        self.include_archived = Some(value);
343        self
344    }
345    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
346        self.order_by = Some(value);
347        self
348    }
349    pub async fn send(self) -> Result<Connection<T>, LinearError> {
350        let mut map = serde_json::Map::new();
351        if let Some(ref v) = self.filter {
352            map.insert("filter".to_string(), serde_json::json!(v));
353        }
354        if let Some(ref v) = self.before {
355            map.insert("before".to_string(), serde_json::json!(v));
356        }
357        if let Some(ref v) = self.after {
358            map.insert("after".to_string(), serde_json::json!(v));
359        }
360        if let Some(ref v) = self.first {
361            map.insert("first".to_string(), serde_json::json!(v));
362        }
363        if let Some(ref v) = self.last {
364            map.insert("last".to_string(), serde_json::json!(v));
365        }
366        if let Some(ref v) = self.include_archived {
367            map.insert("includeArchived".to_string(), serde_json::json!(v));
368        }
369        if let Some(ref v) = self.order_by {
370            map.insert("orderBy".to_string(), serde_json::json!(v));
371        }
372        let variables = serde_json::Value::Object(map);
373        let selection = T::selection();
374        let query = format!(
375            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
376            "Teams",
377            "$filter: TeamFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
378            "teams",
379            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
380            selection
381        );
382        self.client
383            .execute_connection::<T>(&query, variables, "teams")
384            .await
385    }
386}
387/// Query builder: Search issues.
388///
389/// Full type: [`IssueSearchResult`](super::types::IssueSearchResult)
390///
391/// Use setter methods to configure optional parameters, then call
392/// [`.send()`](Self::send) to execute the query.
393#[must_use]
394pub struct SearchIssuesQueryBuilder<'a, T> {
395    client: &'a Client,
396    term: String,
397    filter: Option<IssueFilter>,
398    before: Option<String>,
399    after: Option<String>,
400    first: Option<i64>,
401    last: Option<i64>,
402    include_archived: Option<bool>,
403    order_by: Option<PaginationOrderBy>,
404    include_comments: Option<bool>,
405    team_id: Option<String>,
406    _marker: std::marker::PhantomData<T>,
407}
408impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueSearchResult>>
409    SearchIssuesQueryBuilder<'a, T>
410{
411    pub fn filter(mut self, value: IssueFilter) -> Self {
412        self.filter = Some(value);
413        self
414    }
415    pub fn before(mut self, value: impl Into<String>) -> Self {
416        self.before = Some(value.into());
417        self
418    }
419    pub fn after(mut self, value: impl Into<String>) -> Self {
420        self.after = Some(value.into());
421        self
422    }
423    pub fn first(mut self, value: i64) -> Self {
424        self.first = Some(value);
425        self
426    }
427    pub fn last(mut self, value: i64) -> Self {
428        self.last = Some(value);
429        self
430    }
431    pub fn include_archived(mut self, value: bool) -> Self {
432        self.include_archived = Some(value);
433        self
434    }
435    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
436        self.order_by = Some(value);
437        self
438    }
439    pub fn include_comments(mut self, value: bool) -> Self {
440        self.include_comments = Some(value);
441        self
442    }
443    pub fn team_id(mut self, value: impl Into<String>) -> Self {
444        self.team_id = Some(value.into());
445        self
446    }
447    pub async fn send(self) -> Result<Connection<T>, LinearError> {
448        let mut map = serde_json::Map::new();
449        map.insert("term".to_string(), serde_json::json!(self.term));
450        if let Some(ref v) = self.filter {
451            map.insert("filter".to_string(), serde_json::json!(v));
452        }
453        if let Some(ref v) = self.before {
454            map.insert("before".to_string(), serde_json::json!(v));
455        }
456        if let Some(ref v) = self.after {
457            map.insert("after".to_string(), serde_json::json!(v));
458        }
459        if let Some(ref v) = self.first {
460            map.insert("first".to_string(), serde_json::json!(v));
461        }
462        if let Some(ref v) = self.last {
463            map.insert("last".to_string(), serde_json::json!(v));
464        }
465        if let Some(ref v) = self.include_archived {
466            map.insert("includeArchived".to_string(), serde_json::json!(v));
467        }
468        if let Some(ref v) = self.order_by {
469            map.insert("orderBy".to_string(), serde_json::json!(v));
470        }
471        if let Some(ref v) = self.include_comments {
472            map.insert("includeComments".to_string(), serde_json::json!(v));
473        }
474        if let Some(ref v) = self.team_id {
475            map.insert("teamId".to_string(), serde_json::json!(v));
476        }
477        let variables = serde_json::Value::Object(map);
478        let selection = T::selection();
479        let query = format!(
480            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
481            "SearchIssues",
482            "$filter: IssueFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $term: String!, $includeComments: Boolean, $teamId: String",
483            "searchIssues",
484            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, term: $term, includeComments: $includeComments, teamId: $teamId",
485            selection
486        );
487        self.client
488            .execute_connection::<T>(&query, variables, "searchIssues")
489            .await
490    }
491}
492/// Query builder: All issues.
493///
494/// Full type: [`Issue`](super::types::Issue)
495///
496/// Use setter methods to configure optional parameters, then call
497/// [`.send()`](Self::send) to execute the query.
498#[must_use]
499pub struct IssuesQueryBuilder<'a, T> {
500    client: &'a Client,
501    filter: Option<IssueFilter>,
502    before: Option<String>,
503    after: Option<String>,
504    first: Option<i64>,
505    last: Option<i64>,
506    include_archived: Option<bool>,
507    order_by: Option<PaginationOrderBy>,
508    sort: Option<IssueSortInput>,
509    _marker: std::marker::PhantomData<T>,
510}
511impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>>
512    IssuesQueryBuilder<'a, T>
513{
514    pub fn filter(mut self, value: IssueFilter) -> Self {
515        self.filter = Some(value);
516        self
517    }
518    pub fn before(mut self, value: impl Into<String>) -> Self {
519        self.before = Some(value.into());
520        self
521    }
522    pub fn after(mut self, value: impl Into<String>) -> Self {
523        self.after = Some(value.into());
524        self
525    }
526    pub fn first(mut self, value: i64) -> Self {
527        self.first = Some(value);
528        self
529    }
530    pub fn last(mut self, value: i64) -> Self {
531        self.last = Some(value);
532        self
533    }
534    pub fn include_archived(mut self, value: bool) -> Self {
535        self.include_archived = Some(value);
536        self
537    }
538    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
539        self.order_by = Some(value);
540        self
541    }
542    pub fn sort(mut self, value: IssueSortInput) -> Self {
543        self.sort = Some(value);
544        self
545    }
546    pub async fn send(self) -> Result<Connection<T>, LinearError> {
547        let mut map = serde_json::Map::new();
548        if let Some(ref v) = self.filter {
549            map.insert("filter".to_string(), serde_json::json!(v));
550        }
551        if let Some(ref v) = self.before {
552            map.insert("before".to_string(), serde_json::json!(v));
553        }
554        if let Some(ref v) = self.after {
555            map.insert("after".to_string(), serde_json::json!(v));
556        }
557        if let Some(ref v) = self.first {
558            map.insert("first".to_string(), serde_json::json!(v));
559        }
560        if let Some(ref v) = self.last {
561            map.insert("last".to_string(), serde_json::json!(v));
562        }
563        if let Some(ref v) = self.include_archived {
564            map.insert("includeArchived".to_string(), serde_json::json!(v));
565        }
566        if let Some(ref v) = self.order_by {
567            map.insert("orderBy".to_string(), serde_json::json!(v));
568        }
569        if let Some(ref v) = self.sort {
570            map.insert("sort".to_string(), serde_json::json!(v));
571        }
572        let variables = serde_json::Value::Object(map);
573        let selection = T::selection();
574        let query = format!(
575            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
576            "Issues",
577            "$filter: IssueFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [IssueSortInput!]",
578            "issues",
579            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort",
580            selection
581        );
582        self.client
583            .execute_connection::<T>(&query, variables, "issues")
584            .await
585    }
586}
587/// Query builder: All issue relationships.
588///
589/// Full type: [`IssueRelation`](super::types::IssueRelation)
590///
591/// Use setter methods to configure optional parameters, then call
592/// [`.send()`](Self::send) to execute the query.
593#[must_use]
594pub struct IssueRelationsQueryBuilder<'a, T> {
595    client: &'a Client,
596    before: Option<String>,
597    after: Option<String>,
598    first: Option<i64>,
599    last: Option<i64>,
600    include_archived: Option<bool>,
601    order_by: Option<PaginationOrderBy>,
602    _marker: std::marker::PhantomData<T>,
603}
604impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>>
605    IssueRelationsQueryBuilder<'a, T>
606{
607    pub fn before(mut self, value: impl Into<String>) -> Self {
608        self.before = Some(value.into());
609        self
610    }
611    pub fn after(mut self, value: impl Into<String>) -> Self {
612        self.after = Some(value.into());
613        self
614    }
615    pub fn first(mut self, value: i64) -> Self {
616        self.first = Some(value);
617        self
618    }
619    pub fn last(mut self, value: i64) -> Self {
620        self.last = Some(value);
621        self
622    }
623    pub fn include_archived(mut self, value: bool) -> Self {
624        self.include_archived = Some(value);
625        self
626    }
627    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
628        self.order_by = Some(value);
629        self
630    }
631    pub async fn send(self) -> Result<Connection<T>, LinearError> {
632        let mut map = serde_json::Map::new();
633        if let Some(ref v) = self.before {
634            map.insert("before".to_string(), serde_json::json!(v));
635        }
636        if let Some(ref v) = self.after {
637            map.insert("after".to_string(), serde_json::json!(v));
638        }
639        if let Some(ref v) = self.first {
640            map.insert("first".to_string(), serde_json::json!(v));
641        }
642        if let Some(ref v) = self.last {
643            map.insert("last".to_string(), serde_json::json!(v));
644        }
645        if let Some(ref v) = self.include_archived {
646            map.insert("includeArchived".to_string(), serde_json::json!(v));
647        }
648        if let Some(ref v) = self.order_by {
649            map.insert("orderBy".to_string(), serde_json::json!(v));
650        }
651        let variables = serde_json::Value::Object(map);
652        let selection = T::selection();
653        let query = format!(
654            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
655            "IssueRelations",
656            "$before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
657            "issueRelations",
658            "before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
659            selection
660        );
661        self.client
662            .execute_connection::<T>(&query, variables, "issueRelations")
663            .await
664    }
665}
666/// Query builder: All issue labels.
667///
668/// Full type: [`IssueLabel`](super::types::IssueLabel)
669///
670/// Use setter methods to configure optional parameters, then call
671/// [`.send()`](Self::send) to execute the query.
672#[must_use]
673pub struct IssueLabelsQueryBuilder<'a, T> {
674    client: &'a Client,
675    filter: Option<IssueLabelFilter>,
676    before: Option<String>,
677    after: Option<String>,
678    first: Option<i64>,
679    last: Option<i64>,
680    include_archived: Option<bool>,
681    order_by: Option<PaginationOrderBy>,
682    _marker: std::marker::PhantomData<T>,
683}
684impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueLabel>>
685    IssueLabelsQueryBuilder<'a, T>
686{
687    pub fn filter(mut self, value: IssueLabelFilter) -> Self {
688        self.filter = Some(value);
689        self
690    }
691    pub fn before(mut self, value: impl Into<String>) -> Self {
692        self.before = Some(value.into());
693        self
694    }
695    pub fn after(mut self, value: impl Into<String>) -> Self {
696        self.after = Some(value.into());
697        self
698    }
699    pub fn first(mut self, value: i64) -> Self {
700        self.first = Some(value);
701        self
702    }
703    pub fn last(mut self, value: i64) -> Self {
704        self.last = Some(value);
705        self
706    }
707    pub fn include_archived(mut self, value: bool) -> Self {
708        self.include_archived = Some(value);
709        self
710    }
711    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
712        self.order_by = Some(value);
713        self
714    }
715    pub async fn send(self) -> Result<Connection<T>, LinearError> {
716        let mut map = serde_json::Map::new();
717        if let Some(ref v) = self.filter {
718            map.insert("filter".to_string(), serde_json::json!(v));
719        }
720        if let Some(ref v) = self.before {
721            map.insert("before".to_string(), serde_json::json!(v));
722        }
723        if let Some(ref v) = self.after {
724            map.insert("after".to_string(), serde_json::json!(v));
725        }
726        if let Some(ref v) = self.first {
727            map.insert("first".to_string(), serde_json::json!(v));
728        }
729        if let Some(ref v) = self.last {
730            map.insert("last".to_string(), serde_json::json!(v));
731        }
732        if let Some(ref v) = self.include_archived {
733            map.insert("includeArchived".to_string(), serde_json::json!(v));
734        }
735        if let Some(ref v) = self.order_by {
736            map.insert("orderBy".to_string(), serde_json::json!(v));
737        }
738        let variables = serde_json::Value::Object(map);
739        let selection = T::selection();
740        let query = format!(
741            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
742            "IssueLabels",
743            "$filter: IssueLabelFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
744            "issueLabels",
745            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
746            selection
747        );
748        self.client
749            .execute_connection::<T>(&query, variables, "issueLabels")
750            .await
751    }
752}
753/// Query builder: All documents in the workspace.
754///
755/// Full type: [`Document`](super::types::Document)
756///
757/// Use setter methods to configure optional parameters, then call
758/// [`.send()`](Self::send) to execute the query.
759#[must_use]
760pub struct DocumentsQueryBuilder<'a, T> {
761    client: &'a Client,
762    filter: Option<DocumentFilter>,
763    before: Option<String>,
764    after: Option<String>,
765    first: Option<i64>,
766    last: Option<i64>,
767    include_archived: Option<bool>,
768    order_by: Option<PaginationOrderBy>,
769    _marker: std::marker::PhantomData<T>,
770}
771impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Document>>
772    DocumentsQueryBuilder<'a, T>
773{
774    pub fn filter(mut self, value: DocumentFilter) -> Self {
775        self.filter = Some(value);
776        self
777    }
778    pub fn before(mut self, value: impl Into<String>) -> Self {
779        self.before = Some(value.into());
780        self
781    }
782    pub fn after(mut self, value: impl Into<String>) -> Self {
783        self.after = Some(value.into());
784        self
785    }
786    pub fn first(mut self, value: i64) -> Self {
787        self.first = Some(value);
788        self
789    }
790    pub fn last(mut self, value: i64) -> Self {
791        self.last = Some(value);
792        self
793    }
794    pub fn include_archived(mut self, value: bool) -> Self {
795        self.include_archived = Some(value);
796        self
797    }
798    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
799        self.order_by = Some(value);
800        self
801    }
802    pub async fn send(self) -> Result<Connection<T>, LinearError> {
803        let mut map = serde_json::Map::new();
804        if let Some(ref v) = self.filter {
805            map.insert("filter".to_string(), serde_json::json!(v));
806        }
807        if let Some(ref v) = self.before {
808            map.insert("before".to_string(), serde_json::json!(v));
809        }
810        if let Some(ref v) = self.after {
811            map.insert("after".to_string(), serde_json::json!(v));
812        }
813        if let Some(ref v) = self.first {
814            map.insert("first".to_string(), serde_json::json!(v));
815        }
816        if let Some(ref v) = self.last {
817            map.insert("last".to_string(), serde_json::json!(v));
818        }
819        if let Some(ref v) = self.include_archived {
820            map.insert("includeArchived".to_string(), serde_json::json!(v));
821        }
822        if let Some(ref v) = self.order_by {
823            map.insert("orderBy".to_string(), serde_json::json!(v));
824        }
825        let variables = serde_json::Value::Object(map);
826        let selection = T::selection();
827        let query = format!(
828            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
829            "Documents",
830            "$filter: DocumentFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
831            "documents",
832            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
833            selection
834        );
835        self.client
836            .execute_connection::<T>(&query, variables, "documents")
837            .await
838    }
839}
840/// Query builder: All cycles.
841///
842/// Full type: [`Cycle`](super::types::Cycle)
843///
844/// Use setter methods to configure optional parameters, then call
845/// [`.send()`](Self::send) to execute the query.
846#[must_use]
847pub struct CyclesQueryBuilder<'a, T> {
848    client: &'a Client,
849    filter: Option<CycleFilter>,
850    before: Option<String>,
851    after: Option<String>,
852    first: Option<i64>,
853    last: Option<i64>,
854    include_archived: Option<bool>,
855    order_by: Option<PaginationOrderBy>,
856    _marker: std::marker::PhantomData<T>,
857}
858impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>
859    CyclesQueryBuilder<'a, T>
860{
861    pub fn filter(mut self, value: CycleFilter) -> Self {
862        self.filter = Some(value);
863        self
864    }
865    pub fn before(mut self, value: impl Into<String>) -> Self {
866        self.before = Some(value.into());
867        self
868    }
869    pub fn after(mut self, value: impl Into<String>) -> Self {
870        self.after = Some(value.into());
871        self
872    }
873    pub fn first(mut self, value: i64) -> Self {
874        self.first = Some(value);
875        self
876    }
877    pub fn last(mut self, value: i64) -> Self {
878        self.last = Some(value);
879        self
880    }
881    pub fn include_archived(mut self, value: bool) -> Self {
882        self.include_archived = Some(value);
883        self
884    }
885    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
886        self.order_by = Some(value);
887        self
888    }
889    pub async fn send(self) -> Result<Connection<T>, LinearError> {
890        let mut map = serde_json::Map::new();
891        if let Some(ref v) = self.filter {
892            map.insert("filter".to_string(), serde_json::json!(v));
893        }
894        if let Some(ref v) = self.before {
895            map.insert("before".to_string(), serde_json::json!(v));
896        }
897        if let Some(ref v) = self.after {
898            map.insert("after".to_string(), serde_json::json!(v));
899        }
900        if let Some(ref v) = self.first {
901            map.insert("first".to_string(), serde_json::json!(v));
902        }
903        if let Some(ref v) = self.last {
904            map.insert("last".to_string(), serde_json::json!(v));
905        }
906        if let Some(ref v) = self.include_archived {
907            map.insert("includeArchived".to_string(), serde_json::json!(v));
908        }
909        if let Some(ref v) = self.order_by {
910            map.insert("orderBy".to_string(), serde_json::json!(v));
911        }
912        let variables = serde_json::Value::Object(map);
913        let selection = T::selection();
914        let query = format!(
915            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
916            "Cycles",
917            "$filter: CycleFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
918            "cycles",
919            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
920            selection
921        );
922        self.client
923            .execute_connection::<T>(&query, variables, "cycles")
924            .await
925    }
926}
927/// All issue workflow states.
928///
929/// Full type: [`WorkflowState`](super::types::WorkflowState)
930pub fn workflow_states<'a, T>(client: &'a Client) -> WorkflowStatesQueryBuilder<'a, T> {
931    WorkflowStatesQueryBuilder {
932        client,
933        filter: None,
934        before: None,
935        after: None,
936        first: None,
937        last: None,
938        include_archived: None,
939        order_by: None,
940        _marker: std::marker::PhantomData,
941    }
942}
943/// All users for the organization.
944///
945/// Full type: [`User`](super::types::User)
946pub fn users<'a, T>(client: &'a Client) -> UsersQueryBuilder<'a, T> {
947    UsersQueryBuilder {
948        client,
949        filter: None,
950        include_disabled: None,
951        before: None,
952        after: None,
953        first: None,
954        last: None,
955        include_archived: None,
956        order_by: None,
957        sort: None,
958        _marker: std::marker::PhantomData,
959    }
960}
961/// The currently authenticated user.
962///
963/// Full type: [`User`](super::types::User)
964pub async fn whoami<T: DeserializeOwned + GraphQLFields<FullType = super::types::User>>(
965    client: &Client,
966) -> Result<T, LinearError> {
967    let variables = serde_json::json!({});
968    let selection = T::selection();
969    let query = format!("query {} {{ {} {{ {} }} }}", "Viewer", "viewer", selection);
970    client.execute::<T>(&query, variables, "viewer").await
971}
972/// All projects.
973///
974/// Full type: [`Project`](super::types::Project)
975pub fn projects<'a, T>(client: &'a Client) -> ProjectsQueryBuilder<'a, T> {
976    ProjectsQueryBuilder {
977        client,
978        filter: None,
979        before: None,
980        after: None,
981        first: None,
982        last: None,
983        include_archived: None,
984        order_by: None,
985        sort: None,
986        _marker: std::marker::PhantomData,
987    }
988}
989/// One specific project.
990///
991/// Full type: [`Project`](super::types::Project)
992pub async fn project<T: DeserializeOwned + GraphQLFields<FullType = super::types::Project>>(
993    client: &Client,
994    id: String,
995) -> Result<T, LinearError> {
996    let variables = serde_json::json!({ "id" : id });
997    let selection = T::selection();
998    let query = format!(
999        "query {}({}) {{ {}({}) {{ {} }} }}",
1000        "Project", "$id: String!", "project", "id: $id", selection
1001    );
1002    client.execute::<T>(&query, variables, "project").await
1003}
1004/// 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.
1005///
1006/// Full type: [`Team`](super::types::Team)
1007pub fn teams<'a, T>(client: &'a Client) -> TeamsQueryBuilder<'a, T> {
1008    TeamsQueryBuilder {
1009        client,
1010        filter: None,
1011        before: None,
1012        after: None,
1013        first: None,
1014        last: None,
1015        include_archived: None,
1016        order_by: None,
1017        _marker: std::marker::PhantomData,
1018    }
1019}
1020/// One specific team.
1021///
1022/// Full type: [`Team`](super::types::Team)
1023pub async fn team<T: DeserializeOwned + GraphQLFields<FullType = super::types::Team>>(
1024    client: &Client,
1025    id: String,
1026) -> Result<T, LinearError> {
1027    let variables = serde_json::json!({ "id" : id });
1028    let selection = T::selection();
1029    let query = format!(
1030        "query {}({}) {{ {}({}) {{ {} }} }}",
1031        "Team", "$id: String!", "team", "id: $id", selection
1032    );
1033    client.execute::<T>(&query, variables, "team").await
1034}
1035/// Search issues.
1036///
1037/// Full type: [`IssueSearchResult`](super::types::IssueSearchResult)
1038pub fn search_issues<'a, T>(
1039    client: &'a Client,
1040    term: impl Into<String>,
1041) -> SearchIssuesQueryBuilder<'a, T> {
1042    SearchIssuesQueryBuilder {
1043        client,
1044        term: term.into(),
1045        filter: None,
1046        before: None,
1047        after: None,
1048        first: None,
1049        last: None,
1050        include_archived: None,
1051        order_by: None,
1052        include_comments: None,
1053        team_id: None,
1054        _marker: std::marker::PhantomData,
1055    }
1056}
1057/// All issues.
1058///
1059/// Full type: [`Issue`](super::types::Issue)
1060pub fn issues<'a, T>(client: &'a Client) -> IssuesQueryBuilder<'a, T> {
1061    IssuesQueryBuilder {
1062        client,
1063        filter: None,
1064        before: None,
1065        after: None,
1066        first: None,
1067        last: None,
1068        include_archived: None,
1069        order_by: None,
1070        sort: None,
1071        _marker: std::marker::PhantomData,
1072    }
1073}
1074/// One specific issue.
1075///
1076/// Full type: [`Issue`](super::types::Issue)
1077pub async fn issue<T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>>(
1078    client: &Client,
1079    id: String,
1080) -> Result<T, LinearError> {
1081    let variables = serde_json::json!({ "id" : id });
1082    let selection = T::selection();
1083    let query = format!(
1084        "query {}({}) {{ {}({}) {{ {} }} }}",
1085        "Issue", "$id: String!", "issue", "id: $id", selection
1086    );
1087    client.execute::<T>(&query, variables, "issue").await
1088}
1089/// All issue relationships.
1090///
1091/// Full type: [`IssueRelation`](super::types::IssueRelation)
1092pub fn issue_relations<'a, T>(client: &'a Client) -> IssueRelationsQueryBuilder<'a, T> {
1093    IssueRelationsQueryBuilder {
1094        client,
1095        before: None,
1096        after: None,
1097        first: None,
1098        last: None,
1099        include_archived: None,
1100        order_by: None,
1101        _marker: std::marker::PhantomData,
1102    }
1103}
1104/// One specific issue relation.
1105///
1106/// Full type: [`IssueRelation`](super::types::IssueRelation)
1107pub async fn issue_relation<
1108    T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>,
1109>(
1110    client: &Client,
1111    id: String,
1112) -> Result<T, LinearError> {
1113    let variables = serde_json::json!({ "id" : id });
1114    let selection = T::selection();
1115    let query = format!(
1116        "query {}({}) {{ {}({}) {{ {} }} }}",
1117        "IssueRelation", "$id: String!", "issueRelation", "id: $id", selection
1118    );
1119    client
1120        .execute::<T>(&query, variables, "issueRelation")
1121        .await
1122}
1123/// All issue labels.
1124///
1125/// Full type: [`IssueLabel`](super::types::IssueLabel)
1126pub fn issue_labels<'a, T>(client: &'a Client) -> IssueLabelsQueryBuilder<'a, T> {
1127    IssueLabelsQueryBuilder {
1128        client,
1129        filter: None,
1130        before: None,
1131        after: None,
1132        first: None,
1133        last: None,
1134        include_archived: None,
1135        order_by: None,
1136        _marker: std::marker::PhantomData,
1137    }
1138}
1139/// All documents in the workspace.
1140///
1141/// Full type: [`Document`](super::types::Document)
1142pub fn documents<'a, T>(client: &'a Client) -> DocumentsQueryBuilder<'a, T> {
1143    DocumentsQueryBuilder {
1144        client,
1145        filter: None,
1146        before: None,
1147        after: None,
1148        first: None,
1149        last: None,
1150        include_archived: None,
1151        order_by: None,
1152        _marker: std::marker::PhantomData,
1153    }
1154}
1155/// One specific document.
1156///
1157/// Full type: [`Document`](super::types::Document)
1158pub async fn document<T: DeserializeOwned + GraphQLFields<FullType = super::types::Document>>(
1159    client: &Client,
1160    id: String,
1161) -> Result<T, LinearError> {
1162    let variables = serde_json::json!({ "id" : id });
1163    let selection = T::selection();
1164    let query = format!(
1165        "query {}({}) {{ {}({}) {{ {} }} }}",
1166        "Document", "$id: String!", "document", "id: $id", selection
1167    );
1168    client.execute::<T>(&query, variables, "document").await
1169}
1170/// All cycles.
1171///
1172/// Full type: [`Cycle`](super::types::Cycle)
1173pub fn cycles<'a, T>(client: &'a Client) -> CyclesQueryBuilder<'a, T> {
1174    CyclesQueryBuilder {
1175        client,
1176        filter: None,
1177        before: None,
1178        after: None,
1179        first: None,
1180        last: None,
1181        include_archived: None,
1182        order_by: None,
1183        _marker: std::marker::PhantomData,
1184    }
1185}
1186/// One specific cycle.
1187///
1188/// Full type: [`Cycle`](super::types::Cycle)
1189pub async fn cycle<T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>(
1190    client: &Client,
1191    id: String,
1192) -> Result<T, LinearError> {
1193    let variables = serde_json::json!({ "id" : id });
1194    let selection = T::selection();
1195    let query = format!(
1196        "query {}({}) {{ {}({}) {{ {} }} }}",
1197        "Cycle", "$id: String!", "cycle", "id: $id", selection
1198    );
1199    client.execute::<T>(&query, variables, "cycle").await
1200}