Skip to main content

spatio_sdk/apis/
tasks_api.rs

1/*
2 * SpatioAPI
3 *
4 * The REST API that owns every resource in your Spatio workspace: notes, sheets, slides, tasks, calendar events, mail, chat, files, and contacts. SpatioMCP wraps this API; Spatio Desktop reads from it. You can call it directly from your own code.  All requests must be authenticated with a Personal Access Token (`Authorization: Bearer pat_...`) or an OAuth 2.1 access token, and use HTTPS.  Official SDKs (MIT, generated from this spec on every release):  - TypeScript: https://github.com/spatio-labs/spatio-ts (`npm install @spatio-labs/spatio-ts`) - Python: https://github.com/spatio-labs/spatio-py (`pip install spatio-sdk`) - Go: https://github.com/spatio-labs/spatio-go (`go get github.com/spatio-labs/spatio-go`)  This specification is generated from the platform-service Go source on every push to `main`. The spec, not hand-written documentation, is the source of truth: server stubs and SDKs are generated from it, and any drift between the spec and the running service fails CI. 
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: hello@spatio.app
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`bulk_delete_tasks`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum BulkDeleteTasksError {
22    Status400(models::ApiError),
23    Status401(models::ApiError),
24    UnknownValue(serde_json::Value),
25}
26
27/// struct for typed errors of method [`bulk_update_tasks`]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum BulkUpdateTasksError {
31    Status400(models::ApiError),
32    Status401(models::ApiError),
33    UnknownValue(serde_json::Value),
34}
35
36/// struct for typed errors of method [`complete_task`]
37#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum CompleteTaskError {
40    Status401(models::ApiError),
41    Status404(models::ApiError),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`create_task`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum CreateTaskError {
49    Status400(models::CreateNote400Response),
50    Status401(models::ApiError),
51    Status500(models::ApiError),
52    UnknownValue(serde_json::Value),
53}
54
55/// struct for typed errors of method [`create_task_comment`]
56#[derive(Debug, Clone, Serialize, Deserialize)]
57#[serde(untagged)]
58pub enum CreateTaskCommentError {
59    Status400(models::ApiError),
60    Status401(models::ApiError),
61    UnknownValue(serde_json::Value),
62}
63
64/// struct for typed errors of method [`delete_task`]
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum DeleteTaskError {
68    Status401(models::ApiError),
69    Status404(models::ApiError),
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method [`delete_task_comment`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum DeleteTaskCommentError {
77    Status400(models::ApiError),
78    Status401(models::ApiError),
79    Status403(models::ApiError),
80    Status404(models::ApiError),
81    UnknownValue(serde_json::Value),
82}
83
84/// struct for typed errors of method [`get_task`]
85#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum GetTaskError {
88    Status400(models::CreateNote400Response),
89    Status401(models::ApiError),
90    Status404(models::ApiError),
91    UnknownValue(serde_json::Value),
92}
93
94/// struct for typed errors of method [`list_task_comments`]
95#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum ListTaskCommentsError {
98    Status400(models::ApiError),
99    Status401(models::ApiError),
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`list_task_providers`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum ListTaskProvidersError {
107    Status401(models::ApiError),
108    UnknownValue(serde_json::Value),
109}
110
111/// struct for typed errors of method [`list_tasks`]
112#[derive(Debug, Clone, Serialize, Deserialize)]
113#[serde(untagged)]
114pub enum ListTasksError {
115    Status401(models::ApiError),
116    Status500(models::ApiError),
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`update_task`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum UpdateTaskError {
124    Status400(models::ApiError),
125    Status401(models::ApiError),
126    Status404(models::ApiError),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`update_task_comment`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum UpdateTaskCommentError {
134    Status400(models::ApiError),
135    Status401(models::ApiError),
136    Status403(models::ApiError),
137    Status404(models::ApiError),
138    UnknownValue(serde_json::Value),
139}
140
141/// struct for typed errors of method [`workspace_complete_task`]
142#[derive(Debug, Clone, Serialize, Deserialize)]
143#[serde(untagged)]
144pub enum WorkspaceCompleteTaskError {
145    Status401(models::ApiError),
146    Status403(models::ApiError),
147    UnknownValue(serde_json::Value),
148}
149
150/// struct for typed errors of method [`workspace_complete_task_alias`]
151#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum WorkspaceCompleteTaskAliasError {
154    Status401(models::ApiError),
155    Status403(models::ApiError),
156    UnknownValue(serde_json::Value),
157}
158
159/// struct for typed errors of method [`workspace_create_task`]
160#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum WorkspaceCreateTaskError {
163    Status401(models::ApiError),
164    Status403(models::ApiError),
165    UnknownValue(serde_json::Value),
166}
167
168/// struct for typed errors of method [`workspace_create_task_alias`]
169#[derive(Debug, Clone, Serialize, Deserialize)]
170#[serde(untagged)]
171pub enum WorkspaceCreateTaskAliasError {
172    Status401(models::ApiError),
173    Status403(models::ApiError),
174    UnknownValue(serde_json::Value),
175}
176
177/// struct for typed errors of method [`workspace_delete_task`]
178#[derive(Debug, Clone, Serialize, Deserialize)]
179#[serde(untagged)]
180pub enum WorkspaceDeleteTaskError {
181    Status401(models::ApiError),
182    Status403(models::ApiError),
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`workspace_get_task`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum WorkspaceGetTaskError {
190    Status401(models::ApiError),
191    Status403(models::ApiError),
192    Status404(models::ApiError),
193    UnknownValue(serde_json::Value),
194}
195
196/// struct for typed errors of method [`workspace_list_task_providers`]
197#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum WorkspaceListTaskProvidersError {
200    Status401(models::ApiError),
201    Status403(models::ApiError),
202    UnknownValue(serde_json::Value),
203}
204
205/// struct for typed errors of method [`workspace_list_tasks`]
206#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum WorkspaceListTasksError {
209    Status401(models::ApiError),
210    Status403(models::ApiError),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`workspace_list_tasks_alias`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum WorkspaceListTasksAliasError {
218    Status401(models::ApiError),
219    Status403(models::ApiError),
220    UnknownValue(serde_json::Value),
221}
222
223/// struct for typed errors of method [`workspace_update_task`]
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum WorkspaceUpdateTaskError {
227    Status401(models::ApiError),
228    Status403(models::ApiError),
229    UnknownValue(serde_json::Value),
230}
231
232/// struct for typed errors of method [`workspace_update_task_alias`]
233#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum WorkspaceUpdateTaskAliasError {
236    Status401(models::ApiError),
237    Status403(models::ApiError),
238    UnknownValue(serde_json::Value),
239}
240
241
242/// Replaces the legacy BFF that looped DELETE /v1/tasks/:id. Per-id errors are collected in `failed` rather than failing the whole call — partial success is the norm. 
243pub async fn bulk_delete_tasks(configuration: &configuration::Configuration, bulk_delete_tasks_request: models::BulkDeleteTasksRequest) -> Result<models::BulkDeleteTasksResponse, Error<BulkDeleteTasksError>> {
244    // add a prefix to parameters to efficiently prevent name collisions
245    let p_body_bulk_delete_tasks_request = bulk_delete_tasks_request;
246
247    let uri_str = format!("{}/v1/tasks/delete", configuration.base_path);
248    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
249
250    if let Some(ref user_agent) = configuration.user_agent {
251        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
252    }
253    if let Some(ref token) = configuration.bearer_access_token {
254        req_builder = req_builder.bearer_auth(token.to_owned());
255    };
256    req_builder = req_builder.json(&p_body_bulk_delete_tasks_request);
257
258    let req = req_builder.build()?;
259    let resp = configuration.client.execute(req).await?;
260
261    let status = resp.status();
262    let content_type = resp
263        .headers()
264        .get("content-type")
265        .and_then(|v| v.to_str().ok())
266        .unwrap_or("application/octet-stream");
267    let content_type = super::ContentType::from(content_type);
268
269    if !status.is_client_error() && !status.is_server_error() {
270        let content = resp.text().await?;
271        match content_type {
272            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
273            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BulkDeleteTasksResponse`"))),
274            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BulkDeleteTasksResponse`")))),
275        }
276    } else {
277        let content = resp.text().await?;
278        let entity: Option<BulkDeleteTasksError> = serde_json::from_str(&content).ok();
279        Err(Error::ResponseError(ResponseContent { status, content, entity }))
280    }
281}
282
283/// Same `updates` payload applied to every id in `taskIds`. As with bulk delete, per-id failures collect in `failed`. 
284pub async fn bulk_update_tasks(configuration: &configuration::Configuration, bulk_update_tasks_request: models::BulkUpdateTasksRequest) -> Result<models::BulkUpdateTasksResponse, Error<BulkUpdateTasksError>> {
285    // add a prefix to parameters to efficiently prevent name collisions
286    let p_body_bulk_update_tasks_request = bulk_update_tasks_request;
287
288    let uri_str = format!("{}/v1/tasks/bulk-update", configuration.base_path);
289    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
290
291    if let Some(ref user_agent) = configuration.user_agent {
292        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
293    }
294    if let Some(ref token) = configuration.bearer_access_token {
295        req_builder = req_builder.bearer_auth(token.to_owned());
296    };
297    req_builder = req_builder.json(&p_body_bulk_update_tasks_request);
298
299    let req = req_builder.build()?;
300    let resp = configuration.client.execute(req).await?;
301
302    let status = resp.status();
303    let content_type = resp
304        .headers()
305        .get("content-type")
306        .and_then(|v| v.to_str().ok())
307        .unwrap_or("application/octet-stream");
308    let content_type = super::ContentType::from(content_type);
309
310    if !status.is_client_error() && !status.is_server_error() {
311        let content = resp.text().await?;
312        match content_type {
313            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
314            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BulkUpdateTasksResponse`"))),
315            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BulkUpdateTasksResponse`")))),
316        }
317    } else {
318        let content = resp.text().await?;
319        let entity: Option<BulkUpdateTasksError> = serde_json::from_str(&content).ok();
320        Err(Error::ResponseError(ResponseContent { status, content, entity }))
321    }
322}
323
324/// Idempotent — completing an already-completed task is a no-op that still returns success. The legacy `POST /v1/tasks/complete/task` endpoint accepts the same operation with the task id in the JSON body instead of the URL; that variant is a renderer-compat shim and is not modeled in the spec. 
325pub async fn complete_task(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<CompleteTaskError>> {
326    // add a prefix to parameters to efficiently prevent name collisions
327    let p_path_id = id;
328    let p_query_account_id = account_id;
329    let p_header_x_workspace_id = x_workspace_id;
330
331    let uri_str = format!("{}/v1/tasks/{id}/complete", configuration.base_path, id=crate::apis::urlencode(p_path_id));
332    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
333
334    if let Some(ref param_value) = p_query_account_id {
335        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
336    }
337    if let Some(ref user_agent) = configuration.user_agent {
338        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
339    }
340    if let Some(param_value) = p_header_x_workspace_id {
341        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
342    }
343    if let Some(ref token) = configuration.bearer_access_token {
344        req_builder = req_builder.bearer_auth(token.to_owned());
345    };
346
347    let req = req_builder.build()?;
348    let resp = configuration.client.execute(req).await?;
349
350    let status = resp.status();
351    let content_type = resp
352        .headers()
353        .get("content-type")
354        .and_then(|v| v.to_str().ok())
355        .unwrap_or("application/octet-stream");
356    let content_type = super::ContentType::from(content_type);
357
358    if !status.is_client_error() && !status.is_server_error() {
359        let content = resp.text().await?;
360        match content_type {
361            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
362            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
363            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SuccessFlag`")))),
364        }
365    } else {
366        let content = resp.text().await?;
367        let entity: Option<CompleteTaskError> = serde_json::from_str(&content).ok();
368        Err(Error::ResponseError(ResponseContent { status, content, entity }))
369    }
370}
371
372/// Creates a new task under the target account. Target resolution mirrors `POST /v1/notes`: body `accountId` → `?accountId=` → body `provider` → `?provider=` → caller's single connected account (errors `ambiguous_account` if more than one and no selector). 
373pub async fn create_task(configuration: &configuration::Configuration, create_task_request: models::CreateTaskRequest, account_id: Option<&str>, provider: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Task, Error<CreateTaskError>> {
374    // add a prefix to parameters to efficiently prevent name collisions
375    let p_body_create_task_request = create_task_request;
376    let p_query_account_id = account_id;
377    let p_query_provider = provider;
378    let p_header_x_workspace_id = x_workspace_id;
379
380    let uri_str = format!("{}/v1/tasks", configuration.base_path);
381    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
382
383    if let Some(ref param_value) = p_query_account_id {
384        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
385    }
386    if let Some(ref param_value) = p_query_provider {
387        req_builder = req_builder.query(&[("provider", &param_value.to_string())]);
388    }
389    if let Some(ref user_agent) = configuration.user_agent {
390        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
391    }
392    if let Some(param_value) = p_header_x_workspace_id {
393        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
394    }
395    if let Some(ref token) = configuration.bearer_access_token {
396        req_builder = req_builder.bearer_auth(token.to_owned());
397    };
398    req_builder = req_builder.json(&p_body_create_task_request);
399
400    let req = req_builder.build()?;
401    let resp = configuration.client.execute(req).await?;
402
403    let status = resp.status();
404    let content_type = resp
405        .headers()
406        .get("content-type")
407        .and_then(|v| v.to_str().ok())
408        .unwrap_or("application/octet-stream");
409    let content_type = super::ContentType::from(content_type);
410
411    if !status.is_client_error() && !status.is_server_error() {
412        let content = resp.text().await?;
413        match content_type {
414            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
415            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Task`"))),
416            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Task`")))),
417        }
418    } else {
419        let content = resp.text().await?;
420        let entity: Option<CreateTaskError> = serde_json::from_str(&content).ok();
421        Err(Error::ResponseError(ResponseContent { status, content, entity }))
422    }
423}
424
425pub async fn create_task_comment(configuration: &configuration::Configuration, id: &str, task_comment_request: models::TaskCommentRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::TaskCommentMutationResponse, Error<CreateTaskCommentError>> {
426    // add a prefix to parameters to efficiently prevent name collisions
427    let p_path_id = id;
428    let p_body_task_comment_request = task_comment_request;
429    let p_query_account_id = account_id;
430    let p_header_x_workspace_id = x_workspace_id;
431
432    let uri_str = format!("{}/v1/tasks/{id}/comments", configuration.base_path, id=crate::apis::urlencode(p_path_id));
433    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
434
435    if let Some(ref param_value) = p_query_account_id {
436        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
437    }
438    if let Some(ref user_agent) = configuration.user_agent {
439        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
440    }
441    if let Some(param_value) = p_header_x_workspace_id {
442        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
443    }
444    if let Some(ref token) = configuration.bearer_access_token {
445        req_builder = req_builder.bearer_auth(token.to_owned());
446    };
447    req_builder = req_builder.json(&p_body_task_comment_request);
448
449    let req = req_builder.build()?;
450    let resp = configuration.client.execute(req).await?;
451
452    let status = resp.status();
453    let content_type = resp
454        .headers()
455        .get("content-type")
456        .and_then(|v| v.to_str().ok())
457        .unwrap_or("application/octet-stream");
458    let content_type = super::ContentType::from(content_type);
459
460    if !status.is_client_error() && !status.is_server_error() {
461        let content = resp.text().await?;
462        match content_type {
463            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
464            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskCommentMutationResponse`"))),
465            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskCommentMutationResponse`")))),
466        }
467    } else {
468        let content = resp.text().await?;
469        let entity: Option<CreateTaskCommentError> = serde_json::from_str(&content).ok();
470        Err(Error::ResponseError(ResponseContent { status, content, entity }))
471    }
472}
473
474pub async fn delete_task(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<DeleteTaskError>> {
475    // add a prefix to parameters to efficiently prevent name collisions
476    let p_path_id = id;
477    let p_query_account_id = account_id;
478    let p_header_x_workspace_id = x_workspace_id;
479
480    let uri_str = format!("{}/v1/tasks/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
481    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
482
483    if let Some(ref param_value) = p_query_account_id {
484        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
485    }
486    if let Some(ref user_agent) = configuration.user_agent {
487        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
488    }
489    if let Some(param_value) = p_header_x_workspace_id {
490        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
491    }
492    if let Some(ref token) = configuration.bearer_access_token {
493        req_builder = req_builder.bearer_auth(token.to_owned());
494    };
495
496    let req = req_builder.build()?;
497    let resp = configuration.client.execute(req).await?;
498
499    let status = resp.status();
500    let content_type = resp
501        .headers()
502        .get("content-type")
503        .and_then(|v| v.to_str().ok())
504        .unwrap_or("application/octet-stream");
505    let content_type = super::ContentType::from(content_type);
506
507    if !status.is_client_error() && !status.is_server_error() {
508        let content = resp.text().await?;
509        match content_type {
510            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
511            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
512            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SuccessFlag`")))),
513        }
514    } else {
515        let content = resp.text().await?;
516        let entity: Option<DeleteTaskError> = serde_json::from_str(&content).ok();
517        Err(Error::ResponseError(ResponseContent { status, content, entity }))
518    }
519}
520
521/// Allowed for the comment author and (for native comments) for the task owner. 
522pub async fn delete_task_comment(configuration: &configuration::Configuration, id: &str, comment_id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<DeleteTaskCommentError>> {
523    // add a prefix to parameters to efficiently prevent name collisions
524    let p_path_id = id;
525    let p_path_comment_id = comment_id;
526    let p_query_account_id = account_id;
527    let p_header_x_workspace_id = x_workspace_id;
528
529    let uri_str = format!("{}/v1/tasks/{id}/comments/{commentId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), commentId=crate::apis::urlencode(p_path_comment_id));
530    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
531
532    if let Some(ref param_value) = p_query_account_id {
533        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
534    }
535    if let Some(ref user_agent) = configuration.user_agent {
536        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
537    }
538    if let Some(param_value) = p_header_x_workspace_id {
539        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
540    }
541    if let Some(ref token) = configuration.bearer_access_token {
542        req_builder = req_builder.bearer_auth(token.to_owned());
543    };
544
545    let req = req_builder.build()?;
546    let resp = configuration.client.execute(req).await?;
547
548    let status = resp.status();
549    let content_type = resp
550        .headers()
551        .get("content-type")
552        .and_then(|v| v.to_str().ok())
553        .unwrap_or("application/octet-stream");
554    let content_type = super::ContentType::from(content_type);
555
556    if !status.is_client_error() && !status.is_server_error() {
557        let content = resp.text().await?;
558        match content_type {
559            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
560            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
561            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SuccessFlag`")))),
562        }
563    } else {
564        let content = resp.text().await?;
565        let entity: Option<DeleteTaskCommentError> = serde_json::from_str(&content).ok();
566        Err(Error::ResponseError(ResponseContent { status, content, entity }))
567    }
568}
569
570pub async fn get_task(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Task, Error<GetTaskError>> {
571    // add a prefix to parameters to efficiently prevent name collisions
572    let p_path_id = id;
573    let p_query_account_id = account_id;
574    let p_header_x_workspace_id = x_workspace_id;
575
576    let uri_str = format!("{}/v1/tasks/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
577    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
578
579    if let Some(ref param_value) = p_query_account_id {
580        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
581    }
582    if let Some(ref user_agent) = configuration.user_agent {
583        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
584    }
585    if let Some(param_value) = p_header_x_workspace_id {
586        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
587    }
588    if let Some(ref token) = configuration.bearer_access_token {
589        req_builder = req_builder.bearer_auth(token.to_owned());
590    };
591
592    let req = req_builder.build()?;
593    let resp = configuration.client.execute(req).await?;
594
595    let status = resp.status();
596    let content_type = resp
597        .headers()
598        .get("content-type")
599        .and_then(|v| v.to_str().ok())
600        .unwrap_or("application/octet-stream");
601    let content_type = super::ContentType::from(content_type);
602
603    if !status.is_client_error() && !status.is_server_error() {
604        let content = resp.text().await?;
605        match content_type {
606            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
607            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Task`"))),
608            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Task`")))),
609        }
610    } else {
611        let content = resp.text().await?;
612        let entity: Option<GetTaskError> = serde_json::from_str(&content).ok();
613        Err(Error::ResponseError(ResponseContent { status, content, entity }))
614    }
615}
616
617/// Returns active comments. When `?accountId=` targets an external provider that supports comments (e.g. Linear), the provider is queried directly; otherwise the native `TaskComment` table is used. 
618pub async fn list_task_comments(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::TaskCommentList, Error<ListTaskCommentsError>> {
619    // add a prefix to parameters to efficiently prevent name collisions
620    let p_path_id = id;
621    let p_query_account_id = account_id;
622    let p_header_x_workspace_id = x_workspace_id;
623
624    let uri_str = format!("{}/v1/tasks/{id}/comments", configuration.base_path, id=crate::apis::urlencode(p_path_id));
625    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
626
627    if let Some(ref param_value) = p_query_account_id {
628        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
629    }
630    if let Some(ref user_agent) = configuration.user_agent {
631        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
632    }
633    if let Some(param_value) = p_header_x_workspace_id {
634        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
635    }
636    if let Some(ref token) = configuration.bearer_access_token {
637        req_builder = req_builder.bearer_auth(token.to_owned());
638    };
639
640    let req = req_builder.build()?;
641    let resp = configuration.client.execute(req).await?;
642
643    let status = resp.status();
644    let content_type = resp
645        .headers()
646        .get("content-type")
647        .and_then(|v| v.to_str().ok())
648        .unwrap_or("application/octet-stream");
649    let content_type = super::ContentType::from(content_type);
650
651    if !status.is_client_error() && !status.is_server_error() {
652        let content = resp.text().await?;
653        match content_type {
654            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
655            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskCommentList`"))),
656            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskCommentList`")))),
657        }
658    } else {
659        let content = resp.text().await?;
660        let entity: Option<ListTaskCommentsError> = serde_json::from_str(&content).ok();
661        Err(Error::ResponseError(ResponseContent { status, content, entity }))
662    }
663}
664
665/// Returns the registered task-provider ids and the platform's own metadata. Useful for clients that need to render provider-specific UI (icons, capability flags) before committing to a particular `provider`. 
666pub async fn list_task_providers(configuration: &configuration::Configuration, ) -> Result<models::TaskProvidersInfo, Error<ListTaskProvidersError>> {
667
668    let uri_str = format!("{}/v1/tasks/providers", configuration.base_path);
669    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
670
671    if let Some(ref user_agent) = configuration.user_agent {
672        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
673    }
674    if let Some(ref token) = configuration.bearer_access_token {
675        req_builder = req_builder.bearer_auth(token.to_owned());
676    };
677
678    let req = req_builder.build()?;
679    let resp = configuration.client.execute(req).await?;
680
681    let status = resp.status();
682    let content_type = resp
683        .headers()
684        .get("content-type")
685        .and_then(|v| v.to_str().ok())
686        .unwrap_or("application/octet-stream");
687    let content_type = super::ContentType::from(content_type);
688
689    if !status.is_client_error() && !status.is_server_error() {
690        let content = resp.text().await?;
691        match content_type {
692            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
693            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskProvidersInfo`"))),
694            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskProvidersInfo`")))),
695        }
696    } else {
697        let content = resp.text().await?;
698        let entity: Option<ListTaskProvidersError> = serde_json::from_str(&content).ok();
699        Err(Error::ResponseError(ResponseContent { status, content, entity }))
700    }
701}
702
703/// Fan-out list. Returns every task visible to the caller across every connected tasks provider. Pass `?accountId=` or `?provider=` to scope to a single source. 
704pub async fn list_tasks(configuration: &configuration::Configuration, account_id: Option<&str>, provider: Option<&str>, x_workspace_id: Option<&str>, completed: Option<bool>, labels: Option<Vec<String>>, parent_task_id: Option<&str>, r#type: Option<&str>, source_platform: Option<&str>, source_id: Option<&str>, limit: Option<i32>, offset: Option<i32>) -> Result<models::TaskListEnvelope, Error<ListTasksError>> {
705    // add a prefix to parameters to efficiently prevent name collisions
706    let p_query_account_id = account_id;
707    let p_query_provider = provider;
708    let p_header_x_workspace_id = x_workspace_id;
709    let p_query_completed = completed;
710    let p_query_labels = labels;
711    let p_query_parent_task_id = parent_task_id;
712    let p_query_type = r#type;
713    let p_query_source_platform = source_platform;
714    let p_query_source_id = source_id;
715    let p_query_limit = limit;
716    let p_query_offset = offset;
717
718    let uri_str = format!("{}/v1/tasks", configuration.base_path);
719    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
720
721    if let Some(ref param_value) = p_query_account_id {
722        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
723    }
724    if let Some(ref param_value) = p_query_provider {
725        req_builder = req_builder.query(&[("provider", &param_value.to_string())]);
726    }
727    if let Some(ref param_value) = p_query_completed {
728        req_builder = req_builder.query(&[("completed", &param_value.to_string())]);
729    }
730    if let Some(ref param_value) = p_query_labels {
731        req_builder = match "multi" {
732            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("labels".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
733            _ => req_builder.query(&[("labels", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
734        };
735    }
736    if let Some(ref param_value) = p_query_parent_task_id {
737        req_builder = req_builder.query(&[("parentTaskId", &param_value.to_string())]);
738    }
739    if let Some(ref param_value) = p_query_type {
740        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
741    }
742    if let Some(ref param_value) = p_query_source_platform {
743        req_builder = req_builder.query(&[("sourcePlatform", &param_value.to_string())]);
744    }
745    if let Some(ref param_value) = p_query_source_id {
746        req_builder = req_builder.query(&[("sourceId", &param_value.to_string())]);
747    }
748    if let Some(ref param_value) = p_query_limit {
749        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
750    }
751    if let Some(ref param_value) = p_query_offset {
752        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
753    }
754    if let Some(ref user_agent) = configuration.user_agent {
755        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
756    }
757    if let Some(param_value) = p_header_x_workspace_id {
758        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
759    }
760    if let Some(ref token) = configuration.bearer_access_token {
761        req_builder = req_builder.bearer_auth(token.to_owned());
762    };
763
764    let req = req_builder.build()?;
765    let resp = configuration.client.execute(req).await?;
766
767    let status = resp.status();
768    let content_type = resp
769        .headers()
770        .get("content-type")
771        .and_then(|v| v.to_str().ok())
772        .unwrap_or("application/octet-stream");
773    let content_type = super::ContentType::from(content_type);
774
775    if !status.is_client_error() && !status.is_server_error() {
776        let content = resp.text().await?;
777        match content_type {
778            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
779            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskListEnvelope`"))),
780            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskListEnvelope`")))),
781        }
782    } else {
783        let content = resp.text().await?;
784        let entity: Option<ListTasksError> = serde_json::from_str(&content).ok();
785        Err(Error::ResponseError(ResponseContent { status, content, entity }))
786    }
787}
788
789pub async fn update_task(configuration: &configuration::Configuration, id: &str, update_task_request: models::UpdateTaskRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Task, Error<UpdateTaskError>> {
790    // add a prefix to parameters to efficiently prevent name collisions
791    let p_path_id = id;
792    let p_body_update_task_request = update_task_request;
793    let p_query_account_id = account_id;
794    let p_header_x_workspace_id = x_workspace_id;
795
796    let uri_str = format!("{}/v1/tasks/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
797    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
798
799    if let Some(ref param_value) = p_query_account_id {
800        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
801    }
802    if let Some(ref user_agent) = configuration.user_agent {
803        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
804    }
805    if let Some(param_value) = p_header_x_workspace_id {
806        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
807    }
808    if let Some(ref token) = configuration.bearer_access_token {
809        req_builder = req_builder.bearer_auth(token.to_owned());
810    };
811    req_builder = req_builder.json(&p_body_update_task_request);
812
813    let req = req_builder.build()?;
814    let resp = configuration.client.execute(req).await?;
815
816    let status = resp.status();
817    let content_type = resp
818        .headers()
819        .get("content-type")
820        .and_then(|v| v.to_str().ok())
821        .unwrap_or("application/octet-stream");
822    let content_type = super::ContentType::from(content_type);
823
824    if !status.is_client_error() && !status.is_server_error() {
825        let content = resp.text().await?;
826        match content_type {
827            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
828            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Task`"))),
829            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Task`")))),
830        }
831    } else {
832        let content = resp.text().await?;
833        let entity: Option<UpdateTaskError> = serde_json::from_str(&content).ok();
834        Err(Error::ResponseError(ResponseContent { status, content, entity }))
835    }
836}
837
838/// Only the comment author can edit.
839pub async fn update_task_comment(configuration: &configuration::Configuration, id: &str, comment_id: &str, task_comment_request: models::TaskCommentRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::TaskCommentMutationResponse, Error<UpdateTaskCommentError>> {
840    // add a prefix to parameters to efficiently prevent name collisions
841    let p_path_id = id;
842    let p_path_comment_id = comment_id;
843    let p_body_task_comment_request = task_comment_request;
844    let p_query_account_id = account_id;
845    let p_header_x_workspace_id = x_workspace_id;
846
847    let uri_str = format!("{}/v1/tasks/{id}/comments/{commentId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), commentId=crate::apis::urlencode(p_path_comment_id));
848    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
849
850    if let Some(ref param_value) = p_query_account_id {
851        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
852    }
853    if let Some(ref user_agent) = configuration.user_agent {
854        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
855    }
856    if let Some(param_value) = p_header_x_workspace_id {
857        req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
858    }
859    if let Some(ref token) = configuration.bearer_access_token {
860        req_builder = req_builder.bearer_auth(token.to_owned());
861    };
862    req_builder = req_builder.json(&p_body_task_comment_request);
863
864    let req = req_builder.build()?;
865    let resp = configuration.client.execute(req).await?;
866
867    let status = resp.status();
868    let content_type = resp
869        .headers()
870        .get("content-type")
871        .and_then(|v| v.to_str().ok())
872        .unwrap_or("application/octet-stream");
873    let content_type = super::ContentType::from(content_type);
874
875    if !status.is_client_error() && !status.is_server_error() {
876        let content = resp.text().await?;
877        match content_type {
878            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
879            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskCommentMutationResponse`"))),
880            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskCommentMutationResponse`")))),
881        }
882    } else {
883        let content = resp.text().await?;
884        let entity: Option<UpdateTaskCommentError> = serde_json::from_str(&content).ok();
885        Err(Error::ResponseError(ResponseContent { status, content, entity }))
886    }
887}
888
889pub async fn workspace_complete_task(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCompleteTaskError>> {
890    // add a prefix to parameters to efficiently prevent name collisions
891    let p_path_org = org;
892    let p_path_workspace = workspace;
893    let p_path_id = id;
894
895    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/{id}/complete", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
896    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
897
898    if let Some(ref user_agent) = configuration.user_agent {
899        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
900    }
901    if let Some(ref token) = configuration.bearer_access_token {
902        req_builder = req_builder.bearer_auth(token.to_owned());
903    };
904
905    let req = req_builder.build()?;
906    let resp = configuration.client.execute(req).await?;
907
908    let status = resp.status();
909    let content_type = resp
910        .headers()
911        .get("content-type")
912        .and_then(|v| v.to_str().ok())
913        .unwrap_or("application/octet-stream");
914    let content_type = super::ContentType::from(content_type);
915
916    if !status.is_client_error() && !status.is_server_error() {
917        let content = resp.text().await?;
918        match content_type {
919            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
920            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
921            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
922        }
923    } else {
924        let content = resp.text().await?;
925        let entity: Option<WorkspaceCompleteTaskError> = serde_json::from_str(&content).ok();
926        Err(Error::ResponseError(ResponseContent { status, content, entity }))
927    }
928}
929
930pub async fn workspace_complete_task_alias(configuration: &configuration::Configuration, org: &str, workspace: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCompleteTaskAliasError>> {
931    // add a prefix to parameters to efficiently prevent name collisions
932    let p_path_org = org;
933    let p_path_workspace = workspace;
934    let p_body_request_body = request_body;
935
936    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/complete/task", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
937    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
938
939    if let Some(ref user_agent) = configuration.user_agent {
940        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
941    }
942    if let Some(ref token) = configuration.bearer_access_token {
943        req_builder = req_builder.bearer_auth(token.to_owned());
944    };
945    req_builder = req_builder.json(&p_body_request_body);
946
947    let req = req_builder.build()?;
948    let resp = configuration.client.execute(req).await?;
949
950    let status = resp.status();
951    let content_type = resp
952        .headers()
953        .get("content-type")
954        .and_then(|v| v.to_str().ok())
955        .unwrap_or("application/octet-stream");
956    let content_type = super::ContentType::from(content_type);
957
958    if !status.is_client_error() && !status.is_server_error() {
959        let content = resp.text().await?;
960        match content_type {
961            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
962            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
963            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
964        }
965    } else {
966        let content = resp.text().await?;
967        let entity: Option<WorkspaceCompleteTaskAliasError> = serde_json::from_str(&content).ok();
968        Err(Error::ResponseError(ResponseContent { status, content, entity }))
969    }
970}
971
972pub async fn workspace_create_task(configuration: &configuration::Configuration, org: &str, workspace: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCreateTaskError>> {
973    // add a prefix to parameters to efficiently prevent name collisions
974    let p_path_org = org;
975    let p_path_workspace = workspace;
976    let p_body_request_body = request_body;
977
978    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
979    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
980
981    if let Some(ref user_agent) = configuration.user_agent {
982        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
983    }
984    if let Some(ref token) = configuration.bearer_access_token {
985        req_builder = req_builder.bearer_auth(token.to_owned());
986    };
987    req_builder = req_builder.json(&p_body_request_body);
988
989    let req = req_builder.build()?;
990    let resp = configuration.client.execute(req).await?;
991
992    let status = resp.status();
993    let content_type = resp
994        .headers()
995        .get("content-type")
996        .and_then(|v| v.to_str().ok())
997        .unwrap_or("application/octet-stream");
998    let content_type = super::ContentType::from(content_type);
999
1000    if !status.is_client_error() && !status.is_server_error() {
1001        let content = resp.text().await?;
1002        match content_type {
1003            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1004            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1005            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1006        }
1007    } else {
1008        let content = resp.text().await?;
1009        let entity: Option<WorkspaceCreateTaskError> = serde_json::from_str(&content).ok();
1010        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1011    }
1012}
1013
1014pub async fn workspace_create_task_alias(configuration: &configuration::Configuration, org: &str, workspace: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCreateTaskAliasError>> {
1015    // add a prefix to parameters to efficiently prevent name collisions
1016    let p_path_org = org;
1017    let p_path_workspace = workspace;
1018    let p_body_request_body = request_body;
1019
1020    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/task", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1021    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1022
1023    if let Some(ref user_agent) = configuration.user_agent {
1024        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1025    }
1026    if let Some(ref token) = configuration.bearer_access_token {
1027        req_builder = req_builder.bearer_auth(token.to_owned());
1028    };
1029    req_builder = req_builder.json(&p_body_request_body);
1030
1031    let req = req_builder.build()?;
1032    let resp = configuration.client.execute(req).await?;
1033
1034    let status = resp.status();
1035    let content_type = resp
1036        .headers()
1037        .get("content-type")
1038        .and_then(|v| v.to_str().ok())
1039        .unwrap_or("application/octet-stream");
1040    let content_type = super::ContentType::from(content_type);
1041
1042    if !status.is_client_error() && !status.is_server_error() {
1043        let content = resp.text().await?;
1044        match content_type {
1045            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1046            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1047            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1048        }
1049    } else {
1050        let content = resp.text().await?;
1051        let entity: Option<WorkspaceCreateTaskAliasError> = serde_json::from_str(&content).ok();
1052        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1053    }
1054}
1055
1056pub async fn workspace_delete_task(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<(), Error<WorkspaceDeleteTaskError>> {
1057    // add a prefix to parameters to efficiently prevent name collisions
1058    let p_path_org = org;
1059    let p_path_workspace = workspace;
1060    let p_path_id = id;
1061
1062    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1063    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1064
1065    if let Some(ref user_agent) = configuration.user_agent {
1066        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1067    }
1068    if let Some(ref token) = configuration.bearer_access_token {
1069        req_builder = req_builder.bearer_auth(token.to_owned());
1070    };
1071
1072    let req = req_builder.build()?;
1073    let resp = configuration.client.execute(req).await?;
1074
1075    let status = resp.status();
1076
1077    if !status.is_client_error() && !status.is_server_error() {
1078        Ok(())
1079    } else {
1080        let content = resp.text().await?;
1081        let entity: Option<WorkspaceDeleteTaskError> = serde_json::from_str(&content).ok();
1082        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1083    }
1084}
1085
1086pub async fn workspace_get_task(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetTaskError>> {
1087    // add a prefix to parameters to efficiently prevent name collisions
1088    let p_path_org = org;
1089    let p_path_workspace = workspace;
1090    let p_path_id = id;
1091
1092    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1093    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1094
1095    if let Some(ref user_agent) = configuration.user_agent {
1096        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1097    }
1098    if let Some(ref token) = configuration.bearer_access_token {
1099        req_builder = req_builder.bearer_auth(token.to_owned());
1100    };
1101
1102    let req = req_builder.build()?;
1103    let resp = configuration.client.execute(req).await?;
1104
1105    let status = resp.status();
1106    let content_type = resp
1107        .headers()
1108        .get("content-type")
1109        .and_then(|v| v.to_str().ok())
1110        .unwrap_or("application/octet-stream");
1111    let content_type = super::ContentType::from(content_type);
1112
1113    if !status.is_client_error() && !status.is_server_error() {
1114        let content = resp.text().await?;
1115        match content_type {
1116            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1117            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1118            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1119        }
1120    } else {
1121        let content = resp.text().await?;
1122        let entity: Option<WorkspaceGetTaskError> = serde_json::from_str(&content).ok();
1123        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1124    }
1125}
1126
1127pub async fn workspace_list_task_providers(configuration: &configuration::Configuration, org: &str, workspace: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListTaskProvidersError>> {
1128    // add a prefix to parameters to efficiently prevent name collisions
1129    let p_path_org = org;
1130    let p_path_workspace = workspace;
1131
1132    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/providers", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1133    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1134
1135    if let Some(ref user_agent) = configuration.user_agent {
1136        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1137    }
1138    if let Some(ref token) = configuration.bearer_access_token {
1139        req_builder = req_builder.bearer_auth(token.to_owned());
1140    };
1141
1142    let req = req_builder.build()?;
1143    let resp = configuration.client.execute(req).await?;
1144
1145    let status = resp.status();
1146    let content_type = resp
1147        .headers()
1148        .get("content-type")
1149        .and_then(|v| v.to_str().ok())
1150        .unwrap_or("application/octet-stream");
1151    let content_type = super::ContentType::from(content_type);
1152
1153    if !status.is_client_error() && !status.is_server_error() {
1154        let content = resp.text().await?;
1155        match content_type {
1156            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1157            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1158            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1159        }
1160    } else {
1161        let content = resp.text().await?;
1162        let entity: Option<WorkspaceListTaskProvidersError> = serde_json::from_str(&content).ok();
1163        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1164    }
1165}
1166
1167pub async fn workspace_list_tasks(configuration: &configuration::Configuration, org: &str, workspace: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListTasksError>> {
1168    // add a prefix to parameters to efficiently prevent name collisions
1169    let p_path_org = org;
1170    let p_path_workspace = workspace;
1171
1172    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1173    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1174
1175    if let Some(ref user_agent) = configuration.user_agent {
1176        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1177    }
1178    if let Some(ref token) = configuration.bearer_access_token {
1179        req_builder = req_builder.bearer_auth(token.to_owned());
1180    };
1181
1182    let req = req_builder.build()?;
1183    let resp = configuration.client.execute(req).await?;
1184
1185    let status = resp.status();
1186    let content_type = resp
1187        .headers()
1188        .get("content-type")
1189        .and_then(|v| v.to_str().ok())
1190        .unwrap_or("application/octet-stream");
1191    let content_type = super::ContentType::from(content_type);
1192
1193    if !status.is_client_error() && !status.is_server_error() {
1194        let content = resp.text().await?;
1195        match content_type {
1196            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1197            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1198            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1199        }
1200    } else {
1201        let content = resp.text().await?;
1202        let entity: Option<WorkspaceListTasksError> = serde_json::from_str(&content).ok();
1203        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1204    }
1205}
1206
1207pub async fn workspace_list_tasks_alias(configuration: &configuration::Configuration, org: &str, workspace: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListTasksAliasError>> {
1208    // add a prefix to parameters to efficiently prevent name collisions
1209    let p_path_org = org;
1210    let p_path_workspace = workspace;
1211
1212    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/tasks", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1213    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1214
1215    if let Some(ref user_agent) = configuration.user_agent {
1216        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1217    }
1218    if let Some(ref token) = configuration.bearer_access_token {
1219        req_builder = req_builder.bearer_auth(token.to_owned());
1220    };
1221
1222    let req = req_builder.build()?;
1223    let resp = configuration.client.execute(req).await?;
1224
1225    let status = resp.status();
1226    let content_type = resp
1227        .headers()
1228        .get("content-type")
1229        .and_then(|v| v.to_str().ok())
1230        .unwrap_or("application/octet-stream");
1231    let content_type = super::ContentType::from(content_type);
1232
1233    if !status.is_client_error() && !status.is_server_error() {
1234        let content = resp.text().await?;
1235        match content_type {
1236            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1237            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1238            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1239        }
1240    } else {
1241        let content = resp.text().await?;
1242        let entity: Option<WorkspaceListTasksAliasError> = serde_json::from_str(&content).ok();
1243        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1244    }
1245}
1246
1247pub async fn workspace_update_task(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceUpdateTaskError>> {
1248    // add a prefix to parameters to efficiently prevent name collisions
1249    let p_path_org = org;
1250    let p_path_workspace = workspace;
1251    let p_path_id = id;
1252    let p_body_request_body = request_body;
1253
1254    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1255    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1256
1257    if let Some(ref user_agent) = configuration.user_agent {
1258        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1259    }
1260    if let Some(ref token) = configuration.bearer_access_token {
1261        req_builder = req_builder.bearer_auth(token.to_owned());
1262    };
1263    req_builder = req_builder.json(&p_body_request_body);
1264
1265    let req = req_builder.build()?;
1266    let resp = configuration.client.execute(req).await?;
1267
1268    let status = resp.status();
1269    let content_type = resp
1270        .headers()
1271        .get("content-type")
1272        .and_then(|v| v.to_str().ok())
1273        .unwrap_or("application/octet-stream");
1274    let content_type = super::ContentType::from(content_type);
1275
1276    if !status.is_client_error() && !status.is_server_error() {
1277        let content = resp.text().await?;
1278        match content_type {
1279            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1280            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1281            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1282        }
1283    } else {
1284        let content = resp.text().await?;
1285        let entity: Option<WorkspaceUpdateTaskError> = serde_json::from_str(&content).ok();
1286        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1287    }
1288}
1289
1290pub async fn workspace_update_task_alias(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceUpdateTaskAliasError>> {
1291    // add a prefix to parameters to efficiently prevent name collisions
1292    let p_path_org = org;
1293    let p_path_workspace = workspace;
1294    let p_path_id = id;
1295    let p_body_request_body = request_body;
1296
1297    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/tasks/task/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1298    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1299
1300    if let Some(ref user_agent) = configuration.user_agent {
1301        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1302    }
1303    if let Some(ref token) = configuration.bearer_access_token {
1304        req_builder = req_builder.bearer_auth(token.to_owned());
1305    };
1306    req_builder = req_builder.json(&p_body_request_body);
1307
1308    let req = req_builder.build()?;
1309    let resp = configuration.client.execute(req).await?;
1310
1311    let status = resp.status();
1312    let content_type = resp
1313        .headers()
1314        .get("content-type")
1315        .and_then(|v| v.to_str().ok())
1316        .unwrap_or("application/octet-stream");
1317    let content_type = super::ContentType::from(content_type);
1318
1319    if !status.is_client_error() && !status.is_server_error() {
1320        let content = resp.text().await?;
1321        match content_type {
1322            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1323            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1324            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1325        }
1326    } else {
1327        let content = resp.text().await?;
1328        let entity: Option<WorkspaceUpdateTaskAliasError> = serde_json::from_str(&content).ok();
1329        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1330    }
1331}
1332