1use super::{configuration, Error};
26use crate::apis::ResponseContent;
27use ::qcs_api_client_common::backoff::{
28 duration_from_io_error, duration_from_reqwest_error, duration_from_response, ExponentialBackoff,
29};
30#[cfg(feature = "tracing")]
31use qcs_api_client_common::configuration::tokens::TokenRefresher;
32use reqwest::StatusCode;
33use serde::{Deserialize, Serialize};
34
35#[cfg(feature = "clap")]
36#[allow(unused, reason = "not used in all templates, but required in some")]
37use ::{miette::IntoDiagnostic as _, qcs_api_client_common::clap_utils::JsonMaybeStdin};
38
39#[cfg(feature = "clap")]
41#[derive(Debug, clap::Args)]
42pub struct ActivateUserClapParams {
43 pub activate_user_request: Option<JsonMaybeStdin<crate::models::ActivateUserRequest>>,
44}
45
46#[cfg(feature = "clap")]
47impl ActivateUserClapParams {
48 pub async fn execute(
49 self,
50 configuration: &configuration::Configuration,
51 ) -> Result<crate::models::User, miette::Error> {
52 let request = self
53 .activate_user_request
54 .map(|body| body.into_inner().into_inner());
55
56 activate_user(configuration, request)
57 .await
58 .into_diagnostic()
59 }
60}
61
62#[cfg(feature = "clap")]
64#[derive(Debug, clap::Args)]
65pub struct AddGroupUserClapParams {
66 pub add_group_user_request: JsonMaybeStdin<crate::models::AddGroupUserRequest>,
67}
68
69#[cfg(feature = "clap")]
70impl AddGroupUserClapParams {
71 pub async fn execute(
72 self,
73 configuration: &configuration::Configuration,
74 ) -> Result<(), miette::Error> {
75 let request = self.add_group_user_request.into_inner().into_inner();
76
77 add_group_user(configuration, request)
78 .await
79 .into_diagnostic()
80 }
81}
82
83#[cfg(feature = "clap")]
85#[derive(Debug, clap::Args)]
86pub struct DismissViewerAnnouncementClapParams {
87 #[arg(long)]
89 pub announcement_id: i64,
90}
91
92#[cfg(feature = "clap")]
93impl DismissViewerAnnouncementClapParams {
94 pub async fn execute(
95 self,
96 configuration: &configuration::Configuration,
97 ) -> Result<(), miette::Error> {
98 dismiss_viewer_announcement(configuration, self.announcement_id)
99 .await
100 .into_diagnostic()
101 }
102}
103
104#[cfg(feature = "clap")]
106#[derive(Debug, clap::Args)]
107pub struct GetGroupBalanceClapParams {
108 #[arg(long)]
110 pub group_name: String,
111}
112
113#[cfg(feature = "clap")]
114impl GetGroupBalanceClapParams {
115 pub async fn execute(
116 self,
117 configuration: &configuration::Configuration,
118 ) -> Result<crate::models::AccountBalance, miette::Error> {
119 get_group_balance(configuration, self.group_name.as_str())
120 .await
121 .into_diagnostic()
122 }
123}
124
125#[cfg(feature = "clap")]
127#[derive(Debug, clap::Args)]
128pub struct GetGroupBillingCustomerClapParams {
129 #[arg(long)]
131 pub group_name: String,
132}
133
134#[cfg(feature = "clap")]
135impl GetGroupBillingCustomerClapParams {
136 pub async fn execute(
137 self,
138 configuration: &configuration::Configuration,
139 ) -> Result<crate::models::BillingCustomer, miette::Error> {
140 get_group_billing_customer(configuration, self.group_name.as_str())
141 .await
142 .into_diagnostic()
143 }
144}
145
146#[cfg(feature = "clap")]
148#[derive(Debug, clap::Args)]
149pub struct GetGroupUpcomingBillingInvoiceClapParams {
150 #[arg(long)]
152 pub group_name: String,
153}
154
155#[cfg(feature = "clap")]
156impl GetGroupUpcomingBillingInvoiceClapParams {
157 pub async fn execute(
158 self,
159 configuration: &configuration::Configuration,
160 ) -> Result<crate::models::BillingUpcomingInvoice, miette::Error> {
161 get_group_upcoming_billing_invoice(configuration, self.group_name.as_str())
162 .await
163 .into_diagnostic()
164 }
165}
166
167#[cfg(feature = "clap")]
169#[derive(Debug, clap::Args)]
170pub struct GetUserBalanceClapParams {
171 #[arg(long)]
173 pub user_id: String,
174}
175
176#[cfg(feature = "clap")]
177impl GetUserBalanceClapParams {
178 pub async fn execute(
179 self,
180 configuration: &configuration::Configuration,
181 ) -> Result<crate::models::AccountBalance, miette::Error> {
182 get_user_balance(configuration, self.user_id.as_str())
183 .await
184 .into_diagnostic()
185 }
186}
187
188#[cfg(feature = "clap")]
190#[derive(Debug, clap::Args)]
191pub struct GetUserBillingCustomerClapParams {
192 #[arg(long)]
194 pub user_id: String,
195}
196
197#[cfg(feature = "clap")]
198impl GetUserBillingCustomerClapParams {
199 pub async fn execute(
200 self,
201 configuration: &configuration::Configuration,
202 ) -> Result<crate::models::BillingCustomer, miette::Error> {
203 get_user_billing_customer(configuration, self.user_id.as_str())
204 .await
205 .into_diagnostic()
206 }
207}
208
209#[cfg(feature = "clap")]
211#[derive(Debug, clap::Args)]
212pub struct GetUserEventBillingPriceClapParams {
213 #[arg(long)]
215 pub user_id: String,
216 pub get_account_event_billing_price_request:
217 JsonMaybeStdin<crate::models::GetAccountEventBillingPriceRequest>,
218}
219
220#[cfg(feature = "clap")]
221impl GetUserEventBillingPriceClapParams {
222 pub async fn execute(
223 self,
224 configuration: &configuration::Configuration,
225 ) -> Result<crate::models::EventBillingPriceRate, miette::Error> {
226 let request = self
227 .get_account_event_billing_price_request
228 .into_inner()
229 .into_inner();
230
231 get_user_event_billing_price(configuration, self.user_id.as_str(), request)
232 .await
233 .into_diagnostic()
234 }
235}
236
237#[cfg(feature = "clap")]
239#[derive(Debug, clap::Args)]
240pub struct GetUserUpcomingBillingInvoiceClapParams {
241 #[arg(long)]
243 pub user_id: String,
244}
245
246#[cfg(feature = "clap")]
247impl GetUserUpcomingBillingInvoiceClapParams {
248 pub async fn execute(
249 self,
250 configuration: &configuration::Configuration,
251 ) -> Result<crate::models::BillingUpcomingInvoice, miette::Error> {
252 get_user_upcoming_billing_invoice(configuration, self.user_id.as_str())
253 .await
254 .into_diagnostic()
255 }
256}
257
258#[cfg(feature = "clap")]
260#[derive(Debug, clap::Args)]
261pub struct GetViewerUserOnboardingCompletedClapParams {}
262
263#[cfg(feature = "clap")]
264impl GetViewerUserOnboardingCompletedClapParams {
265 pub async fn execute(
266 self,
267 configuration: &configuration::Configuration,
268 ) -> Result<crate::models::ViewerUserOnboardingCompleted, miette::Error> {
269 get_viewer_user_onboarding_completed(configuration)
270 .await
271 .into_diagnostic()
272 }
273}
274
275#[cfg(feature = "clap")]
277#[derive(Debug, clap::Args)]
278pub struct ListGroupBillingInvoiceLinesClapParams {
279 #[arg(long)]
281 pub group_name: String,
282 #[arg(long)]
284 pub billing_invoice_id: String,
285 #[arg(long)]
287 pub page_token: Option<String>,
288 #[arg(long)]
289 pub page_size: Option<i64>,
290}
291
292#[cfg(feature = "clap")]
293impl ListGroupBillingInvoiceLinesClapParams {
294 pub async fn execute(
295 self,
296 configuration: &configuration::Configuration,
297 ) -> Result<crate::models::ListAccountBillingInvoiceLinesResponse, miette::Error> {
298 list_group_billing_invoice_lines(
299 configuration,
300 self.group_name.as_str(),
301 self.billing_invoice_id.as_str(),
302 self.page_token.as_deref(),
303 self.page_size,
304 )
305 .await
306 .into_diagnostic()
307 }
308}
309
310#[cfg(feature = "clap")]
312#[derive(Debug, clap::Args)]
313pub struct ListGroupBillingInvoicesClapParams {
314 #[arg(long)]
316 pub group_name: String,
317 #[arg(long)]
319 pub page_token: Option<String>,
320 #[arg(long)]
321 pub page_size: Option<i64>,
322}
323
324#[cfg(feature = "clap")]
325impl ListGroupBillingInvoicesClapParams {
326 pub async fn execute(
327 self,
328 configuration: &configuration::Configuration,
329 ) -> Result<crate::models::ListAccountBillingInvoicesResponse, miette::Error> {
330 list_group_billing_invoices(
331 configuration,
332 self.group_name.as_str(),
333 self.page_token.as_deref(),
334 self.page_size,
335 )
336 .await
337 .into_diagnostic()
338 }
339}
340
341#[cfg(feature = "clap")]
343#[derive(Debug, clap::Args)]
344pub struct ListGroupUpcomingBillingInvoiceLinesClapParams {
345 #[arg(long)]
347 pub group_name: String,
348 #[arg(long)]
350 pub page_token: Option<String>,
351 #[arg(long)]
352 pub page_size: Option<i64>,
353}
354
355#[cfg(feature = "clap")]
356impl ListGroupUpcomingBillingInvoiceLinesClapParams {
357 pub async fn execute(
358 self,
359 configuration: &configuration::Configuration,
360 ) -> Result<crate::models::ListAccountBillingInvoiceLinesResponse, miette::Error> {
361 list_group_upcoming_billing_invoice_lines(
362 configuration,
363 self.group_name.as_str(),
364 self.page_token.as_deref(),
365 self.page_size,
366 )
367 .await
368 .into_diagnostic()
369 }
370}
371
372#[cfg(feature = "clap")]
374#[derive(Debug, clap::Args)]
375pub struct ListGroupUsersClapParams {
376 #[arg(long)]
378 pub group_name: String,
379 #[arg(long)]
380 pub page_size: Option<i64>,
381 #[arg(long)]
383 pub page_token: Option<String>,
384}
385
386#[cfg(feature = "clap")]
387impl ListGroupUsersClapParams {
388 pub async fn execute(
389 self,
390 configuration: &configuration::Configuration,
391 ) -> Result<crate::models::ListGroupUsersResponse, miette::Error> {
392 list_group_users(
393 configuration,
394 self.group_name.as_str(),
395 self.page_size,
396 self.page_token.as_deref(),
397 )
398 .await
399 .into_diagnostic()
400 }
401}
402
403#[cfg(feature = "clap")]
405#[derive(Debug, clap::Args)]
406pub struct ListUserBillingInvoiceLinesClapParams {
407 #[arg(long)]
409 pub user_id: String,
410 #[arg(long)]
412 pub billing_invoice_id: String,
413 #[arg(long)]
415 pub page_token: Option<String>,
416 #[arg(long)]
417 pub page_size: Option<i64>,
418}
419
420#[cfg(feature = "clap")]
421impl ListUserBillingInvoiceLinesClapParams {
422 pub async fn execute(
423 self,
424 configuration: &configuration::Configuration,
425 ) -> Result<crate::models::ListAccountBillingInvoiceLinesResponse, miette::Error> {
426 list_user_billing_invoice_lines(
427 configuration,
428 self.user_id.as_str(),
429 self.billing_invoice_id.as_str(),
430 self.page_token.as_deref(),
431 self.page_size,
432 )
433 .await
434 .into_diagnostic()
435 }
436}
437
438#[cfg(feature = "clap")]
440#[derive(Debug, clap::Args)]
441pub struct ListUserBillingInvoicesClapParams {
442 #[arg(long)]
444 pub user_id: String,
445 #[arg(long)]
447 pub page_token: Option<String>,
448 #[arg(long)]
449 pub page_size: Option<i64>,
450}
451
452#[cfg(feature = "clap")]
453impl ListUserBillingInvoicesClapParams {
454 pub async fn execute(
455 self,
456 configuration: &configuration::Configuration,
457 ) -> Result<crate::models::ListAccountBillingInvoicesResponse, miette::Error> {
458 list_user_billing_invoices(
459 configuration,
460 self.user_id.as_str(),
461 self.page_token.as_deref(),
462 self.page_size,
463 )
464 .await
465 .into_diagnostic()
466 }
467}
468
469#[cfg(feature = "clap")]
471#[derive(Debug, clap::Args)]
472pub struct ListUserGroupsClapParams {
473 #[arg(long)]
475 pub user_id: String,
476 #[arg(long)]
477 pub page_size: Option<i64>,
478 #[arg(long)]
480 pub page_token: Option<String>,
481}
482
483#[cfg(feature = "clap")]
484impl ListUserGroupsClapParams {
485 pub async fn execute(
486 self,
487 configuration: &configuration::Configuration,
488 ) -> Result<crate::models::ListGroupsResponse, miette::Error> {
489 list_user_groups(
490 configuration,
491 self.user_id.as_str(),
492 self.page_size,
493 self.page_token.as_deref(),
494 )
495 .await
496 .into_diagnostic()
497 }
498}
499
500#[cfg(feature = "clap")]
502#[derive(Debug, clap::Args)]
503pub struct ListUserUpcomingBillingInvoiceLinesClapParams {
504 #[arg(long)]
506 pub user_id: String,
507 #[arg(long)]
509 pub page_token: Option<String>,
510 #[arg(long)]
511 pub page_size: Option<i64>,
512}
513
514#[cfg(feature = "clap")]
515impl ListUserUpcomingBillingInvoiceLinesClapParams {
516 pub async fn execute(
517 self,
518 configuration: &configuration::Configuration,
519 ) -> Result<crate::models::ListAccountBillingInvoiceLinesResponse, miette::Error> {
520 list_user_upcoming_billing_invoice_lines(
521 configuration,
522 self.user_id.as_str(),
523 self.page_token.as_deref(),
524 self.page_size,
525 )
526 .await
527 .into_diagnostic()
528 }
529}
530
531#[cfg(feature = "clap")]
533#[derive(Debug, clap::Args)]
534pub struct ListViewerAnnouncementsClapParams {
535 #[arg(long)]
536 pub page_size: Option<i64>,
537 #[arg(long)]
539 pub page_token: Option<String>,
540 #[arg(long)]
542 pub include_dismissed: Option<bool>,
543}
544
545#[cfg(feature = "clap")]
546impl ListViewerAnnouncementsClapParams {
547 pub async fn execute(
548 self,
549 configuration: &configuration::Configuration,
550 ) -> Result<crate::models::AnnouncementsResponse, miette::Error> {
551 list_viewer_announcements(
552 configuration,
553 self.page_size,
554 self.page_token.as_deref(),
555 self.include_dismissed,
556 )
557 .await
558 .into_diagnostic()
559 }
560}
561
562#[cfg(feature = "clap")]
564#[derive(Debug, clap::Args)]
565pub struct PutViewerUserOnboardingCompletedClapParams {
566 pub viewer_user_onboarding_completed:
567 Option<JsonMaybeStdin<crate::models::ViewerUserOnboardingCompleted>>,
568}
569
570#[cfg(feature = "clap")]
571impl PutViewerUserOnboardingCompletedClapParams {
572 pub async fn execute(
573 self,
574 configuration: &configuration::Configuration,
575 ) -> Result<crate::models::ViewerUserOnboardingCompleted, miette::Error> {
576 let request = self
577 .viewer_user_onboarding_completed
578 .map(|body| body.into_inner().into_inner());
579
580 put_viewer_user_onboarding_completed(configuration, request)
581 .await
582 .into_diagnostic()
583 }
584}
585
586#[cfg(feature = "clap")]
588#[derive(Debug, clap::Args)]
589pub struct RemoveGroupUserClapParams {
590 pub remove_group_user_request: JsonMaybeStdin<crate::models::RemoveGroupUserRequest>,
591}
592
593#[cfg(feature = "clap")]
594impl RemoveGroupUserClapParams {
595 pub async fn execute(
596 self,
597 configuration: &configuration::Configuration,
598 ) -> Result<(), miette::Error> {
599 let request = self.remove_group_user_request.into_inner().into_inner();
600
601 remove_group_user(configuration, request)
602 .await
603 .into_diagnostic()
604 }
605}
606
607#[cfg(feature = "clap")]
609#[derive(Debug, clap::Args)]
610pub struct UpdateViewerUserProfileClapParams {
611 pub update_viewer_user_profile_request:
612 JsonMaybeStdin<crate::models::UpdateViewerUserProfileRequest>,
613}
614
615#[cfg(feature = "clap")]
616impl UpdateViewerUserProfileClapParams {
617 pub async fn execute(
618 self,
619 configuration: &configuration::Configuration,
620 ) -> Result<crate::models::User, miette::Error> {
621 let request = self
622 .update_viewer_user_profile_request
623 .into_inner()
624 .into_inner();
625
626 update_viewer_user_profile(configuration, request)
627 .await
628 .into_diagnostic()
629 }
630}
631
632#[derive(Debug, Clone, Serialize, Deserialize)]
634#[serde(untagged)]
635pub enum ActivateUserError {
636 Status422(crate::models::Error),
637 UnknownValue(serde_json::Value),
638}
639
640#[derive(Debug, Clone, Serialize, Deserialize)]
642#[serde(untagged)]
643pub enum AddGroupUserError {
644 Status404(crate::models::Error),
645 Status422(crate::models::Error),
646 UnknownValue(serde_json::Value),
647}
648
649#[derive(Debug, Clone, Serialize, Deserialize)]
651#[serde(untagged)]
652pub enum DismissViewerAnnouncementError {
653 Status401(crate::models::Error),
654 Status404(crate::models::Error),
655 UnknownValue(serde_json::Value),
656}
657
658#[derive(Debug, Clone, Serialize, Deserialize)]
660#[serde(untagged)]
661pub enum GetGroupBalanceError {
662 Status403(crate::models::Error),
663 Status404(crate::models::Error),
664 Status422(crate::models::Error),
665 UnknownValue(serde_json::Value),
666}
667
668#[derive(Debug, Clone, Serialize, Deserialize)]
670#[serde(untagged)]
671pub enum GetGroupBillingCustomerError {
672 Status403(crate::models::Error),
673 Status404(crate::models::Error),
674 UnknownValue(serde_json::Value),
675}
676
677#[derive(Debug, Clone, Serialize, Deserialize)]
679#[serde(untagged)]
680pub enum GetGroupUpcomingBillingInvoiceError {
681 Status403(crate::models::Error),
682 Status404(crate::models::Error),
683 UnknownValue(serde_json::Value),
684}
685
686#[derive(Debug, Clone, Serialize, Deserialize)]
688#[serde(untagged)]
689pub enum GetUserBalanceError {
690 Status403(crate::models::Error),
691 Status404(crate::models::Error),
692 Status422(crate::models::Error),
693 UnknownValue(serde_json::Value),
694}
695
696#[derive(Debug, Clone, Serialize, Deserialize)]
698#[serde(untagged)]
699pub enum GetUserBillingCustomerError {
700 Status403(crate::models::Error),
701 Status404(crate::models::Error),
702 UnknownValue(serde_json::Value),
703}
704
705#[derive(Debug, Clone, Serialize, Deserialize)]
707#[serde(untagged)]
708pub enum GetUserEventBillingPriceError {
709 Status403(crate::models::Error),
710 Status404(crate::models::Error),
711 Status422(crate::models::Error),
712 UnknownValue(serde_json::Value),
713}
714
715#[derive(Debug, Clone, Serialize, Deserialize)]
717#[serde(untagged)]
718pub enum GetUserUpcomingBillingInvoiceError {
719 Status403(crate::models::Error),
720 Status404(crate::models::Error),
721 UnknownValue(serde_json::Value),
722}
723
724#[derive(Debug, Clone, Serialize, Deserialize)]
726#[serde(untagged)]
727pub enum GetViewerUserOnboardingCompletedError {
728 Status401(crate::models::Error),
729 UnknownValue(serde_json::Value),
730}
731
732#[derive(Debug, Clone, Serialize, Deserialize)]
734#[serde(untagged)]
735pub enum ListGroupBillingInvoiceLinesError {
736 Status403(crate::models::Error),
737 Status404(crate::models::Error),
738 UnknownValue(serde_json::Value),
739}
740
741#[derive(Debug, Clone, Serialize, Deserialize)]
743#[serde(untagged)]
744pub enum ListGroupBillingInvoicesError {
745 Status403(crate::models::Error),
746 Status404(crate::models::Error),
747 UnknownValue(serde_json::Value),
748}
749
750#[derive(Debug, Clone, Serialize, Deserialize)]
752#[serde(untagged)]
753pub enum ListGroupUpcomingBillingInvoiceLinesError {
754 Status403(crate::models::Error),
755 Status404(crate::models::Error),
756 UnknownValue(serde_json::Value),
757}
758
759#[derive(Debug, Clone, Serialize, Deserialize)]
761#[serde(untagged)]
762pub enum ListGroupUsersError {
763 Status404(crate::models::Error),
764 Status422(crate::models::Error),
765 UnknownValue(serde_json::Value),
766}
767
768#[derive(Debug, Clone, Serialize, Deserialize)]
770#[serde(untagged)]
771pub enum ListUserBillingInvoiceLinesError {
772 Status403(crate::models::Error),
773 Status404(crate::models::Error),
774 UnknownValue(serde_json::Value),
775}
776
777#[derive(Debug, Clone, Serialize, Deserialize)]
779#[serde(untagged)]
780pub enum ListUserBillingInvoicesError {
781 Status403(crate::models::Error),
782 Status404(crate::models::Error),
783 UnknownValue(serde_json::Value),
784}
785
786#[derive(Debug, Clone, Serialize, Deserialize)]
788#[serde(untagged)]
789pub enum ListUserGroupsError {
790 Status422(crate::models::Error),
791 UnknownValue(serde_json::Value),
792}
793
794#[derive(Debug, Clone, Serialize, Deserialize)]
796#[serde(untagged)]
797pub enum ListUserUpcomingBillingInvoiceLinesError {
798 Status403(crate::models::Error),
799 Status404(crate::models::Error),
800 UnknownValue(serde_json::Value),
801}
802
803#[derive(Debug, Clone, Serialize, Deserialize)]
805#[serde(untagged)]
806pub enum ListViewerAnnouncementsError {
807 Status401(crate::models::Error),
808 Status422(crate::models::Error),
809 UnknownValue(serde_json::Value),
810}
811
812#[derive(Debug, Clone, Serialize, Deserialize)]
814#[serde(untagged)]
815pub enum PutViewerUserOnboardingCompletedError {
816 Status401(crate::models::Error),
817 UnknownValue(serde_json::Value),
818}
819
820#[derive(Debug, Clone, Serialize, Deserialize)]
822#[serde(untagged)]
823pub enum RemoveGroupUserError {
824 Status404(crate::models::Error),
825 Status422(crate::models::Error),
826 UnknownValue(serde_json::Value),
827}
828
829#[derive(Debug, Clone, Serialize, Deserialize)]
831#[serde(untagged)]
832pub enum UpdateViewerUserProfileError {
833 Status401(crate::models::Error),
834 Status404(crate::models::Error),
835 Status422(crate::models::Error),
836 UnknownValue(serde_json::Value),
837}
838
839async fn activate_user_inner(
840 configuration: &configuration::Configuration,
841 backoff: &mut ExponentialBackoff,
842 activate_user_request: Option<crate::models::ActivateUserRequest>,
843) -> Result<crate::models::User, Error<ActivateUserError>> {
844 let local_var_configuration = configuration;
845
846 let local_var_client = &local_var_configuration.client;
847
848 let local_var_uri_str = format!(
849 "{}/v1/users:activate",
850 local_var_configuration.qcs_config.api_url()
851 );
852 let mut local_var_req_builder =
853 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
854
855 #[cfg(feature = "tracing")]
856 {
857 let local_var_do_tracing = local_var_uri_str
860 .parse::<::url::Url>()
861 .ok()
862 .is_none_or(|url| {
863 configuration
864 .qcs_config
865 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
866 });
867
868 if local_var_do_tracing {
869 ::tracing::debug!(
870 url=%local_var_uri_str,
871 method="POST",
872 "making activate_user request",
873 );
874 }
875 }
876
877 {
880 use qcs_api_client_common::configuration::TokenError;
881
882 #[allow(
883 clippy::nonminimal_bool,
884 clippy::eq_op,
885 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
886 )]
887 let is_jwt_bearer_optional: bool = false;
888
889 let token = local_var_configuration
890 .qcs_config
891 .get_bearer_access_token()
892 .await;
893
894 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
895 #[cfg(feature = "tracing")]
897 tracing::debug!(
898 "No client credentials found, but this call does not require authentication."
899 );
900 } else {
901 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
902 }
903 }
904
905 local_var_req_builder = local_var_req_builder.json(&activate_user_request);
906
907 let local_var_req = local_var_req_builder.build()?;
908 let local_var_resp = local_var_client.execute(local_var_req).await?;
909
910 let local_var_status = local_var_resp.status();
911
912 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
913 let local_var_content = local_var_resp.text().await?;
914 serde_json::from_str(&local_var_content).map_err(Error::from)
915 } else {
916 let local_var_retry_delay =
917 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
918 let local_var_content = local_var_resp.text().await?;
919 let local_var_entity: Option<ActivateUserError> =
920 serde_json::from_str(&local_var_content).ok();
921 let local_var_error = ResponseContent {
922 status: local_var_status,
923 content: local_var_content,
924 entity: local_var_entity,
925 retry_delay: local_var_retry_delay,
926 };
927 Err(Error::ResponseError(local_var_error))
928 }
929}
930
931pub async fn activate_user(
933 configuration: &configuration::Configuration,
934 activate_user_request: Option<crate::models::ActivateUserRequest>,
935) -> Result<crate::models::User, Error<ActivateUserError>> {
936 let mut backoff = configuration.backoff.clone();
937 let mut refreshed_credentials = false;
938 let method = reqwest::Method::POST;
939 loop {
940 let result =
941 activate_user_inner(configuration, &mut backoff, activate_user_request.clone()).await;
942
943 match result {
944 Ok(result) => return Ok(result),
945 Err(Error::ResponseError(response)) => {
946 if !refreshed_credentials
947 && matches!(
948 response.status,
949 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
950 )
951 {
952 configuration.qcs_config.refresh().await?;
953 refreshed_credentials = true;
954 continue;
955 } else if let Some(duration) = response.retry_delay {
956 tokio::time::sleep(duration).await;
957 continue;
958 }
959
960 return Err(Error::ResponseError(response));
961 }
962 Err(Error::Reqwest(error)) => {
963 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
964 tokio::time::sleep(duration).await;
965 continue;
966 }
967
968 return Err(Error::Reqwest(error));
969 }
970 Err(Error::Io(error)) => {
971 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
972 tokio::time::sleep(duration).await;
973 continue;
974 }
975
976 return Err(Error::Io(error));
977 }
978 Err(error) => return Err(error),
979 }
980 }
981}
982async fn add_group_user_inner(
983 configuration: &configuration::Configuration,
984 backoff: &mut ExponentialBackoff,
985 add_group_user_request: crate::models::AddGroupUserRequest,
986) -> Result<(), Error<AddGroupUserError>> {
987 let local_var_configuration = configuration;
988
989 let local_var_client = &local_var_configuration.client;
990
991 let local_var_uri_str = format!(
992 "{}/v1/groups:addUser",
993 local_var_configuration.qcs_config.api_url()
994 );
995 let mut local_var_req_builder =
996 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
997
998 #[cfg(feature = "tracing")]
999 {
1000 let local_var_do_tracing = local_var_uri_str
1003 .parse::<::url::Url>()
1004 .ok()
1005 .is_none_or(|url| {
1006 configuration
1007 .qcs_config
1008 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
1009 });
1010
1011 if local_var_do_tracing {
1012 ::tracing::debug!(
1013 url=%local_var_uri_str,
1014 method="POST",
1015 "making add_group_user request",
1016 );
1017 }
1018 }
1019
1020 {
1023 use qcs_api_client_common::configuration::TokenError;
1024
1025 #[allow(
1026 clippy::nonminimal_bool,
1027 clippy::eq_op,
1028 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
1029 )]
1030 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
1031
1032 let token = local_var_configuration
1033 .qcs_config
1034 .get_bearer_access_token()
1035 .await;
1036
1037 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
1038 #[cfg(feature = "tracing")]
1040 tracing::debug!(
1041 "No client credentials found, but this call does not require authentication."
1042 );
1043 } else {
1044 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
1045 }
1046 }
1047
1048 local_var_req_builder = local_var_req_builder.json(&add_group_user_request);
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
1055 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1056 Ok(())
1057 } else {
1058 let local_var_retry_delay =
1059 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
1060 let local_var_content = local_var_resp.text().await?;
1061 let local_var_entity: Option<AddGroupUserError> =
1062 serde_json::from_str(&local_var_content).ok();
1063 let local_var_error = ResponseContent {
1064 status: local_var_status,
1065 content: local_var_content,
1066 entity: local_var_entity,
1067 retry_delay: local_var_retry_delay,
1068 };
1069 Err(Error::ResponseError(local_var_error))
1070 }
1071}
1072
1073pub async fn add_group_user(
1075 configuration: &configuration::Configuration,
1076 add_group_user_request: crate::models::AddGroupUserRequest,
1077) -> Result<(), Error<AddGroupUserError>> {
1078 let mut backoff = configuration.backoff.clone();
1079 let mut refreshed_credentials = false;
1080 let method = reqwest::Method::POST;
1081 loop {
1082 let result =
1083 add_group_user_inner(configuration, &mut backoff, add_group_user_request.clone()).await;
1084
1085 match result {
1086 Ok(result) => return Ok(result),
1087 Err(Error::ResponseError(response)) => {
1088 if !refreshed_credentials
1089 && matches!(
1090 response.status,
1091 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
1092 )
1093 {
1094 configuration.qcs_config.refresh().await?;
1095 refreshed_credentials = true;
1096 continue;
1097 } else if let Some(duration) = response.retry_delay {
1098 tokio::time::sleep(duration).await;
1099 continue;
1100 }
1101
1102 return Err(Error::ResponseError(response));
1103 }
1104 Err(Error::Reqwest(error)) => {
1105 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
1106 tokio::time::sleep(duration).await;
1107 continue;
1108 }
1109
1110 return Err(Error::Reqwest(error));
1111 }
1112 Err(Error::Io(error)) => {
1113 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
1114 tokio::time::sleep(duration).await;
1115 continue;
1116 }
1117
1118 return Err(Error::Io(error));
1119 }
1120 Err(error) => return Err(error),
1121 }
1122 }
1123}
1124async fn dismiss_viewer_announcement_inner(
1125 configuration: &configuration::Configuration,
1126 backoff: &mut ExponentialBackoff,
1127 announcement_id: i64,
1128) -> Result<(), Error<DismissViewerAnnouncementError>> {
1129 let local_var_configuration = configuration;
1130
1131 let local_var_client = &local_var_configuration.client;
1132
1133 let local_var_uri_str = format!(
1134 "{}/v1/viewer/announcements/{announcementId}",
1135 local_var_configuration.qcs_config.api_url(),
1136 announcementId = announcement_id
1137 );
1138 let mut local_var_req_builder =
1139 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1140
1141 #[cfg(feature = "tracing")]
1142 {
1143 let local_var_do_tracing = local_var_uri_str
1146 .parse::<::url::Url>()
1147 .ok()
1148 .is_none_or(|url| {
1149 configuration
1150 .qcs_config
1151 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
1152 });
1153
1154 if local_var_do_tracing {
1155 ::tracing::debug!(
1156 url=%local_var_uri_str,
1157 method="DELETE",
1158 "making dismiss_viewer_announcement request",
1159 );
1160 }
1161 }
1162
1163 {
1166 use qcs_api_client_common::configuration::TokenError;
1167
1168 #[allow(
1169 clippy::nonminimal_bool,
1170 clippy::eq_op,
1171 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
1172 )]
1173 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
1174
1175 let token = local_var_configuration
1176 .qcs_config
1177 .get_bearer_access_token()
1178 .await;
1179
1180 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
1181 #[cfg(feature = "tracing")]
1183 tracing::debug!(
1184 "No client credentials found, but this call does not require authentication."
1185 );
1186 } else {
1187 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
1188 }
1189 }
1190
1191 let local_var_req = local_var_req_builder.build()?;
1192 let local_var_resp = local_var_client.execute(local_var_req).await?;
1193
1194 let local_var_status = local_var_resp.status();
1195
1196 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1197 Ok(())
1198 } else {
1199 let local_var_retry_delay =
1200 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
1201 let local_var_content = local_var_resp.text().await?;
1202 let local_var_entity: Option<DismissViewerAnnouncementError> =
1203 serde_json::from_str(&local_var_content).ok();
1204 let local_var_error = ResponseContent {
1205 status: local_var_status,
1206 content: local_var_content,
1207 entity: local_var_entity,
1208 retry_delay: local_var_retry_delay,
1209 };
1210 Err(Error::ResponseError(local_var_error))
1211 }
1212}
1213
1214pub async fn dismiss_viewer_announcement(
1216 configuration: &configuration::Configuration,
1217 announcement_id: i64,
1218) -> Result<(), Error<DismissViewerAnnouncementError>> {
1219 let mut backoff = configuration.backoff.clone();
1220 let mut refreshed_credentials = false;
1221 let method = reqwest::Method::DELETE;
1222 loop {
1223 let result =
1224 dismiss_viewer_announcement_inner(configuration, &mut backoff, announcement_id.clone())
1225 .await;
1226
1227 match result {
1228 Ok(result) => return Ok(result),
1229 Err(Error::ResponseError(response)) => {
1230 if !refreshed_credentials
1231 && matches!(
1232 response.status,
1233 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
1234 )
1235 {
1236 configuration.qcs_config.refresh().await?;
1237 refreshed_credentials = true;
1238 continue;
1239 } else if let Some(duration) = response.retry_delay {
1240 tokio::time::sleep(duration).await;
1241 continue;
1242 }
1243
1244 return Err(Error::ResponseError(response));
1245 }
1246 Err(Error::Reqwest(error)) => {
1247 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
1248 tokio::time::sleep(duration).await;
1249 continue;
1250 }
1251
1252 return Err(Error::Reqwest(error));
1253 }
1254 Err(Error::Io(error)) => {
1255 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
1256 tokio::time::sleep(duration).await;
1257 continue;
1258 }
1259
1260 return Err(Error::Io(error));
1261 }
1262 Err(error) => return Err(error),
1263 }
1264 }
1265}
1266async fn get_group_balance_inner(
1267 configuration: &configuration::Configuration,
1268 backoff: &mut ExponentialBackoff,
1269 group_name: &str,
1270) -> Result<crate::models::AccountBalance, Error<GetGroupBalanceError>> {
1271 let local_var_configuration = configuration;
1272
1273 let local_var_client = &local_var_configuration.client;
1274
1275 let local_var_uri_str = format!(
1276 "{}/v1/groups/{groupName}/balance",
1277 local_var_configuration.qcs_config.api_url(),
1278 groupName = crate::apis::urlencode(group_name)
1279 );
1280 let mut local_var_req_builder =
1281 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1282
1283 #[cfg(feature = "tracing")]
1284 {
1285 let local_var_do_tracing = local_var_uri_str
1288 .parse::<::url::Url>()
1289 .ok()
1290 .is_none_or(|url| {
1291 configuration
1292 .qcs_config
1293 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
1294 });
1295
1296 if local_var_do_tracing {
1297 ::tracing::debug!(
1298 url=%local_var_uri_str,
1299 method="GET",
1300 "making get_group_balance request",
1301 );
1302 }
1303 }
1304
1305 {
1308 use qcs_api_client_common::configuration::TokenError;
1309
1310 #[allow(
1311 clippy::nonminimal_bool,
1312 clippy::eq_op,
1313 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
1314 )]
1315 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
1316
1317 let token = local_var_configuration
1318 .qcs_config
1319 .get_bearer_access_token()
1320 .await;
1321
1322 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
1323 #[cfg(feature = "tracing")]
1325 tracing::debug!(
1326 "No client credentials found, but this call does not require authentication."
1327 );
1328 } else {
1329 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
1330 }
1331 }
1332
1333 let local_var_req = local_var_req_builder.build()?;
1334 let local_var_resp = local_var_client.execute(local_var_req).await?;
1335
1336 let local_var_status = local_var_resp.status();
1337
1338 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1339 let local_var_content = local_var_resp.text().await?;
1340 serde_json::from_str(&local_var_content).map_err(Error::from)
1341 } else {
1342 let local_var_retry_delay =
1343 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
1344 let local_var_content = local_var_resp.text().await?;
1345 let local_var_entity: Option<GetGroupBalanceError> =
1346 serde_json::from_str(&local_var_content).ok();
1347 let local_var_error = ResponseContent {
1348 status: local_var_status,
1349 content: local_var_content,
1350 entity: local_var_entity,
1351 retry_delay: local_var_retry_delay,
1352 };
1353 Err(Error::ResponseError(local_var_error))
1354 }
1355}
1356
1357pub async fn get_group_balance(
1359 configuration: &configuration::Configuration,
1360 group_name: &str,
1361) -> Result<crate::models::AccountBalance, Error<GetGroupBalanceError>> {
1362 let mut backoff = configuration.backoff.clone();
1363 let mut refreshed_credentials = false;
1364 let method = reqwest::Method::GET;
1365 loop {
1366 let result = get_group_balance_inner(configuration, &mut backoff, group_name.clone()).await;
1367
1368 match result {
1369 Ok(result) => return Ok(result),
1370 Err(Error::ResponseError(response)) => {
1371 if !refreshed_credentials
1372 && matches!(
1373 response.status,
1374 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
1375 )
1376 {
1377 configuration.qcs_config.refresh().await?;
1378 refreshed_credentials = true;
1379 continue;
1380 } else if let Some(duration) = response.retry_delay {
1381 tokio::time::sleep(duration).await;
1382 continue;
1383 }
1384
1385 return Err(Error::ResponseError(response));
1386 }
1387 Err(Error::Reqwest(error)) => {
1388 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
1389 tokio::time::sleep(duration).await;
1390 continue;
1391 }
1392
1393 return Err(Error::Reqwest(error));
1394 }
1395 Err(Error::Io(error)) => {
1396 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
1397 tokio::time::sleep(duration).await;
1398 continue;
1399 }
1400
1401 return Err(Error::Io(error));
1402 }
1403 Err(error) => return Err(error),
1404 }
1405 }
1406}
1407async fn get_group_billing_customer_inner(
1408 configuration: &configuration::Configuration,
1409 backoff: &mut ExponentialBackoff,
1410 group_name: &str,
1411) -> Result<crate::models::BillingCustomer, Error<GetGroupBillingCustomerError>> {
1412 let local_var_configuration = configuration;
1413
1414 let local_var_client = &local_var_configuration.client;
1415
1416 let local_var_uri_str = format!(
1417 "{}/v1/groups/{groupName}/billingCustomer",
1418 local_var_configuration.qcs_config.api_url(),
1419 groupName = crate::apis::urlencode(group_name)
1420 );
1421 let mut local_var_req_builder =
1422 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1423
1424 #[cfg(feature = "tracing")]
1425 {
1426 let local_var_do_tracing = local_var_uri_str
1429 .parse::<::url::Url>()
1430 .ok()
1431 .is_none_or(|url| {
1432 configuration
1433 .qcs_config
1434 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
1435 });
1436
1437 if local_var_do_tracing {
1438 ::tracing::debug!(
1439 url=%local_var_uri_str,
1440 method="GET",
1441 "making get_group_billing_customer request",
1442 );
1443 }
1444 }
1445
1446 {
1449 use qcs_api_client_common::configuration::TokenError;
1450
1451 #[allow(
1452 clippy::nonminimal_bool,
1453 clippy::eq_op,
1454 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
1455 )]
1456 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
1457
1458 let token = local_var_configuration
1459 .qcs_config
1460 .get_bearer_access_token()
1461 .await;
1462
1463 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
1464 #[cfg(feature = "tracing")]
1466 tracing::debug!(
1467 "No client credentials found, but this call does not require authentication."
1468 );
1469 } else {
1470 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
1471 }
1472 }
1473
1474 let local_var_req = local_var_req_builder.build()?;
1475 let local_var_resp = local_var_client.execute(local_var_req).await?;
1476
1477 let local_var_status = local_var_resp.status();
1478
1479 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1480 let local_var_content = local_var_resp.text().await?;
1481 serde_json::from_str(&local_var_content).map_err(Error::from)
1482 } else {
1483 let local_var_retry_delay =
1484 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
1485 let local_var_content = local_var_resp.text().await?;
1486 let local_var_entity: Option<GetGroupBillingCustomerError> =
1487 serde_json::from_str(&local_var_content).ok();
1488 let local_var_error = ResponseContent {
1489 status: local_var_status,
1490 content: local_var_content,
1491 entity: local_var_entity,
1492 retry_delay: local_var_retry_delay,
1493 };
1494 Err(Error::ResponseError(local_var_error))
1495 }
1496}
1497
1498pub async fn get_group_billing_customer(
1500 configuration: &configuration::Configuration,
1501 group_name: &str,
1502) -> Result<crate::models::BillingCustomer, Error<GetGroupBillingCustomerError>> {
1503 let mut backoff = configuration.backoff.clone();
1504 let mut refreshed_credentials = false;
1505 let method = reqwest::Method::GET;
1506 loop {
1507 let result =
1508 get_group_billing_customer_inner(configuration, &mut backoff, group_name.clone()).await;
1509
1510 match result {
1511 Ok(result) => return Ok(result),
1512 Err(Error::ResponseError(response)) => {
1513 if !refreshed_credentials
1514 && matches!(
1515 response.status,
1516 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
1517 )
1518 {
1519 configuration.qcs_config.refresh().await?;
1520 refreshed_credentials = true;
1521 continue;
1522 } else if let Some(duration) = response.retry_delay {
1523 tokio::time::sleep(duration).await;
1524 continue;
1525 }
1526
1527 return Err(Error::ResponseError(response));
1528 }
1529 Err(Error::Reqwest(error)) => {
1530 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
1531 tokio::time::sleep(duration).await;
1532 continue;
1533 }
1534
1535 return Err(Error::Reqwest(error));
1536 }
1537 Err(Error::Io(error)) => {
1538 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
1539 tokio::time::sleep(duration).await;
1540 continue;
1541 }
1542
1543 return Err(Error::Io(error));
1544 }
1545 Err(error) => return Err(error),
1546 }
1547 }
1548}
1549async fn get_group_upcoming_billing_invoice_inner(
1550 configuration: &configuration::Configuration,
1551 backoff: &mut ExponentialBackoff,
1552 group_name: &str,
1553) -> Result<crate::models::BillingUpcomingInvoice, Error<GetGroupUpcomingBillingInvoiceError>> {
1554 let local_var_configuration = configuration;
1555
1556 let local_var_client = &local_var_configuration.client;
1557
1558 let local_var_uri_str = format!(
1559 "{}/v1/groups/{groupName}/billingInvoices:getUpcoming",
1560 local_var_configuration.qcs_config.api_url(),
1561 groupName = crate::apis::urlencode(group_name)
1562 );
1563 let mut local_var_req_builder =
1564 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1565
1566 #[cfg(feature = "tracing")]
1567 {
1568 let local_var_do_tracing = local_var_uri_str
1571 .parse::<::url::Url>()
1572 .ok()
1573 .is_none_or(|url| {
1574 configuration
1575 .qcs_config
1576 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
1577 });
1578
1579 if local_var_do_tracing {
1580 ::tracing::debug!(
1581 url=%local_var_uri_str,
1582 method="GET",
1583 "making get_group_upcoming_billing_invoice request",
1584 );
1585 }
1586 }
1587
1588 {
1591 use qcs_api_client_common::configuration::TokenError;
1592
1593 #[allow(
1594 clippy::nonminimal_bool,
1595 clippy::eq_op,
1596 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
1597 )]
1598 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
1599
1600 let token = local_var_configuration
1601 .qcs_config
1602 .get_bearer_access_token()
1603 .await;
1604
1605 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
1606 #[cfg(feature = "tracing")]
1608 tracing::debug!(
1609 "No client credentials found, but this call does not require authentication."
1610 );
1611 } else {
1612 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
1613 }
1614 }
1615
1616 let local_var_req = local_var_req_builder.build()?;
1617 let local_var_resp = local_var_client.execute(local_var_req).await?;
1618
1619 let local_var_status = local_var_resp.status();
1620
1621 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1622 let local_var_content = local_var_resp.text().await?;
1623 serde_json::from_str(&local_var_content).map_err(Error::from)
1624 } else {
1625 let local_var_retry_delay =
1626 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
1627 let local_var_content = local_var_resp.text().await?;
1628 let local_var_entity: Option<GetGroupUpcomingBillingInvoiceError> =
1629 serde_json::from_str(&local_var_content).ok();
1630 let local_var_error = ResponseContent {
1631 status: local_var_status,
1632 content: local_var_content,
1633 entity: local_var_entity,
1634 retry_delay: local_var_retry_delay,
1635 };
1636 Err(Error::ResponseError(local_var_error))
1637 }
1638}
1639
1640pub async fn get_group_upcoming_billing_invoice(
1642 configuration: &configuration::Configuration,
1643 group_name: &str,
1644) -> Result<crate::models::BillingUpcomingInvoice, Error<GetGroupUpcomingBillingInvoiceError>> {
1645 let mut backoff = configuration.backoff.clone();
1646 let mut refreshed_credentials = false;
1647 let method = reqwest::Method::GET;
1648 loop {
1649 let result = get_group_upcoming_billing_invoice_inner(
1650 configuration,
1651 &mut backoff,
1652 group_name.clone(),
1653 )
1654 .await;
1655
1656 match result {
1657 Ok(result) => return Ok(result),
1658 Err(Error::ResponseError(response)) => {
1659 if !refreshed_credentials
1660 && matches!(
1661 response.status,
1662 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
1663 )
1664 {
1665 configuration.qcs_config.refresh().await?;
1666 refreshed_credentials = true;
1667 continue;
1668 } else if let Some(duration) = response.retry_delay {
1669 tokio::time::sleep(duration).await;
1670 continue;
1671 }
1672
1673 return Err(Error::ResponseError(response));
1674 }
1675 Err(Error::Reqwest(error)) => {
1676 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
1677 tokio::time::sleep(duration).await;
1678 continue;
1679 }
1680
1681 return Err(Error::Reqwest(error));
1682 }
1683 Err(Error::Io(error)) => {
1684 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
1685 tokio::time::sleep(duration).await;
1686 continue;
1687 }
1688
1689 return Err(Error::Io(error));
1690 }
1691 Err(error) => return Err(error),
1692 }
1693 }
1694}
1695async fn get_user_balance_inner(
1696 configuration: &configuration::Configuration,
1697 backoff: &mut ExponentialBackoff,
1698 user_id: &str,
1699) -> Result<crate::models::AccountBalance, Error<GetUserBalanceError>> {
1700 let local_var_configuration = configuration;
1701
1702 let local_var_client = &local_var_configuration.client;
1703
1704 let local_var_uri_str = format!(
1705 "{}/v1/users/{userId}/balance",
1706 local_var_configuration.qcs_config.api_url(),
1707 userId = crate::apis::urlencode(user_id)
1708 );
1709 let mut local_var_req_builder =
1710 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1711
1712 #[cfg(feature = "tracing")]
1713 {
1714 let local_var_do_tracing = local_var_uri_str
1717 .parse::<::url::Url>()
1718 .ok()
1719 .is_none_or(|url| {
1720 configuration
1721 .qcs_config
1722 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
1723 });
1724
1725 if local_var_do_tracing {
1726 ::tracing::debug!(
1727 url=%local_var_uri_str,
1728 method="GET",
1729 "making get_user_balance request",
1730 );
1731 }
1732 }
1733
1734 {
1737 use qcs_api_client_common::configuration::TokenError;
1738
1739 #[allow(
1740 clippy::nonminimal_bool,
1741 clippy::eq_op,
1742 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
1743 )]
1744 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
1745
1746 let token = local_var_configuration
1747 .qcs_config
1748 .get_bearer_access_token()
1749 .await;
1750
1751 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
1752 #[cfg(feature = "tracing")]
1754 tracing::debug!(
1755 "No client credentials found, but this call does not require authentication."
1756 );
1757 } else {
1758 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
1759 }
1760 }
1761
1762 let local_var_req = local_var_req_builder.build()?;
1763 let local_var_resp = local_var_client.execute(local_var_req).await?;
1764
1765 let local_var_status = local_var_resp.status();
1766
1767 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1768 let local_var_content = local_var_resp.text().await?;
1769 serde_json::from_str(&local_var_content).map_err(Error::from)
1770 } else {
1771 let local_var_retry_delay =
1772 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
1773 let local_var_content = local_var_resp.text().await?;
1774 let local_var_entity: Option<GetUserBalanceError> =
1775 serde_json::from_str(&local_var_content).ok();
1776 let local_var_error = ResponseContent {
1777 status: local_var_status,
1778 content: local_var_content,
1779 entity: local_var_entity,
1780 retry_delay: local_var_retry_delay,
1781 };
1782 Err(Error::ResponseError(local_var_error))
1783 }
1784}
1785
1786pub async fn get_user_balance(
1788 configuration: &configuration::Configuration,
1789 user_id: &str,
1790) -> Result<crate::models::AccountBalance, Error<GetUserBalanceError>> {
1791 let mut backoff = configuration.backoff.clone();
1792 let mut refreshed_credentials = false;
1793 let method = reqwest::Method::GET;
1794 loop {
1795 let result = get_user_balance_inner(configuration, &mut backoff, user_id.clone()).await;
1796
1797 match result {
1798 Ok(result) => return Ok(result),
1799 Err(Error::ResponseError(response)) => {
1800 if !refreshed_credentials
1801 && matches!(
1802 response.status,
1803 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
1804 )
1805 {
1806 configuration.qcs_config.refresh().await?;
1807 refreshed_credentials = true;
1808 continue;
1809 } else if let Some(duration) = response.retry_delay {
1810 tokio::time::sleep(duration).await;
1811 continue;
1812 }
1813
1814 return Err(Error::ResponseError(response));
1815 }
1816 Err(Error::Reqwest(error)) => {
1817 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
1818 tokio::time::sleep(duration).await;
1819 continue;
1820 }
1821
1822 return Err(Error::Reqwest(error));
1823 }
1824 Err(Error::Io(error)) => {
1825 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
1826 tokio::time::sleep(duration).await;
1827 continue;
1828 }
1829
1830 return Err(Error::Io(error));
1831 }
1832 Err(error) => return Err(error),
1833 }
1834 }
1835}
1836async fn get_user_billing_customer_inner(
1837 configuration: &configuration::Configuration,
1838 backoff: &mut ExponentialBackoff,
1839 user_id: &str,
1840) -> Result<crate::models::BillingCustomer, Error<GetUserBillingCustomerError>> {
1841 let local_var_configuration = configuration;
1842
1843 let local_var_client = &local_var_configuration.client;
1844
1845 let local_var_uri_str = format!(
1846 "{}/v1/users/{userId}/billingCustomer",
1847 local_var_configuration.qcs_config.api_url(),
1848 userId = crate::apis::urlencode(user_id)
1849 );
1850 let mut local_var_req_builder =
1851 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1852
1853 #[cfg(feature = "tracing")]
1854 {
1855 let local_var_do_tracing = local_var_uri_str
1858 .parse::<::url::Url>()
1859 .ok()
1860 .is_none_or(|url| {
1861 configuration
1862 .qcs_config
1863 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
1864 });
1865
1866 if local_var_do_tracing {
1867 ::tracing::debug!(
1868 url=%local_var_uri_str,
1869 method="GET",
1870 "making get_user_billing_customer request",
1871 );
1872 }
1873 }
1874
1875 {
1878 use qcs_api_client_common::configuration::TokenError;
1879
1880 #[allow(
1881 clippy::nonminimal_bool,
1882 clippy::eq_op,
1883 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
1884 )]
1885 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
1886
1887 let token = local_var_configuration
1888 .qcs_config
1889 .get_bearer_access_token()
1890 .await;
1891
1892 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
1893 #[cfg(feature = "tracing")]
1895 tracing::debug!(
1896 "No client credentials found, but this call does not require authentication."
1897 );
1898 } else {
1899 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
1900 }
1901 }
1902
1903 let local_var_req = local_var_req_builder.build()?;
1904 let local_var_resp = local_var_client.execute(local_var_req).await?;
1905
1906 let local_var_status = local_var_resp.status();
1907
1908 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1909 let local_var_content = local_var_resp.text().await?;
1910 serde_json::from_str(&local_var_content).map_err(Error::from)
1911 } else {
1912 let local_var_retry_delay =
1913 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
1914 let local_var_content = local_var_resp.text().await?;
1915 let local_var_entity: Option<GetUserBillingCustomerError> =
1916 serde_json::from_str(&local_var_content).ok();
1917 let local_var_error = ResponseContent {
1918 status: local_var_status,
1919 content: local_var_content,
1920 entity: local_var_entity,
1921 retry_delay: local_var_retry_delay,
1922 };
1923 Err(Error::ResponseError(local_var_error))
1924 }
1925}
1926
1927pub async fn get_user_billing_customer(
1929 configuration: &configuration::Configuration,
1930 user_id: &str,
1931) -> Result<crate::models::BillingCustomer, Error<GetUserBillingCustomerError>> {
1932 let mut backoff = configuration.backoff.clone();
1933 let mut refreshed_credentials = false;
1934 let method = reqwest::Method::GET;
1935 loop {
1936 let result =
1937 get_user_billing_customer_inner(configuration, &mut backoff, user_id.clone()).await;
1938
1939 match result {
1940 Ok(result) => return Ok(result),
1941 Err(Error::ResponseError(response)) => {
1942 if !refreshed_credentials
1943 && matches!(
1944 response.status,
1945 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
1946 )
1947 {
1948 configuration.qcs_config.refresh().await?;
1949 refreshed_credentials = true;
1950 continue;
1951 } else if let Some(duration) = response.retry_delay {
1952 tokio::time::sleep(duration).await;
1953 continue;
1954 }
1955
1956 return Err(Error::ResponseError(response));
1957 }
1958 Err(Error::Reqwest(error)) => {
1959 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
1960 tokio::time::sleep(duration).await;
1961 continue;
1962 }
1963
1964 return Err(Error::Reqwest(error));
1965 }
1966 Err(Error::Io(error)) => {
1967 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
1968 tokio::time::sleep(duration).await;
1969 continue;
1970 }
1971
1972 return Err(Error::Io(error));
1973 }
1974 Err(error) => return Err(error),
1975 }
1976 }
1977}
1978async fn get_user_event_billing_price_inner(
1979 configuration: &configuration::Configuration,
1980 backoff: &mut ExponentialBackoff,
1981 user_id: &str,
1982 get_account_event_billing_price_request: crate::models::GetAccountEventBillingPriceRequest,
1983) -> Result<crate::models::EventBillingPriceRate, Error<GetUserEventBillingPriceError>> {
1984 let local_var_configuration = configuration;
1985
1986 let local_var_client = &local_var_configuration.client;
1987
1988 let local_var_uri_str = format!(
1989 "{}/v1/users/{userId}/eventBillingPrices:get",
1990 local_var_configuration.qcs_config.api_url(),
1991 userId = crate::apis::urlencode(user_id)
1992 );
1993 let mut local_var_req_builder =
1994 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1995
1996 #[cfg(feature = "tracing")]
1997 {
1998 let local_var_do_tracing = local_var_uri_str
2001 .parse::<::url::Url>()
2002 .ok()
2003 .is_none_or(|url| {
2004 configuration
2005 .qcs_config
2006 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
2007 });
2008
2009 if local_var_do_tracing {
2010 ::tracing::debug!(
2011 url=%local_var_uri_str,
2012 method="POST",
2013 "making get_user_event_billing_price request",
2014 );
2015 }
2016 }
2017
2018 {
2021 use qcs_api_client_common::configuration::TokenError;
2022
2023 #[allow(
2024 clippy::nonminimal_bool,
2025 clippy::eq_op,
2026 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
2027 )]
2028 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
2029
2030 let token = local_var_configuration
2031 .qcs_config
2032 .get_bearer_access_token()
2033 .await;
2034
2035 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
2036 #[cfg(feature = "tracing")]
2038 tracing::debug!(
2039 "No client credentials found, but this call does not require authentication."
2040 );
2041 } else {
2042 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
2043 }
2044 }
2045
2046 local_var_req_builder = local_var_req_builder.json(&get_account_event_billing_price_request);
2047
2048 let local_var_req = local_var_req_builder.build()?;
2049 let local_var_resp = local_var_client.execute(local_var_req).await?;
2050
2051 let local_var_status = local_var_resp.status();
2052
2053 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2054 let local_var_content = local_var_resp.text().await?;
2055 serde_json::from_str(&local_var_content).map_err(Error::from)
2056 } else {
2057 let local_var_retry_delay =
2058 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
2059 let local_var_content = local_var_resp.text().await?;
2060 let local_var_entity: Option<GetUserEventBillingPriceError> =
2061 serde_json::from_str(&local_var_content).ok();
2062 let local_var_error = ResponseContent {
2063 status: local_var_status,
2064 content: local_var_content,
2065 entity: local_var_entity,
2066 retry_delay: local_var_retry_delay,
2067 };
2068 Err(Error::ResponseError(local_var_error))
2069 }
2070}
2071
2072pub async fn get_user_event_billing_price(
2074 configuration: &configuration::Configuration,
2075 user_id: &str,
2076 get_account_event_billing_price_request: crate::models::GetAccountEventBillingPriceRequest,
2077) -> Result<crate::models::EventBillingPriceRate, Error<GetUserEventBillingPriceError>> {
2078 let mut backoff = configuration.backoff.clone();
2079 let mut refreshed_credentials = false;
2080 let method = reqwest::Method::POST;
2081 loop {
2082 let result = get_user_event_billing_price_inner(
2083 configuration,
2084 &mut backoff,
2085 user_id.clone(),
2086 get_account_event_billing_price_request.clone(),
2087 )
2088 .await;
2089
2090 match result {
2091 Ok(result) => return Ok(result),
2092 Err(Error::ResponseError(response)) => {
2093 if !refreshed_credentials
2094 && matches!(
2095 response.status,
2096 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
2097 )
2098 {
2099 configuration.qcs_config.refresh().await?;
2100 refreshed_credentials = true;
2101 continue;
2102 } else if let Some(duration) = response.retry_delay {
2103 tokio::time::sleep(duration).await;
2104 continue;
2105 }
2106
2107 return Err(Error::ResponseError(response));
2108 }
2109 Err(Error::Reqwest(error)) => {
2110 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
2111 tokio::time::sleep(duration).await;
2112 continue;
2113 }
2114
2115 return Err(Error::Reqwest(error));
2116 }
2117 Err(Error::Io(error)) => {
2118 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
2119 tokio::time::sleep(duration).await;
2120 continue;
2121 }
2122
2123 return Err(Error::Io(error));
2124 }
2125 Err(error) => return Err(error),
2126 }
2127 }
2128}
2129async fn get_user_upcoming_billing_invoice_inner(
2130 configuration: &configuration::Configuration,
2131 backoff: &mut ExponentialBackoff,
2132 user_id: &str,
2133) -> Result<crate::models::BillingUpcomingInvoice, Error<GetUserUpcomingBillingInvoiceError>> {
2134 let local_var_configuration = configuration;
2135
2136 let local_var_client = &local_var_configuration.client;
2137
2138 let local_var_uri_str = format!(
2139 "{}/v1/users/{userId}/billingInvoices:getUpcoming",
2140 local_var_configuration.qcs_config.api_url(),
2141 userId = crate::apis::urlencode(user_id)
2142 );
2143 let mut local_var_req_builder =
2144 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2145
2146 #[cfg(feature = "tracing")]
2147 {
2148 let local_var_do_tracing = local_var_uri_str
2151 .parse::<::url::Url>()
2152 .ok()
2153 .is_none_or(|url| {
2154 configuration
2155 .qcs_config
2156 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
2157 });
2158
2159 if local_var_do_tracing {
2160 ::tracing::debug!(
2161 url=%local_var_uri_str,
2162 method="GET",
2163 "making get_user_upcoming_billing_invoice request",
2164 );
2165 }
2166 }
2167
2168 {
2171 use qcs_api_client_common::configuration::TokenError;
2172
2173 #[allow(
2174 clippy::nonminimal_bool,
2175 clippy::eq_op,
2176 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
2177 )]
2178 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
2179
2180 let token = local_var_configuration
2181 .qcs_config
2182 .get_bearer_access_token()
2183 .await;
2184
2185 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
2186 #[cfg(feature = "tracing")]
2188 tracing::debug!(
2189 "No client credentials found, but this call does not require authentication."
2190 );
2191 } else {
2192 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
2193 }
2194 }
2195
2196 let local_var_req = local_var_req_builder.build()?;
2197 let local_var_resp = local_var_client.execute(local_var_req).await?;
2198
2199 let local_var_status = local_var_resp.status();
2200
2201 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2202 let local_var_content = local_var_resp.text().await?;
2203 serde_json::from_str(&local_var_content).map_err(Error::from)
2204 } else {
2205 let local_var_retry_delay =
2206 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
2207 let local_var_content = local_var_resp.text().await?;
2208 let local_var_entity: Option<GetUserUpcomingBillingInvoiceError> =
2209 serde_json::from_str(&local_var_content).ok();
2210 let local_var_error = ResponseContent {
2211 status: local_var_status,
2212 content: local_var_content,
2213 entity: local_var_entity,
2214 retry_delay: local_var_retry_delay,
2215 };
2216 Err(Error::ResponseError(local_var_error))
2217 }
2218}
2219
2220pub async fn get_user_upcoming_billing_invoice(
2222 configuration: &configuration::Configuration,
2223 user_id: &str,
2224) -> Result<crate::models::BillingUpcomingInvoice, Error<GetUserUpcomingBillingInvoiceError>> {
2225 let mut backoff = configuration.backoff.clone();
2226 let mut refreshed_credentials = false;
2227 let method = reqwest::Method::GET;
2228 loop {
2229 let result =
2230 get_user_upcoming_billing_invoice_inner(configuration, &mut backoff, user_id.clone())
2231 .await;
2232
2233 match result {
2234 Ok(result) => return Ok(result),
2235 Err(Error::ResponseError(response)) => {
2236 if !refreshed_credentials
2237 && matches!(
2238 response.status,
2239 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
2240 )
2241 {
2242 configuration.qcs_config.refresh().await?;
2243 refreshed_credentials = true;
2244 continue;
2245 } else if let Some(duration) = response.retry_delay {
2246 tokio::time::sleep(duration).await;
2247 continue;
2248 }
2249
2250 return Err(Error::ResponseError(response));
2251 }
2252 Err(Error::Reqwest(error)) => {
2253 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
2254 tokio::time::sleep(duration).await;
2255 continue;
2256 }
2257
2258 return Err(Error::Reqwest(error));
2259 }
2260 Err(Error::Io(error)) => {
2261 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
2262 tokio::time::sleep(duration).await;
2263 continue;
2264 }
2265
2266 return Err(Error::Io(error));
2267 }
2268 Err(error) => return Err(error),
2269 }
2270 }
2271}
2272async fn get_viewer_user_onboarding_completed_inner(
2273 configuration: &configuration::Configuration,
2274 backoff: &mut ExponentialBackoff,
2275) -> Result<
2276 crate::models::ViewerUserOnboardingCompleted,
2277 Error<GetViewerUserOnboardingCompletedError>,
2278> {
2279 let local_var_configuration = configuration;
2280
2281 let local_var_client = &local_var_configuration.client;
2282
2283 let local_var_uri_str = format!(
2284 "{}/v1/viewer/onboardingCompleted",
2285 local_var_configuration.qcs_config.api_url()
2286 );
2287 let mut local_var_req_builder =
2288 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2289
2290 #[cfg(feature = "tracing")]
2291 {
2292 let local_var_do_tracing = local_var_uri_str
2295 .parse::<::url::Url>()
2296 .ok()
2297 .is_none_or(|url| {
2298 configuration
2299 .qcs_config
2300 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
2301 });
2302
2303 if local_var_do_tracing {
2304 ::tracing::debug!(
2305 url=%local_var_uri_str,
2306 method="GET",
2307 "making get_viewer_user_onboarding_completed request",
2308 );
2309 }
2310 }
2311
2312 {
2315 use qcs_api_client_common::configuration::TokenError;
2316
2317 #[allow(
2318 clippy::nonminimal_bool,
2319 clippy::eq_op,
2320 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
2321 )]
2322 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
2323
2324 let token = local_var_configuration
2325 .qcs_config
2326 .get_bearer_access_token()
2327 .await;
2328
2329 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
2330 #[cfg(feature = "tracing")]
2332 tracing::debug!(
2333 "No client credentials found, but this call does not require authentication."
2334 );
2335 } else {
2336 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
2337 }
2338 }
2339
2340 let local_var_req = local_var_req_builder.build()?;
2341 let local_var_resp = local_var_client.execute(local_var_req).await?;
2342
2343 let local_var_status = local_var_resp.status();
2344
2345 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2346 let local_var_content = local_var_resp.text().await?;
2347 serde_json::from_str(&local_var_content).map_err(Error::from)
2348 } else {
2349 let local_var_retry_delay =
2350 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
2351 let local_var_content = local_var_resp.text().await?;
2352 let local_var_entity: Option<GetViewerUserOnboardingCompletedError> =
2353 serde_json::from_str(&local_var_content).ok();
2354 let local_var_error = ResponseContent {
2355 status: local_var_status,
2356 content: local_var_content,
2357 entity: local_var_entity,
2358 retry_delay: local_var_retry_delay,
2359 };
2360 Err(Error::ResponseError(local_var_error))
2361 }
2362}
2363
2364pub async fn get_viewer_user_onboarding_completed(
2366 configuration: &configuration::Configuration,
2367) -> Result<
2368 crate::models::ViewerUserOnboardingCompleted,
2369 Error<GetViewerUserOnboardingCompletedError>,
2370> {
2371 let mut backoff = configuration.backoff.clone();
2372 let mut refreshed_credentials = false;
2373 let method = reqwest::Method::GET;
2374 loop {
2375 let result = get_viewer_user_onboarding_completed_inner(configuration, &mut backoff).await;
2376
2377 match result {
2378 Ok(result) => return Ok(result),
2379 Err(Error::ResponseError(response)) => {
2380 if !refreshed_credentials
2381 && matches!(
2382 response.status,
2383 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
2384 )
2385 {
2386 configuration.qcs_config.refresh().await?;
2387 refreshed_credentials = true;
2388 continue;
2389 } else if let Some(duration) = response.retry_delay {
2390 tokio::time::sleep(duration).await;
2391 continue;
2392 }
2393
2394 return Err(Error::ResponseError(response));
2395 }
2396 Err(Error::Reqwest(error)) => {
2397 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
2398 tokio::time::sleep(duration).await;
2399 continue;
2400 }
2401
2402 return Err(Error::Reqwest(error));
2403 }
2404 Err(Error::Io(error)) => {
2405 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
2406 tokio::time::sleep(duration).await;
2407 continue;
2408 }
2409
2410 return Err(Error::Io(error));
2411 }
2412 Err(error) => return Err(error),
2413 }
2414 }
2415}
2416async fn list_group_billing_invoice_lines_inner(
2417 configuration: &configuration::Configuration,
2418 backoff: &mut ExponentialBackoff,
2419 group_name: &str,
2420 billing_invoice_id: &str,
2421 page_token: Option<&str>,
2422 page_size: Option<i64>,
2423) -> Result<
2424 crate::models::ListAccountBillingInvoiceLinesResponse,
2425 Error<ListGroupBillingInvoiceLinesError>,
2426> {
2427 let local_var_configuration = configuration;
2428
2429 let local_var_client = &local_var_configuration.client;
2430
2431 let local_var_uri_str = format!(
2432 "{}/v1/groups/{groupName}/billingInvoices/{billingInvoiceId}/lines",
2433 local_var_configuration.qcs_config.api_url(),
2434 groupName = crate::apis::urlencode(group_name),
2435 billingInvoiceId = crate::apis::urlencode(billing_invoice_id)
2436 );
2437 let mut local_var_req_builder =
2438 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2439
2440 #[cfg(feature = "tracing")]
2441 {
2442 let local_var_do_tracing = local_var_uri_str
2445 .parse::<::url::Url>()
2446 .ok()
2447 .is_none_or(|url| {
2448 configuration
2449 .qcs_config
2450 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
2451 });
2452
2453 if local_var_do_tracing {
2454 ::tracing::debug!(
2455 url=%local_var_uri_str,
2456 method="GET",
2457 "making list_group_billing_invoice_lines request",
2458 );
2459 }
2460 }
2461
2462 if let Some(ref local_var_str) = page_token {
2463 local_var_req_builder =
2464 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
2465 }
2466 if let Some(ref local_var_str) = page_size {
2467 local_var_req_builder =
2468 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
2469 }
2470
2471 {
2474 use qcs_api_client_common::configuration::TokenError;
2475
2476 #[allow(
2477 clippy::nonminimal_bool,
2478 clippy::eq_op,
2479 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
2480 )]
2481 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
2482
2483 let token = local_var_configuration
2484 .qcs_config
2485 .get_bearer_access_token()
2486 .await;
2487
2488 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
2489 #[cfg(feature = "tracing")]
2491 tracing::debug!(
2492 "No client credentials found, but this call does not require authentication."
2493 );
2494 } else {
2495 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
2496 }
2497 }
2498
2499 let local_var_req = local_var_req_builder.build()?;
2500 let local_var_resp = local_var_client.execute(local_var_req).await?;
2501
2502 let local_var_status = local_var_resp.status();
2503
2504 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2505 let local_var_content = local_var_resp.text().await?;
2506 serde_json::from_str(&local_var_content).map_err(Error::from)
2507 } else {
2508 let local_var_retry_delay =
2509 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
2510 let local_var_content = local_var_resp.text().await?;
2511 let local_var_entity: Option<ListGroupBillingInvoiceLinesError> =
2512 serde_json::from_str(&local_var_content).ok();
2513 let local_var_error = ResponseContent {
2514 status: local_var_status,
2515 content: local_var_content,
2516 entity: local_var_entity,
2517 retry_delay: local_var_retry_delay,
2518 };
2519 Err(Error::ResponseError(local_var_error))
2520 }
2521}
2522
2523pub async fn list_group_billing_invoice_lines(
2525 configuration: &configuration::Configuration,
2526 group_name: &str,
2527 billing_invoice_id: &str,
2528 page_token: Option<&str>,
2529 page_size: Option<i64>,
2530) -> Result<
2531 crate::models::ListAccountBillingInvoiceLinesResponse,
2532 Error<ListGroupBillingInvoiceLinesError>,
2533> {
2534 let mut backoff = configuration.backoff.clone();
2535 let mut refreshed_credentials = false;
2536 let method = reqwest::Method::GET;
2537 loop {
2538 let result = list_group_billing_invoice_lines_inner(
2539 configuration,
2540 &mut backoff,
2541 group_name.clone(),
2542 billing_invoice_id.clone(),
2543 page_token.clone(),
2544 page_size.clone(),
2545 )
2546 .await;
2547
2548 match result {
2549 Ok(result) => return Ok(result),
2550 Err(Error::ResponseError(response)) => {
2551 if !refreshed_credentials
2552 && matches!(
2553 response.status,
2554 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
2555 )
2556 {
2557 configuration.qcs_config.refresh().await?;
2558 refreshed_credentials = true;
2559 continue;
2560 } else if let Some(duration) = response.retry_delay {
2561 tokio::time::sleep(duration).await;
2562 continue;
2563 }
2564
2565 return Err(Error::ResponseError(response));
2566 }
2567 Err(Error::Reqwest(error)) => {
2568 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
2569 tokio::time::sleep(duration).await;
2570 continue;
2571 }
2572
2573 return Err(Error::Reqwest(error));
2574 }
2575 Err(Error::Io(error)) => {
2576 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
2577 tokio::time::sleep(duration).await;
2578 continue;
2579 }
2580
2581 return Err(Error::Io(error));
2582 }
2583 Err(error) => return Err(error),
2584 }
2585 }
2586}
2587async fn list_group_billing_invoices_inner(
2588 configuration: &configuration::Configuration,
2589 backoff: &mut ExponentialBackoff,
2590 group_name: &str,
2591 page_token: Option<&str>,
2592 page_size: Option<i64>,
2593) -> Result<crate::models::ListAccountBillingInvoicesResponse, Error<ListGroupBillingInvoicesError>>
2594{
2595 let local_var_configuration = configuration;
2596
2597 let local_var_client = &local_var_configuration.client;
2598
2599 let local_var_uri_str = format!(
2600 "{}/v1/groups/{groupName}/billingInvoices",
2601 local_var_configuration.qcs_config.api_url(),
2602 groupName = crate::apis::urlencode(group_name)
2603 );
2604 let mut local_var_req_builder =
2605 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2606
2607 #[cfg(feature = "tracing")]
2608 {
2609 let local_var_do_tracing = local_var_uri_str
2612 .parse::<::url::Url>()
2613 .ok()
2614 .is_none_or(|url| {
2615 configuration
2616 .qcs_config
2617 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
2618 });
2619
2620 if local_var_do_tracing {
2621 ::tracing::debug!(
2622 url=%local_var_uri_str,
2623 method="GET",
2624 "making list_group_billing_invoices request",
2625 );
2626 }
2627 }
2628
2629 if let Some(ref local_var_str) = page_token {
2630 local_var_req_builder =
2631 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
2632 }
2633 if let Some(ref local_var_str) = page_size {
2634 local_var_req_builder =
2635 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
2636 }
2637
2638 {
2641 use qcs_api_client_common::configuration::TokenError;
2642
2643 #[allow(
2644 clippy::nonminimal_bool,
2645 clippy::eq_op,
2646 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
2647 )]
2648 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
2649
2650 let token = local_var_configuration
2651 .qcs_config
2652 .get_bearer_access_token()
2653 .await;
2654
2655 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
2656 #[cfg(feature = "tracing")]
2658 tracing::debug!(
2659 "No client credentials found, but this call does not require authentication."
2660 );
2661 } else {
2662 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
2663 }
2664 }
2665
2666 let local_var_req = local_var_req_builder.build()?;
2667 let local_var_resp = local_var_client.execute(local_var_req).await?;
2668
2669 let local_var_status = local_var_resp.status();
2670
2671 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2672 let local_var_content = local_var_resp.text().await?;
2673 serde_json::from_str(&local_var_content).map_err(Error::from)
2674 } else {
2675 let local_var_retry_delay =
2676 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
2677 let local_var_content = local_var_resp.text().await?;
2678 let local_var_entity: Option<ListGroupBillingInvoicesError> =
2679 serde_json::from_str(&local_var_content).ok();
2680 let local_var_error = ResponseContent {
2681 status: local_var_status,
2682 content: local_var_content,
2683 entity: local_var_entity,
2684 retry_delay: local_var_retry_delay,
2685 };
2686 Err(Error::ResponseError(local_var_error))
2687 }
2688}
2689
2690pub async fn list_group_billing_invoices(
2692 configuration: &configuration::Configuration,
2693 group_name: &str,
2694 page_token: Option<&str>,
2695 page_size: Option<i64>,
2696) -> Result<crate::models::ListAccountBillingInvoicesResponse, Error<ListGroupBillingInvoicesError>>
2697{
2698 let mut backoff = configuration.backoff.clone();
2699 let mut refreshed_credentials = false;
2700 let method = reqwest::Method::GET;
2701 loop {
2702 let result = list_group_billing_invoices_inner(
2703 configuration,
2704 &mut backoff,
2705 group_name.clone(),
2706 page_token.clone(),
2707 page_size.clone(),
2708 )
2709 .await;
2710
2711 match result {
2712 Ok(result) => return Ok(result),
2713 Err(Error::ResponseError(response)) => {
2714 if !refreshed_credentials
2715 && matches!(
2716 response.status,
2717 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
2718 )
2719 {
2720 configuration.qcs_config.refresh().await?;
2721 refreshed_credentials = true;
2722 continue;
2723 } else if let Some(duration) = response.retry_delay {
2724 tokio::time::sleep(duration).await;
2725 continue;
2726 }
2727
2728 return Err(Error::ResponseError(response));
2729 }
2730 Err(Error::Reqwest(error)) => {
2731 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
2732 tokio::time::sleep(duration).await;
2733 continue;
2734 }
2735
2736 return Err(Error::Reqwest(error));
2737 }
2738 Err(Error::Io(error)) => {
2739 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
2740 tokio::time::sleep(duration).await;
2741 continue;
2742 }
2743
2744 return Err(Error::Io(error));
2745 }
2746 Err(error) => return Err(error),
2747 }
2748 }
2749}
2750async fn list_group_upcoming_billing_invoice_lines_inner(
2751 configuration: &configuration::Configuration,
2752 backoff: &mut ExponentialBackoff,
2753 group_name: &str,
2754 page_token: Option<&str>,
2755 page_size: Option<i64>,
2756) -> Result<
2757 crate::models::ListAccountBillingInvoiceLinesResponse,
2758 Error<ListGroupUpcomingBillingInvoiceLinesError>,
2759> {
2760 let local_var_configuration = configuration;
2761
2762 let local_var_client = &local_var_configuration.client;
2763
2764 let local_var_uri_str = format!(
2765 "{}/v1/groups/{groupName}/billingInvoices:listUpcomingLines",
2766 local_var_configuration.qcs_config.api_url(),
2767 groupName = crate::apis::urlencode(group_name)
2768 );
2769 let mut local_var_req_builder =
2770 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2771
2772 #[cfg(feature = "tracing")]
2773 {
2774 let local_var_do_tracing = local_var_uri_str
2777 .parse::<::url::Url>()
2778 .ok()
2779 .is_none_or(|url| {
2780 configuration
2781 .qcs_config
2782 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
2783 });
2784
2785 if local_var_do_tracing {
2786 ::tracing::debug!(
2787 url=%local_var_uri_str,
2788 method="GET",
2789 "making list_group_upcoming_billing_invoice_lines request",
2790 );
2791 }
2792 }
2793
2794 if let Some(ref local_var_str) = page_token {
2795 local_var_req_builder =
2796 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
2797 }
2798 if let Some(ref local_var_str) = page_size {
2799 local_var_req_builder =
2800 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
2801 }
2802
2803 {
2806 use qcs_api_client_common::configuration::TokenError;
2807
2808 #[allow(
2809 clippy::nonminimal_bool,
2810 clippy::eq_op,
2811 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
2812 )]
2813 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
2814
2815 let token = local_var_configuration
2816 .qcs_config
2817 .get_bearer_access_token()
2818 .await;
2819
2820 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
2821 #[cfg(feature = "tracing")]
2823 tracing::debug!(
2824 "No client credentials found, but this call does not require authentication."
2825 );
2826 } else {
2827 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
2828 }
2829 }
2830
2831 let local_var_req = local_var_req_builder.build()?;
2832 let local_var_resp = local_var_client.execute(local_var_req).await?;
2833
2834 let local_var_status = local_var_resp.status();
2835
2836 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2837 let local_var_content = local_var_resp.text().await?;
2838 serde_json::from_str(&local_var_content).map_err(Error::from)
2839 } else {
2840 let local_var_retry_delay =
2841 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
2842 let local_var_content = local_var_resp.text().await?;
2843 let local_var_entity: Option<ListGroupUpcomingBillingInvoiceLinesError> =
2844 serde_json::from_str(&local_var_content).ok();
2845 let local_var_error = ResponseContent {
2846 status: local_var_status,
2847 content: local_var_content,
2848 entity: local_var_entity,
2849 retry_delay: local_var_retry_delay,
2850 };
2851 Err(Error::ResponseError(local_var_error))
2852 }
2853}
2854
2855pub async fn list_group_upcoming_billing_invoice_lines(
2857 configuration: &configuration::Configuration,
2858 group_name: &str,
2859 page_token: Option<&str>,
2860 page_size: Option<i64>,
2861) -> Result<
2862 crate::models::ListAccountBillingInvoiceLinesResponse,
2863 Error<ListGroupUpcomingBillingInvoiceLinesError>,
2864> {
2865 let mut backoff = configuration.backoff.clone();
2866 let mut refreshed_credentials = false;
2867 let method = reqwest::Method::GET;
2868 loop {
2869 let result = list_group_upcoming_billing_invoice_lines_inner(
2870 configuration,
2871 &mut backoff,
2872 group_name.clone(),
2873 page_token.clone(),
2874 page_size.clone(),
2875 )
2876 .await;
2877
2878 match result {
2879 Ok(result) => return Ok(result),
2880 Err(Error::ResponseError(response)) => {
2881 if !refreshed_credentials
2882 && matches!(
2883 response.status,
2884 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
2885 )
2886 {
2887 configuration.qcs_config.refresh().await?;
2888 refreshed_credentials = true;
2889 continue;
2890 } else if let Some(duration) = response.retry_delay {
2891 tokio::time::sleep(duration).await;
2892 continue;
2893 }
2894
2895 return Err(Error::ResponseError(response));
2896 }
2897 Err(Error::Reqwest(error)) => {
2898 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
2899 tokio::time::sleep(duration).await;
2900 continue;
2901 }
2902
2903 return Err(Error::Reqwest(error));
2904 }
2905 Err(Error::Io(error)) => {
2906 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
2907 tokio::time::sleep(duration).await;
2908 continue;
2909 }
2910
2911 return Err(Error::Io(error));
2912 }
2913 Err(error) => return Err(error),
2914 }
2915 }
2916}
2917async fn list_group_users_inner(
2918 configuration: &configuration::Configuration,
2919 backoff: &mut ExponentialBackoff,
2920 group_name: &str,
2921 page_size: Option<i64>,
2922 page_token: Option<&str>,
2923) -> Result<crate::models::ListGroupUsersResponse, Error<ListGroupUsersError>> {
2924 let local_var_configuration = configuration;
2925
2926 let local_var_client = &local_var_configuration.client;
2927
2928 let local_var_uri_str = format!(
2929 "{}/v1/groups/{groupName}/users",
2930 local_var_configuration.qcs_config.api_url(),
2931 groupName = crate::apis::urlencode(group_name)
2932 );
2933 let mut local_var_req_builder =
2934 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2935
2936 #[cfg(feature = "tracing")]
2937 {
2938 let local_var_do_tracing = local_var_uri_str
2941 .parse::<::url::Url>()
2942 .ok()
2943 .is_none_or(|url| {
2944 configuration
2945 .qcs_config
2946 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
2947 });
2948
2949 if local_var_do_tracing {
2950 ::tracing::debug!(
2951 url=%local_var_uri_str,
2952 method="GET",
2953 "making list_group_users request",
2954 );
2955 }
2956 }
2957
2958 if let Some(ref local_var_str) = page_size {
2959 local_var_req_builder =
2960 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
2961 }
2962 if let Some(ref local_var_str) = page_token {
2963 local_var_req_builder =
2964 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
2965 }
2966
2967 {
2970 use qcs_api_client_common::configuration::TokenError;
2971
2972 #[allow(
2973 clippy::nonminimal_bool,
2974 clippy::eq_op,
2975 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
2976 )]
2977 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
2978
2979 let token = local_var_configuration
2980 .qcs_config
2981 .get_bearer_access_token()
2982 .await;
2983
2984 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
2985 #[cfg(feature = "tracing")]
2987 tracing::debug!(
2988 "No client credentials found, but this call does not require authentication."
2989 );
2990 } else {
2991 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
2992 }
2993 }
2994
2995 let local_var_req = local_var_req_builder.build()?;
2996 let local_var_resp = local_var_client.execute(local_var_req).await?;
2997
2998 let local_var_status = local_var_resp.status();
2999
3000 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3001 let local_var_content = local_var_resp.text().await?;
3002 serde_json::from_str(&local_var_content).map_err(Error::from)
3003 } else {
3004 let local_var_retry_delay =
3005 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
3006 let local_var_content = local_var_resp.text().await?;
3007 let local_var_entity: Option<ListGroupUsersError> =
3008 serde_json::from_str(&local_var_content).ok();
3009 let local_var_error = ResponseContent {
3010 status: local_var_status,
3011 content: local_var_content,
3012 entity: local_var_entity,
3013 retry_delay: local_var_retry_delay,
3014 };
3015 Err(Error::ResponseError(local_var_error))
3016 }
3017}
3018
3019pub async fn list_group_users(
3021 configuration: &configuration::Configuration,
3022 group_name: &str,
3023 page_size: Option<i64>,
3024 page_token: Option<&str>,
3025) -> Result<crate::models::ListGroupUsersResponse, Error<ListGroupUsersError>> {
3026 let mut backoff = configuration.backoff.clone();
3027 let mut refreshed_credentials = false;
3028 let method = reqwest::Method::GET;
3029 loop {
3030 let result = list_group_users_inner(
3031 configuration,
3032 &mut backoff,
3033 group_name.clone(),
3034 page_size.clone(),
3035 page_token.clone(),
3036 )
3037 .await;
3038
3039 match result {
3040 Ok(result) => return Ok(result),
3041 Err(Error::ResponseError(response)) => {
3042 if !refreshed_credentials
3043 && matches!(
3044 response.status,
3045 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
3046 )
3047 {
3048 configuration.qcs_config.refresh().await?;
3049 refreshed_credentials = true;
3050 continue;
3051 } else if let Some(duration) = response.retry_delay {
3052 tokio::time::sleep(duration).await;
3053 continue;
3054 }
3055
3056 return Err(Error::ResponseError(response));
3057 }
3058 Err(Error::Reqwest(error)) => {
3059 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
3060 tokio::time::sleep(duration).await;
3061 continue;
3062 }
3063
3064 return Err(Error::Reqwest(error));
3065 }
3066 Err(Error::Io(error)) => {
3067 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
3068 tokio::time::sleep(duration).await;
3069 continue;
3070 }
3071
3072 return Err(Error::Io(error));
3073 }
3074 Err(error) => return Err(error),
3075 }
3076 }
3077}
3078async fn list_user_billing_invoice_lines_inner(
3079 configuration: &configuration::Configuration,
3080 backoff: &mut ExponentialBackoff,
3081 user_id: &str,
3082 billing_invoice_id: &str,
3083 page_token: Option<&str>,
3084 page_size: Option<i64>,
3085) -> Result<
3086 crate::models::ListAccountBillingInvoiceLinesResponse,
3087 Error<ListUserBillingInvoiceLinesError>,
3088> {
3089 let local_var_configuration = configuration;
3090
3091 let local_var_client = &local_var_configuration.client;
3092
3093 let local_var_uri_str = format!(
3094 "{}/v1/users/{userId}/billingInvoices/{billingInvoiceId}/lines",
3095 local_var_configuration.qcs_config.api_url(),
3096 userId = crate::apis::urlencode(user_id),
3097 billingInvoiceId = crate::apis::urlencode(billing_invoice_id)
3098 );
3099 let mut local_var_req_builder =
3100 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3101
3102 #[cfg(feature = "tracing")]
3103 {
3104 let local_var_do_tracing = local_var_uri_str
3107 .parse::<::url::Url>()
3108 .ok()
3109 .is_none_or(|url| {
3110 configuration
3111 .qcs_config
3112 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
3113 });
3114
3115 if local_var_do_tracing {
3116 ::tracing::debug!(
3117 url=%local_var_uri_str,
3118 method="GET",
3119 "making list_user_billing_invoice_lines request",
3120 );
3121 }
3122 }
3123
3124 if let Some(ref local_var_str) = page_token {
3125 local_var_req_builder =
3126 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
3127 }
3128 if let Some(ref local_var_str) = page_size {
3129 local_var_req_builder =
3130 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
3131 }
3132
3133 {
3136 use qcs_api_client_common::configuration::TokenError;
3137
3138 #[allow(
3139 clippy::nonminimal_bool,
3140 clippy::eq_op,
3141 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
3142 )]
3143 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
3144
3145 let token = local_var_configuration
3146 .qcs_config
3147 .get_bearer_access_token()
3148 .await;
3149
3150 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
3151 #[cfg(feature = "tracing")]
3153 tracing::debug!(
3154 "No client credentials found, but this call does not require authentication."
3155 );
3156 } else {
3157 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
3158 }
3159 }
3160
3161 let local_var_req = local_var_req_builder.build()?;
3162 let local_var_resp = local_var_client.execute(local_var_req).await?;
3163
3164 let local_var_status = local_var_resp.status();
3165
3166 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3167 let local_var_content = local_var_resp.text().await?;
3168 serde_json::from_str(&local_var_content).map_err(Error::from)
3169 } else {
3170 let local_var_retry_delay =
3171 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
3172 let local_var_content = local_var_resp.text().await?;
3173 let local_var_entity: Option<ListUserBillingInvoiceLinesError> =
3174 serde_json::from_str(&local_var_content).ok();
3175 let local_var_error = ResponseContent {
3176 status: local_var_status,
3177 content: local_var_content,
3178 entity: local_var_entity,
3179 retry_delay: local_var_retry_delay,
3180 };
3181 Err(Error::ResponseError(local_var_error))
3182 }
3183}
3184
3185pub async fn list_user_billing_invoice_lines(
3187 configuration: &configuration::Configuration,
3188 user_id: &str,
3189 billing_invoice_id: &str,
3190 page_token: Option<&str>,
3191 page_size: Option<i64>,
3192) -> Result<
3193 crate::models::ListAccountBillingInvoiceLinesResponse,
3194 Error<ListUserBillingInvoiceLinesError>,
3195> {
3196 let mut backoff = configuration.backoff.clone();
3197 let mut refreshed_credentials = false;
3198 let method = reqwest::Method::GET;
3199 loop {
3200 let result = list_user_billing_invoice_lines_inner(
3201 configuration,
3202 &mut backoff,
3203 user_id.clone(),
3204 billing_invoice_id.clone(),
3205 page_token.clone(),
3206 page_size.clone(),
3207 )
3208 .await;
3209
3210 match result {
3211 Ok(result) => return Ok(result),
3212 Err(Error::ResponseError(response)) => {
3213 if !refreshed_credentials
3214 && matches!(
3215 response.status,
3216 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
3217 )
3218 {
3219 configuration.qcs_config.refresh().await?;
3220 refreshed_credentials = true;
3221 continue;
3222 } else if let Some(duration) = response.retry_delay {
3223 tokio::time::sleep(duration).await;
3224 continue;
3225 }
3226
3227 return Err(Error::ResponseError(response));
3228 }
3229 Err(Error::Reqwest(error)) => {
3230 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
3231 tokio::time::sleep(duration).await;
3232 continue;
3233 }
3234
3235 return Err(Error::Reqwest(error));
3236 }
3237 Err(Error::Io(error)) => {
3238 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
3239 tokio::time::sleep(duration).await;
3240 continue;
3241 }
3242
3243 return Err(Error::Io(error));
3244 }
3245 Err(error) => return Err(error),
3246 }
3247 }
3248}
3249async fn list_user_billing_invoices_inner(
3250 configuration: &configuration::Configuration,
3251 backoff: &mut ExponentialBackoff,
3252 user_id: &str,
3253 page_token: Option<&str>,
3254 page_size: Option<i64>,
3255) -> Result<crate::models::ListAccountBillingInvoicesResponse, Error<ListUserBillingInvoicesError>>
3256{
3257 let local_var_configuration = configuration;
3258
3259 let local_var_client = &local_var_configuration.client;
3260
3261 let local_var_uri_str = format!(
3262 "{}/v1/users/{userId}/billingInvoices",
3263 local_var_configuration.qcs_config.api_url(),
3264 userId = crate::apis::urlencode(user_id)
3265 );
3266 let mut local_var_req_builder =
3267 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3268
3269 #[cfg(feature = "tracing")]
3270 {
3271 let local_var_do_tracing = local_var_uri_str
3274 .parse::<::url::Url>()
3275 .ok()
3276 .is_none_or(|url| {
3277 configuration
3278 .qcs_config
3279 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
3280 });
3281
3282 if local_var_do_tracing {
3283 ::tracing::debug!(
3284 url=%local_var_uri_str,
3285 method="GET",
3286 "making list_user_billing_invoices request",
3287 );
3288 }
3289 }
3290
3291 if let Some(ref local_var_str) = page_token {
3292 local_var_req_builder =
3293 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
3294 }
3295 if let Some(ref local_var_str) = page_size {
3296 local_var_req_builder =
3297 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
3298 }
3299
3300 {
3303 use qcs_api_client_common::configuration::TokenError;
3304
3305 #[allow(
3306 clippy::nonminimal_bool,
3307 clippy::eq_op,
3308 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
3309 )]
3310 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
3311
3312 let token = local_var_configuration
3313 .qcs_config
3314 .get_bearer_access_token()
3315 .await;
3316
3317 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
3318 #[cfg(feature = "tracing")]
3320 tracing::debug!(
3321 "No client credentials found, but this call does not require authentication."
3322 );
3323 } else {
3324 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
3325 }
3326 }
3327
3328 let local_var_req = local_var_req_builder.build()?;
3329 let local_var_resp = local_var_client.execute(local_var_req).await?;
3330
3331 let local_var_status = local_var_resp.status();
3332
3333 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3334 let local_var_content = local_var_resp.text().await?;
3335 serde_json::from_str(&local_var_content).map_err(Error::from)
3336 } else {
3337 let local_var_retry_delay =
3338 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
3339 let local_var_content = local_var_resp.text().await?;
3340 let local_var_entity: Option<ListUserBillingInvoicesError> =
3341 serde_json::from_str(&local_var_content).ok();
3342 let local_var_error = ResponseContent {
3343 status: local_var_status,
3344 content: local_var_content,
3345 entity: local_var_entity,
3346 retry_delay: local_var_retry_delay,
3347 };
3348 Err(Error::ResponseError(local_var_error))
3349 }
3350}
3351
3352pub async fn list_user_billing_invoices(
3354 configuration: &configuration::Configuration,
3355 user_id: &str,
3356 page_token: Option<&str>,
3357 page_size: Option<i64>,
3358) -> Result<crate::models::ListAccountBillingInvoicesResponse, Error<ListUserBillingInvoicesError>>
3359{
3360 let mut backoff = configuration.backoff.clone();
3361 let mut refreshed_credentials = false;
3362 let method = reqwest::Method::GET;
3363 loop {
3364 let result = list_user_billing_invoices_inner(
3365 configuration,
3366 &mut backoff,
3367 user_id.clone(),
3368 page_token.clone(),
3369 page_size.clone(),
3370 )
3371 .await;
3372
3373 match result {
3374 Ok(result) => return Ok(result),
3375 Err(Error::ResponseError(response)) => {
3376 if !refreshed_credentials
3377 && matches!(
3378 response.status,
3379 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
3380 )
3381 {
3382 configuration.qcs_config.refresh().await?;
3383 refreshed_credentials = true;
3384 continue;
3385 } else if let Some(duration) = response.retry_delay {
3386 tokio::time::sleep(duration).await;
3387 continue;
3388 }
3389
3390 return Err(Error::ResponseError(response));
3391 }
3392 Err(Error::Reqwest(error)) => {
3393 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
3394 tokio::time::sleep(duration).await;
3395 continue;
3396 }
3397
3398 return Err(Error::Reqwest(error));
3399 }
3400 Err(Error::Io(error)) => {
3401 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
3402 tokio::time::sleep(duration).await;
3403 continue;
3404 }
3405
3406 return Err(Error::Io(error));
3407 }
3408 Err(error) => return Err(error),
3409 }
3410 }
3411}
3412async fn list_user_groups_inner(
3413 configuration: &configuration::Configuration,
3414 backoff: &mut ExponentialBackoff,
3415 user_id: &str,
3416 page_size: Option<i64>,
3417 page_token: Option<&str>,
3418) -> Result<crate::models::ListGroupsResponse, Error<ListUserGroupsError>> {
3419 let local_var_configuration = configuration;
3420
3421 let local_var_client = &local_var_configuration.client;
3422
3423 let local_var_uri_str = format!(
3424 "{}/v1/users/{userId}/groups",
3425 local_var_configuration.qcs_config.api_url(),
3426 userId = crate::apis::urlencode(user_id)
3427 );
3428 let mut local_var_req_builder =
3429 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3430
3431 #[cfg(feature = "tracing")]
3432 {
3433 let local_var_do_tracing = local_var_uri_str
3436 .parse::<::url::Url>()
3437 .ok()
3438 .is_none_or(|url| {
3439 configuration
3440 .qcs_config
3441 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
3442 });
3443
3444 if local_var_do_tracing {
3445 ::tracing::debug!(
3446 url=%local_var_uri_str,
3447 method="GET",
3448 "making list_user_groups request",
3449 );
3450 }
3451 }
3452
3453 if let Some(ref local_var_str) = page_size {
3454 local_var_req_builder =
3455 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
3456 }
3457 if let Some(ref local_var_str) = page_token {
3458 local_var_req_builder =
3459 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
3460 }
3461
3462 {
3465 use qcs_api_client_common::configuration::TokenError;
3466
3467 #[allow(
3468 clippy::nonminimal_bool,
3469 clippy::eq_op,
3470 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
3471 )]
3472 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
3473
3474 let token = local_var_configuration
3475 .qcs_config
3476 .get_bearer_access_token()
3477 .await;
3478
3479 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
3480 #[cfg(feature = "tracing")]
3482 tracing::debug!(
3483 "No client credentials found, but this call does not require authentication."
3484 );
3485 } else {
3486 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
3487 }
3488 }
3489
3490 let local_var_req = local_var_req_builder.build()?;
3491 let local_var_resp = local_var_client.execute(local_var_req).await?;
3492
3493 let local_var_status = local_var_resp.status();
3494
3495 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3496 let local_var_content = local_var_resp.text().await?;
3497 serde_json::from_str(&local_var_content).map_err(Error::from)
3498 } else {
3499 let local_var_retry_delay =
3500 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
3501 let local_var_content = local_var_resp.text().await?;
3502 let local_var_entity: Option<ListUserGroupsError> =
3503 serde_json::from_str(&local_var_content).ok();
3504 let local_var_error = ResponseContent {
3505 status: local_var_status,
3506 content: local_var_content,
3507 entity: local_var_entity,
3508 retry_delay: local_var_retry_delay,
3509 };
3510 Err(Error::ResponseError(local_var_error))
3511 }
3512}
3513
3514pub async fn list_user_groups(
3516 configuration: &configuration::Configuration,
3517 user_id: &str,
3518 page_size: Option<i64>,
3519 page_token: Option<&str>,
3520) -> Result<crate::models::ListGroupsResponse, Error<ListUserGroupsError>> {
3521 let mut backoff = configuration.backoff.clone();
3522 let mut refreshed_credentials = false;
3523 let method = reqwest::Method::GET;
3524 loop {
3525 let result = list_user_groups_inner(
3526 configuration,
3527 &mut backoff,
3528 user_id.clone(),
3529 page_size.clone(),
3530 page_token.clone(),
3531 )
3532 .await;
3533
3534 match result {
3535 Ok(result) => return Ok(result),
3536 Err(Error::ResponseError(response)) => {
3537 if !refreshed_credentials
3538 && matches!(
3539 response.status,
3540 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
3541 )
3542 {
3543 configuration.qcs_config.refresh().await?;
3544 refreshed_credentials = true;
3545 continue;
3546 } else if let Some(duration) = response.retry_delay {
3547 tokio::time::sleep(duration).await;
3548 continue;
3549 }
3550
3551 return Err(Error::ResponseError(response));
3552 }
3553 Err(Error::Reqwest(error)) => {
3554 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
3555 tokio::time::sleep(duration).await;
3556 continue;
3557 }
3558
3559 return Err(Error::Reqwest(error));
3560 }
3561 Err(Error::Io(error)) => {
3562 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
3563 tokio::time::sleep(duration).await;
3564 continue;
3565 }
3566
3567 return Err(Error::Io(error));
3568 }
3569 Err(error) => return Err(error),
3570 }
3571 }
3572}
3573async fn list_user_upcoming_billing_invoice_lines_inner(
3574 configuration: &configuration::Configuration,
3575 backoff: &mut ExponentialBackoff,
3576 user_id: &str,
3577 page_token: Option<&str>,
3578 page_size: Option<i64>,
3579) -> Result<
3580 crate::models::ListAccountBillingInvoiceLinesResponse,
3581 Error<ListUserUpcomingBillingInvoiceLinesError>,
3582> {
3583 let local_var_configuration = configuration;
3584
3585 let local_var_client = &local_var_configuration.client;
3586
3587 let local_var_uri_str = format!(
3588 "{}/v1/users/{userId}/billingInvoices:listUpcomingLines",
3589 local_var_configuration.qcs_config.api_url(),
3590 userId = crate::apis::urlencode(user_id)
3591 );
3592 let mut local_var_req_builder =
3593 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3594
3595 #[cfg(feature = "tracing")]
3596 {
3597 let local_var_do_tracing = local_var_uri_str
3600 .parse::<::url::Url>()
3601 .ok()
3602 .is_none_or(|url| {
3603 configuration
3604 .qcs_config
3605 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
3606 });
3607
3608 if local_var_do_tracing {
3609 ::tracing::debug!(
3610 url=%local_var_uri_str,
3611 method="GET",
3612 "making list_user_upcoming_billing_invoice_lines request",
3613 );
3614 }
3615 }
3616
3617 if let Some(ref local_var_str) = page_token {
3618 local_var_req_builder =
3619 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
3620 }
3621 if let Some(ref local_var_str) = page_size {
3622 local_var_req_builder =
3623 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
3624 }
3625
3626 {
3629 use qcs_api_client_common::configuration::TokenError;
3630
3631 #[allow(
3632 clippy::nonminimal_bool,
3633 clippy::eq_op,
3634 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
3635 )]
3636 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
3637
3638 let token = local_var_configuration
3639 .qcs_config
3640 .get_bearer_access_token()
3641 .await;
3642
3643 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
3644 #[cfg(feature = "tracing")]
3646 tracing::debug!(
3647 "No client credentials found, but this call does not require authentication."
3648 );
3649 } else {
3650 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
3651 }
3652 }
3653
3654 let local_var_req = local_var_req_builder.build()?;
3655 let local_var_resp = local_var_client.execute(local_var_req).await?;
3656
3657 let local_var_status = local_var_resp.status();
3658
3659 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3660 let local_var_content = local_var_resp.text().await?;
3661 serde_json::from_str(&local_var_content).map_err(Error::from)
3662 } else {
3663 let local_var_retry_delay =
3664 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
3665 let local_var_content = local_var_resp.text().await?;
3666 let local_var_entity: Option<ListUserUpcomingBillingInvoiceLinesError> =
3667 serde_json::from_str(&local_var_content).ok();
3668 let local_var_error = ResponseContent {
3669 status: local_var_status,
3670 content: local_var_content,
3671 entity: local_var_entity,
3672 retry_delay: local_var_retry_delay,
3673 };
3674 Err(Error::ResponseError(local_var_error))
3675 }
3676}
3677
3678pub async fn list_user_upcoming_billing_invoice_lines(
3680 configuration: &configuration::Configuration,
3681 user_id: &str,
3682 page_token: Option<&str>,
3683 page_size: Option<i64>,
3684) -> Result<
3685 crate::models::ListAccountBillingInvoiceLinesResponse,
3686 Error<ListUserUpcomingBillingInvoiceLinesError>,
3687> {
3688 let mut backoff = configuration.backoff.clone();
3689 let mut refreshed_credentials = false;
3690 let method = reqwest::Method::GET;
3691 loop {
3692 let result = list_user_upcoming_billing_invoice_lines_inner(
3693 configuration,
3694 &mut backoff,
3695 user_id.clone(),
3696 page_token.clone(),
3697 page_size.clone(),
3698 )
3699 .await;
3700
3701 match result {
3702 Ok(result) => return Ok(result),
3703 Err(Error::ResponseError(response)) => {
3704 if !refreshed_credentials
3705 && matches!(
3706 response.status,
3707 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
3708 )
3709 {
3710 configuration.qcs_config.refresh().await?;
3711 refreshed_credentials = true;
3712 continue;
3713 } else if let Some(duration) = response.retry_delay {
3714 tokio::time::sleep(duration).await;
3715 continue;
3716 }
3717
3718 return Err(Error::ResponseError(response));
3719 }
3720 Err(Error::Reqwest(error)) => {
3721 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
3722 tokio::time::sleep(duration).await;
3723 continue;
3724 }
3725
3726 return Err(Error::Reqwest(error));
3727 }
3728 Err(Error::Io(error)) => {
3729 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
3730 tokio::time::sleep(duration).await;
3731 continue;
3732 }
3733
3734 return Err(Error::Io(error));
3735 }
3736 Err(error) => return Err(error),
3737 }
3738 }
3739}
3740async fn list_viewer_announcements_inner(
3741 configuration: &configuration::Configuration,
3742 backoff: &mut ExponentialBackoff,
3743 page_size: Option<i64>,
3744 page_token: Option<&str>,
3745 include_dismissed: Option<bool>,
3746) -> Result<crate::models::AnnouncementsResponse, Error<ListViewerAnnouncementsError>> {
3747 let local_var_configuration = configuration;
3748
3749 let local_var_client = &local_var_configuration.client;
3750
3751 let local_var_uri_str = format!(
3752 "{}/v1/viewer/announcements",
3753 local_var_configuration.qcs_config.api_url()
3754 );
3755 let mut local_var_req_builder =
3756 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3757
3758 #[cfg(feature = "tracing")]
3759 {
3760 let local_var_do_tracing = local_var_uri_str
3763 .parse::<::url::Url>()
3764 .ok()
3765 .is_none_or(|url| {
3766 configuration
3767 .qcs_config
3768 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
3769 });
3770
3771 if local_var_do_tracing {
3772 ::tracing::debug!(
3773 url=%local_var_uri_str,
3774 method="GET",
3775 "making list_viewer_announcements request",
3776 );
3777 }
3778 }
3779
3780 if let Some(ref local_var_str) = page_size {
3781 local_var_req_builder =
3782 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
3783 }
3784 if let Some(ref local_var_str) = page_token {
3785 local_var_req_builder =
3786 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
3787 }
3788 if let Some(ref local_var_str) = include_dismissed {
3789 local_var_req_builder =
3790 local_var_req_builder.query(&[("includeDismissed", &local_var_str.to_string())]);
3791 }
3792
3793 {
3796 use qcs_api_client_common::configuration::TokenError;
3797
3798 #[allow(
3799 clippy::nonminimal_bool,
3800 clippy::eq_op,
3801 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
3802 )]
3803 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
3804
3805 let token = local_var_configuration
3806 .qcs_config
3807 .get_bearer_access_token()
3808 .await;
3809
3810 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
3811 #[cfg(feature = "tracing")]
3813 tracing::debug!(
3814 "No client credentials found, but this call does not require authentication."
3815 );
3816 } else {
3817 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
3818 }
3819 }
3820
3821 let local_var_req = local_var_req_builder.build()?;
3822 let local_var_resp = local_var_client.execute(local_var_req).await?;
3823
3824 let local_var_status = local_var_resp.status();
3825
3826 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3827 let local_var_content = local_var_resp.text().await?;
3828 serde_json::from_str(&local_var_content).map_err(Error::from)
3829 } else {
3830 let local_var_retry_delay =
3831 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
3832 let local_var_content = local_var_resp.text().await?;
3833 let local_var_entity: Option<ListViewerAnnouncementsError> =
3834 serde_json::from_str(&local_var_content).ok();
3835 let local_var_error = ResponseContent {
3836 status: local_var_status,
3837 content: local_var_content,
3838 entity: local_var_entity,
3839 retry_delay: local_var_retry_delay,
3840 };
3841 Err(Error::ResponseError(local_var_error))
3842 }
3843}
3844
3845pub async fn list_viewer_announcements(
3847 configuration: &configuration::Configuration,
3848 page_size: Option<i64>,
3849 page_token: Option<&str>,
3850 include_dismissed: Option<bool>,
3851) -> Result<crate::models::AnnouncementsResponse, Error<ListViewerAnnouncementsError>> {
3852 let mut backoff = configuration.backoff.clone();
3853 let mut refreshed_credentials = false;
3854 let method = reqwest::Method::GET;
3855 loop {
3856 let result = list_viewer_announcements_inner(
3857 configuration,
3858 &mut backoff,
3859 page_size.clone(),
3860 page_token.clone(),
3861 include_dismissed.clone(),
3862 )
3863 .await;
3864
3865 match result {
3866 Ok(result) => return Ok(result),
3867 Err(Error::ResponseError(response)) => {
3868 if !refreshed_credentials
3869 && matches!(
3870 response.status,
3871 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
3872 )
3873 {
3874 configuration.qcs_config.refresh().await?;
3875 refreshed_credentials = true;
3876 continue;
3877 } else if let Some(duration) = response.retry_delay {
3878 tokio::time::sleep(duration).await;
3879 continue;
3880 }
3881
3882 return Err(Error::ResponseError(response));
3883 }
3884 Err(Error::Reqwest(error)) => {
3885 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
3886 tokio::time::sleep(duration).await;
3887 continue;
3888 }
3889
3890 return Err(Error::Reqwest(error));
3891 }
3892 Err(Error::Io(error)) => {
3893 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
3894 tokio::time::sleep(duration).await;
3895 continue;
3896 }
3897
3898 return Err(Error::Io(error));
3899 }
3900 Err(error) => return Err(error),
3901 }
3902 }
3903}
3904async fn put_viewer_user_onboarding_completed_inner(
3905 configuration: &configuration::Configuration,
3906 backoff: &mut ExponentialBackoff,
3907 viewer_user_onboarding_completed: Option<crate::models::ViewerUserOnboardingCompleted>,
3908) -> Result<
3909 crate::models::ViewerUserOnboardingCompleted,
3910 Error<PutViewerUserOnboardingCompletedError>,
3911> {
3912 let local_var_configuration = configuration;
3913
3914 let local_var_client = &local_var_configuration.client;
3915
3916 let local_var_uri_str = format!(
3917 "{}/v1/viewer/onboardingCompleted",
3918 local_var_configuration.qcs_config.api_url()
3919 );
3920 let mut local_var_req_builder =
3921 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3922
3923 #[cfg(feature = "tracing")]
3924 {
3925 let local_var_do_tracing = local_var_uri_str
3928 .parse::<::url::Url>()
3929 .ok()
3930 .is_none_or(|url| {
3931 configuration
3932 .qcs_config
3933 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
3934 });
3935
3936 if local_var_do_tracing {
3937 ::tracing::debug!(
3938 url=%local_var_uri_str,
3939 method="PUT",
3940 "making put_viewer_user_onboarding_completed request",
3941 );
3942 }
3943 }
3944
3945 {
3948 use qcs_api_client_common::configuration::TokenError;
3949
3950 #[allow(
3951 clippy::nonminimal_bool,
3952 clippy::eq_op,
3953 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
3954 )]
3955 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
3956
3957 let token = local_var_configuration
3958 .qcs_config
3959 .get_bearer_access_token()
3960 .await;
3961
3962 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
3963 #[cfg(feature = "tracing")]
3965 tracing::debug!(
3966 "No client credentials found, but this call does not require authentication."
3967 );
3968 } else {
3969 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
3970 }
3971 }
3972
3973 local_var_req_builder = local_var_req_builder.json(&viewer_user_onboarding_completed);
3974
3975 let local_var_req = local_var_req_builder.build()?;
3976 let local_var_resp = local_var_client.execute(local_var_req).await?;
3977
3978 let local_var_status = local_var_resp.status();
3979
3980 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3981 let local_var_content = local_var_resp.text().await?;
3982 serde_json::from_str(&local_var_content).map_err(Error::from)
3983 } else {
3984 let local_var_retry_delay =
3985 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
3986 let local_var_content = local_var_resp.text().await?;
3987 let local_var_entity: Option<PutViewerUserOnboardingCompletedError> =
3988 serde_json::from_str(&local_var_content).ok();
3989 let local_var_error = ResponseContent {
3990 status: local_var_status,
3991 content: local_var_content,
3992 entity: local_var_entity,
3993 retry_delay: local_var_retry_delay,
3994 };
3995 Err(Error::ResponseError(local_var_error))
3996 }
3997}
3998
3999pub async fn put_viewer_user_onboarding_completed(
4001 configuration: &configuration::Configuration,
4002 viewer_user_onboarding_completed: Option<crate::models::ViewerUserOnboardingCompleted>,
4003) -> Result<
4004 crate::models::ViewerUserOnboardingCompleted,
4005 Error<PutViewerUserOnboardingCompletedError>,
4006> {
4007 let mut backoff = configuration.backoff.clone();
4008 let mut refreshed_credentials = false;
4009 let method = reqwest::Method::PUT;
4010 loop {
4011 let result = put_viewer_user_onboarding_completed_inner(
4012 configuration,
4013 &mut backoff,
4014 viewer_user_onboarding_completed.clone(),
4015 )
4016 .await;
4017
4018 match result {
4019 Ok(result) => return Ok(result),
4020 Err(Error::ResponseError(response)) => {
4021 if !refreshed_credentials
4022 && matches!(
4023 response.status,
4024 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
4025 )
4026 {
4027 configuration.qcs_config.refresh().await?;
4028 refreshed_credentials = true;
4029 continue;
4030 } else if let Some(duration) = response.retry_delay {
4031 tokio::time::sleep(duration).await;
4032 continue;
4033 }
4034
4035 return Err(Error::ResponseError(response));
4036 }
4037 Err(Error::Reqwest(error)) => {
4038 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
4039 tokio::time::sleep(duration).await;
4040 continue;
4041 }
4042
4043 return Err(Error::Reqwest(error));
4044 }
4045 Err(Error::Io(error)) => {
4046 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
4047 tokio::time::sleep(duration).await;
4048 continue;
4049 }
4050
4051 return Err(Error::Io(error));
4052 }
4053 Err(error) => return Err(error),
4054 }
4055 }
4056}
4057async fn remove_group_user_inner(
4058 configuration: &configuration::Configuration,
4059 backoff: &mut ExponentialBackoff,
4060 remove_group_user_request: crate::models::RemoveGroupUserRequest,
4061) -> Result<(), Error<RemoveGroupUserError>> {
4062 let local_var_configuration = configuration;
4063
4064 let local_var_client = &local_var_configuration.client;
4065
4066 let local_var_uri_str = format!(
4067 "{}/v1/groups:removeUser",
4068 local_var_configuration.qcs_config.api_url()
4069 );
4070 let mut local_var_req_builder =
4071 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
4072
4073 #[cfg(feature = "tracing")]
4074 {
4075 let local_var_do_tracing = local_var_uri_str
4078 .parse::<::url::Url>()
4079 .ok()
4080 .is_none_or(|url| {
4081 configuration
4082 .qcs_config
4083 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
4084 });
4085
4086 if local_var_do_tracing {
4087 ::tracing::debug!(
4088 url=%local_var_uri_str,
4089 method="POST",
4090 "making remove_group_user request",
4091 );
4092 }
4093 }
4094
4095 {
4098 use qcs_api_client_common::configuration::TokenError;
4099
4100 #[allow(
4101 clippy::nonminimal_bool,
4102 clippy::eq_op,
4103 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
4104 )]
4105 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
4106
4107 let token = local_var_configuration
4108 .qcs_config
4109 .get_bearer_access_token()
4110 .await;
4111
4112 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
4113 #[cfg(feature = "tracing")]
4115 tracing::debug!(
4116 "No client credentials found, but this call does not require authentication."
4117 );
4118 } else {
4119 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
4120 }
4121 }
4122
4123 local_var_req_builder = local_var_req_builder.json(&remove_group_user_request);
4124
4125 let local_var_req = local_var_req_builder.build()?;
4126 let local_var_resp = local_var_client.execute(local_var_req).await?;
4127
4128 let local_var_status = local_var_resp.status();
4129
4130 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
4131 Ok(())
4132 } else {
4133 let local_var_retry_delay =
4134 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
4135 let local_var_content = local_var_resp.text().await?;
4136 let local_var_entity: Option<RemoveGroupUserError> =
4137 serde_json::from_str(&local_var_content).ok();
4138 let local_var_error = ResponseContent {
4139 status: local_var_status,
4140 content: local_var_content,
4141 entity: local_var_entity,
4142 retry_delay: local_var_retry_delay,
4143 };
4144 Err(Error::ResponseError(local_var_error))
4145 }
4146}
4147
4148pub async fn remove_group_user(
4150 configuration: &configuration::Configuration,
4151 remove_group_user_request: crate::models::RemoveGroupUserRequest,
4152) -> Result<(), Error<RemoveGroupUserError>> {
4153 let mut backoff = configuration.backoff.clone();
4154 let mut refreshed_credentials = false;
4155 let method = reqwest::Method::POST;
4156 loop {
4157 let result = remove_group_user_inner(
4158 configuration,
4159 &mut backoff,
4160 remove_group_user_request.clone(),
4161 )
4162 .await;
4163
4164 match result {
4165 Ok(result) => return Ok(result),
4166 Err(Error::ResponseError(response)) => {
4167 if !refreshed_credentials
4168 && matches!(
4169 response.status,
4170 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
4171 )
4172 {
4173 configuration.qcs_config.refresh().await?;
4174 refreshed_credentials = true;
4175 continue;
4176 } else if let Some(duration) = response.retry_delay {
4177 tokio::time::sleep(duration).await;
4178 continue;
4179 }
4180
4181 return Err(Error::ResponseError(response));
4182 }
4183 Err(Error::Reqwest(error)) => {
4184 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
4185 tokio::time::sleep(duration).await;
4186 continue;
4187 }
4188
4189 return Err(Error::Reqwest(error));
4190 }
4191 Err(Error::Io(error)) => {
4192 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
4193 tokio::time::sleep(duration).await;
4194 continue;
4195 }
4196
4197 return Err(Error::Io(error));
4198 }
4199 Err(error) => return Err(error),
4200 }
4201 }
4202}
4203async fn update_viewer_user_profile_inner(
4204 configuration: &configuration::Configuration,
4205 backoff: &mut ExponentialBackoff,
4206 update_viewer_user_profile_request: crate::models::UpdateViewerUserProfileRequest,
4207) -> Result<crate::models::User, Error<UpdateViewerUserProfileError>> {
4208 let local_var_configuration = configuration;
4209
4210 let local_var_client = &local_var_configuration.client;
4211
4212 let local_var_uri_str = format!(
4213 "{}/v1/viewer/userProfile",
4214 local_var_configuration.qcs_config.api_url()
4215 );
4216 let mut local_var_req_builder =
4217 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
4218
4219 #[cfg(feature = "tracing")]
4220 {
4221 let local_var_do_tracing = local_var_uri_str
4224 .parse::<::url::Url>()
4225 .ok()
4226 .is_none_or(|url| {
4227 configuration
4228 .qcs_config
4229 .should_trace(&::urlpattern::UrlPatternMatchInput::Url(url))
4230 });
4231
4232 if local_var_do_tracing {
4233 ::tracing::debug!(
4234 url=%local_var_uri_str,
4235 method="PUT",
4236 "making update_viewer_user_profile request",
4237 );
4238 }
4239 }
4240
4241 {
4244 use qcs_api_client_common::configuration::TokenError;
4245
4246 #[allow(
4247 clippy::nonminimal_bool,
4248 clippy::eq_op,
4249 reason = "Logic must be done at runtime since it cannot be handled by the mustache template engine."
4250 )]
4251 let is_jwt_bearer_optional: bool = false || "JWTBearer" == "JWTBearerOptional";
4252
4253 let token = local_var_configuration
4254 .qcs_config
4255 .get_bearer_access_token()
4256 .await;
4257
4258 if is_jwt_bearer_optional && matches!(token, Err(TokenError::NoCredentials)) {
4259 #[cfg(feature = "tracing")]
4261 tracing::debug!(
4262 "No client credentials found, but this call does not require authentication."
4263 );
4264 } else {
4265 local_var_req_builder = local_var_req_builder.bearer_auth(token?.secret());
4266 }
4267 }
4268
4269 local_var_req_builder = local_var_req_builder.json(&update_viewer_user_profile_request);
4270
4271 let local_var_req = local_var_req_builder.build()?;
4272 let local_var_resp = local_var_client.execute(local_var_req).await?;
4273
4274 let local_var_status = local_var_resp.status();
4275
4276 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
4277 let local_var_content = local_var_resp.text().await?;
4278 serde_json::from_str(&local_var_content).map_err(Error::from)
4279 } else {
4280 let local_var_retry_delay =
4281 duration_from_response(local_var_resp.status(), local_var_resp.headers(), backoff);
4282 let local_var_content = local_var_resp.text().await?;
4283 let local_var_entity: Option<UpdateViewerUserProfileError> =
4284 serde_json::from_str(&local_var_content).ok();
4285 let local_var_error = ResponseContent {
4286 status: local_var_status,
4287 content: local_var_content,
4288 entity: local_var_entity,
4289 retry_delay: local_var_retry_delay,
4290 };
4291 Err(Error::ResponseError(local_var_error))
4292 }
4293}
4294
4295pub async fn update_viewer_user_profile(
4297 configuration: &configuration::Configuration,
4298 update_viewer_user_profile_request: crate::models::UpdateViewerUserProfileRequest,
4299) -> Result<crate::models::User, Error<UpdateViewerUserProfileError>> {
4300 let mut backoff = configuration.backoff.clone();
4301 let mut refreshed_credentials = false;
4302 let method = reqwest::Method::PUT;
4303 loop {
4304 let result = update_viewer_user_profile_inner(
4305 configuration,
4306 &mut backoff,
4307 update_viewer_user_profile_request.clone(),
4308 )
4309 .await;
4310
4311 match result {
4312 Ok(result) => return Ok(result),
4313 Err(Error::ResponseError(response)) => {
4314 if !refreshed_credentials
4315 && matches!(
4316 response.status,
4317 StatusCode::FORBIDDEN | StatusCode::UNAUTHORIZED
4318 )
4319 {
4320 configuration.qcs_config.refresh().await?;
4321 refreshed_credentials = true;
4322 continue;
4323 } else if let Some(duration) = response.retry_delay {
4324 tokio::time::sleep(duration).await;
4325 continue;
4326 }
4327
4328 return Err(Error::ResponseError(response));
4329 }
4330 Err(Error::Reqwest(error)) => {
4331 if let Some(duration) = duration_from_reqwest_error(&method, &error, &mut backoff) {
4332 tokio::time::sleep(duration).await;
4333 continue;
4334 }
4335
4336 return Err(Error::Reqwest(error));
4337 }
4338 Err(Error::Io(error)) => {
4339 if let Some(duration) = duration_from_io_error(&method, &error, &mut backoff) {
4340 tokio::time::sleep(duration).await;
4341 continue;
4342 }
4343
4344 return Err(Error::Io(error));
4345 }
4346 Err(error) => return Err(error),
4347 }
4348 }
4349}