1use super::enums::*;
10use super::inputs::*;
11use super::types::*;
12use crate::client::Client;
13use crate::error::LinearError;
14use crate::pagination::Connection;
15#[must_use]
20pub struct WorkflowStatesQueryBuilder<'a> {
21 client: &'a Client,
22 filter: Option<WorkflowStateFilter>,
23 before: Option<String>,
24 after: Option<String>,
25 first: Option<i64>,
26 last: Option<i64>,
27 include_archived: Option<bool>,
28 order_by: Option<PaginationOrderBy>,
29}
30impl<'a> WorkflowStatesQueryBuilder<'a> {
31 pub fn filter(mut self, value: WorkflowStateFilter) -> Self {
32 self.filter = Some(value);
33 self
34 }
35 pub fn before(mut self, value: impl Into<String>) -> Self {
36 self.before = Some(value.into());
37 self
38 }
39 pub fn after(mut self, value: impl Into<String>) -> Self {
40 self.after = Some(value.into());
41 self
42 }
43 pub fn first(mut self, value: i64) -> Self {
44 self.first = Some(value);
45 self
46 }
47 pub fn last(mut self, value: i64) -> Self {
48 self.last = Some(value);
49 self
50 }
51 pub fn include_archived(mut self, value: bool) -> Self {
52 self.include_archived = Some(value);
53 self
54 }
55 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
56 self.order_by = Some(value);
57 self
58 }
59 pub async fn send(self) -> Result<Connection<WorkflowState>, LinearError> {
60 let mut map = serde_json::Map::new();
61 if let Some(ref v) = self.filter {
62 map.insert("filter".to_string(), serde_json::json!(v));
63 }
64 if let Some(ref v) = self.before {
65 map.insert("before".to_string(), serde_json::json!(v));
66 }
67 if let Some(ref v) = self.after {
68 map.insert("after".to_string(), serde_json::json!(v));
69 }
70 if let Some(ref v) = self.first {
71 map.insert("first".to_string(), serde_json::json!(v));
72 }
73 if let Some(ref v) = self.last {
74 map.insert("last".to_string(), serde_json::json!(v));
75 }
76 if let Some(ref v) = self.include_archived {
77 map.insert("includeArchived".to_string(), serde_json::json!(v));
78 }
79 if let Some(ref v) = self.order_by {
80 map.insert("orderBy".to_string(), serde_json::json!(v));
81 }
82 let variables = serde_json::Value::Object(map);
83 self.client
84 .execute_connection::<
85 WorkflowState,
86 >(
87 "query WorkflowStates($filter: WorkflowStateFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy) { workflowStates(filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy) { nodes { id createdAt updatedAt archivedAt name color description position type team { id name key color displayName } inheritedFrom { id name color type } } pageInfo { hasNextPage endCursor } } }",
88 variables,
89 "workflowStates",
90 )
91 .await
92 }
93}
94#[must_use]
99pub struct UsersQueryBuilder<'a> {
100 client: &'a Client,
101 filter: Option<UserFilter>,
102 include_disabled: Option<bool>,
103 before: Option<String>,
104 after: Option<String>,
105 first: Option<i64>,
106 last: Option<i64>,
107 include_archived: Option<bool>,
108 order_by: Option<PaginationOrderBy>,
109 sort: Option<UserSortInput>,
110}
111impl<'a> UsersQueryBuilder<'a> {
112 pub fn filter(mut self, value: UserFilter) -> Self {
113 self.filter = Some(value);
114 self
115 }
116 pub fn include_disabled(mut self, value: bool) -> Self {
117 self.include_disabled = Some(value);
118 self
119 }
120 pub fn before(mut self, value: impl Into<String>) -> Self {
121 self.before = Some(value.into());
122 self
123 }
124 pub fn after(mut self, value: impl Into<String>) -> Self {
125 self.after = Some(value.into());
126 self
127 }
128 pub fn first(mut self, value: i64) -> Self {
129 self.first = Some(value);
130 self
131 }
132 pub fn last(mut self, value: i64) -> Self {
133 self.last = Some(value);
134 self
135 }
136 pub fn include_archived(mut self, value: bool) -> Self {
137 self.include_archived = Some(value);
138 self
139 }
140 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
141 self.order_by = Some(value);
142 self
143 }
144 pub fn sort(mut self, value: UserSortInput) -> Self {
145 self.sort = Some(value);
146 self
147 }
148 pub async fn send(self) -> Result<Connection<User>, LinearError> {
149 let mut map = serde_json::Map::new();
150 if let Some(ref v) = self.filter {
151 map.insert("filter".to_string(), serde_json::json!(v));
152 }
153 if let Some(ref v) = self.include_disabled {
154 map.insert("includeDisabled".to_string(), serde_json::json!(v));
155 }
156 if let Some(ref v) = self.before {
157 map.insert("before".to_string(), serde_json::json!(v));
158 }
159 if let Some(ref v) = self.after {
160 map.insert("after".to_string(), serde_json::json!(v));
161 }
162 if let Some(ref v) = self.first {
163 map.insert("first".to_string(), serde_json::json!(v));
164 }
165 if let Some(ref v) = self.last {
166 map.insert("last".to_string(), serde_json::json!(v));
167 }
168 if let Some(ref v) = self.include_archived {
169 map.insert("includeArchived".to_string(), serde_json::json!(v));
170 }
171 if let Some(ref v) = self.order_by {
172 map.insert("orderBy".to_string(), serde_json::json!(v));
173 }
174 if let Some(ref v) = self.sort {
175 map.insert("sort".to_string(), serde_json::json!(v));
176 }
177 let variables = serde_json::Value::Object(map);
178 self.client
179 .execute_connection::<
180 User,
181 >(
182 "query Users($filter: UserFilter, $includeDisabled: Boolean, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [UserSortInput!]) { users(filter: $filter, includeDisabled: $includeDisabled, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort) { nodes { id createdAt updatedAt archivedAt name displayName email avatarUrl disableReason calendarHash description statusEmoji statusLabel statusUntilAt timezone organization { id name } lastSeen identityProvider { id type } initials avatarBackgroundColor guest app isMentionable isAssignable active url createdIssueCount canAccessAnyPublicTeam isMe admin owner supportsAgentSessions inviteHash gitHubUserId } pageInfo { hasNextPage endCursor } } }",
183 variables,
184 "users",
185 )
186 .await
187 }
188}
189#[must_use]
194pub struct ProjectsQueryBuilder<'a> {
195 client: &'a Client,
196 filter: Option<ProjectFilter>,
197 before: Option<String>,
198 after: Option<String>,
199 first: Option<i64>,
200 last: Option<i64>,
201 include_archived: Option<bool>,
202 order_by: Option<PaginationOrderBy>,
203 sort: Option<ProjectSortInput>,
204}
205impl<'a> ProjectsQueryBuilder<'a> {
206 pub fn filter(mut self, value: ProjectFilter) -> Self {
207 self.filter = Some(value);
208 self
209 }
210 pub fn before(mut self, value: impl Into<String>) -> Self {
211 self.before = Some(value.into());
212 self
213 }
214 pub fn after(mut self, value: impl Into<String>) -> Self {
215 self.after = Some(value.into());
216 self
217 }
218 pub fn first(mut self, value: i64) -> Self {
219 self.first = Some(value);
220 self
221 }
222 pub fn last(mut self, value: i64) -> Self {
223 self.last = Some(value);
224 self
225 }
226 pub fn include_archived(mut self, value: bool) -> Self {
227 self.include_archived = Some(value);
228 self
229 }
230 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
231 self.order_by = Some(value);
232 self
233 }
234 pub fn sort(mut self, value: ProjectSortInput) -> Self {
235 self.sort = Some(value);
236 self
237 }
238 pub async fn send(self) -> Result<Connection<Project>, LinearError> {
239 let mut map = serde_json::Map::new();
240 if let Some(ref v) = self.filter {
241 map.insert("filter".to_string(), serde_json::json!(v));
242 }
243 if let Some(ref v) = self.before {
244 map.insert("before".to_string(), serde_json::json!(v));
245 }
246 if let Some(ref v) = self.after {
247 map.insert("after".to_string(), serde_json::json!(v));
248 }
249 if let Some(ref v) = self.first {
250 map.insert("first".to_string(), serde_json::json!(v));
251 }
252 if let Some(ref v) = self.last {
253 map.insert("last".to_string(), serde_json::json!(v));
254 }
255 if let Some(ref v) = self.include_archived {
256 map.insert("includeArchived".to_string(), serde_json::json!(v));
257 }
258 if let Some(ref v) = self.order_by {
259 map.insert("orderBy".to_string(), serde_json::json!(v));
260 }
261 if let Some(ref v) = self.sort {
262 map.insert("sort".to_string(), serde_json::json!(v));
263 }
264 let variables = serde_json::Value::Object(map);
265 self.client
266 .execute_connection::<
267 Project,
268 >(
269 "query Projects($filter: ProjectFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [ProjectSortInput!]) { projects(filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort) { nodes { id createdAt updatedAt archivedAt updateReminderFrequencyInWeeks updateReminderFrequency frequencyResolution updateRemindersDay updateRemindersHour name description slugId icon color status { id name color type } creator { id name displayName email url } lead { id name displayName email url } facets { id } projectUpdateRemindersPausedUntilAt startDate startDateResolution targetDate targetDateResolution startedAt completedAt canceledAt autoArchivedAt trashed sortOrder prioritySortOrder convertedFromIssue { id number title identifier url } lastAppliedTemplate { id type name } priority lastUpdate { id url } health healthUpdatedAt issueCountHistory completedIssueCountHistory scopeHistory completedScopeHistory inProgressScopeHistory progressHistory currentProgress slackNewIssue slackIssueComments slackIssueStatuses labelIds favorite { id type url title color } url progress scope integrationsSettings { id } content contentState documentContent { id } state priorityLabel } pageInfo { hasNextPage endCursor } } }",
270 variables,
271 "projects",
272 )
273 .await
274 }
275}
276#[must_use]
281pub struct TeamsQueryBuilder<'a> {
282 client: &'a Client,
283 filter: Option<TeamFilter>,
284 before: Option<String>,
285 after: Option<String>,
286 first: Option<i64>,
287 last: Option<i64>,
288 include_archived: Option<bool>,
289 order_by: Option<PaginationOrderBy>,
290}
291impl<'a> TeamsQueryBuilder<'a> {
292 pub fn filter(mut self, value: TeamFilter) -> Self {
293 self.filter = Some(value);
294 self
295 }
296 pub fn before(mut self, value: impl Into<String>) -> Self {
297 self.before = Some(value.into());
298 self
299 }
300 pub fn after(mut self, value: impl Into<String>) -> Self {
301 self.after = Some(value.into());
302 self
303 }
304 pub fn first(mut self, value: i64) -> Self {
305 self.first = Some(value);
306 self
307 }
308 pub fn last(mut self, value: i64) -> Self {
309 self.last = Some(value);
310 self
311 }
312 pub fn include_archived(mut self, value: bool) -> Self {
313 self.include_archived = Some(value);
314 self
315 }
316 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
317 self.order_by = Some(value);
318 self
319 }
320 pub async fn send(self) -> Result<Connection<Team>, LinearError> {
321 let mut map = serde_json::Map::new();
322 if let Some(ref v) = self.filter {
323 map.insert("filter".to_string(), serde_json::json!(v));
324 }
325 if let Some(ref v) = self.before {
326 map.insert("before".to_string(), serde_json::json!(v));
327 }
328 if let Some(ref v) = self.after {
329 map.insert("after".to_string(), serde_json::json!(v));
330 }
331 if let Some(ref v) = self.first {
332 map.insert("first".to_string(), serde_json::json!(v));
333 }
334 if let Some(ref v) = self.last {
335 map.insert("last".to_string(), serde_json::json!(v));
336 }
337 if let Some(ref v) = self.include_archived {
338 map.insert("includeArchived".to_string(), serde_json::json!(v));
339 }
340 if let Some(ref v) = self.order_by {
341 map.insert("orderBy".to_string(), serde_json::json!(v));
342 }
343 let variables = serde_json::Value::Object(map);
344 self.client
345 .execute_connection::<
346 Team,
347 >(
348 "query Teams($filter: TeamFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy) { teams(filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy) { nodes { id createdAt updatedAt archivedAt name key description icon color retiredAt organization { id name } parent { id name key color displayName } children { id name key color displayName } cyclesEnabled cycleStartDay cycleDuration cycleCooldownTime cycleIssueAutoAssignStarted cycleIssueAutoAssignCompleted cycleLockToActive upcomingCycleCount timezone inheritWorkflowStatuses inheritIssueEstimation issueEstimationType issueOrderingNoPriorityFirst issueEstimationAllowZero setIssueSortOrderOnStateChange issueEstimationExtended defaultIssueEstimate triageEnabled requirePriorityToLeaveTriage defaultIssueState { id name color type } defaultTemplateForMembers { id type name } defaultTemplateForMembersId defaultTemplateForNonMembers { id type name } defaultTemplateForNonMembersId defaultProjectTemplate { id type name } triageIssueState { id name color type } private allMembersCanJoin securitySettings facets { id } posts { id title type } scimManaged scimGroupName progressHistory currentProgress draftWorkflowState { id name color type } startWorkflowState { id name color type } reviewWorkflowState { id name color type } mergeableWorkflowState { id name color type } mergeWorkflowState { id name color type } groupIssueHistory aiThreadSummariesEnabled aiDiscussionSummariesEnabled slackNewIssue slackIssueComments slackIssueStatuses autoClosePeriod autoCloseStateId autoArchivePeriod autoCloseParentIssues autoCloseChildIssues markedAsDuplicateWorkflowState { id name color type } joinByDefault cycleCalenderUrl displayName issueCount activeCycle { id number name } triageResponsibility { id } integrationsSettings { id } issueSortOrderDefaultToBottom inviteHash } pageInfo { hasNextPage endCursor } } }",
349 variables,
350 "teams",
351 )
352 .await
353 }
354}
355#[must_use]
360pub struct SearchIssuesQueryBuilder<'a> {
361 client: &'a Client,
362 term: String,
363 filter: Option<IssueFilter>,
364 before: Option<String>,
365 after: Option<String>,
366 first: Option<i64>,
367 last: Option<i64>,
368 include_archived: Option<bool>,
369 order_by: Option<PaginationOrderBy>,
370 include_comments: Option<bool>,
371 team_id: Option<String>,
372}
373impl<'a> SearchIssuesQueryBuilder<'a> {
374 pub fn filter(mut self, value: IssueFilter) -> Self {
375 self.filter = Some(value);
376 self
377 }
378 pub fn before(mut self, value: impl Into<String>) -> Self {
379 self.before = Some(value.into());
380 self
381 }
382 pub fn after(mut self, value: impl Into<String>) -> Self {
383 self.after = Some(value.into());
384 self
385 }
386 pub fn first(mut self, value: i64) -> Self {
387 self.first = Some(value);
388 self
389 }
390 pub fn last(mut self, value: i64) -> Self {
391 self.last = Some(value);
392 self
393 }
394 pub fn include_archived(mut self, value: bool) -> Self {
395 self.include_archived = Some(value);
396 self
397 }
398 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
399 self.order_by = Some(value);
400 self
401 }
402 pub fn include_comments(mut self, value: bool) -> Self {
403 self.include_comments = Some(value);
404 self
405 }
406 pub fn team_id(mut self, value: impl Into<String>) -> Self {
407 self.team_id = Some(value.into());
408 self
409 }
410 pub async fn send(self) -> Result<Connection<Issue>, LinearError> {
411 let mut map = serde_json::Map::new();
412 map.insert("term".to_string(), serde_json::json!(self.term));
413 if let Some(ref v) = self.filter {
414 map.insert("filter".to_string(), serde_json::json!(v));
415 }
416 if let Some(ref v) = self.before {
417 map.insert("before".to_string(), serde_json::json!(v));
418 }
419 if let Some(ref v) = self.after {
420 map.insert("after".to_string(), serde_json::json!(v));
421 }
422 if let Some(ref v) = self.first {
423 map.insert("first".to_string(), serde_json::json!(v));
424 }
425 if let Some(ref v) = self.last {
426 map.insert("last".to_string(), serde_json::json!(v));
427 }
428 if let Some(ref v) = self.include_archived {
429 map.insert("includeArchived".to_string(), serde_json::json!(v));
430 }
431 if let Some(ref v) = self.order_by {
432 map.insert("orderBy".to_string(), serde_json::json!(v));
433 }
434 if let Some(ref v) = self.include_comments {
435 map.insert("includeComments".to_string(), serde_json::json!(v));
436 }
437 if let Some(ref v) = self.team_id {
438 map.insert("teamId".to_string(), serde_json::json!(v));
439 }
440 let variables = serde_json::Value::Object(map);
441 self.client
442 .execute_connection::<
443 Issue,
444 >(
445 "query SearchIssues($filter: IssueFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $term: String!, $includeComments: Boolean, $teamId: String) { searchIssues(filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, term: $term, includeComments: $includeComments, teamId: $teamId) { nodes { id createdAt updatedAt archivedAt number title priority estimate boardOrder sortOrder prioritySortOrder startedAt completedAt startedTriageAt triagedAt canceledAt autoClosedAt autoArchivedAt dueDate slaStartedAt slaMediumRiskAt slaHighRiskAt slaBreachesAt slaType addedToProjectAt addedToCycleAt addedToTeamAt trashed snoozedUntilAt suggestionsGeneratedAt activitySummary summary { id } labelIds team { id name key color displayName } cycle { id number name } project { id name color url } projectMilestone { id name } lastAppliedTemplate { id type name } recurringIssueTemplate { id type name } previousIdentifiers creator { id name displayName email url } externalUserCreator { id name displayName email } assignee { id name displayName email url } delegate { id name displayName email url } snoozedBy { id name displayName email url } state { id name color type } subIssueSortOrder reactionData priorityLabel sourceComment { id url } integrationSourceType botActor { id type name } favorite { id type url title color } identifier url branchName customerTicketCount parent { id number title identifier url } description documentContent { id } reactions { id } syncedWith { id } asksRequester { id name displayName email url } asksExternalUserRequester { id name displayName email } } pageInfo { hasNextPage endCursor } } }",
446 variables,
447 "searchIssues",
448 )
449 .await
450 }
451}
452#[must_use]
457pub struct IssuesQueryBuilder<'a> {
458 client: &'a Client,
459 filter: Option<IssueFilter>,
460 before: Option<String>,
461 after: Option<String>,
462 first: Option<i64>,
463 last: Option<i64>,
464 include_archived: Option<bool>,
465 order_by: Option<PaginationOrderBy>,
466 sort: Option<IssueSortInput>,
467}
468impl<'a> IssuesQueryBuilder<'a> {
469 pub fn filter(mut self, value: IssueFilter) -> Self {
470 self.filter = Some(value);
471 self
472 }
473 pub fn before(mut self, value: impl Into<String>) -> Self {
474 self.before = Some(value.into());
475 self
476 }
477 pub fn after(mut self, value: impl Into<String>) -> Self {
478 self.after = Some(value.into());
479 self
480 }
481 pub fn first(mut self, value: i64) -> Self {
482 self.first = Some(value);
483 self
484 }
485 pub fn last(mut self, value: i64) -> Self {
486 self.last = Some(value);
487 self
488 }
489 pub fn include_archived(mut self, value: bool) -> Self {
490 self.include_archived = Some(value);
491 self
492 }
493 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
494 self.order_by = Some(value);
495 self
496 }
497 pub fn sort(mut self, value: IssueSortInput) -> Self {
498 self.sort = Some(value);
499 self
500 }
501 pub async fn send(self) -> Result<Connection<Issue>, LinearError> {
502 let mut map = serde_json::Map::new();
503 if let Some(ref v) = self.filter {
504 map.insert("filter".to_string(), serde_json::json!(v));
505 }
506 if let Some(ref v) = self.before {
507 map.insert("before".to_string(), serde_json::json!(v));
508 }
509 if let Some(ref v) = self.after {
510 map.insert("after".to_string(), serde_json::json!(v));
511 }
512 if let Some(ref v) = self.first {
513 map.insert("first".to_string(), serde_json::json!(v));
514 }
515 if let Some(ref v) = self.last {
516 map.insert("last".to_string(), serde_json::json!(v));
517 }
518 if let Some(ref v) = self.include_archived {
519 map.insert("includeArchived".to_string(), serde_json::json!(v));
520 }
521 if let Some(ref v) = self.order_by {
522 map.insert("orderBy".to_string(), serde_json::json!(v));
523 }
524 if let Some(ref v) = self.sort {
525 map.insert("sort".to_string(), serde_json::json!(v));
526 }
527 let variables = serde_json::Value::Object(map);
528 self.client
529 .execute_connection::<
530 Issue,
531 >(
532 "query Issues($filter: IssueFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [IssueSortInput!]) { issues(filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort) { nodes { id createdAt updatedAt archivedAt number title priority estimate boardOrder sortOrder prioritySortOrder startedAt completedAt startedTriageAt triagedAt canceledAt autoClosedAt autoArchivedAt dueDate slaStartedAt slaMediumRiskAt slaHighRiskAt slaBreachesAt slaType addedToProjectAt addedToCycleAt addedToTeamAt trashed snoozedUntilAt suggestionsGeneratedAt activitySummary summary { id } labelIds team { id name key color displayName } cycle { id number name } project { id name color url } projectMilestone { id name } lastAppliedTemplate { id type name } recurringIssueTemplate { id type name } previousIdentifiers creator { id name displayName email url } externalUserCreator { id name displayName email } assignee { id name displayName email url } delegate { id name displayName email url } snoozedBy { id name displayName email url } state { id name color type } subIssueSortOrder reactionData priorityLabel sourceComment { id url } integrationSourceType botActor { id type name } favorite { id type url title color } identifier url branchName customerTicketCount parent { id number title identifier url } description documentContent { id } reactions { id } syncedWith { id } asksRequester { id name displayName email url } asksExternalUserRequester { id name displayName email } } pageInfo { hasNextPage endCursor } } }",
533 variables,
534 "issues",
535 )
536 .await
537 }
538}
539#[must_use]
544pub struct IssueRelationsQueryBuilder<'a> {
545 client: &'a Client,
546 before: Option<String>,
547 after: Option<String>,
548 first: Option<i64>,
549 last: Option<i64>,
550 include_archived: Option<bool>,
551 order_by: Option<PaginationOrderBy>,
552}
553impl<'a> IssueRelationsQueryBuilder<'a> {
554 pub fn before(mut self, value: impl Into<String>) -> Self {
555 self.before = Some(value.into());
556 self
557 }
558 pub fn after(mut self, value: impl Into<String>) -> Self {
559 self.after = Some(value.into());
560 self
561 }
562 pub fn first(mut self, value: i64) -> Self {
563 self.first = Some(value);
564 self
565 }
566 pub fn last(mut self, value: i64) -> Self {
567 self.last = Some(value);
568 self
569 }
570 pub fn include_archived(mut self, value: bool) -> Self {
571 self.include_archived = Some(value);
572 self
573 }
574 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
575 self.order_by = Some(value);
576 self
577 }
578 pub async fn send(self) -> Result<Connection<IssueRelation>, LinearError> {
579 let mut map = serde_json::Map::new();
580 if let Some(ref v) = self.before {
581 map.insert("before".to_string(), serde_json::json!(v));
582 }
583 if let Some(ref v) = self.after {
584 map.insert("after".to_string(), serde_json::json!(v));
585 }
586 if let Some(ref v) = self.first {
587 map.insert("first".to_string(), serde_json::json!(v));
588 }
589 if let Some(ref v) = self.last {
590 map.insert("last".to_string(), serde_json::json!(v));
591 }
592 if let Some(ref v) = self.include_archived {
593 map.insert("includeArchived".to_string(), serde_json::json!(v));
594 }
595 if let Some(ref v) = self.order_by {
596 map.insert("orderBy".to_string(), serde_json::json!(v));
597 }
598 let variables = serde_json::Value::Object(map);
599 self.client
600 .execute_connection::<
601 IssueRelation,
602 >(
603 "query IssueRelations($before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy) { issueRelations(before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy) { nodes { id createdAt updatedAt archivedAt type issue { id number title identifier url } relatedIssue { id number title identifier url } } pageInfo { hasNextPage endCursor } } }",
604 variables,
605 "issueRelations",
606 )
607 .await
608 }
609}
610#[must_use]
615pub struct IssueLabelsQueryBuilder<'a> {
616 client: &'a Client,
617 filter: Option<IssueLabelFilter>,
618 before: Option<String>,
619 after: Option<String>,
620 first: Option<i64>,
621 last: Option<i64>,
622 include_archived: Option<bool>,
623 order_by: Option<PaginationOrderBy>,
624}
625impl<'a> IssueLabelsQueryBuilder<'a> {
626 pub fn filter(mut self, value: IssueLabelFilter) -> Self {
627 self.filter = Some(value);
628 self
629 }
630 pub fn before(mut self, value: impl Into<String>) -> Self {
631 self.before = Some(value.into());
632 self
633 }
634 pub fn after(mut self, value: impl Into<String>) -> Self {
635 self.after = Some(value.into());
636 self
637 }
638 pub fn first(mut self, value: i64) -> Self {
639 self.first = Some(value);
640 self
641 }
642 pub fn last(mut self, value: i64) -> Self {
643 self.last = Some(value);
644 self
645 }
646 pub fn include_archived(mut self, value: bool) -> Self {
647 self.include_archived = Some(value);
648 self
649 }
650 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
651 self.order_by = Some(value);
652 self
653 }
654 pub async fn send(self) -> Result<Connection<IssueLabel>, LinearError> {
655 let mut map = serde_json::Map::new();
656 if let Some(ref v) = self.filter {
657 map.insert("filter".to_string(), serde_json::json!(v));
658 }
659 if let Some(ref v) = self.before {
660 map.insert("before".to_string(), serde_json::json!(v));
661 }
662 if let Some(ref v) = self.after {
663 map.insert("after".to_string(), serde_json::json!(v));
664 }
665 if let Some(ref v) = self.first {
666 map.insert("first".to_string(), serde_json::json!(v));
667 }
668 if let Some(ref v) = self.last {
669 map.insert("last".to_string(), serde_json::json!(v));
670 }
671 if let Some(ref v) = self.include_archived {
672 map.insert("includeArchived".to_string(), serde_json::json!(v));
673 }
674 if let Some(ref v) = self.order_by {
675 map.insert("orderBy".to_string(), serde_json::json!(v));
676 }
677 let variables = serde_json::Value::Object(map);
678 self.client
679 .execute_connection::<
680 IssueLabel,
681 >(
682 "query IssueLabels($filter: IssueLabelFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy) { issueLabels(filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy) { nodes { id createdAt updatedAt archivedAt name description color isGroup lastAppliedAt retiredAt organization { id name } team { id name key color displayName } creator { id name displayName email url } retiredBy { id name displayName email url } parent { id name color } inheritedFrom { id name color } } pageInfo { hasNextPage endCursor } } }",
683 variables,
684 "issueLabels",
685 )
686 .await
687 }
688}
689#[must_use]
694pub struct DocumentsQueryBuilder<'a> {
695 client: &'a Client,
696 filter: Option<DocumentFilter>,
697 before: Option<String>,
698 after: Option<String>,
699 first: Option<i64>,
700 last: Option<i64>,
701 include_archived: Option<bool>,
702 order_by: Option<PaginationOrderBy>,
703}
704impl<'a> DocumentsQueryBuilder<'a> {
705 pub fn filter(mut self, value: DocumentFilter) -> Self {
706 self.filter = Some(value);
707 self
708 }
709 pub fn before(mut self, value: impl Into<String>) -> Self {
710 self.before = Some(value.into());
711 self
712 }
713 pub fn after(mut self, value: impl Into<String>) -> Self {
714 self.after = Some(value.into());
715 self
716 }
717 pub fn first(mut self, value: i64) -> Self {
718 self.first = Some(value);
719 self
720 }
721 pub fn last(mut self, value: i64) -> Self {
722 self.last = Some(value);
723 self
724 }
725 pub fn include_archived(mut self, value: bool) -> Self {
726 self.include_archived = Some(value);
727 self
728 }
729 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
730 self.order_by = Some(value);
731 self
732 }
733 pub async fn send(self) -> Result<Connection<Document>, LinearError> {
734 let mut map = serde_json::Map::new();
735 if let Some(ref v) = self.filter {
736 map.insert("filter".to_string(), serde_json::json!(v));
737 }
738 if let Some(ref v) = self.before {
739 map.insert("before".to_string(), serde_json::json!(v));
740 }
741 if let Some(ref v) = self.after {
742 map.insert("after".to_string(), serde_json::json!(v));
743 }
744 if let Some(ref v) = self.first {
745 map.insert("first".to_string(), serde_json::json!(v));
746 }
747 if let Some(ref v) = self.last {
748 map.insert("last".to_string(), serde_json::json!(v));
749 }
750 if let Some(ref v) = self.include_archived {
751 map.insert("includeArchived".to_string(), serde_json::json!(v));
752 }
753 if let Some(ref v) = self.order_by {
754 map.insert("orderBy".to_string(), serde_json::json!(v));
755 }
756 let variables = serde_json::Value::Object(map);
757 self.client
758 .execute_connection::<
759 Document,
760 >(
761 "query Documents($filter: DocumentFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy) { documents(filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy) { nodes { id createdAt updatedAt archivedAt title icon color creator { id name displayName email url } updatedBy { id name displayName email url } project { id name color url } initiative { id name color url } team { id name key color displayName } issue { id number title identifier url } release { id name url } cycle { id number name } slugId lastAppliedTemplate { id type name } hiddenAt trashed sortOrder content contentState documentContentId url } pageInfo { hasNextPage endCursor } } }",
762 variables,
763 "documents",
764 )
765 .await
766 }
767}
768#[must_use]
773pub struct CyclesQueryBuilder<'a> {
774 client: &'a Client,
775 filter: Option<CycleFilter>,
776 before: Option<String>,
777 after: Option<String>,
778 first: Option<i64>,
779 last: Option<i64>,
780 include_archived: Option<bool>,
781 order_by: Option<PaginationOrderBy>,
782}
783impl<'a> CyclesQueryBuilder<'a> {
784 pub fn filter(mut self, value: CycleFilter) -> Self {
785 self.filter = Some(value);
786 self
787 }
788 pub fn before(mut self, value: impl Into<String>) -> Self {
789 self.before = Some(value.into());
790 self
791 }
792 pub fn after(mut self, value: impl Into<String>) -> Self {
793 self.after = Some(value.into());
794 self
795 }
796 pub fn first(mut self, value: i64) -> Self {
797 self.first = Some(value);
798 self
799 }
800 pub fn last(mut self, value: i64) -> Self {
801 self.last = Some(value);
802 self
803 }
804 pub fn include_archived(mut self, value: bool) -> Self {
805 self.include_archived = Some(value);
806 self
807 }
808 pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
809 self.order_by = Some(value);
810 self
811 }
812 pub async fn send(self) -> Result<Connection<Cycle>, LinearError> {
813 let mut map = serde_json::Map::new();
814 if let Some(ref v) = self.filter {
815 map.insert("filter".to_string(), serde_json::json!(v));
816 }
817 if let Some(ref v) = self.before {
818 map.insert("before".to_string(), serde_json::json!(v));
819 }
820 if let Some(ref v) = self.after {
821 map.insert("after".to_string(), serde_json::json!(v));
822 }
823 if let Some(ref v) = self.first {
824 map.insert("first".to_string(), serde_json::json!(v));
825 }
826 if let Some(ref v) = self.last {
827 map.insert("last".to_string(), serde_json::json!(v));
828 }
829 if let Some(ref v) = self.include_archived {
830 map.insert("includeArchived".to_string(), serde_json::json!(v));
831 }
832 if let Some(ref v) = self.order_by {
833 map.insert("orderBy".to_string(), serde_json::json!(v));
834 }
835 let variables = serde_json::Value::Object(map);
836 self.client
837 .execute_connection::<
838 Cycle,
839 >(
840 "query Cycles($filter: CycleFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy) { cycles(filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy) { nodes { id createdAt updatedAt archivedAt number name description startsAt endsAt completedAt autoArchivedAt issueCountHistory completedIssueCountHistory scopeHistory completedScopeHistory inProgressScopeHistory team { id name key color displayName } progressHistory currentProgress inheritedFrom { id number name } isActive isFuture isPast progress isNext isPrevious } pageInfo { hasNextPage endCursor } } }",
841 variables,
842 "cycles",
843 )
844 .await
845 }
846}
847pub fn workflow_states<'a>(client: &'a Client) -> WorkflowStatesQueryBuilder<'a> {
849 WorkflowStatesQueryBuilder {
850 client,
851 filter: None,
852 before: None,
853 after: None,
854 first: None,
855 last: None,
856 include_archived: None,
857 order_by: None,
858 }
859}
860pub fn users<'a>(client: &'a Client) -> UsersQueryBuilder<'a> {
862 UsersQueryBuilder {
863 client,
864 filter: None,
865 include_disabled: None,
866 before: None,
867 after: None,
868 first: None,
869 last: None,
870 include_archived: None,
871 order_by: None,
872 sort: None,
873 }
874}
875pub async fn whoami(client: &Client) -> Result<User, LinearError> {
877 let variables = serde_json::json!({});
878 client
879 .execute::<
880 User,
881 >(
882 "query Viewer { viewer { id createdAt updatedAt archivedAt name displayName email avatarUrl disableReason calendarHash description statusEmoji statusLabel statusUntilAt timezone organization { id name } lastSeen identityProvider { id type } initials avatarBackgroundColor guest app isMentionable isAssignable active issueDrafts { nodes { id title creator { id } parent { id } parentIssue { id } } } drafts { nodes { id user { id } issue { id } project { id } projectUpdate { id } initiative { id } initiativeUpdate { id } post { id } parentComment { id } customerNeed { id } team { id } } } url assignedIssues { nodes { id number title summary { id } team { id } cycle { id } project { id } projectMilestone { id } lastAppliedTemplate { id } recurringIssueTemplate { id } creator { id } externalUserCreator { id } assignee { id } delegate { id } snoozedBy { id } state { id } sourceComment { id } botActor { id } favorite { id } identifier url parent { id } documentContent { id } reactions { id } syncedWith { id } asksRequester { id } asksExternalUserRequester { id } } } delegatedIssues { nodes { id number title summary { id } team { id } cycle { id } project { id } projectMilestone { id } lastAppliedTemplate { id } recurringIssueTemplate { id } creator { id } externalUserCreator { id } assignee { id } delegate { id } snoozedBy { id } state { id } sourceComment { id } botActor { id } favorite { id } identifier url parent { id } documentContent { id } reactions { id } syncedWith { id } asksRequester { id } asksExternalUserRequester { id } } } createdIssues { nodes { id number title summary { id } team { id } cycle { id } project { id } projectMilestone { id } lastAppliedTemplate { id } recurringIssueTemplate { id } creator { id } externalUserCreator { id } assignee { id } delegate { id } snoozedBy { id } state { id } sourceComment { id } botActor { id } favorite { id } identifier url parent { id } documentContent { id } reactions { id } syncedWith { id } asksRequester { id } asksExternalUserRequester { id } } } createdIssueCount teams { nodes { id name key color organization { id } parent { id } children { id } defaultIssueState { id } defaultTemplateForMembers { id } defaultTemplateForNonMembers { id } defaultProjectTemplate { id } triageIssueState { id } facets { id } posts { id } draftWorkflowState { id } startWorkflowState { id } reviewWorkflowState { id } mergeableWorkflowState { id } mergeWorkflowState { id } markedAsDuplicateWorkflowState { id } displayName activeCycle { id } triageResponsibility { id } integrationsSettings { id } } } teamMemberships { nodes { id user { id } team { id } } } feedFacets { nodes { id sourceOrganization { id } sourceTeam { id } sourceProject { id } sourceInitiative { id } sourceFeedUser { id } targetCustomView { id } } } canAccessAnyPublicTeam isMe admin owner supportsAgentSessions inviteHash gitHubUserId } }",
883 variables,
884 "viewer",
885 )
886 .await
887}
888pub fn projects<'a>(client: &'a Client) -> ProjectsQueryBuilder<'a> {
890 ProjectsQueryBuilder {
891 client,
892 filter: None,
893 before: None,
894 after: None,
895 first: None,
896 last: None,
897 include_archived: None,
898 order_by: None,
899 sort: None,
900 }
901}
902pub async fn project(client: &Client, id: String) -> Result<Project, LinearError> {
904 let variables = serde_json::json!({ "id" : id });
905 client
906 .execute::<
907 Project,
908 >(
909 "query Project($id: String!) { project(id: $id) { id createdAt updatedAt archivedAt updateReminderFrequencyInWeeks updateReminderFrequency frequencyResolution updateRemindersDay updateRemindersHour name description slugId icon color status { id name color type } creator { id name displayName email url } lead { id name displayName email url } facets { id } projectUpdateRemindersPausedUntilAt startDate startDateResolution targetDate targetDateResolution startedAt completedAt canceledAt autoArchivedAt trashed sortOrder prioritySortOrder convertedFromIssue { id number title identifier url } lastAppliedTemplate { id type name } priority lastUpdate { id url } health healthUpdatedAt issueCountHistory completedIssueCountHistory scopeHistory completedScopeHistory inProgressScopeHistory progressHistory currentProgress slackNewIssue slackIssueComments slackIssueStatuses labelIds favorite { id type url title color } url initiatives { nodes { id name organization { id } creator { id } owner { id } color facets { id } lastUpdate { id } url integrationsSettings { id } parentInitiative { id } documentContent { id } } } initiativeToProjects { nodes { id project { id } initiative { id } } } teams { nodes { id name key color organization { id } parent { id } children { id } defaultIssueState { id } defaultTemplateForMembers { id } defaultTemplateForNonMembers { id } defaultProjectTemplate { id } triageIssueState { id } facets { id } posts { id } draftWorkflowState { id } startWorkflowState { id } reviewWorkflowState { id } mergeableWorkflowState { id } mergeWorkflowState { id } markedAsDuplicateWorkflowState { id } displayName activeCycle { id } triageResponsibility { id } integrationsSettings { id } } } members { nodes { id name displayName email organization { id } identityProvider { id } url } } projectUpdates { nodes { id project { id } user { id } url reactions { id } } } documents { nodes { id title color creator { id } updatedBy { id } project { id } initiative { id } team { id } issue { id } release { id } cycle { id } lastAppliedTemplate { id } url } } projectMilestones { nodes { id name documentContent { id } project { id } } } issues { nodes { id number title summary { id } team { id } cycle { id } project { id } projectMilestone { id } lastAppliedTemplate { id } recurringIssueTemplate { id } creator { id } externalUserCreator { id } assignee { id } delegate { id } snoozedBy { id } state { id } sourceComment { id } botActor { id } favorite { id } identifier url parent { id } documentContent { id } reactions { id } syncedWith { id } asksRequester { id } asksExternalUserRequester { id } } } externalLinks { nodes { id url creator { id } initiative { id } } } attachments { nodes { id title url creator { id } } } history { nodes { id project { id } } } labels { nodes { id name color organization { id } creator { id } retiredBy { id } parent { id } } } progress scope integrationsSettings { id } content contentState documentContent { id } comments { nodes { id issue { id } documentContent { id } projectUpdate { id } initiativeUpdate { id } post { id } parent { id } resolvingUser { id } resolvingComment { id } user { id } externalUser { id } url agentSession { id } botActor { id } onBehalfOf { id } externalThread { id } reactions { id } syncedWith { id } } } relations { nodes { id type project { id } projectMilestone { id } relatedProject { id } relatedProjectMilestone { id } user { id } } } inverseRelations { nodes { id type project { id } projectMilestone { id } relatedProject { id } relatedProjectMilestone { id } user { id } } } needs { nodes { id customer { id } issue { id } project { id } comment { id } attachment { id } projectAttachment { id } creator { id } originalIssue { id } url } } state priorityLabel } }",
910 variables,
911 "project",
912 )
913 .await
914}
915pub fn teams<'a>(client: &'a Client) -> TeamsQueryBuilder<'a> {
917 TeamsQueryBuilder {
918 client,
919 filter: None,
920 before: None,
921 after: None,
922 first: None,
923 last: None,
924 include_archived: None,
925 order_by: None,
926 }
927}
928pub async fn team(client: &Client, id: String) -> Result<Team, LinearError> {
930 let variables = serde_json::json!({ "id" : id });
931 client
932 .execute::<
933 Team,
934 >(
935 "query Team($id: String!) { team(id: $id) { id createdAt updatedAt archivedAt name key description icon color retiredAt organization { id name } parent { id name key color displayName } children { id name key color displayName } cyclesEnabled cycleStartDay cycleDuration cycleCooldownTime cycleIssueAutoAssignStarted cycleIssueAutoAssignCompleted cycleLockToActive upcomingCycleCount timezone inheritWorkflowStatuses inheritIssueEstimation issueEstimationType issueOrderingNoPriorityFirst issueEstimationAllowZero setIssueSortOrderOnStateChange issueEstimationExtended defaultIssueEstimate triageEnabled requirePriorityToLeaveTriage defaultIssueState { id name color type } defaultTemplateForMembers { id type name } defaultTemplateForMembersId defaultTemplateForNonMembers { id type name } defaultTemplateForNonMembersId defaultProjectTemplate { id type name } triageIssueState { id name color type } private allMembersCanJoin securitySettings facets { id } posts { id title type } scimManaged scimGroupName progressHistory currentProgress draftWorkflowState { id name color type } startWorkflowState { id name color type } reviewWorkflowState { id name color type } mergeableWorkflowState { id name color type } mergeWorkflowState { id name color type } groupIssueHistory aiThreadSummariesEnabled aiDiscussionSummariesEnabled slackNewIssue slackIssueComments slackIssueStatuses autoClosePeriod autoCloseStateId autoArchivePeriod autoCloseParentIssues autoCloseChildIssues markedAsDuplicateWorkflowState { id name color type } joinByDefault cycleCalenderUrl displayName issues { nodes { id number title summary { id } team { id } cycle { id } project { id } projectMilestone { id } lastAppliedTemplate { id } recurringIssueTemplate { id } creator { id } externalUserCreator { id } assignee { id } delegate { id } snoozedBy { id } state { id } sourceComment { id } botActor { id } favorite { id } identifier url parent { id } documentContent { id } reactions { id } syncedWith { id } asksRequester { id } asksExternalUserRequester { id } } } issueCount cycles { nodes { id number name team { id } inheritedFrom { id } } } activeCycle { id number name } triageResponsibility { id } members { nodes { id name displayName email organization { id } identityProvider { id } url } } memberships { nodes { id user { id } team { id } } } projects { nodes { id name color status { id } creator { id } lead { id } facets { id } convertedFromIssue { id } lastAppliedTemplate { id } lastUpdate { id } favorite { id } url integrationsSettings { id } documentContent { id } } } states { nodes { id name color type team { id } inheritedFrom { id } } } gitAutomationStates { nodes { id state { id } team { id } targetBranch { id } } } templates { nodes { id type name organization { id } team { id } creator { id } lastUpdatedBy { id } inheritedFrom { id } } } labels { nodes { id name color organization { id } team { id } creator { id } retiredBy { id } parent { id } inheritedFrom { id } } } webhooks { nodes { id url team { id } creator { id } failures { id } } } integrationsSettings { id } issueSortOrderDefaultToBottom inviteHash } }",
936 variables,
937 "team",
938 )
939 .await
940}
941pub fn search_issues<'a>(
943 client: &'a Client,
944 term: impl Into<String>,
945) -> SearchIssuesQueryBuilder<'a> {
946 SearchIssuesQueryBuilder {
947 client,
948 term: term.into(),
949 filter: None,
950 before: None,
951 after: None,
952 first: None,
953 last: None,
954 include_archived: None,
955 order_by: None,
956 include_comments: None,
957 team_id: None,
958 }
959}
960pub fn issues<'a>(client: &'a Client) -> IssuesQueryBuilder<'a> {
962 IssuesQueryBuilder {
963 client,
964 filter: None,
965 before: None,
966 after: None,
967 first: None,
968 last: None,
969 include_archived: None,
970 order_by: None,
971 sort: None,
972 }
973}
974pub async fn issue(client: &Client, id: String) -> Result<Issue, LinearError> {
976 let variables = serde_json::json!({ "id" : id });
977 client
978 .execute::<
979 Issue,
980 >(
981 "query Issue($id: String!) { issue(id: $id) { id createdAt updatedAt archivedAt number title priority estimate boardOrder sortOrder prioritySortOrder startedAt completedAt startedTriageAt triagedAt canceledAt autoClosedAt autoArchivedAt dueDate slaStartedAt slaMediumRiskAt slaHighRiskAt slaBreachesAt slaType addedToProjectAt addedToCycleAt addedToTeamAt trashed snoozedUntilAt suggestionsGeneratedAt activitySummary summary { id } labelIds team { id name key color displayName } cycle { id number name } project { id name color url } projectMilestone { id name } lastAppliedTemplate { id type name } recurringIssueTemplate { id type name } previousIdentifiers creator { id name displayName email url } externalUserCreator { id name displayName email } assignee { id name displayName email url } delegate { id name displayName email url } snoozedBy { id name displayName email url } state { id name color type } subIssueSortOrder reactionData priorityLabel sourceComment { id url } integrationSourceType documents { nodes { id title color creator { id } updatedBy { id } project { id } initiative { id } team { id } issue { id } release { id } cycle { id } lastAppliedTemplate { id } url } } botActor { id type name } favorite { id type url title color } identifier url branchName customerTicketCount subscribers { nodes { id name displayName email organization { id } identityProvider { id } url } } parent { id number title identifier url } children { nodes { id number title summary { id } team { id } cycle { id } project { id } projectMilestone { id } lastAppliedTemplate { id } recurringIssueTemplate { id } creator { id } externalUserCreator { id } assignee { id } delegate { id } snoozedBy { id } state { id } sourceComment { id } botActor { id } favorite { id } identifier url parent { id } documentContent { id } reactions { id } syncedWith { id } asksRequester { id } asksExternalUserRequester { id } } } comments { nodes { id issue { id } documentContent { id } projectUpdate { id } initiativeUpdate { id } post { id } parent { id } resolvingUser { id } resolvingComment { id } user { id } externalUser { id } url agentSession { id } botActor { id } onBehalfOf { id } externalThread { id } reactions { id } syncedWith { id } } } history { nodes { id issue { id } actor { id } actors { id } descriptionUpdatedBy { id } fromAssignee { id } toAssignee { id } fromCycle { id } toCycle { id } toConvertedProject { id } fromDelegate { id } toDelegate { id } fromProject { id } toProject { id } fromState { id } toState { id } fromTeam { id } toTeam { id } fromParent { id } toParent { id } attachment { id } issueImport { id } triageResponsibilityNotifiedUsers { id } triageResponsibilityTeam { id } fromProjectMilestone { id } toProjectMilestone { id } botActor { id } addedLabels { id } removedLabels { id } addedToReleases { id } removedFromReleases { id } } } labels { nodes { id name color organization { id } team { id } creator { id } retiredBy { id } parent { id } inheritedFrom { id } } } relations { nodes { id type issue { id } relatedIssue { id } } } inverseRelations { nodes { id type issue { id } relatedIssue { id } } } attachments { nodes { id title url creator { id } externalUserCreator { id } originalIssue { id } issue { id } } } formerAttachments { nodes { id title url creator { id } externalUserCreator { id } originalIssue { id } issue { id } } } description documentContent { id } reactions { id } needs { nodes { id customer { id } issue { id } project { id } comment { id } attachment { id } projectAttachment { id } creator { id } originalIssue { id } url } } formerNeeds { nodes { id customer { id } issue { id } project { id } comment { id } attachment { id } projectAttachment { id } creator { id } originalIssue { id } url } } syncedWith { id } suggestions { nodes { id issue { id } type suggestedIssue { id } suggestedTeam { id } suggestedProject { id } suggestedUser { id } suggestedLabel { id } } } incomingSuggestions { nodes { id issue { id } type suggestedIssue { id } suggestedTeam { id } suggestedProject { id } suggestedUser { id } suggestedLabel { id } } } asksRequester { id name displayName email url } asksExternalUserRequester { id name displayName email } stateHistory { nodes { id state { id } } } } }",
982 variables,
983 "issue",
984 )
985 .await
986}
987pub fn issue_relations<'a>(client: &'a Client) -> IssueRelationsQueryBuilder<'a> {
989 IssueRelationsQueryBuilder {
990 client,
991 before: None,
992 after: None,
993 first: None,
994 last: None,
995 include_archived: None,
996 order_by: None,
997 }
998}
999pub async fn issue_relation(client: &Client, id: String) -> Result<IssueRelation, LinearError> {
1001 let variables = serde_json::json!({ "id" : id });
1002 client
1003 .execute::<
1004 IssueRelation,
1005 >(
1006 "query IssueRelation($id: String!) { issueRelation(id: $id) { id createdAt updatedAt archivedAt type issue { id number title identifier url } relatedIssue { id number title identifier url } } }",
1007 variables,
1008 "issueRelation",
1009 )
1010 .await
1011}
1012pub fn issue_labels<'a>(client: &'a Client) -> IssueLabelsQueryBuilder<'a> {
1014 IssueLabelsQueryBuilder {
1015 client,
1016 filter: None,
1017 before: None,
1018 after: None,
1019 first: None,
1020 last: None,
1021 include_archived: None,
1022 order_by: None,
1023 }
1024}
1025pub fn documents<'a>(client: &'a Client) -> DocumentsQueryBuilder<'a> {
1027 DocumentsQueryBuilder {
1028 client,
1029 filter: None,
1030 before: None,
1031 after: None,
1032 first: None,
1033 last: None,
1034 include_archived: None,
1035 order_by: None,
1036 }
1037}
1038pub async fn document(client: &Client, id: String) -> Result<Document, LinearError> {
1040 let variables = serde_json::json!({ "id" : id });
1041 client
1042 .execute::<
1043 Document,
1044 >(
1045 "query Document($id: String!) { document(id: $id) { id createdAt updatedAt archivedAt title icon color creator { id name displayName email url } updatedBy { id name displayName email url } project { id name color url } initiative { id name color url } team { id name key color displayName } issue { id number title identifier url } release { id name url } cycle { id number name } slugId lastAppliedTemplate { id type name } hiddenAt trashed sortOrder comments { nodes { id issue { id } documentContent { id } projectUpdate { id } initiativeUpdate { id } post { id } parent { id } resolvingUser { id } resolvingComment { id } user { id } externalUser { id } url agentSession { id } botActor { id } onBehalfOf { id } externalThread { id } reactions { id } syncedWith { id } } } content contentState documentContentId url } }",
1046 variables,
1047 "document",
1048 )
1049 .await
1050}
1051pub fn cycles<'a>(client: &'a Client) -> CyclesQueryBuilder<'a> {
1053 CyclesQueryBuilder {
1054 client,
1055 filter: None,
1056 before: None,
1057 after: None,
1058 first: None,
1059 last: None,
1060 include_archived: None,
1061 order_by: None,
1062 }
1063}
1064pub async fn cycle(client: &Client, id: String) -> Result<Cycle, LinearError> {
1066 let variables = serde_json::json!({ "id" : id });
1067 client
1068 .execute::<
1069 Cycle,
1070 >(
1071 "query Cycle($id: String!) { cycle(id: $id) { id createdAt updatedAt archivedAt number name description startsAt endsAt completedAt autoArchivedAt issueCountHistory completedIssueCountHistory scopeHistory completedScopeHistory inProgressScopeHistory team { id name key color displayName } progressHistory currentProgress inheritedFrom { id number name } isActive isFuture isPast issues { nodes { id number title summary { id } team { id } cycle { id } project { id } projectMilestone { id } lastAppliedTemplate { id } recurringIssueTemplate { id } creator { id } externalUserCreator { id } assignee { id } delegate { id } snoozedBy { id } state { id } sourceComment { id } botActor { id } favorite { id } identifier url parent { id } documentContent { id } reactions { id } syncedWith { id } asksRequester { id } asksExternalUserRequester { id } } } uncompletedIssuesUponClose { nodes { id number title summary { id } team { id } cycle { id } project { id } projectMilestone { id } lastAppliedTemplate { id } recurringIssueTemplate { id } creator { id } externalUserCreator { id } assignee { id } delegate { id } snoozedBy { id } state { id } sourceComment { id } botActor { id } favorite { id } identifier url parent { id } documentContent { id } reactions { id } syncedWith { id } asksRequester { id } asksExternalUserRequester { id } } } progress isNext isPrevious documents { nodes { id title color creator { id } updatedBy { id } project { id } initiative { id } team { id } issue { id } release { id } cycle { id } lastAppliedTemplate { id } url } } links { nodes { id url creator { id } initiative { id } } } } }",
1072 variables,
1073 "cycle",
1074 )
1075 .await
1076}