1#![allow(clippy::too_many_arguments)]
8use super::inputs::*;
9use crate::client::Client;
10use crate::error::LinearError;
11pub async fn file_upload(
13 client: &Client,
14 meta_data: Option<serde_json::Value>,
15 make_public: Option<bool>,
16 size: i64,
17 content_type: String,
18 filename: String,
19) -> Result<serde_json::Value, LinearError> {
20 let variables = serde_json::json!(
21 { "metaData" : meta_data, "makePublic" : make_public, "size" : size,
22 "contentType" : content_type, "filename" : filename }
23 );
24 client
25 .execute::<
26 serde_json::Value,
27 >(
28 "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 } } }",
29 variables,
30 "fileUpload",
31 )
32 .await
33}
34pub async fn image_upload_from_url(
36 client: &Client,
37 url: String,
38) -> Result<serde_json::Value, LinearError> {
39 let variables = serde_json::json!({ "url" : url });
40 client
41 .execute::<
42 serde_json::Value,
43 >(
44 "mutation ImageUploadFromUrl($url: String!) { imageUploadFromUrl(url: $url) { success url } }",
45 variables,
46 "imageUploadFromUrl",
47 )
48 .await
49}
50pub async fn issue_create(
52 client: &Client,
53 input: IssueCreateInput,
54) -> Result<serde_json::Value, LinearError> {
55 let variables = serde_json::json!({ "input" : input });
56 client
57 .execute::<
58 serde_json::Value,
59 >(
60 "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 } } }",
61 variables,
62 "issueCreate",
63 )
64 .await
65}
66pub async fn issue_update(
68 client: &Client,
69 input: IssueUpdateInput,
70 id: String,
71) -> Result<serde_json::Value, LinearError> {
72 let variables = serde_json::json!({ "input" : input, "id" : id });
73 client
74 .execute::<
75 serde_json::Value,
76 >(
77 "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 } } }",
78 variables,
79 "issueUpdate",
80 )
81 .await
82}
83pub async fn issue_archive(
85 client: &Client,
86 trash: Option<bool>,
87 id: String,
88) -> Result<serde_json::Value, LinearError> {
89 let variables = serde_json::json!({ "trash" : trash, "id" : id });
90 client
91 .execute::<
92 serde_json::Value,
93 >(
94 "mutation IssueArchive($trash: Boolean, $id: String!) { issueArchive(trash: $trash, id: $id) { 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 } } }",
95 variables,
96 "issueArchive",
97 )
98 .await
99}
100pub async fn issue_unarchive(
102 client: &Client,
103 id: String,
104) -> Result<serde_json::Value, LinearError> {
105 let variables = serde_json::json!({ "id" : id });
106 client
107 .execute::<
108 serde_json::Value,
109 >(
110 "mutation IssueUnarchive($id: String!) { issueUnarchive(id: $id) { 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 } } }",
111 variables,
112 "issueUnarchive",
113 )
114 .await
115}
116pub async fn issue_delete(
118 client: &Client,
119 permanently_delete: Option<bool>,
120 id: String,
121) -> Result<serde_json::Value, LinearError> {
122 let variables = serde_json::json!(
123 { "permanentlyDelete" : permanently_delete, "id" : id }
124 );
125 client
126 .execute::<
127 serde_json::Value,
128 >(
129 "mutation IssueDelete($permanentlyDelete: Boolean, $id: String!) { issueDelete(permanentlyDelete: $permanentlyDelete, id: $id) { 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 } } }",
130 variables,
131 "issueDelete",
132 )
133 .await
134}
135pub async fn issue_relation_create(
137 client: &Client,
138 override_created_at: Option<serde_json::Value>,
139 input: IssueRelationCreateInput,
140) -> Result<serde_json::Value, LinearError> {
141 let variables = serde_json::json!(
142 { "overrideCreatedAt" : override_created_at, "input" : input }
143 );
144 client
145 .execute::<
146 serde_json::Value,
147 >(
148 "mutation IssueRelationCreate($overrideCreatedAt: DateTime, $input: IssueRelationCreateInput!) { issueRelationCreate(overrideCreatedAt: $overrideCreatedAt, input: $input) { success issueRelation { id createdAt updatedAt archivedAt type } } }",
149 variables,
150 "issueRelationCreate",
151 )
152 .await
153}
154pub async fn document_create(
156 client: &Client,
157 input: DocumentCreateInput,
158) -> Result<serde_json::Value, LinearError> {
159 let variables = serde_json::json!({ "input" : input });
160 client
161 .execute::<
162 serde_json::Value,
163 >(
164 "mutation DocumentCreate($input: DocumentCreateInput!) { documentCreate(input: $input) { success document { id createdAt updatedAt archivedAt title icon color slugId hiddenAt trashed sortOrder content contentState documentContentId url } } }",
165 variables,
166 "documentCreate",
167 )
168 .await
169}
170pub async fn document_update(
172 client: &Client,
173 input: DocumentUpdateInput,
174 id: String,
175) -> Result<serde_json::Value, LinearError> {
176 let variables = serde_json::json!({ "input" : input, "id" : id });
177 client
178 .execute::<
179 serde_json::Value,
180 >(
181 "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 } } }",
182 variables,
183 "documentUpdate",
184 )
185 .await
186}
187pub async fn document_delete(
189 client: &Client,
190 id: String,
191) -> Result<serde_json::Value, LinearError> {
192 let variables = serde_json::json!({ "id" : id });
193 client
194 .execute::<
195 serde_json::Value,
196 >(
197 "mutation DocumentDelete($id: String!) { documentDelete(id: $id) { success entity { id createdAt updatedAt archivedAt title icon color slugId hiddenAt trashed sortOrder content contentState documentContentId url } } }",
198 variables,
199 "documentDelete",
200 )
201 .await
202}
203pub async fn comment_create(
205 client: &Client,
206 input: CommentCreateInput,
207) -> Result<serde_json::Value, LinearError> {
208 let variables = serde_json::json!({ "input" : input });
209 client
210 .execute::<
211 serde_json::Value,
212 >(
213 "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 } } }",
214 variables,
215 "commentCreate",
216 )
217 .await
218}