Skip to main content

spatio_sdk/apis/
workspaces_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 [`accept_workspace_invitation`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AcceptWorkspaceInvitationError {
22    Status401(models::ApiError),
23    Status404(models::ApiError),
24    Status410(models::ApiError),
25    UnknownValue(serde_json::Value),
26}
27
28/// struct for typed errors of method [`add_workspace_member`]
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum AddWorkspaceMemberError {
32    Status401(models::ApiError),
33    Status403(models::ApiError),
34    UnknownValue(serde_json::Value),
35}
36
37/// struct for typed errors of method [`create_workspace`]
38#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum CreateWorkspaceError {
41    Status400(models::ApiError),
42    Status401(models::ApiError),
43    Status403(models::ApiError),
44    UnknownValue(serde_json::Value),
45}
46
47/// struct for typed errors of method [`create_workspace_invitation`]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum CreateWorkspaceInvitationError {
51    Status401(models::ApiError),
52    Status402(models::ApiError),
53    UnknownValue(serde_json::Value),
54}
55
56/// struct for typed errors of method [`get_public_invitation`]
57#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum GetPublicInvitationError {
60    Status404(models::ApiError),
61    Status410(models::ApiError),
62    UnknownValue(serde_json::Value),
63}
64
65/// struct for typed errors of method [`get_workspace`]
66#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum GetWorkspaceError {
69    Status401(models::ApiError),
70    Status403(models::ApiError),
71    Status404(models::ApiError),
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`list_my_workspaces`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum ListMyWorkspacesError {
79    Status401(models::ApiError),
80    UnknownValue(serde_json::Value),
81}
82
83/// struct for typed errors of method [`list_workspace_invitations`]
84#[derive(Debug, Clone, Serialize, Deserialize)]
85#[serde(untagged)]
86pub enum ListWorkspaceInvitationsError {
87    Status401(models::ApiError),
88    UnknownValue(serde_json::Value),
89}
90
91/// struct for typed errors of method [`list_workspace_members`]
92#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum ListWorkspaceMembersError {
95    Status401(models::ApiError),
96    UnknownValue(serde_json::Value),
97}
98
99/// struct for typed errors of method [`remove_workspace_member`]
100#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum RemoveWorkspaceMemberError {
103    Status401(models::ApiError),
104    Status403(models::ApiError),
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`revoke_workspace_invitation`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum RevokeWorkspaceInvitationError {
112    Status401(models::ApiError),
113    Status404(models::ApiError),
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`update_workspace`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum UpdateWorkspaceError {
121    Status401(models::ApiError),
122    Status403(models::ApiError),
123    UnknownValue(serde_json::Value),
124}
125
126/// struct for typed errors of method [`update_workspace_member`]
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum UpdateWorkspaceMemberError {
130    Status401(models::ApiError),
131    Status403(models::ApiError),
132    UnknownValue(serde_json::Value),
133}
134
135
136pub async fn accept_workspace_invitation(configuration: &configuration::Configuration, token: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<AcceptWorkspaceInvitationError>> {
137    // add a prefix to parameters to efficiently prevent name collisions
138    let p_path_token = token;
139
140    let uri_str = format!("{}/v1/invitations/{token}/accept", configuration.base_path, token=crate::apis::urlencode(p_path_token));
141    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
142
143    if let Some(ref user_agent) = configuration.user_agent {
144        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
145    }
146    if let Some(ref token) = configuration.bearer_access_token {
147        req_builder = req_builder.bearer_auth(token.to_owned());
148    };
149
150    let req = req_builder.build()?;
151    let resp = configuration.client.execute(req).await?;
152
153    let status = resp.status();
154    let content_type = resp
155        .headers()
156        .get("content-type")
157        .and_then(|v| v.to_str().ok())
158        .unwrap_or("application/octet-stream");
159    let content_type = super::ContentType::from(content_type);
160
161    if !status.is_client_error() && !status.is_server_error() {
162        let content = resp.text().await?;
163        match content_type {
164            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
165            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;`"))),
166            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;`")))),
167        }
168    } else {
169        let content = resp.text().await?;
170        let entity: Option<AcceptWorkspaceInvitationError> = serde_json::from_str(&content).ok();
171        Err(Error::ResponseError(ResponseContent { status, content, entity }))
172    }
173}
174
175pub async fn add_workspace_member(configuration: &configuration::Configuration, workspace_id: &str, add_workspace_member_request: models::AddWorkspaceMemberRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<AddWorkspaceMemberError>> {
176    // add a prefix to parameters to efficiently prevent name collisions
177    let p_path_workspace_id = workspace_id;
178    let p_body_add_workspace_member_request = add_workspace_member_request;
179
180    let uri_str = format!("{}/v1/workspaces/{workspaceId}/members", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id));
181    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
182
183    if let Some(ref user_agent) = configuration.user_agent {
184        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
185    }
186    if let Some(ref token) = configuration.bearer_access_token {
187        req_builder = req_builder.bearer_auth(token.to_owned());
188    };
189    req_builder = req_builder.json(&p_body_add_workspace_member_request);
190
191    let req = req_builder.build()?;
192    let resp = configuration.client.execute(req).await?;
193
194    let status = resp.status();
195    let content_type = resp
196        .headers()
197        .get("content-type")
198        .and_then(|v| v.to_str().ok())
199        .unwrap_or("application/octet-stream");
200    let content_type = super::ContentType::from(content_type);
201
202    if !status.is_client_error() && !status.is_server_error() {
203        let content = resp.text().await?;
204        match content_type {
205            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
206            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;`"))),
207            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;`")))),
208        }
209    } else {
210        let content = resp.text().await?;
211        let entity: Option<AddWorkspaceMemberError> = serde_json::from_str(&content).ok();
212        Err(Error::ResponseError(ResponseContent { status, content, entity }))
213    }
214}
215
216pub async fn create_workspace(configuration: &configuration::Configuration, create_workspace_request: models::CreateWorkspaceRequest) -> Result<models::WorkspaceEnvelope, Error<CreateWorkspaceError>> {
217    // add a prefix to parameters to efficiently prevent name collisions
218    let p_body_create_workspace_request = create_workspace_request;
219
220    let uri_str = format!("{}/v1/workspaces", configuration.base_path);
221    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
222
223    if let Some(ref user_agent) = configuration.user_agent {
224        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
225    }
226    if let Some(ref token) = configuration.bearer_access_token {
227        req_builder = req_builder.bearer_auth(token.to_owned());
228    };
229    req_builder = req_builder.json(&p_body_create_workspace_request);
230
231    let req = req_builder.build()?;
232    let resp = configuration.client.execute(req).await?;
233
234    let status = resp.status();
235    let content_type = resp
236        .headers()
237        .get("content-type")
238        .and_then(|v| v.to_str().ok())
239        .unwrap_or("application/octet-stream");
240    let content_type = super::ContentType::from(content_type);
241
242    if !status.is_client_error() && !status.is_server_error() {
243        let content = resp.text().await?;
244        match content_type {
245            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
246            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceEnvelope`"))),
247            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::WorkspaceEnvelope`")))),
248        }
249    } else {
250        let content = resp.text().await?;
251        let entity: Option<CreateWorkspaceError> = serde_json::from_str(&content).ok();
252        Err(Error::ResponseError(ResponseContent { status, content, entity }))
253    }
254}
255
256pub async fn create_workspace_invitation(configuration: &configuration::Configuration, workspace_id: &str, create_workspace_invitation_request: models::CreateWorkspaceInvitationRequest) -> Result<models::WorkspaceInvitation, Error<CreateWorkspaceInvitationError>> {
257    // add a prefix to parameters to efficiently prevent name collisions
258    let p_path_workspace_id = workspace_id;
259    let p_body_create_workspace_invitation_request = create_workspace_invitation_request;
260
261    let uri_str = format!("{}/v1/workspaces/{workspaceId}/invitations", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id));
262    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
263
264    if let Some(ref user_agent) = configuration.user_agent {
265        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
266    }
267    if let Some(ref token) = configuration.bearer_access_token {
268        req_builder = req_builder.bearer_auth(token.to_owned());
269    };
270    req_builder = req_builder.json(&p_body_create_workspace_invitation_request);
271
272    let req = req_builder.build()?;
273    let resp = configuration.client.execute(req).await?;
274
275    let status = resp.status();
276    let content_type = resp
277        .headers()
278        .get("content-type")
279        .and_then(|v| v.to_str().ok())
280        .unwrap_or("application/octet-stream");
281    let content_type = super::ContentType::from(content_type);
282
283    if !status.is_client_error() && !status.is_server_error() {
284        let content = resp.text().await?;
285        match content_type {
286            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
287            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceInvitation`"))),
288            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::WorkspaceInvitation`")))),
289        }
290    } else {
291        let content = resp.text().await?;
292        let entity: Option<CreateWorkspaceInvitationError> = serde_json::from_str(&content).ok();
293        Err(Error::ResponseError(ResponseContent { status, content, entity }))
294    }
295}
296
297pub async fn get_public_invitation(configuration: &configuration::Configuration, token: &str) -> Result<models::PublicInvitationPayload, Error<GetPublicInvitationError>> {
298    // add a prefix to parameters to efficiently prevent name collisions
299    let p_path_token = token;
300
301    let uri_str = format!("{}/invitations/{token}", configuration.base_path, token=crate::apis::urlencode(p_path_token));
302    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
303
304    if let Some(ref user_agent) = configuration.user_agent {
305        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306    }
307    if let Some(ref token) = configuration.bearer_access_token {
308        req_builder = req_builder.bearer_auth(token.to_owned());
309    };
310
311    let req = req_builder.build()?;
312    let resp = configuration.client.execute(req).await?;
313
314    let status = resp.status();
315    let content_type = resp
316        .headers()
317        .get("content-type")
318        .and_then(|v| v.to_str().ok())
319        .unwrap_or("application/octet-stream");
320    let content_type = super::ContentType::from(content_type);
321
322    if !status.is_client_error() && !status.is_server_error() {
323        let content = resp.text().await?;
324        match content_type {
325            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
326            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PublicInvitationPayload`"))),
327            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::PublicInvitationPayload`")))),
328        }
329    } else {
330        let content = resp.text().await?;
331        let entity: Option<GetPublicInvitationError> = serde_json::from_str(&content).ok();
332        Err(Error::ResponseError(ResponseContent { status, content, entity }))
333    }
334}
335
336pub async fn get_workspace(configuration: &configuration::Configuration, workspace_id: &str) -> Result<models::WorkspaceEnvelope, Error<GetWorkspaceError>> {
337    // add a prefix to parameters to efficiently prevent name collisions
338    let p_path_workspace_id = workspace_id;
339
340    let uri_str = format!("{}/v1/workspaces/{workspaceId}", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id));
341    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
342
343    if let Some(ref user_agent) = configuration.user_agent {
344        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
345    }
346    if let Some(ref token) = configuration.bearer_access_token {
347        req_builder = req_builder.bearer_auth(token.to_owned());
348    };
349
350    let req = req_builder.build()?;
351    let resp = configuration.client.execute(req).await?;
352
353    let status = resp.status();
354    let content_type = resp
355        .headers()
356        .get("content-type")
357        .and_then(|v| v.to_str().ok())
358        .unwrap_or("application/octet-stream");
359    let content_type = super::ContentType::from(content_type);
360
361    if !status.is_client_error() && !status.is_server_error() {
362        let content = resp.text().await?;
363        match content_type {
364            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
365            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceEnvelope`"))),
366            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::WorkspaceEnvelope`")))),
367        }
368    } else {
369        let content = resp.text().await?;
370        let entity: Option<GetWorkspaceError> = serde_json::from_str(&content).ok();
371        Err(Error::ResponseError(ResponseContent { status, content, entity }))
372    }
373}
374
375pub async fn list_my_workspaces(configuration: &configuration::Configuration, ) -> Result<models::WorkspaceListResponse, Error<ListMyWorkspacesError>> {
376
377    let uri_str = format!("{}/v1/workspaces", configuration.base_path);
378    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
379
380    if let Some(ref user_agent) = configuration.user_agent {
381        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
382    }
383    if let Some(ref token) = configuration.bearer_access_token {
384        req_builder = req_builder.bearer_auth(token.to_owned());
385    };
386
387    let req = req_builder.build()?;
388    let resp = configuration.client.execute(req).await?;
389
390    let status = resp.status();
391    let content_type = resp
392        .headers()
393        .get("content-type")
394        .and_then(|v| v.to_str().ok())
395        .unwrap_or("application/octet-stream");
396    let content_type = super::ContentType::from(content_type);
397
398    if !status.is_client_error() && !status.is_server_error() {
399        let content = resp.text().await?;
400        match content_type {
401            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
402            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceListResponse`"))),
403            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::WorkspaceListResponse`")))),
404        }
405    } else {
406        let content = resp.text().await?;
407        let entity: Option<ListMyWorkspacesError> = serde_json::from_str(&content).ok();
408        Err(Error::ResponseError(ResponseContent { status, content, entity }))
409    }
410}
411
412pub async fn list_workspace_invitations(configuration: &configuration::Configuration, workspace_id: &str) -> Result<models::WorkspaceInvitationListResponse, Error<ListWorkspaceInvitationsError>> {
413    // add a prefix to parameters to efficiently prevent name collisions
414    let p_path_workspace_id = workspace_id;
415
416    let uri_str = format!("{}/v1/workspaces/{workspaceId}/invitations", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id));
417    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
418
419    if let Some(ref user_agent) = configuration.user_agent {
420        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
421    }
422    if let Some(ref token) = configuration.bearer_access_token {
423        req_builder = req_builder.bearer_auth(token.to_owned());
424    };
425
426    let req = req_builder.build()?;
427    let resp = configuration.client.execute(req).await?;
428
429    let status = resp.status();
430    let content_type = resp
431        .headers()
432        .get("content-type")
433        .and_then(|v| v.to_str().ok())
434        .unwrap_or("application/octet-stream");
435    let content_type = super::ContentType::from(content_type);
436
437    if !status.is_client_error() && !status.is_server_error() {
438        let content = resp.text().await?;
439        match content_type {
440            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
441            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceInvitationListResponse`"))),
442            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::WorkspaceInvitationListResponse`")))),
443        }
444    } else {
445        let content = resp.text().await?;
446        let entity: Option<ListWorkspaceInvitationsError> = serde_json::from_str(&content).ok();
447        Err(Error::ResponseError(ResponseContent { status, content, entity }))
448    }
449}
450
451pub async fn list_workspace_members(configuration: &configuration::Configuration, workspace_id: &str) -> Result<models::WorkspaceMemberListResponse, Error<ListWorkspaceMembersError>> {
452    // add a prefix to parameters to efficiently prevent name collisions
453    let p_path_workspace_id = workspace_id;
454
455    let uri_str = format!("{}/v1/workspaces/{workspaceId}/members", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id));
456    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
457
458    if let Some(ref user_agent) = configuration.user_agent {
459        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
460    }
461    if let Some(ref token) = configuration.bearer_access_token {
462        req_builder = req_builder.bearer_auth(token.to_owned());
463    };
464
465    let req = req_builder.build()?;
466    let resp = configuration.client.execute(req).await?;
467
468    let status = resp.status();
469    let content_type = resp
470        .headers()
471        .get("content-type")
472        .and_then(|v| v.to_str().ok())
473        .unwrap_or("application/octet-stream");
474    let content_type = super::ContentType::from(content_type);
475
476    if !status.is_client_error() && !status.is_server_error() {
477        let content = resp.text().await?;
478        match content_type {
479            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
480            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceMemberListResponse`"))),
481            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::WorkspaceMemberListResponse`")))),
482        }
483    } else {
484        let content = resp.text().await?;
485        let entity: Option<ListWorkspaceMembersError> = serde_json::from_str(&content).ok();
486        Err(Error::ResponseError(ResponseContent { status, content, entity }))
487    }
488}
489
490pub async fn remove_workspace_member(configuration: &configuration::Configuration, workspace_id: &str, member_id: &str) -> Result<(), Error<RemoveWorkspaceMemberError>> {
491    // add a prefix to parameters to efficiently prevent name collisions
492    let p_path_workspace_id = workspace_id;
493    let p_path_member_id = member_id;
494
495    let uri_str = format!("{}/v1/workspaces/{workspaceId}/members/{memberId}", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id), memberId=crate::apis::urlencode(p_path_member_id));
496    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
497
498    if let Some(ref user_agent) = configuration.user_agent {
499        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
500    }
501    if let Some(ref token) = configuration.bearer_access_token {
502        req_builder = req_builder.bearer_auth(token.to_owned());
503    };
504
505    let req = req_builder.build()?;
506    let resp = configuration.client.execute(req).await?;
507
508    let status = resp.status();
509
510    if !status.is_client_error() && !status.is_server_error() {
511        Ok(())
512    } else {
513        let content = resp.text().await?;
514        let entity: Option<RemoveWorkspaceMemberError> = serde_json::from_str(&content).ok();
515        Err(Error::ResponseError(ResponseContent { status, content, entity }))
516    }
517}
518
519pub async fn revoke_workspace_invitation(configuration: &configuration::Configuration, workspace_id: &str, invitation_id: &str) -> Result<(), Error<RevokeWorkspaceInvitationError>> {
520    // add a prefix to parameters to efficiently prevent name collisions
521    let p_path_workspace_id = workspace_id;
522    let p_path_invitation_id = invitation_id;
523
524    let uri_str = format!("{}/v1/workspaces/{workspaceId}/invitations/{invitationId}", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id), invitationId=crate::apis::urlencode(p_path_invitation_id));
525    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
526
527    if let Some(ref user_agent) = configuration.user_agent {
528        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
529    }
530    if let Some(ref token) = configuration.bearer_access_token {
531        req_builder = req_builder.bearer_auth(token.to_owned());
532    };
533
534    let req = req_builder.build()?;
535    let resp = configuration.client.execute(req).await?;
536
537    let status = resp.status();
538
539    if !status.is_client_error() && !status.is_server_error() {
540        Ok(())
541    } else {
542        let content = resp.text().await?;
543        let entity: Option<RevokeWorkspaceInvitationError> = serde_json::from_str(&content).ok();
544        Err(Error::ResponseError(ResponseContent { status, content, entity }))
545    }
546}
547
548pub async fn update_workspace(configuration: &configuration::Configuration, workspace_id: &str, update_workspace_request: models::UpdateWorkspaceRequest) -> Result<models::WorkspaceEnvelope, Error<UpdateWorkspaceError>> {
549    // add a prefix to parameters to efficiently prevent name collisions
550    let p_path_workspace_id = workspace_id;
551    let p_body_update_workspace_request = update_workspace_request;
552
553    let uri_str = format!("{}/v1/workspaces/{workspaceId}", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id));
554    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
555
556    if let Some(ref user_agent) = configuration.user_agent {
557        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
558    }
559    if let Some(ref token) = configuration.bearer_access_token {
560        req_builder = req_builder.bearer_auth(token.to_owned());
561    };
562    req_builder = req_builder.json(&p_body_update_workspace_request);
563
564    let req = req_builder.build()?;
565    let resp = configuration.client.execute(req).await?;
566
567    let status = resp.status();
568    let content_type = resp
569        .headers()
570        .get("content-type")
571        .and_then(|v| v.to_str().ok())
572        .unwrap_or("application/octet-stream");
573    let content_type = super::ContentType::from(content_type);
574
575    if !status.is_client_error() && !status.is_server_error() {
576        let content = resp.text().await?;
577        match content_type {
578            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
579            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceEnvelope`"))),
580            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::WorkspaceEnvelope`")))),
581        }
582    } else {
583        let content = resp.text().await?;
584        let entity: Option<UpdateWorkspaceError> = serde_json::from_str(&content).ok();
585        Err(Error::ResponseError(ResponseContent { status, content, entity }))
586    }
587}
588
589pub async fn update_workspace_member(configuration: &configuration::Configuration, workspace_id: &str, member_id: &str, update_workspace_member_request: models::UpdateWorkspaceMemberRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<UpdateWorkspaceMemberError>> {
590    // add a prefix to parameters to efficiently prevent name collisions
591    let p_path_workspace_id = workspace_id;
592    let p_path_member_id = member_id;
593    let p_body_update_workspace_member_request = update_workspace_member_request;
594
595    let uri_str = format!("{}/v1/workspaces/{workspaceId}/members/{memberId}", configuration.base_path, workspaceId=crate::apis::urlencode(p_path_workspace_id), memberId=crate::apis::urlencode(p_path_member_id));
596    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
597
598    if let Some(ref user_agent) = configuration.user_agent {
599        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
600    }
601    if let Some(ref token) = configuration.bearer_access_token {
602        req_builder = req_builder.bearer_auth(token.to_owned());
603    };
604    req_builder = req_builder.json(&p_body_update_workspace_member_request);
605
606    let req = req_builder.build()?;
607    let resp = configuration.client.execute(req).await?;
608
609    let status = resp.status();
610    let content_type = resp
611        .headers()
612        .get("content-type")
613        .and_then(|v| v.to_str().ok())
614        .unwrap_or("application/octet-stream");
615    let content_type = super::ContentType::from(content_type);
616
617    if !status.is_client_error() && !status.is_server_error() {
618        let content = resp.text().await?;
619        match content_type {
620            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
621            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;`"))),
622            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;`")))),
623        }
624    } else {
625        let content = resp.text().await?;
626        let entity: Option<UpdateWorkspaceMemberError> = serde_json::from_str(&content).ok();
627        Err(Error::ResponseError(ResponseContent { status, content, entity }))
628    }
629}
630