Skip to main content

spatio_sdk/apis/
calls_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 [`create_call`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateCallError {
22    Status401(models::ApiError),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`create_meeting_room`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum CreateMeetingRoomError {
30    Status401(models::ApiError),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`delete_call_recording`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum DeleteCallRecordingError {
38    Status401(models::ApiError),
39    UnknownValue(serde_json::Value),
40}
41
42/// struct for typed errors of method [`end_call`]
43#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum EndCallError {
46    Status401(models::ApiError),
47    UnknownValue(serde_json::Value),
48}
49
50/// struct for typed errors of method [`get_bandwidth_history`]
51#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum GetBandwidthHistoryError {
54    Status401(models::ApiError),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`get_bandwidth_summary`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GetBandwidthSummaryError {
62    Status401(models::ApiError),
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`get_call`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetCallError {
70    Status401(models::ApiError),
71    Status404(models::ApiError),
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`get_meeting_room`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum GetMeetingRoomError {
79    Status401(models::ApiError),
80    Status404(models::ApiError),
81    UnknownValue(serde_json::Value),
82}
83
84/// struct for typed errors of method [`join_call`]
85#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum JoinCallError {
88    Status401(models::ApiError),
89    UnknownValue(serde_json::Value),
90}
91
92/// struct for typed errors of method [`leave_call`]
93#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum LeaveCallError {
96    Status401(models::ApiError),
97    UnknownValue(serde_json::Value),
98}
99
100/// struct for typed errors of method [`list_active_calls`]
101#[derive(Debug, Clone, Serialize, Deserialize)]
102#[serde(untagged)]
103pub enum ListActiveCallsError {
104    Status401(models::ApiError),
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`list_call_recordings`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum ListCallRecordingsError {
112    Status401(models::ApiError),
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`start_call_recording`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum StartCallRecordingError {
120    Status401(models::ApiError),
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`stop_call_recording`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum StopCallRecordingError {
128    Status401(models::ApiError),
129    UnknownValue(serde_json::Value),
130}
131
132/// struct for typed errors of method [`update_call_participant_state`]
133#[derive(Debug, Clone, Serialize, Deserialize)]
134#[serde(untagged)]
135pub enum UpdateCallParticipantStateError {
136    Status401(models::ApiError),
137    UnknownValue(serde_json::Value),
138}
139
140/// struct for typed errors of method [`workspace_create_call`]
141#[derive(Debug, Clone, Serialize, Deserialize)]
142#[serde(untagged)]
143pub enum WorkspaceCreateCallError {
144    Status401(models::ApiError),
145    Status403(models::ApiError),
146    UnknownValue(serde_json::Value),
147}
148
149/// struct for typed errors of method [`workspace_create_meeting_room`]
150#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum WorkspaceCreateMeetingRoomError {
153    Status401(models::ApiError),
154    Status403(models::ApiError),
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`workspace_delete_call_recording`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum WorkspaceDeleteCallRecordingError {
162    Status401(models::ApiError),
163    Status403(models::ApiError),
164    UnknownValue(serde_json::Value),
165}
166
167/// struct for typed errors of method [`workspace_end_call`]
168#[derive(Debug, Clone, Serialize, Deserialize)]
169#[serde(untagged)]
170pub enum WorkspaceEndCallError {
171    Status401(models::ApiError),
172    Status403(models::ApiError),
173    UnknownValue(serde_json::Value),
174}
175
176/// struct for typed errors of method [`workspace_get_bandwidth_history`]
177#[derive(Debug, Clone, Serialize, Deserialize)]
178#[serde(untagged)]
179pub enum WorkspaceGetBandwidthHistoryError {
180    Status401(models::ApiError),
181    Status403(models::ApiError),
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`workspace_get_bandwidth_summary`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum WorkspaceGetBandwidthSummaryError {
189    Status401(models::ApiError),
190    Status403(models::ApiError),
191    UnknownValue(serde_json::Value),
192}
193
194/// struct for typed errors of method [`workspace_get_call`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum WorkspaceGetCallError {
198    Status401(models::ApiError),
199    Status403(models::ApiError),
200    Status404(models::ApiError),
201    UnknownValue(serde_json::Value),
202}
203
204/// struct for typed errors of method [`workspace_get_meeting_room`]
205#[derive(Debug, Clone, Serialize, Deserialize)]
206#[serde(untagged)]
207pub enum WorkspaceGetMeetingRoomError {
208    Status401(models::ApiError),
209    Status403(models::ApiError),
210    UnknownValue(serde_json::Value),
211}
212
213/// struct for typed errors of method [`workspace_join_call`]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum WorkspaceJoinCallError {
217    Status401(models::ApiError),
218    Status403(models::ApiError),
219    UnknownValue(serde_json::Value),
220}
221
222/// struct for typed errors of method [`workspace_leave_call`]
223#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum WorkspaceLeaveCallError {
226    Status401(models::ApiError),
227    Status403(models::ApiError),
228    UnknownValue(serde_json::Value),
229}
230
231/// struct for typed errors of method [`workspace_list_active_calls`]
232#[derive(Debug, Clone, Serialize, Deserialize)]
233#[serde(untagged)]
234pub enum WorkspaceListActiveCallsError {
235    Status401(models::ApiError),
236    Status403(models::ApiError),
237    UnknownValue(serde_json::Value),
238}
239
240/// struct for typed errors of method [`workspace_list_call_recordings`]
241#[derive(Debug, Clone, Serialize, Deserialize)]
242#[serde(untagged)]
243pub enum WorkspaceListCallRecordingsError {
244    Status401(models::ApiError),
245    Status403(models::ApiError),
246    UnknownValue(serde_json::Value),
247}
248
249/// struct for typed errors of method [`workspace_start_call_recording`]
250#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum WorkspaceStartCallRecordingError {
253    Status401(models::ApiError),
254    Status403(models::ApiError),
255    UnknownValue(serde_json::Value),
256}
257
258/// struct for typed errors of method [`workspace_stop_call_recording`]
259#[derive(Debug, Clone, Serialize, Deserialize)]
260#[serde(untagged)]
261pub enum WorkspaceStopCallRecordingError {
262    Status401(models::ApiError),
263    Status403(models::ApiError),
264    UnknownValue(serde_json::Value),
265}
266
267/// struct for typed errors of method [`workspace_update_call_participant`]
268#[derive(Debug, Clone, Serialize, Deserialize)]
269#[serde(untagged)]
270pub enum WorkspaceUpdateCallParticipantError {
271    Status401(models::ApiError),
272    Status403(models::ApiError),
273    UnknownValue(serde_json::Value),
274}
275
276
277pub async fn create_call(configuration: &configuration::Configuration, create_call_request: Option<models::CreateCallRequest>) -> Result<models::SpatioCall, Error<CreateCallError>> {
278    // add a prefix to parameters to efficiently prevent name collisions
279    let p_body_create_call_request = create_call_request;
280
281    let uri_str = format!("{}/v1/calls", configuration.base_path);
282    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
283
284    if let Some(ref user_agent) = configuration.user_agent {
285        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
286    }
287    if let Some(ref token) = configuration.bearer_access_token {
288        req_builder = req_builder.bearer_auth(token.to_owned());
289    };
290    req_builder = req_builder.json(&p_body_create_call_request);
291
292    let req = req_builder.build()?;
293    let resp = configuration.client.execute(req).await?;
294
295    let status = resp.status();
296    let content_type = resp
297        .headers()
298        .get("content-type")
299        .and_then(|v| v.to_str().ok())
300        .unwrap_or("application/octet-stream");
301    let content_type = super::ContentType::from(content_type);
302
303    if !status.is_client_error() && !status.is_server_error() {
304        let content = resp.text().await?;
305        match content_type {
306            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
307            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpatioCall`"))),
308            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::SpatioCall`")))),
309        }
310    } else {
311        let content = resp.text().await?;
312        let entity: Option<CreateCallError> = serde_json::from_str(&content).ok();
313        Err(Error::ResponseError(ResponseContent { status, content, entity }))
314    }
315}
316
317pub async fn create_meeting_room(configuration: &configuration::Configuration, create_meeting_room_request: models::CreateMeetingRoomRequest) -> Result<models::MeetingRoom, Error<CreateMeetingRoomError>> {
318    // add a prefix to parameters to efficiently prevent name collisions
319    let p_body_create_meeting_room_request = create_meeting_room_request;
320
321    let uri_str = format!("{}/v1/calls/rooms", configuration.base_path);
322    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
323
324    if let Some(ref user_agent) = configuration.user_agent {
325        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
326    }
327    if let Some(ref token) = configuration.bearer_access_token {
328        req_builder = req_builder.bearer_auth(token.to_owned());
329    };
330    req_builder = req_builder.json(&p_body_create_meeting_room_request);
331
332    let req = req_builder.build()?;
333    let resp = configuration.client.execute(req).await?;
334
335    let status = resp.status();
336    let content_type = resp
337        .headers()
338        .get("content-type")
339        .and_then(|v| v.to_str().ok())
340        .unwrap_or("application/octet-stream");
341    let content_type = super::ContentType::from(content_type);
342
343    if !status.is_client_error() && !status.is_server_error() {
344        let content = resp.text().await?;
345        match content_type {
346            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
347            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MeetingRoom`"))),
348            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::MeetingRoom`")))),
349        }
350    } else {
351        let content = resp.text().await?;
352        let entity: Option<CreateMeetingRoomError> = serde_json::from_str(&content).ok();
353        Err(Error::ResponseError(ResponseContent { status, content, entity }))
354    }
355}
356
357pub async fn delete_call_recording(configuration: &configuration::Configuration, recording_id: &str) -> Result<(), Error<DeleteCallRecordingError>> {
358    // add a prefix to parameters to efficiently prevent name collisions
359    let p_path_recording_id = recording_id;
360
361    let uri_str = format!("{}/v1/calls/recordings/{recordingId}", configuration.base_path, recordingId=crate::apis::urlencode(p_path_recording_id));
362    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
363
364    if let Some(ref user_agent) = configuration.user_agent {
365        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
366    }
367    if let Some(ref token) = configuration.bearer_access_token {
368        req_builder = req_builder.bearer_auth(token.to_owned());
369    };
370
371    let req = req_builder.build()?;
372    let resp = configuration.client.execute(req).await?;
373
374    let status = resp.status();
375
376    if !status.is_client_error() && !status.is_server_error() {
377        Ok(())
378    } else {
379        let content = resp.text().await?;
380        let entity: Option<DeleteCallRecordingError> = serde_json::from_str(&content).ok();
381        Err(Error::ResponseError(ResponseContent { status, content, entity }))
382    }
383}
384
385pub async fn end_call(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<EndCallError>> {
386    // add a prefix to parameters to efficiently prevent name collisions
387    let p_path_id = id;
388
389    let uri_str = format!("{}/v1/calls/{id}/end", configuration.base_path, id=crate::apis::urlencode(p_path_id));
390    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
391
392    if let Some(ref user_agent) = configuration.user_agent {
393        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
394    }
395    if let Some(ref token) = configuration.bearer_access_token {
396        req_builder = req_builder.bearer_auth(token.to_owned());
397    };
398
399    let req = req_builder.build()?;
400    let resp = configuration.client.execute(req).await?;
401
402    let status = resp.status();
403
404    if !status.is_client_error() && !status.is_server_error() {
405        Ok(())
406    } else {
407        let content = resp.text().await?;
408        let entity: Option<EndCallError> = serde_json::from_str(&content).ok();
409        Err(Error::ResponseError(ResponseContent { status, content, entity }))
410    }
411}
412
413pub async fn get_bandwidth_history(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetBandwidthHistoryError>> {
414
415    let uri_str = format!("{}/v1/calls/bandwidth/history", 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<GetBandwidthHistoryError> = serde_json::from_str(&content).ok();
446        Err(Error::ResponseError(ResponseContent { status, content, entity }))
447    }
448}
449
450pub async fn get_bandwidth_summary(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetBandwidthSummaryError>> {
451
452    let uri_str = format!("{}/v1/calls/bandwidth/summary", configuration.base_path);
453    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
454
455    if let Some(ref user_agent) = configuration.user_agent {
456        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
457    }
458    if let Some(ref token) = configuration.bearer_access_token {
459        req_builder = req_builder.bearer_auth(token.to_owned());
460    };
461
462    let req = req_builder.build()?;
463    let resp = configuration.client.execute(req).await?;
464
465    let status = resp.status();
466    let content_type = resp
467        .headers()
468        .get("content-type")
469        .and_then(|v| v.to_str().ok())
470        .unwrap_or("application/octet-stream");
471    let content_type = super::ContentType::from(content_type);
472
473    if !status.is_client_error() && !status.is_server_error() {
474        let content = resp.text().await?;
475        match content_type {
476            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
477            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;`"))),
478            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;`")))),
479        }
480    } else {
481        let content = resp.text().await?;
482        let entity: Option<GetBandwidthSummaryError> = serde_json::from_str(&content).ok();
483        Err(Error::ResponseError(ResponseContent { status, content, entity }))
484    }
485}
486
487pub async fn get_call(configuration: &configuration::Configuration, id: &str) -> Result<models::SpatioCall, Error<GetCallError>> {
488    // add a prefix to parameters to efficiently prevent name collisions
489    let p_path_id = id;
490
491    let uri_str = format!("{}/v1/calls/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
492    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
493
494    if let Some(ref user_agent) = configuration.user_agent {
495        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
496    }
497    if let Some(ref token) = configuration.bearer_access_token {
498        req_builder = req_builder.bearer_auth(token.to_owned());
499    };
500
501    let req = req_builder.build()?;
502    let resp = configuration.client.execute(req).await?;
503
504    let status = resp.status();
505    let content_type = resp
506        .headers()
507        .get("content-type")
508        .and_then(|v| v.to_str().ok())
509        .unwrap_or("application/octet-stream");
510    let content_type = super::ContentType::from(content_type);
511
512    if !status.is_client_error() && !status.is_server_error() {
513        let content = resp.text().await?;
514        match content_type {
515            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
516            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpatioCall`"))),
517            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::SpatioCall`")))),
518        }
519    } else {
520        let content = resp.text().await?;
521        let entity: Option<GetCallError> = serde_json::from_str(&content).ok();
522        Err(Error::ResponseError(ResponseContent { status, content, entity }))
523    }
524}
525
526pub async fn get_meeting_room(configuration: &configuration::Configuration, id: &str) -> Result<models::MeetingRoom, Error<GetMeetingRoomError>> {
527    // add a prefix to parameters to efficiently prevent name collisions
528    let p_path_id = id;
529
530    let uri_str = format!("{}/v1/calls/rooms/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
531    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
532
533    if let Some(ref user_agent) = configuration.user_agent {
534        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
535    }
536    if let Some(ref token) = configuration.bearer_access_token {
537        req_builder = req_builder.bearer_auth(token.to_owned());
538    };
539
540    let req = req_builder.build()?;
541    let resp = configuration.client.execute(req).await?;
542
543    let status = resp.status();
544    let content_type = resp
545        .headers()
546        .get("content-type")
547        .and_then(|v| v.to_str().ok())
548        .unwrap_or("application/octet-stream");
549    let content_type = super::ContentType::from(content_type);
550
551    if !status.is_client_error() && !status.is_server_error() {
552        let content = resp.text().await?;
553        match content_type {
554            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
555            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MeetingRoom`"))),
556            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::MeetingRoom`")))),
557        }
558    } else {
559        let content = resp.text().await?;
560        let entity: Option<GetMeetingRoomError> = serde_json::from_str(&content).ok();
561        Err(Error::ResponseError(ResponseContent { status, content, entity }))
562    }
563}
564
565pub async fn join_call(configuration: &configuration::Configuration, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<JoinCallError>> {
566    // add a prefix to parameters to efficiently prevent name collisions
567    let p_path_id = id;
568
569    let uri_str = format!("{}/v1/calls/{id}/join", configuration.base_path, id=crate::apis::urlencode(p_path_id));
570    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
571
572    if let Some(ref user_agent) = configuration.user_agent {
573        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
574    }
575    if let Some(ref token) = configuration.bearer_access_token {
576        req_builder = req_builder.bearer_auth(token.to_owned());
577    };
578
579    let req = req_builder.build()?;
580    let resp = configuration.client.execute(req).await?;
581
582    let status = resp.status();
583    let content_type = resp
584        .headers()
585        .get("content-type")
586        .and_then(|v| v.to_str().ok())
587        .unwrap_or("application/octet-stream");
588    let content_type = super::ContentType::from(content_type);
589
590    if !status.is_client_error() && !status.is_server_error() {
591        let content = resp.text().await?;
592        match content_type {
593            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
594            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;`"))),
595            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;`")))),
596        }
597    } else {
598        let content = resp.text().await?;
599        let entity: Option<JoinCallError> = serde_json::from_str(&content).ok();
600        Err(Error::ResponseError(ResponseContent { status, content, entity }))
601    }
602}
603
604pub async fn leave_call(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<LeaveCallError>> {
605    // add a prefix to parameters to efficiently prevent name collisions
606    let p_path_id = id;
607
608    let uri_str = format!("{}/v1/calls/{id}/leave", configuration.base_path, id=crate::apis::urlencode(p_path_id));
609    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
610
611    if let Some(ref user_agent) = configuration.user_agent {
612        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
613    }
614    if let Some(ref token) = configuration.bearer_access_token {
615        req_builder = req_builder.bearer_auth(token.to_owned());
616    };
617
618    let req = req_builder.build()?;
619    let resp = configuration.client.execute(req).await?;
620
621    let status = resp.status();
622
623    if !status.is_client_error() && !status.is_server_error() {
624        Ok(())
625    } else {
626        let content = resp.text().await?;
627        let entity: Option<LeaveCallError> = serde_json::from_str(&content).ok();
628        Err(Error::ResponseError(ResponseContent { status, content, entity }))
629    }
630}
631
632pub async fn list_active_calls(configuration: &configuration::Configuration, ) -> Result<models::CallListResponse, Error<ListActiveCallsError>> {
633
634    let uri_str = format!("{}/v1/calls", configuration.base_path);
635    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
636
637    if let Some(ref user_agent) = configuration.user_agent {
638        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
639    }
640    if let Some(ref token) = configuration.bearer_access_token {
641        req_builder = req_builder.bearer_auth(token.to_owned());
642    };
643
644    let req = req_builder.build()?;
645    let resp = configuration.client.execute(req).await?;
646
647    let status = resp.status();
648    let content_type = resp
649        .headers()
650        .get("content-type")
651        .and_then(|v| v.to_str().ok())
652        .unwrap_or("application/octet-stream");
653    let content_type = super::ContentType::from(content_type);
654
655    if !status.is_client_error() && !status.is_server_error() {
656        let content = resp.text().await?;
657        match content_type {
658            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
659            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CallListResponse`"))),
660            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::CallListResponse`")))),
661        }
662    } else {
663        let content = resp.text().await?;
664        let entity: Option<ListActiveCallsError> = serde_json::from_str(&content).ok();
665        Err(Error::ResponseError(ResponseContent { status, content, entity }))
666    }
667}
668
669pub async fn list_call_recordings(configuration: &configuration::Configuration, id: &str) -> Result<models::CallRecordingListResponse, Error<ListCallRecordingsError>> {
670    // add a prefix to parameters to efficiently prevent name collisions
671    let p_path_id = id;
672
673    let uri_str = format!("{}/v1/calls/{id}/recordings", configuration.base_path, id=crate::apis::urlencode(p_path_id));
674    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
675
676    if let Some(ref user_agent) = configuration.user_agent {
677        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
678    }
679    if let Some(ref token) = configuration.bearer_access_token {
680        req_builder = req_builder.bearer_auth(token.to_owned());
681    };
682
683    let req = req_builder.build()?;
684    let resp = configuration.client.execute(req).await?;
685
686    let status = resp.status();
687    let content_type = resp
688        .headers()
689        .get("content-type")
690        .and_then(|v| v.to_str().ok())
691        .unwrap_or("application/octet-stream");
692    let content_type = super::ContentType::from(content_type);
693
694    if !status.is_client_error() && !status.is_server_error() {
695        let content = resp.text().await?;
696        match content_type {
697            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
698            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CallRecordingListResponse`"))),
699            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::CallRecordingListResponse`")))),
700        }
701    } else {
702        let content = resp.text().await?;
703        let entity: Option<ListCallRecordingsError> = serde_json::from_str(&content).ok();
704        Err(Error::ResponseError(ResponseContent { status, content, entity }))
705    }
706}
707
708pub async fn start_call_recording(configuration: &configuration::Configuration, id: &str) -> Result<models::CallRecording, Error<StartCallRecordingError>> {
709    // add a prefix to parameters to efficiently prevent name collisions
710    let p_path_id = id;
711
712    let uri_str = format!("{}/v1/calls/{id}/recordings/start", configuration.base_path, id=crate::apis::urlencode(p_path_id));
713    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
714
715    if let Some(ref user_agent) = configuration.user_agent {
716        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
717    }
718    if let Some(ref token) = configuration.bearer_access_token {
719        req_builder = req_builder.bearer_auth(token.to_owned());
720    };
721
722    let req = req_builder.build()?;
723    let resp = configuration.client.execute(req).await?;
724
725    let status = resp.status();
726    let content_type = resp
727        .headers()
728        .get("content-type")
729        .and_then(|v| v.to_str().ok())
730        .unwrap_or("application/octet-stream");
731    let content_type = super::ContentType::from(content_type);
732
733    if !status.is_client_error() && !status.is_server_error() {
734        let content = resp.text().await?;
735        match content_type {
736            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
737            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CallRecording`"))),
738            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::CallRecording`")))),
739        }
740    } else {
741        let content = resp.text().await?;
742        let entity: Option<StartCallRecordingError> = serde_json::from_str(&content).ok();
743        Err(Error::ResponseError(ResponseContent { status, content, entity }))
744    }
745}
746
747pub async fn stop_call_recording(configuration: &configuration::Configuration, id: &str, recording_id: &str) -> Result<models::CallRecording, Error<StopCallRecordingError>> {
748    // add a prefix to parameters to efficiently prevent name collisions
749    let p_path_id = id;
750    let p_path_recording_id = recording_id;
751
752    let uri_str = format!("{}/v1/calls/{id}/recordings/{recordingId}/stop", configuration.base_path, id=crate::apis::urlencode(p_path_id), recordingId=crate::apis::urlencode(p_path_recording_id));
753    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
754
755    if let Some(ref user_agent) = configuration.user_agent {
756        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
757    }
758    if let Some(ref token) = configuration.bearer_access_token {
759        req_builder = req_builder.bearer_auth(token.to_owned());
760    };
761
762    let req = req_builder.build()?;
763    let resp = configuration.client.execute(req).await?;
764
765    let status = resp.status();
766    let content_type = resp
767        .headers()
768        .get("content-type")
769        .and_then(|v| v.to_str().ok())
770        .unwrap_or("application/octet-stream");
771    let content_type = super::ContentType::from(content_type);
772
773    if !status.is_client_error() && !status.is_server_error() {
774        let content = resp.text().await?;
775        match content_type {
776            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
777            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CallRecording`"))),
778            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::CallRecording`")))),
779        }
780    } else {
781        let content = resp.text().await?;
782        let entity: Option<StopCallRecordingError> = serde_json::from_str(&content).ok();
783        Err(Error::ResponseError(ResponseContent { status, content, entity }))
784    }
785}
786
787pub async fn update_call_participant_state(configuration: &configuration::Configuration, id: &str, update_participant_state_request: models::UpdateParticipantStateRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<UpdateCallParticipantStateError>> {
788    // add a prefix to parameters to efficiently prevent name collisions
789    let p_path_id = id;
790    let p_body_update_participant_state_request = update_participant_state_request;
791
792    let uri_str = format!("{}/v1/calls/{id}/participant", configuration.base_path, id=crate::apis::urlencode(p_path_id));
793    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
794
795    if let Some(ref user_agent) = configuration.user_agent {
796        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
797    }
798    if let Some(ref token) = configuration.bearer_access_token {
799        req_builder = req_builder.bearer_auth(token.to_owned());
800    };
801    req_builder = req_builder.json(&p_body_update_participant_state_request);
802
803    let req = req_builder.build()?;
804    let resp = configuration.client.execute(req).await?;
805
806    let status = resp.status();
807    let content_type = resp
808        .headers()
809        .get("content-type")
810        .and_then(|v| v.to_str().ok())
811        .unwrap_or("application/octet-stream");
812    let content_type = super::ContentType::from(content_type);
813
814    if !status.is_client_error() && !status.is_server_error() {
815        let content = resp.text().await?;
816        match content_type {
817            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
818            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;`"))),
819            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;`")))),
820        }
821    } else {
822        let content = resp.text().await?;
823        let entity: Option<UpdateCallParticipantStateError> = serde_json::from_str(&content).ok();
824        Err(Error::ResponseError(ResponseContent { status, content, entity }))
825    }
826}
827
828pub async fn workspace_create_call(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<WorkspaceCreateCallError>> {
829    // add a prefix to parameters to efficiently prevent name collisions
830    let p_path_org = org;
831    let p_path_workspace = workspace;
832    let p_body_request_body = request_body;
833
834    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
835    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
836
837    if let Some(ref user_agent) = configuration.user_agent {
838        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
839    }
840    if let Some(ref token) = configuration.bearer_access_token {
841        req_builder = req_builder.bearer_auth(token.to_owned());
842    };
843    req_builder = req_builder.json(&p_body_request_body);
844
845    let req = req_builder.build()?;
846    let resp = configuration.client.execute(req).await?;
847
848    let status = resp.status();
849    let content_type = resp
850        .headers()
851        .get("content-type")
852        .and_then(|v| v.to_str().ok())
853        .unwrap_or("application/octet-stream");
854    let content_type = super::ContentType::from(content_type);
855
856    if !status.is_client_error() && !status.is_server_error() {
857        let content = resp.text().await?;
858        match content_type {
859            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
860            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;`"))),
861            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;`")))),
862        }
863    } else {
864        let content = resp.text().await?;
865        let entity: Option<WorkspaceCreateCallError> = serde_json::from_str(&content).ok();
866        Err(Error::ResponseError(ResponseContent { status, content, entity }))
867    }
868}
869
870pub async fn workspace_create_meeting_room(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<WorkspaceCreateMeetingRoomError>> {
871    // add a prefix to parameters to efficiently prevent name collisions
872    let p_path_org = org;
873    let p_path_workspace = workspace;
874    let p_body_request_body = request_body;
875
876    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/rooms", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
877    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
878
879    if let Some(ref user_agent) = configuration.user_agent {
880        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
881    }
882    if let Some(ref token) = configuration.bearer_access_token {
883        req_builder = req_builder.bearer_auth(token.to_owned());
884    };
885    req_builder = req_builder.json(&p_body_request_body);
886
887    let req = req_builder.build()?;
888    let resp = configuration.client.execute(req).await?;
889
890    let status = resp.status();
891    let content_type = resp
892        .headers()
893        .get("content-type")
894        .and_then(|v| v.to_str().ok())
895        .unwrap_or("application/octet-stream");
896    let content_type = super::ContentType::from(content_type);
897
898    if !status.is_client_error() && !status.is_server_error() {
899        let content = resp.text().await?;
900        match content_type {
901            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
902            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;`"))),
903            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;`")))),
904        }
905    } else {
906        let content = resp.text().await?;
907        let entity: Option<WorkspaceCreateMeetingRoomError> = serde_json::from_str(&content).ok();
908        Err(Error::ResponseError(ResponseContent { status, content, entity }))
909    }
910}
911
912pub async fn workspace_delete_call_recording(configuration: &configuration::Configuration, org: &str, workspace: &str, recording_id: &str) -> Result<(), Error<WorkspaceDeleteCallRecordingError>> {
913    // add a prefix to parameters to efficiently prevent name collisions
914    let p_path_org = org;
915    let p_path_workspace = workspace;
916    let p_path_recording_id = recording_id;
917
918    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/recordings/{recordingId}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), recordingId=crate::apis::urlencode(p_path_recording_id));
919    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
920
921    if let Some(ref user_agent) = configuration.user_agent {
922        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
923    }
924    if let Some(ref token) = configuration.bearer_access_token {
925        req_builder = req_builder.bearer_auth(token.to_owned());
926    };
927
928    let req = req_builder.build()?;
929    let resp = configuration.client.execute(req).await?;
930
931    let status = resp.status();
932
933    if !status.is_client_error() && !status.is_server_error() {
934        Ok(())
935    } else {
936        let content = resp.text().await?;
937        let entity: Option<WorkspaceDeleteCallRecordingError> = serde_json::from_str(&content).ok();
938        Err(Error::ResponseError(ResponseContent { status, content, entity }))
939    }
940}
941
942pub async fn workspace_end_call(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<(), Error<WorkspaceEndCallError>> {
943    // add a prefix to parameters to efficiently prevent name collisions
944    let p_path_org = org;
945    let p_path_workspace = workspace;
946    let p_path_id = id;
947
948    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/{id}/end", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
949    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
950
951    if let Some(ref user_agent) = configuration.user_agent {
952        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
953    }
954    if let Some(ref token) = configuration.bearer_access_token {
955        req_builder = req_builder.bearer_auth(token.to_owned());
956    };
957
958    let req = req_builder.build()?;
959    let resp = configuration.client.execute(req).await?;
960
961    let status = resp.status();
962
963    if !status.is_client_error() && !status.is_server_error() {
964        Ok(())
965    } else {
966        let content = resp.text().await?;
967        let entity: Option<WorkspaceEndCallError> = serde_json::from_str(&content).ok();
968        Err(Error::ResponseError(ResponseContent { status, content, entity }))
969    }
970}
971
972pub async fn workspace_get_bandwidth_history(configuration: &configuration::Configuration, org: &str, workspace: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetBandwidthHistoryError>> {
973    // add a prefix to parameters to efficiently prevent name collisions
974    let p_path_org = org;
975    let p_path_workspace = workspace;
976
977    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/bandwidth/history", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
978    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
979
980    if let Some(ref user_agent) = configuration.user_agent {
981        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
982    }
983    if let Some(ref token) = configuration.bearer_access_token {
984        req_builder = req_builder.bearer_auth(token.to_owned());
985    };
986
987    let req = req_builder.build()?;
988    let resp = configuration.client.execute(req).await?;
989
990    let status = resp.status();
991    let content_type = resp
992        .headers()
993        .get("content-type")
994        .and_then(|v| v.to_str().ok())
995        .unwrap_or("application/octet-stream");
996    let content_type = super::ContentType::from(content_type);
997
998    if !status.is_client_error() && !status.is_server_error() {
999        let content = resp.text().await?;
1000        match content_type {
1001            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1002            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;`"))),
1003            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;`")))),
1004        }
1005    } else {
1006        let content = resp.text().await?;
1007        let entity: Option<WorkspaceGetBandwidthHistoryError> = serde_json::from_str(&content).ok();
1008        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1009    }
1010}
1011
1012pub async fn workspace_get_bandwidth_summary(configuration: &configuration::Configuration, org: &str, workspace: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetBandwidthSummaryError>> {
1013    // add a prefix to parameters to efficiently prevent name collisions
1014    let p_path_org = org;
1015    let p_path_workspace = workspace;
1016
1017    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/bandwidth/summary", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1018    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1019
1020    if let Some(ref user_agent) = configuration.user_agent {
1021        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1022    }
1023    if let Some(ref token) = configuration.bearer_access_token {
1024        req_builder = req_builder.bearer_auth(token.to_owned());
1025    };
1026
1027    let req = req_builder.build()?;
1028    let resp = configuration.client.execute(req).await?;
1029
1030    let status = resp.status();
1031    let content_type = resp
1032        .headers()
1033        .get("content-type")
1034        .and_then(|v| v.to_str().ok())
1035        .unwrap_or("application/octet-stream");
1036    let content_type = super::ContentType::from(content_type);
1037
1038    if !status.is_client_error() && !status.is_server_error() {
1039        let content = resp.text().await?;
1040        match content_type {
1041            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1042            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;`"))),
1043            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;`")))),
1044        }
1045    } else {
1046        let content = resp.text().await?;
1047        let entity: Option<WorkspaceGetBandwidthSummaryError> = serde_json::from_str(&content).ok();
1048        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1049    }
1050}
1051
1052pub async fn workspace_get_call(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetCallError>> {
1053    // add a prefix to parameters to efficiently prevent name collisions
1054    let p_path_org = org;
1055    let p_path_workspace = workspace;
1056    let p_path_id = id;
1057
1058    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/{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));
1059    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1060
1061    if let Some(ref user_agent) = configuration.user_agent {
1062        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1063    }
1064    if let Some(ref token) = configuration.bearer_access_token {
1065        req_builder = req_builder.bearer_auth(token.to_owned());
1066    };
1067
1068    let req = req_builder.build()?;
1069    let resp = configuration.client.execute(req).await?;
1070
1071    let status = resp.status();
1072    let content_type = resp
1073        .headers()
1074        .get("content-type")
1075        .and_then(|v| v.to_str().ok())
1076        .unwrap_or("application/octet-stream");
1077    let content_type = super::ContentType::from(content_type);
1078
1079    if !status.is_client_error() && !status.is_server_error() {
1080        let content = resp.text().await?;
1081        match content_type {
1082            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1083            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;`"))),
1084            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;`")))),
1085        }
1086    } else {
1087        let content = resp.text().await?;
1088        let entity: Option<WorkspaceGetCallError> = serde_json::from_str(&content).ok();
1089        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1090    }
1091}
1092
1093pub async fn workspace_get_meeting_room(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetMeetingRoomError>> {
1094    // add a prefix to parameters to efficiently prevent name collisions
1095    let p_path_org = org;
1096    let p_path_workspace = workspace;
1097    let p_path_id = id;
1098
1099    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/rooms/{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));
1100    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1101
1102    if let Some(ref user_agent) = configuration.user_agent {
1103        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1104    }
1105    if let Some(ref token) = configuration.bearer_access_token {
1106        req_builder = req_builder.bearer_auth(token.to_owned());
1107    };
1108
1109    let req = req_builder.build()?;
1110    let resp = configuration.client.execute(req).await?;
1111
1112    let status = resp.status();
1113    let content_type = resp
1114        .headers()
1115        .get("content-type")
1116        .and_then(|v| v.to_str().ok())
1117        .unwrap_or("application/octet-stream");
1118    let content_type = super::ContentType::from(content_type);
1119
1120    if !status.is_client_error() && !status.is_server_error() {
1121        let content = resp.text().await?;
1122        match content_type {
1123            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1124            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;`"))),
1125            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;`")))),
1126        }
1127    } else {
1128        let content = resp.text().await?;
1129        let entity: Option<WorkspaceGetMeetingRoomError> = serde_json::from_str(&content).ok();
1130        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1131    }
1132}
1133
1134pub async fn workspace_join_call(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceJoinCallError>> {
1135    // add a prefix to parameters to efficiently prevent name collisions
1136    let p_path_org = org;
1137    let p_path_workspace = workspace;
1138    let p_path_id = id;
1139
1140    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/{id}/join", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1141    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1142
1143    if let Some(ref user_agent) = configuration.user_agent {
1144        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1145    }
1146    if let Some(ref token) = configuration.bearer_access_token {
1147        req_builder = req_builder.bearer_auth(token.to_owned());
1148    };
1149
1150    let req = req_builder.build()?;
1151    let resp = configuration.client.execute(req).await?;
1152
1153    let status = resp.status();
1154    let content_type = resp
1155        .headers()
1156        .get("content-type")
1157        .and_then(|v| v.to_str().ok())
1158        .unwrap_or("application/octet-stream");
1159    let content_type = super::ContentType::from(content_type);
1160
1161    if !status.is_client_error() && !status.is_server_error() {
1162        let content = resp.text().await?;
1163        match content_type {
1164            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1165            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;`"))),
1166            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;`")))),
1167        }
1168    } else {
1169        let content = resp.text().await?;
1170        let entity: Option<WorkspaceJoinCallError> = serde_json::from_str(&content).ok();
1171        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1172    }
1173}
1174
1175pub async fn workspace_leave_call(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<(), Error<WorkspaceLeaveCallError>> {
1176    // add a prefix to parameters to efficiently prevent name collisions
1177    let p_path_org = org;
1178    let p_path_workspace = workspace;
1179    let p_path_id = id;
1180
1181    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/{id}/leave", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1182    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1183
1184    if let Some(ref user_agent) = configuration.user_agent {
1185        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1186    }
1187    if let Some(ref token) = configuration.bearer_access_token {
1188        req_builder = req_builder.bearer_auth(token.to_owned());
1189    };
1190
1191    let req = req_builder.build()?;
1192    let resp = configuration.client.execute(req).await?;
1193
1194    let status = resp.status();
1195
1196    if !status.is_client_error() && !status.is_server_error() {
1197        Ok(())
1198    } else {
1199        let content = resp.text().await?;
1200        let entity: Option<WorkspaceLeaveCallError> = serde_json::from_str(&content).ok();
1201        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1202    }
1203}
1204
1205pub async fn workspace_list_active_calls(configuration: &configuration::Configuration, org: &str, workspace: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListActiveCallsError>> {
1206    // add a prefix to parameters to efficiently prevent name collisions
1207    let p_path_org = org;
1208    let p_path_workspace = workspace;
1209
1210    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1211    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1212
1213    if let Some(ref user_agent) = configuration.user_agent {
1214        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1215    }
1216    if let Some(ref token) = configuration.bearer_access_token {
1217        req_builder = req_builder.bearer_auth(token.to_owned());
1218    };
1219
1220    let req = req_builder.build()?;
1221    let resp = configuration.client.execute(req).await?;
1222
1223    let status = resp.status();
1224    let content_type = resp
1225        .headers()
1226        .get("content-type")
1227        .and_then(|v| v.to_str().ok())
1228        .unwrap_or("application/octet-stream");
1229    let content_type = super::ContentType::from(content_type);
1230
1231    if !status.is_client_error() && !status.is_server_error() {
1232        let content = resp.text().await?;
1233        match content_type {
1234            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1235            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;`"))),
1236            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;`")))),
1237        }
1238    } else {
1239        let content = resp.text().await?;
1240        let entity: Option<WorkspaceListActiveCallsError> = serde_json::from_str(&content).ok();
1241        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1242    }
1243}
1244
1245pub async fn workspace_list_call_recordings(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListCallRecordingsError>> {
1246    // add a prefix to parameters to efficiently prevent name collisions
1247    let p_path_org = org;
1248    let p_path_workspace = workspace;
1249    let p_path_id = id;
1250
1251    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/{id}/recordings", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1252    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1253
1254    if let Some(ref user_agent) = configuration.user_agent {
1255        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1256    }
1257    if let Some(ref token) = configuration.bearer_access_token {
1258        req_builder = req_builder.bearer_auth(token.to_owned());
1259    };
1260
1261    let req = req_builder.build()?;
1262    let resp = configuration.client.execute(req).await?;
1263
1264    let status = resp.status();
1265    let content_type = resp
1266        .headers()
1267        .get("content-type")
1268        .and_then(|v| v.to_str().ok())
1269        .unwrap_or("application/octet-stream");
1270    let content_type = super::ContentType::from(content_type);
1271
1272    if !status.is_client_error() && !status.is_server_error() {
1273        let content = resp.text().await?;
1274        match content_type {
1275            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1276            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;`"))),
1277            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;`")))),
1278        }
1279    } else {
1280        let content = resp.text().await?;
1281        let entity: Option<WorkspaceListCallRecordingsError> = serde_json::from_str(&content).ok();
1282        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1283    }
1284}
1285
1286pub async fn workspace_start_call_recording(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceStartCallRecordingError>> {
1287    // add a prefix to parameters to efficiently prevent name collisions
1288    let p_path_org = org;
1289    let p_path_workspace = workspace;
1290    let p_path_id = id;
1291
1292    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/{id}/recordings/start", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1293    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1294
1295    if let Some(ref user_agent) = configuration.user_agent {
1296        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1297    }
1298    if let Some(ref token) = configuration.bearer_access_token {
1299        req_builder = req_builder.bearer_auth(token.to_owned());
1300    };
1301
1302    let req = req_builder.build()?;
1303    let resp = configuration.client.execute(req).await?;
1304
1305    let status = resp.status();
1306    let content_type = resp
1307        .headers()
1308        .get("content-type")
1309        .and_then(|v| v.to_str().ok())
1310        .unwrap_or("application/octet-stream");
1311    let content_type = super::ContentType::from(content_type);
1312
1313    if !status.is_client_error() && !status.is_server_error() {
1314        let content = resp.text().await?;
1315        match content_type {
1316            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1317            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;`"))),
1318            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;`")))),
1319        }
1320    } else {
1321        let content = resp.text().await?;
1322        let entity: Option<WorkspaceStartCallRecordingError> = serde_json::from_str(&content).ok();
1323        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1324    }
1325}
1326
1327pub async fn workspace_stop_call_recording(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str, recording_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceStopCallRecordingError>> {
1328    // add a prefix to parameters to efficiently prevent name collisions
1329    let p_path_org = org;
1330    let p_path_workspace = workspace;
1331    let p_path_id = id;
1332    let p_path_recording_id = recording_id;
1333
1334    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/{id}/recordings/{recordingId}/stop", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id), recordingId=crate::apis::urlencode(p_path_recording_id));
1335    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1336
1337    if let Some(ref user_agent) = configuration.user_agent {
1338        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1339    }
1340    if let Some(ref token) = configuration.bearer_access_token {
1341        req_builder = req_builder.bearer_auth(token.to_owned());
1342    };
1343
1344    let req = req_builder.build()?;
1345    let resp = configuration.client.execute(req).await?;
1346
1347    let status = resp.status();
1348    let content_type = resp
1349        .headers()
1350        .get("content-type")
1351        .and_then(|v| v.to_str().ok())
1352        .unwrap_or("application/octet-stream");
1353    let content_type = super::ContentType::from(content_type);
1354
1355    if !status.is_client_error() && !status.is_server_error() {
1356        let content = resp.text().await?;
1357        match content_type {
1358            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1359            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;`"))),
1360            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;`")))),
1361        }
1362    } else {
1363        let content = resp.text().await?;
1364        let entity: Option<WorkspaceStopCallRecordingError> = serde_json::from_str(&content).ok();
1365        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1366    }
1367}
1368
1369pub async fn workspace_update_call_participant(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<WorkspaceUpdateCallParticipantError>> {
1370    // add a prefix to parameters to efficiently prevent name collisions
1371    let p_path_org = org;
1372    let p_path_workspace = workspace;
1373    let p_path_id = id;
1374    let p_body_request_body = request_body;
1375
1376    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/calls/{id}/participant", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1377    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1378
1379    if let Some(ref user_agent) = configuration.user_agent {
1380        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1381    }
1382    if let Some(ref token) = configuration.bearer_access_token {
1383        req_builder = req_builder.bearer_auth(token.to_owned());
1384    };
1385    req_builder = req_builder.json(&p_body_request_body);
1386
1387    let req = req_builder.build()?;
1388    let resp = configuration.client.execute(req).await?;
1389
1390    let status = resp.status();
1391    let content_type = resp
1392        .headers()
1393        .get("content-type")
1394        .and_then(|v| v.to_str().ok())
1395        .unwrap_or("application/octet-stream");
1396    let content_type = super::ContentType::from(content_type);
1397
1398    if !status.is_client_error() && !status.is_server_error() {
1399        let content = resp.text().await?;
1400        match content_type {
1401            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1402            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;`"))),
1403            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;`")))),
1404        }
1405    } else {
1406        let content = resp.text().await?;
1407        let entity: Option<WorkspaceUpdateCallParticipantError> = serde_json::from_str(&content).ok();
1408        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1409    }
1410}
1411