1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CancelSubscriptionError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CollectInvoiceError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteBillingAlertsByIdError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteBillingMethodsByIdError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DeleteBillingPortalMethodsByIdError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetBillingAccountsError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetBillingAccountsByIdMembersError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetBillingAlertsError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetBillingAlertsAuthorizeError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetBillingBalanceError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetBillingCreditBalanceError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetBillingCreditBalanceBreakdownError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetBillingCreditsError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetBillingCryptoDepositByIdError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetBillingCryptoOptionsError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetBillingInvoicesError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetBillingInvoicesByIdPdfError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetBillingLedgerError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetBillingMethodsError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetBillingPayoutsError {
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GetBillingPlansError {
162 UnknownValue(serde_json::Value),
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum GetBillingPortalMethodsError {
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum GetBillingSettingsError {
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum GetBillingSubscriptionsError {
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum GetBillingTierError {
190 UnknownValue(serde_json::Value),
191}
192
193#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum GetBillingTransactionsError {
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum GetBillingUsageError {
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum GetBillingUsageAccountsError {
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum GetBillingUsageRollupError {
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum GetBillingWireError {
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum GetInvoiceError {
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum IssueInvoiceError {
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum PatchBillingAlertsByIdError {
246 UnknownValue(serde_json::Value),
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum PostBillingAlertsError {
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum PostBillingCryptoDepositError {
260 UnknownValue(serde_json::Value),
261}
262
263#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum PostBillingMethodsError {
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum PostBillingModeError {
274 UnknownValue(serde_json::Value),
275}
276
277#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum PostBillingPortalMethodsError {
281 UnknownValue(serde_json::Value),
282}
283
284#[derive(Debug, Clone, Serialize, Deserialize)]
286#[serde(untagged)]
287pub enum PostBillingRechargeRunAllError {
288 UnknownValue(serde_json::Value),
289}
290
291#[derive(Debug, Clone, Serialize, Deserialize)]
293#[serde(untagged)]
294pub enum PostBillingSubscribeCardError {
295 UnknownValue(serde_json::Value),
296}
297
298#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum PostBillingTopupError {
302 UnknownValue(serde_json::Value),
303}
304
305#[derive(Debug, Clone, Serialize, Deserialize)]
307#[serde(untagged)]
308pub enum PostBillingTopupTokenError {
309 UnknownValue(serde_json::Value),
310}
311
312#[derive(Debug, Clone, Serialize, Deserialize)]
314#[serde(untagged)]
315pub enum RaiseInvoiceError {
316 UnknownValue(serde_json::Value),
317}
318
319#[derive(Debug, Clone, Serialize, Deserialize)]
321#[serde(untagged)]
322pub enum ReactivateSubscriptionError {
323 UnknownValue(serde_json::Value),
324}
325
326#[derive(Debug, Clone, Serialize, Deserialize)]
328#[serde(untagged)]
329pub enum VoidInvoiceError {
330 UnknownValue(serde_json::Value),
331}
332
333
334pub async fn cancel_subscription(configuration: &configuration::Configuration, id: &str, subscription_ref: models::SubscriptionRef) -> Result<models::Subscription, Error<CancelSubscriptionError>> {
336 let p_id = id;
338 let p_subscription_ref = subscription_ref;
339
340 let uri_str = format!("{}/v1/billing/subscriptions/{id}/cancel", configuration.base_path, id=crate::apis::urlencode(p_id));
341 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
342
343 if let Some(ref user_agent) = configuration.user_agent {
344 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
345 }
346 if let Some(ref token) = configuration.bearer_access_token {
347 req_builder = req_builder.bearer_auth(token.to_owned());
348 };
349 req_builder = req_builder.json(&p_subscription_ref);
350
351 let req = req_builder.build()?;
352 let resp = configuration.client.execute(req).await?;
353
354 let status = resp.status();
355 let content_type = resp
356 .headers()
357 .get("content-type")
358 .and_then(|v| v.to_str().ok())
359 .unwrap_or("application/octet-stream");
360 let content_type = super::ContentType::from(content_type);
361
362 if !status.is_client_error() && !status.is_server_error() {
363 let content = resp.text().await?;
364 match content_type {
365 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
366 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Subscription`"))),
367 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Subscription`")))),
368 }
369 } else {
370 let content = resp.text().await?;
371 let entity: Option<CancelSubscriptionError> = serde_json::from_str(&content).ok();
372 Err(Error::ResponseError(ResponseContent { status, content, entity }))
373 }
374}
375
376pub async fn collect_invoice(configuration: &configuration::Configuration, id: &str) -> Result<models::Collected, Error<CollectInvoiceError>> {
378 let p_id = id;
380
381 let uri_str = format!("{}/v1/billing/invoices/{id}/collect", configuration.base_path, id=crate::apis::urlencode(p_id));
382 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
383
384 if let Some(ref user_agent) = configuration.user_agent {
385 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
386 }
387 if let Some(ref token) = configuration.bearer_access_token {
388 req_builder = req_builder.bearer_auth(token.to_owned());
389 };
390
391 let req = req_builder.build()?;
392 let resp = configuration.client.execute(req).await?;
393
394 let status = resp.status();
395 let content_type = resp
396 .headers()
397 .get("content-type")
398 .and_then(|v| v.to_str().ok())
399 .unwrap_or("application/octet-stream");
400 let content_type = super::ContentType::from(content_type);
401
402 if !status.is_client_error() && !status.is_server_error() {
403 let content = resp.text().await?;
404 match content_type {
405 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
406 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Collected`"))),
407 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Collected`")))),
408 }
409 } else {
410 let content = resp.text().await?;
411 let entity: Option<CollectInvoiceError> = serde_json::from_str(&content).ok();
412 Err(Error::ResponseError(ResponseContent { status, content, entity }))
413 }
414}
415
416pub async fn delete_billing_alerts_by_id(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteBillingAlertsByIdError>> {
418 let p_id = id;
420
421 let uri_str = format!("{}/v1/billing/alerts/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
422 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
423
424 if let Some(ref user_agent) = configuration.user_agent {
425 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
426 }
427 if let Some(ref token) = configuration.bearer_access_token {
428 req_builder = req_builder.bearer_auth(token.to_owned());
429 };
430
431 let req = req_builder.build()?;
432 let resp = configuration.client.execute(req).await?;
433
434 let status = resp.status();
435
436 if !status.is_client_error() && !status.is_server_error() {
437 Ok(())
438 } else {
439 let content = resp.text().await?;
440 let entity: Option<DeleteBillingAlertsByIdError> = serde_json::from_str(&content).ok();
441 Err(Error::ResponseError(ResponseContent { status, content, entity }))
442 }
443}
444
445pub async fn delete_billing_methods_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::Detachment, Error<DeleteBillingMethodsByIdError>> {
447 let p_id = id;
449
450 let uri_str = format!("{}/v1/billing/methods/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
451 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
452
453 if let Some(ref user_agent) = configuration.user_agent {
454 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
455 }
456 if let Some(ref token) = configuration.bearer_access_token {
457 req_builder = req_builder.bearer_auth(token.to_owned());
458 };
459
460 let req = req_builder.build()?;
461 let resp = configuration.client.execute(req).await?;
462
463 let status = resp.status();
464 let content_type = resp
465 .headers()
466 .get("content-type")
467 .and_then(|v| v.to_str().ok())
468 .unwrap_or("application/octet-stream");
469 let content_type = super::ContentType::from(content_type);
470
471 if !status.is_client_error() && !status.is_server_error() {
472 let content = resp.text().await?;
473 match content_type {
474 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
475 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Detachment`"))),
476 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Detachment`")))),
477 }
478 } else {
479 let content = resp.text().await?;
480 let entity: Option<DeleteBillingMethodsByIdError> = serde_json::from_str(&content).ok();
481 Err(Error::ResponseError(ResponseContent { status, content, entity }))
482 }
483}
484
485pub async fn delete_billing_portal_methods_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::Detachment, Error<DeleteBillingPortalMethodsByIdError>> {
487 let p_id = id;
489
490 let uri_str = format!("{}/v1/billing/portal/methods/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
491 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
492
493 if let Some(ref user_agent) = configuration.user_agent {
494 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
495 }
496 if let Some(ref token) = configuration.bearer_access_token {
497 req_builder = req_builder.bearer_auth(token.to_owned());
498 };
499
500 let req = req_builder.build()?;
501 let resp = configuration.client.execute(req).await?;
502
503 let status = resp.status();
504 let content_type = resp
505 .headers()
506 .get("content-type")
507 .and_then(|v| v.to_str().ok())
508 .unwrap_or("application/octet-stream");
509 let content_type = super::ContentType::from(content_type);
510
511 if !status.is_client_error() && !status.is_server_error() {
512 let content = resp.text().await?;
513 match content_type {
514 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
515 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Detachment`"))),
516 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Detachment`")))),
517 }
518 } else {
519 let content = resp.text().await?;
520 let entity: Option<DeleteBillingPortalMethodsByIdError> = serde_json::from_str(&content).ok();
521 Err(Error::ResponseError(ResponseContent { status, content, entity }))
522 }
523}
524
525pub async fn get_billing_accounts(configuration: &configuration::Configuration, ) -> Result<Vec<models::BillingAccount>, Error<GetBillingAccountsError>> {
527
528 let uri_str = format!("{}/v1/billing/accounts", configuration.base_path);
529 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
530
531 if let Some(ref user_agent) = configuration.user_agent {
532 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
533 }
534 if let Some(ref token) = configuration.bearer_access_token {
535 req_builder = req_builder.bearer_auth(token.to_owned());
536 };
537
538 let req = req_builder.build()?;
539 let resp = configuration.client.execute(req).await?;
540
541 let status = resp.status();
542 let content_type = resp
543 .headers()
544 .get("content-type")
545 .and_then(|v| v.to_str().ok())
546 .unwrap_or("application/octet-stream");
547 let content_type = super::ContentType::from(content_type);
548
549 if !status.is_client_error() && !status.is_server_error() {
550 let content = resp.text().await?;
551 match content_type {
552 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
553 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::BillingAccount>`"))),
554 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::BillingAccount>`")))),
555 }
556 } else {
557 let content = resp.text().await?;
558 let entity: Option<GetBillingAccountsError> = serde_json::from_str(&content).ok();
559 Err(Error::ResponseError(ResponseContent { status, content, entity }))
560 }
561}
562
563pub async fn get_billing_accounts_by_id_members(configuration: &configuration::Configuration, id: &str) -> Result<Vec<models::Holder>, Error<GetBillingAccountsByIdMembersError>> {
565 let p_id = id;
567
568 let uri_str = format!("{}/v1/billing/accounts/{id}/members", configuration.base_path, id=crate::apis::urlencode(p_id));
569 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
570
571 if let Some(ref user_agent) = configuration.user_agent {
572 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
573 }
574 if let Some(ref token) = configuration.bearer_access_token {
575 req_builder = req_builder.bearer_auth(token.to_owned());
576 };
577
578 let req = req_builder.build()?;
579 let resp = configuration.client.execute(req).await?;
580
581 let status = resp.status();
582 let content_type = resp
583 .headers()
584 .get("content-type")
585 .and_then(|v| v.to_str().ok())
586 .unwrap_or("application/octet-stream");
587 let content_type = super::ContentType::from(content_type);
588
589 if !status.is_client_error() && !status.is_server_error() {
590 let content = resp.text().await?;
591 match content_type {
592 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
593 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Holder>`"))),
594 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Holder>`")))),
595 }
596 } else {
597 let content = resp.text().await?;
598 let entity: Option<GetBillingAccountsByIdMembersError> = serde_json::from_str(&content).ok();
599 Err(Error::ResponseError(ResponseContent { status, content, entity }))
600 }
601}
602
603pub async fn get_billing_alerts(configuration: &configuration::Configuration, ) -> Result<Vec<models::Alert>, Error<GetBillingAlertsError>> {
605
606 let uri_str = format!("{}/v1/billing/alerts", configuration.base_path);
607 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
608
609 if let Some(ref user_agent) = configuration.user_agent {
610 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
611 }
612 if let Some(ref token) = configuration.bearer_access_token {
613 req_builder = req_builder.bearer_auth(token.to_owned());
614 };
615
616 let req = req_builder.build()?;
617 let resp = configuration.client.execute(req).await?;
618
619 let status = resp.status();
620 let content_type = resp
621 .headers()
622 .get("content-type")
623 .and_then(|v| v.to_str().ok())
624 .unwrap_or("application/octet-stream");
625 let content_type = super::ContentType::from(content_type);
626
627 if !status.is_client_error() && !status.is_server_error() {
628 let content = resp.text().await?;
629 match content_type {
630 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
631 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Alert>`"))),
632 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Alert>`")))),
633 }
634 } else {
635 let content = resp.text().await?;
636 let entity: Option<GetBillingAlertsError> = serde_json::from_str(&content).ok();
637 Err(Error::ResponseError(ResponseContent { status, content, entity }))
638 }
639}
640
641pub async fn get_billing_alerts_authorize(configuration: &configuration::Configuration, project: Option<&str>, service: Option<&str>, amount: Option<&str>, pv: Option<&str>) -> Result<models::CapVerdict, Error<GetBillingAlertsAuthorizeError>> {
643 let p_project = project;
645 let p_service = service;
646 let p_amount = amount;
647 let p_pv = pv;
648
649 let uri_str = format!("{}/v1/billing/alerts/authorize", configuration.base_path);
650 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
651
652 if let Some(ref param_value) = p_project {
653 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
654 }
655 if let Some(ref param_value) = p_service {
656 req_builder = req_builder.query(&[("service", ¶m_value.to_string())]);
657 }
658 if let Some(ref param_value) = p_amount {
659 req_builder = req_builder.query(&[("amount", ¶m_value.to_string())]);
660 }
661 if let Some(ref param_value) = p_pv {
662 req_builder = req_builder.query(&[("pv", ¶m_value.to_string())]);
663 }
664 if let Some(ref user_agent) = configuration.user_agent {
665 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
666 }
667 if let Some(ref token) = configuration.bearer_access_token {
668 req_builder = req_builder.bearer_auth(token.to_owned());
669 };
670
671 let req = req_builder.build()?;
672 let resp = configuration.client.execute(req).await?;
673
674 let status = resp.status();
675 let content_type = resp
676 .headers()
677 .get("content-type")
678 .and_then(|v| v.to_str().ok())
679 .unwrap_or("application/octet-stream");
680 let content_type = super::ContentType::from(content_type);
681
682 if !status.is_client_error() && !status.is_server_error() {
683 let content = resp.text().await?;
684 match content_type {
685 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
686 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CapVerdict`"))),
687 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CapVerdict`")))),
688 }
689 } else {
690 let content = resp.text().await?;
691 let entity: Option<GetBillingAlertsAuthorizeError> = serde_json::from_str(&content).ok();
692 Err(Error::ResponseError(ResponseContent { status, content, entity }))
693 }
694}
695
696pub async fn get_billing_balance(configuration: &configuration::Configuration, ) -> Result<(), Error<GetBillingBalanceError>> {
698
699 let uri_str = format!("{}/v1/billing/balance", configuration.base_path);
700 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
701
702 if let Some(ref user_agent) = configuration.user_agent {
703 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
704 }
705 if let Some(ref token) = configuration.bearer_access_token {
706 req_builder = req_builder.bearer_auth(token.to_owned());
707 };
708
709 let req = req_builder.build()?;
710 let resp = configuration.client.execute(req).await?;
711
712 let status = resp.status();
713
714 if !status.is_client_error() && !status.is_server_error() {
715 Ok(())
716 } else {
717 let content = resp.text().await?;
718 let entity: Option<GetBillingBalanceError> = serde_json::from_str(&content).ok();
719 Err(Error::ResponseError(ResponseContent { status, content, entity }))
720 }
721}
722
723pub async fn get_billing_credit_balance(configuration: &configuration::Configuration, ) -> Result<models::CreditBalance, Error<GetBillingCreditBalanceError>> {
725
726 let uri_str = format!("{}/v1/billing/credit-balance", configuration.base_path);
727 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
728
729 if let Some(ref user_agent) = configuration.user_agent {
730 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
731 }
732 if let Some(ref token) = configuration.bearer_access_token {
733 req_builder = req_builder.bearer_auth(token.to_owned());
734 };
735
736 let req = req_builder.build()?;
737 let resp = configuration.client.execute(req).await?;
738
739 let status = resp.status();
740 let content_type = resp
741 .headers()
742 .get("content-type")
743 .and_then(|v| v.to_str().ok())
744 .unwrap_or("application/octet-stream");
745 let content_type = super::ContentType::from(content_type);
746
747 if !status.is_client_error() && !status.is_server_error() {
748 let content = resp.text().await?;
749 match content_type {
750 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
751 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreditBalance`"))),
752 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreditBalance`")))),
753 }
754 } else {
755 let content = resp.text().await?;
756 let entity: Option<GetBillingCreditBalanceError> = serde_json::from_str(&content).ok();
757 Err(Error::ResponseError(ResponseContent { status, content, entity }))
758 }
759}
760
761pub async fn get_billing_credit_balance_breakdown(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<GetBillingCreditBalanceBreakdownError>> {
763
764 let uri_str = format!("{}/v1/billing/credit-balance/breakdown", configuration.base_path);
765 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
766
767 if let Some(ref user_agent) = configuration.user_agent {
768 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
769 }
770 if let Some(ref token) = configuration.bearer_access_token {
771 req_builder = req_builder.bearer_auth(token.to_owned());
772 };
773
774 let req = req_builder.build()?;
775 let resp = configuration.client.execute(req).await?;
776
777 let status = resp.status();
778 let content_type = resp
779 .headers()
780 .get("content-type")
781 .and_then(|v| v.to_str().ok())
782 .unwrap_or("application/octet-stream");
783 let content_type = super::ContentType::from(content_type);
784
785 if !status.is_client_error() && !status.is_server_error() {
786 let content = resp.text().await?;
787 match content_type {
788 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
789 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
790 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
791 }
792 } else {
793 let content = resp.text().await?;
794 let entity: Option<GetBillingCreditBalanceBreakdownError> = serde_json::from_str(&content).ok();
795 Err(Error::ResponseError(ResponseContent { status, content, entity }))
796 }
797}
798
799pub async fn get_billing_credits(configuration: &configuration::Configuration, ) -> Result<models::CreditGrants, Error<GetBillingCreditsError>> {
801
802 let uri_str = format!("{}/v1/billing/credits", configuration.base_path);
803 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
804
805 if let Some(ref user_agent) = configuration.user_agent {
806 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
807 }
808 if let Some(ref token) = configuration.bearer_access_token {
809 req_builder = req_builder.bearer_auth(token.to_owned());
810 };
811
812 let req = req_builder.build()?;
813 let resp = configuration.client.execute(req).await?;
814
815 let status = resp.status();
816 let content_type = resp
817 .headers()
818 .get("content-type")
819 .and_then(|v| v.to_str().ok())
820 .unwrap_or("application/octet-stream");
821 let content_type = super::ContentType::from(content_type);
822
823 if !status.is_client_error() && !status.is_server_error() {
824 let content = resp.text().await?;
825 match content_type {
826 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
827 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreditGrants`"))),
828 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreditGrants`")))),
829 }
830 } else {
831 let content = resp.text().await?;
832 let entity: Option<GetBillingCreditsError> = serde_json::from_str(&content).ok();
833 Err(Error::ResponseError(ResponseContent { status, content, entity }))
834 }
835}
836
837pub async fn get_billing_crypto_deposit_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::CryptoDeposit, Error<GetBillingCryptoDepositByIdError>> {
839 let p_id = id;
841
842 let uri_str = format!("{}/v1/billing/crypto/deposit/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
843 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
844
845 if let Some(ref user_agent) = configuration.user_agent {
846 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
847 }
848 if let Some(ref token) = configuration.bearer_access_token {
849 req_builder = req_builder.bearer_auth(token.to_owned());
850 };
851
852 let req = req_builder.build()?;
853 let resp = configuration.client.execute(req).await?;
854
855 let status = resp.status();
856 let content_type = resp
857 .headers()
858 .get("content-type")
859 .and_then(|v| v.to_str().ok())
860 .unwrap_or("application/octet-stream");
861 let content_type = super::ContentType::from(content_type);
862
863 if !status.is_client_error() && !status.is_server_error() {
864 let content = resp.text().await?;
865 match content_type {
866 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
867 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CryptoDeposit`"))),
868 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CryptoDeposit`")))),
869 }
870 } else {
871 let content = resp.text().await?;
872 let entity: Option<GetBillingCryptoDepositByIdError> = serde_json::from_str(&content).ok();
873 Err(Error::ResponseError(ResponseContent { status, content, entity }))
874 }
875}
876
877pub async fn get_billing_crypto_options(configuration: &configuration::Configuration, ) -> Result<models::CryptoOptions, Error<GetBillingCryptoOptionsError>> {
879
880 let uri_str = format!("{}/v1/billing/crypto/options", configuration.base_path);
881 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
882
883 if let Some(ref user_agent) = configuration.user_agent {
884 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
885 }
886 if let Some(ref token) = configuration.bearer_access_token {
887 req_builder = req_builder.bearer_auth(token.to_owned());
888 };
889
890 let req = req_builder.build()?;
891 let resp = configuration.client.execute(req).await?;
892
893 let status = resp.status();
894 let content_type = resp
895 .headers()
896 .get("content-type")
897 .and_then(|v| v.to_str().ok())
898 .unwrap_or("application/octet-stream");
899 let content_type = super::ContentType::from(content_type);
900
901 if !status.is_client_error() && !status.is_server_error() {
902 let content = resp.text().await?;
903 match content_type {
904 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
905 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CryptoOptions`"))),
906 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CryptoOptions`")))),
907 }
908 } else {
909 let content = resp.text().await?;
910 let entity: Option<GetBillingCryptoOptionsError> = serde_json::from_str(&content).ok();
911 Err(Error::ResponseError(ResponseContent { status, content, entity }))
912 }
913}
914
915pub async fn get_billing_invoices(configuration: &configuration::Configuration, ) -> Result<models::Invoices, Error<GetBillingInvoicesError>> {
917
918 let uri_str = format!("{}/v1/billing/invoices", configuration.base_path);
919 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
920
921 if let Some(ref user_agent) = configuration.user_agent {
922 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
923 }
924 if let Some(ref token) = configuration.bearer_access_token {
925 req_builder = req_builder.bearer_auth(token.to_owned());
926 };
927
928 let req = req_builder.build()?;
929 let resp = configuration.client.execute(req).await?;
930
931 let status = resp.status();
932 let content_type = resp
933 .headers()
934 .get("content-type")
935 .and_then(|v| v.to_str().ok())
936 .unwrap_or("application/octet-stream");
937 let content_type = super::ContentType::from(content_type);
938
939 if !status.is_client_error() && !status.is_server_error() {
940 let content = resp.text().await?;
941 match content_type {
942 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
943 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Invoices`"))),
944 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Invoices`")))),
945 }
946 } else {
947 let content = resp.text().await?;
948 let entity: Option<GetBillingInvoicesError> = serde_json::from_str(&content).ok();
949 Err(Error::ResponseError(ResponseContent { status, content, entity }))
950 }
951}
952
953pub async fn get_billing_invoices_by_id_pdf(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<GetBillingInvoicesByIdPdfError>> {
955 let p_id = id;
957
958 let uri_str = format!("{}/v1/billing/invoices/{id}/pdf", configuration.base_path, id=crate::apis::urlencode(p_id));
959 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
960
961 if let Some(ref user_agent) = configuration.user_agent {
962 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
963 }
964 if let Some(ref token) = configuration.bearer_access_token {
965 req_builder = req_builder.bearer_auth(token.to_owned());
966 };
967
968 let req = req_builder.build()?;
969 let resp = configuration.client.execute(req).await?;
970
971 let status = resp.status();
972
973 if !status.is_client_error() && !status.is_server_error() {
974 Ok(())
975 } else {
976 let content = resp.text().await?;
977 let entity: Option<GetBillingInvoicesByIdPdfError> = serde_json::from_str(&content).ok();
978 Err(Error::ResponseError(ResponseContent { status, content, entity }))
979 }
980}
981
982pub async fn get_billing_ledger(configuration: &configuration::Configuration, range: Option<&str>) -> Result<Vec<models::FinanceLedgerEntry>, Error<GetBillingLedgerError>> {
984 let p_range = range;
986
987 let uri_str = format!("{}/v1/billing/ledger", configuration.base_path);
988 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
989
990 if let Some(ref param_value) = p_range {
991 req_builder = req_builder.query(&[("range", ¶m_value.to_string())]);
992 }
993 if let Some(ref user_agent) = configuration.user_agent {
994 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
995 }
996 if let Some(ref token) = configuration.bearer_access_token {
997 req_builder = req_builder.bearer_auth(token.to_owned());
998 };
999
1000 let req = req_builder.build()?;
1001 let resp = configuration.client.execute(req).await?;
1002
1003 let status = resp.status();
1004 let content_type = resp
1005 .headers()
1006 .get("content-type")
1007 .and_then(|v| v.to_str().ok())
1008 .unwrap_or("application/octet-stream");
1009 let content_type = super::ContentType::from(content_type);
1010
1011 if !status.is_client_error() && !status.is_server_error() {
1012 let content = resp.text().await?;
1013 match content_type {
1014 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1015 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::FinanceLedgerEntry>`"))),
1016 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::FinanceLedgerEntry>`")))),
1017 }
1018 } else {
1019 let content = resp.text().await?;
1020 let entity: Option<GetBillingLedgerError> = serde_json::from_str(&content).ok();
1021 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1022 }
1023}
1024
1025pub async fn get_billing_methods(configuration: &configuration::Configuration, ) -> Result<(), Error<GetBillingMethodsError>> {
1027
1028 let uri_str = format!("{}/v1/billing/methods", configuration.base_path);
1029 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1030
1031 if let Some(ref user_agent) = configuration.user_agent {
1032 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1033 }
1034 if let Some(ref token) = configuration.bearer_access_token {
1035 req_builder = req_builder.bearer_auth(token.to_owned());
1036 };
1037
1038 let req = req_builder.build()?;
1039 let resp = configuration.client.execute(req).await?;
1040
1041 let status = resp.status();
1042
1043 if !status.is_client_error() && !status.is_server_error() {
1044 Ok(())
1045 } else {
1046 let content = resp.text().await?;
1047 let entity: Option<GetBillingMethodsError> = serde_json::from_str(&content).ok();
1048 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1049 }
1050}
1051
1052pub async fn get_billing_payouts(configuration: &configuration::Configuration, ) -> Result<Vec<models::Payout>, Error<GetBillingPayoutsError>> {
1054
1055 let uri_str = format!("{}/v1/billing/payouts", configuration.base_path);
1056 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1057
1058 if let Some(ref user_agent) = configuration.user_agent {
1059 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1060 }
1061 if let Some(ref token) = configuration.bearer_access_token {
1062 req_builder = req_builder.bearer_auth(token.to_owned());
1063 };
1064
1065 let req = req_builder.build()?;
1066 let resp = configuration.client.execute(req).await?;
1067
1068 let status = resp.status();
1069 let content_type = resp
1070 .headers()
1071 .get("content-type")
1072 .and_then(|v| v.to_str().ok())
1073 .unwrap_or("application/octet-stream");
1074 let content_type = super::ContentType::from(content_type);
1075
1076 if !status.is_client_error() && !status.is_server_error() {
1077 let content = resp.text().await?;
1078 match content_type {
1079 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1080 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Payout>`"))),
1081 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Payout>`")))),
1082 }
1083 } else {
1084 let content = resp.text().await?;
1085 let entity: Option<GetBillingPayoutsError> = serde_json::from_str(&content).ok();
1086 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1087 }
1088}
1089
1090pub async fn get_billing_plans(configuration: &configuration::Configuration, ) -> Result<(), Error<GetBillingPlansError>> {
1092
1093 let uri_str = format!("{}/v1/billing/plans", configuration.base_path);
1094 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1095
1096 if let Some(ref user_agent) = configuration.user_agent {
1097 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1098 }
1099 if let Some(ref token) = configuration.bearer_access_token {
1100 req_builder = req_builder.bearer_auth(token.to_owned());
1101 };
1102
1103 let req = req_builder.build()?;
1104 let resp = configuration.client.execute(req).await?;
1105
1106 let status = resp.status();
1107
1108 if !status.is_client_error() && !status.is_server_error() {
1109 Ok(())
1110 } else {
1111 let content = resp.text().await?;
1112 let entity: Option<GetBillingPlansError> = serde_json::from_str(&content).ok();
1113 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1114 }
1115}
1116
1117pub async fn get_billing_portal_methods(configuration: &configuration::Configuration, ) -> Result<(), Error<GetBillingPortalMethodsError>> {
1119
1120 let uri_str = format!("{}/v1/billing/portal/methods", configuration.base_path);
1121 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1122
1123 if let Some(ref user_agent) = configuration.user_agent {
1124 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1125 }
1126 if let Some(ref token) = configuration.bearer_access_token {
1127 req_builder = req_builder.bearer_auth(token.to_owned());
1128 };
1129
1130 let req = req_builder.build()?;
1131 let resp = configuration.client.execute(req).await?;
1132
1133 let status = resp.status();
1134
1135 if !status.is_client_error() && !status.is_server_error() {
1136 Ok(())
1137 } else {
1138 let content = resp.text().await?;
1139 let entity: Option<GetBillingPortalMethodsError> = serde_json::from_str(&content).ok();
1140 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1141 }
1142}
1143
1144pub async fn get_billing_settings(configuration: &configuration::Configuration, ) -> Result<models::PaymentConfig, Error<GetBillingSettingsError>> {
1146
1147 let uri_str = format!("{}/v1/billing/settings", configuration.base_path);
1148 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1149
1150 if let Some(ref user_agent) = configuration.user_agent {
1151 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1152 }
1153 if let Some(ref token) = configuration.bearer_access_token {
1154 req_builder = req_builder.bearer_auth(token.to_owned());
1155 };
1156
1157 let req = req_builder.build()?;
1158 let resp = configuration.client.execute(req).await?;
1159
1160 let status = resp.status();
1161 let content_type = resp
1162 .headers()
1163 .get("content-type")
1164 .and_then(|v| v.to_str().ok())
1165 .unwrap_or("application/octet-stream");
1166 let content_type = super::ContentType::from(content_type);
1167
1168 if !status.is_client_error() && !status.is_server_error() {
1169 let content = resp.text().await?;
1170 match content_type {
1171 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1172 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaymentConfig`"))),
1173 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaymentConfig`")))),
1174 }
1175 } else {
1176 let content = resp.text().await?;
1177 let entity: Option<GetBillingSettingsError> = serde_json::from_str(&content).ok();
1178 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1179 }
1180}
1181
1182pub async fn get_billing_subscriptions(configuration: &configuration::Configuration, ) -> Result<models::Subscriptions, Error<GetBillingSubscriptionsError>> {
1184
1185 let uri_str = format!("{}/v1/billing/subscriptions", configuration.base_path);
1186 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1187
1188 if let Some(ref user_agent) = configuration.user_agent {
1189 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1190 }
1191 if let Some(ref token) = configuration.bearer_access_token {
1192 req_builder = req_builder.bearer_auth(token.to_owned());
1193 };
1194
1195 let req = req_builder.build()?;
1196 let resp = configuration.client.execute(req).await?;
1197
1198 let status = resp.status();
1199 let content_type = resp
1200 .headers()
1201 .get("content-type")
1202 .and_then(|v| v.to_str().ok())
1203 .unwrap_or("application/octet-stream");
1204 let content_type = super::ContentType::from(content_type);
1205
1206 if !status.is_client_error() && !status.is_server_error() {
1207 let content = resp.text().await?;
1208 match content_type {
1209 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1210 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Subscriptions`"))),
1211 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Subscriptions`")))),
1212 }
1213 } else {
1214 let content = resp.text().await?;
1215 let entity: Option<GetBillingSubscriptionsError> = serde_json::from_str(&content).ok();
1216 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1217 }
1218}
1219
1220pub async fn get_billing_tier(configuration: &configuration::Configuration, ) -> Result<models::Tier, Error<GetBillingTierError>> {
1222
1223 let uri_str = format!("{}/v1/billing/tier", configuration.base_path);
1224 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1225
1226 if let Some(ref user_agent) = configuration.user_agent {
1227 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1228 }
1229 if let Some(ref token) = configuration.bearer_access_token {
1230 req_builder = req_builder.bearer_auth(token.to_owned());
1231 };
1232
1233 let req = req_builder.build()?;
1234 let resp = configuration.client.execute(req).await?;
1235
1236 let status = resp.status();
1237 let content_type = resp
1238 .headers()
1239 .get("content-type")
1240 .and_then(|v| v.to_str().ok())
1241 .unwrap_or("application/octet-stream");
1242 let content_type = super::ContentType::from(content_type);
1243
1244 if !status.is_client_error() && !status.is_server_error() {
1245 let content = resp.text().await?;
1246 match content_type {
1247 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1248 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Tier`"))),
1249 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Tier`")))),
1250 }
1251 } else {
1252 let content = resp.text().await?;
1253 let entity: Option<GetBillingTierError> = serde_json::from_str(&content).ok();
1254 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1255 }
1256}
1257
1258pub async fn get_billing_transactions(configuration: &configuration::Configuration, currency: Option<&str>, limit: Option<&str>, offset: Option<&str>) -> Result<models::Transactions, Error<GetBillingTransactionsError>> {
1260 let p_currency = currency;
1262 let p_limit = limit;
1263 let p_offset = offset;
1264
1265 let uri_str = format!("{}/v1/billing/transactions", configuration.base_path);
1266 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1267
1268 if let Some(ref param_value) = p_currency {
1269 req_builder = req_builder.query(&[("currency", ¶m_value.to_string())]);
1270 }
1271 if let Some(ref param_value) = p_limit {
1272 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1273 }
1274 if let Some(ref param_value) = p_offset {
1275 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
1276 }
1277 if let Some(ref user_agent) = configuration.user_agent {
1278 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1279 }
1280 if let Some(ref token) = configuration.bearer_access_token {
1281 req_builder = req_builder.bearer_auth(token.to_owned());
1282 };
1283
1284 let req = req_builder.build()?;
1285 let resp = configuration.client.execute(req).await?;
1286
1287 let status = resp.status();
1288 let content_type = resp
1289 .headers()
1290 .get("content-type")
1291 .and_then(|v| v.to_str().ok())
1292 .unwrap_or("application/octet-stream");
1293 let content_type = super::ContentType::from(content_type);
1294
1295 if !status.is_client_error() && !status.is_server_error() {
1296 let content = resp.text().await?;
1297 match content_type {
1298 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1299 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Transactions`"))),
1300 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Transactions`")))),
1301 }
1302 } else {
1303 let content = resp.text().await?;
1304 let entity: Option<GetBillingTransactionsError> = serde_json::from_str(&content).ok();
1305 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1306 }
1307}
1308
1309pub async fn get_billing_usage(configuration: &configuration::Configuration, ) -> Result<(), Error<GetBillingUsageError>> {
1311
1312 let uri_str = format!("{}/v1/billing/usage", configuration.base_path);
1313 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1314
1315 if let Some(ref user_agent) = configuration.user_agent {
1316 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1317 }
1318 if let Some(ref token) = configuration.bearer_access_token {
1319 req_builder = req_builder.bearer_auth(token.to_owned());
1320 };
1321
1322 let req = req_builder.build()?;
1323 let resp = configuration.client.execute(req).await?;
1324
1325 let status = resp.status();
1326
1327 if !status.is_client_error() && !status.is_server_error() {
1328 Ok(())
1329 } else {
1330 let content = resp.text().await?;
1331 let entity: Option<GetBillingUsageError> = serde_json::from_str(&content).ok();
1332 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1333 }
1334}
1335
1336pub async fn get_billing_usage_accounts(configuration: &configuration::Configuration, ) -> Result<models::Accounts, Error<GetBillingUsageAccountsError>> {
1338
1339 let uri_str = format!("{}/v1/billing/usage/accounts", configuration.base_path);
1340 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1341
1342 if let Some(ref user_agent) = configuration.user_agent {
1343 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1344 }
1345 if let Some(ref token) = configuration.bearer_access_token {
1346 req_builder = req_builder.bearer_auth(token.to_owned());
1347 };
1348
1349 let req = req_builder.build()?;
1350 let resp = configuration.client.execute(req).await?;
1351
1352 let status = resp.status();
1353 let content_type = resp
1354 .headers()
1355 .get("content-type")
1356 .and_then(|v| v.to_str().ok())
1357 .unwrap_or("application/octet-stream");
1358 let content_type = super::ContentType::from(content_type);
1359
1360 if !status.is_client_error() && !status.is_server_error() {
1361 let content = resp.text().await?;
1362 match content_type {
1363 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1364 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Accounts`"))),
1365 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Accounts`")))),
1366 }
1367 } else {
1368 let content = resp.text().await?;
1369 let entity: Option<GetBillingUsageAccountsError> = serde_json::from_str(&content).ok();
1370 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1371 }
1372}
1373
1374pub async fn get_billing_usage_rollup(configuration: &configuration::Configuration, ) -> Result<models::Rollup, Error<GetBillingUsageRollupError>> {
1376
1377 let uri_str = format!("{}/v1/billing/usage/rollup", configuration.base_path);
1378 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1379
1380 if let Some(ref user_agent) = configuration.user_agent {
1381 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1382 }
1383 if let Some(ref token) = configuration.bearer_access_token {
1384 req_builder = req_builder.bearer_auth(token.to_owned());
1385 };
1386
1387 let req = req_builder.build()?;
1388 let resp = configuration.client.execute(req).await?;
1389
1390 let status = resp.status();
1391 let content_type = resp
1392 .headers()
1393 .get("content-type")
1394 .and_then(|v| v.to_str().ok())
1395 .unwrap_or("application/octet-stream");
1396 let content_type = super::ContentType::from(content_type);
1397
1398 if !status.is_client_error() && !status.is_server_error() {
1399 let content = resp.text().await?;
1400 match content_type {
1401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Rollup`"))),
1403 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Rollup`")))),
1404 }
1405 } else {
1406 let content = resp.text().await?;
1407 let entity: Option<GetBillingUsageRollupError> = serde_json::from_str(&content).ok();
1408 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1409 }
1410}
1411
1412pub async fn get_billing_wire(configuration: &configuration::Configuration, ) -> Result<models::WireInstructions, Error<GetBillingWireError>> {
1414
1415 let uri_str = format!("{}/v1/billing/wire", configuration.base_path);
1416 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1417
1418 if let Some(ref user_agent) = configuration.user_agent {
1419 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1420 }
1421 if let Some(ref token) = configuration.bearer_access_token {
1422 req_builder = req_builder.bearer_auth(token.to_owned());
1423 };
1424
1425 let req = req_builder.build()?;
1426 let resp = configuration.client.execute(req).await?;
1427
1428 let status = resp.status();
1429 let content_type = resp
1430 .headers()
1431 .get("content-type")
1432 .and_then(|v| v.to_str().ok())
1433 .unwrap_or("application/octet-stream");
1434 let content_type = super::ContentType::from(content_type);
1435
1436 if !status.is_client_error() && !status.is_server_error() {
1437 let content = resp.text().await?;
1438 match content_type {
1439 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1440 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WireInstructions`"))),
1441 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WireInstructions`")))),
1442 }
1443 } else {
1444 let content = resp.text().await?;
1445 let entity: Option<GetBillingWireError> = serde_json::from_str(&content).ok();
1446 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1447 }
1448}
1449
1450pub async fn get_invoice(configuration: &configuration::Configuration, id: &str) -> Result<models::Invoice, Error<GetInvoiceError>> {
1452 let p_id = id;
1454
1455 let uri_str = format!("{}/v1/billing/invoices/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
1456 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1457
1458 if let Some(ref user_agent) = configuration.user_agent {
1459 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1460 }
1461 if let Some(ref token) = configuration.bearer_access_token {
1462 req_builder = req_builder.bearer_auth(token.to_owned());
1463 };
1464
1465 let req = req_builder.build()?;
1466 let resp = configuration.client.execute(req).await?;
1467
1468 let status = resp.status();
1469 let content_type = resp
1470 .headers()
1471 .get("content-type")
1472 .and_then(|v| v.to_str().ok())
1473 .unwrap_or("application/octet-stream");
1474 let content_type = super::ContentType::from(content_type);
1475
1476 if !status.is_client_error() && !status.is_server_error() {
1477 let content = resp.text().await?;
1478 match content_type {
1479 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1480 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Invoice`"))),
1481 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Invoice`")))),
1482 }
1483 } else {
1484 let content = resp.text().await?;
1485 let entity: Option<GetInvoiceError> = serde_json::from_str(&content).ok();
1486 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1487 }
1488}
1489
1490pub async fn issue_invoice(configuration: &configuration::Configuration, id: &str) -> Result<models::Invoice, Error<IssueInvoiceError>> {
1492 let p_id = id;
1494
1495 let uri_str = format!("{}/v1/billing/invoices/{id}/issue", configuration.base_path, id=crate::apis::urlencode(p_id));
1496 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1497
1498 if let Some(ref user_agent) = configuration.user_agent {
1499 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1500 }
1501 if let Some(ref token) = configuration.bearer_access_token {
1502 req_builder = req_builder.bearer_auth(token.to_owned());
1503 };
1504
1505 let req = req_builder.build()?;
1506 let resp = configuration.client.execute(req).await?;
1507
1508 let status = resp.status();
1509 let content_type = resp
1510 .headers()
1511 .get("content-type")
1512 .and_then(|v| v.to_str().ok())
1513 .unwrap_or("application/octet-stream");
1514 let content_type = super::ContentType::from(content_type);
1515
1516 if !status.is_client_error() && !status.is_server_error() {
1517 let content = resp.text().await?;
1518 match content_type {
1519 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1520 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Invoice`"))),
1521 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Invoice`")))),
1522 }
1523 } else {
1524 let content = resp.text().await?;
1525 let entity: Option<IssueInvoiceError> = serde_json::from_str(&content).ok();
1526 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1527 }
1528}
1529
1530pub async fn patch_billing_alerts_by_id(configuration: &configuration::Configuration, id: &str, alert_patch: models::AlertPatch) -> Result<models::Alert, Error<PatchBillingAlertsByIdError>> {
1532 let p_id = id;
1534 let p_alert_patch = alert_patch;
1535
1536 let uri_str = format!("{}/v1/billing/alerts/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
1537 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1538
1539 if let Some(ref user_agent) = configuration.user_agent {
1540 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1541 }
1542 if let Some(ref token) = configuration.bearer_access_token {
1543 req_builder = req_builder.bearer_auth(token.to_owned());
1544 };
1545 req_builder = req_builder.json(&p_alert_patch);
1546
1547 let req = req_builder.build()?;
1548 let resp = configuration.client.execute(req).await?;
1549
1550 let status = resp.status();
1551 let content_type = resp
1552 .headers()
1553 .get("content-type")
1554 .and_then(|v| v.to_str().ok())
1555 .unwrap_or("application/octet-stream");
1556 let content_type = super::ContentType::from(content_type);
1557
1558 if !status.is_client_error() && !status.is_server_error() {
1559 let content = resp.text().await?;
1560 match content_type {
1561 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1562 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Alert`"))),
1563 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Alert`")))),
1564 }
1565 } else {
1566 let content = resp.text().await?;
1567 let entity: Option<PatchBillingAlertsByIdError> = serde_json::from_str(&content).ok();
1568 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1569 }
1570}
1571
1572pub async fn post_billing_alerts(configuration: &configuration::Configuration, alert_spec: models::AlertSpec) -> Result<models::Alert, Error<PostBillingAlertsError>> {
1574 let p_alert_spec = alert_spec;
1576
1577 let uri_str = format!("{}/v1/billing/alerts", configuration.base_path);
1578 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1579
1580 if let Some(ref user_agent) = configuration.user_agent {
1581 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1582 }
1583 if let Some(ref token) = configuration.bearer_access_token {
1584 req_builder = req_builder.bearer_auth(token.to_owned());
1585 };
1586 req_builder = req_builder.json(&p_alert_spec);
1587
1588 let req = req_builder.build()?;
1589 let resp = configuration.client.execute(req).await?;
1590
1591 let status = resp.status();
1592 let content_type = resp
1593 .headers()
1594 .get("content-type")
1595 .and_then(|v| v.to_str().ok())
1596 .unwrap_or("application/octet-stream");
1597 let content_type = super::ContentType::from(content_type);
1598
1599 if !status.is_client_error() && !status.is_server_error() {
1600 let content = resp.text().await?;
1601 match content_type {
1602 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1603 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Alert`"))),
1604 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Alert`")))),
1605 }
1606 } else {
1607 let content = resp.text().await?;
1608 let entity: Option<PostBillingAlertsError> = serde_json::from_str(&content).ok();
1609 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1610 }
1611}
1612
1613pub async fn post_billing_crypto_deposit(configuration: &configuration::Configuration, crypto_asset: models::CryptoAsset) -> Result<models::CryptoDeposit, Error<PostBillingCryptoDepositError>> {
1615 let p_crypto_asset = crypto_asset;
1617
1618 let uri_str = format!("{}/v1/billing/crypto/deposit", configuration.base_path);
1619 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1620
1621 if let Some(ref user_agent) = configuration.user_agent {
1622 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1623 }
1624 if let Some(ref token) = configuration.bearer_access_token {
1625 req_builder = req_builder.bearer_auth(token.to_owned());
1626 };
1627 req_builder = req_builder.json(&p_crypto_asset);
1628
1629 let req = req_builder.build()?;
1630 let resp = configuration.client.execute(req).await?;
1631
1632 let status = resp.status();
1633 let content_type = resp
1634 .headers()
1635 .get("content-type")
1636 .and_then(|v| v.to_str().ok())
1637 .unwrap_or("application/octet-stream");
1638 let content_type = super::ContentType::from(content_type);
1639
1640 if !status.is_client_error() && !status.is_server_error() {
1641 let content = resp.text().await?;
1642 match content_type {
1643 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1644 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CryptoDeposit`"))),
1645 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CryptoDeposit`")))),
1646 }
1647 } else {
1648 let content = resp.text().await?;
1649 let entity: Option<PostBillingCryptoDepositError> = serde_json::from_str(&content).ok();
1650 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1651 }
1652}
1653
1654pub async fn post_billing_methods(configuration: &configuration::Configuration, ) -> Result<(), Error<PostBillingMethodsError>> {
1656
1657 let uri_str = format!("{}/v1/billing/methods", configuration.base_path);
1658 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1659
1660 if let Some(ref user_agent) = configuration.user_agent {
1661 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1662 }
1663 if let Some(ref token) = configuration.bearer_access_token {
1664 req_builder = req_builder.bearer_auth(token.to_owned());
1665 };
1666
1667 let req = req_builder.build()?;
1668 let resp = configuration.client.execute(req).await?;
1669
1670 let status = resp.status();
1671
1672 if !status.is_client_error() && !status.is_server_error() {
1673 Ok(())
1674 } else {
1675 let content = resp.text().await?;
1676 let entity: Option<PostBillingMethodsError> = serde_json::from_str(&content).ok();
1677 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1678 }
1679}
1680
1681pub async fn post_billing_mode(configuration: &configuration::Configuration, mode_in: models::ModeIn) -> Result<models::Mode, Error<PostBillingModeError>> {
1683 let p_mode_in = mode_in;
1685
1686 let uri_str = format!("{}/v1/billing/mode", configuration.base_path);
1687 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1688
1689 if let Some(ref user_agent) = configuration.user_agent {
1690 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1691 }
1692 if let Some(ref token) = configuration.bearer_access_token {
1693 req_builder = req_builder.bearer_auth(token.to_owned());
1694 };
1695 req_builder = req_builder.json(&p_mode_in);
1696
1697 let req = req_builder.build()?;
1698 let resp = configuration.client.execute(req).await?;
1699
1700 let status = resp.status();
1701 let content_type = resp
1702 .headers()
1703 .get("content-type")
1704 .and_then(|v| v.to_str().ok())
1705 .unwrap_or("application/octet-stream");
1706 let content_type = super::ContentType::from(content_type);
1707
1708 if !status.is_client_error() && !status.is_server_error() {
1709 let content = resp.text().await?;
1710 match content_type {
1711 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1712 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Mode`"))),
1713 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Mode`")))),
1714 }
1715 } else {
1716 let content = resp.text().await?;
1717 let entity: Option<PostBillingModeError> = serde_json::from_str(&content).ok();
1718 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1719 }
1720}
1721
1722pub async fn post_billing_portal_methods(configuration: &configuration::Configuration, ) -> Result<(), Error<PostBillingPortalMethodsError>> {
1724
1725 let uri_str = format!("{}/v1/billing/portal/methods", configuration.base_path);
1726 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1727
1728 if let Some(ref user_agent) = configuration.user_agent {
1729 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1730 }
1731 if let Some(ref token) = configuration.bearer_access_token {
1732 req_builder = req_builder.bearer_auth(token.to_owned());
1733 };
1734
1735 let req = req_builder.build()?;
1736 let resp = configuration.client.execute(req).await?;
1737
1738 let status = resp.status();
1739
1740 if !status.is_client_error() && !status.is_server_error() {
1741 Ok(())
1742 } else {
1743 let content = resp.text().await?;
1744 let entity: Option<PostBillingPortalMethodsError> = serde_json::from_str(&content).ok();
1745 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1746 }
1747}
1748
1749pub async fn post_billing_recharge_run_all(configuration: &configuration::Configuration, ) -> Result<models::Recharge, Error<PostBillingRechargeRunAllError>> {
1751
1752 let uri_str = format!("{}/v1/billing/recharge/run-all", configuration.base_path);
1753 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1754
1755 if let Some(ref user_agent) = configuration.user_agent {
1756 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1757 }
1758 if let Some(ref token) = configuration.bearer_access_token {
1759 req_builder = req_builder.bearer_auth(token.to_owned());
1760 };
1761
1762 let req = req_builder.build()?;
1763 let resp = configuration.client.execute(req).await?;
1764
1765 let status = resp.status();
1766 let content_type = resp
1767 .headers()
1768 .get("content-type")
1769 .and_then(|v| v.to_str().ok())
1770 .unwrap_or("application/octet-stream");
1771 let content_type = super::ContentType::from(content_type);
1772
1773 if !status.is_client_error() && !status.is_server_error() {
1774 let content = resp.text().await?;
1775 match content_type {
1776 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1777 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Recharge`"))),
1778 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Recharge`")))),
1779 }
1780 } else {
1781 let content = resp.text().await?;
1782 let entity: Option<PostBillingRechargeRunAllError> = serde_json::from_str(&content).ok();
1783 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1784 }
1785}
1786
1787pub async fn post_billing_subscribe_card(configuration: &configuration::Configuration, ) -> Result<(), Error<PostBillingSubscribeCardError>> {
1789
1790 let uri_str = format!("{}/v1/billing/subscribe/card", configuration.base_path);
1791 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1792
1793 if let Some(ref user_agent) = configuration.user_agent {
1794 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1795 }
1796 if let Some(ref token) = configuration.bearer_access_token {
1797 req_builder = req_builder.bearer_auth(token.to_owned());
1798 };
1799
1800 let req = req_builder.build()?;
1801 let resp = configuration.client.execute(req).await?;
1802
1803 let status = resp.status();
1804
1805 if !status.is_client_error() && !status.is_server_error() {
1806 Ok(())
1807 } else {
1808 let content = resp.text().await?;
1809 let entity: Option<PostBillingSubscribeCardError> = serde_json::from_str(&content).ok();
1810 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1811 }
1812}
1813
1814pub async fn post_billing_topup(configuration: &configuration::Configuration, topup_in: models::TopupIn, x_idempotency_key: Option<&str>) -> Result<models::Charged, Error<PostBillingTopupError>> {
1816 let p_topup_in = topup_in;
1818 let p_x_idempotency_key = x_idempotency_key;
1819
1820 let uri_str = format!("{}/v1/billing/topup", configuration.base_path);
1821 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1822
1823 if let Some(ref user_agent) = configuration.user_agent {
1824 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1825 }
1826 if let Some(param_value) = p_x_idempotency_key {
1827 req_builder = req_builder.header("X-Idempotency-Key", param_value.to_string());
1828 }
1829 if let Some(ref token) = configuration.bearer_access_token {
1830 req_builder = req_builder.bearer_auth(token.to_owned());
1831 };
1832 req_builder = req_builder.json(&p_topup_in);
1833
1834 let req = req_builder.build()?;
1835 let resp = configuration.client.execute(req).await?;
1836
1837 let status = resp.status();
1838 let content_type = resp
1839 .headers()
1840 .get("content-type")
1841 .and_then(|v| v.to_str().ok())
1842 .unwrap_or("application/octet-stream");
1843 let content_type = super::ContentType::from(content_type);
1844
1845 if !status.is_client_error() && !status.is_server_error() {
1846 let content = resp.text().await?;
1847 match content_type {
1848 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1849 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Charged`"))),
1850 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Charged`")))),
1851 }
1852 } else {
1853 let content = resp.text().await?;
1854 let entity: Option<PostBillingTopupError> = serde_json::from_str(&content).ok();
1855 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1856 }
1857}
1858
1859pub async fn post_billing_topup_token(configuration: &configuration::Configuration, topup_in: models::TopupIn, x_idempotency_key: Option<&str>) -> Result<models::Charged, Error<PostBillingTopupTokenError>> {
1861 let p_topup_in = topup_in;
1863 let p_x_idempotency_key = x_idempotency_key;
1864
1865 let uri_str = format!("{}/v1/billing/topup/token", configuration.base_path);
1866 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1867
1868 if let Some(ref user_agent) = configuration.user_agent {
1869 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1870 }
1871 if let Some(param_value) = p_x_idempotency_key {
1872 req_builder = req_builder.header("X-Idempotency-Key", param_value.to_string());
1873 }
1874 if let Some(ref token) = configuration.bearer_access_token {
1875 req_builder = req_builder.bearer_auth(token.to_owned());
1876 };
1877 req_builder = req_builder.json(&p_topup_in);
1878
1879 let req = req_builder.build()?;
1880 let resp = configuration.client.execute(req).await?;
1881
1882 let status = resp.status();
1883 let content_type = resp
1884 .headers()
1885 .get("content-type")
1886 .and_then(|v| v.to_str().ok())
1887 .unwrap_or("application/octet-stream");
1888 let content_type = super::ContentType::from(content_type);
1889
1890 if !status.is_client_error() && !status.is_server_error() {
1891 let content = resp.text().await?;
1892 match content_type {
1893 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1894 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Charged`"))),
1895 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Charged`")))),
1896 }
1897 } else {
1898 let content = resp.text().await?;
1899 let entity: Option<PostBillingTopupTokenError> = serde_json::from_str(&content).ok();
1900 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1901 }
1902}
1903
1904pub async fn raise_invoice(configuration: &configuration::Configuration, raise_in: models::RaiseIn) -> Result<models::Invoice, Error<RaiseInvoiceError>> {
1906 let p_raise_in = raise_in;
1908
1909 let uri_str = format!("{}/v1/billing/invoices", configuration.base_path);
1910 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1911
1912 if let Some(ref user_agent) = configuration.user_agent {
1913 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1914 }
1915 if let Some(ref token) = configuration.bearer_access_token {
1916 req_builder = req_builder.bearer_auth(token.to_owned());
1917 };
1918 req_builder = req_builder.json(&p_raise_in);
1919
1920 let req = req_builder.build()?;
1921 let resp = configuration.client.execute(req).await?;
1922
1923 let status = resp.status();
1924 let content_type = resp
1925 .headers()
1926 .get("content-type")
1927 .and_then(|v| v.to_str().ok())
1928 .unwrap_or("application/octet-stream");
1929 let content_type = super::ContentType::from(content_type);
1930
1931 if !status.is_client_error() && !status.is_server_error() {
1932 let content = resp.text().await?;
1933 match content_type {
1934 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1935 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Invoice`"))),
1936 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Invoice`")))),
1937 }
1938 } else {
1939 let content = resp.text().await?;
1940 let entity: Option<RaiseInvoiceError> = serde_json::from_str(&content).ok();
1941 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1942 }
1943}
1944
1945pub async fn reactivate_subscription(configuration: &configuration::Configuration, id: &str, subscription_ref: models::SubscriptionRef) -> Result<models::Subscription, Error<ReactivateSubscriptionError>> {
1947 let p_id = id;
1949 let p_subscription_ref = subscription_ref;
1950
1951 let uri_str = format!("{}/v1/billing/subscriptions/{id}/reactivate", configuration.base_path, id=crate::apis::urlencode(p_id));
1952 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1953
1954 if let Some(ref user_agent) = configuration.user_agent {
1955 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1956 }
1957 if let Some(ref token) = configuration.bearer_access_token {
1958 req_builder = req_builder.bearer_auth(token.to_owned());
1959 };
1960 req_builder = req_builder.json(&p_subscription_ref);
1961
1962 let req = req_builder.build()?;
1963 let resp = configuration.client.execute(req).await?;
1964
1965 let status = resp.status();
1966 let content_type = resp
1967 .headers()
1968 .get("content-type")
1969 .and_then(|v| v.to_str().ok())
1970 .unwrap_or("application/octet-stream");
1971 let content_type = super::ContentType::from(content_type);
1972
1973 if !status.is_client_error() && !status.is_server_error() {
1974 let content = resp.text().await?;
1975 match content_type {
1976 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1977 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Subscription`"))),
1978 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Subscription`")))),
1979 }
1980 } else {
1981 let content = resp.text().await?;
1982 let entity: Option<ReactivateSubscriptionError> = serde_json::from_str(&content).ok();
1983 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1984 }
1985}
1986
1987pub async fn void_invoice(configuration: &configuration::Configuration, id: &str) -> Result<models::Invoice, Error<VoidInvoiceError>> {
1989 let p_id = id;
1991
1992 let uri_str = format!("{}/v1/billing/invoices/{id}/void", configuration.base_path, id=crate::apis::urlencode(p_id));
1993 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1994
1995 if let Some(ref user_agent) = configuration.user_agent {
1996 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1997 }
1998 if let Some(ref token) = configuration.bearer_access_token {
1999 req_builder = req_builder.bearer_auth(token.to_owned());
2000 };
2001
2002 let req = req_builder.build()?;
2003 let resp = configuration.client.execute(req).await?;
2004
2005 let status = resp.status();
2006 let content_type = resp
2007 .headers()
2008 .get("content-type")
2009 .and_then(|v| v.to_str().ok())
2010 .unwrap_or("application/octet-stream");
2011 let content_type = super::ContentType::from(content_type);
2012
2013 if !status.is_client_error() && !status.is_server_error() {
2014 let content = resp.text().await?;
2015 match content_type {
2016 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2017 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Invoice`"))),
2018 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Invoice`")))),
2019 }
2020 } else {
2021 let content = resp.text().await?;
2022 let entity: Option<VoidInvoiceError> = serde_json::from_str(&content).ok();
2023 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2024 }
2025}
2026