1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetMeetHealthError {
22 Status503(models::MeetHealth),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum GetMeetSessionError {
30 UnknownValue(serde_json::Value),
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
35#[serde(untagged)]
36pub enum MeetCallError {
37 UnknownValue(serde_json::Value),
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum MeetRecordReadError {
44 UnknownValue(serde_json::Value),
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum MeetRecordStartError {
51 UnknownValue(serde_json::Value),
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum MeetRecordStopError {
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum PostMeetGettokenError {
65 UnknownValue(serde_json::Value),
66}
67
68
69pub async fn get_meet_health(configuration: &configuration::Configuration, ) -> Result<models::MeetHealth, Error<GetMeetHealthError>> {
71
72 let uri_str = format!("{}/v1/meet/health", configuration.base_path);
73 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
74
75 if let Some(ref user_agent) = configuration.user_agent {
76 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
77 }
78 if let Some(ref token) = configuration.bearer_access_token {
79 req_builder = req_builder.bearer_auth(token.to_owned());
80 };
81
82 let req = req_builder.build()?;
83 let resp = configuration.client.execute(req).await?;
84
85 let status = resp.status();
86 let content_type = resp
87 .headers()
88 .get("content-type")
89 .and_then(|v| v.to_str().ok())
90 .unwrap_or("application/octet-stream");
91 let content_type = super::ContentType::from(content_type);
92
93 if !status.is_client_error() && !status.is_server_error() {
94 let content = resp.text().await?;
95 match content_type {
96 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
97 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MeetHealth`"))),
98 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::MeetHealth`")))),
99 }
100 } else {
101 let content = resp.text().await?;
102 let entity: Option<GetMeetHealthError> = serde_json::from_str(&content).ok();
103 Err(Error::ResponseError(ResponseContent { status, content, entity }))
104 }
105}
106
107pub async fn get_meet_session(configuration: &configuration::Configuration, ) -> Result<(), Error<GetMeetSessionError>> {
109
110 let uri_str = format!("{}/v1/meet/session", configuration.base_path);
111 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
112
113 if let Some(ref user_agent) = configuration.user_agent {
114 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
115 }
116 if let Some(ref token) = configuration.bearer_access_token {
117 req_builder = req_builder.bearer_auth(token.to_owned());
118 };
119
120 let req = req_builder.build()?;
121 let resp = configuration.client.execute(req).await?;
122
123 let status = resp.status();
124
125 if !status.is_client_error() && !status.is_server_error() {
126 Ok(())
127 } else {
128 let content = resp.text().await?;
129 let entity: Option<GetMeetSessionError> = serde_json::from_str(&content).ok();
130 Err(Error::ResponseError(ResponseContent { status, content, entity }))
131 }
132}
133
134pub async fn meet_call(configuration: &configuration::Configuration, workspace: &str, room: &str) -> Result<models::Venue, Error<MeetCallError>> {
136 let p_workspace = workspace;
138 let p_room = room;
139
140 let uri_str = format!("{}/v1/meet/call", configuration.base_path);
141 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
142
143 req_builder = req_builder.query(&[("workspace", &p_workspace.to_string())]);
144 req_builder = req_builder.query(&[("room", &p_room.to_string())]);
145 if let Some(ref user_agent) = configuration.user_agent {
146 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
147 }
148 if let Some(ref token) = configuration.bearer_access_token {
149 req_builder = req_builder.bearer_auth(token.to_owned());
150 };
151
152 let req = req_builder.build()?;
153 let resp = configuration.client.execute(req).await?;
154
155 let status = resp.status();
156 let content_type = resp
157 .headers()
158 .get("content-type")
159 .and_then(|v| v.to_str().ok())
160 .unwrap_or("application/octet-stream");
161 let content_type = super::ContentType::from(content_type);
162
163 if !status.is_client_error() && !status.is_server_error() {
164 let content = resp.text().await?;
165 match content_type {
166 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
167 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Venue`"))),
168 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::Venue`")))),
169 }
170 } else {
171 let content = resp.text().await?;
172 let entity: Option<MeetCallError> = serde_json::from_str(&content).ok();
173 Err(Error::ResponseError(ResponseContent { status, content, entity }))
174 }
175}
176
177pub async fn meet_record_read(configuration: &configuration::Configuration, room: &str) -> Result<models::Recording, Error<MeetRecordReadError>> {
179 let p_room = room;
181
182 let uri_str = format!("{}/v1/meet/record", configuration.base_path);
183 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
184
185 req_builder = req_builder.query(&[("room", &p_room.to_string())]);
186 if let Some(ref user_agent) = configuration.user_agent {
187 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
188 }
189 if let Some(ref token) = configuration.bearer_access_token {
190 req_builder = req_builder.bearer_auth(token.to_owned());
191 };
192
193 let req = req_builder.build()?;
194 let resp = configuration.client.execute(req).await?;
195
196 let status = resp.status();
197 let content_type = resp
198 .headers()
199 .get("content-type")
200 .and_then(|v| v.to_str().ok())
201 .unwrap_or("application/octet-stream");
202 let content_type = super::ContentType::from(content_type);
203
204 if !status.is_client_error() && !status.is_server_error() {
205 let content = resp.text().await?;
206 match content_type {
207 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
208 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Recording`"))),
209 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::Recording`")))),
210 }
211 } else {
212 let content = resp.text().await?;
213 let entity: Option<MeetRecordReadError> = serde_json::from_str(&content).ok();
214 Err(Error::ResponseError(ResponseContent { status, content, entity }))
215 }
216}
217
218pub async fn meet_record_start(configuration: &configuration::Configuration, record_in: models::RecordIn) -> Result<models::Recording, Error<MeetRecordStartError>> {
220 let p_record_in = record_in;
222
223 let uri_str = format!("{}/v1/meet/record", configuration.base_path);
224 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
225
226 if let Some(ref user_agent) = configuration.user_agent {
227 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
228 }
229 if let Some(ref token) = configuration.bearer_access_token {
230 req_builder = req_builder.bearer_auth(token.to_owned());
231 };
232 req_builder = req_builder.json(&p_record_in);
233
234 let req = req_builder.build()?;
235 let resp = configuration.client.execute(req).await?;
236
237 let status = resp.status();
238 let content_type = resp
239 .headers()
240 .get("content-type")
241 .and_then(|v| v.to_str().ok())
242 .unwrap_or("application/octet-stream");
243 let content_type = super::ContentType::from(content_type);
244
245 if !status.is_client_error() && !status.is_server_error() {
246 let content = resp.text().await?;
247 match content_type {
248 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
249 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Recording`"))),
250 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::Recording`")))),
251 }
252 } else {
253 let content = resp.text().await?;
254 let entity: Option<MeetRecordStartError> = serde_json::from_str(&content).ok();
255 Err(Error::ResponseError(ResponseContent { status, content, entity }))
256 }
257}
258
259pub async fn meet_record_stop(configuration: &configuration::Configuration, room: &str) -> Result<models::Recording, Error<MeetRecordStopError>> {
261 let p_room = room;
263
264 let uri_str = format!("{}/v1/meet/record", configuration.base_path);
265 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
266
267 req_builder = req_builder.query(&[("room", &p_room.to_string())]);
268 if let Some(ref user_agent) = configuration.user_agent {
269 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
270 }
271 if let Some(ref token) = configuration.bearer_access_token {
272 req_builder = req_builder.bearer_auth(token.to_owned());
273 };
274
275 let req = req_builder.build()?;
276 let resp = configuration.client.execute(req).await?;
277
278 let status = resp.status();
279 let content_type = resp
280 .headers()
281 .get("content-type")
282 .and_then(|v| v.to_str().ok())
283 .unwrap_or("application/octet-stream");
284 let content_type = super::ContentType::from(content_type);
285
286 if !status.is_client_error() && !status.is_server_error() {
287 let content = resp.text().await?;
288 match content_type {
289 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
290 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Recording`"))),
291 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::Recording`")))),
292 }
293 } else {
294 let content = resp.text().await?;
295 let entity: Option<MeetRecordStopError> = serde_json::from_str(&content).ok();
296 Err(Error::ResponseError(ResponseContent { status, content, entity }))
297 }
298}
299
300pub async fn post_meet_gettoken(configuration: &configuration::Configuration, ) -> Result<(), Error<PostMeetGettokenError>> {
302
303 let uri_str = format!("{}/v1/meet/getToken", configuration.base_path);
304 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
305
306 if let Some(ref user_agent) = configuration.user_agent {
307 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
308 }
309 if let Some(ref token) = configuration.bearer_access_token {
310 req_builder = req_builder.bearer_auth(token.to_owned());
311 };
312
313 let req = req_builder.build()?;
314 let resp = configuration.client.execute(req).await?;
315
316 let status = resp.status();
317
318 if !status.is_client_error() && !status.is_server_error() {
319 Ok(())
320 } else {
321 let content = resp.text().await?;
322 let entity: Option<PostMeetGettokenError> = serde_json::from_str(&content).ok();
323 Err(Error::ResponseError(ResponseContent { status, content, entity }))
324 }
325}
326