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 (issue statuses). Returns a paginated list of workflow states visible to the authenticated user, across all teams they have access to.
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 in the workspace. Supports filtering, sorting, and pagination.
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: Returns all projects in the workspace, with optional filtering and sorting.
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 the user can access. This includes public teams and private teams the user is a member of. This may differ from `administrableTeams`, which returns teams whose settings the user can change but whose issues they don't necessarily have access to.
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 by text query using full-text and vector search. Results are ranked by relevance unless an orderBy parameter is specified. Supports optional issue filters and comment inclusion. Rate-limited to 30 requests per minute.
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: Returns all project statuses in the workspace.
493///
494/// Full type: [`ProjectStatus`](super::types::ProjectStatus)
495///
496/// Use setter methods to configure optional parameters, then call
497/// [`.send()`](Self::send) to execute the query.
498#[must_use]
499pub struct ProjectStatusesQueryBuilder<'a, T> {
500    client: &'a Client,
501    before: Option<String>,
502    after: Option<String>,
503    first: Option<i64>,
504    last: Option<i64>,
505    include_archived: Option<bool>,
506    order_by: Option<PaginationOrderBy>,
507    _marker: std::marker::PhantomData<T>,
508}
509impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::ProjectStatus>>
510    ProjectStatusesQueryBuilder<'a, T>
511{
512    pub fn before(mut self, value: impl Into<String>) -> Self {
513        self.before = Some(value.into());
514        self
515    }
516    pub fn after(mut self, value: impl Into<String>) -> Self {
517        self.after = Some(value.into());
518        self
519    }
520    pub fn first(mut self, value: i64) -> Self {
521        self.first = Some(value);
522        self
523    }
524    pub fn last(mut self, value: i64) -> Self {
525        self.last = Some(value);
526        self
527    }
528    pub fn include_archived(mut self, value: bool) -> Self {
529        self.include_archived = Some(value);
530        self
531    }
532    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
533        self.order_by = Some(value);
534        self
535    }
536    pub async fn send(self) -> Result<Connection<T>, LinearError> {
537        let mut map = serde_json::Map::new();
538        if let Some(ref v) = self.before {
539            map.insert("before".to_string(), serde_json::json!(v));
540        }
541        if let Some(ref v) = self.after {
542            map.insert("after".to_string(), serde_json::json!(v));
543        }
544        if let Some(ref v) = self.first {
545            map.insert("first".to_string(), serde_json::json!(v));
546        }
547        if let Some(ref v) = self.last {
548            map.insert("last".to_string(), serde_json::json!(v));
549        }
550        if let Some(ref v) = self.include_archived {
551            map.insert("includeArchived".to_string(), serde_json::json!(v));
552        }
553        if let Some(ref v) = self.order_by {
554            map.insert("orderBy".to_string(), serde_json::json!(v));
555        }
556        let variables = serde_json::Value::Object(map);
557        let selection = T::selection();
558        let query = format!(
559            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
560            "ProjectStatuses",
561            "$before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
562            "projectStatuses",
563            "before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
564            selection
565        );
566        self.client
567            .execute_connection::<T>(&query, variables, "projectStatuses")
568            .await
569    }
570}
571/// Query builder: Returns all project milestones in the workspace, with optional filtering.
572///
573/// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
574///
575/// Use setter methods to configure optional parameters, then call
576/// [`.send()`](Self::send) to execute the query.
577#[must_use]
578pub struct ProjectMilestonesQueryBuilder<'a, T> {
579    client: &'a Client,
580    filter: Option<ProjectMilestoneFilter>,
581    before: Option<String>,
582    after: Option<String>,
583    first: Option<i64>,
584    last: Option<i64>,
585    include_archived: Option<bool>,
586    order_by: Option<PaginationOrderBy>,
587    _marker: std::marker::PhantomData<T>,
588}
589impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::ProjectMilestone>>
590    ProjectMilestonesQueryBuilder<'a, T>
591{
592    pub fn filter(mut self, value: ProjectMilestoneFilter) -> Self {
593        self.filter = Some(value);
594        self
595    }
596    pub fn before(mut self, value: impl Into<String>) -> Self {
597        self.before = Some(value.into());
598        self
599    }
600    pub fn after(mut self, value: impl Into<String>) -> Self {
601        self.after = Some(value.into());
602        self
603    }
604    pub fn first(mut self, value: i64) -> Self {
605        self.first = Some(value);
606        self
607    }
608    pub fn last(mut self, value: i64) -> Self {
609        self.last = Some(value);
610        self
611    }
612    pub fn include_archived(mut self, value: bool) -> Self {
613        self.include_archived = Some(value);
614        self
615    }
616    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
617        self.order_by = Some(value);
618        self
619    }
620    pub async fn send(self) -> Result<Connection<T>, LinearError> {
621        let mut map = serde_json::Map::new();
622        if let Some(ref v) = self.filter {
623            map.insert("filter".to_string(), serde_json::json!(v));
624        }
625        if let Some(ref v) = self.before {
626            map.insert("before".to_string(), serde_json::json!(v));
627        }
628        if let Some(ref v) = self.after {
629            map.insert("after".to_string(), serde_json::json!(v));
630        }
631        if let Some(ref v) = self.first {
632            map.insert("first".to_string(), serde_json::json!(v));
633        }
634        if let Some(ref v) = self.last {
635            map.insert("last".to_string(), serde_json::json!(v));
636        }
637        if let Some(ref v) = self.include_archived {
638            map.insert("includeArchived".to_string(), serde_json::json!(v));
639        }
640        if let Some(ref v) = self.order_by {
641            map.insert("orderBy".to_string(), serde_json::json!(v));
642        }
643        let variables = serde_json::Value::Object(map);
644        let selection = T::selection();
645        let query = format!(
646            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
647            "ProjectMilestones",
648            "$filter: ProjectMilestoneFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
649            "projectMilestones",
650            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
651            selection
652        );
653        self.client
654            .execute_connection::<T>(&query, variables, "projectMilestones")
655            .await
656    }
657}
658/// Query builder: Returns all project labels in the workspace, with optional filtering.
659///
660/// Full type: [`ProjectLabel`](super::types::ProjectLabel)
661///
662/// Use setter methods to configure optional parameters, then call
663/// [`.send()`](Self::send) to execute the query.
664#[must_use]
665pub struct ProjectLabelsQueryBuilder<'a, T> {
666    client: &'a Client,
667    filter: Option<ProjectLabelFilter>,
668    before: Option<String>,
669    after: Option<String>,
670    first: Option<i64>,
671    last: Option<i64>,
672    include_archived: Option<bool>,
673    order_by: Option<PaginationOrderBy>,
674    _marker: std::marker::PhantomData<T>,
675}
676impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::ProjectLabel>>
677    ProjectLabelsQueryBuilder<'a, T>
678{
679    pub fn filter(mut self, value: ProjectLabelFilter) -> Self {
680        self.filter = Some(value);
681        self
682    }
683    pub fn before(mut self, value: impl Into<String>) -> Self {
684        self.before = Some(value.into());
685        self
686    }
687    pub fn after(mut self, value: impl Into<String>) -> Self {
688        self.after = Some(value.into());
689        self
690    }
691    pub fn first(mut self, value: i64) -> Self {
692        self.first = Some(value);
693        self
694    }
695    pub fn last(mut self, value: i64) -> Self {
696        self.last = Some(value);
697        self
698    }
699    pub fn include_archived(mut self, value: bool) -> Self {
700        self.include_archived = Some(value);
701        self
702    }
703    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
704        self.order_by = Some(value);
705        self
706    }
707    pub async fn send(self) -> Result<Connection<T>, LinearError> {
708        let mut map = serde_json::Map::new();
709        if let Some(ref v) = self.filter {
710            map.insert("filter".to_string(), serde_json::json!(v));
711        }
712        if let Some(ref v) = self.before {
713            map.insert("before".to_string(), serde_json::json!(v));
714        }
715        if let Some(ref v) = self.after {
716            map.insert("after".to_string(), serde_json::json!(v));
717        }
718        if let Some(ref v) = self.first {
719            map.insert("first".to_string(), serde_json::json!(v));
720        }
721        if let Some(ref v) = self.last {
722            map.insert("last".to_string(), serde_json::json!(v));
723        }
724        if let Some(ref v) = self.include_archived {
725            map.insert("includeArchived".to_string(), serde_json::json!(v));
726        }
727        if let Some(ref v) = self.order_by {
728            map.insert("orderBy".to_string(), serde_json::json!(v));
729        }
730        let variables = serde_json::Value::Object(map);
731        let selection = T::selection();
732        let query = format!(
733            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
734            "ProjectLabels",
735            "$filter: ProjectLabelFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
736            "projectLabels",
737            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
738            selection
739        );
740        self.client
741            .execute_connection::<T>(&query, variables, "projectLabels")
742            .await
743    }
744}
745/// Query builder: All issues. Returns a paginated list of issues visible to the authenticated user. Can be filtered by various criteria including team, assignee, state, labels, project, and cycle.
746///
747/// Full type: [`Issue`](super::types::Issue)
748///
749/// Use setter methods to configure optional parameters, then call
750/// [`.send()`](Self::send) to execute the query.
751#[must_use]
752pub struct IssuesQueryBuilder<'a, T> {
753    client: &'a Client,
754    filter: Option<IssueFilter>,
755    before: Option<String>,
756    after: Option<String>,
757    first: Option<i64>,
758    last: Option<i64>,
759    include_archived: Option<bool>,
760    order_by: Option<PaginationOrderBy>,
761    sort: Option<IssueSortInput>,
762    _marker: std::marker::PhantomData<T>,
763}
764impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>>
765    IssuesQueryBuilder<'a, T>
766{
767    pub fn filter(mut self, value: IssueFilter) -> Self {
768        self.filter = Some(value);
769        self
770    }
771    pub fn before(mut self, value: impl Into<String>) -> Self {
772        self.before = Some(value.into());
773        self
774    }
775    pub fn after(mut self, value: impl Into<String>) -> Self {
776        self.after = Some(value.into());
777        self
778    }
779    pub fn first(mut self, value: i64) -> Self {
780        self.first = Some(value);
781        self
782    }
783    pub fn last(mut self, value: i64) -> Self {
784        self.last = Some(value);
785        self
786    }
787    pub fn include_archived(mut self, value: bool) -> Self {
788        self.include_archived = Some(value);
789        self
790    }
791    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
792        self.order_by = Some(value);
793        self
794    }
795    pub fn sort(mut self, value: IssueSortInput) -> Self {
796        self.sort = Some(value);
797        self
798    }
799    pub async fn send(self) -> Result<Connection<T>, LinearError> {
800        let mut map = serde_json::Map::new();
801        if let Some(ref v) = self.filter {
802            map.insert("filter".to_string(), serde_json::json!(v));
803        }
804        if let Some(ref v) = self.before {
805            map.insert("before".to_string(), serde_json::json!(v));
806        }
807        if let Some(ref v) = self.after {
808            map.insert("after".to_string(), serde_json::json!(v));
809        }
810        if let Some(ref v) = self.first {
811            map.insert("first".to_string(), serde_json::json!(v));
812        }
813        if let Some(ref v) = self.last {
814            map.insert("last".to_string(), serde_json::json!(v));
815        }
816        if let Some(ref v) = self.include_archived {
817            map.insert("includeArchived".to_string(), serde_json::json!(v));
818        }
819        if let Some(ref v) = self.order_by {
820            map.insert("orderBy".to_string(), serde_json::json!(v));
821        }
822        if let Some(ref v) = self.sort {
823            map.insert("sort".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            "Issues",
830            "$filter: IssueFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [IssueSortInput!]",
831            "issues",
832            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort",
833            selection
834        );
835        self.client
836            .execute_connection::<T>(&query, variables, "issues")
837            .await
838    }
839}
840/// Query builder: All issue relations. Returns a paginated list of all issue relations (blocks, blocked by, relates to, duplicates) visible to the authenticated user.
841///
842/// Full type: [`IssueRelation`](super::types::IssueRelation)
843///
844/// Use setter methods to configure optional parameters, then call
845/// [`.send()`](Self::send) to execute the query.
846#[must_use]
847pub struct IssueRelationsQueryBuilder<'a, T> {
848    client: &'a Client,
849    before: Option<String>,
850    after: Option<String>,
851    first: Option<i64>,
852    last: Option<i64>,
853    include_archived: Option<bool>,
854    order_by: Option<PaginationOrderBy>,
855    _marker: std::marker::PhantomData<T>,
856}
857impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>>
858    IssueRelationsQueryBuilder<'a, T>
859{
860    pub fn before(mut self, value: impl Into<String>) -> Self {
861        self.before = Some(value.into());
862        self
863    }
864    pub fn after(mut self, value: impl Into<String>) -> Self {
865        self.after = Some(value.into());
866        self
867    }
868    pub fn first(mut self, value: i64) -> Self {
869        self.first = Some(value);
870        self
871    }
872    pub fn last(mut self, value: i64) -> Self {
873        self.last = Some(value);
874        self
875    }
876    pub fn include_archived(mut self, value: bool) -> Self {
877        self.include_archived = Some(value);
878        self
879    }
880    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
881        self.order_by = Some(value);
882        self
883    }
884    pub async fn send(self) -> Result<Connection<T>, LinearError> {
885        let mut map = serde_json::Map::new();
886        if let Some(ref v) = self.before {
887            map.insert("before".to_string(), serde_json::json!(v));
888        }
889        if let Some(ref v) = self.after {
890            map.insert("after".to_string(), serde_json::json!(v));
891        }
892        if let Some(ref v) = self.first {
893            map.insert("first".to_string(), serde_json::json!(v));
894        }
895        if let Some(ref v) = self.last {
896            map.insert("last".to_string(), serde_json::json!(v));
897        }
898        if let Some(ref v) = self.include_archived {
899            map.insert("includeArchived".to_string(), serde_json::json!(v));
900        }
901        if let Some(ref v) = self.order_by {
902            map.insert("orderBy".to_string(), serde_json::json!(v));
903        }
904        let variables = serde_json::Value::Object(map);
905        let selection = T::selection();
906        let query = format!(
907            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
908            "IssueRelations",
909            "$before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
910            "issueRelations",
911            "before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
912            selection
913        );
914        self.client
915            .execute_connection::<T>(&query, variables, "issueRelations")
916            .await
917    }
918}
919/// Query builder: All issue labels. Returns a paginated list of labels visible to the authenticated user, including both workspace-level and team-scoped labels.
920///
921/// Full type: [`IssueLabel`](super::types::IssueLabel)
922///
923/// Use setter methods to configure optional parameters, then call
924/// [`.send()`](Self::send) to execute the query.
925#[must_use]
926pub struct IssueLabelsQueryBuilder<'a, T> {
927    client: &'a Client,
928    filter: Option<IssueLabelFilter>,
929    before: Option<String>,
930    after: Option<String>,
931    first: Option<i64>,
932    last: Option<i64>,
933    include_archived: Option<bool>,
934    order_by: Option<PaginationOrderBy>,
935    _marker: std::marker::PhantomData<T>,
936}
937impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueLabel>>
938    IssueLabelsQueryBuilder<'a, T>
939{
940    pub fn filter(mut self, value: IssueLabelFilter) -> Self {
941        self.filter = Some(value);
942        self
943    }
944    pub fn before(mut self, value: impl Into<String>) -> Self {
945        self.before = Some(value.into());
946        self
947    }
948    pub fn after(mut self, value: impl Into<String>) -> Self {
949        self.after = Some(value.into());
950        self
951    }
952    pub fn first(mut self, value: i64) -> Self {
953        self.first = Some(value);
954        self
955    }
956    pub fn last(mut self, value: i64) -> Self {
957        self.last = Some(value);
958        self
959    }
960    pub fn include_archived(mut self, value: bool) -> Self {
961        self.include_archived = Some(value);
962        self
963    }
964    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
965        self.order_by = Some(value);
966        self
967    }
968    pub async fn send(self) -> Result<Connection<T>, LinearError> {
969        let mut map = serde_json::Map::new();
970        if let Some(ref v) = self.filter {
971            map.insert("filter".to_string(), serde_json::json!(v));
972        }
973        if let Some(ref v) = self.before {
974            map.insert("before".to_string(), serde_json::json!(v));
975        }
976        if let Some(ref v) = self.after {
977            map.insert("after".to_string(), serde_json::json!(v));
978        }
979        if let Some(ref v) = self.first {
980            map.insert("first".to_string(), serde_json::json!(v));
981        }
982        if let Some(ref v) = self.last {
983            map.insert("last".to_string(), serde_json::json!(v));
984        }
985        if let Some(ref v) = self.include_archived {
986            map.insert("includeArchived".to_string(), serde_json::json!(v));
987        }
988        if let Some(ref v) = self.order_by {
989            map.insert("orderBy".to_string(), serde_json::json!(v));
990        }
991        let variables = serde_json::Value::Object(map);
992        let selection = T::selection();
993        let query = format!(
994            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
995            "IssueLabels",
996            "$filter: IssueLabelFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
997            "issueLabels",
998            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
999            selection
1000        );
1001        self.client
1002            .execute_connection::<T>(&query, variables, "issueLabels")
1003            .await
1004    }
1005}
1006/// Query builder: All documents the user has access to in the workspace.
1007///
1008/// Full type: [`Document`](super::types::Document)
1009///
1010/// Use setter methods to configure optional parameters, then call
1011/// [`.send()`](Self::send) to execute the query.
1012#[must_use]
1013pub struct DocumentsQueryBuilder<'a, T> {
1014    client: &'a Client,
1015    filter: Option<DocumentFilter>,
1016    before: Option<String>,
1017    after: Option<String>,
1018    first: Option<i64>,
1019    last: Option<i64>,
1020    include_archived: Option<bool>,
1021    order_by: Option<PaginationOrderBy>,
1022    _marker: std::marker::PhantomData<T>,
1023}
1024impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Document>>
1025    DocumentsQueryBuilder<'a, T>
1026{
1027    pub fn filter(mut self, value: DocumentFilter) -> Self {
1028        self.filter = Some(value);
1029        self
1030    }
1031    pub fn before(mut self, value: impl Into<String>) -> Self {
1032        self.before = Some(value.into());
1033        self
1034    }
1035    pub fn after(mut self, value: impl Into<String>) -> Self {
1036        self.after = Some(value.into());
1037        self
1038    }
1039    pub fn first(mut self, value: i64) -> Self {
1040        self.first = Some(value);
1041        self
1042    }
1043    pub fn last(mut self, value: i64) -> Self {
1044        self.last = Some(value);
1045        self
1046    }
1047    pub fn include_archived(mut self, value: bool) -> Self {
1048        self.include_archived = Some(value);
1049        self
1050    }
1051    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
1052        self.order_by = Some(value);
1053        self
1054    }
1055    pub async fn send(self) -> Result<Connection<T>, LinearError> {
1056        let mut map = serde_json::Map::new();
1057        if let Some(ref v) = self.filter {
1058            map.insert("filter".to_string(), serde_json::json!(v));
1059        }
1060        if let Some(ref v) = self.before {
1061            map.insert("before".to_string(), serde_json::json!(v));
1062        }
1063        if let Some(ref v) = self.after {
1064            map.insert("after".to_string(), serde_json::json!(v));
1065        }
1066        if let Some(ref v) = self.first {
1067            map.insert("first".to_string(), serde_json::json!(v));
1068        }
1069        if let Some(ref v) = self.last {
1070            map.insert("last".to_string(), serde_json::json!(v));
1071        }
1072        if let Some(ref v) = self.include_archived {
1073            map.insert("includeArchived".to_string(), serde_json::json!(v));
1074        }
1075        if let Some(ref v) = self.order_by {
1076            map.insert("orderBy".to_string(), serde_json::json!(v));
1077        }
1078        let variables = serde_json::Value::Object(map);
1079        let selection = T::selection();
1080        let query = format!(
1081            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
1082            "Documents",
1083            "$filter: DocumentFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
1084            "documents",
1085            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
1086            selection
1087        );
1088        self.client
1089            .execute_connection::<T>(&query, variables, "documents")
1090            .await
1091    }
1092}
1093/// Query builder: All cycles accessible to the user.
1094///
1095/// Full type: [`Cycle`](super::types::Cycle)
1096///
1097/// Use setter methods to configure optional parameters, then call
1098/// [`.send()`](Self::send) to execute the query.
1099#[must_use]
1100pub struct CyclesQueryBuilder<'a, T> {
1101    client: &'a Client,
1102    filter: Option<CycleFilter>,
1103    before: Option<String>,
1104    after: Option<String>,
1105    first: Option<i64>,
1106    last: Option<i64>,
1107    include_archived: Option<bool>,
1108    order_by: Option<PaginationOrderBy>,
1109    _marker: std::marker::PhantomData<T>,
1110}
1111impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>
1112    CyclesQueryBuilder<'a, T>
1113{
1114    pub fn filter(mut self, value: CycleFilter) -> Self {
1115        self.filter = Some(value);
1116        self
1117    }
1118    pub fn before(mut self, value: impl Into<String>) -> Self {
1119        self.before = Some(value.into());
1120        self
1121    }
1122    pub fn after(mut self, value: impl Into<String>) -> Self {
1123        self.after = Some(value.into());
1124        self
1125    }
1126    pub fn first(mut self, value: i64) -> Self {
1127        self.first = Some(value);
1128        self
1129    }
1130    pub fn last(mut self, value: i64) -> Self {
1131        self.last = Some(value);
1132        self
1133    }
1134    pub fn include_archived(mut self, value: bool) -> Self {
1135        self.include_archived = Some(value);
1136        self
1137    }
1138    pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
1139        self.order_by = Some(value);
1140        self
1141    }
1142    pub async fn send(self) -> Result<Connection<T>, LinearError> {
1143        let mut map = serde_json::Map::new();
1144        if let Some(ref v) = self.filter {
1145            map.insert("filter".to_string(), serde_json::json!(v));
1146        }
1147        if let Some(ref v) = self.before {
1148            map.insert("before".to_string(), serde_json::json!(v));
1149        }
1150        if let Some(ref v) = self.after {
1151            map.insert("after".to_string(), serde_json::json!(v));
1152        }
1153        if let Some(ref v) = self.first {
1154            map.insert("first".to_string(), serde_json::json!(v));
1155        }
1156        if let Some(ref v) = self.last {
1157            map.insert("last".to_string(), serde_json::json!(v));
1158        }
1159        if let Some(ref v) = self.include_archived {
1160            map.insert("includeArchived".to_string(), serde_json::json!(v));
1161        }
1162        if let Some(ref v) = self.order_by {
1163            map.insert("orderBy".to_string(), serde_json::json!(v));
1164        }
1165        let variables = serde_json::Value::Object(map);
1166        let selection = T::selection();
1167        let query = format!(
1168            "query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
1169            "Cycles",
1170            "$filter: CycleFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy",
1171            "cycles",
1172            "filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy",
1173            selection
1174        );
1175        self.client
1176            .execute_connection::<T>(&query, variables, "cycles")
1177            .await
1178    }
1179}
1180/// All issue workflow states (issue statuses). Returns a paginated list of workflow states visible to the authenticated user, across all teams they have access to.
1181///
1182/// Full type: [`WorkflowState`](super::types::WorkflowState)
1183pub fn workflow_states<'a, T>(client: &'a Client) -> WorkflowStatesQueryBuilder<'a, T> {
1184    WorkflowStatesQueryBuilder {
1185        client,
1186        filter: None,
1187        before: None,
1188        after: None,
1189        first: None,
1190        last: None,
1191        include_archived: None,
1192        order_by: None,
1193        _marker: std::marker::PhantomData,
1194    }
1195}
1196/// All users in the workspace. Supports filtering, sorting, and pagination.
1197///
1198/// Full type: [`User`](super::types::User)
1199pub fn users<'a, T>(client: &'a Client) -> UsersQueryBuilder<'a, T> {
1200    UsersQueryBuilder {
1201        client,
1202        filter: None,
1203        include_disabled: None,
1204        before: None,
1205        after: None,
1206        first: None,
1207        last: None,
1208        include_archived: None,
1209        order_by: None,
1210        sort: None,
1211        _marker: std::marker::PhantomData,
1212    }
1213}
1214/// The currently authenticated user making the API request.
1215///
1216/// Full type: [`User`](super::types::User)
1217pub async fn whoami<T: DeserializeOwned + GraphQLFields<FullType = super::types::User>>(
1218    client: &Client,
1219) -> Result<T, LinearError> {
1220    let variables = serde_json::json!({});
1221    let selection = T::selection();
1222    let query = format!("query {} {{ {} {{ {} }} }}", "Viewer", "viewer", selection);
1223    client.execute::<T>(&query, variables, "viewer").await
1224}
1225/// Returns all projects in the workspace, with optional filtering and sorting.
1226///
1227/// Full type: [`Project`](super::types::Project)
1228pub fn projects<'a, T>(client: &'a Client) -> ProjectsQueryBuilder<'a, T> {
1229    ProjectsQueryBuilder {
1230        client,
1231        filter: None,
1232        before: None,
1233        after: None,
1234        first: None,
1235        last: None,
1236        include_archived: None,
1237        order_by: None,
1238        sort: None,
1239        _marker: std::marker::PhantomData,
1240    }
1241}
1242/// Returns a single project by its identifier or URL slug.
1243///
1244/// Full type: [`Project`](super::types::Project)
1245pub async fn project<T: DeserializeOwned + GraphQLFields<FullType = super::types::Project>>(
1246    client: &Client,
1247    id: String,
1248) -> Result<T, LinearError> {
1249    let variables = serde_json::json!({ "id" : id });
1250    let selection = T::selection();
1251    let query = format!(
1252        "query {}({}) {{ {}({}) {{ {} }} }}",
1253        "Project", "$id: String!", "project", "id: $id", selection
1254    );
1255    client.execute::<T>(&query, variables, "project").await
1256}
1257/// All teams whose issues the user can access. This includes public teams and private teams the user is a member of. This may differ from `administrableTeams`, which returns teams whose settings the user can change but whose issues they don't necessarily have access to.
1258///
1259/// Full type: [`Team`](super::types::Team)
1260pub fn teams<'a, T>(client: &'a Client) -> TeamsQueryBuilder<'a, T> {
1261    TeamsQueryBuilder {
1262        client,
1263        filter: None,
1264        before: None,
1265        after: None,
1266        first: None,
1267        last: None,
1268        include_archived: None,
1269        order_by: None,
1270        _marker: std::marker::PhantomData,
1271    }
1272}
1273/// Fetches a specific team by its ID.
1274///
1275/// Full type: [`Team`](super::types::Team)
1276pub async fn team<T: DeserializeOwned + GraphQLFields<FullType = super::types::Team>>(
1277    client: &Client,
1278    id: String,
1279) -> Result<T, LinearError> {
1280    let variables = serde_json::json!({ "id" : id });
1281    let selection = T::selection();
1282    let query = format!(
1283        "query {}({}) {{ {}({}) {{ {} }} }}",
1284        "Team", "$id: String!", "team", "id: $id", selection
1285    );
1286    client.execute::<T>(&query, variables, "team").await
1287}
1288/// Search issues by text query using full-text and vector search. Results are ranked by relevance unless an orderBy parameter is specified. Supports optional issue filters and comment inclusion. Rate-limited to 30 requests per minute.
1289///
1290/// Full type: [`IssueSearchResult`](super::types::IssueSearchResult)
1291pub fn search_issues<'a, T>(
1292    client: &'a Client,
1293    term: impl Into<String>,
1294) -> SearchIssuesQueryBuilder<'a, T> {
1295    SearchIssuesQueryBuilder {
1296        client,
1297        term: term.into(),
1298        filter: None,
1299        before: None,
1300        after: None,
1301        first: None,
1302        last: None,
1303        include_archived: None,
1304        order_by: None,
1305        include_comments: None,
1306        team_id: None,
1307        _marker: std::marker::PhantomData,
1308    }
1309}
1310/// Returns all project statuses in the workspace.
1311///
1312/// Full type: [`ProjectStatus`](super::types::ProjectStatus)
1313pub fn project_statuses<'a, T>(client: &'a Client) -> ProjectStatusesQueryBuilder<'a, T> {
1314    ProjectStatusesQueryBuilder {
1315        client,
1316        before: None,
1317        after: None,
1318        first: None,
1319        last: None,
1320        include_archived: None,
1321        order_by: None,
1322        _marker: std::marker::PhantomData,
1323    }
1324}
1325/// Returns all project milestones in the workspace, with optional filtering.
1326///
1327/// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
1328pub fn project_milestones<'a, T>(client: &'a Client) -> ProjectMilestonesQueryBuilder<'a, T> {
1329    ProjectMilestonesQueryBuilder {
1330        client,
1331        filter: None,
1332        before: None,
1333        after: None,
1334        first: None,
1335        last: None,
1336        include_archived: None,
1337        order_by: None,
1338        _marker: std::marker::PhantomData,
1339    }
1340}
1341/// Returns a single project milestone by its identifier.
1342///
1343/// Full type: [`ProjectMilestone`](super::types::ProjectMilestone)
1344pub async fn project_milestone<
1345    T: DeserializeOwned + GraphQLFields<FullType = super::types::ProjectMilestone>,
1346>(
1347    client: &Client,
1348    id: String,
1349) -> Result<T, LinearError> {
1350    let variables = serde_json::json!({ "id" : id });
1351    let selection = T::selection();
1352    let query = format!(
1353        "query {}({}) {{ {}({}) {{ {} }} }}",
1354        "ProjectMilestone", "$id: String!", "projectMilestone", "id: $id", selection
1355    );
1356    client
1357        .execute::<T>(&query, variables, "projectMilestone")
1358        .await
1359}
1360/// Returns all project labels in the workspace, with optional filtering.
1361///
1362/// Full type: [`ProjectLabel`](super::types::ProjectLabel)
1363pub fn project_labels<'a, T>(client: &'a Client) -> ProjectLabelsQueryBuilder<'a, T> {
1364    ProjectLabelsQueryBuilder {
1365        client,
1366        filter: None,
1367        before: None,
1368        after: None,
1369        first: None,
1370        last: None,
1371        include_archived: None,
1372        order_by: None,
1373        _marker: std::marker::PhantomData,
1374    }
1375}
1376/// All issues. Returns a paginated list of issues visible to the authenticated user. Can be filtered by various criteria including team, assignee, state, labels, project, and cycle.
1377///
1378/// Full type: [`Issue`](super::types::Issue)
1379pub fn issues<'a, T>(client: &'a Client) -> IssuesQueryBuilder<'a, T> {
1380    IssuesQueryBuilder {
1381        client,
1382        filter: None,
1383        before: None,
1384        after: None,
1385        first: None,
1386        last: None,
1387        include_archived: None,
1388        order_by: None,
1389        sort: None,
1390        _marker: std::marker::PhantomData,
1391    }
1392}
1393/// One specific issue, looked up by its unique identifier.
1394///
1395/// Full type: [`Issue`](super::types::Issue)
1396pub async fn issue<T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>>(
1397    client: &Client,
1398    id: String,
1399) -> Result<T, LinearError> {
1400    let variables = serde_json::json!({ "id" : id });
1401    let selection = T::selection();
1402    let query = format!(
1403        "query {}({}) {{ {}({}) {{ {} }} }}",
1404        "Issue", "$id: String!", "issue", "id: $id", selection
1405    );
1406    client.execute::<T>(&query, variables, "issue").await
1407}
1408/// Find issue based on the VCS branch name.
1409///
1410/// Full type: [`Issue`](super::types::Issue)
1411pub async fn issue_vcs_branch_search<
1412    T: DeserializeOwned + GraphQLFields<FullType = super::types::Issue>,
1413>(
1414    client: &Client,
1415    branch_name: String,
1416) -> Result<Option<T>, LinearError> {
1417    let variables = serde_json::json!({ "branchName" : branch_name });
1418    let selection = T::selection();
1419    let query = format!(
1420        "query {}({}) {{ {}({}) {{ {} }} }}",
1421        "IssueVcsBranchSearch",
1422        "$branchName: String!",
1423        "issueVcsBranchSearch",
1424        "branchName: $branchName",
1425        selection
1426    );
1427    client
1428        .execute::<Option<T>>(&query, variables, "issueVcsBranchSearch")
1429        .await
1430}
1431/// All issue relations. Returns a paginated list of all issue relations (blocks, blocked by, relates to, duplicates) visible to the authenticated user.
1432///
1433/// Full type: [`IssueRelation`](super::types::IssueRelation)
1434pub fn issue_relations<'a, T>(client: &'a Client) -> IssueRelationsQueryBuilder<'a, T> {
1435    IssueRelationsQueryBuilder {
1436        client,
1437        before: None,
1438        after: None,
1439        first: None,
1440        last: None,
1441        include_archived: None,
1442        order_by: None,
1443        _marker: std::marker::PhantomData,
1444    }
1445}
1446/// One specific issue relation, looked up by its unique identifier.
1447///
1448/// Full type: [`IssueRelation`](super::types::IssueRelation)
1449pub async fn issue_relation<
1450    T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueRelation>,
1451>(
1452    client: &Client,
1453    id: String,
1454) -> Result<T, LinearError> {
1455    let variables = serde_json::json!({ "id" : id });
1456    let selection = T::selection();
1457    let query = format!(
1458        "query {}({}) {{ {}({}) {{ {} }} }}",
1459        "IssueRelation", "$id: String!", "issueRelation", "id: $id", selection
1460    );
1461    client
1462        .execute::<T>(&query, variables, "issueRelation")
1463        .await
1464}
1465/// All issue labels. Returns a paginated list of labels visible to the authenticated user, including both workspace-level and team-scoped labels.
1466///
1467/// Full type: [`IssueLabel`](super::types::IssueLabel)
1468pub fn issue_labels<'a, T>(client: &'a Client) -> IssueLabelsQueryBuilder<'a, T> {
1469    IssueLabelsQueryBuilder {
1470        client,
1471        filter: None,
1472        before: None,
1473        after: None,
1474        first: None,
1475        last: None,
1476        include_archived: None,
1477        order_by: None,
1478        _marker: std::marker::PhantomData,
1479    }
1480}
1481/// All documents the user has access to in the workspace.
1482///
1483/// Full type: [`Document`](super::types::Document)
1484pub fn documents<'a, T>(client: &'a Client) -> DocumentsQueryBuilder<'a, T> {
1485    DocumentsQueryBuilder {
1486        client,
1487        filter: None,
1488        before: None,
1489        after: None,
1490        first: None,
1491        last: None,
1492        include_archived: None,
1493        order_by: None,
1494        _marker: std::marker::PhantomData,
1495    }
1496}
1497/// A specific document by ID or slug.
1498///
1499/// Full type: [`Document`](super::types::Document)
1500pub async fn document<T: DeserializeOwned + GraphQLFields<FullType = super::types::Document>>(
1501    client: &Client,
1502    id: String,
1503) -> Result<T, LinearError> {
1504    let variables = serde_json::json!({ "id" : id });
1505    let selection = T::selection();
1506    let query = format!(
1507        "query {}({}) {{ {}({}) {{ {} }} }}",
1508        "Document", "$id: String!", "document", "id: $id", selection
1509    );
1510    client.execute::<T>(&query, variables, "document").await
1511}
1512/// All cycles accessible to the user.
1513///
1514/// Full type: [`Cycle`](super::types::Cycle)
1515pub fn cycles<'a, T>(client: &'a Client) -> CyclesQueryBuilder<'a, T> {
1516    CyclesQueryBuilder {
1517        client,
1518        filter: None,
1519        before: None,
1520        after: None,
1521        first: None,
1522        last: None,
1523        include_archived: None,
1524        order_by: None,
1525        _marker: std::marker::PhantomData,
1526    }
1527}
1528/// One specific cycle, looked up by ID or slug.
1529///
1530/// Full type: [`Cycle`](super::types::Cycle)
1531pub async fn cycle<T: DeserializeOwned + GraphQLFields<FullType = super::types::Cycle>>(
1532    client: &Client,
1533    id: String,
1534) -> Result<T, LinearError> {
1535    let variables = serde_json::json!({ "id" : id });
1536    let selection = T::selection();
1537    let query = format!(
1538        "query {}({}) {{ {}({}) {{ {} }} }}",
1539        "Cycle", "$id: String!", "cycle", "id: $id", selection
1540    );
1541    client.execute::<T>(&query, variables, "cycle").await
1542}