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 milestones for the project.
493///
494/// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
495///
496/// Use setter methods to configure optional parameters, then call
497/// [`.send()`](Self::send) to execute the query.
498#[must_use]
499pub struct ProjectMilestonesQueryBuilder<'a, T> {
500    client: &'a Client,
501    filter: Option<ProjectMilestoneFilter>,
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    _marker: std::marker::PhantomData<T>,
509}
510impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::ProjectMilestone>>
511    ProjectMilestonesQueryBuilder<'a, T>
512{
513    pub fn filter(mut self, value: ProjectMilestoneFilter) -> Self {
514        self.filter = Some(value);
515        self
516    }
517    pub fn before(mut self, value: impl Into<String>) -> Self {
518        self.before = Some(value.into());
519        self
520    }
521    pub fn after(mut self, value: impl Into<String>) -> Self {
522        self.after = Some(value.into());
523        self
524    }
525    pub fn first(mut self, value: i64) -> Self {
526        self.first = Some(value);
527        self
528    }
529    pub fn last(mut self, value: i64) -> Self {
530        self.last = Some(value);
531        self
532    }
533    pub fn include_archived(mut self, value: bool) -> Self {
534        self.include_archived = Some(value);
535        self
536    }
537    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
538        self.order_by = Some(value);
539        self
540    }
541    pub async fn send(self) -> Result<Connection<T>, LinearError> {
542        let mut map = serde_json::Map::new();
543        if let Some(ref v) = self.filter {
544            map.insert("filter".to_string(), serde_json::json!(v));
545        }
546        if let Some(ref v) = self.before {
547            map.insert("before".to_string(), serde_json::json!(v));
548        }
549        if let Some(ref v) = self.after {
550            map.insert("after".to_string(), serde_json::json!(v));
551        }
552        if let Some(ref v) = self.first {
553            map.insert("first".to_string(), serde_json::json!(v));
554        }
555        if let Some(ref v) = self.last {
556            map.insert("last".to_string(), serde_json::json!(v));
557        }
558        if let Some(ref v) = self.include_archived {
559            map.insert("includeArchived".to_string(), serde_json::json!(v));
560        }
561        if let Some(ref v) = self.order_by {
562            map.insert("orderBy".to_string(), serde_json::json!(v));
563        }
564        let variables = serde_json::Value::Object(map);
565        let selection = T::selection();
566        let query = format!(
567            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
568            "ProjectMilestones",
569            "$filter: ProjectMilestoneFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
570            "projectMilestones",
571            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
572            selection
573        );
574        self.client
575            .execute_connection::<T>(&query, variables, "projectMilestones")
576            .await
577    }
578}
579/// Query builder: All issues.
580///
581/// Full type: [`Issue`](super::types::Issue)
582///
583/// Use setter methods to configure optional parameters, then call
584/// [`.send()`](Self::send) to execute the query.
585#[must_use]
586pub struct IssuesQueryBuilder<'a, T> {
587    client: &'a Client,
588    filter: Option<IssueFilter>,
589    before: Option<String>,
590    after: Option<String>,
591    first: Option<i64>,
592    last: Option<i64>,
593    include_archived: Option<bool>,
594    order_by: Option<PaginationOrderBy>,
595    sort: Option<IssueSortInput>,
596    _marker: std::marker::PhantomData<T>,
597}
598impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>>
599    IssuesQueryBuilder<'a, T>
600{
601    pub fn filter(mut self, value: IssueFilter) -> Self {
602        self.filter = Some(value);
603        self
604    }
605    pub fn before(mut self, value: impl Into<String>) -> Self {
606        self.before = Some(value.into());
607        self
608    }
609    pub fn after(mut self, value: impl Into<String>) -> Self {
610        self.after = Some(value.into());
611        self
612    }
613    pub fn first(mut self, value: i64) -> Self {
614        self.first = Some(value);
615        self
616    }
617    pub fn last(mut self, value: i64) -> Self {
618        self.last = Some(value);
619        self
620    }
621    pub fn include_archived(mut self, value: bool) -> Self {
622        self.include_archived = Some(value);
623        self
624    }
625    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
626        self.order_by = Some(value);
627        self
628    }
629    pub fn sort(mut self, value: IssueSortInput) -> Self {
630        self.sort = Some(value);
631        self
632    }
633    pub async fn send(self) -> Result<Connection<T>, LinearError> {
634        let mut map = serde_json::Map::new();
635        if let Some(ref v) = self.filter {
636            map.insert("filter".to_string(), serde_json::json!(v));
637        }
638        if let Some(ref v) = self.before {
639            map.insert("before".to_string(), serde_json::json!(v));
640        }
641        if let Some(ref v) = self.after {
642            map.insert("after".to_string(), serde_json::json!(v));
643        }
644        if let Some(ref v) = self.first {
645            map.insert("first".to_string(), serde_json::json!(v));
646        }
647        if let Some(ref v) = self.last {
648            map.insert("last".to_string(), serde_json::json!(v));
649        }
650        if let Some(ref v) = self.include_archived {
651            map.insert("includeArchived".to_string(), serde_json::json!(v));
652        }
653        if let Some(ref v) = self.order_by {
654            map.insert("orderBy".to_string(), serde_json::json!(v));
655        }
656        if let Some(ref v) = self.sort {
657            map.insert("sort".to_string(), serde_json::json!(v));
658        }
659        let variables = serde_json::Value::Object(map);
660        let selection = T::selection();
661        let query = format!(
662            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
663            "Issues",
664            "$filter: IssueFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [IssueSortInput!]",
665            "issues",
666            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort",
667            selection
668        );
669        self.client
670            .execute_connection::<T>(&query, variables, "issues")
671            .await
672    }
673}
674/// Query builder: All issue relationships.
675///
676/// Full type: [`IssueRelation`](super::types::IssueRelation)
677///
678/// Use setter methods to configure optional parameters, then call
679/// [`.send()`](Self::send) to execute the query.
680#[must_use]
681pub struct IssueRelationsQueryBuilder<'a, T> {
682    client: &'a Client,
683    before: Option<String>,
684    after: Option<String>,
685    first: Option<i64>,
686    last: Option<i64>,
687    include_archived: Option<bool>,
688    order_by: Option<PaginationOrderBy>,
689    _marker: std::marker::PhantomData<T>,
690}
691impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>>
692    IssueRelationsQueryBuilder<'a, T>
693{
694    pub fn before(mut self, value: impl Into<String>) -> Self {
695        self.before = Some(value.into());
696        self
697    }
698    pub fn after(mut self, value: impl Into<String>) -> Self {
699        self.after = Some(value.into());
700        self
701    }
702    pub fn first(mut self, value: i64) -> Self {
703        self.first = Some(value);
704        self
705    }
706    pub fn last(mut self, value: i64) -> Self {
707        self.last = Some(value);
708        self
709    }
710    pub fn include_archived(mut self, value: bool) -> Self {
711        self.include_archived = Some(value);
712        self
713    }
714    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
715        self.order_by = Some(value);
716        self
717    }
718    pub async fn send(self) -> Result<Connection<T>, LinearError> {
719        let mut map = serde_json::Map::new();
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            "IssueRelations",
743            "$before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
744            "issueRelations",
745            "before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
746            selection
747        );
748        self.client
749            .execute_connection::<T>(&query, variables, "issueRelations")
750            .await
751    }
752}
753/// Query builder: All issue labels.
754///
755/// Full type: [`IssueLabel`](super::types::IssueLabel)
756///
757/// Use setter methods to configure optional parameters, then call
758/// [`.send()`](Self::send) to execute the query.
759#[must_use]
760pub struct IssueLabelsQueryBuilder<'a, T> {
761    client: &'a Client,
762    filter: Option<IssueLabelFilter>,
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::IssueLabel>>
772    IssueLabelsQueryBuilder<'a, T>
773{
774    pub fn filter(mut self, value: IssueLabelFilter) -> 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            "IssueLabels",
830            "$filter: IssueLabelFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
831            "issueLabels",
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, "issueLabels")
837            .await
838    }
839}
840/// Query builder: All documents in the workspace.
841///
842/// Full type: [`Document`](super::types::Document)
843///
844/// Use setter methods to configure optional parameters, then call
845/// [`.send()`](Self::send) to execute the query.
846#[must_use]
847pub struct DocumentsQueryBuilder<'a, T> {
848    client: &'a Client,
849    filter: Option<DocumentFilter>,
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::Document>>
859    DocumentsQueryBuilder<'a, T>
860{
861    pub fn filter(mut self, value: DocumentFilter) -> 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            "Documents",
917            "$filter: DocumentFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
918            "documents",
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, "documents")
924            .await
925    }
926}
927/// Query builder: All cycles.
928///
929/// Full type: [`Cycle`](super::types::Cycle)
930///
931/// Use setter methods to configure optional parameters, then call
932/// [`.send()`](Self::send) to execute the query.
933#[must_use]
934pub struct CyclesQueryBuilder<'a, T> {
935    client: &'a Client,
936    filter: Option<CycleFilter>,
937    before: Option<String>,
938    after: Option<String>,
939    first: Option<i64>,
940    last: Option<i64>,
941    include_archived: Option<bool>,
942    order_by: Option<PaginationOrderBy>,
943    _marker: std::marker::PhantomData<T>,
944}
945impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>
946    CyclesQueryBuilder<'a, T>
947{
948    pub fn filter(mut self, value: CycleFilter) -> Self {
949        self.filter = Some(value);
950        self
951    }
952    pub fn before(mut self, value: impl Into<String>) -> Self {
953        self.before = Some(value.into());
954        self
955    }
956    pub fn after(mut self, value: impl Into<String>) -> Self {
957        self.after = Some(value.into());
958        self
959    }
960    pub fn first(mut self, value: i64) -> Self {
961        self.first = Some(value);
962        self
963    }
964    pub fn last(mut self, value: i64) -> Self {
965        self.last = Some(value);
966        self
967    }
968    pub fn include_archived(mut self, value: bool) -> Self {
969        self.include_archived = Some(value);
970        self
971    }
972    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
973        self.order_by = Some(value);
974        self
975    }
976    pub async fn send(self) -> Result<Connection<T>, LinearError> {
977        let mut map = serde_json::Map::new();
978        if let Some(ref v) = self.filter {
979            map.insert("filter".to_string(), serde_json::json!(v));
980        }
981        if let Some(ref v) = self.before {
982            map.insert("before".to_string(), serde_json::json!(v));
983        }
984        if let Some(ref v) = self.after {
985            map.insert("after".to_string(), serde_json::json!(v));
986        }
987        if let Some(ref v) = self.first {
988            map.insert("first".to_string(), serde_json::json!(v));
989        }
990        if let Some(ref v) = self.last {
991            map.insert("last".to_string(), serde_json::json!(v));
992        }
993        if let Some(ref v) = self.include_archived {
994            map.insert("includeArchived".to_string(), serde_json::json!(v));
995        }
996        if let Some(ref v) = self.order_by {
997            map.insert("orderBy".to_string(), serde_json::json!(v));
998        }
999        let variables = serde_json::Value::Object(map);
1000        let selection = T::selection();
1001        let query = format!(
1002            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
1003            "Cycles",
1004            "$filter: CycleFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
1005            "cycles",
1006            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
1007            selection
1008        );
1009        self.client
1010            .execute_connection::<T>(&query, variables, "cycles")
1011            .await
1012    }
1013}
1014/// All issue workflow states.
1015///
1016/// Full type: [`WorkflowState`](super::types::WorkflowState)
1017pub fn workflow_states<'a, T>(client: &'a Client) -> WorkflowStatesQueryBuilder<'a, T> {
1018    WorkflowStatesQueryBuilder {
1019        client,
1020        filter: None,
1021        before: None,
1022        after: None,
1023        first: None,
1024        last: None,
1025        include_archived: None,
1026        order_by: None,
1027        _marker: std::marker::PhantomData,
1028    }
1029}
1030/// All users for the organization.
1031///
1032/// Full type: [`User`](super::types::User)
1033pub fn users<'a, T>(client: &'a Client) -> UsersQueryBuilder<'a, T> {
1034    UsersQueryBuilder {
1035        client,
1036        filter: None,
1037        include_disabled: None,
1038        before: None,
1039        after: None,
1040        first: None,
1041        last: None,
1042        include_archived: None,
1043        order_by: None,
1044        sort: None,
1045        _marker: std::marker::PhantomData,
1046    }
1047}
1048/// The currently authenticated user.
1049///
1050/// Full type: [`User`](super::types::User)
1051pub async fn whoami<T: DeserializeOwned + GraphQLFields<FullType = super::types::User>>(
1052    client: &Client,
1053) -> Result<T, LinearError> {
1054    let variables = serde_json::json!({});
1055    let selection = T::selection();
1056    let query = format!("query {} {{ {} {{ {} }} }}", "Viewer", "viewer", selection);
1057    client.execute::<T>(&query, variables, "viewer").await
1058}
1059/// All projects.
1060///
1061/// Full type: [`Project`](super::types::Project)
1062pub fn projects<'a, T>(client: &'a Client) -> ProjectsQueryBuilder<'a, T> {
1063    ProjectsQueryBuilder {
1064        client,
1065        filter: None,
1066        before: None,
1067        after: None,
1068        first: None,
1069        last: None,
1070        include_archived: None,
1071        order_by: None,
1072        sort: None,
1073        _marker: std::marker::PhantomData,
1074    }
1075}
1076/// One specific project.
1077///
1078/// Full type: [`Project`](super::types::Project)
1079pub async fn project<T: DeserializeOwned + GraphQLFields<FullType = super::types::Project>>(
1080    client: &Client,
1081    id: String,
1082) -> Result<T, LinearError> {
1083    let variables = serde_json::json!({ "id" : id });
1084    let selection = T::selection();
1085    let query = format!(
1086        "query {}({}) {{ {}({}) {{ {} }} }}",
1087        "Project", "$id: String!", "project", "id: $id", selection
1088    );
1089    client.execute::<T>(&query, variables, "project").await
1090}
1091/// 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.
1092///
1093/// Full type: [`Team`](super::types::Team)
1094pub fn teams<'a, T>(client: &'a Client) -> TeamsQueryBuilder<'a, T> {
1095    TeamsQueryBuilder {
1096        client,
1097        filter: None,
1098        before: None,
1099        after: None,
1100        first: None,
1101        last: None,
1102        include_archived: None,
1103        order_by: None,
1104        _marker: std::marker::PhantomData,
1105    }
1106}
1107/// One specific team.
1108///
1109/// Full type: [`Team`](super::types::Team)
1110pub async fn team<T: DeserializeOwned + GraphQLFields<FullType = super::types::Team>>(
1111    client: &Client,
1112    id: String,
1113) -> Result<T, LinearError> {
1114    let variables = serde_json::json!({ "id" : id });
1115    let selection = T::selection();
1116    let query = format!(
1117        "query {}({}) {{ {}({}) {{ {} }} }}",
1118        "Team", "$id: String!", "team", "id: $id", selection
1119    );
1120    client.execute::<T>(&query, variables, "team").await
1121}
1122/// Search issues.
1123///
1124/// Full type: [`IssueSearchResult`](super::types::IssueSearchResult)
1125pub fn search_issues<'a, T>(
1126    client: &'a Client,
1127    term: impl Into<String>,
1128) -> SearchIssuesQueryBuilder<'a, T> {
1129    SearchIssuesQueryBuilder {
1130        client,
1131        term: term.into(),
1132        filter: None,
1133        before: None,
1134        after: None,
1135        first: None,
1136        last: None,
1137        include_archived: None,
1138        order_by: None,
1139        include_comments: None,
1140        team_id: None,
1141        _marker: std::marker::PhantomData,
1142    }
1143}
1144/// All milestones for the project.
1145///
1146/// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
1147pub fn project_milestones<'a, T>(client: &'a Client) -> ProjectMilestonesQueryBuilder<'a, T> {
1148    ProjectMilestonesQueryBuilder {
1149        client,
1150        filter: None,
1151        before: None,
1152        after: None,
1153        first: None,
1154        last: None,
1155        include_archived: None,
1156        order_by: None,
1157        _marker: std::marker::PhantomData,
1158    }
1159}
1160/// One specific project milestone.
1161///
1162/// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
1163pub async fn project_milestone<
1164    T: DeserializeOwned + GraphQLFields<FullType = super::types::ProjectMilestone>,
1165>(
1166    client: &Client,
1167    id: String,
1168) -> Result<T, LinearError> {
1169    let variables = serde_json::json!({ "id" : id });
1170    let selection = T::selection();
1171    let query = format!(
1172        "query {}({}) {{ {}({}) {{ {} }} }}",
1173        "ProjectMilestone", "$id: String!", "projectMilestone", "id: $id", selection
1174    );
1175    client
1176        .execute::<T>(&query, variables, "projectMilestone")
1177        .await
1178}
1179/// All issues.
1180///
1181/// Full type: [`Issue`](super::types::Issue)
1182pub fn issues<'a, T>(client: &'a Client) -> IssuesQueryBuilder<'a, T> {
1183    IssuesQueryBuilder {
1184        client,
1185        filter: None,
1186        before: None,
1187        after: None,
1188        first: None,
1189        last: None,
1190        include_archived: None,
1191        order_by: None,
1192        sort: None,
1193        _marker: std::marker::PhantomData,
1194    }
1195}
1196/// One specific issue.
1197///
1198/// Full type: [`Issue`](super::types::Issue)
1199pub async fn issue<T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>>(
1200    client: &Client,
1201    id: String,
1202) -> Result<T, LinearError> {
1203    let variables = serde_json::json!({ "id" : id });
1204    let selection = T::selection();
1205    let query = format!(
1206        "query {}({}) {{ {}({}) {{ {} }} }}",
1207        "Issue", "$id: String!", "issue", "id: $id", selection
1208    );
1209    client.execute::<T>(&query, variables, "issue").await
1210}
1211/// All issue relationships.
1212///
1213/// Full type: [`IssueRelation`](super::types::IssueRelation)
1214pub fn issue_relations<'a, T>(client: &'a Client) -> IssueRelationsQueryBuilder<'a, T> {
1215    IssueRelationsQueryBuilder {
1216        client,
1217        before: None,
1218        after: None,
1219        first: None,
1220        last: None,
1221        include_archived: None,
1222        order_by: None,
1223        _marker: std::marker::PhantomData,
1224    }
1225}
1226/// One specific issue relation.
1227///
1228/// Full type: [`IssueRelation`](super::types::IssueRelation)
1229pub async fn issue_relation<
1230    T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>,
1231>(
1232    client: &Client,
1233    id: String,
1234) -> Result<T, LinearError> {
1235    let variables = serde_json::json!({ "id" : id });
1236    let selection = T::selection();
1237    let query = format!(
1238        "query {}({}) {{ {}({}) {{ {} }} }}",
1239        "IssueRelation", "$id: String!", "issueRelation", "id: $id", selection
1240    );
1241    client
1242        .execute::<T>(&query, variables, "issueRelation")
1243        .await
1244}
1245/// All issue labels.
1246///
1247/// Full type: [`IssueLabel`](super::types::IssueLabel)
1248pub fn issue_labels<'a, T>(client: &'a Client) -> IssueLabelsQueryBuilder<'a, T> {
1249    IssueLabelsQueryBuilder {
1250        client,
1251        filter: None,
1252        before: None,
1253        after: None,
1254        first: None,
1255        last: None,
1256        include_archived: None,
1257        order_by: None,
1258        _marker: std::marker::PhantomData,
1259    }
1260}
1261/// All documents in the workspace.
1262///
1263/// Full type: [`Document`](super::types::Document)
1264pub fn documents<'a, T>(client: &'a Client) -> DocumentsQueryBuilder<'a, T> {
1265    DocumentsQueryBuilder {
1266        client,
1267        filter: None,
1268        before: None,
1269        after: None,
1270        first: None,
1271        last: None,
1272        include_archived: None,
1273        order_by: None,
1274        _marker: std::marker::PhantomData,
1275    }
1276}
1277/// One specific document.
1278///
1279/// Full type: [`Document`](super::types::Document)
1280pub async fn document<T: DeserializeOwned + GraphQLFields<FullType = super::types::Document>>(
1281    client: &Client,
1282    id: String,
1283) -> Result<T, LinearError> {
1284    let variables = serde_json::json!({ "id" : id });
1285    let selection = T::selection();
1286    let query = format!(
1287        "query {}({}) {{ {}({}) {{ {} }} }}",
1288        "Document", "$id: String!", "document", "id: $id", selection
1289    );
1290    client.execute::<T>(&query, variables, "document").await
1291}
1292/// All cycles.
1293///
1294/// Full type: [`Cycle`](super::types::Cycle)
1295pub fn cycles<'a, T>(client: &'a Client) -> CyclesQueryBuilder<'a, T> {
1296    CyclesQueryBuilder {
1297        client,
1298        filter: None,
1299        before: None,
1300        after: None,
1301        first: None,
1302        last: None,
1303        include_archived: None,
1304        order_by: None,
1305        _marker: std::marker::PhantomData,
1306    }
1307}
1308/// One specific cycle.
1309///
1310/// Full type: [`Cycle`](super::types::Cycle)
1311pub async fn cycle<T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>(
1312    client: &Client,
1313    id: String,
1314) -> Result<T, LinearError> {
1315    let variables = serde_json::json!({ "id" : id });
1316    let selection = T::selection();
1317    let query = format!(
1318        "query {}({}) {{ {}({}) {{ {} }} }}",
1319        "Cycle", "$id: String!", "cycle", "id: $id", selection
1320    );
1321    client.execute::<T>(&query, variables, "cycle").await
1322}