Skip to main content

spatio_sdk/apis/
misc_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 [`delete_pinned_platform`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeletePinnedPlatformError {
22    Status401(models::ApiError),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`get_bootstrap`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum GetBootstrapError {
30    Status401(models::ApiError),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`get_onboarding_invitations`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum GetOnboardingInvitationsError {
38    Status401(models::ApiError),
39    UnknownValue(serde_json::Value),
40}
41
42/// struct for typed errors of method [`get_pinned_platforms`]
43#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum GetPinnedPlatformsError {
46    Status401(models::ApiError),
47    UnknownValue(serde_json::Value),
48}
49
50/// struct for typed errors of method [`get_platform_preferences`]
51#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum GetPlatformPreferencesError {
54    Status401(models::ApiError),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`get_platform_settings_legacy`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GetPlatformSettingsLegacyError {
62    Status401(models::ApiError),
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`get_threads_status`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetThreadsStatusError {
70    Status401(models::ApiError),
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_user_permissions`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetUserPermissionsError {
78    Status401(models::ApiError),
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`get_workspace_activity`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GetWorkspaceActivityError {
86    Status401(models::ApiError),
87    UnknownValue(serde_json::Value),
88}
89
90/// struct for typed errors of method [`get_workspace_layout`]
91#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum GetWorkspaceLayoutError {
94    Status401(models::ApiError),
95    UnknownValue(serde_json::Value),
96}
97
98/// struct for typed errors of method [`put_pinned_platform`]
99#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum PutPinnedPlatformError {
102    Status401(models::ApiError),
103    UnknownValue(serde_json::Value),
104}
105
106/// struct for typed errors of method [`put_platform_preferences`]
107#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum PutPlatformPreferencesError {
110    Status401(models::ApiError),
111    UnknownValue(serde_json::Value),
112}
113
114/// struct for typed errors of method [`put_workspace_layout`]
115#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum PutWorkspaceLayoutError {
118    Status401(models::ApiError),
119    UnknownValue(serde_json::Value),
120}
121
122/// struct for typed errors of method [`reorder_pinned_platforms`]
123#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum ReorderPinnedPlatformsError {
126    Status401(models::ApiError),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`reset_platform_preferences`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ResetPlatformPreferencesError {
134    Status401(models::ApiError),
135    UnknownValue(serde_json::Value),
136}
137
138/// struct for typed errors of method [`update_user_profile`]
139#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum UpdateUserProfileError {
142    Status401(models::ApiError),
143    UnknownValue(serde_json::Value),
144}
145
146/// struct for typed errors of method [`validate_organization_slug`]
147#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(untagged)]
149pub enum ValidateOrganizationSlugError {
150    Status401(models::ApiError),
151    UnknownValue(serde_json::Value),
152}
153
154/// struct for typed errors of method [`validate_workspace_slug`]
155#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum ValidateWorkspaceSlugError {
158    Status401(models::ApiError),
159    UnknownValue(serde_json::Value),
160}
161
162
163pub async fn delete_pinned_platform(configuration: &configuration::Configuration, platform_id: &str) -> Result<(), Error<DeletePinnedPlatformError>> {
164    // add a prefix to parameters to efficiently prevent name collisions
165    let p_path_platform_id = platform_id;
166
167    let uri_str = format!("{}/v1/pinned-platforms/{platformId}", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
168    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
169
170    if let Some(ref user_agent) = configuration.user_agent {
171        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
172    }
173    if let Some(ref token) = configuration.bearer_access_token {
174        req_builder = req_builder.bearer_auth(token.to_owned());
175    };
176
177    let req = req_builder.build()?;
178    let resp = configuration.client.execute(req).await?;
179
180    let status = resp.status();
181
182    if !status.is_client_error() && !status.is_server_error() {
183        Ok(())
184    } else {
185        let content = resp.text().await?;
186        let entity: Option<DeletePinnedPlatformError> = serde_json::from_str(&content).ok();
187        Err(Error::ResponseError(ResponseContent { status, content, entity }))
188    }
189}
190
191pub async fn get_bootstrap(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetBootstrapError>> {
192
193    let uri_str = format!("{}/v1/bootstrap", configuration.base_path);
194    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
195
196    if let Some(ref user_agent) = configuration.user_agent {
197        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
198    }
199    if let Some(ref token) = configuration.bearer_access_token {
200        req_builder = req_builder.bearer_auth(token.to_owned());
201    };
202
203    let req = req_builder.build()?;
204    let resp = configuration.client.execute(req).await?;
205
206    let status = resp.status();
207    let content_type = resp
208        .headers()
209        .get("content-type")
210        .and_then(|v| v.to_str().ok())
211        .unwrap_or("application/octet-stream");
212    let content_type = super::ContentType::from(content_type);
213
214    if !status.is_client_error() && !status.is_server_error() {
215        let content = resp.text().await?;
216        match content_type {
217            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
218            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;`"))),
219            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;`")))),
220        }
221    } else {
222        let content = resp.text().await?;
223        let entity: Option<GetBootstrapError> = serde_json::from_str(&content).ok();
224        Err(Error::ResponseError(ResponseContent { status, content, entity }))
225    }
226}
227
228pub async fn get_onboarding_invitations(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetOnboardingInvitationsError>> {
229
230    let uri_str = format!("{}/v1/onboarding/invitations", configuration.base_path);
231    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
232
233    if let Some(ref user_agent) = configuration.user_agent {
234        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
235    }
236    if let Some(ref token) = configuration.bearer_access_token {
237        req_builder = req_builder.bearer_auth(token.to_owned());
238    };
239
240    let req = req_builder.build()?;
241    let resp = configuration.client.execute(req).await?;
242
243    let status = resp.status();
244    let content_type = resp
245        .headers()
246        .get("content-type")
247        .and_then(|v| v.to_str().ok())
248        .unwrap_or("application/octet-stream");
249    let content_type = super::ContentType::from(content_type);
250
251    if !status.is_client_error() && !status.is_server_error() {
252        let content = resp.text().await?;
253        match content_type {
254            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
255            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;`"))),
256            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;`")))),
257        }
258    } else {
259        let content = resp.text().await?;
260        let entity: Option<GetOnboardingInvitationsError> = serde_json::from_str(&content).ok();
261        Err(Error::ResponseError(ResponseContent { status, content, entity }))
262    }
263}
264
265pub async fn get_pinned_platforms(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPinnedPlatformsError>> {
266
267    let uri_str = format!("{}/v1/pinned-platforms", configuration.base_path);
268    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
269
270    if let Some(ref user_agent) = configuration.user_agent {
271        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
272    }
273    if let Some(ref token) = configuration.bearer_access_token {
274        req_builder = req_builder.bearer_auth(token.to_owned());
275    };
276
277    let req = req_builder.build()?;
278    let resp = configuration.client.execute(req).await?;
279
280    let status = resp.status();
281    let content_type = resp
282        .headers()
283        .get("content-type")
284        .and_then(|v| v.to_str().ok())
285        .unwrap_or("application/octet-stream");
286    let content_type = super::ContentType::from(content_type);
287
288    if !status.is_client_error() && !status.is_server_error() {
289        let content = resp.text().await?;
290        match content_type {
291            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
292            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;`"))),
293            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;`")))),
294        }
295    } else {
296        let content = resp.text().await?;
297        let entity: Option<GetPinnedPlatformsError> = serde_json::from_str(&content).ok();
298        Err(Error::ResponseError(ResponseContent { status, content, entity }))
299    }
300}
301
302pub async fn get_platform_preferences(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPlatformPreferencesError>> {
303
304    let uri_str = format!("{}/v1/platform-preferences", configuration.base_path);
305    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
306
307    if let Some(ref user_agent) = configuration.user_agent {
308        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
309    }
310    if let Some(ref token) = configuration.bearer_access_token {
311        req_builder = req_builder.bearer_auth(token.to_owned());
312    };
313
314    let req = req_builder.build()?;
315    let resp = configuration.client.execute(req).await?;
316
317    let status = resp.status();
318    let content_type = resp
319        .headers()
320        .get("content-type")
321        .and_then(|v| v.to_str().ok())
322        .unwrap_or("application/octet-stream");
323    let content_type = super::ContentType::from(content_type);
324
325    if !status.is_client_error() && !status.is_server_error() {
326        let content = resp.text().await?;
327        match content_type {
328            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
329            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;`"))),
330            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;`")))),
331        }
332    } else {
333        let content = resp.text().await?;
334        let entity: Option<GetPlatformPreferencesError> = serde_json::from_str(&content).ok();
335        Err(Error::ResponseError(ResponseContent { status, content, entity }))
336    }
337}
338
339pub async fn get_platform_settings_legacy(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPlatformSettingsLegacyError>> {
340
341    let uri_str = format!("{}/v1/settings/platform", configuration.base_path);
342    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
343
344    if let Some(ref user_agent) = configuration.user_agent {
345        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
346    }
347    if let Some(ref token) = configuration.bearer_access_token {
348        req_builder = req_builder.bearer_auth(token.to_owned());
349    };
350
351    let req = req_builder.build()?;
352    let resp = configuration.client.execute(req).await?;
353
354    let status = resp.status();
355    let content_type = resp
356        .headers()
357        .get("content-type")
358        .and_then(|v| v.to_str().ok())
359        .unwrap_or("application/octet-stream");
360    let content_type = super::ContentType::from(content_type);
361
362    if !status.is_client_error() && !status.is_server_error() {
363        let content = resp.text().await?;
364        match content_type {
365            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
366            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;`"))),
367            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;`")))),
368        }
369    } else {
370        let content = resp.text().await?;
371        let entity: Option<GetPlatformSettingsLegacyError> = serde_json::from_str(&content).ok();
372        Err(Error::ResponseError(ResponseContent { status, content, entity }))
373    }
374}
375
376pub async fn get_threads_status(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetThreadsStatusError>> {
377
378    let uri_str = format!("{}/v1/threads/status", configuration.base_path);
379    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
380
381    if let Some(ref user_agent) = configuration.user_agent {
382        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
383    }
384    if let Some(ref token) = configuration.bearer_access_token {
385        req_builder = req_builder.bearer_auth(token.to_owned());
386    };
387
388    let req = req_builder.build()?;
389    let resp = configuration.client.execute(req).await?;
390
391    let status = resp.status();
392    let content_type = resp
393        .headers()
394        .get("content-type")
395        .and_then(|v| v.to_str().ok())
396        .unwrap_or("application/octet-stream");
397    let content_type = super::ContentType::from(content_type);
398
399    if !status.is_client_error() && !status.is_server_error() {
400        let content = resp.text().await?;
401        match content_type {
402            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
403            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;`"))),
404            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;`")))),
405        }
406    } else {
407        let content = resp.text().await?;
408        let entity: Option<GetThreadsStatusError> = serde_json::from_str(&content).ok();
409        Err(Error::ResponseError(ResponseContent { status, content, entity }))
410    }
411}
412
413pub async fn get_user_permissions(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetUserPermissionsError>> {
414
415    let uri_str = format!("{}/v1/user/permissions", configuration.base_path);
416    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
417
418    if let Some(ref user_agent) = configuration.user_agent {
419        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
420    }
421    if let Some(ref token) = configuration.bearer_access_token {
422        req_builder = req_builder.bearer_auth(token.to_owned());
423    };
424
425    let req = req_builder.build()?;
426    let resp = configuration.client.execute(req).await?;
427
428    let status = resp.status();
429    let content_type = resp
430        .headers()
431        .get("content-type")
432        .and_then(|v| v.to_str().ok())
433        .unwrap_or("application/octet-stream");
434    let content_type = super::ContentType::from(content_type);
435
436    if !status.is_client_error() && !status.is_server_error() {
437        let content = resp.text().await?;
438        match content_type {
439            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
440            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;`"))),
441            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;`")))),
442        }
443    } else {
444        let content = resp.text().await?;
445        let entity: Option<GetUserPermissionsError> = serde_json::from_str(&content).ok();
446        Err(Error::ResponseError(ResponseContent { status, content, entity }))
447    }
448}
449
450pub async fn get_workspace_activity(configuration: &configuration::Configuration, workspace_id: Option<&str>, limit: Option<i32>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetWorkspaceActivityError>> {
451    // add a prefix to parameters to efficiently prevent name collisions
452    let p_query_workspace_id = workspace_id;
453    let p_query_limit = limit;
454
455    let uri_str = format!("{}/v1/workspace-activity", configuration.base_path);
456    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
457
458    if let Some(ref param_value) = p_query_workspace_id {
459        req_builder = req_builder.query(&[("workspaceId", &param_value.to_string())]);
460    }
461    if let Some(ref param_value) = p_query_limit {
462        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
463    }
464    if let Some(ref user_agent) = configuration.user_agent {
465        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
466    }
467    if let Some(ref token) = configuration.bearer_access_token {
468        req_builder = req_builder.bearer_auth(token.to_owned());
469    };
470
471    let req = req_builder.build()?;
472    let resp = configuration.client.execute(req).await?;
473
474    let status = resp.status();
475    let content_type = resp
476        .headers()
477        .get("content-type")
478        .and_then(|v| v.to_str().ok())
479        .unwrap_or("application/octet-stream");
480    let content_type = super::ContentType::from(content_type);
481
482    if !status.is_client_error() && !status.is_server_error() {
483        let content = resp.text().await?;
484        match content_type {
485            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
486            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;`"))),
487            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;`")))),
488        }
489    } else {
490        let content = resp.text().await?;
491        let entity: Option<GetWorkspaceActivityError> = serde_json::from_str(&content).ok();
492        Err(Error::ResponseError(ResponseContent { status, content, entity }))
493    }
494}
495
496pub async fn get_workspace_layout(configuration: &configuration::Configuration, workspace_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetWorkspaceLayoutError>> {
497    // add a prefix to parameters to efficiently prevent name collisions
498    let p_path_workspace_id = workspace_id;
499
500    let uri_str = format!("{}/v1/layout/{workspaceId}", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id));
501    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
502
503    if let Some(ref user_agent) = configuration.user_agent {
504        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
505    }
506    if let Some(ref token) = configuration.bearer_access_token {
507        req_builder = req_builder.bearer_auth(token.to_owned());
508    };
509
510    let req = req_builder.build()?;
511    let resp = configuration.client.execute(req).await?;
512
513    let status = resp.status();
514    let content_type = resp
515        .headers()
516        .get("content-type")
517        .and_then(|v| v.to_str().ok())
518        .unwrap_or("application/octet-stream");
519    let content_type = super::ContentType::from(content_type);
520
521    if !status.is_client_error() && !status.is_server_error() {
522        let content = resp.text().await?;
523        match content_type {
524            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
525            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;`"))),
526            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;`")))),
527        }
528    } else {
529        let content = resp.text().await?;
530        let entity: Option<GetWorkspaceLayoutError> = serde_json::from_str(&content).ok();
531        Err(Error::ResponseError(ResponseContent { status, content, entity }))
532    }
533}
534
535pub async fn put_pinned_platform(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<(), Error<PutPinnedPlatformError>> {
536    // add a prefix to parameters to efficiently prevent name collisions
537    let p_body_request_body = request_body;
538
539    let uri_str = format!("{}/v1/pinned-platforms", configuration.base_path);
540    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
541
542    if let Some(ref user_agent) = configuration.user_agent {
543        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
544    }
545    if let Some(ref token) = configuration.bearer_access_token {
546        req_builder = req_builder.bearer_auth(token.to_owned());
547    };
548    req_builder = req_builder.json(&p_body_request_body);
549
550    let req = req_builder.build()?;
551    let resp = configuration.client.execute(req).await?;
552
553    let status = resp.status();
554
555    if !status.is_client_error() && !status.is_server_error() {
556        Ok(())
557    } else {
558        let content = resp.text().await?;
559        let entity: Option<PutPinnedPlatformError> = serde_json::from_str(&content).ok();
560        Err(Error::ResponseError(ResponseContent { status, content, entity }))
561    }
562}
563
564pub async fn put_platform_preferences(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<(), Error<PutPlatformPreferencesError>> {
565    // add a prefix to parameters to efficiently prevent name collisions
566    let p_body_request_body = request_body;
567
568    let uri_str = format!("{}/v1/platform-preferences", configuration.base_path);
569    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
570
571    if let Some(ref user_agent) = configuration.user_agent {
572        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
573    }
574    if let Some(ref token) = configuration.bearer_access_token {
575        req_builder = req_builder.bearer_auth(token.to_owned());
576    };
577    req_builder = req_builder.json(&p_body_request_body);
578
579    let req = req_builder.build()?;
580    let resp = configuration.client.execute(req).await?;
581
582    let status = resp.status();
583
584    if !status.is_client_error() && !status.is_server_error() {
585        Ok(())
586    } else {
587        let content = resp.text().await?;
588        let entity: Option<PutPlatformPreferencesError> = serde_json::from_str(&content).ok();
589        Err(Error::ResponseError(ResponseContent { status, content, entity }))
590    }
591}
592
593pub async fn put_workspace_layout(configuration: &configuration::Configuration, workspace_id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<(), Error<PutWorkspaceLayoutError>> {
594    // add a prefix to parameters to efficiently prevent name collisions
595    let p_path_workspace_id = workspace_id;
596    let p_body_request_body = request_body;
597
598    let uri_str = format!("{}/v1/layout/{workspaceId}", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id));
599    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
600
601    if let Some(ref user_agent) = configuration.user_agent {
602        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
603    }
604    if let Some(ref token) = configuration.bearer_access_token {
605        req_builder = req_builder.bearer_auth(token.to_owned());
606    };
607    req_builder = req_builder.json(&p_body_request_body);
608
609    let req = req_builder.build()?;
610    let resp = configuration.client.execute(req).await?;
611
612    let status = resp.status();
613
614    if !status.is_client_error() && !status.is_server_error() {
615        Ok(())
616    } else {
617        let content = resp.text().await?;
618        let entity: Option<PutWorkspaceLayoutError> = serde_json::from_str(&content).ok();
619        Err(Error::ResponseError(ResponseContent { status, content, entity }))
620    }
621}
622
623pub async fn reorder_pinned_platforms(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<(), Error<ReorderPinnedPlatformsError>> {
624    // add a prefix to parameters to efficiently prevent name collisions
625    let p_body_request_body = request_body;
626
627    let uri_str = format!("{}/v1/pinned-platforms/reorder", configuration.base_path);
628    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
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(ref token) = configuration.bearer_access_token {
634        req_builder = req_builder.bearer_auth(token.to_owned());
635    };
636    req_builder = req_builder.json(&p_body_request_body);
637
638    let req = req_builder.build()?;
639    let resp = configuration.client.execute(req).await?;
640
641    let status = resp.status();
642
643    if !status.is_client_error() && !status.is_server_error() {
644        Ok(())
645    } else {
646        let content = resp.text().await?;
647        let entity: Option<ReorderPinnedPlatformsError> = serde_json::from_str(&content).ok();
648        Err(Error::ResponseError(ResponseContent { status, content, entity }))
649    }
650}
651
652pub async fn reset_platform_preferences(configuration: &configuration::Configuration, ) -> Result<(), Error<ResetPlatformPreferencesError>> {
653
654    let uri_str = format!("{}/v1/platform-preferences/reset", configuration.base_path);
655    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
656
657    if let Some(ref user_agent) = configuration.user_agent {
658        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
659    }
660    if let Some(ref token) = configuration.bearer_access_token {
661        req_builder = req_builder.bearer_auth(token.to_owned());
662    };
663
664    let req = req_builder.build()?;
665    let resp = configuration.client.execute(req).await?;
666
667    let status = resp.status();
668
669    if !status.is_client_error() && !status.is_server_error() {
670        Ok(())
671    } else {
672        let content = resp.text().await?;
673        let entity: Option<ResetPlatformPreferencesError> = serde_json::from_str(&content).ok();
674        Err(Error::ResponseError(ResponseContent { status, content, entity }))
675    }
676}
677
678pub async fn update_user_profile(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<UpdateUserProfileError>> {
679    // add a prefix to parameters to efficiently prevent name collisions
680    let p_body_request_body = request_body;
681
682    let uri_str = format!("{}/v1/user/profile", configuration.base_path);
683    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
684
685    if let Some(ref user_agent) = configuration.user_agent {
686        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
687    }
688    if let Some(ref token) = configuration.bearer_access_token {
689        req_builder = req_builder.bearer_auth(token.to_owned());
690    };
691    req_builder = req_builder.json(&p_body_request_body);
692
693    let req = req_builder.build()?;
694    let resp = configuration.client.execute(req).await?;
695
696    let status = resp.status();
697    let content_type = resp
698        .headers()
699        .get("content-type")
700        .and_then(|v| v.to_str().ok())
701        .unwrap_or("application/octet-stream");
702    let content_type = super::ContentType::from(content_type);
703
704    if !status.is_client_error() && !status.is_server_error() {
705        let content = resp.text().await?;
706        match content_type {
707            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
708            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;`"))),
709            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;`")))),
710        }
711    } else {
712        let content = resp.text().await?;
713        let entity: Option<UpdateUserProfileError> = serde_json::from_str(&content).ok();
714        Err(Error::ResponseError(ResponseContent { status, content, entity }))
715    }
716}
717
718pub async fn validate_organization_slug(configuration: &configuration::Configuration, slug: Option<&str>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ValidateOrganizationSlugError>> {
719    // add a prefix to parameters to efficiently prevent name collisions
720    let p_query_slug = slug;
721
722    let uri_str = format!("{}/v1/validate-slug/organization", configuration.base_path);
723    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
724
725    if let Some(ref param_value) = p_query_slug {
726        req_builder = req_builder.query(&[("slug", &param_value.to_string())]);
727    }
728    if let Some(ref user_agent) = configuration.user_agent {
729        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
730    }
731    if let Some(ref token) = configuration.bearer_access_token {
732        req_builder = req_builder.bearer_auth(token.to_owned());
733    };
734
735    let req = req_builder.build()?;
736    let resp = configuration.client.execute(req).await?;
737
738    let status = resp.status();
739    let content_type = resp
740        .headers()
741        .get("content-type")
742        .and_then(|v| v.to_str().ok())
743        .unwrap_or("application/octet-stream");
744    let content_type = super::ContentType::from(content_type);
745
746    if !status.is_client_error() && !status.is_server_error() {
747        let content = resp.text().await?;
748        match content_type {
749            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
750            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;`"))),
751            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;`")))),
752        }
753    } else {
754        let content = resp.text().await?;
755        let entity: Option<ValidateOrganizationSlugError> = serde_json::from_str(&content).ok();
756        Err(Error::ResponseError(ResponseContent { status, content, entity }))
757    }
758}
759
760pub async fn validate_workspace_slug(configuration: &configuration::Configuration, slug: Option<&str>, organization_id: Option<&str>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ValidateWorkspaceSlugError>> {
761    // add a prefix to parameters to efficiently prevent name collisions
762    let p_query_slug = slug;
763    let p_query_organization_id = organization_id;
764
765    let uri_str = format!("{}/v1/validate-slug/workspace", configuration.base_path);
766    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
767
768    if let Some(ref param_value) = p_query_slug {
769        req_builder = req_builder.query(&[("slug", &param_value.to_string())]);
770    }
771    if let Some(ref param_value) = p_query_organization_id {
772        req_builder = req_builder.query(&[("organizationId", &param_value.to_string())]);
773    }
774    if let Some(ref user_agent) = configuration.user_agent {
775        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
776    }
777    if let Some(ref token) = configuration.bearer_access_token {
778        req_builder = req_builder.bearer_auth(token.to_owned());
779    };
780
781    let req = req_builder.build()?;
782    let resp = configuration.client.execute(req).await?;
783
784    let status = resp.status();
785    let content_type = resp
786        .headers()
787        .get("content-type")
788        .and_then(|v| v.to_str().ok())
789        .unwrap_or("application/octet-stream");
790    let content_type = super::ContentType::from(content_type);
791
792    if !status.is_client_error() && !status.is_server_error() {
793        let content = resp.text().await?;
794        match content_type {
795            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
796            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;`"))),
797            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;`")))),
798        }
799    } else {
800        let content = resp.text().await?;
801        let entity: Option<ValidateWorkspaceSlugError> = serde_json::from_str(&content).ok();
802        Err(Error::ResponseError(ResponseContent { status, content, entity }))
803    }
804}
805