1use super::{configuration, Error};
2use crate::{apis::ResponseContent, models};
3use reqwest::StatusCode;
4use serde::{de, Deserialize, Deserializer, Serialize};
5
6#[derive(Clone, Debug)]
8pub struct BuyGemsParams {
9 pub purchase_gems_request_schema: models::PurchaseGemsRequestSchema,
10}
11
12impl BuyGemsParams {
13 pub fn new(purchase_gems_request_schema: models::PurchaseGemsRequestSchema) -> Self {
14 Self {
15 purchase_gems_request_schema,
16 }
17 }
18}
19
20#[derive(Clone, Debug)]
22pub struct BuySubscriptionStripeParams {
23 pub subscribe_request_schema: models::SubscribeRequestSchema,
24}
25
26impl BuySubscriptionStripeParams {
27 pub fn new(subscribe_request_schema: models::SubscribeRequestSchema) -> Self {
28 Self {
29 subscribe_request_schema,
30 }
31 }
32}
33
34#[derive(Clone, Debug)]
36pub struct ChangeEmailParams {
37 pub change_email_schema: models::ChangeEmailSchema,
38}
39
40impl ChangeEmailParams {
41 pub fn new(change_email_schema: models::ChangeEmailSchema) -> Self {
42 Self {
43 change_email_schema,
44 }
45 }
46}
47
48#[derive(Clone, Debug)]
50pub struct ChangePasswordParams {
51 pub change_password_schema: models::ChangePasswordSchema,
52}
53
54impl ChangePasswordParams {
55 pub fn new(change_password_schema: models::ChangePasswordSchema) -> Self {
56 Self {
57 change_password_schema,
58 }
59 }
60}
61
62#[derive(Clone, Debug)]
64pub struct GetBankItemsParams {
65 pub item_code: Option<String>,
67 pub page: Option<u32>,
69 pub size: Option<u32>,
71}
72
73impl GetBankItemsParams {
74 pub fn new(item_code: Option<String>, page: Option<u32>, size: Option<u32>) -> Self {
75 Self {
76 item_code,
77 page,
78 size,
79 }
80 }
81}
82
83#[derive(Clone, Debug)]
85pub struct GetGeHistoryParams {
86 pub id: Option<String>,
88 pub code: Option<String>,
90 pub page: Option<u32>,
92 pub size: Option<u32>,
94}
95
96impl GetGeHistoryParams {
97 pub fn new(
98 id: Option<String>,
99 code: Option<String>,
100 page: Option<u32>,
101 size: Option<u32>,
102 ) -> Self {
103 Self {
104 id,
105 code,
106 page,
107 size,
108 }
109 }
110}
111
112#[derive(Clone, Debug)]
114pub struct GetGeOrdersParams {
115 pub code: Option<String>,
117 pub r#type: Option<models::GeOrderType>,
119 pub page: Option<u32>,
121 pub size: Option<u32>,
123}
124
125impl GetGeOrdersParams {
126 pub fn new(
127 code: Option<String>,
128 r#type: Option<models::GeOrderType>,
129 page: Option<u32>,
130 size: Option<u32>,
131 ) -> Self {
132 Self {
133 code,
134 r#type,
135 page,
136 size,
137 }
138 }
139}
140
141#[derive(Clone, Debug)]
143pub struct GetPendingItemsParams {
144 pub page: Option<u32>,
146 pub size: Option<u32>,
148}
149
150impl GetPendingItemsParams {
151 pub fn new(page: Option<u32>, size: Option<u32>) -> Self {
152 Self { page, size }
153 }
154}
155
156#[derive(Debug, Clone, Serialize)]
158#[serde(untagged)]
159pub enum BuyGemsError {
160 Status404(models::ErrorResponseSchema),
162 Status422(models::ErrorResponseSchema),
164}
165
166impl<'de> Deserialize<'de> for BuyGemsError {
167 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
168 where
169 D: Deserializer<'de>,
170 {
171 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
172 match raw.error.code {
173 404 => Ok(Self::Status404(raw)),
174 422 => Ok(Self::Status422(raw)),
175 _ => Err(de::Error::custom(format!(
176 "Unexpected error code: {}",
177 raw.error.code
178 ))),
179 }
180 }
181}
182
183#[derive(Debug, Clone, Serialize)]
185#[serde(untagged)]
186pub enum BuySubscriptionStripeError {
187 Status565(models::ErrorResponseSchema),
189 Status422(models::ErrorResponseSchema),
191}
192
193impl<'de> Deserialize<'de> for BuySubscriptionStripeError {
194 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
195 where
196 D: Deserializer<'de>,
197 {
198 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
199 match raw.error.code {
200 565 => Ok(Self::Status565(raw)),
201 422 => Ok(Self::Status422(raw)),
202 _ => Err(de::Error::custom(format!(
203 "Unexpected error code: {}",
204 raw.error.code
205 ))),
206 }
207 }
208}
209
210#[derive(Debug, Clone, Serialize)]
212#[serde(untagged)]
213pub enum CancelSubscriptionError {
214 Status404(models::ErrorResponseSchema),
216 Status422(models::ErrorResponseSchema),
218}
219
220impl<'de> Deserialize<'de> for CancelSubscriptionError {
221 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
222 where
223 D: Deserializer<'de>,
224 {
225 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
226 match raw.error.code {
227 404 => Ok(Self::Status404(raw)),
228 422 => Ok(Self::Status422(raw)),
229 _ => Err(de::Error::custom(format!(
230 "Unexpected error code: {}",
231 raw.error.code
232 ))),
233 }
234 }
235}
236
237#[derive(Debug, Clone, Serialize)]
239#[serde(untagged)]
240pub enum ChangeEmailError {
241 Status463(models::ErrorResponseSchema),
243 Status457(models::ErrorResponseSchema),
245 Status422(models::ErrorResponseSchema),
247}
248
249impl<'de> Deserialize<'de> for ChangeEmailError {
250 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
251 where
252 D: Deserializer<'de>,
253 {
254 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
255 match raw.error.code {
256 463 => Ok(Self::Status463(raw)),
257 457 => Ok(Self::Status457(raw)),
258 422 => Ok(Self::Status422(raw)),
259 _ => Err(de::Error::custom(format!(
260 "Unexpected error code: {}",
261 raw.error.code
262 ))),
263 }
264 }
265}
266
267#[derive(Debug, Clone, Serialize)]
269#[serde(untagged)]
270pub enum ChangePasswordError {
271 Status458(models::ErrorResponseSchema),
273 Status459(models::ErrorResponseSchema),
275 Status422(models::ErrorResponseSchema),
277}
278
279impl<'de> Deserialize<'de> for ChangePasswordError {
280 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
281 where
282 D: Deserializer<'de>,
283 {
284 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
285 match raw.error.code {
286 458 => Ok(Self::Status458(raw)),
287 459 => Ok(Self::Status459(raw)),
288 422 => Ok(Self::Status422(raw)),
289 _ => Err(de::Error::custom(format!(
290 "Unexpected error code: {}",
291 raw.error.code
292 ))),
293 }
294 }
295}
296
297#[derive(Debug, Clone, Serialize)]
299#[serde(untagged)]
300pub enum GetAccountDetailsError {}
301
302impl<'de> Deserialize<'de> for GetAccountDetailsError {
303 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
304 where
305 D: Deserializer<'de>,
306 {
307 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
308 Err(de::Error::custom(format!(
309 "Unexpected error code: {}",
310 raw.error.code
311 )))
312 }
313}
314
315#[derive(Debug, Clone, Serialize)]
317#[serde(untagged)]
318pub enum GetBankDetailsError {}
319
320impl<'de> Deserialize<'de> for GetBankDetailsError {
321 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
322 where
323 D: Deserializer<'de>,
324 {
325 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
326 Err(de::Error::custom(format!(
327 "Unexpected error code: {}",
328 raw.error.code
329 )))
330 }
331}
332
333#[derive(Debug, Clone, Serialize)]
335#[serde(untagged)]
336pub enum GetBankItemsError {}
337
338impl<'de> Deserialize<'de> for GetBankItemsError {
339 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
340 where
341 D: Deserializer<'de>,
342 {
343 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
344 Err(de::Error::custom(format!(
345 "Unexpected error code: {}",
346 raw.error.code
347 )))
348 }
349}
350
351#[derive(Debug, Clone, Serialize)]
353#[serde(untagged)]
354pub enum GetGeHistoryError {}
355
356impl<'de> Deserialize<'de> for GetGeHistoryError {
357 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
358 where
359 D: Deserializer<'de>,
360 {
361 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
362 Err(de::Error::custom(format!(
363 "Unexpected error code: {}",
364 raw.error.code
365 )))
366 }
367}
368
369#[derive(Debug, Clone, Serialize)]
371#[serde(untagged)]
372pub enum GetGeOrdersError {}
373
374impl<'de> Deserialize<'de> for GetGeOrdersError {
375 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
376 where
377 D: Deserializer<'de>,
378 {
379 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
380 Err(de::Error::custom(format!(
381 "Unexpected error code: {}",
382 raw.error.code
383 )))
384 }
385}
386
387#[derive(Debug, Clone, Serialize)]
389#[serde(untagged)]
390pub enum GetMyGemsHistoryError {}
391
392impl<'de> Deserialize<'de> for GetMyGemsHistoryError {
393 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
394 where
395 D: Deserializer<'de>,
396 {
397 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
398 Err(de::Error::custom(format!(
399 "Unexpected error code: {}",
400 raw.error.code
401 )))
402 }
403}
404
405#[derive(Debug, Clone, Serialize)]
407#[serde(untagged)]
408pub enum GetMyPurchaseHistoryError {}
409
410impl<'de> Deserialize<'de> for GetMyPurchaseHistoryError {
411 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
412 where
413 D: Deserializer<'de>,
414 {
415 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
416 Err(de::Error::custom(format!(
417 "Unexpected error code: {}",
418 raw.error.code
419 )))
420 }
421}
422
423#[derive(Debug, Clone, Serialize)]
425#[serde(untagged)]
426pub enum GetMySubscriptionError {
427 Status404(models::ErrorResponseSchema),
429}
430
431impl<'de> Deserialize<'de> for GetMySubscriptionError {
432 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
433 where
434 D: Deserializer<'de>,
435 {
436 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
437 match raw.error.code {
438 404 => Ok(Self::Status404(raw)),
439 _ => Err(de::Error::custom(format!(
440 "Unexpected error code: {}",
441 raw.error.code
442 ))),
443 }
444 }
445}
446
447#[derive(Debug, Clone, Serialize)]
449#[serde(untagged)]
450pub enum GetPendingItemsError {}
451
452impl<'de> Deserialize<'de> for GetPendingItemsError {
453 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
454 where
455 D: Deserializer<'de>,
456 {
457 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
458 Err(de::Error::custom(format!(
459 "Unexpected error code: {}",
460 raw.error.code
461 )))
462 }
463}
464
465#[derive(Debug, Clone, Serialize)]
467#[serde(untagged)]
468pub enum GetRateLimitsError {}
469
470impl<'de> Deserialize<'de> for GetRateLimitsError {
471 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
472 where
473 D: Deserializer<'de>,
474 {
475 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
476 Err(de::Error::custom(format!(
477 "Unexpected error code: {}",
478 raw.error.code
479 )))
480 }
481}
482
483#[derive(Debug, Clone, Serialize)]
485#[serde(untagged)]
486pub enum SubscribeWithMemberTokenError {
487 Status572(models::ErrorResponseSchema),
489 Status573(models::ErrorResponseSchema),
491 Status422(models::ErrorResponseSchema),
493}
494
495impl<'de> Deserialize<'de> for SubscribeWithMemberTokenError {
496 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
497 where
498 D: Deserializer<'de>,
499 {
500 let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
501 match raw.error.code {
502 572 => Ok(Self::Status572(raw)),
503 573 => Ok(Self::Status573(raw)),
504 422 => Ok(Self::Status422(raw)),
505 _ => Err(de::Error::custom(format!(
506 "Unexpected error code: {}",
507 raw.error.code
508 ))),
509 }
510 }
511}
512
513pub async fn buy_gems(
515 configuration: &configuration::Configuration,
516 params: BuyGemsParams,
517) -> Result<models::CheckoutResponseWrapperSchema, Error<BuyGemsError>> {
518 let local_var_configuration = configuration;
519
520 let purchase_gems_request_schema = params.purchase_gems_request_schema;
522
523 let local_var_client = &local_var_configuration.client;
524
525 let local_var_uri_str = format!("{}/my/buy_gems", local_var_configuration.base_path);
526 let mut local_var_req_builder =
527 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
528
529 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
530 local_var_req_builder =
531 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
532 }
533 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
534 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
535 };
536 local_var_req_builder = local_var_req_builder.json(&purchase_gems_request_schema);
537
538 let local_var_req = local_var_req_builder.build()?;
539 let local_var_resp = local_var_client.execute(local_var_req).await?;
540
541 let local_var_status = local_var_resp.status();
542 let local_var_content = local_var_resp.text().await?;
543
544 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
545 serde_json::from_str(&local_var_content).map_err(Error::from)
546 } else {
547 let local_var_entity: Option<BuyGemsError> = serde_json::from_str(&local_var_content).ok();
548 let local_var_error = ResponseContent {
549 status: local_var_status,
550 content: local_var_content,
551 entity: local_var_entity,
552 };
553 Err(Error::ResponseError(local_var_error))
554 }
555}
556
557pub async fn buy_subscription_stripe(
559 configuration: &configuration::Configuration,
560 params: BuySubscriptionStripeParams,
561) -> Result<models::CheckoutResponseWrapperSchema, Error<BuySubscriptionStripeError>> {
562 let local_var_configuration = configuration;
563
564 let subscribe_request_schema = params.subscribe_request_schema;
566
567 let local_var_client = &local_var_configuration.client;
568
569 let local_var_uri_str = format!("{}/my/subscribe/stripe", local_var_configuration.base_path);
570 let mut local_var_req_builder =
571 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
572
573 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
574 local_var_req_builder =
575 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
576 }
577 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
578 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
579 };
580 local_var_req_builder = local_var_req_builder.json(&subscribe_request_schema);
581
582 let local_var_req = local_var_req_builder.build()?;
583 let local_var_resp = local_var_client.execute(local_var_req).await?;
584
585 let local_var_status = local_var_resp.status();
586 let local_var_content = local_var_resp.text().await?;
587
588 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
589 serde_json::from_str(&local_var_content).map_err(Error::from)
590 } else {
591 let local_var_entity: Option<BuySubscriptionStripeError> =
592 serde_json::from_str(&local_var_content).ok();
593 let local_var_error = ResponseContent {
594 status: local_var_status,
595 content: local_var_content,
596 entity: local_var_entity,
597 };
598 Err(Error::ResponseError(local_var_error))
599 }
600}
601
602pub async fn cancel_subscription(
604 configuration: &configuration::Configuration,
605) -> Result<models::ResponseSchema, Error<CancelSubscriptionError>> {
606 let local_var_configuration = configuration;
607
608 let local_var_client = &local_var_configuration.client;
609
610 let local_var_uri_str = format!("{}/my/subscribe/cancel", local_var_configuration.base_path);
611 let mut local_var_req_builder =
612 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
613
614 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
615 local_var_req_builder =
616 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
617 }
618 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
619 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
620 };
621
622 let local_var_req = local_var_req_builder.build()?;
623 let local_var_resp = local_var_client.execute(local_var_req).await?;
624
625 let local_var_status = local_var_resp.status();
626 let local_var_content = local_var_resp.text().await?;
627
628 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
629 serde_json::from_str(&local_var_content).map_err(Error::from)
630 } else {
631 let local_var_entity: Option<CancelSubscriptionError> =
632 serde_json::from_str(&local_var_content).ok();
633 let local_var_error = ResponseContent {
634 status: local_var_status,
635 content: local_var_content,
636 entity: local_var_entity,
637 };
638 Err(Error::ResponseError(local_var_error))
639 }
640}
641
642pub async fn change_email(
644 configuration: &configuration::Configuration,
645 params: ChangeEmailParams,
646) -> Result<models::ResponseSchema, Error<ChangeEmailError>> {
647 let local_var_configuration = configuration;
648
649 let change_email_schema = params.change_email_schema;
651
652 let local_var_client = &local_var_configuration.client;
653
654 let local_var_uri_str = format!("{}/my/change_email", local_var_configuration.base_path);
655 let mut local_var_req_builder =
656 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
657
658 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
659 local_var_req_builder =
660 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
661 }
662 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
663 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
664 };
665 local_var_req_builder = local_var_req_builder.json(&change_email_schema);
666
667 let local_var_req = local_var_req_builder.build()?;
668 let local_var_resp = local_var_client.execute(local_var_req).await?;
669
670 let local_var_status = local_var_resp.status();
671 let local_var_content = local_var_resp.text().await?;
672
673 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
674 serde_json::from_str(&local_var_content).map_err(Error::from)
675 } else {
676 let local_var_entity: Option<ChangeEmailError> =
677 serde_json::from_str(&local_var_content).ok();
678 let local_var_error = ResponseContent {
679 status: local_var_status,
680 content: local_var_content,
681 entity: local_var_entity,
682 };
683 Err(Error::ResponseError(local_var_error))
684 }
685}
686
687pub async fn change_password(
689 configuration: &configuration::Configuration,
690 params: ChangePasswordParams,
691) -> Result<models::ResponseSchema, Error<ChangePasswordError>> {
692 let local_var_configuration = configuration;
693
694 let change_password_schema = params.change_password_schema;
696
697 let local_var_client = &local_var_configuration.client;
698
699 let local_var_uri_str = format!("{}/my/change_password", local_var_configuration.base_path);
700 let mut local_var_req_builder =
701 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
702
703 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
704 local_var_req_builder =
705 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
706 }
707 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
708 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
709 };
710 local_var_req_builder = local_var_req_builder.json(&change_password_schema);
711
712 let local_var_req = local_var_req_builder.build()?;
713 let local_var_resp = local_var_client.execute(local_var_req).await?;
714
715 let local_var_status = local_var_resp.status();
716 let local_var_content = local_var_resp.text().await?;
717
718 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
719 serde_json::from_str(&local_var_content).map_err(Error::from)
720 } else {
721 let local_var_entity: Option<ChangePasswordError> =
722 serde_json::from_str(&local_var_content).ok();
723 let local_var_error = ResponseContent {
724 status: local_var_status,
725 content: local_var_content,
726 entity: local_var_entity,
727 };
728 Err(Error::ResponseError(local_var_error))
729 }
730}
731
732pub async fn get_account_details(
734 configuration: &configuration::Configuration,
735) -> Result<models::MyAccountDetailsSchema, Error<GetAccountDetailsError>> {
736 let local_var_configuration = configuration;
737
738 let local_var_client = &local_var_configuration.client;
739
740 let local_var_uri_str = format!("{}/my/details", local_var_configuration.base_path);
741 let mut local_var_req_builder =
742 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
743
744 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
745 local_var_req_builder =
746 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
747 }
748 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
749 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
750 };
751
752 let local_var_req = local_var_req_builder.build()?;
753 let local_var_resp = local_var_client.execute(local_var_req).await?;
754
755 let local_var_status = local_var_resp.status();
756 let local_var_content = local_var_resp.text().await?;
757
758 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
759 serde_json::from_str(&local_var_content).map_err(Error::from)
760 } else {
761 let local_var_entity: Option<GetAccountDetailsError> =
762 serde_json::from_str(&local_var_content).ok();
763 let local_var_error = ResponseContent {
764 status: local_var_status,
765 content: local_var_content,
766 entity: local_var_entity,
767 };
768 Err(Error::ResponseError(local_var_error))
769 }
770}
771
772pub async fn get_bank_details(
774 configuration: &configuration::Configuration,
775) -> Result<models::BankResponseSchema, Error<GetBankDetailsError>> {
776 let local_var_configuration = configuration;
777
778 let local_var_client = &local_var_configuration.client;
779
780 let local_var_uri_str = format!("{}/my/bank", local_var_configuration.base_path);
781 let mut local_var_req_builder =
782 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
783
784 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
785 local_var_req_builder =
786 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
787 }
788 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
789 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
790 };
791
792 let local_var_req = local_var_req_builder.build()?;
793 let local_var_resp = local_var_client.execute(local_var_req).await?;
794
795 let local_var_status = local_var_resp.status();
796 let local_var_content = local_var_resp.text().await?;
797
798 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
799 serde_json::from_str(&local_var_content).map_err(Error::from)
800 } else {
801 let local_var_entity: Option<GetBankDetailsError> =
802 serde_json::from_str(&local_var_content).ok();
803 let local_var_error = ResponseContent {
804 status: local_var_status,
805 content: local_var_content,
806 entity: local_var_entity,
807 };
808 Err(Error::ResponseError(local_var_error))
809 }
810}
811
812pub async fn get_bank_items(
814 configuration: &configuration::Configuration,
815 params: GetBankItemsParams,
816) -> Result<models::DataPageSimpleItemSchema, Error<GetBankItemsError>> {
817 let local_var_configuration = configuration;
818
819 let item_code = params.item_code;
821 let page = params.page;
823 let size = params.size;
825
826 let local_var_client = &local_var_configuration.client;
827
828 let local_var_uri_str = format!("{}/my/bank/items", local_var_configuration.base_path);
829 let mut local_var_req_builder =
830 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
831
832 if let Some(ref local_var_str) = item_code {
833 local_var_req_builder =
834 local_var_req_builder.query(&[("item_code", &local_var_str.to_string())]);
835 }
836 if let Some(ref local_var_str) = page {
837 local_var_req_builder =
838 local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
839 }
840 if let Some(ref local_var_str) = size {
841 local_var_req_builder =
842 local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
843 }
844 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
845 local_var_req_builder =
846 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
847 }
848 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
849 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
850 };
851
852 let local_var_req = local_var_req_builder.build()?;
853 let local_var_resp = local_var_client.execute(local_var_req).await?;
854
855 let local_var_status = local_var_resp.status();
856 let local_var_content = local_var_resp.text().await?;
857
858 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
859 serde_json::from_str(&local_var_content).map_err(Error::from)
860 } else {
861 let local_var_entity: Option<GetBankItemsError> =
862 serde_json::from_str(&local_var_content).ok();
863 let local_var_error = ResponseContent {
864 status: local_var_status,
865 content: local_var_content,
866 entity: local_var_entity,
867 };
868 Err(Error::ResponseError(local_var_error))
869 }
870}
871
872pub async fn get_ge_history(
874 configuration: &configuration::Configuration,
875 params: GetGeHistoryParams,
876) -> Result<models::DataPageGeOrderHistorySchema, Error<GetGeHistoryError>> {
877 let local_var_configuration = configuration;
878
879 let id = params.id;
881 let code = params.code;
883 let page = params.page;
885 let size = params.size;
887
888 let local_var_client = &local_var_configuration.client;
889
890 let local_var_uri_str = format!(
891 "{}/my/grandexchange/history",
892 local_var_configuration.base_path
893 );
894 let mut local_var_req_builder =
895 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
896
897 if let Some(ref local_var_str) = id {
898 local_var_req_builder = local_var_req_builder.query(&[("id", &local_var_str.to_string())]);
899 }
900 if let Some(ref local_var_str) = code {
901 local_var_req_builder =
902 local_var_req_builder.query(&[("code", &local_var_str.to_string())]);
903 }
904 if let Some(ref local_var_str) = page {
905 local_var_req_builder =
906 local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
907 }
908 if let Some(ref local_var_str) = size {
909 local_var_req_builder =
910 local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
911 }
912 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
913 local_var_req_builder =
914 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
915 }
916 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
917 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
918 };
919
920 let local_var_req = local_var_req_builder.build()?;
921 let local_var_resp = local_var_client.execute(local_var_req).await?;
922
923 let local_var_status = local_var_resp.status();
924 let local_var_content = local_var_resp.text().await?;
925
926 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
927 serde_json::from_str(&local_var_content).map_err(Error::from)
928 } else {
929 let local_var_entity: Option<GetGeHistoryError> =
930 serde_json::from_str(&local_var_content).ok();
931 let local_var_error = ResponseContent {
932 status: local_var_status,
933 content: local_var_content,
934 entity: local_var_entity,
935 };
936 Err(Error::ResponseError(local_var_error))
937 }
938}
939
940pub async fn get_ge_orders(
942 configuration: &configuration::Configuration,
943 params: GetGeOrdersParams,
944) -> Result<models::DataPageGeOrderSchema, Error<GetGeOrdersError>> {
945 let local_var_configuration = configuration;
946
947 let code = params.code;
949 let r#type = params.r#type;
951 let page = params.page;
953 let size = params.size;
955
956 let local_var_client = &local_var_configuration.client;
957
958 let local_var_uri_str = format!(
959 "{}/my/grandexchange/orders",
960 local_var_configuration.base_path
961 );
962 let mut local_var_req_builder =
963 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
964
965 if let Some(ref local_var_str) = code {
966 local_var_req_builder =
967 local_var_req_builder.query(&[("code", &local_var_str.to_string())]);
968 }
969 if let Some(ref local_var_str) = r#type {
970 local_var_req_builder =
971 local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
972 }
973 if let Some(ref local_var_str) = page {
974 local_var_req_builder =
975 local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
976 }
977 if let Some(ref local_var_str) = size {
978 local_var_req_builder =
979 local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
980 }
981 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
982 local_var_req_builder =
983 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
984 }
985 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
986 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
987 };
988
989 let local_var_req = local_var_req_builder.build()?;
990 let local_var_resp = local_var_client.execute(local_var_req).await?;
991
992 let local_var_status = local_var_resp.status();
993 let local_var_content = local_var_resp.text().await?;
994
995 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
996 serde_json::from_str(&local_var_content).map_err(Error::from)
997 } else {
998 let local_var_entity: Option<GetGeOrdersError> =
999 serde_json::from_str(&local_var_content).ok();
1000 let local_var_error = ResponseContent {
1001 status: local_var_status,
1002 content: local_var_content,
1003 entity: local_var_entity,
1004 };
1005 Err(Error::ResponseError(local_var_error))
1006 }
1007}
1008
1009pub async fn get_my_gems_history(
1011 configuration: &configuration::Configuration,
1012) -> Result<models::GemTransactionListResponseSchema, Error<GetMyGemsHistoryError>> {
1013 let local_var_configuration = configuration;
1014
1015 let local_var_client = &local_var_configuration.client;
1016
1017 let local_var_uri_str = format!("{}/my/gems_history", local_var_configuration.base_path);
1018 let mut local_var_req_builder =
1019 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1020
1021 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1022 local_var_req_builder =
1023 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1024 }
1025 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1026 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1027 };
1028
1029 let local_var_req = local_var_req_builder.build()?;
1030 let local_var_resp = local_var_client.execute(local_var_req).await?;
1031
1032 let local_var_status = local_var_resp.status();
1033 let local_var_content = local_var_resp.text().await?;
1034
1035 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1036 serde_json::from_str(&local_var_content).map_err(Error::from)
1037 } else {
1038 let local_var_entity: Option<GetMyGemsHistoryError> =
1039 serde_json::from_str(&local_var_content).ok();
1040 let local_var_error = ResponseContent {
1041 status: local_var_status,
1042 content: local_var_content,
1043 entity: local_var_entity,
1044 };
1045 Err(Error::ResponseError(local_var_error))
1046 }
1047}
1048
1049pub async fn get_my_purchase_history(
1051 configuration: &configuration::Configuration,
1052) -> Result<models::PurchaseHistoryListResponseSchema, Error<GetMyPurchaseHistoryError>> {
1053 let local_var_configuration = configuration;
1054
1055 let local_var_client = &local_var_configuration.client;
1056
1057 let local_var_uri_str = format!("{}/my/purchase_history", local_var_configuration.base_path);
1058 let mut local_var_req_builder =
1059 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1060
1061 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1062 local_var_req_builder =
1063 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1064 }
1065 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1066 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1067 };
1068
1069 let local_var_req = local_var_req_builder.build()?;
1070 let local_var_resp = local_var_client.execute(local_var_req).await?;
1071
1072 let local_var_status = local_var_resp.status();
1073 let local_var_content = local_var_resp.text().await?;
1074
1075 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1076 serde_json::from_str(&local_var_content).map_err(Error::from)
1077 } else {
1078 let local_var_entity: Option<GetMyPurchaseHistoryError> =
1079 serde_json::from_str(&local_var_content).ok();
1080 let local_var_error = ResponseContent {
1081 status: local_var_status,
1082 content: local_var_content,
1083 entity: local_var_entity,
1084 };
1085 Err(Error::ResponseError(local_var_error))
1086 }
1087}
1088
1089pub async fn get_my_subscription(
1091 configuration: &configuration::Configuration,
1092) -> Result<models::SubscriptionResponseSchema, Error<GetMySubscriptionError>> {
1093 let local_var_configuration = configuration;
1094
1095 let local_var_client = &local_var_configuration.client;
1096
1097 let local_var_uri_str = format!("{}/my/subscription", local_var_configuration.base_path);
1098 let mut local_var_req_builder =
1099 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1100
1101 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1102 local_var_req_builder =
1103 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1104 }
1105 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1106 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1107 };
1108
1109 let local_var_req = local_var_req_builder.build()?;
1110 let local_var_resp = local_var_client.execute(local_var_req).await?;
1111
1112 let local_var_status = local_var_resp.status();
1113 let local_var_content = local_var_resp.text().await?;
1114
1115 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1116 serde_json::from_str(&local_var_content).map_err(Error::from)
1117 } else {
1118 let local_var_entity: Option<GetMySubscriptionError> =
1119 serde_json::from_str(&local_var_content).ok();
1120 let local_var_error = ResponseContent {
1121 status: local_var_status,
1122 content: local_var_content,
1123 entity: local_var_entity,
1124 };
1125 Err(Error::ResponseError(local_var_error))
1126 }
1127}
1128
1129pub async fn get_pending_items(
1131 configuration: &configuration::Configuration,
1132 params: GetPendingItemsParams,
1133) -> Result<models::DataPagePendingItemSchema, Error<GetPendingItemsError>> {
1134 let local_var_configuration = configuration;
1135
1136 let page = params.page;
1138 let size = params.size;
1140
1141 let local_var_client = &local_var_configuration.client;
1142
1143 let local_var_uri_str = format!("{}/my/pending_items", local_var_configuration.base_path);
1144 let mut local_var_req_builder =
1145 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1146
1147 if let Some(ref local_var_str) = page {
1148 local_var_req_builder =
1149 local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1150 }
1151 if let Some(ref local_var_str) = size {
1152 local_var_req_builder =
1153 local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
1154 }
1155 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1156 local_var_req_builder =
1157 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1158 }
1159 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1160 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1161 };
1162
1163 let local_var_req = local_var_req_builder.build()?;
1164 let local_var_resp = local_var_client.execute(local_var_req).await?;
1165
1166 let local_var_status = local_var_resp.status();
1167 let local_var_content = local_var_resp.text().await?;
1168
1169 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1170 serde_json::from_str(&local_var_content).map_err(Error::from)
1171 } else {
1172 let local_var_entity: Option<GetPendingItemsError> =
1173 serde_json::from_str(&local_var_content).ok();
1174 let local_var_error = ResponseContent {
1175 status: local_var_status,
1176 content: local_var_content,
1177 entity: local_var_entity,
1178 };
1179 Err(Error::ResponseError(local_var_error))
1180 }
1181}
1182
1183pub async fn get_rate_limits(
1185 configuration: &configuration::Configuration,
1186) -> Result<models::RateLimitsSchema, Error<GetRateLimitsError>> {
1187 let local_var_configuration = configuration;
1188
1189 let local_var_client = &local_var_configuration.client;
1190
1191 let local_var_uri_str = format!("{}/my/rates", local_var_configuration.base_path);
1192 let mut local_var_req_builder =
1193 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1194
1195 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1196 local_var_req_builder =
1197 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1198 }
1199 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1200 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1201 };
1202
1203 let local_var_req = local_var_req_builder.build()?;
1204 let local_var_resp = local_var_client.execute(local_var_req).await?;
1205
1206 let local_var_status = local_var_resp.status();
1207 let local_var_content = local_var_resp.text().await?;
1208
1209 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1210 serde_json::from_str(&local_var_content).map_err(Error::from)
1211 } else {
1212 let local_var_entity: Option<GetRateLimitsError> =
1213 serde_json::from_str(&local_var_content).ok();
1214 let local_var_error = ResponseContent {
1215 status: local_var_status,
1216 content: local_var_content,
1217 entity: local_var_entity,
1218 };
1219 Err(Error::ResponseError(local_var_error))
1220 }
1221}
1222
1223pub async fn subscribe_with_member_token(
1225 configuration: &configuration::Configuration,
1226) -> Result<models::MemberTokenSubscriptionResponseSchema, Error<SubscribeWithMemberTokenError>> {
1227 let local_var_configuration = configuration;
1228
1229 let local_var_client = &local_var_configuration.client;
1230
1231 let local_var_uri_str = format!(
1232 "{}/my/subscribe/member_token",
1233 local_var_configuration.base_path
1234 );
1235 let mut local_var_req_builder =
1236 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1237
1238 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1239 local_var_req_builder =
1240 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1241 }
1242 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1243 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1244 };
1245
1246 let local_var_req = local_var_req_builder.build()?;
1247 let local_var_resp = local_var_client.execute(local_var_req).await?;
1248
1249 let local_var_status = local_var_resp.status();
1250 let local_var_content = local_var_resp.text().await?;
1251
1252 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1253 serde_json::from_str(&local_var_content).map_err(Error::from)
1254 } else {
1255 let local_var_entity: Option<SubscribeWithMemberTokenError> =
1256 serde_json::from_str(&local_var_content).ok();
1257 let local_var_error = ResponseContent {
1258 status: local_var_status,
1259 content: local_var_content,
1260 entity: local_var_entity,
1261 };
1262 Err(Error::ResponseError(local_var_error))
1263 }
1264}