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 CreatePresentationError {
22 Status400(models::CreateNote400Response),
23 Status401(models::ApiError),
24 Status500(models::ApiError),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum CreateSlideError {
32 Status400(models::ApiError),
33 Status401(models::ApiError),
34 Status404(models::ApiError),
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum CreateSlideElementError {
42 Status400(models::ApiError),
43 Status401(models::ApiError),
44 Status404(models::ApiError),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum DeletePresentationError {
52 Status401(models::ApiError),
53 Status404(models::ApiError),
54 UnknownValue(serde_json::Value),
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(untagged)]
60pub enum DeleteSlideError {
61 Status401(models::ApiError),
62 Status404(models::ApiError),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum DeleteSlideElementError {
70 Status401(models::ApiError),
71 Status404(models::ApiError),
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum DisablePresentationShareError {
79 Status401(models::ApiError),
80 Status403(models::ApiError),
81 Status404(models::ApiError),
82 UnknownValue(serde_json::Value),
83}
84
85#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum EnablePresentationShareError {
89 Status400(models::ApiError),
90 Status401(models::ApiError),
91 Status403(models::ApiError),
92 Status404(models::ApiError),
93 UnknownValue(serde_json::Value),
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum ExportPresentationPdfError {
100 Status400(models::ApiError),
101 Status401(models::ApiError),
102 Status502(models::ApiError),
103 Status503(models::ApiError),
104 UnknownValue(serde_json::Value),
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum ExportPresentationPptxError {
111 Status400(models::ApiError),
112 Status401(models::ApiError),
113 Status502(models::ApiError),
114 Status503(models::ApiError),
115 UnknownValue(serde_json::Value),
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum GetPresentationError {
122 Status400(models::CreateNote400Response),
123 Status401(models::ApiError),
124 Status404(models::ApiError),
125 UnknownValue(serde_json::Value),
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum GetPresentationShareSettingsError {
132 Status401(models::ApiError),
133 Status403(models::ApiError),
134 Status404(models::ApiError),
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum GetPublicPresentationError {
142 Status400(models::ApiError),
143 Status401(models::PasswordRequiredError),
144 Status404(models::ApiError),
145 Status500(models::ApiError),
146 UnknownValue(serde_json::Value),
147}
148
149#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum GetSlideError {
153 Status401(models::ApiError),
154 Status404(models::ApiError),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GetSlideElementError {
162 Status401(models::ApiError),
163 Status404(models::ApiError),
164 UnknownValue(serde_json::Value),
165}
166
167#[derive(Debug, Clone, Serialize, Deserialize)]
169#[serde(untagged)]
170pub enum ListPresentationsError {
171 Status401(models::ApiError),
172 Status500(models::ApiError),
173 UnknownValue(serde_json::Value),
174}
175
176#[derive(Debug, Clone, Serialize, Deserialize)]
178#[serde(untagged)]
179pub enum ListSlideElementsError {
180 Status401(models::ApiError),
181 Status404(models::ApiError),
182 UnknownValue(serde_json::Value),
183}
184
185#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum ListSlidesInPresentationError {
189 Status401(models::ApiError),
190 Status404(models::ApiError),
191 UnknownValue(serde_json::Value),
192}
193
194#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum RotatePresentationShareTokenError {
198 Status401(models::ApiError),
199 Status403(models::ApiError),
200 Status404(models::ApiError),
201 UnknownValue(serde_json::Value),
202}
203
204#[derive(Debug, Clone, Serialize, Deserialize)]
206#[serde(untagged)]
207pub enum UpdatePresentationError {
208 Status400(models::ApiError),
209 Status401(models::ApiError),
210 Status404(models::ApiError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum UpdateSlideError {
218 Status400(models::ApiError),
219 Status401(models::ApiError),
220 Status404(models::ApiError),
221 UnknownValue(serde_json::Value),
222}
223
224#[derive(Debug, Clone, Serialize, Deserialize)]
226#[serde(untagged)]
227pub enum UpdateSlideElementError {
228 Status400(models::ApiError),
229 Status401(models::ApiError),
230 Status404(models::ApiError),
231 UnknownValue(serde_json::Value),
232}
233
234
235pub async fn create_presentation(configuration: &configuration::Configuration, create_presentation_request: models::CreatePresentationRequest, account_id: Option<&str>, provider: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Presentation, Error<CreatePresentationError>> {
237 let p_body_create_presentation_request = create_presentation_request;
239 let p_query_account_id = account_id;
240 let p_query_provider = provider;
241 let p_header_x_workspace_id = x_workspace_id;
242
243 let uri_str = format!("{}/v1/slides", configuration.base_path);
244 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
245
246 if let Some(ref param_value) = p_query_account_id {
247 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
248 }
249 if let Some(ref param_value) = p_query_provider {
250 req_builder = req_builder.query(&[("provider", ¶m_value.to_string())]);
251 }
252 if let Some(ref user_agent) = configuration.user_agent {
253 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
254 }
255 if let Some(param_value) = p_header_x_workspace_id {
256 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
257 }
258 if let Some(ref token) = configuration.bearer_access_token {
259 req_builder = req_builder.bearer_auth(token.to_owned());
260 };
261 req_builder = req_builder.json(&p_body_create_presentation_request);
262
263 let req = req_builder.build()?;
264 let resp = configuration.client.execute(req).await?;
265
266 let status = resp.status();
267 let content_type = resp
268 .headers()
269 .get("content-type")
270 .and_then(|v| v.to_str().ok())
271 .unwrap_or("application/octet-stream");
272 let content_type = super::ContentType::from(content_type);
273
274 if !status.is_client_error() && !status.is_server_error() {
275 let content = resp.text().await?;
276 match content_type {
277 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
278 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Presentation`"))),
279 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::Presentation`")))),
280 }
281 } else {
282 let content = resp.text().await?;
283 let entity: Option<CreatePresentationError> = serde_json::from_str(&content).ok();
284 Err(Error::ResponseError(ResponseContent { status, content, entity }))
285 }
286}
287
288pub async fn create_slide(configuration: &configuration::Configuration, id: &str, create_slide_request: models::CreateSlideRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Slide, Error<CreateSlideError>> {
289 let p_path_id = id;
291 let p_body_create_slide_request = create_slide_request;
292 let p_query_account_id = account_id;
293 let p_header_x_workspace_id = x_workspace_id;
294
295 let uri_str = format!("{}/v1/slides/{id}/slides", configuration.base_path, id=crate::apis::urlencode(p_path_id));
296 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
297
298 if let Some(ref param_value) = p_query_account_id {
299 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
300 }
301 if let Some(ref user_agent) = configuration.user_agent {
302 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
303 }
304 if let Some(param_value) = p_header_x_workspace_id {
305 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
306 }
307 if let Some(ref token) = configuration.bearer_access_token {
308 req_builder = req_builder.bearer_auth(token.to_owned());
309 };
310 req_builder = req_builder.json(&p_body_create_slide_request);
311
312 let req = req_builder.build()?;
313 let resp = configuration.client.execute(req).await?;
314
315 let status = resp.status();
316 let content_type = resp
317 .headers()
318 .get("content-type")
319 .and_then(|v| v.to_str().ok())
320 .unwrap_or("application/octet-stream");
321 let content_type = super::ContentType::from(content_type);
322
323 if !status.is_client_error() && !status.is_server_error() {
324 let content = resp.text().await?;
325 match content_type {
326 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
327 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Slide`"))),
328 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::Slide`")))),
329 }
330 } else {
331 let content = resp.text().await?;
332 let entity: Option<CreateSlideError> = serde_json::from_str(&content).ok();
333 Err(Error::ResponseError(ResponseContent { status, content, entity }))
334 }
335}
336
337pub async fn create_slide_element(configuration: &configuration::Configuration, id: &str, slide_id: &str, create_slide_element_request: models::CreateSlideElementRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SlideElement, Error<CreateSlideElementError>> {
338 let p_path_id = id;
340 let p_path_slide_id = slide_id;
341 let p_body_create_slide_element_request = create_slide_element_request;
342 let p_query_account_id = account_id;
343 let p_header_x_workspace_id = x_workspace_id;
344
345 let uri_str = format!("{}/v1/slides/{id}/slides/{slideId}/elements", configuration.base_path, id=crate::apis::urlencode(p_path_id), slideId=crate::apis::urlencode(p_path_slide_id));
346 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
347
348 if let Some(ref param_value) = p_query_account_id {
349 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
350 }
351 if let Some(ref user_agent) = configuration.user_agent {
352 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
353 }
354 if let Some(param_value) = p_header_x_workspace_id {
355 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
356 }
357 if let Some(ref token) = configuration.bearer_access_token {
358 req_builder = req_builder.bearer_auth(token.to_owned());
359 };
360 req_builder = req_builder.json(&p_body_create_slide_element_request);
361
362 let req = req_builder.build()?;
363 let resp = configuration.client.execute(req).await?;
364
365 let status = resp.status();
366 let content_type = resp
367 .headers()
368 .get("content-type")
369 .and_then(|v| v.to_str().ok())
370 .unwrap_or("application/octet-stream");
371 let content_type = super::ContentType::from(content_type);
372
373 if !status.is_client_error() && !status.is_server_error() {
374 let content = resp.text().await?;
375 match content_type {
376 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
377 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SlideElement`"))),
378 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::SlideElement`")))),
379 }
380 } else {
381 let content = resp.text().await?;
382 let entity: Option<CreateSlideElementError> = serde_json::from_str(&content).ok();
383 Err(Error::ResponseError(ResponseContent { status, content, entity }))
384 }
385}
386
387pub async fn delete_presentation(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<DeletePresentationError>> {
388 let p_path_id = id;
390 let p_query_account_id = account_id;
391 let p_header_x_workspace_id = x_workspace_id;
392
393 let uri_str = format!("{}/v1/slides/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
394 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
395
396 if let Some(ref param_value) = p_query_account_id {
397 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
398 }
399 if let Some(ref user_agent) = configuration.user_agent {
400 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
401 }
402 if let Some(param_value) = p_header_x_workspace_id {
403 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
404 }
405 if let Some(ref token) = configuration.bearer_access_token {
406 req_builder = req_builder.bearer_auth(token.to_owned());
407 };
408
409 let req = req_builder.build()?;
410 let resp = configuration.client.execute(req).await?;
411
412 let status = resp.status();
413 let content_type = resp
414 .headers()
415 .get("content-type")
416 .and_then(|v| v.to_str().ok())
417 .unwrap_or("application/octet-stream");
418 let content_type = super::ContentType::from(content_type);
419
420 if !status.is_client_error() && !status.is_server_error() {
421 let content = resp.text().await?;
422 match content_type {
423 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
424 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
425 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SuccessFlag`")))),
426 }
427 } else {
428 let content = resp.text().await?;
429 let entity: Option<DeletePresentationError> = serde_json::from_str(&content).ok();
430 Err(Error::ResponseError(ResponseContent { status, content, entity }))
431 }
432}
433
434pub async fn delete_slide(configuration: &configuration::Configuration, id: &str, slide_id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<DeleteSlideError>> {
435 let p_path_id = id;
437 let p_path_slide_id = slide_id;
438 let p_query_account_id = account_id;
439 let p_header_x_workspace_id = x_workspace_id;
440
441 let uri_str = format!("{}/v1/slides/{id}/slides/{slideId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), slideId=crate::apis::urlencode(p_path_slide_id));
442 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
443
444 if let Some(ref param_value) = p_query_account_id {
445 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
446 }
447 if let Some(ref user_agent) = configuration.user_agent {
448 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
449 }
450 if let Some(param_value) = p_header_x_workspace_id {
451 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
452 }
453 if let Some(ref token) = configuration.bearer_access_token {
454 req_builder = req_builder.bearer_auth(token.to_owned());
455 };
456
457 let req = req_builder.build()?;
458 let resp = configuration.client.execute(req).await?;
459
460 let status = resp.status();
461 let content_type = resp
462 .headers()
463 .get("content-type")
464 .and_then(|v| v.to_str().ok())
465 .unwrap_or("application/octet-stream");
466 let content_type = super::ContentType::from(content_type);
467
468 if !status.is_client_error() && !status.is_server_error() {
469 let content = resp.text().await?;
470 match content_type {
471 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
472 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
473 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SuccessFlag`")))),
474 }
475 } else {
476 let content = resp.text().await?;
477 let entity: Option<DeleteSlideError> = serde_json::from_str(&content).ok();
478 Err(Error::ResponseError(ResponseContent { status, content, entity }))
479 }
480}
481
482pub async fn delete_slide_element(configuration: &configuration::Configuration, id: &str, slide_id: &str, element_id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<DeleteSlideElementError>> {
483 let p_path_id = id;
485 let p_path_slide_id = slide_id;
486 let p_path_element_id = element_id;
487 let p_query_account_id = account_id;
488 let p_header_x_workspace_id = x_workspace_id;
489
490 let uri_str = format!("{}/v1/slides/{id}/slides/{slideId}/elements/{elementId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), slideId=crate::apis::urlencode(p_path_slide_id), elementId=crate::apis::urlencode(p_path_element_id));
491 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
492
493 if let Some(ref param_value) = p_query_account_id {
494 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
495 }
496 if let Some(ref user_agent) = configuration.user_agent {
497 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
498 }
499 if let Some(param_value) = p_header_x_workspace_id {
500 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
501 }
502 if let Some(ref token) = configuration.bearer_access_token {
503 req_builder = req_builder.bearer_auth(token.to_owned());
504 };
505
506 let req = req_builder.build()?;
507 let resp = configuration.client.execute(req).await?;
508
509 let status = resp.status();
510 let content_type = resp
511 .headers()
512 .get("content-type")
513 .and_then(|v| v.to_str().ok())
514 .unwrap_or("application/octet-stream");
515 let content_type = super::ContentType::from(content_type);
516
517 if !status.is_client_error() && !status.is_server_error() {
518 let content = resp.text().await?;
519 match content_type {
520 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
521 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
522 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SuccessFlag`")))),
523 }
524 } else {
525 let content = resp.text().await?;
526 let entity: Option<DeleteSlideElementError> = serde_json::from_str(&content).ok();
527 Err(Error::ResponseError(ResponseContent { status, content, entity }))
528 }
529}
530
531pub async fn disable_presentation_share(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<(), Error<DisablePresentationShareError>> {
533 let p_path_id = id;
535 let p_query_account_id = account_id;
536 let p_header_x_workspace_id = x_workspace_id;
537
538 let uri_str = format!("{}/v1/slides/{id}/share", configuration.base_path, id=crate::apis::urlencode(p_path_id));
539 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
540
541 if let Some(ref param_value) = p_query_account_id {
542 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
543 }
544 if let Some(ref user_agent) = configuration.user_agent {
545 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
546 }
547 if let Some(param_value) = p_header_x_workspace_id {
548 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
549 }
550 if let Some(ref token) = configuration.bearer_access_token {
551 req_builder = req_builder.bearer_auth(token.to_owned());
552 };
553
554 let req = req_builder.build()?;
555 let resp = configuration.client.execute(req).await?;
556
557 let status = resp.status();
558
559 if !status.is_client_error() && !status.is_server_error() {
560 Ok(())
561 } else {
562 let content = resp.text().await?;
563 let entity: Option<DisablePresentationShareError> = serde_json::from_str(&content).ok();
564 Err(Error::ResponseError(ResponseContent { status, content, entity }))
565 }
566}
567
568pub async fn enable_presentation_share(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>, enable_share_request: Option<models::EnableShareRequest>) -> Result<models::ShareSettings, Error<EnablePresentationShareError>> {
570 let p_path_id = id;
572 let p_query_account_id = account_id;
573 let p_header_x_workspace_id = x_workspace_id;
574 let p_body_enable_share_request = enable_share_request;
575
576 let uri_str = format!("{}/v1/slides/{id}/share", configuration.base_path, id=crate::apis::urlencode(p_path_id));
577 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
578
579 if let Some(ref param_value) = p_query_account_id {
580 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
581 }
582 if let Some(ref user_agent) = configuration.user_agent {
583 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
584 }
585 if let Some(param_value) = p_header_x_workspace_id {
586 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
587 }
588 if let Some(ref token) = configuration.bearer_access_token {
589 req_builder = req_builder.bearer_auth(token.to_owned());
590 };
591 req_builder = req_builder.json(&p_body_enable_share_request);
592
593 let req = req_builder.build()?;
594 let resp = configuration.client.execute(req).await?;
595
596 let status = resp.status();
597 let content_type = resp
598 .headers()
599 .get("content-type")
600 .and_then(|v| v.to_str().ok())
601 .unwrap_or("application/octet-stream");
602 let content_type = super::ContentType::from(content_type);
603
604 if !status.is_client_error() && !status.is_server_error() {
605 let content = resp.text().await?;
606 match content_type {
607 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
608 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ShareSettings`"))),
609 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::ShareSettings`")))),
610 }
611 } else {
612 let content = resp.text().await?;
613 let entity: Option<EnablePresentationShareError> = serde_json::from_str(&content).ok();
614 Err(Error::ResponseError(ResponseContent { status, content, entity }))
615 }
616}
617
618pub async fn export_presentation_pdf(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>, storage: Option<&str>, filename: Option<&str>, export_pdf_request: Option<models::ExportPdfRequest>) -> Result<reqwest::Response, Error<ExportPresentationPdfError>> {
620 let p_path_id = id;
622 let p_query_account_id = account_id;
623 let p_header_x_workspace_id = x_workspace_id;
624 let p_query_storage = storage;
625 let p_query_filename = filename;
626 let p_body_export_pdf_request = export_pdf_request;
627
628 let uri_str = format!("{}/v1/slides/{id}/export/pdf", configuration.base_path, id=crate::apis::urlencode(p_path_id));
629 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
630
631 if let Some(ref param_value) = p_query_account_id {
632 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
633 }
634 if let Some(ref param_value) = p_query_storage {
635 req_builder = req_builder.query(&[("storage", ¶m_value.to_string())]);
636 }
637 if let Some(ref param_value) = p_query_filename {
638 req_builder = req_builder.query(&[("filename", ¶m_value.to_string())]);
639 }
640 if let Some(ref user_agent) = configuration.user_agent {
641 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
642 }
643 if let Some(param_value) = p_header_x_workspace_id {
644 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
645 }
646 if let Some(ref token) = configuration.bearer_access_token {
647 req_builder = req_builder.bearer_auth(token.to_owned());
648 };
649 req_builder = req_builder.json(&p_body_export_pdf_request);
650
651 let req = req_builder.build()?;
652 let resp = configuration.client.execute(req).await?;
653
654 let status = resp.status();
655
656 if !status.is_client_error() && !status.is_server_error() {
657 Ok(resp)
658 } else {
659 let content = resp.text().await?;
660 let entity: Option<ExportPresentationPdfError> = serde_json::from_str(&content).ok();
661 Err(Error::ResponseError(ResponseContent { status, content, entity }))
662 }
663}
664
665pub async fn export_presentation_pptx(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>, storage: Option<&str>, filename: Option<&str>, export_pdf_request: Option<models::ExportPdfRequest>) -> Result<reqwest::Response, Error<ExportPresentationPptxError>> {
667 let p_path_id = id;
669 let p_query_account_id = account_id;
670 let p_header_x_workspace_id = x_workspace_id;
671 let p_query_storage = storage;
672 let p_query_filename = filename;
673 let p_body_export_pdf_request = export_pdf_request;
674
675 let uri_str = format!("{}/v1/slides/{id}/export/pptx", configuration.base_path, id=crate::apis::urlencode(p_path_id));
676 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
677
678 if let Some(ref param_value) = p_query_account_id {
679 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
680 }
681 if let Some(ref param_value) = p_query_storage {
682 req_builder = req_builder.query(&[("storage", ¶m_value.to_string())]);
683 }
684 if let Some(ref param_value) = p_query_filename {
685 req_builder = req_builder.query(&[("filename", ¶m_value.to_string())]);
686 }
687 if let Some(ref user_agent) = configuration.user_agent {
688 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
689 }
690 if let Some(param_value) = p_header_x_workspace_id {
691 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
692 }
693 if let Some(ref token) = configuration.bearer_access_token {
694 req_builder = req_builder.bearer_auth(token.to_owned());
695 };
696 req_builder = req_builder.json(&p_body_export_pdf_request);
697
698 let req = req_builder.build()?;
699 let resp = configuration.client.execute(req).await?;
700
701 let status = resp.status();
702
703 if !status.is_client_error() && !status.is_server_error() {
704 Ok(resp)
705 } else {
706 let content = resp.text().await?;
707 let entity: Option<ExportPresentationPptxError> = serde_json::from_str(&content).ok();
708 Err(Error::ResponseError(ResponseContent { status, content, entity }))
709 }
710}
711
712pub async fn get_presentation(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Presentation, Error<GetPresentationError>> {
713 let p_path_id = id;
715 let p_query_account_id = account_id;
716 let p_header_x_workspace_id = x_workspace_id;
717
718 let uri_str = format!("{}/v1/slides/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
719 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
720
721 if let Some(ref param_value) = p_query_account_id {
722 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
723 }
724 if let Some(ref user_agent) = configuration.user_agent {
725 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
726 }
727 if let Some(param_value) = p_header_x_workspace_id {
728 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
729 }
730 if let Some(ref token) = configuration.bearer_access_token {
731 req_builder = req_builder.bearer_auth(token.to_owned());
732 };
733
734 let req = req_builder.build()?;
735 let resp = configuration.client.execute(req).await?;
736
737 let status = resp.status();
738 let content_type = resp
739 .headers()
740 .get("content-type")
741 .and_then(|v| v.to_str().ok())
742 .unwrap_or("application/octet-stream");
743 let content_type = super::ContentType::from(content_type);
744
745 if !status.is_client_error() && !status.is_server_error() {
746 let content = resp.text().await?;
747 match content_type {
748 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
749 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Presentation`"))),
750 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::Presentation`")))),
751 }
752 } else {
753 let content = resp.text().await?;
754 let entity: Option<GetPresentationError> = serde_json::from_str(&content).ok();
755 Err(Error::ResponseError(ResponseContent { status, content, entity }))
756 }
757}
758
759pub async fn get_presentation_share_settings(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::ShareSettings, Error<GetPresentationShareSettingsError>> {
761 let p_path_id = id;
763 let p_query_account_id = account_id;
764 let p_header_x_workspace_id = x_workspace_id;
765
766 let uri_str = format!("{}/v1/slides/{id}/share", configuration.base_path, id=crate::apis::urlencode(p_path_id));
767 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
768
769 if let Some(ref param_value) = p_query_account_id {
770 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
771 }
772 if let Some(ref user_agent) = configuration.user_agent {
773 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
774 }
775 if let Some(param_value) = p_header_x_workspace_id {
776 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
777 }
778 if let Some(ref token) = configuration.bearer_access_token {
779 req_builder = req_builder.bearer_auth(token.to_owned());
780 };
781
782 let req = req_builder.build()?;
783 let resp = configuration.client.execute(req).await?;
784
785 let status = resp.status();
786 let content_type = resp
787 .headers()
788 .get("content-type")
789 .and_then(|v| v.to_str().ok())
790 .unwrap_or("application/octet-stream");
791 let content_type = super::ContentType::from(content_type);
792
793 if !status.is_client_error() && !status.is_server_error() {
794 let content = resp.text().await?;
795 match content_type {
796 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
797 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ShareSettings`"))),
798 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::ShareSettings`")))),
799 }
800 } else {
801 let content = resp.text().await?;
802 let entity: Option<GetPresentationShareSettingsError> = serde_json::from_str(&content).ok();
803 Err(Error::ResponseError(ResponseContent { status, content, entity }))
804 }
805}
806
807pub async fn get_public_presentation(configuration: &configuration::Configuration, token: &str, password: Option<&str>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPublicPresentationError>> {
809 let p_path_token = token;
811 let p_query_password = password;
812
813 let uri_str = format!("{}/public/slides/{token}", configuration.base_path, token=crate::apis::urlencode(p_path_token));
814 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
815
816 if let Some(ref param_value) = p_query_password {
817 req_builder = req_builder.query(&[("password", ¶m_value.to_string())]);
818 }
819 if let Some(ref user_agent) = configuration.user_agent {
820 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
821 }
822
823 let req = req_builder.build()?;
824 let resp = configuration.client.execute(req).await?;
825
826 let status = resp.status();
827 let content_type = resp
828 .headers()
829 .get("content-type")
830 .and_then(|v| v.to_str().ok())
831 .unwrap_or("application/octet-stream");
832 let content_type = super::ContentType::from(content_type);
833
834 if !status.is_client_error() && !status.is_server_error() {
835 let content = resp.text().await?;
836 match content_type {
837 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
838 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
839 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<String, serde_json::Value>`")))),
840 }
841 } else {
842 let content = resp.text().await?;
843 let entity: Option<GetPublicPresentationError> = serde_json::from_str(&content).ok();
844 Err(Error::ResponseError(ResponseContent { status, content, entity }))
845 }
846}
847
848pub async fn get_slide(configuration: &configuration::Configuration, id: &str, slide_id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Slide, Error<GetSlideError>> {
849 let p_path_id = id;
851 let p_path_slide_id = slide_id;
852 let p_query_account_id = account_id;
853 let p_header_x_workspace_id = x_workspace_id;
854
855 let uri_str = format!("{}/v1/slides/{id}/slides/{slideId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), slideId=crate::apis::urlencode(p_path_slide_id));
856 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
857
858 if let Some(ref param_value) = p_query_account_id {
859 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
860 }
861 if let Some(ref user_agent) = configuration.user_agent {
862 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
863 }
864 if let Some(param_value) = p_header_x_workspace_id {
865 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
866 }
867 if let Some(ref token) = configuration.bearer_access_token {
868 req_builder = req_builder.bearer_auth(token.to_owned());
869 };
870
871 let req = req_builder.build()?;
872 let resp = configuration.client.execute(req).await?;
873
874 let status = resp.status();
875 let content_type = resp
876 .headers()
877 .get("content-type")
878 .and_then(|v| v.to_str().ok())
879 .unwrap_or("application/octet-stream");
880 let content_type = super::ContentType::from(content_type);
881
882 if !status.is_client_error() && !status.is_server_error() {
883 let content = resp.text().await?;
884 match content_type {
885 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
886 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Slide`"))),
887 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::Slide`")))),
888 }
889 } else {
890 let content = resp.text().await?;
891 let entity: Option<GetSlideError> = serde_json::from_str(&content).ok();
892 Err(Error::ResponseError(ResponseContent { status, content, entity }))
893 }
894}
895
896pub async fn get_slide_element(configuration: &configuration::Configuration, id: &str, slide_id: &str, element_id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SlideElement, Error<GetSlideElementError>> {
897 let p_path_id = id;
899 let p_path_slide_id = slide_id;
900 let p_path_element_id = element_id;
901 let p_query_account_id = account_id;
902 let p_header_x_workspace_id = x_workspace_id;
903
904 let uri_str = format!("{}/v1/slides/{id}/slides/{slideId}/elements/{elementId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), slideId=crate::apis::urlencode(p_path_slide_id), elementId=crate::apis::urlencode(p_path_element_id));
905 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
906
907 if let Some(ref param_value) = p_query_account_id {
908 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
909 }
910 if let Some(ref user_agent) = configuration.user_agent {
911 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
912 }
913 if let Some(param_value) = p_header_x_workspace_id {
914 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
915 }
916 if let Some(ref token) = configuration.bearer_access_token {
917 req_builder = req_builder.bearer_auth(token.to_owned());
918 };
919
920 let req = req_builder.build()?;
921 let resp = configuration.client.execute(req).await?;
922
923 let status = resp.status();
924 let content_type = resp
925 .headers()
926 .get("content-type")
927 .and_then(|v| v.to_str().ok())
928 .unwrap_or("application/octet-stream");
929 let content_type = super::ContentType::from(content_type);
930
931 if !status.is_client_error() && !status.is_server_error() {
932 let content = resp.text().await?;
933 match content_type {
934 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
935 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SlideElement`"))),
936 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::SlideElement`")))),
937 }
938 } else {
939 let content = resp.text().await?;
940 let entity: Option<GetSlideElementError> = serde_json::from_str(&content).ok();
941 Err(Error::ResponseError(ResponseContent { status, content, entity }))
942 }
943}
944
945pub async fn list_presentations(configuration: &configuration::Configuration, account_id: Option<&str>, provider: Option<&str>, x_workspace_id: Option<&str>, limit: Option<i32>, offset: Option<i32>) -> Result<models::PresentationListEnvelope, Error<ListPresentationsError>> {
947 let p_query_account_id = account_id;
949 let p_query_provider = provider;
950 let p_header_x_workspace_id = x_workspace_id;
951 let p_query_limit = limit;
952 let p_query_offset = offset;
953
954 let uri_str = format!("{}/v1/slides", configuration.base_path);
955 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
956
957 if let Some(ref param_value) = p_query_account_id {
958 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
959 }
960 if let Some(ref param_value) = p_query_provider {
961 req_builder = req_builder.query(&[("provider", ¶m_value.to_string())]);
962 }
963 if let Some(ref param_value) = p_query_limit {
964 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
965 }
966 if let Some(ref param_value) = p_query_offset {
967 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
968 }
969 if let Some(ref user_agent) = configuration.user_agent {
970 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
971 }
972 if let Some(param_value) = p_header_x_workspace_id {
973 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
974 }
975 if let Some(ref token) = configuration.bearer_access_token {
976 req_builder = req_builder.bearer_auth(token.to_owned());
977 };
978
979 let req = req_builder.build()?;
980 let resp = configuration.client.execute(req).await?;
981
982 let status = resp.status();
983 let content_type = resp
984 .headers()
985 .get("content-type")
986 .and_then(|v| v.to_str().ok())
987 .unwrap_or("application/octet-stream");
988 let content_type = super::ContentType::from(content_type);
989
990 if !status.is_client_error() && !status.is_server_error() {
991 let content = resp.text().await?;
992 match content_type {
993 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
994 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PresentationListEnvelope`"))),
995 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::PresentationListEnvelope`")))),
996 }
997 } else {
998 let content = resp.text().await?;
999 let entity: Option<ListPresentationsError> = serde_json::from_str(&content).ok();
1000 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1001 }
1002}
1003
1004pub async fn list_slide_elements(configuration: &configuration::Configuration, id: &str, slide_id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SlideElementList, Error<ListSlideElementsError>> {
1005 let p_path_id = id;
1007 let p_path_slide_id = slide_id;
1008 let p_query_account_id = account_id;
1009 let p_header_x_workspace_id = x_workspace_id;
1010
1011 let uri_str = format!("{}/v1/slides/{id}/slides/{slideId}/elements", configuration.base_path, id=crate::apis::urlencode(p_path_id), slideId=crate::apis::urlencode(p_path_slide_id));
1012 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1013
1014 if let Some(ref param_value) = p_query_account_id {
1015 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1016 }
1017 if let Some(ref user_agent) = configuration.user_agent {
1018 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1019 }
1020 if let Some(param_value) = p_header_x_workspace_id {
1021 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
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 `models::SlideElementList`"))),
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 `models::SlideElementList`")))),
1044 }
1045 } else {
1046 let content = resp.text().await?;
1047 let entity: Option<ListSlideElementsError> = serde_json::from_str(&content).ok();
1048 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1049 }
1050}
1051
1052pub async fn list_slides_in_presentation(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SlideList, Error<ListSlidesInPresentationError>> {
1054 let p_path_id = id;
1056 let p_query_account_id = account_id;
1057 let p_header_x_workspace_id = x_workspace_id;
1058
1059 let uri_str = format!("{}/v1/slides/{id}/slides", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1060 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1061
1062 if let Some(ref param_value) = p_query_account_id {
1063 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1064 }
1065 if let Some(ref user_agent) = configuration.user_agent {
1066 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1067 }
1068 if let Some(param_value) = p_header_x_workspace_id {
1069 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1070 }
1071 if let Some(ref token) = configuration.bearer_access_token {
1072 req_builder = req_builder.bearer_auth(token.to_owned());
1073 };
1074
1075 let req = req_builder.build()?;
1076 let resp = configuration.client.execute(req).await?;
1077
1078 let status = resp.status();
1079 let content_type = resp
1080 .headers()
1081 .get("content-type")
1082 .and_then(|v| v.to_str().ok())
1083 .unwrap_or("application/octet-stream");
1084 let content_type = super::ContentType::from(content_type);
1085
1086 if !status.is_client_error() && !status.is_server_error() {
1087 let content = resp.text().await?;
1088 match content_type {
1089 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1090 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SlideList`"))),
1091 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::SlideList`")))),
1092 }
1093 } else {
1094 let content = resp.text().await?;
1095 let entity: Option<ListSlidesInPresentationError> = serde_json::from_str(&content).ok();
1096 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1097 }
1098}
1099
1100pub async fn rotate_presentation_share_token(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::ShareSettings, Error<RotatePresentationShareTokenError>> {
1101 let p_path_id = id;
1103 let p_query_account_id = account_id;
1104 let p_header_x_workspace_id = x_workspace_id;
1105
1106 let uri_str = format!("{}/v1/slides/{id}/share/rotate", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1107 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1108
1109 if let Some(ref param_value) = p_query_account_id {
1110 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1111 }
1112 if let Some(ref user_agent) = configuration.user_agent {
1113 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1114 }
1115 if let Some(param_value) = p_header_x_workspace_id {
1116 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1117 }
1118 if let Some(ref token) = configuration.bearer_access_token {
1119 req_builder = req_builder.bearer_auth(token.to_owned());
1120 };
1121
1122 let req = req_builder.build()?;
1123 let resp = configuration.client.execute(req).await?;
1124
1125 let status = resp.status();
1126 let content_type = resp
1127 .headers()
1128 .get("content-type")
1129 .and_then(|v| v.to_str().ok())
1130 .unwrap_or("application/octet-stream");
1131 let content_type = super::ContentType::from(content_type);
1132
1133 if !status.is_client_error() && !status.is_server_error() {
1134 let content = resp.text().await?;
1135 match content_type {
1136 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1137 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ShareSettings`"))),
1138 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::ShareSettings`")))),
1139 }
1140 } else {
1141 let content = resp.text().await?;
1142 let entity: Option<RotatePresentationShareTokenError> = serde_json::from_str(&content).ok();
1143 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1144 }
1145}
1146
1147pub async fn update_presentation(configuration: &configuration::Configuration, id: &str, update_presentation_request: models::UpdatePresentationRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Presentation, Error<UpdatePresentationError>> {
1148 let p_path_id = id;
1150 let p_body_update_presentation_request = update_presentation_request;
1151 let p_query_account_id = account_id;
1152 let p_header_x_workspace_id = x_workspace_id;
1153
1154 let uri_str = format!("{}/v1/slides/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1155 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1156
1157 if let Some(ref param_value) = p_query_account_id {
1158 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1159 }
1160 if let Some(ref user_agent) = configuration.user_agent {
1161 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1162 }
1163 if let Some(param_value) = p_header_x_workspace_id {
1164 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1165 }
1166 if let Some(ref token) = configuration.bearer_access_token {
1167 req_builder = req_builder.bearer_auth(token.to_owned());
1168 };
1169 req_builder = req_builder.json(&p_body_update_presentation_request);
1170
1171 let req = req_builder.build()?;
1172 let resp = configuration.client.execute(req).await?;
1173
1174 let status = resp.status();
1175 let content_type = resp
1176 .headers()
1177 .get("content-type")
1178 .and_then(|v| v.to_str().ok())
1179 .unwrap_or("application/octet-stream");
1180 let content_type = super::ContentType::from(content_type);
1181
1182 if !status.is_client_error() && !status.is_server_error() {
1183 let content = resp.text().await?;
1184 match content_type {
1185 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1186 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Presentation`"))),
1187 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::Presentation`")))),
1188 }
1189 } else {
1190 let content = resp.text().await?;
1191 let entity: Option<UpdatePresentationError> = serde_json::from_str(&content).ok();
1192 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1193 }
1194}
1195
1196pub async fn update_slide(configuration: &configuration::Configuration, id: &str, slide_id: &str, update_slide_request: models::UpdateSlideRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Slide, Error<UpdateSlideError>> {
1197 let p_path_id = id;
1199 let p_path_slide_id = slide_id;
1200 let p_body_update_slide_request = update_slide_request;
1201 let p_query_account_id = account_id;
1202 let p_header_x_workspace_id = x_workspace_id;
1203
1204 let uri_str = format!("{}/v1/slides/{id}/slides/{slideId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), slideId=crate::apis::urlencode(p_path_slide_id));
1205 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1206
1207 if let Some(ref param_value) = p_query_account_id {
1208 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1209 }
1210 if let Some(ref user_agent) = configuration.user_agent {
1211 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1212 }
1213 if let Some(param_value) = p_header_x_workspace_id {
1214 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1215 }
1216 if let Some(ref token) = configuration.bearer_access_token {
1217 req_builder = req_builder.bearer_auth(token.to_owned());
1218 };
1219 req_builder = req_builder.json(&p_body_update_slide_request);
1220
1221 let req = req_builder.build()?;
1222 let resp = configuration.client.execute(req).await?;
1223
1224 let status = resp.status();
1225 let content_type = resp
1226 .headers()
1227 .get("content-type")
1228 .and_then(|v| v.to_str().ok())
1229 .unwrap_or("application/octet-stream");
1230 let content_type = super::ContentType::from(content_type);
1231
1232 if !status.is_client_error() && !status.is_server_error() {
1233 let content = resp.text().await?;
1234 match content_type {
1235 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1236 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Slide`"))),
1237 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::Slide`")))),
1238 }
1239 } else {
1240 let content = resp.text().await?;
1241 let entity: Option<UpdateSlideError> = serde_json::from_str(&content).ok();
1242 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1243 }
1244}
1245
1246pub async fn update_slide_element(configuration: &configuration::Configuration, id: &str, slide_id: &str, element_id: &str, update_slide_element_request: models::UpdateSlideElementRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SlideElement, Error<UpdateSlideElementError>> {
1247 let p_path_id = id;
1249 let p_path_slide_id = slide_id;
1250 let p_path_element_id = element_id;
1251 let p_body_update_slide_element_request = update_slide_element_request;
1252 let p_query_account_id = account_id;
1253 let p_header_x_workspace_id = x_workspace_id;
1254
1255 let uri_str = format!("{}/v1/slides/{id}/slides/{slideId}/elements/{elementId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), slideId=crate::apis::urlencode(p_path_slide_id), elementId=crate::apis::urlencode(p_path_element_id));
1256 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1257
1258 if let Some(ref param_value) = p_query_account_id {
1259 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1260 }
1261 if let Some(ref user_agent) = configuration.user_agent {
1262 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1263 }
1264 if let Some(param_value) = p_header_x_workspace_id {
1265 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1266 }
1267 if let Some(ref token) = configuration.bearer_access_token {
1268 req_builder = req_builder.bearer_auth(token.to_owned());
1269 };
1270 req_builder = req_builder.json(&p_body_update_slide_element_request);
1271
1272 let req = req_builder.build()?;
1273 let resp = configuration.client.execute(req).await?;
1274
1275 let status = resp.status();
1276 let content_type = resp
1277 .headers()
1278 .get("content-type")
1279 .and_then(|v| v.to_str().ok())
1280 .unwrap_or("application/octet-stream");
1281 let content_type = super::ContentType::from(content_type);
1282
1283 if !status.is_client_error() && !status.is_server_error() {
1284 let content = resp.text().await?;
1285 match content_type {
1286 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1287 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SlideElement`"))),
1288 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::SlideElement`")))),
1289 }
1290 } else {
1291 let content = resp.text().await?;
1292 let entity: Option<UpdateSlideElementError> = serde_json::from_str(&content).ok();
1293 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1294 }
1295}
1296