1use reqwest;
13
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum SourcesAllDestroyError {
22 Status400(models::ValidationError),
23 Status403(models::GenericError),
24 UnknownValue(serde_json::Value),
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum SourcesAllListError {
31 Status400(models::ValidationError),
32 Status403(models::GenericError),
33 UnknownValue(serde_json::Value),
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum SourcesAllRetrieveError {
40 Status400(models::ValidationError),
41 Status403(models::GenericError),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum SourcesAllSetIconCreateError {
49 Status400(),
50 Status403(models::GenericError),
51 UnknownValue(serde_json::Value),
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum SourcesAllSetIconUrlCreateError {
58 Status400(),
59 Status403(models::GenericError),
60 UnknownValue(serde_json::Value),
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum SourcesAllTypesListError {
67 Status400(models::ValidationError),
68 Status403(models::GenericError),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum SourcesAllUsedByListError {
76 Status400(models::ValidationError),
77 Status403(models::GenericError),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum SourcesAllUserSettingsListError {
85 Status400(models::ValidationError),
86 Status403(models::GenericError),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum SourcesLdapCreateError {
94 Status400(models::ValidationError),
95 Status403(models::GenericError),
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum SourcesLdapDebugRetrieveError {
103 Status400(models::ValidationError),
104 Status403(models::GenericError),
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum SourcesLdapDestroyError {
112 Status400(models::ValidationError),
113 Status403(models::GenericError),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum SourcesLdapListError {
121 Status400(models::ValidationError),
122 Status403(models::GenericError),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum SourcesLdapPartialUpdateError {
130 Status400(models::ValidationError),
131 Status403(models::GenericError),
132 UnknownValue(serde_json::Value),
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum SourcesLdapRetrieveError {
139 Status400(models::ValidationError),
140 Status403(models::GenericError),
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum SourcesLdapSyncStatusRetrieveError {
148 Status400(models::ValidationError),
149 Status403(models::GenericError),
150 UnknownValue(serde_json::Value),
151}
152
153#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum SourcesLdapUpdateError {
157 Status400(models::ValidationError),
158 Status403(models::GenericError),
159 UnknownValue(serde_json::Value),
160}
161
162#[derive(Debug, Clone, Serialize, Deserialize)]
164#[serde(untagged)]
165pub enum SourcesLdapUsedByListError {
166 Status400(models::ValidationError),
167 Status403(models::GenericError),
168 UnknownValue(serde_json::Value),
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum SourcesOauthCreateError {
175 Status400(models::ValidationError),
176 Status403(models::GenericError),
177 UnknownValue(serde_json::Value),
178}
179
180#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum SourcesOauthDestroyError {
184 Status400(models::ValidationError),
185 Status403(models::GenericError),
186 UnknownValue(serde_json::Value),
187}
188
189#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum SourcesOauthListError {
193 Status400(models::ValidationError),
194 Status403(models::GenericError),
195 UnknownValue(serde_json::Value),
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum SourcesOauthPartialUpdateError {
202 Status400(models::ValidationError),
203 Status403(models::GenericError),
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum SourcesOauthRetrieveError {
211 Status400(models::ValidationError),
212 Status403(models::GenericError),
213 UnknownValue(serde_json::Value),
214}
215
216#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum SourcesOauthSourceTypesListError {
220 Status400(models::ValidationError),
221 Status403(models::GenericError),
222 UnknownValue(serde_json::Value),
223}
224
225#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum SourcesOauthUpdateError {
229 Status400(models::ValidationError),
230 Status403(models::GenericError),
231 UnknownValue(serde_json::Value),
232}
233
234#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum SourcesOauthUsedByListError {
238 Status400(models::ValidationError),
239 Status403(models::GenericError),
240 UnknownValue(serde_json::Value),
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum SourcesPlexCreateError {
247 Status400(models::ValidationError),
248 Status403(models::GenericError),
249 UnknownValue(serde_json::Value),
250}
251
252#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum SourcesPlexDestroyError {
256 Status400(models::ValidationError),
257 Status403(models::GenericError),
258 UnknownValue(serde_json::Value),
259}
260
261#[derive(Debug, Clone, Serialize, Deserialize)]
263#[serde(untagged)]
264pub enum SourcesPlexListError {
265 Status400(models::ValidationError),
266 Status403(models::GenericError),
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum SourcesPlexPartialUpdateError {
274 Status400(models::ValidationError),
275 Status403(models::GenericError),
276 UnknownValue(serde_json::Value),
277}
278
279#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum SourcesPlexRedeemTokenAuthenticatedCreateError {
283 Status400(),
284 Status403(),
285 UnknownValue(serde_json::Value),
286}
287
288#[derive(Debug, Clone, Serialize, Deserialize)]
290#[serde(untagged)]
291pub enum SourcesPlexRedeemTokenCreateError {
292 Status400(),
293 Status403(),
294 UnknownValue(serde_json::Value),
295}
296
297#[derive(Debug, Clone, Serialize, Deserialize)]
299#[serde(untagged)]
300pub enum SourcesPlexRetrieveError {
301 Status400(models::ValidationError),
302 Status403(models::GenericError),
303 UnknownValue(serde_json::Value),
304}
305
306#[derive(Debug, Clone, Serialize, Deserialize)]
308#[serde(untagged)]
309pub enum SourcesPlexUpdateError {
310 Status400(models::ValidationError),
311 Status403(models::GenericError),
312 UnknownValue(serde_json::Value),
313}
314
315#[derive(Debug, Clone, Serialize, Deserialize)]
317#[serde(untagged)]
318pub enum SourcesPlexUsedByListError {
319 Status400(models::ValidationError),
320 Status403(models::GenericError),
321 UnknownValue(serde_json::Value),
322}
323
324#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum SourcesSamlCreateError {
328 Status400(models::ValidationError),
329 Status403(models::GenericError),
330 UnknownValue(serde_json::Value),
331}
332
333#[derive(Debug, Clone, Serialize, Deserialize)]
335#[serde(untagged)]
336pub enum SourcesSamlDestroyError {
337 Status400(models::ValidationError),
338 Status403(models::GenericError),
339 UnknownValue(serde_json::Value),
340}
341
342#[derive(Debug, Clone, Serialize, Deserialize)]
344#[serde(untagged)]
345pub enum SourcesSamlListError {
346 Status400(models::ValidationError),
347 Status403(models::GenericError),
348 UnknownValue(serde_json::Value),
349}
350
351#[derive(Debug, Clone, Serialize, Deserialize)]
353#[serde(untagged)]
354pub enum SourcesSamlMetadataRetrieveError {
355 Status400(models::ValidationError),
356 Status403(models::GenericError),
357 UnknownValue(serde_json::Value),
358}
359
360#[derive(Debug, Clone, Serialize, Deserialize)]
362#[serde(untagged)]
363pub enum SourcesSamlPartialUpdateError {
364 Status400(models::ValidationError),
365 Status403(models::GenericError),
366 UnknownValue(serde_json::Value),
367}
368
369#[derive(Debug, Clone, Serialize, Deserialize)]
371#[serde(untagged)]
372pub enum SourcesSamlRetrieveError {
373 Status400(models::ValidationError),
374 Status403(models::GenericError),
375 UnknownValue(serde_json::Value),
376}
377
378#[derive(Debug, Clone, Serialize, Deserialize)]
380#[serde(untagged)]
381pub enum SourcesSamlUpdateError {
382 Status400(models::ValidationError),
383 Status403(models::GenericError),
384 UnknownValue(serde_json::Value),
385}
386
387#[derive(Debug, Clone, Serialize, Deserialize)]
389#[serde(untagged)]
390pub enum SourcesSamlUsedByListError {
391 Status400(models::ValidationError),
392 Status403(models::GenericError),
393 UnknownValue(serde_json::Value),
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum SourcesUserConnectionsAllDestroyError {
400 Status400(models::ValidationError),
401 Status403(models::GenericError),
402 UnknownValue(serde_json::Value),
403}
404
405#[derive(Debug, Clone, Serialize, Deserialize)]
407#[serde(untagged)]
408pub enum SourcesUserConnectionsAllListError {
409 Status400(models::ValidationError),
410 Status403(models::GenericError),
411 UnknownValue(serde_json::Value),
412}
413
414#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum SourcesUserConnectionsAllPartialUpdateError {
418 Status400(models::ValidationError),
419 Status403(models::GenericError),
420 UnknownValue(serde_json::Value),
421}
422
423#[derive(Debug, Clone, Serialize, Deserialize)]
425#[serde(untagged)]
426pub enum SourcesUserConnectionsAllRetrieveError {
427 Status400(models::ValidationError),
428 Status403(models::GenericError),
429 UnknownValue(serde_json::Value),
430}
431
432#[derive(Debug, Clone, Serialize, Deserialize)]
434#[serde(untagged)]
435pub enum SourcesUserConnectionsAllUpdateError {
436 Status400(models::ValidationError),
437 Status403(models::GenericError),
438 UnknownValue(serde_json::Value),
439}
440
441#[derive(Debug, Clone, Serialize, Deserialize)]
443#[serde(untagged)]
444pub enum SourcesUserConnectionsAllUsedByListError {
445 Status400(models::ValidationError),
446 Status403(models::GenericError),
447 UnknownValue(serde_json::Value),
448}
449
450#[derive(Debug, Clone, Serialize, Deserialize)]
452#[serde(untagged)]
453pub enum SourcesUserConnectionsOauthCreateError {
454 Status400(models::ValidationError),
455 Status403(models::GenericError),
456 UnknownValue(serde_json::Value),
457}
458
459#[derive(Debug, Clone, Serialize, Deserialize)]
461#[serde(untagged)]
462pub enum SourcesUserConnectionsOauthDestroyError {
463 Status400(models::ValidationError),
464 Status403(models::GenericError),
465 UnknownValue(serde_json::Value),
466}
467
468#[derive(Debug, Clone, Serialize, Deserialize)]
470#[serde(untagged)]
471pub enum SourcesUserConnectionsOauthListError {
472 Status400(models::ValidationError),
473 Status403(models::GenericError),
474 UnknownValue(serde_json::Value),
475}
476
477#[derive(Debug, Clone, Serialize, Deserialize)]
479#[serde(untagged)]
480pub enum SourcesUserConnectionsOauthPartialUpdateError {
481 Status400(models::ValidationError),
482 Status403(models::GenericError),
483 UnknownValue(serde_json::Value),
484}
485
486#[derive(Debug, Clone, Serialize, Deserialize)]
488#[serde(untagged)]
489pub enum SourcesUserConnectionsOauthRetrieveError {
490 Status400(models::ValidationError),
491 Status403(models::GenericError),
492 UnknownValue(serde_json::Value),
493}
494
495#[derive(Debug, Clone, Serialize, Deserialize)]
497#[serde(untagged)]
498pub enum SourcesUserConnectionsOauthUpdateError {
499 Status400(models::ValidationError),
500 Status403(models::GenericError),
501 UnknownValue(serde_json::Value),
502}
503
504#[derive(Debug, Clone, Serialize, Deserialize)]
506#[serde(untagged)]
507pub enum SourcesUserConnectionsOauthUsedByListError {
508 Status400(models::ValidationError),
509 Status403(models::GenericError),
510 UnknownValue(serde_json::Value),
511}
512
513#[derive(Debug, Clone, Serialize, Deserialize)]
515#[serde(untagged)]
516pub enum SourcesUserConnectionsPlexCreateError {
517 Status400(models::ValidationError),
518 Status403(models::GenericError),
519 UnknownValue(serde_json::Value),
520}
521
522#[derive(Debug, Clone, Serialize, Deserialize)]
524#[serde(untagged)]
525pub enum SourcesUserConnectionsPlexDestroyError {
526 Status400(models::ValidationError),
527 Status403(models::GenericError),
528 UnknownValue(serde_json::Value),
529}
530
531#[derive(Debug, Clone, Serialize, Deserialize)]
533#[serde(untagged)]
534pub enum SourcesUserConnectionsPlexListError {
535 Status400(models::ValidationError),
536 Status403(models::GenericError),
537 UnknownValue(serde_json::Value),
538}
539
540#[derive(Debug, Clone, Serialize, Deserialize)]
542#[serde(untagged)]
543pub enum SourcesUserConnectionsPlexPartialUpdateError {
544 Status400(models::ValidationError),
545 Status403(models::GenericError),
546 UnknownValue(serde_json::Value),
547}
548
549#[derive(Debug, Clone, Serialize, Deserialize)]
551#[serde(untagged)]
552pub enum SourcesUserConnectionsPlexRetrieveError {
553 Status400(models::ValidationError),
554 Status403(models::GenericError),
555 UnknownValue(serde_json::Value),
556}
557
558#[derive(Debug, Clone, Serialize, Deserialize)]
560#[serde(untagged)]
561pub enum SourcesUserConnectionsPlexUpdateError {
562 Status400(models::ValidationError),
563 Status403(models::GenericError),
564 UnknownValue(serde_json::Value),
565}
566
567#[derive(Debug, Clone, Serialize, Deserialize)]
569#[serde(untagged)]
570pub enum SourcesUserConnectionsPlexUsedByListError {
571 Status400(models::ValidationError),
572 Status403(models::GenericError),
573 UnknownValue(serde_json::Value),
574}
575
576#[derive(Debug, Clone, Serialize, Deserialize)]
578#[serde(untagged)]
579pub enum SourcesUserConnectionsSamlCreateError {
580 Status400(models::ValidationError),
581 Status403(models::GenericError),
582 UnknownValue(serde_json::Value),
583}
584
585#[derive(Debug, Clone, Serialize, Deserialize)]
587#[serde(untagged)]
588pub enum SourcesUserConnectionsSamlDestroyError {
589 Status400(models::ValidationError),
590 Status403(models::GenericError),
591 UnknownValue(serde_json::Value),
592}
593
594#[derive(Debug, Clone, Serialize, Deserialize)]
596#[serde(untagged)]
597pub enum SourcesUserConnectionsSamlListError {
598 Status400(models::ValidationError),
599 Status403(models::GenericError),
600 UnknownValue(serde_json::Value),
601}
602
603#[derive(Debug, Clone, Serialize, Deserialize)]
605#[serde(untagged)]
606pub enum SourcesUserConnectionsSamlPartialUpdateError {
607 Status400(models::ValidationError),
608 Status403(models::GenericError),
609 UnknownValue(serde_json::Value),
610}
611
612#[derive(Debug, Clone, Serialize, Deserialize)]
614#[serde(untagged)]
615pub enum SourcesUserConnectionsSamlRetrieveError {
616 Status400(models::ValidationError),
617 Status403(models::GenericError),
618 UnknownValue(serde_json::Value),
619}
620
621#[derive(Debug, Clone, Serialize, Deserialize)]
623#[serde(untagged)]
624pub enum SourcesUserConnectionsSamlUpdateError {
625 Status400(models::ValidationError),
626 Status403(models::GenericError),
627 UnknownValue(serde_json::Value),
628}
629
630#[derive(Debug, Clone, Serialize, Deserialize)]
632#[serde(untagged)]
633pub enum SourcesUserConnectionsSamlUsedByListError {
634 Status400(models::ValidationError),
635 Status403(models::GenericError),
636 UnknownValue(serde_json::Value),
637}
638
639
640pub async fn sources_all_destroy(configuration: &configuration::Configuration, slug: &str) -> Result<(), Error<SourcesAllDestroyError>> {
642 let local_var_configuration = configuration;
643
644 let local_var_client = &local_var_configuration.client;
645
646 let local_var_uri_str = format!("{}/sources/all/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
647 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
648
649 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
650 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
651 }
652 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
653 let local_var_key = local_var_apikey.key.clone();
654 let local_var_value = match local_var_apikey.prefix {
655 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
656 None => local_var_key,
657 };
658 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
659 };
660
661 let local_var_req = local_var_req_builder.build()?;
662 let local_var_resp = local_var_client.execute(local_var_req).await?;
663
664 let local_var_status = local_var_resp.status();
665 let local_var_content = local_var_resp.text().await?;
666
667 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
668 Ok(())
669 } else {
670 let local_var_entity: Option<SourcesAllDestroyError> = serde_json::from_str(&local_var_content).ok();
671 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
672 Err(Error::ResponseError(local_var_error))
673 }
674}
675
676pub async fn sources_all_list(configuration: &configuration::Configuration, managed: Option<&str>, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, slug: Option<&str>) -> Result<models::PaginatedSourceList, Error<SourcesAllListError>> {
678 let local_var_configuration = configuration;
679
680 let local_var_client = &local_var_configuration.client;
681
682 let local_var_uri_str = format!("{}/sources/all/", local_var_configuration.base_path);
683 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
684
685 if let Some(ref local_var_str) = managed {
686 local_var_req_builder = local_var_req_builder.query(&[("managed", &local_var_str.to_string())]);
687 }
688 if let Some(ref local_var_str) = name {
689 local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
690 }
691 if let Some(ref local_var_str) = ordering {
692 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
693 }
694 if let Some(ref local_var_str) = page {
695 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
696 }
697 if let Some(ref local_var_str) = page_size {
698 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
699 }
700 if let Some(ref local_var_str) = search {
701 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
702 }
703 if let Some(ref local_var_str) = slug {
704 local_var_req_builder = local_var_req_builder.query(&[("slug", &local_var_str.to_string())]);
705 }
706 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
707 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
708 }
709 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
710 let local_var_key = local_var_apikey.key.clone();
711 let local_var_value = match local_var_apikey.prefix {
712 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
713 None => local_var_key,
714 };
715 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
716 };
717
718 let local_var_req = local_var_req_builder.build()?;
719 let local_var_resp = local_var_client.execute(local_var_req).await?;
720
721 let local_var_status = local_var_resp.status();
722 let local_var_content = local_var_resp.text().await?;
723
724 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
725 serde_json::from_str(&local_var_content).map_err(Error::from)
726 } else {
727 let local_var_entity: Option<SourcesAllListError> = serde_json::from_str(&local_var_content).ok();
728 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
729 Err(Error::ResponseError(local_var_error))
730 }
731}
732
733pub async fn sources_all_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::Source, Error<SourcesAllRetrieveError>> {
735 let local_var_configuration = configuration;
736
737 let local_var_client = &local_var_configuration.client;
738
739 let local_var_uri_str = format!("{}/sources/all/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
740 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
741
742 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
743 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
744 }
745 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
746 let local_var_key = local_var_apikey.key.clone();
747 let local_var_value = match local_var_apikey.prefix {
748 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
749 None => local_var_key,
750 };
751 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
752 };
753
754 let local_var_req = local_var_req_builder.build()?;
755 let local_var_resp = local_var_client.execute(local_var_req).await?;
756
757 let local_var_status = local_var_resp.status();
758 let local_var_content = local_var_resp.text().await?;
759
760 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
761 serde_json::from_str(&local_var_content).map_err(Error::from)
762 } else {
763 let local_var_entity: Option<SourcesAllRetrieveError> = serde_json::from_str(&local_var_content).ok();
764 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
765 Err(Error::ResponseError(local_var_error))
766 }
767}
768
769pub async fn sources_all_set_icon_create(configuration: &configuration::Configuration, slug: &str, file: Option<std::path::PathBuf>, clear: Option<bool>) -> Result<(), Error<SourcesAllSetIconCreateError>> {
771 let local_var_configuration = configuration;
772
773 let local_var_client = &local_var_configuration.client;
774
775 let local_var_uri_str = format!("{}/sources/all/{slug}/set_icon/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
776 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
777
778 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
779 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
780 }
781 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
782 let local_var_key = local_var_apikey.key.clone();
783 let local_var_value = match local_var_apikey.prefix {
784 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
785 None => local_var_key,
786 };
787 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
788 };
789 let mut local_var_form = reqwest::multipart::Form::new();
790 if let Some(local_var_param_value) = clear {
792 local_var_form = local_var_form.text("clear", local_var_param_value.to_string());
793 }
794 local_var_req_builder = local_var_req_builder.multipart(local_var_form);
795
796 let local_var_req = local_var_req_builder.build()?;
797 let local_var_resp = local_var_client.execute(local_var_req).await?;
798
799 let local_var_status = local_var_resp.status();
800 let local_var_content = local_var_resp.text().await?;
801
802 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
803 Ok(())
804 } else {
805 let local_var_entity: Option<SourcesAllSetIconCreateError> = serde_json::from_str(&local_var_content).ok();
806 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
807 Err(Error::ResponseError(local_var_error))
808 }
809}
810
811pub async fn sources_all_set_icon_url_create(configuration: &configuration::Configuration, slug: &str, file_path_request: models::FilePathRequest) -> Result<(), Error<SourcesAllSetIconUrlCreateError>> {
813 let local_var_configuration = configuration;
814
815 let local_var_client = &local_var_configuration.client;
816
817 let local_var_uri_str = format!("{}/sources/all/{slug}/set_icon_url/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
818 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
819
820 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
821 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
822 }
823 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
824 let local_var_key = local_var_apikey.key.clone();
825 let local_var_value = match local_var_apikey.prefix {
826 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
827 None => local_var_key,
828 };
829 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
830 };
831 local_var_req_builder = local_var_req_builder.json(&file_path_request);
832
833 let local_var_req = local_var_req_builder.build()?;
834 let local_var_resp = local_var_client.execute(local_var_req).await?;
835
836 let local_var_status = local_var_resp.status();
837 let local_var_content = local_var_resp.text().await?;
838
839 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
840 Ok(())
841 } else {
842 let local_var_entity: Option<SourcesAllSetIconUrlCreateError> = serde_json::from_str(&local_var_content).ok();
843 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
844 Err(Error::ResponseError(local_var_error))
845 }
846}
847
848pub async fn sources_all_types_list(configuration: &configuration::Configuration, ) -> Result<Vec<models::TypeCreate>, Error<SourcesAllTypesListError>> {
850 let local_var_configuration = configuration;
851
852 let local_var_client = &local_var_configuration.client;
853
854 let local_var_uri_str = format!("{}/sources/all/types/", local_var_configuration.base_path);
855 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
856
857 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
858 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
859 }
860 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
861 let local_var_key = local_var_apikey.key.clone();
862 let local_var_value = match local_var_apikey.prefix {
863 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
864 None => local_var_key,
865 };
866 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
867 };
868
869 let local_var_req = local_var_req_builder.build()?;
870 let local_var_resp = local_var_client.execute(local_var_req).await?;
871
872 let local_var_status = local_var_resp.status();
873 let local_var_content = local_var_resp.text().await?;
874
875 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
876 serde_json::from_str(&local_var_content).map_err(Error::from)
877 } else {
878 let local_var_entity: Option<SourcesAllTypesListError> = serde_json::from_str(&local_var_content).ok();
879 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
880 Err(Error::ResponseError(local_var_error))
881 }
882}
883
884pub async fn sources_all_used_by_list(configuration: &configuration::Configuration, slug: &str) -> Result<Vec<models::UsedBy>, Error<SourcesAllUsedByListError>> {
886 let local_var_configuration = configuration;
887
888 let local_var_client = &local_var_configuration.client;
889
890 let local_var_uri_str = format!("{}/sources/all/{slug}/used_by/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
891 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
892
893 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
894 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
895 }
896 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
897 let local_var_key = local_var_apikey.key.clone();
898 let local_var_value = match local_var_apikey.prefix {
899 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
900 None => local_var_key,
901 };
902 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
903 };
904
905 let local_var_req = local_var_req_builder.build()?;
906 let local_var_resp = local_var_client.execute(local_var_req).await?;
907
908 let local_var_status = local_var_resp.status();
909 let local_var_content = local_var_resp.text().await?;
910
911 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
912 serde_json::from_str(&local_var_content).map_err(Error::from)
913 } else {
914 let local_var_entity: Option<SourcesAllUsedByListError> = serde_json::from_str(&local_var_content).ok();
915 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
916 Err(Error::ResponseError(local_var_error))
917 }
918}
919
920pub async fn sources_all_user_settings_list(configuration: &configuration::Configuration, ) -> Result<Vec<models::UserSetting>, Error<SourcesAllUserSettingsListError>> {
922 let local_var_configuration = configuration;
923
924 let local_var_client = &local_var_configuration.client;
925
926 let local_var_uri_str = format!("{}/sources/all/user_settings/", local_var_configuration.base_path);
927 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
928
929 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
930 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
931 }
932 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
933 let local_var_key = local_var_apikey.key.clone();
934 let local_var_value = match local_var_apikey.prefix {
935 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
936 None => local_var_key,
937 };
938 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
939 };
940
941 let local_var_req = local_var_req_builder.build()?;
942 let local_var_resp = local_var_client.execute(local_var_req).await?;
943
944 let local_var_status = local_var_resp.status();
945 let local_var_content = local_var_resp.text().await?;
946
947 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
948 serde_json::from_str(&local_var_content).map_err(Error::from)
949 } else {
950 let local_var_entity: Option<SourcesAllUserSettingsListError> = serde_json::from_str(&local_var_content).ok();
951 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
952 Err(Error::ResponseError(local_var_error))
953 }
954}
955
956pub async fn sources_ldap_create(configuration: &configuration::Configuration, ldap_source_request: models::LdapSourceRequest) -> Result<models::LdapSource, Error<SourcesLdapCreateError>> {
958 let local_var_configuration = configuration;
959
960 let local_var_client = &local_var_configuration.client;
961
962 let local_var_uri_str = format!("{}/sources/ldap/", local_var_configuration.base_path);
963 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
964
965 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
966 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
967 }
968 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
969 let local_var_key = local_var_apikey.key.clone();
970 let local_var_value = match local_var_apikey.prefix {
971 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
972 None => local_var_key,
973 };
974 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
975 };
976 local_var_req_builder = local_var_req_builder.json(&ldap_source_request);
977
978 let local_var_req = local_var_req_builder.build()?;
979 let local_var_resp = local_var_client.execute(local_var_req).await?;
980
981 let local_var_status = local_var_resp.status();
982 let local_var_content = local_var_resp.text().await?;
983
984 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
985 serde_json::from_str(&local_var_content).map_err(Error::from)
986 } else {
987 let local_var_entity: Option<SourcesLdapCreateError> = serde_json::from_str(&local_var_content).ok();
988 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
989 Err(Error::ResponseError(local_var_error))
990 }
991}
992
993pub async fn sources_ldap_debug_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::LdapDebug, Error<SourcesLdapDebugRetrieveError>> {
995 let local_var_configuration = configuration;
996
997 let local_var_client = &local_var_configuration.client;
998
999 let local_var_uri_str = format!("{}/sources/ldap/{slug}/debug/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1000 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1001
1002 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1003 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1004 }
1005 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1006 let local_var_key = local_var_apikey.key.clone();
1007 let local_var_value = match local_var_apikey.prefix {
1008 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1009 None => local_var_key,
1010 };
1011 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1012 };
1013
1014 let local_var_req = local_var_req_builder.build()?;
1015 let local_var_resp = local_var_client.execute(local_var_req).await?;
1016
1017 let local_var_status = local_var_resp.status();
1018 let local_var_content = local_var_resp.text().await?;
1019
1020 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1021 serde_json::from_str(&local_var_content).map_err(Error::from)
1022 } else {
1023 let local_var_entity: Option<SourcesLdapDebugRetrieveError> = serde_json::from_str(&local_var_content).ok();
1024 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1025 Err(Error::ResponseError(local_var_error))
1026 }
1027}
1028
1029pub async fn sources_ldap_destroy(configuration: &configuration::Configuration, slug: &str) -> Result<(), Error<SourcesLdapDestroyError>> {
1031 let local_var_configuration = configuration;
1032
1033 let local_var_client = &local_var_configuration.client;
1034
1035 let local_var_uri_str = format!("{}/sources/ldap/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1036 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1037
1038 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1039 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1040 }
1041 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1042 let local_var_key = local_var_apikey.key.clone();
1043 let local_var_value = match local_var_apikey.prefix {
1044 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1045 None => local_var_key,
1046 };
1047 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1048 };
1049
1050 let local_var_req = local_var_req_builder.build()?;
1051 let local_var_resp = local_var_client.execute(local_var_req).await?;
1052
1053 let local_var_status = local_var_resp.status();
1054 let local_var_content = local_var_resp.text().await?;
1055
1056 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1057 Ok(())
1058 } else {
1059 let local_var_entity: Option<SourcesLdapDestroyError> = serde_json::from_str(&local_var_content).ok();
1060 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1061 Err(Error::ResponseError(local_var_error))
1062 }
1063}
1064
1065pub async fn sources_ldap_list(configuration: &configuration::Configuration, additional_group_dn: Option<&str>, additional_user_dn: Option<&str>, base_dn: Option<&str>, bind_cn: Option<&str>, client_certificate: Option<&str>, enabled: Option<bool>, group_membership_field: Option<&str>, group_object_filter: Option<&str>, name: Option<&str>, object_uniqueness_field: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, peer_certificate: Option<&str>, property_mappings: Option<Vec<uuid::Uuid>>, property_mappings_group: Option<Vec<uuid::Uuid>>, search: Option<&str>, server_uri: Option<&str>, slug: Option<&str>, sni: Option<bool>, start_tls: Option<bool>, sync_groups: Option<bool>, sync_parent_group: Option<&str>, sync_users: Option<bool>, sync_users_password: Option<bool>, user_object_filter: Option<&str>) -> Result<models::PaginatedLdapSourceList, Error<SourcesLdapListError>> {
1067 let local_var_configuration = configuration;
1068
1069 let local_var_client = &local_var_configuration.client;
1070
1071 let local_var_uri_str = format!("{}/sources/ldap/", local_var_configuration.base_path);
1072 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1073
1074 if let Some(ref local_var_str) = additional_group_dn {
1075 local_var_req_builder = local_var_req_builder.query(&[("additional_group_dn", &local_var_str.to_string())]);
1076 }
1077 if let Some(ref local_var_str) = additional_user_dn {
1078 local_var_req_builder = local_var_req_builder.query(&[("additional_user_dn", &local_var_str.to_string())]);
1079 }
1080 if let Some(ref local_var_str) = base_dn {
1081 local_var_req_builder = local_var_req_builder.query(&[("base_dn", &local_var_str.to_string())]);
1082 }
1083 if let Some(ref local_var_str) = bind_cn {
1084 local_var_req_builder = local_var_req_builder.query(&[("bind_cn", &local_var_str.to_string())]);
1085 }
1086 if let Some(ref local_var_str) = client_certificate {
1087 local_var_req_builder = local_var_req_builder.query(&[("client_certificate", &local_var_str.to_string())]);
1088 }
1089 if let Some(ref local_var_str) = enabled {
1090 local_var_req_builder = local_var_req_builder.query(&[("enabled", &local_var_str.to_string())]);
1091 }
1092 if let Some(ref local_var_str) = group_membership_field {
1093 local_var_req_builder = local_var_req_builder.query(&[("group_membership_field", &local_var_str.to_string())]);
1094 }
1095 if let Some(ref local_var_str) = group_object_filter {
1096 local_var_req_builder = local_var_req_builder.query(&[("group_object_filter", &local_var_str.to_string())]);
1097 }
1098 if let Some(ref local_var_str) = name {
1099 local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
1100 }
1101 if let Some(ref local_var_str) = object_uniqueness_field {
1102 local_var_req_builder = local_var_req_builder.query(&[("object_uniqueness_field", &local_var_str.to_string())]);
1103 }
1104 if let Some(ref local_var_str) = ordering {
1105 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1106 }
1107 if let Some(ref local_var_str) = page {
1108 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1109 }
1110 if let Some(ref local_var_str) = page_size {
1111 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1112 }
1113 if let Some(ref local_var_str) = peer_certificate {
1114 local_var_req_builder = local_var_req_builder.query(&[("peer_certificate", &local_var_str.to_string())]);
1115 }
1116 if let Some(ref local_var_str) = property_mappings {
1117 local_var_req_builder = match "multi" {
1118 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("property_mappings".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
1119 _ => local_var_req_builder.query(&[("property_mappings", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
1120 };
1121 }
1122 if let Some(ref local_var_str) = property_mappings_group {
1123 local_var_req_builder = match "multi" {
1124 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("property_mappings_group".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
1125 _ => local_var_req_builder.query(&[("property_mappings_group", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
1126 };
1127 }
1128 if let Some(ref local_var_str) = search {
1129 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1130 }
1131 if let Some(ref local_var_str) = server_uri {
1132 local_var_req_builder = local_var_req_builder.query(&[("server_uri", &local_var_str.to_string())]);
1133 }
1134 if let Some(ref local_var_str) = slug {
1135 local_var_req_builder = local_var_req_builder.query(&[("slug", &local_var_str.to_string())]);
1136 }
1137 if let Some(ref local_var_str) = sni {
1138 local_var_req_builder = local_var_req_builder.query(&[("sni", &local_var_str.to_string())]);
1139 }
1140 if let Some(ref local_var_str) = start_tls {
1141 local_var_req_builder = local_var_req_builder.query(&[("start_tls", &local_var_str.to_string())]);
1142 }
1143 if let Some(ref local_var_str) = sync_groups {
1144 local_var_req_builder = local_var_req_builder.query(&[("sync_groups", &local_var_str.to_string())]);
1145 }
1146 if let Some(ref local_var_str) = sync_parent_group {
1147 local_var_req_builder = local_var_req_builder.query(&[("sync_parent_group", &local_var_str.to_string())]);
1148 }
1149 if let Some(ref local_var_str) = sync_users {
1150 local_var_req_builder = local_var_req_builder.query(&[("sync_users", &local_var_str.to_string())]);
1151 }
1152 if let Some(ref local_var_str) = sync_users_password {
1153 local_var_req_builder = local_var_req_builder.query(&[("sync_users_password", &local_var_str.to_string())]);
1154 }
1155 if let Some(ref local_var_str) = user_object_filter {
1156 local_var_req_builder = local_var_req_builder.query(&[("user_object_filter", &local_var_str.to_string())]);
1157 }
1158 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1159 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1160 }
1161 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1162 let local_var_key = local_var_apikey.key.clone();
1163 let local_var_value = match local_var_apikey.prefix {
1164 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1165 None => local_var_key,
1166 };
1167 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1168 };
1169
1170 let local_var_req = local_var_req_builder.build()?;
1171 let local_var_resp = local_var_client.execute(local_var_req).await?;
1172
1173 let local_var_status = local_var_resp.status();
1174 let local_var_content = local_var_resp.text().await?;
1175
1176 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1177 serde_json::from_str(&local_var_content).map_err(Error::from)
1178 } else {
1179 let local_var_entity: Option<SourcesLdapListError> = serde_json::from_str(&local_var_content).ok();
1180 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1181 Err(Error::ResponseError(local_var_error))
1182 }
1183}
1184
1185pub async fn sources_ldap_partial_update(configuration: &configuration::Configuration, slug: &str, patched_ldap_source_request: Option<models::PatchedLdapSourceRequest>) -> Result<models::LdapSource, Error<SourcesLdapPartialUpdateError>> {
1187 let local_var_configuration = configuration;
1188
1189 let local_var_client = &local_var_configuration.client;
1190
1191 let local_var_uri_str = format!("{}/sources/ldap/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1192 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1193
1194 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1195 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1196 }
1197 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1198 let local_var_key = local_var_apikey.key.clone();
1199 let local_var_value = match local_var_apikey.prefix {
1200 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1201 None => local_var_key,
1202 };
1203 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1204 };
1205 local_var_req_builder = local_var_req_builder.json(&patched_ldap_source_request);
1206
1207 let local_var_req = local_var_req_builder.build()?;
1208 let local_var_resp = local_var_client.execute(local_var_req).await?;
1209
1210 let local_var_status = local_var_resp.status();
1211 let local_var_content = local_var_resp.text().await?;
1212
1213 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1214 serde_json::from_str(&local_var_content).map_err(Error::from)
1215 } else {
1216 let local_var_entity: Option<SourcesLdapPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
1217 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1218 Err(Error::ResponseError(local_var_error))
1219 }
1220}
1221
1222pub async fn sources_ldap_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::LdapSource, Error<SourcesLdapRetrieveError>> {
1224 let local_var_configuration = configuration;
1225
1226 let local_var_client = &local_var_configuration.client;
1227
1228 let local_var_uri_str = format!("{}/sources/ldap/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1229 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1230
1231 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1232 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1233 }
1234 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1235 let local_var_key = local_var_apikey.key.clone();
1236 let local_var_value = match local_var_apikey.prefix {
1237 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1238 None => local_var_key,
1239 };
1240 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1241 };
1242
1243 let local_var_req = local_var_req_builder.build()?;
1244 let local_var_resp = local_var_client.execute(local_var_req).await?;
1245
1246 let local_var_status = local_var_resp.status();
1247 let local_var_content = local_var_resp.text().await?;
1248
1249 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1250 serde_json::from_str(&local_var_content).map_err(Error::from)
1251 } else {
1252 let local_var_entity: Option<SourcesLdapRetrieveError> = serde_json::from_str(&local_var_content).ok();
1253 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1254 Err(Error::ResponseError(local_var_error))
1255 }
1256}
1257
1258pub async fn sources_ldap_sync_status_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::LdapSyncStatus, Error<SourcesLdapSyncStatusRetrieveError>> {
1260 let local_var_configuration = configuration;
1261
1262 let local_var_client = &local_var_configuration.client;
1263
1264 let local_var_uri_str = format!("{}/sources/ldap/{slug}/sync_status/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1265 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1266
1267 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1268 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1269 }
1270 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1271 let local_var_key = local_var_apikey.key.clone();
1272 let local_var_value = match local_var_apikey.prefix {
1273 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1274 None => local_var_key,
1275 };
1276 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1277 };
1278
1279 let local_var_req = local_var_req_builder.build()?;
1280 let local_var_resp = local_var_client.execute(local_var_req).await?;
1281
1282 let local_var_status = local_var_resp.status();
1283 let local_var_content = local_var_resp.text().await?;
1284
1285 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1286 serde_json::from_str(&local_var_content).map_err(Error::from)
1287 } else {
1288 let local_var_entity: Option<SourcesLdapSyncStatusRetrieveError> = serde_json::from_str(&local_var_content).ok();
1289 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1290 Err(Error::ResponseError(local_var_error))
1291 }
1292}
1293
1294pub async fn sources_ldap_update(configuration: &configuration::Configuration, slug: &str, ldap_source_request: models::LdapSourceRequest) -> Result<models::LdapSource, Error<SourcesLdapUpdateError>> {
1296 let local_var_configuration = configuration;
1297
1298 let local_var_client = &local_var_configuration.client;
1299
1300 let local_var_uri_str = format!("{}/sources/ldap/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1301 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1302
1303 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1304 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1305 }
1306 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1307 let local_var_key = local_var_apikey.key.clone();
1308 let local_var_value = match local_var_apikey.prefix {
1309 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1310 None => local_var_key,
1311 };
1312 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1313 };
1314 local_var_req_builder = local_var_req_builder.json(&ldap_source_request);
1315
1316 let local_var_req = local_var_req_builder.build()?;
1317 let local_var_resp = local_var_client.execute(local_var_req).await?;
1318
1319 let local_var_status = local_var_resp.status();
1320 let local_var_content = local_var_resp.text().await?;
1321
1322 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1323 serde_json::from_str(&local_var_content).map_err(Error::from)
1324 } else {
1325 let local_var_entity: Option<SourcesLdapUpdateError> = serde_json::from_str(&local_var_content).ok();
1326 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1327 Err(Error::ResponseError(local_var_error))
1328 }
1329}
1330
1331pub async fn sources_ldap_used_by_list(configuration: &configuration::Configuration, slug: &str) -> Result<Vec<models::UsedBy>, Error<SourcesLdapUsedByListError>> {
1333 let local_var_configuration = configuration;
1334
1335 let local_var_client = &local_var_configuration.client;
1336
1337 let local_var_uri_str = format!("{}/sources/ldap/{slug}/used_by/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1338 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1339
1340 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1341 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1342 }
1343 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1344 let local_var_key = local_var_apikey.key.clone();
1345 let local_var_value = match local_var_apikey.prefix {
1346 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1347 None => local_var_key,
1348 };
1349 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1350 };
1351
1352 let local_var_req = local_var_req_builder.build()?;
1353 let local_var_resp = local_var_client.execute(local_var_req).await?;
1354
1355 let local_var_status = local_var_resp.status();
1356 let local_var_content = local_var_resp.text().await?;
1357
1358 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1359 serde_json::from_str(&local_var_content).map_err(Error::from)
1360 } else {
1361 let local_var_entity: Option<SourcesLdapUsedByListError> = serde_json::from_str(&local_var_content).ok();
1362 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1363 Err(Error::ResponseError(local_var_error))
1364 }
1365}
1366
1367pub async fn sources_oauth_create(configuration: &configuration::Configuration, o_auth_source_request: models::OAuthSourceRequest) -> Result<models::OAuthSource, Error<SourcesOauthCreateError>> {
1369 let local_var_configuration = configuration;
1370
1371 let local_var_client = &local_var_configuration.client;
1372
1373 let local_var_uri_str = format!("{}/sources/oauth/", local_var_configuration.base_path);
1374 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1375
1376 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1377 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1378 }
1379 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1380 let local_var_key = local_var_apikey.key.clone();
1381 let local_var_value = match local_var_apikey.prefix {
1382 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1383 None => local_var_key,
1384 };
1385 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1386 };
1387 local_var_req_builder = local_var_req_builder.json(&o_auth_source_request);
1388
1389 let local_var_req = local_var_req_builder.build()?;
1390 let local_var_resp = local_var_client.execute(local_var_req).await?;
1391
1392 let local_var_status = local_var_resp.status();
1393 let local_var_content = local_var_resp.text().await?;
1394
1395 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1396 serde_json::from_str(&local_var_content).map_err(Error::from)
1397 } else {
1398 let local_var_entity: Option<SourcesOauthCreateError> = serde_json::from_str(&local_var_content).ok();
1399 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1400 Err(Error::ResponseError(local_var_error))
1401 }
1402}
1403
1404pub async fn sources_oauth_destroy(configuration: &configuration::Configuration, slug: &str) -> Result<(), Error<SourcesOauthDestroyError>> {
1406 let local_var_configuration = configuration;
1407
1408 let local_var_client = &local_var_configuration.client;
1409
1410 let local_var_uri_str = format!("{}/sources/oauth/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1411 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1412
1413 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1414 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1415 }
1416 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1417 let local_var_key = local_var_apikey.key.clone();
1418 let local_var_value = match local_var_apikey.prefix {
1419 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1420 None => local_var_key,
1421 };
1422 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1423 };
1424
1425 let local_var_req = local_var_req_builder.build()?;
1426 let local_var_resp = local_var_client.execute(local_var_req).await?;
1427
1428 let local_var_status = local_var_resp.status();
1429 let local_var_content = local_var_resp.text().await?;
1430
1431 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1432 Ok(())
1433 } else {
1434 let local_var_entity: Option<SourcesOauthDestroyError> = serde_json::from_str(&local_var_content).ok();
1435 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1436 Err(Error::ResponseError(local_var_error))
1437 }
1438}
1439
1440pub async fn sources_oauth_list(configuration: &configuration::Configuration, access_token_url: Option<&str>, additional_scopes: Option<&str>, authentication_flow: Option<&str>, authorization_url: Option<&str>, consumer_key: Option<&str>, enabled: Option<bool>, enrollment_flow: Option<&str>, has_jwks: Option<bool>, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, policy_engine_mode: Option<&str>, profile_url: Option<&str>, provider_type: Option<&str>, request_token_url: Option<&str>, search: Option<&str>, slug: Option<&str>, user_matching_mode: Option<&str>) -> Result<models::PaginatedOAuthSourceList, Error<SourcesOauthListError>> {
1442 let local_var_configuration = configuration;
1443
1444 let local_var_client = &local_var_configuration.client;
1445
1446 let local_var_uri_str = format!("{}/sources/oauth/", local_var_configuration.base_path);
1447 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1448
1449 if let Some(ref local_var_str) = access_token_url {
1450 local_var_req_builder = local_var_req_builder.query(&[("access_token_url", &local_var_str.to_string())]);
1451 }
1452 if let Some(ref local_var_str) = additional_scopes {
1453 local_var_req_builder = local_var_req_builder.query(&[("additional_scopes", &local_var_str.to_string())]);
1454 }
1455 if let Some(ref local_var_str) = authentication_flow {
1456 local_var_req_builder = local_var_req_builder.query(&[("authentication_flow", &local_var_str.to_string())]);
1457 }
1458 if let Some(ref local_var_str) = authorization_url {
1459 local_var_req_builder = local_var_req_builder.query(&[("authorization_url", &local_var_str.to_string())]);
1460 }
1461 if let Some(ref local_var_str) = consumer_key {
1462 local_var_req_builder = local_var_req_builder.query(&[("consumer_key", &local_var_str.to_string())]);
1463 }
1464 if let Some(ref local_var_str) = enabled {
1465 local_var_req_builder = local_var_req_builder.query(&[("enabled", &local_var_str.to_string())]);
1466 }
1467 if let Some(ref local_var_str) = enrollment_flow {
1468 local_var_req_builder = local_var_req_builder.query(&[("enrollment_flow", &local_var_str.to_string())]);
1469 }
1470 if let Some(ref local_var_str) = has_jwks {
1471 local_var_req_builder = local_var_req_builder.query(&[("has_jwks", &local_var_str.to_string())]);
1472 }
1473 if let Some(ref local_var_str) = name {
1474 local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
1475 }
1476 if let Some(ref local_var_str) = ordering {
1477 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1478 }
1479 if let Some(ref local_var_str) = page {
1480 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1481 }
1482 if let Some(ref local_var_str) = page_size {
1483 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1484 }
1485 if let Some(ref local_var_str) = policy_engine_mode {
1486 local_var_req_builder = local_var_req_builder.query(&[("policy_engine_mode", &local_var_str.to_string())]);
1487 }
1488 if let Some(ref local_var_str) = profile_url {
1489 local_var_req_builder = local_var_req_builder.query(&[("profile_url", &local_var_str.to_string())]);
1490 }
1491 if let Some(ref local_var_str) = provider_type {
1492 local_var_req_builder = local_var_req_builder.query(&[("provider_type", &local_var_str.to_string())]);
1493 }
1494 if let Some(ref local_var_str) = request_token_url {
1495 local_var_req_builder = local_var_req_builder.query(&[("request_token_url", &local_var_str.to_string())]);
1496 }
1497 if let Some(ref local_var_str) = search {
1498 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1499 }
1500 if let Some(ref local_var_str) = slug {
1501 local_var_req_builder = local_var_req_builder.query(&[("slug", &local_var_str.to_string())]);
1502 }
1503 if let Some(ref local_var_str) = user_matching_mode {
1504 local_var_req_builder = local_var_req_builder.query(&[("user_matching_mode", &local_var_str.to_string())]);
1505 }
1506 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1507 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1508 }
1509 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1510 let local_var_key = local_var_apikey.key.clone();
1511 let local_var_value = match local_var_apikey.prefix {
1512 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1513 None => local_var_key,
1514 };
1515 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1516 };
1517
1518 let local_var_req = local_var_req_builder.build()?;
1519 let local_var_resp = local_var_client.execute(local_var_req).await?;
1520
1521 let local_var_status = local_var_resp.status();
1522 let local_var_content = local_var_resp.text().await?;
1523
1524 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1525 serde_json::from_str(&local_var_content).map_err(Error::from)
1526 } else {
1527 let local_var_entity: Option<SourcesOauthListError> = serde_json::from_str(&local_var_content).ok();
1528 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1529 Err(Error::ResponseError(local_var_error))
1530 }
1531}
1532
1533pub async fn sources_oauth_partial_update(configuration: &configuration::Configuration, slug: &str, patched_o_auth_source_request: Option<models::PatchedOAuthSourceRequest>) -> Result<models::OAuthSource, Error<SourcesOauthPartialUpdateError>> {
1535 let local_var_configuration = configuration;
1536
1537 let local_var_client = &local_var_configuration.client;
1538
1539 let local_var_uri_str = format!("{}/sources/oauth/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1540 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1541
1542 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1543 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1544 }
1545 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1546 let local_var_key = local_var_apikey.key.clone();
1547 let local_var_value = match local_var_apikey.prefix {
1548 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1549 None => local_var_key,
1550 };
1551 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1552 };
1553 local_var_req_builder = local_var_req_builder.json(&patched_o_auth_source_request);
1554
1555 let local_var_req = local_var_req_builder.build()?;
1556 let local_var_resp = local_var_client.execute(local_var_req).await?;
1557
1558 let local_var_status = local_var_resp.status();
1559 let local_var_content = local_var_resp.text().await?;
1560
1561 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1562 serde_json::from_str(&local_var_content).map_err(Error::from)
1563 } else {
1564 let local_var_entity: Option<SourcesOauthPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
1565 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1566 Err(Error::ResponseError(local_var_error))
1567 }
1568}
1569
1570pub async fn sources_oauth_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::OAuthSource, Error<SourcesOauthRetrieveError>> {
1572 let local_var_configuration = configuration;
1573
1574 let local_var_client = &local_var_configuration.client;
1575
1576 let local_var_uri_str = format!("{}/sources/oauth/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1577 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1578
1579 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1580 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1581 }
1582 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1583 let local_var_key = local_var_apikey.key.clone();
1584 let local_var_value = match local_var_apikey.prefix {
1585 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1586 None => local_var_key,
1587 };
1588 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1589 };
1590
1591 let local_var_req = local_var_req_builder.build()?;
1592 let local_var_resp = local_var_client.execute(local_var_req).await?;
1593
1594 let local_var_status = local_var_resp.status();
1595 let local_var_content = local_var_resp.text().await?;
1596
1597 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1598 serde_json::from_str(&local_var_content).map_err(Error::from)
1599 } else {
1600 let local_var_entity: Option<SourcesOauthRetrieveError> = serde_json::from_str(&local_var_content).ok();
1601 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1602 Err(Error::ResponseError(local_var_error))
1603 }
1604}
1605
1606pub async fn sources_oauth_source_types_list(configuration: &configuration::Configuration, name: Option<&str>) -> Result<Vec<models::SourceType>, Error<SourcesOauthSourceTypesListError>> {
1608 let local_var_configuration = configuration;
1609
1610 let local_var_client = &local_var_configuration.client;
1611
1612 let local_var_uri_str = format!("{}/sources/oauth/source_types/", local_var_configuration.base_path);
1613 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1614
1615 if let Some(ref local_var_str) = name {
1616 local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
1617 }
1618 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1619 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1620 }
1621 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1622 let local_var_key = local_var_apikey.key.clone();
1623 let local_var_value = match local_var_apikey.prefix {
1624 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1625 None => local_var_key,
1626 };
1627 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1628 };
1629
1630 let local_var_req = local_var_req_builder.build()?;
1631 let local_var_resp = local_var_client.execute(local_var_req).await?;
1632
1633 let local_var_status = local_var_resp.status();
1634 let local_var_content = local_var_resp.text().await?;
1635
1636 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1637 serde_json::from_str(&local_var_content).map_err(Error::from)
1638 } else {
1639 let local_var_entity: Option<SourcesOauthSourceTypesListError> = serde_json::from_str(&local_var_content).ok();
1640 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1641 Err(Error::ResponseError(local_var_error))
1642 }
1643}
1644
1645pub async fn sources_oauth_update(configuration: &configuration::Configuration, slug: &str, o_auth_source_request: models::OAuthSourceRequest) -> Result<models::OAuthSource, Error<SourcesOauthUpdateError>> {
1647 let local_var_configuration = configuration;
1648
1649 let local_var_client = &local_var_configuration.client;
1650
1651 let local_var_uri_str = format!("{}/sources/oauth/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1652 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1653
1654 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1655 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1656 }
1657 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1658 let local_var_key = local_var_apikey.key.clone();
1659 let local_var_value = match local_var_apikey.prefix {
1660 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1661 None => local_var_key,
1662 };
1663 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1664 };
1665 local_var_req_builder = local_var_req_builder.json(&o_auth_source_request);
1666
1667 let local_var_req = local_var_req_builder.build()?;
1668 let local_var_resp = local_var_client.execute(local_var_req).await?;
1669
1670 let local_var_status = local_var_resp.status();
1671 let local_var_content = local_var_resp.text().await?;
1672
1673 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1674 serde_json::from_str(&local_var_content).map_err(Error::from)
1675 } else {
1676 let local_var_entity: Option<SourcesOauthUpdateError> = serde_json::from_str(&local_var_content).ok();
1677 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1678 Err(Error::ResponseError(local_var_error))
1679 }
1680}
1681
1682pub async fn sources_oauth_used_by_list(configuration: &configuration::Configuration, slug: &str) -> Result<Vec<models::UsedBy>, Error<SourcesOauthUsedByListError>> {
1684 let local_var_configuration = configuration;
1685
1686 let local_var_client = &local_var_configuration.client;
1687
1688 let local_var_uri_str = format!("{}/sources/oauth/{slug}/used_by/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1689 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1690
1691 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1692 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1693 }
1694 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1695 let local_var_key = local_var_apikey.key.clone();
1696 let local_var_value = match local_var_apikey.prefix {
1697 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1698 None => local_var_key,
1699 };
1700 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1701 };
1702
1703 let local_var_req = local_var_req_builder.build()?;
1704 let local_var_resp = local_var_client.execute(local_var_req).await?;
1705
1706 let local_var_status = local_var_resp.status();
1707 let local_var_content = local_var_resp.text().await?;
1708
1709 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1710 serde_json::from_str(&local_var_content).map_err(Error::from)
1711 } else {
1712 let local_var_entity: Option<SourcesOauthUsedByListError> = serde_json::from_str(&local_var_content).ok();
1713 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1714 Err(Error::ResponseError(local_var_error))
1715 }
1716}
1717
1718pub async fn sources_plex_create(configuration: &configuration::Configuration, plex_source_request: models::PlexSourceRequest) -> Result<models::PlexSource, Error<SourcesPlexCreateError>> {
1720 let local_var_configuration = configuration;
1721
1722 let local_var_client = &local_var_configuration.client;
1723
1724 let local_var_uri_str = format!("{}/sources/plex/", local_var_configuration.base_path);
1725 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1726
1727 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1728 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1729 }
1730 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1731 let local_var_key = local_var_apikey.key.clone();
1732 let local_var_value = match local_var_apikey.prefix {
1733 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1734 None => local_var_key,
1735 };
1736 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1737 };
1738 local_var_req_builder = local_var_req_builder.json(&plex_source_request);
1739
1740 let local_var_req = local_var_req_builder.build()?;
1741 let local_var_resp = local_var_client.execute(local_var_req).await?;
1742
1743 let local_var_status = local_var_resp.status();
1744 let local_var_content = local_var_resp.text().await?;
1745
1746 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1747 serde_json::from_str(&local_var_content).map_err(Error::from)
1748 } else {
1749 let local_var_entity: Option<SourcesPlexCreateError> = serde_json::from_str(&local_var_content).ok();
1750 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1751 Err(Error::ResponseError(local_var_error))
1752 }
1753}
1754
1755pub async fn sources_plex_destroy(configuration: &configuration::Configuration, slug: &str) -> Result<(), Error<SourcesPlexDestroyError>> {
1757 let local_var_configuration = configuration;
1758
1759 let local_var_client = &local_var_configuration.client;
1760
1761 let local_var_uri_str = format!("{}/sources/plex/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1762 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1763
1764 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1765 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1766 }
1767 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1768 let local_var_key = local_var_apikey.key.clone();
1769 let local_var_value = match local_var_apikey.prefix {
1770 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1771 None => local_var_key,
1772 };
1773 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1774 };
1775
1776 let local_var_req = local_var_req_builder.build()?;
1777 let local_var_resp = local_var_client.execute(local_var_req).await?;
1778
1779 let local_var_status = local_var_resp.status();
1780 let local_var_content = local_var_resp.text().await?;
1781
1782 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1783 Ok(())
1784 } else {
1785 let local_var_entity: Option<SourcesPlexDestroyError> = serde_json::from_str(&local_var_content).ok();
1786 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1787 Err(Error::ResponseError(local_var_error))
1788 }
1789}
1790
1791pub async fn sources_plex_list(configuration: &configuration::Configuration, allow_friends: Option<bool>, authentication_flow: Option<&str>, client_id: Option<&str>, enabled: Option<bool>, enrollment_flow: Option<&str>, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, policy_engine_mode: Option<&str>, search: Option<&str>, slug: Option<&str>, user_matching_mode: Option<&str>) -> Result<models::PaginatedPlexSourceList, Error<SourcesPlexListError>> {
1793 let local_var_configuration = configuration;
1794
1795 let local_var_client = &local_var_configuration.client;
1796
1797 let local_var_uri_str = format!("{}/sources/plex/", local_var_configuration.base_path);
1798 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1799
1800 if let Some(ref local_var_str) = allow_friends {
1801 local_var_req_builder = local_var_req_builder.query(&[("allow_friends", &local_var_str.to_string())]);
1802 }
1803 if let Some(ref local_var_str) = authentication_flow {
1804 local_var_req_builder = local_var_req_builder.query(&[("authentication_flow", &local_var_str.to_string())]);
1805 }
1806 if let Some(ref local_var_str) = client_id {
1807 local_var_req_builder = local_var_req_builder.query(&[("client_id", &local_var_str.to_string())]);
1808 }
1809 if let Some(ref local_var_str) = enabled {
1810 local_var_req_builder = local_var_req_builder.query(&[("enabled", &local_var_str.to_string())]);
1811 }
1812 if let Some(ref local_var_str) = enrollment_flow {
1813 local_var_req_builder = local_var_req_builder.query(&[("enrollment_flow", &local_var_str.to_string())]);
1814 }
1815 if let Some(ref local_var_str) = name {
1816 local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
1817 }
1818 if let Some(ref local_var_str) = ordering {
1819 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1820 }
1821 if let Some(ref local_var_str) = page {
1822 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1823 }
1824 if let Some(ref local_var_str) = page_size {
1825 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1826 }
1827 if let Some(ref local_var_str) = policy_engine_mode {
1828 local_var_req_builder = local_var_req_builder.query(&[("policy_engine_mode", &local_var_str.to_string())]);
1829 }
1830 if let Some(ref local_var_str) = search {
1831 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1832 }
1833 if let Some(ref local_var_str) = slug {
1834 local_var_req_builder = local_var_req_builder.query(&[("slug", &local_var_str.to_string())]);
1835 }
1836 if let Some(ref local_var_str) = user_matching_mode {
1837 local_var_req_builder = local_var_req_builder.query(&[("user_matching_mode", &local_var_str.to_string())]);
1838 }
1839 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1840 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1841 }
1842 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1843 let local_var_key = local_var_apikey.key.clone();
1844 let local_var_value = match local_var_apikey.prefix {
1845 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1846 None => local_var_key,
1847 };
1848 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1849 };
1850
1851 let local_var_req = local_var_req_builder.build()?;
1852 let local_var_resp = local_var_client.execute(local_var_req).await?;
1853
1854 let local_var_status = local_var_resp.status();
1855 let local_var_content = local_var_resp.text().await?;
1856
1857 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1858 serde_json::from_str(&local_var_content).map_err(Error::from)
1859 } else {
1860 let local_var_entity: Option<SourcesPlexListError> = serde_json::from_str(&local_var_content).ok();
1861 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1862 Err(Error::ResponseError(local_var_error))
1863 }
1864}
1865
1866pub async fn sources_plex_partial_update(configuration: &configuration::Configuration, slug: &str, patched_plex_source_request: Option<models::PatchedPlexSourceRequest>) -> Result<models::PlexSource, Error<SourcesPlexPartialUpdateError>> {
1868 let local_var_configuration = configuration;
1869
1870 let local_var_client = &local_var_configuration.client;
1871
1872 let local_var_uri_str = format!("{}/sources/plex/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1873 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1874
1875 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1876 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1877 }
1878 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1879 let local_var_key = local_var_apikey.key.clone();
1880 let local_var_value = match local_var_apikey.prefix {
1881 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1882 None => local_var_key,
1883 };
1884 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1885 };
1886 local_var_req_builder = local_var_req_builder.json(&patched_plex_source_request);
1887
1888 let local_var_req = local_var_req_builder.build()?;
1889 let local_var_resp = local_var_client.execute(local_var_req).await?;
1890
1891 let local_var_status = local_var_resp.status();
1892 let local_var_content = local_var_resp.text().await?;
1893
1894 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1895 serde_json::from_str(&local_var_content).map_err(Error::from)
1896 } else {
1897 let local_var_entity: Option<SourcesPlexPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
1898 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1899 Err(Error::ResponseError(local_var_error))
1900 }
1901}
1902
1903pub async fn sources_plex_redeem_token_authenticated_create(configuration: &configuration::Configuration, plex_token_redeem_request: models::PlexTokenRedeemRequest, slug: Option<&str>) -> Result<(), Error<SourcesPlexRedeemTokenAuthenticatedCreateError>> {
1905 let local_var_configuration = configuration;
1906
1907 let local_var_client = &local_var_configuration.client;
1908
1909 let local_var_uri_str = format!("{}/sources/plex/redeem_token_authenticated/", local_var_configuration.base_path);
1910 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1911
1912 if let Some(ref local_var_str) = slug {
1913 local_var_req_builder = local_var_req_builder.query(&[("slug", &local_var_str.to_string())]);
1914 }
1915 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1916 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1917 }
1918 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1919 let local_var_key = local_var_apikey.key.clone();
1920 let local_var_value = match local_var_apikey.prefix {
1921 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1922 None => local_var_key,
1923 };
1924 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1925 };
1926 local_var_req_builder = local_var_req_builder.json(&plex_token_redeem_request);
1927
1928 let local_var_req = local_var_req_builder.build()?;
1929 let local_var_resp = local_var_client.execute(local_var_req).await?;
1930
1931 let local_var_status = local_var_resp.status();
1932 let local_var_content = local_var_resp.text().await?;
1933
1934 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1935 Ok(())
1936 } else {
1937 let local_var_entity: Option<SourcesPlexRedeemTokenAuthenticatedCreateError> = serde_json::from_str(&local_var_content).ok();
1938 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1939 Err(Error::ResponseError(local_var_error))
1940 }
1941}
1942
1943pub async fn sources_plex_redeem_token_create(configuration: &configuration::Configuration, plex_token_redeem_request: models::PlexTokenRedeemRequest, slug: Option<&str>) -> Result<models::RedirectChallenge, Error<SourcesPlexRedeemTokenCreateError>> {
1945 let local_var_configuration = configuration;
1946
1947 let local_var_client = &local_var_configuration.client;
1948
1949 let local_var_uri_str = format!("{}/sources/plex/redeem_token/", local_var_configuration.base_path);
1950 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1951
1952 if let Some(ref local_var_str) = slug {
1953 local_var_req_builder = local_var_req_builder.query(&[("slug", &local_var_str.to_string())]);
1954 }
1955 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1956 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1957 }
1958 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1959 let local_var_key = local_var_apikey.key.clone();
1960 let local_var_value = match local_var_apikey.prefix {
1961 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1962 None => local_var_key,
1963 };
1964 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1965 };
1966 local_var_req_builder = local_var_req_builder.json(&plex_token_redeem_request);
1967
1968 let local_var_req = local_var_req_builder.build()?;
1969 let local_var_resp = local_var_client.execute(local_var_req).await?;
1970
1971 let local_var_status = local_var_resp.status();
1972 let local_var_content = local_var_resp.text().await?;
1973
1974 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1975 serde_json::from_str(&local_var_content).map_err(Error::from)
1976 } else {
1977 let local_var_entity: Option<SourcesPlexRedeemTokenCreateError> = serde_json::from_str(&local_var_content).ok();
1978 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1979 Err(Error::ResponseError(local_var_error))
1980 }
1981}
1982
1983pub async fn sources_plex_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::PlexSource, Error<SourcesPlexRetrieveError>> {
1985 let local_var_configuration = configuration;
1986
1987 let local_var_client = &local_var_configuration.client;
1988
1989 let local_var_uri_str = format!("{}/sources/plex/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
1990 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1991
1992 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1993 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1994 }
1995 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1996 let local_var_key = local_var_apikey.key.clone();
1997 let local_var_value = match local_var_apikey.prefix {
1998 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1999 None => local_var_key,
2000 };
2001 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2002 };
2003
2004 let local_var_req = local_var_req_builder.build()?;
2005 let local_var_resp = local_var_client.execute(local_var_req).await?;
2006
2007 let local_var_status = local_var_resp.status();
2008 let local_var_content = local_var_resp.text().await?;
2009
2010 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2011 serde_json::from_str(&local_var_content).map_err(Error::from)
2012 } else {
2013 let local_var_entity: Option<SourcesPlexRetrieveError> = serde_json::from_str(&local_var_content).ok();
2014 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2015 Err(Error::ResponseError(local_var_error))
2016 }
2017}
2018
2019pub async fn sources_plex_update(configuration: &configuration::Configuration, slug: &str, plex_source_request: models::PlexSourceRequest) -> Result<models::PlexSource, Error<SourcesPlexUpdateError>> {
2021 let local_var_configuration = configuration;
2022
2023 let local_var_client = &local_var_configuration.client;
2024
2025 let local_var_uri_str = format!("{}/sources/plex/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
2026 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2027
2028 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2029 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2030 }
2031 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2032 let local_var_key = local_var_apikey.key.clone();
2033 let local_var_value = match local_var_apikey.prefix {
2034 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2035 None => local_var_key,
2036 };
2037 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2038 };
2039 local_var_req_builder = local_var_req_builder.json(&plex_source_request);
2040
2041 let local_var_req = local_var_req_builder.build()?;
2042 let local_var_resp = local_var_client.execute(local_var_req).await?;
2043
2044 let local_var_status = local_var_resp.status();
2045 let local_var_content = local_var_resp.text().await?;
2046
2047 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2048 serde_json::from_str(&local_var_content).map_err(Error::from)
2049 } else {
2050 let local_var_entity: Option<SourcesPlexUpdateError> = serde_json::from_str(&local_var_content).ok();
2051 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2052 Err(Error::ResponseError(local_var_error))
2053 }
2054}
2055
2056pub async fn sources_plex_used_by_list(configuration: &configuration::Configuration, slug: &str) -> Result<Vec<models::UsedBy>, Error<SourcesPlexUsedByListError>> {
2058 let local_var_configuration = configuration;
2059
2060 let local_var_client = &local_var_configuration.client;
2061
2062 let local_var_uri_str = format!("{}/sources/plex/{slug}/used_by/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
2063 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2064
2065 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2066 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2067 }
2068 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2069 let local_var_key = local_var_apikey.key.clone();
2070 let local_var_value = match local_var_apikey.prefix {
2071 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2072 None => local_var_key,
2073 };
2074 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2075 };
2076
2077 let local_var_req = local_var_req_builder.build()?;
2078 let local_var_resp = local_var_client.execute(local_var_req).await?;
2079
2080 let local_var_status = local_var_resp.status();
2081 let local_var_content = local_var_resp.text().await?;
2082
2083 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2084 serde_json::from_str(&local_var_content).map_err(Error::from)
2085 } else {
2086 let local_var_entity: Option<SourcesPlexUsedByListError> = serde_json::from_str(&local_var_content).ok();
2087 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2088 Err(Error::ResponseError(local_var_error))
2089 }
2090}
2091
2092pub async fn sources_saml_create(configuration: &configuration::Configuration, saml_source_request: models::SamlSourceRequest) -> Result<models::SamlSource, Error<SourcesSamlCreateError>> {
2094 let local_var_configuration = configuration;
2095
2096 let local_var_client = &local_var_configuration.client;
2097
2098 let local_var_uri_str = format!("{}/sources/saml/", local_var_configuration.base_path);
2099 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2100
2101 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2102 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2103 }
2104 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2105 let local_var_key = local_var_apikey.key.clone();
2106 let local_var_value = match local_var_apikey.prefix {
2107 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2108 None => local_var_key,
2109 };
2110 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2111 };
2112 local_var_req_builder = local_var_req_builder.json(&saml_source_request);
2113
2114 let local_var_req = local_var_req_builder.build()?;
2115 let local_var_resp = local_var_client.execute(local_var_req).await?;
2116
2117 let local_var_status = local_var_resp.status();
2118 let local_var_content = local_var_resp.text().await?;
2119
2120 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2121 serde_json::from_str(&local_var_content).map_err(Error::from)
2122 } else {
2123 let local_var_entity: Option<SourcesSamlCreateError> = serde_json::from_str(&local_var_content).ok();
2124 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2125 Err(Error::ResponseError(local_var_error))
2126 }
2127}
2128
2129pub async fn sources_saml_destroy(configuration: &configuration::Configuration, slug: &str) -> Result<(), Error<SourcesSamlDestroyError>> {
2131 let local_var_configuration = configuration;
2132
2133 let local_var_client = &local_var_configuration.client;
2134
2135 let local_var_uri_str = format!("{}/sources/saml/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
2136 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2137
2138 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2139 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2140 }
2141 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2142 let local_var_key = local_var_apikey.key.clone();
2143 let local_var_value = match local_var_apikey.prefix {
2144 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2145 None => local_var_key,
2146 };
2147 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2148 };
2149
2150 let local_var_req = local_var_req_builder.build()?;
2151 let local_var_resp = local_var_client.execute(local_var_req).await?;
2152
2153 let local_var_status = local_var_resp.status();
2154 let local_var_content = local_var_resp.text().await?;
2155
2156 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2157 Ok(())
2158 } else {
2159 let local_var_entity: Option<SourcesSamlDestroyError> = serde_json::from_str(&local_var_content).ok();
2160 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2161 Err(Error::ResponseError(local_var_error))
2162 }
2163}
2164
2165pub async fn sources_saml_list(configuration: &configuration::Configuration, allow_idp_initiated: Option<bool>, authentication_flow: Option<&str>, binding_type: Option<&str>, digest_algorithm: Option<&str>, enabled: Option<bool>, enrollment_flow: Option<&str>, issuer: Option<&str>, managed: Option<&str>, name: Option<&str>, name_id_policy: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, policy_engine_mode: Option<&str>, pre_authentication_flow: Option<&str>, search: Option<&str>, signature_algorithm: Option<&str>, signing_kp: Option<&str>, slo_url: Option<&str>, slug: Option<&str>, sso_url: Option<&str>, temporary_user_delete_after: Option<&str>, user_matching_mode: Option<&str>, verification_kp: Option<&str>) -> Result<models::PaginatedSamlSourceList, Error<SourcesSamlListError>> {
2167 let local_var_configuration = configuration;
2168
2169 let local_var_client = &local_var_configuration.client;
2170
2171 let local_var_uri_str = format!("{}/sources/saml/", local_var_configuration.base_path);
2172 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2173
2174 if let Some(ref local_var_str) = allow_idp_initiated {
2175 local_var_req_builder = local_var_req_builder.query(&[("allow_idp_initiated", &local_var_str.to_string())]);
2176 }
2177 if let Some(ref local_var_str) = authentication_flow {
2178 local_var_req_builder = local_var_req_builder.query(&[("authentication_flow", &local_var_str.to_string())]);
2179 }
2180 if let Some(ref local_var_str) = binding_type {
2181 local_var_req_builder = local_var_req_builder.query(&[("binding_type", &local_var_str.to_string())]);
2182 }
2183 if let Some(ref local_var_str) = digest_algorithm {
2184 local_var_req_builder = local_var_req_builder.query(&[("digest_algorithm", &local_var_str.to_string())]);
2185 }
2186 if let Some(ref local_var_str) = enabled {
2187 local_var_req_builder = local_var_req_builder.query(&[("enabled", &local_var_str.to_string())]);
2188 }
2189 if let Some(ref local_var_str) = enrollment_flow {
2190 local_var_req_builder = local_var_req_builder.query(&[("enrollment_flow", &local_var_str.to_string())]);
2191 }
2192 if let Some(ref local_var_str) = issuer {
2193 local_var_req_builder = local_var_req_builder.query(&[("issuer", &local_var_str.to_string())]);
2194 }
2195 if let Some(ref local_var_str) = managed {
2196 local_var_req_builder = local_var_req_builder.query(&[("managed", &local_var_str.to_string())]);
2197 }
2198 if let Some(ref local_var_str) = name {
2199 local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
2200 }
2201 if let Some(ref local_var_str) = name_id_policy {
2202 local_var_req_builder = local_var_req_builder.query(&[("name_id_policy", &local_var_str.to_string())]);
2203 }
2204 if let Some(ref local_var_str) = ordering {
2205 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
2206 }
2207 if let Some(ref local_var_str) = page {
2208 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2209 }
2210 if let Some(ref local_var_str) = page_size {
2211 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
2212 }
2213 if let Some(ref local_var_str) = policy_engine_mode {
2214 local_var_req_builder = local_var_req_builder.query(&[("policy_engine_mode", &local_var_str.to_string())]);
2215 }
2216 if let Some(ref local_var_str) = pre_authentication_flow {
2217 local_var_req_builder = local_var_req_builder.query(&[("pre_authentication_flow", &local_var_str.to_string())]);
2218 }
2219 if let Some(ref local_var_str) = search {
2220 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
2221 }
2222 if let Some(ref local_var_str) = signature_algorithm {
2223 local_var_req_builder = local_var_req_builder.query(&[("signature_algorithm", &local_var_str.to_string())]);
2224 }
2225 if let Some(ref local_var_str) = signing_kp {
2226 local_var_req_builder = local_var_req_builder.query(&[("signing_kp", &local_var_str.to_string())]);
2227 }
2228 if let Some(ref local_var_str) = slo_url {
2229 local_var_req_builder = local_var_req_builder.query(&[("slo_url", &local_var_str.to_string())]);
2230 }
2231 if let Some(ref local_var_str) = slug {
2232 local_var_req_builder = local_var_req_builder.query(&[("slug", &local_var_str.to_string())]);
2233 }
2234 if let Some(ref local_var_str) = sso_url {
2235 local_var_req_builder = local_var_req_builder.query(&[("sso_url", &local_var_str.to_string())]);
2236 }
2237 if let Some(ref local_var_str) = temporary_user_delete_after {
2238 local_var_req_builder = local_var_req_builder.query(&[("temporary_user_delete_after", &local_var_str.to_string())]);
2239 }
2240 if let Some(ref local_var_str) = user_matching_mode {
2241 local_var_req_builder = local_var_req_builder.query(&[("user_matching_mode", &local_var_str.to_string())]);
2242 }
2243 if let Some(ref local_var_str) = verification_kp {
2244 local_var_req_builder = local_var_req_builder.query(&[("verification_kp", &local_var_str.to_string())]);
2245 }
2246 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2247 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2248 }
2249 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2250 let local_var_key = local_var_apikey.key.clone();
2251 let local_var_value = match local_var_apikey.prefix {
2252 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2253 None => local_var_key,
2254 };
2255 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2256 };
2257
2258 let local_var_req = local_var_req_builder.build()?;
2259 let local_var_resp = local_var_client.execute(local_var_req).await?;
2260
2261 let local_var_status = local_var_resp.status();
2262 let local_var_content = local_var_resp.text().await?;
2263
2264 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2265 serde_json::from_str(&local_var_content).map_err(Error::from)
2266 } else {
2267 let local_var_entity: Option<SourcesSamlListError> = serde_json::from_str(&local_var_content).ok();
2268 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2269 Err(Error::ResponseError(local_var_error))
2270 }
2271}
2272
2273pub async fn sources_saml_metadata_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::SamlMetadata, Error<SourcesSamlMetadataRetrieveError>> {
2275 let local_var_configuration = configuration;
2276
2277 let local_var_client = &local_var_configuration.client;
2278
2279 let local_var_uri_str = format!("{}/sources/saml/{slug}/metadata/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
2280 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2281
2282 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2283 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2284 }
2285 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2286 let local_var_key = local_var_apikey.key.clone();
2287 let local_var_value = match local_var_apikey.prefix {
2288 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2289 None => local_var_key,
2290 };
2291 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2292 };
2293
2294 let local_var_req = local_var_req_builder.build()?;
2295 let local_var_resp = local_var_client.execute(local_var_req).await?;
2296
2297 let local_var_status = local_var_resp.status();
2298 let local_var_content = local_var_resp.text().await?;
2299
2300 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2301 serde_json::from_str(&local_var_content).map_err(Error::from)
2302 } else {
2303 let local_var_entity: Option<SourcesSamlMetadataRetrieveError> = serde_json::from_str(&local_var_content).ok();
2304 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2305 Err(Error::ResponseError(local_var_error))
2306 }
2307}
2308
2309pub async fn sources_saml_partial_update(configuration: &configuration::Configuration, slug: &str, patched_saml_source_request: Option<models::PatchedSamlSourceRequest>) -> Result<models::SamlSource, Error<SourcesSamlPartialUpdateError>> {
2311 let local_var_configuration = configuration;
2312
2313 let local_var_client = &local_var_configuration.client;
2314
2315 let local_var_uri_str = format!("{}/sources/saml/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
2316 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2317
2318 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2319 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2320 }
2321 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2322 let local_var_key = local_var_apikey.key.clone();
2323 let local_var_value = match local_var_apikey.prefix {
2324 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2325 None => local_var_key,
2326 };
2327 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2328 };
2329 local_var_req_builder = local_var_req_builder.json(&patched_saml_source_request);
2330
2331 let local_var_req = local_var_req_builder.build()?;
2332 let local_var_resp = local_var_client.execute(local_var_req).await?;
2333
2334 let local_var_status = local_var_resp.status();
2335 let local_var_content = local_var_resp.text().await?;
2336
2337 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2338 serde_json::from_str(&local_var_content).map_err(Error::from)
2339 } else {
2340 let local_var_entity: Option<SourcesSamlPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
2341 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2342 Err(Error::ResponseError(local_var_error))
2343 }
2344}
2345
2346pub async fn sources_saml_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::SamlSource, Error<SourcesSamlRetrieveError>> {
2348 let local_var_configuration = configuration;
2349
2350 let local_var_client = &local_var_configuration.client;
2351
2352 let local_var_uri_str = format!("{}/sources/saml/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
2353 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2354
2355 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2356 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2357 }
2358 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2359 let local_var_key = local_var_apikey.key.clone();
2360 let local_var_value = match local_var_apikey.prefix {
2361 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2362 None => local_var_key,
2363 };
2364 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2365 };
2366
2367 let local_var_req = local_var_req_builder.build()?;
2368 let local_var_resp = local_var_client.execute(local_var_req).await?;
2369
2370 let local_var_status = local_var_resp.status();
2371 let local_var_content = local_var_resp.text().await?;
2372
2373 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2374 serde_json::from_str(&local_var_content).map_err(Error::from)
2375 } else {
2376 let local_var_entity: Option<SourcesSamlRetrieveError> = serde_json::from_str(&local_var_content).ok();
2377 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2378 Err(Error::ResponseError(local_var_error))
2379 }
2380}
2381
2382pub async fn sources_saml_update(configuration: &configuration::Configuration, slug: &str, saml_source_request: models::SamlSourceRequest) -> Result<models::SamlSource, Error<SourcesSamlUpdateError>> {
2384 let local_var_configuration = configuration;
2385
2386 let local_var_client = &local_var_configuration.client;
2387
2388 let local_var_uri_str = format!("{}/sources/saml/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
2389 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2390
2391 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2392 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2393 }
2394 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2395 let local_var_key = local_var_apikey.key.clone();
2396 let local_var_value = match local_var_apikey.prefix {
2397 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2398 None => local_var_key,
2399 };
2400 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2401 };
2402 local_var_req_builder = local_var_req_builder.json(&saml_source_request);
2403
2404 let local_var_req = local_var_req_builder.build()?;
2405 let local_var_resp = local_var_client.execute(local_var_req).await?;
2406
2407 let local_var_status = local_var_resp.status();
2408 let local_var_content = local_var_resp.text().await?;
2409
2410 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2411 serde_json::from_str(&local_var_content).map_err(Error::from)
2412 } else {
2413 let local_var_entity: Option<SourcesSamlUpdateError> = serde_json::from_str(&local_var_content).ok();
2414 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2415 Err(Error::ResponseError(local_var_error))
2416 }
2417}
2418
2419pub async fn sources_saml_used_by_list(configuration: &configuration::Configuration, slug: &str) -> Result<Vec<models::UsedBy>, Error<SourcesSamlUsedByListError>> {
2421 let local_var_configuration = configuration;
2422
2423 let local_var_client = &local_var_configuration.client;
2424
2425 let local_var_uri_str = format!("{}/sources/saml/{slug}/used_by/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
2426 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2427
2428 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2429 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2430 }
2431 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2432 let local_var_key = local_var_apikey.key.clone();
2433 let local_var_value = match local_var_apikey.prefix {
2434 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2435 None => local_var_key,
2436 };
2437 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2438 };
2439
2440 let local_var_req = local_var_req_builder.build()?;
2441 let local_var_resp = local_var_client.execute(local_var_req).await?;
2442
2443 let local_var_status = local_var_resp.status();
2444 let local_var_content = local_var_resp.text().await?;
2445
2446 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2447 serde_json::from_str(&local_var_content).map_err(Error::from)
2448 } else {
2449 let local_var_entity: Option<SourcesSamlUsedByListError> = serde_json::from_str(&local_var_content).ok();
2450 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2451 Err(Error::ResponseError(local_var_error))
2452 }
2453}
2454
2455pub async fn sources_user_connections_all_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<SourcesUserConnectionsAllDestroyError>> {
2457 let local_var_configuration = configuration;
2458
2459 let local_var_client = &local_var_configuration.client;
2460
2461 let local_var_uri_str = format!("{}/sources/user_connections/all/{id}/", local_var_configuration.base_path, id=id);
2462 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2463
2464 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2465 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2466 }
2467 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2468 let local_var_key = local_var_apikey.key.clone();
2469 let local_var_value = match local_var_apikey.prefix {
2470 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2471 None => local_var_key,
2472 };
2473 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2474 };
2475
2476 let local_var_req = local_var_req_builder.build()?;
2477 let local_var_resp = local_var_client.execute(local_var_req).await?;
2478
2479 let local_var_status = local_var_resp.status();
2480 let local_var_content = local_var_resp.text().await?;
2481
2482 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2483 Ok(())
2484 } else {
2485 let local_var_entity: Option<SourcesUserConnectionsAllDestroyError> = serde_json::from_str(&local_var_content).ok();
2486 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2487 Err(Error::ResponseError(local_var_error))
2488 }
2489}
2490
2491pub async fn sources_user_connections_all_list(configuration: &configuration::Configuration, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, user: Option<i32>) -> Result<models::PaginatedUserSourceConnectionList, Error<SourcesUserConnectionsAllListError>> {
2493 let local_var_configuration = configuration;
2494
2495 let local_var_client = &local_var_configuration.client;
2496
2497 let local_var_uri_str = format!("{}/sources/user_connections/all/", local_var_configuration.base_path);
2498 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2499
2500 if let Some(ref local_var_str) = ordering {
2501 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
2502 }
2503 if let Some(ref local_var_str) = page {
2504 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2505 }
2506 if let Some(ref local_var_str) = page_size {
2507 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
2508 }
2509 if let Some(ref local_var_str) = search {
2510 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
2511 }
2512 if let Some(ref local_var_str) = user {
2513 local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
2514 }
2515 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2516 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2517 }
2518 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2519 let local_var_key = local_var_apikey.key.clone();
2520 let local_var_value = match local_var_apikey.prefix {
2521 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2522 None => local_var_key,
2523 };
2524 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2525 };
2526
2527 let local_var_req = local_var_req_builder.build()?;
2528 let local_var_resp = local_var_client.execute(local_var_req).await?;
2529
2530 let local_var_status = local_var_resp.status();
2531 let local_var_content = local_var_resp.text().await?;
2532
2533 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2534 serde_json::from_str(&local_var_content).map_err(Error::from)
2535 } else {
2536 let local_var_entity: Option<SourcesUserConnectionsAllListError> = serde_json::from_str(&local_var_content).ok();
2537 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2538 Err(Error::ResponseError(local_var_error))
2539 }
2540}
2541
2542pub async fn sources_user_connections_all_partial_update(configuration: &configuration::Configuration, id: i32) -> Result<models::UserSourceConnection, Error<SourcesUserConnectionsAllPartialUpdateError>> {
2544 let local_var_configuration = configuration;
2545
2546 let local_var_client = &local_var_configuration.client;
2547
2548 let local_var_uri_str = format!("{}/sources/user_connections/all/{id}/", local_var_configuration.base_path, id=id);
2549 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2550
2551 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2552 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2553 }
2554 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2555 let local_var_key = local_var_apikey.key.clone();
2556 let local_var_value = match local_var_apikey.prefix {
2557 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2558 None => local_var_key,
2559 };
2560 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2561 };
2562
2563 let local_var_req = local_var_req_builder.build()?;
2564 let local_var_resp = local_var_client.execute(local_var_req).await?;
2565
2566 let local_var_status = local_var_resp.status();
2567 let local_var_content = local_var_resp.text().await?;
2568
2569 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2570 serde_json::from_str(&local_var_content).map_err(Error::from)
2571 } else {
2572 let local_var_entity: Option<SourcesUserConnectionsAllPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
2573 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2574 Err(Error::ResponseError(local_var_error))
2575 }
2576}
2577
2578pub async fn sources_user_connections_all_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::UserSourceConnection, Error<SourcesUserConnectionsAllRetrieveError>> {
2580 let local_var_configuration = configuration;
2581
2582 let local_var_client = &local_var_configuration.client;
2583
2584 let local_var_uri_str = format!("{}/sources/user_connections/all/{id}/", local_var_configuration.base_path, id=id);
2585 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2586
2587 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2588 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2589 }
2590 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2591 let local_var_key = local_var_apikey.key.clone();
2592 let local_var_value = match local_var_apikey.prefix {
2593 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2594 None => local_var_key,
2595 };
2596 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2597 };
2598
2599 let local_var_req = local_var_req_builder.build()?;
2600 let local_var_resp = local_var_client.execute(local_var_req).await?;
2601
2602 let local_var_status = local_var_resp.status();
2603 let local_var_content = local_var_resp.text().await?;
2604
2605 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2606 serde_json::from_str(&local_var_content).map_err(Error::from)
2607 } else {
2608 let local_var_entity: Option<SourcesUserConnectionsAllRetrieveError> = serde_json::from_str(&local_var_content).ok();
2609 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2610 Err(Error::ResponseError(local_var_error))
2611 }
2612}
2613
2614pub async fn sources_user_connections_all_update(configuration: &configuration::Configuration, id: i32) -> Result<models::UserSourceConnection, Error<SourcesUserConnectionsAllUpdateError>> {
2616 let local_var_configuration = configuration;
2617
2618 let local_var_client = &local_var_configuration.client;
2619
2620 let local_var_uri_str = format!("{}/sources/user_connections/all/{id}/", local_var_configuration.base_path, id=id);
2621 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2622
2623 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2624 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2625 }
2626 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2627 let local_var_key = local_var_apikey.key.clone();
2628 let local_var_value = match local_var_apikey.prefix {
2629 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2630 None => local_var_key,
2631 };
2632 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2633 };
2634
2635 let local_var_req = local_var_req_builder.build()?;
2636 let local_var_resp = local_var_client.execute(local_var_req).await?;
2637
2638 let local_var_status = local_var_resp.status();
2639 let local_var_content = local_var_resp.text().await?;
2640
2641 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2642 serde_json::from_str(&local_var_content).map_err(Error::from)
2643 } else {
2644 let local_var_entity: Option<SourcesUserConnectionsAllUpdateError> = serde_json::from_str(&local_var_content).ok();
2645 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2646 Err(Error::ResponseError(local_var_error))
2647 }
2648}
2649
2650pub async fn sources_user_connections_all_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<SourcesUserConnectionsAllUsedByListError>> {
2652 let local_var_configuration = configuration;
2653
2654 let local_var_client = &local_var_configuration.client;
2655
2656 let local_var_uri_str = format!("{}/sources/user_connections/all/{id}/used_by/", local_var_configuration.base_path, id=id);
2657 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2658
2659 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2660 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2661 }
2662 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2663 let local_var_key = local_var_apikey.key.clone();
2664 let local_var_value = match local_var_apikey.prefix {
2665 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2666 None => local_var_key,
2667 };
2668 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2669 };
2670
2671 let local_var_req = local_var_req_builder.build()?;
2672 let local_var_resp = local_var_client.execute(local_var_req).await?;
2673
2674 let local_var_status = local_var_resp.status();
2675 let local_var_content = local_var_resp.text().await?;
2676
2677 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2678 serde_json::from_str(&local_var_content).map_err(Error::from)
2679 } else {
2680 let local_var_entity: Option<SourcesUserConnectionsAllUsedByListError> = serde_json::from_str(&local_var_content).ok();
2681 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2682 Err(Error::ResponseError(local_var_error))
2683 }
2684}
2685
2686pub async fn sources_user_connections_oauth_create(configuration: &configuration::Configuration, user_o_auth_source_connection_request: models::UserOAuthSourceConnectionRequest) -> Result<models::UserOAuthSourceConnection, Error<SourcesUserConnectionsOauthCreateError>> {
2688 let local_var_configuration = configuration;
2689
2690 let local_var_client = &local_var_configuration.client;
2691
2692 let local_var_uri_str = format!("{}/sources/user_connections/oauth/", local_var_configuration.base_path);
2693 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2694
2695 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2696 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2697 }
2698 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2699 let local_var_key = local_var_apikey.key.clone();
2700 let local_var_value = match local_var_apikey.prefix {
2701 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2702 None => local_var_key,
2703 };
2704 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2705 };
2706 local_var_req_builder = local_var_req_builder.json(&user_o_auth_source_connection_request);
2707
2708 let local_var_req = local_var_req_builder.build()?;
2709 let local_var_resp = local_var_client.execute(local_var_req).await?;
2710
2711 let local_var_status = local_var_resp.status();
2712 let local_var_content = local_var_resp.text().await?;
2713
2714 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2715 serde_json::from_str(&local_var_content).map_err(Error::from)
2716 } else {
2717 let local_var_entity: Option<SourcesUserConnectionsOauthCreateError> = serde_json::from_str(&local_var_content).ok();
2718 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2719 Err(Error::ResponseError(local_var_error))
2720 }
2721}
2722
2723pub async fn sources_user_connections_oauth_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<SourcesUserConnectionsOauthDestroyError>> {
2725 let local_var_configuration = configuration;
2726
2727 let local_var_client = &local_var_configuration.client;
2728
2729 let local_var_uri_str = format!("{}/sources/user_connections/oauth/{id}/", local_var_configuration.base_path, id=id);
2730 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2731
2732 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2733 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2734 }
2735 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2736 let local_var_key = local_var_apikey.key.clone();
2737 let local_var_value = match local_var_apikey.prefix {
2738 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2739 None => local_var_key,
2740 };
2741 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2742 };
2743
2744 let local_var_req = local_var_req_builder.build()?;
2745 let local_var_resp = local_var_client.execute(local_var_req).await?;
2746
2747 let local_var_status = local_var_resp.status();
2748 let local_var_content = local_var_resp.text().await?;
2749
2750 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2751 Ok(())
2752 } else {
2753 let local_var_entity: Option<SourcesUserConnectionsOauthDestroyError> = serde_json::from_str(&local_var_content).ok();
2754 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2755 Err(Error::ResponseError(local_var_error))
2756 }
2757}
2758
2759pub async fn sources_user_connections_oauth_list(configuration: &configuration::Configuration, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, source__slug: Option<&str>) -> Result<models::PaginatedUserOAuthSourceConnectionList, Error<SourcesUserConnectionsOauthListError>> {
2761 let local_var_configuration = configuration;
2762
2763 let local_var_client = &local_var_configuration.client;
2764
2765 let local_var_uri_str = format!("{}/sources/user_connections/oauth/", local_var_configuration.base_path);
2766 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2767
2768 if let Some(ref local_var_str) = ordering {
2769 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
2770 }
2771 if let Some(ref local_var_str) = page {
2772 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2773 }
2774 if let Some(ref local_var_str) = page_size {
2775 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
2776 }
2777 if let Some(ref local_var_str) = search {
2778 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
2779 }
2780 if let Some(ref local_var_str) = source__slug {
2781 local_var_req_builder = local_var_req_builder.query(&[("source__slug", &local_var_str.to_string())]);
2782 }
2783 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2784 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2785 }
2786 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2787 let local_var_key = local_var_apikey.key.clone();
2788 let local_var_value = match local_var_apikey.prefix {
2789 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2790 None => local_var_key,
2791 };
2792 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2793 };
2794
2795 let local_var_req = local_var_req_builder.build()?;
2796 let local_var_resp = local_var_client.execute(local_var_req).await?;
2797
2798 let local_var_status = local_var_resp.status();
2799 let local_var_content = local_var_resp.text().await?;
2800
2801 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2802 serde_json::from_str(&local_var_content).map_err(Error::from)
2803 } else {
2804 let local_var_entity: Option<SourcesUserConnectionsOauthListError> = serde_json::from_str(&local_var_content).ok();
2805 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2806 Err(Error::ResponseError(local_var_error))
2807 }
2808}
2809
2810pub async fn sources_user_connections_oauth_partial_update(configuration: &configuration::Configuration, id: i32, patched_user_o_auth_source_connection_request: Option<models::PatchedUserOAuthSourceConnectionRequest>) -> Result<models::UserOAuthSourceConnection, Error<SourcesUserConnectionsOauthPartialUpdateError>> {
2812 let local_var_configuration = configuration;
2813
2814 let local_var_client = &local_var_configuration.client;
2815
2816 let local_var_uri_str = format!("{}/sources/user_connections/oauth/{id}/", local_var_configuration.base_path, id=id);
2817 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2818
2819 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2820 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2821 }
2822 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2823 let local_var_key = local_var_apikey.key.clone();
2824 let local_var_value = match local_var_apikey.prefix {
2825 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2826 None => local_var_key,
2827 };
2828 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2829 };
2830 local_var_req_builder = local_var_req_builder.json(&patched_user_o_auth_source_connection_request);
2831
2832 let local_var_req = local_var_req_builder.build()?;
2833 let local_var_resp = local_var_client.execute(local_var_req).await?;
2834
2835 let local_var_status = local_var_resp.status();
2836 let local_var_content = local_var_resp.text().await?;
2837
2838 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2839 serde_json::from_str(&local_var_content).map_err(Error::from)
2840 } else {
2841 let local_var_entity: Option<SourcesUserConnectionsOauthPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
2842 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2843 Err(Error::ResponseError(local_var_error))
2844 }
2845}
2846
2847pub async fn sources_user_connections_oauth_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::UserOAuthSourceConnection, Error<SourcesUserConnectionsOauthRetrieveError>> {
2849 let local_var_configuration = configuration;
2850
2851 let local_var_client = &local_var_configuration.client;
2852
2853 let local_var_uri_str = format!("{}/sources/user_connections/oauth/{id}/", local_var_configuration.base_path, id=id);
2854 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2855
2856 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2857 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2858 }
2859 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2860 let local_var_key = local_var_apikey.key.clone();
2861 let local_var_value = match local_var_apikey.prefix {
2862 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2863 None => local_var_key,
2864 };
2865 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2866 };
2867
2868 let local_var_req = local_var_req_builder.build()?;
2869 let local_var_resp = local_var_client.execute(local_var_req).await?;
2870
2871 let local_var_status = local_var_resp.status();
2872 let local_var_content = local_var_resp.text().await?;
2873
2874 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2875 serde_json::from_str(&local_var_content).map_err(Error::from)
2876 } else {
2877 let local_var_entity: Option<SourcesUserConnectionsOauthRetrieveError> = serde_json::from_str(&local_var_content).ok();
2878 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2879 Err(Error::ResponseError(local_var_error))
2880 }
2881}
2882
2883pub async fn sources_user_connections_oauth_update(configuration: &configuration::Configuration, id: i32, user_o_auth_source_connection_request: models::UserOAuthSourceConnectionRequest) -> Result<models::UserOAuthSourceConnection, Error<SourcesUserConnectionsOauthUpdateError>> {
2885 let local_var_configuration = configuration;
2886
2887 let local_var_client = &local_var_configuration.client;
2888
2889 let local_var_uri_str = format!("{}/sources/user_connections/oauth/{id}/", local_var_configuration.base_path, id=id);
2890 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2891
2892 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2893 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2894 }
2895 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2896 let local_var_key = local_var_apikey.key.clone();
2897 let local_var_value = match local_var_apikey.prefix {
2898 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2899 None => local_var_key,
2900 };
2901 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2902 };
2903 local_var_req_builder = local_var_req_builder.json(&user_o_auth_source_connection_request);
2904
2905 let local_var_req = local_var_req_builder.build()?;
2906 let local_var_resp = local_var_client.execute(local_var_req).await?;
2907
2908 let local_var_status = local_var_resp.status();
2909 let local_var_content = local_var_resp.text().await?;
2910
2911 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2912 serde_json::from_str(&local_var_content).map_err(Error::from)
2913 } else {
2914 let local_var_entity: Option<SourcesUserConnectionsOauthUpdateError> = serde_json::from_str(&local_var_content).ok();
2915 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2916 Err(Error::ResponseError(local_var_error))
2917 }
2918}
2919
2920pub async fn sources_user_connections_oauth_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<SourcesUserConnectionsOauthUsedByListError>> {
2922 let local_var_configuration = configuration;
2923
2924 let local_var_client = &local_var_configuration.client;
2925
2926 let local_var_uri_str = format!("{}/sources/user_connections/oauth/{id}/used_by/", local_var_configuration.base_path, id=id);
2927 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2928
2929 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2930 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2931 }
2932 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2933 let local_var_key = local_var_apikey.key.clone();
2934 let local_var_value = match local_var_apikey.prefix {
2935 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2936 None => local_var_key,
2937 };
2938 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2939 };
2940
2941 let local_var_req = local_var_req_builder.build()?;
2942 let local_var_resp = local_var_client.execute(local_var_req).await?;
2943
2944 let local_var_status = local_var_resp.status();
2945 let local_var_content = local_var_resp.text().await?;
2946
2947 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2948 serde_json::from_str(&local_var_content).map_err(Error::from)
2949 } else {
2950 let local_var_entity: Option<SourcesUserConnectionsOauthUsedByListError> = serde_json::from_str(&local_var_content).ok();
2951 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2952 Err(Error::ResponseError(local_var_error))
2953 }
2954}
2955
2956pub async fn sources_user_connections_plex_create(configuration: &configuration::Configuration, plex_source_connection_request: models::PlexSourceConnectionRequest) -> Result<models::PlexSourceConnection, Error<SourcesUserConnectionsPlexCreateError>> {
2958 let local_var_configuration = configuration;
2959
2960 let local_var_client = &local_var_configuration.client;
2961
2962 let local_var_uri_str = format!("{}/sources/user_connections/plex/", local_var_configuration.base_path);
2963 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2964
2965 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2966 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2967 }
2968 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2969 let local_var_key = local_var_apikey.key.clone();
2970 let local_var_value = match local_var_apikey.prefix {
2971 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2972 None => local_var_key,
2973 };
2974 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2975 };
2976 local_var_req_builder = local_var_req_builder.json(&plex_source_connection_request);
2977
2978 let local_var_req = local_var_req_builder.build()?;
2979 let local_var_resp = local_var_client.execute(local_var_req).await?;
2980
2981 let local_var_status = local_var_resp.status();
2982 let local_var_content = local_var_resp.text().await?;
2983
2984 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2985 serde_json::from_str(&local_var_content).map_err(Error::from)
2986 } else {
2987 let local_var_entity: Option<SourcesUserConnectionsPlexCreateError> = serde_json::from_str(&local_var_content).ok();
2988 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2989 Err(Error::ResponseError(local_var_error))
2990 }
2991}
2992
2993pub async fn sources_user_connections_plex_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<SourcesUserConnectionsPlexDestroyError>> {
2995 let local_var_configuration = configuration;
2996
2997 let local_var_client = &local_var_configuration.client;
2998
2999 let local_var_uri_str = format!("{}/sources/user_connections/plex/{id}/", local_var_configuration.base_path, id=id);
3000 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
3001
3002 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3003 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3004 }
3005 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3006 let local_var_key = local_var_apikey.key.clone();
3007 let local_var_value = match local_var_apikey.prefix {
3008 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3009 None => local_var_key,
3010 };
3011 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3012 };
3013
3014 let local_var_req = local_var_req_builder.build()?;
3015 let local_var_resp = local_var_client.execute(local_var_req).await?;
3016
3017 let local_var_status = local_var_resp.status();
3018 let local_var_content = local_var_resp.text().await?;
3019
3020 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3021 Ok(())
3022 } else {
3023 let local_var_entity: Option<SourcesUserConnectionsPlexDestroyError> = serde_json::from_str(&local_var_content).ok();
3024 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3025 Err(Error::ResponseError(local_var_error))
3026 }
3027}
3028
3029pub async fn sources_user_connections_plex_list(configuration: &configuration::Configuration, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, source__slug: Option<&str>) -> Result<models::PaginatedPlexSourceConnectionList, Error<SourcesUserConnectionsPlexListError>> {
3031 let local_var_configuration = configuration;
3032
3033 let local_var_client = &local_var_configuration.client;
3034
3035 let local_var_uri_str = format!("{}/sources/user_connections/plex/", local_var_configuration.base_path);
3036 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3037
3038 if let Some(ref local_var_str) = ordering {
3039 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
3040 }
3041 if let Some(ref local_var_str) = page {
3042 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
3043 }
3044 if let Some(ref local_var_str) = page_size {
3045 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
3046 }
3047 if let Some(ref local_var_str) = search {
3048 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
3049 }
3050 if let Some(ref local_var_str) = source__slug {
3051 local_var_req_builder = local_var_req_builder.query(&[("source__slug", &local_var_str.to_string())]);
3052 }
3053 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3054 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3055 }
3056 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3057 let local_var_key = local_var_apikey.key.clone();
3058 let local_var_value = match local_var_apikey.prefix {
3059 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3060 None => local_var_key,
3061 };
3062 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3063 };
3064
3065 let local_var_req = local_var_req_builder.build()?;
3066 let local_var_resp = local_var_client.execute(local_var_req).await?;
3067
3068 let local_var_status = local_var_resp.status();
3069 let local_var_content = local_var_resp.text().await?;
3070
3071 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3072 serde_json::from_str(&local_var_content).map_err(Error::from)
3073 } else {
3074 let local_var_entity: Option<SourcesUserConnectionsPlexListError> = serde_json::from_str(&local_var_content).ok();
3075 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3076 Err(Error::ResponseError(local_var_error))
3077 }
3078}
3079
3080pub async fn sources_user_connections_plex_partial_update(configuration: &configuration::Configuration, id: i32, patched_plex_source_connection_request: Option<models::PatchedPlexSourceConnectionRequest>) -> Result<models::PlexSourceConnection, Error<SourcesUserConnectionsPlexPartialUpdateError>> {
3082 let local_var_configuration = configuration;
3083
3084 let local_var_client = &local_var_configuration.client;
3085
3086 let local_var_uri_str = format!("{}/sources/user_connections/plex/{id}/", local_var_configuration.base_path, id=id);
3087 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
3088
3089 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3090 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3091 }
3092 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3093 let local_var_key = local_var_apikey.key.clone();
3094 let local_var_value = match local_var_apikey.prefix {
3095 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3096 None => local_var_key,
3097 };
3098 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3099 };
3100 local_var_req_builder = local_var_req_builder.json(&patched_plex_source_connection_request);
3101
3102 let local_var_req = local_var_req_builder.build()?;
3103 let local_var_resp = local_var_client.execute(local_var_req).await?;
3104
3105 let local_var_status = local_var_resp.status();
3106 let local_var_content = local_var_resp.text().await?;
3107
3108 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3109 serde_json::from_str(&local_var_content).map_err(Error::from)
3110 } else {
3111 let local_var_entity: Option<SourcesUserConnectionsPlexPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
3112 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3113 Err(Error::ResponseError(local_var_error))
3114 }
3115}
3116
3117pub async fn sources_user_connections_plex_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::PlexSourceConnection, Error<SourcesUserConnectionsPlexRetrieveError>> {
3119 let local_var_configuration = configuration;
3120
3121 let local_var_client = &local_var_configuration.client;
3122
3123 let local_var_uri_str = format!("{}/sources/user_connections/plex/{id}/", local_var_configuration.base_path, id=id);
3124 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3125
3126 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3127 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3128 }
3129 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3130 let local_var_key = local_var_apikey.key.clone();
3131 let local_var_value = match local_var_apikey.prefix {
3132 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3133 None => local_var_key,
3134 };
3135 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3136 };
3137
3138 let local_var_req = local_var_req_builder.build()?;
3139 let local_var_resp = local_var_client.execute(local_var_req).await?;
3140
3141 let local_var_status = local_var_resp.status();
3142 let local_var_content = local_var_resp.text().await?;
3143
3144 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3145 serde_json::from_str(&local_var_content).map_err(Error::from)
3146 } else {
3147 let local_var_entity: Option<SourcesUserConnectionsPlexRetrieveError> = serde_json::from_str(&local_var_content).ok();
3148 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3149 Err(Error::ResponseError(local_var_error))
3150 }
3151}
3152
3153pub async fn sources_user_connections_plex_update(configuration: &configuration::Configuration, id: i32, plex_source_connection_request: models::PlexSourceConnectionRequest) -> Result<models::PlexSourceConnection, Error<SourcesUserConnectionsPlexUpdateError>> {
3155 let local_var_configuration = configuration;
3156
3157 let local_var_client = &local_var_configuration.client;
3158
3159 let local_var_uri_str = format!("{}/sources/user_connections/plex/{id}/", local_var_configuration.base_path, id=id);
3160 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3161
3162 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3163 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3164 }
3165 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3166 let local_var_key = local_var_apikey.key.clone();
3167 let local_var_value = match local_var_apikey.prefix {
3168 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3169 None => local_var_key,
3170 };
3171 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3172 };
3173 local_var_req_builder = local_var_req_builder.json(&plex_source_connection_request);
3174
3175 let local_var_req = local_var_req_builder.build()?;
3176 let local_var_resp = local_var_client.execute(local_var_req).await?;
3177
3178 let local_var_status = local_var_resp.status();
3179 let local_var_content = local_var_resp.text().await?;
3180
3181 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3182 serde_json::from_str(&local_var_content).map_err(Error::from)
3183 } else {
3184 let local_var_entity: Option<SourcesUserConnectionsPlexUpdateError> = serde_json::from_str(&local_var_content).ok();
3185 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3186 Err(Error::ResponseError(local_var_error))
3187 }
3188}
3189
3190pub async fn sources_user_connections_plex_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<SourcesUserConnectionsPlexUsedByListError>> {
3192 let local_var_configuration = configuration;
3193
3194 let local_var_client = &local_var_configuration.client;
3195
3196 let local_var_uri_str = format!("{}/sources/user_connections/plex/{id}/used_by/", local_var_configuration.base_path, id=id);
3197 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3198
3199 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3200 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3201 }
3202 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3203 let local_var_key = local_var_apikey.key.clone();
3204 let local_var_value = match local_var_apikey.prefix {
3205 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3206 None => local_var_key,
3207 };
3208 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3209 };
3210
3211 let local_var_req = local_var_req_builder.build()?;
3212 let local_var_resp = local_var_client.execute(local_var_req).await?;
3213
3214 let local_var_status = local_var_resp.status();
3215 let local_var_content = local_var_resp.text().await?;
3216
3217 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3218 serde_json::from_str(&local_var_content).map_err(Error::from)
3219 } else {
3220 let local_var_entity: Option<SourcesUserConnectionsPlexUsedByListError> = serde_json::from_str(&local_var_content).ok();
3221 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3222 Err(Error::ResponseError(local_var_error))
3223 }
3224}
3225
3226pub async fn sources_user_connections_saml_create(configuration: &configuration::Configuration, user_saml_source_connection_request: models::UserSamlSourceConnectionRequest) -> Result<models::UserSamlSourceConnection, Error<SourcesUserConnectionsSamlCreateError>> {
3228 let local_var_configuration = configuration;
3229
3230 let local_var_client = &local_var_configuration.client;
3231
3232 let local_var_uri_str = format!("{}/sources/user_connections/saml/", local_var_configuration.base_path);
3233 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3234
3235 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3236 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3237 }
3238 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3239 let local_var_key = local_var_apikey.key.clone();
3240 let local_var_value = match local_var_apikey.prefix {
3241 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3242 None => local_var_key,
3243 };
3244 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3245 };
3246 local_var_req_builder = local_var_req_builder.json(&user_saml_source_connection_request);
3247
3248 let local_var_req = local_var_req_builder.build()?;
3249 let local_var_resp = local_var_client.execute(local_var_req).await?;
3250
3251 let local_var_status = local_var_resp.status();
3252 let local_var_content = local_var_resp.text().await?;
3253
3254 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3255 serde_json::from_str(&local_var_content).map_err(Error::from)
3256 } else {
3257 let local_var_entity: Option<SourcesUserConnectionsSamlCreateError> = serde_json::from_str(&local_var_content).ok();
3258 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3259 Err(Error::ResponseError(local_var_error))
3260 }
3261}
3262
3263pub async fn sources_user_connections_saml_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<SourcesUserConnectionsSamlDestroyError>> {
3265 let local_var_configuration = configuration;
3266
3267 let local_var_client = &local_var_configuration.client;
3268
3269 let local_var_uri_str = format!("{}/sources/user_connections/saml/{id}/", local_var_configuration.base_path, id=id);
3270 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
3271
3272 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3273 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3274 }
3275 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3276 let local_var_key = local_var_apikey.key.clone();
3277 let local_var_value = match local_var_apikey.prefix {
3278 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3279 None => local_var_key,
3280 };
3281 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3282 };
3283
3284 let local_var_req = local_var_req_builder.build()?;
3285 let local_var_resp = local_var_client.execute(local_var_req).await?;
3286
3287 let local_var_status = local_var_resp.status();
3288 let local_var_content = local_var_resp.text().await?;
3289
3290 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3291 Ok(())
3292 } else {
3293 let local_var_entity: Option<SourcesUserConnectionsSamlDestroyError> = serde_json::from_str(&local_var_content).ok();
3294 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3295 Err(Error::ResponseError(local_var_error))
3296 }
3297}
3298
3299pub async fn sources_user_connections_saml_list(configuration: &configuration::Configuration, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, source__slug: Option<&str>) -> Result<models::PaginatedUserSamlSourceConnectionList, Error<SourcesUserConnectionsSamlListError>> {
3301 let local_var_configuration = configuration;
3302
3303 let local_var_client = &local_var_configuration.client;
3304
3305 let local_var_uri_str = format!("{}/sources/user_connections/saml/", local_var_configuration.base_path);
3306 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3307
3308 if let Some(ref local_var_str) = ordering {
3309 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
3310 }
3311 if let Some(ref local_var_str) = page {
3312 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
3313 }
3314 if let Some(ref local_var_str) = page_size {
3315 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
3316 }
3317 if let Some(ref local_var_str) = search {
3318 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
3319 }
3320 if let Some(ref local_var_str) = source__slug {
3321 local_var_req_builder = local_var_req_builder.query(&[("source__slug", &local_var_str.to_string())]);
3322 }
3323 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3324 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3325 }
3326 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3327 let local_var_key = local_var_apikey.key.clone();
3328 let local_var_value = match local_var_apikey.prefix {
3329 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3330 None => local_var_key,
3331 };
3332 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3333 };
3334
3335 let local_var_req = local_var_req_builder.build()?;
3336 let local_var_resp = local_var_client.execute(local_var_req).await?;
3337
3338 let local_var_status = local_var_resp.status();
3339 let local_var_content = local_var_resp.text().await?;
3340
3341 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3342 serde_json::from_str(&local_var_content).map_err(Error::from)
3343 } else {
3344 let local_var_entity: Option<SourcesUserConnectionsSamlListError> = serde_json::from_str(&local_var_content).ok();
3345 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3346 Err(Error::ResponseError(local_var_error))
3347 }
3348}
3349
3350pub async fn sources_user_connections_saml_partial_update(configuration: &configuration::Configuration, id: i32, patched_user_saml_source_connection_request: Option<models::PatchedUserSamlSourceConnectionRequest>) -> Result<models::UserSamlSourceConnection, Error<SourcesUserConnectionsSamlPartialUpdateError>> {
3352 let local_var_configuration = configuration;
3353
3354 let local_var_client = &local_var_configuration.client;
3355
3356 let local_var_uri_str = format!("{}/sources/user_connections/saml/{id}/", local_var_configuration.base_path, id=id);
3357 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
3358
3359 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3360 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3361 }
3362 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3363 let local_var_key = local_var_apikey.key.clone();
3364 let local_var_value = match local_var_apikey.prefix {
3365 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3366 None => local_var_key,
3367 };
3368 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3369 };
3370 local_var_req_builder = local_var_req_builder.json(&patched_user_saml_source_connection_request);
3371
3372 let local_var_req = local_var_req_builder.build()?;
3373 let local_var_resp = local_var_client.execute(local_var_req).await?;
3374
3375 let local_var_status = local_var_resp.status();
3376 let local_var_content = local_var_resp.text().await?;
3377
3378 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3379 serde_json::from_str(&local_var_content).map_err(Error::from)
3380 } else {
3381 let local_var_entity: Option<SourcesUserConnectionsSamlPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
3382 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3383 Err(Error::ResponseError(local_var_error))
3384 }
3385}
3386
3387pub async fn sources_user_connections_saml_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::UserSamlSourceConnection, Error<SourcesUserConnectionsSamlRetrieveError>> {
3389 let local_var_configuration = configuration;
3390
3391 let local_var_client = &local_var_configuration.client;
3392
3393 let local_var_uri_str = format!("{}/sources/user_connections/saml/{id}/", local_var_configuration.base_path, id=id);
3394 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3395
3396 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3397 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3398 }
3399 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3400 let local_var_key = local_var_apikey.key.clone();
3401 let local_var_value = match local_var_apikey.prefix {
3402 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3403 None => local_var_key,
3404 };
3405 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3406 };
3407
3408 let local_var_req = local_var_req_builder.build()?;
3409 let local_var_resp = local_var_client.execute(local_var_req).await?;
3410
3411 let local_var_status = local_var_resp.status();
3412 let local_var_content = local_var_resp.text().await?;
3413
3414 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3415 serde_json::from_str(&local_var_content).map_err(Error::from)
3416 } else {
3417 let local_var_entity: Option<SourcesUserConnectionsSamlRetrieveError> = serde_json::from_str(&local_var_content).ok();
3418 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3419 Err(Error::ResponseError(local_var_error))
3420 }
3421}
3422
3423pub async fn sources_user_connections_saml_update(configuration: &configuration::Configuration, id: i32, user_saml_source_connection_request: models::UserSamlSourceConnectionRequest) -> Result<models::UserSamlSourceConnection, Error<SourcesUserConnectionsSamlUpdateError>> {
3425 let local_var_configuration = configuration;
3426
3427 let local_var_client = &local_var_configuration.client;
3428
3429 let local_var_uri_str = format!("{}/sources/user_connections/saml/{id}/", local_var_configuration.base_path, id=id);
3430 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3431
3432 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3433 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3434 }
3435 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3436 let local_var_key = local_var_apikey.key.clone();
3437 let local_var_value = match local_var_apikey.prefix {
3438 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3439 None => local_var_key,
3440 };
3441 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3442 };
3443 local_var_req_builder = local_var_req_builder.json(&user_saml_source_connection_request);
3444
3445 let local_var_req = local_var_req_builder.build()?;
3446 let local_var_resp = local_var_client.execute(local_var_req).await?;
3447
3448 let local_var_status = local_var_resp.status();
3449 let local_var_content = local_var_resp.text().await?;
3450
3451 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3452 serde_json::from_str(&local_var_content).map_err(Error::from)
3453 } else {
3454 let local_var_entity: Option<SourcesUserConnectionsSamlUpdateError> = serde_json::from_str(&local_var_content).ok();
3455 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3456 Err(Error::ResponseError(local_var_error))
3457 }
3458}
3459
3460pub async fn sources_user_connections_saml_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<SourcesUserConnectionsSamlUsedByListError>> {
3462 let local_var_configuration = configuration;
3463
3464 let local_var_client = &local_var_configuration.client;
3465
3466 let local_var_uri_str = format!("{}/sources/user_connections/saml/{id}/used_by/", local_var_configuration.base_path, id=id);
3467 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3468
3469 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3470 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3471 }
3472 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3473 let local_var_key = local_var_apikey.key.clone();
3474 let local_var_value = match local_var_apikey.prefix {
3475 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3476 None => local_var_key,
3477 };
3478 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3479 };
3480
3481 let local_var_req = local_var_req_builder.build()?;
3482 let local_var_resp = local_var_client.execute(local_var_req).await?;
3483
3484 let local_var_status = local_var_resp.status();
3485 let local_var_content = local_var_resp.text().await?;
3486
3487 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3488 serde_json::from_str(&local_var_content).map_err(Error::from)
3489 } else {
3490 let local_var_entity: Option<SourcesUserConnectionsSamlUsedByListError> = serde_json::from_str(&local_var_content).ok();
3491 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3492 Err(Error::ResponseError(local_var_error))
3493 }
3494}
3495