1#![allow(clippy::too_many_arguments)]
5use super::inputs::*;
6use crate::client::Client;
7use crate::error::LinearError;
8impl Client {
9 pub async fn file_upload(
10 &self,
11 meta_data: Option<serde_json::Value>,
12 make_public: Option<bool>,
13 size: i64,
14 content_type: String,
15 filename: String,
16 ) -> Result<serde_json::Value, LinearError> {
17 let variables = serde_json::json!(
18 { "metaData" : meta_data, "makePublic" : make_public, "size" : size,
19 "contentType" : content_type, "filename" : filename }
20 );
21 self.execute::<
22 serde_json::Value,
23 >(
24 "mutation FileUpload($metaData: JSON, $makePublic: Boolean, $size: Int!, $contentType: String!, $filename: String!) { fileUpload(metaData: $metaData, makePublic: $makePublic, size: $size, contentType: $contentType, filename: $filename) { success uploadFile { filename contentType size uploadUrl assetUrl metaData } success } }",
25 variables,
26 "fileUpload",
27 )
28 .await
29 }
30 pub async fn image_upload_from_url(
31 &self,
32 url: String,
33 ) -> Result<serde_json::Value, LinearError> {
34 let variables = serde_json::json!({ "url" : url });
35 self.execute::<
36 serde_json::Value,
37 >(
38 "mutation ImageUploadFromUrl($url: String!) { imageUploadFromUrl(url: $url) { success url success } }",
39 variables,
40 "imageUploadFromUrl",
41 )
42 .await
43 }
44 pub async fn comment_create(
45 &self,
46 input: CommentCreateInput,
47 ) -> Result<serde_json::Value, LinearError> {
48 let variables = serde_json::json!({ "input" : input });
49 self.execute::<
50 serde_json::Value,
51 >(
52 "mutation CommentCreate($input: CommentCreateInput!) { commentCreate(input: $input) { success comment { id createdAt updatedAt archivedAt body issueId documentContentId projectUpdateId initiativeUpdateId parentId resolvedAt resolvingCommentId editedAt bodyData quotedText reactionData threadSummary isArtificialAgentSessionRoot url hideInLinear } success } }",
53 variables,
54 "commentCreate",
55 )
56 .await
57 }
58 pub async fn issue_create(
59 &self,
60 input: IssueCreateInput,
61 ) -> Result<serde_json::Value, LinearError> {
62 let variables = serde_json::json!({ "input" : input });
63 self.execute::<
64 serde_json::Value,
65 >(
66 "mutation IssueCreate($input: IssueCreateInput!) { issueCreate(input: $input) { success issue { 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 labelIds previousIdentifiers subIssueSortOrder reactionData priorityLabel integrationSourceType identifier url branchName customerTicketCount description } success } }",
67 variables,
68 "issueCreate",
69 )
70 .await
71 }
72 pub async fn issue_update(
73 &self,
74 input: IssueUpdateInput,
75 id: String,
76 ) -> Result<serde_json::Value, LinearError> {
77 let variables = serde_json::json!({ "input" : input, "id" : id });
78 self.execute::<
79 serde_json::Value,
80 >(
81 "mutation IssueUpdate($input: IssueUpdateInput!, $id: String!) { issueUpdate(input: $input, id: $id) { success issue { 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 labelIds previousIdentifiers subIssueSortOrder reactionData priorityLabel integrationSourceType identifier url branchName customerTicketCount description } success } }",
82 variables,
83 "issueUpdate",
84 )
85 .await
86 }
87 pub async fn issue_archive(
88 &self,
89 trash: Option<bool>,
90 id: String,
91 ) -> Result<serde_json::Value, LinearError> {
92 let variables = serde_json::json!({ "trash" : trash, "id" : id });
93 self.execute::<
94 serde_json::Value,
95 >(
96 "mutation IssueArchive($trash: Boolean, $id: String!) { issueArchive(trash: $trash, id: $id) { success success entity { 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 labelIds previousIdentifiers subIssueSortOrder reactionData priorityLabel integrationSourceType identifier url branchName customerTicketCount description } } }",
97 variables,
98 "issueArchive",
99 )
100 .await
101 }
102 pub async fn issue_unarchive(&self, id: String) -> Result<serde_json::Value, LinearError> {
103 let variables = serde_json::json!({ "id" : id });
104 self.execute::<
105 serde_json::Value,
106 >(
107 "mutation IssueUnarchive($id: String!) { issueUnarchive(id: $id) { success success entity { 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 labelIds previousIdentifiers subIssueSortOrder reactionData priorityLabel integrationSourceType identifier url branchName customerTicketCount description } } }",
108 variables,
109 "issueUnarchive",
110 )
111 .await
112 }
113 pub async fn issue_delete(
114 &self,
115 permanently_delete: Option<bool>,
116 id: String,
117 ) -> Result<serde_json::Value, LinearError> {
118 let variables = serde_json::json!(
119 { "permanentlyDelete" : permanently_delete, "id" : id }
120 );
121 self.execute::<
122 serde_json::Value,
123 >(
124 "mutation IssueDelete($permanentlyDelete: Boolean, $id: String!) { issueDelete(permanentlyDelete: $permanentlyDelete, id: $id) { success success entity { 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 labelIds previousIdentifiers subIssueSortOrder reactionData priorityLabel integrationSourceType identifier url branchName customerTicketCount description } } }",
125 variables,
126 "issueDelete",
127 )
128 .await
129 }
130 pub async fn issue_relation_create(
131 &self,
132 override_created_at: Option<serde_json::Value>,
133 input: IssueRelationCreateInput,
134 ) -> Result<serde_json::Value, LinearError> {
135 let variables = serde_json::json!(
136 { "overrideCreatedAt" : override_created_at, "input" : input }
137 );
138 self.execute::<
139 serde_json::Value,
140 >(
141 "mutation IssueRelationCreate($overrideCreatedAt: DateTime, $input: IssueRelationCreateInput!) { issueRelationCreate(overrideCreatedAt: $overrideCreatedAt, input: $input) { success issueRelation { id createdAt updatedAt archivedAt type } success } }",
142 variables,
143 "issueRelationCreate",
144 )
145 .await
146 }
147 pub async fn document_create(
148 &self,
149 input: DocumentCreateInput,
150 ) -> Result<serde_json::Value, LinearError> {
151 let variables = serde_json::json!({ "input" : input });
152 self.execute::<
153 serde_json::Value,
154 >(
155 "mutation DocumentCreate($input: DocumentCreateInput!) { documentCreate(input: $input) { success document { id createdAt updatedAt archivedAt title icon color slugId hiddenAt trashed sortOrder content contentState documentContentId url } success } }",
156 variables,
157 "documentCreate",
158 )
159 .await
160 }
161 pub async fn document_update(
162 &self,
163 input: DocumentUpdateInput,
164 id: String,
165 ) -> Result<serde_json::Value, LinearError> {
166 let variables = serde_json::json!({ "input" : input, "id" : id });
167 self.execute::<
168 serde_json::Value,
169 >(
170 "mutation DocumentUpdate($input: DocumentUpdateInput!, $id: String!) { documentUpdate(input: $input, id: $id) { success document { id createdAt updatedAt archivedAt title icon color slugId hiddenAt trashed sortOrder content contentState documentContentId url } success } }",
171 variables,
172 "documentUpdate",
173 )
174 .await
175 }
176 pub async fn document_delete(&self, id: String) -> Result<serde_json::Value, LinearError> {
177 let variables = serde_json::json!({ "id" : id });
178 self.execute::<
179 serde_json::Value,
180 >(
181 "mutation DocumentDelete($id: String!) { documentDelete(id: $id) { success success entity { id createdAt updatedAt archivedAt title icon color slugId hiddenAt trashed sortOrder content contentState documentContentId url } } }",
182 variables,
183 "documentDelete",
184 )
185 .await
186 }
187}