Skip to main content

artifacts/apis/
my_account_api.rs

1use super::{configuration, Error};
2use crate::{apis::ResponseContent, models};
3use reqwest::StatusCode;
4use serde::{de, Deserialize, Deserializer, Serialize};
5
6/// struct for passing parameters to the method [`buy_gems`]
7#[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/// struct for passing parameters to the method [`buy_subscription_stripe`]
21#[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/// struct for passing parameters to the method [`change_email`]
35#[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/// struct for passing parameters to the method [`change_password`]
49#[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/// struct for passing parameters to the method [`get_bank_items`]
63#[derive(Clone, Debug)]
64pub struct GetBankItemsParams {
65    /// Item to search in your bank.
66    pub item_code: Option<String>,
67    /// Page number
68    pub page: Option<u32>,
69    /// Page size
70    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/// struct for passing parameters to the method [`get_ge_history`]
84#[derive(Clone, Debug)]
85pub struct GetGeHistoryParams {
86    /// Order ID to search in your history.
87    pub id: Option<String>,
88    /// Item to search in your history.
89    pub code: Option<String>,
90    /// Page number
91    pub page: Option<u32>,
92    /// Page size
93    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/// struct for passing parameters to the method [`get_ge_orders`]
113#[derive(Clone, Debug)]
114pub struct GetGeOrdersParams {
115    /// The code of the item.
116    pub code: Option<String>,
117    /// Filter by order type (sell or buy).
118    pub r#type: Option<models::GeOrderType>,
119    /// Page number
120    pub page: Option<u32>,
121    /// Page size
122    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/// struct for passing parameters to the method [`get_pending_items`]
142#[derive(Clone, Debug)]
143pub struct GetPendingItemsParams {
144    /// Page number
145    pub page: Option<u32>,
146    /// Page size
147    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/// struct for typed errors of method [`buy_gems`]
157#[derive(Debug, Clone, Serialize)]
158#[serde(untagged)]
159pub enum BuyGemsError {
160    /// Gem pack not found.
161    Status404(models::ErrorResponseSchema),
162    /// Request could not be processed due to an invalid payload.
163    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/// struct for typed errors of method [`buy_subscription_stripe`]
184#[derive(Debug, Clone, Serialize)]
185#[serde(untagged)]
186pub enum BuySubscriptionStripeError {
187    /// You already have an active subscription.
188    Status565(models::ErrorResponseSchema),
189    /// An active Stripe subscription cannot be extended with gems or member tokens.
190    Status573(models::ErrorResponseSchema),
191    /// Request could not be processed due to an invalid payload.
192    Status422(models::ErrorResponseSchema),
193}
194
195impl<'de> Deserialize<'de> for BuySubscriptionStripeError {
196    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
197    where
198        D: Deserializer<'de>,
199    {
200        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
201        match raw.error.code {
202            565 => Ok(Self::Status565(raw)),
203            573 => Ok(Self::Status573(raw)),
204            422 => Ok(Self::Status422(raw)),
205            _ => Err(de::Error::custom(format!(
206                "Unexpected error code: {}",
207                raw.error.code
208            ))),
209        }
210    }
211}
212
213/// struct for typed errors of method [`cancel_subscription`]
214#[derive(Debug, Clone, Serialize)]
215#[serde(untagged)]
216pub enum CancelSubscriptionError {
217    /// Subscription not found.
218    Status404(models::ErrorResponseSchema),
219    /// Request could not be processed due to an invalid payload.
220    Status422(models::ErrorResponseSchema),
221}
222
223impl<'de> Deserialize<'de> for CancelSubscriptionError {
224    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
225    where
226        D: Deserializer<'de>,
227    {
228        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
229        match raw.error.code {
230            404 => Ok(Self::Status404(raw)),
231            422 => Ok(Self::Status422(raw)),
232            _ => Err(de::Error::custom(format!(
233                "Unexpected error code: {}",
234                raw.error.code
235            ))),
236        }
237    }
238}
239
240/// struct for typed errors of method [`change_email`]
241#[derive(Debug, Clone, Serialize)]
242#[serde(untagged)]
243pub enum ChangeEmailError {
244    /// Please use a different email.
245    Status463(models::ErrorResponseSchema),
246    /// This email is already in use.
247    Status457(models::ErrorResponseSchema),
248    /// Request could not be processed due to an invalid payload.
249    Status422(models::ErrorResponseSchema),
250}
251
252impl<'de> Deserialize<'de> for ChangeEmailError {
253    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
254    where
255        D: Deserializer<'de>,
256    {
257        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
258        match raw.error.code {
259            463 => Ok(Self::Status463(raw)),
260            457 => Ok(Self::Status457(raw)),
261            422 => Ok(Self::Status422(raw)),
262            _ => Err(de::Error::custom(format!(
263                "Unexpected error code: {}",
264                raw.error.code
265            ))),
266        }
267    }
268}
269
270/// struct for typed errors of method [`change_password`]
271#[derive(Debug, Clone, Serialize)]
272#[serde(untagged)]
273pub enum ChangePasswordError {
274    /// Please use a different password.
275    Status458(models::ErrorResponseSchema),
276    /// The current password you entered is invalid.
277    Status459(models::ErrorResponseSchema),
278    /// Request could not be processed due to an invalid payload.
279    Status422(models::ErrorResponseSchema),
280}
281
282impl<'de> Deserialize<'de> for ChangePasswordError {
283    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
284    where
285        D: Deserializer<'de>,
286    {
287        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
288        match raw.error.code {
289            458 => Ok(Self::Status458(raw)),
290            459 => Ok(Self::Status459(raw)),
291            422 => Ok(Self::Status422(raw)),
292            _ => Err(de::Error::custom(format!(
293                "Unexpected error code: {}",
294                raw.error.code
295            ))),
296        }
297    }
298}
299
300/// struct for typed errors of method [`get_account_details`]
301#[derive(Debug, Clone, Serialize)]
302#[serde(untagged)]
303pub enum GetAccountDetailsError {}
304
305impl<'de> Deserialize<'de> for GetAccountDetailsError {
306    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
307    where
308        D: Deserializer<'de>,
309    {
310        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
311        Err(de::Error::custom(format!(
312            "Unexpected error code: {}",
313            raw.error.code
314        )))
315    }
316}
317
318/// struct for typed errors of method [`get_bank_details`]
319#[derive(Debug, Clone, Serialize)]
320#[serde(untagged)]
321pub enum GetBankDetailsError {}
322
323impl<'de> Deserialize<'de> for GetBankDetailsError {
324    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
325    where
326        D: Deserializer<'de>,
327    {
328        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
329        Err(de::Error::custom(format!(
330            "Unexpected error code: {}",
331            raw.error.code
332        )))
333    }
334}
335
336/// struct for typed errors of method [`get_bank_items`]
337#[derive(Debug, Clone, Serialize)]
338#[serde(untagged)]
339pub enum GetBankItemsError {}
340
341impl<'de> Deserialize<'de> for GetBankItemsError {
342    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
343    where
344        D: Deserializer<'de>,
345    {
346        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
347        Err(de::Error::custom(format!(
348            "Unexpected error code: {}",
349            raw.error.code
350        )))
351    }
352}
353
354/// struct for typed errors of method [`get_ge_history`]
355#[derive(Debug, Clone, Serialize)]
356#[serde(untagged)]
357pub enum GetGeHistoryError {}
358
359impl<'de> Deserialize<'de> for GetGeHistoryError {
360    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
361    where
362        D: Deserializer<'de>,
363    {
364        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
365        Err(de::Error::custom(format!(
366            "Unexpected error code: {}",
367            raw.error.code
368        )))
369    }
370}
371
372/// struct for typed errors of method [`get_ge_orders`]
373#[derive(Debug, Clone, Serialize)]
374#[serde(untagged)]
375pub enum GetGeOrdersError {}
376
377impl<'de> Deserialize<'de> for GetGeOrdersError {
378    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
379    where
380        D: Deserializer<'de>,
381    {
382        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
383        Err(de::Error::custom(format!(
384            "Unexpected error code: {}",
385            raw.error.code
386        )))
387    }
388}
389
390/// struct for typed errors of method [`get_my_gems_history`]
391#[derive(Debug, Clone, Serialize)]
392#[serde(untagged)]
393pub enum GetMyGemsHistoryError {}
394
395impl<'de> Deserialize<'de> for GetMyGemsHistoryError {
396    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
397    where
398        D: Deserializer<'de>,
399    {
400        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
401        Err(de::Error::custom(format!(
402            "Unexpected error code: {}",
403            raw.error.code
404        )))
405    }
406}
407
408/// struct for typed errors of method [`get_my_purchase_history`]
409#[derive(Debug, Clone, Serialize)]
410#[serde(untagged)]
411pub enum GetMyPurchaseHistoryError {}
412
413impl<'de> Deserialize<'de> for GetMyPurchaseHistoryError {
414    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
415    where
416        D: Deserializer<'de>,
417    {
418        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
419        Err(de::Error::custom(format!(
420            "Unexpected error code: {}",
421            raw.error.code
422        )))
423    }
424}
425
426/// struct for typed errors of method [`get_my_subscription`]
427#[derive(Debug, Clone, Serialize)]
428#[serde(untagged)]
429pub enum GetMySubscriptionError {
430    /// Subscription not found.
431    Status404(models::ErrorResponseSchema),
432}
433
434impl<'de> Deserialize<'de> for GetMySubscriptionError {
435    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
436    where
437        D: Deserializer<'de>,
438    {
439        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
440        match raw.error.code {
441            404 => Ok(Self::Status404(raw)),
442            _ => Err(de::Error::custom(format!(
443                "Unexpected error code: {}",
444                raw.error.code
445            ))),
446        }
447    }
448}
449
450/// struct for typed errors of method [`get_pending_items`]
451#[derive(Debug, Clone, Serialize)]
452#[serde(untagged)]
453pub enum GetPendingItemsError {}
454
455impl<'de> Deserialize<'de> for GetPendingItemsError {
456    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
457    where
458        D: Deserializer<'de>,
459    {
460        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
461        Err(de::Error::custom(format!(
462            "Unexpected error code: {}",
463            raw.error.code
464        )))
465    }
466}
467
468/// struct for typed errors of method [`get_rate_limits`]
469#[derive(Debug, Clone, Serialize)]
470#[serde(untagged)]
471pub enum GetRateLimitsError {}
472
473impl<'de> Deserialize<'de> for GetRateLimitsError {
474    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
475    where
476        D: Deserializer<'de>,
477    {
478        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
479        Err(de::Error::custom(format!(
480            "Unexpected error code: {}",
481            raw.error.code
482        )))
483    }
484}
485
486/// struct for typed errors of method [`subscribe_with_member_token`]
487#[derive(Debug, Clone, Serialize)]
488#[serde(untagged)]
489pub enum SubscribeWithMemberTokenError {
490    /// Insufficient member tokens.
491    Status572(models::ErrorResponseSchema),
492    /// An active Stripe subscription cannot be extended with gems or member tokens.
493    Status573(models::ErrorResponseSchema),
494    /// Request could not be processed due to an invalid payload.
495    Status422(models::ErrorResponseSchema),
496}
497
498impl<'de> Deserialize<'de> for SubscribeWithMemberTokenError {
499    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
500    where
501        D: Deserializer<'de>,
502    {
503        let raw = models::ErrorResponseSchema::deserialize(deserializer)?;
504        match raw.error.code {
505            572 => Ok(Self::Status572(raw)),
506            573 => Ok(Self::Status573(raw)),
507            422 => Ok(Self::Status422(raw)),
508            _ => Err(de::Error::custom(format!(
509                "Unexpected error code: {}",
510                raw.error.code
511            ))),
512        }
513    }
514}
515
516/// Purchase gems. Returns a Stripe checkout URL for payment.
517pub async fn buy_gems(
518    configuration: &configuration::Configuration,
519    params: BuyGemsParams,
520) -> Result<models::CheckoutResponseWrapperSchema, Error<BuyGemsError>> {
521    let local_var_configuration = configuration;
522
523    // unbox the parameters
524    let purchase_gems_request_schema = params.purchase_gems_request_schema;
525
526    let local_var_client = &local_var_configuration.client;
527
528    let local_var_uri_str = format!("{}/my/buy_gems", local_var_configuration.base_path);
529    let mut local_var_req_builder =
530        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
531
532    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
533        local_var_req_builder =
534            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
535    }
536    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
537        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
538    };
539    local_var_req_builder = local_var_req_builder.json(&purchase_gems_request_schema);
540
541    let local_var_req = local_var_req_builder.build()?;
542    let local_var_resp = local_var_client.execute(local_var_req).await?;
543
544    let local_var_status = local_var_resp.status();
545    let local_var_content = local_var_resp.text().await?;
546
547    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
548        serde_json::from_str(&local_var_content).map_err(Error::from)
549    } else {
550        let local_var_entity: Option<BuyGemsError> = serde_json::from_str(&local_var_content).ok();
551        let local_var_error = ResponseContent {
552            status: local_var_status,
553            content: local_var_content,
554            entity: local_var_entity,
555        };
556        Err(Error::ResponseError(local_var_error))
557    }
558}
559
560/// Subscribe to become a member and unlock the benefits tied to your selected plan. You will receive a secure Stripe checkout URL to complete the payment.
561pub async fn buy_subscription_stripe(
562    configuration: &configuration::Configuration,
563    params: BuySubscriptionStripeParams,
564) -> Result<models::CheckoutResponseWrapperSchema, Error<BuySubscriptionStripeError>> {
565    let local_var_configuration = configuration;
566
567    // unbox the parameters
568    let subscribe_request_schema = params.subscribe_request_schema;
569
570    let local_var_client = &local_var_configuration.client;
571
572    let local_var_uri_str = format!("{}/my/subscribe/stripe", local_var_configuration.base_path);
573    let mut local_var_req_builder =
574        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
575
576    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
577        local_var_req_builder =
578            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
579    }
580    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
581        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
582    };
583    local_var_req_builder = local_var_req_builder.json(&subscribe_request_schema);
584
585    let local_var_req = local_var_req_builder.build()?;
586    let local_var_resp = local_var_client.execute(local_var_req).await?;
587
588    let local_var_status = local_var_resp.status();
589    let local_var_content = local_var_resp.text().await?;
590
591    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
592        serde_json::from_str(&local_var_content).map_err(Error::from)
593    } else {
594        let local_var_entity: Option<BuySubscriptionStripeError> =
595            serde_json::from_str(&local_var_content).ok();
596        let local_var_error = ResponseContent {
597            status: local_var_status,
598            content: local_var_content,
599            entity: local_var_entity,
600        };
601        Err(Error::ResponseError(local_var_error))
602    }
603}
604
605/// Cancel subscription at the end of the current billing period.
606pub async fn cancel_subscription(
607    configuration: &configuration::Configuration,
608) -> Result<models::ResponseSchema, Error<CancelSubscriptionError>> {
609    let local_var_configuration = configuration;
610
611    let local_var_client = &local_var_configuration.client;
612
613    let local_var_uri_str = format!("{}/my/subscribe/cancel", local_var_configuration.base_path);
614    let mut local_var_req_builder =
615        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
616
617    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
618        local_var_req_builder =
619            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
620    }
621    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
622        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
623    };
624
625    let local_var_req = local_var_req_builder.build()?;
626    let local_var_resp = local_var_client.execute(local_var_req).await?;
627
628    let local_var_status = local_var_resp.status();
629    let local_var_content = local_var_resp.text().await?;
630
631    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
632        serde_json::from_str(&local_var_content).map_err(Error::from)
633    } else {
634        let local_var_entity: Option<CancelSubscriptionError> =
635            serde_json::from_str(&local_var_content).ok();
636        let local_var_error = ResponseContent {
637            status: local_var_status,
638            content: local_var_content,
639            entity: local_var_entity,
640        };
641        Err(Error::ResponseError(local_var_error))
642    }
643}
644
645/// Change your account email.
646pub async fn change_email(
647    configuration: &configuration::Configuration,
648    params: ChangeEmailParams,
649) -> Result<models::ResponseSchema, Error<ChangeEmailError>> {
650    let local_var_configuration = configuration;
651
652    // unbox the parameters
653    let change_email_schema = params.change_email_schema;
654
655    let local_var_client = &local_var_configuration.client;
656
657    let local_var_uri_str = format!("{}/my/change_email", local_var_configuration.base_path);
658    let mut local_var_req_builder =
659        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
660
661    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
662        local_var_req_builder =
663            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
664    }
665    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
666        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
667    };
668    local_var_req_builder = local_var_req_builder.json(&change_email_schema);
669
670    let local_var_req = local_var_req_builder.build()?;
671    let local_var_resp = local_var_client.execute(local_var_req).await?;
672
673    let local_var_status = local_var_resp.status();
674    let local_var_content = local_var_resp.text().await?;
675
676    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
677        serde_json::from_str(&local_var_content).map_err(Error::from)
678    } else {
679        let local_var_entity: Option<ChangeEmailError> =
680            serde_json::from_str(&local_var_content).ok();
681        let local_var_error = ResponseContent {
682            status: local_var_status,
683            content: local_var_content,
684            entity: local_var_entity,
685        };
686        Err(Error::ResponseError(local_var_error))
687    }
688}
689
690/// Change your account password. Changing the password reset the account token.
691pub async fn change_password(
692    configuration: &configuration::Configuration,
693    params: ChangePasswordParams,
694) -> Result<models::ResponseSchema, Error<ChangePasswordError>> {
695    let local_var_configuration = configuration;
696
697    // unbox the parameters
698    let change_password_schema = params.change_password_schema;
699
700    let local_var_client = &local_var_configuration.client;
701
702    let local_var_uri_str = format!("{}/my/change_password", local_var_configuration.base_path);
703    let mut local_var_req_builder =
704        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
705
706    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
707        local_var_req_builder =
708            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
709    }
710    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
711        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
712    };
713    local_var_req_builder = local_var_req_builder.json(&change_password_schema);
714
715    let local_var_req = local_var_req_builder.build()?;
716    let local_var_resp = local_var_client.execute(local_var_req).await?;
717
718    let local_var_status = local_var_resp.status();
719    let local_var_content = local_var_resp.text().await?;
720
721    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
722        serde_json::from_str(&local_var_content).map_err(Error::from)
723    } else {
724        let local_var_entity: Option<ChangePasswordError> =
725            serde_json::from_str(&local_var_content).ok();
726        let local_var_error = ResponseContent {
727            status: local_var_status,
728            content: local_var_content,
729            entity: local_var_entity,
730        };
731        Err(Error::ResponseError(local_var_error))
732    }
733}
734
735/// Fetch account details.
736pub async fn get_account_details(
737    configuration: &configuration::Configuration,
738) -> Result<models::MyAccountDetailsSchema, Error<GetAccountDetailsError>> {
739    let local_var_configuration = configuration;
740
741    let local_var_client = &local_var_configuration.client;
742
743    let local_var_uri_str = format!("{}/my/details", local_var_configuration.base_path);
744    let mut local_var_req_builder =
745        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
746
747    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
748        local_var_req_builder =
749            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
750    }
751    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
752        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
753    };
754
755    let local_var_req = local_var_req_builder.build()?;
756    let local_var_resp = local_var_client.execute(local_var_req).await?;
757
758    let local_var_status = local_var_resp.status();
759    let local_var_content = local_var_resp.text().await?;
760
761    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
762        serde_json::from_str(&local_var_content).map_err(Error::from)
763    } else {
764        let local_var_entity: Option<GetAccountDetailsError> =
765            serde_json::from_str(&local_var_content).ok();
766        let local_var_error = ResponseContent {
767            status: local_var_status,
768            content: local_var_content,
769            entity: local_var_entity,
770        };
771        Err(Error::ResponseError(local_var_error))
772    }
773}
774
775/// Fetch bank details.
776pub async fn get_bank_details(
777    configuration: &configuration::Configuration,
778) -> Result<models::BankResponseSchema, Error<GetBankDetailsError>> {
779    let local_var_configuration = configuration;
780
781    let local_var_client = &local_var_configuration.client;
782
783    let local_var_uri_str = format!("{}/my/bank", local_var_configuration.base_path);
784    let mut local_var_req_builder =
785        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
786
787    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
788        local_var_req_builder =
789            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
790    }
791    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
792        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
793    };
794
795    let local_var_req = local_var_req_builder.build()?;
796    let local_var_resp = local_var_client.execute(local_var_req).await?;
797
798    let local_var_status = local_var_resp.status();
799    let local_var_content = local_var_resp.text().await?;
800
801    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
802        serde_json::from_str(&local_var_content).map_err(Error::from)
803    } else {
804        let local_var_entity: Option<GetBankDetailsError> =
805            serde_json::from_str(&local_var_content).ok();
806        let local_var_error = ResponseContent {
807            status: local_var_status,
808            content: local_var_content,
809            entity: local_var_entity,
810        };
811        Err(Error::ResponseError(local_var_error))
812    }
813}
814
815/// Fetch all items in your bank.
816pub async fn get_bank_items(
817    configuration: &configuration::Configuration,
818    params: GetBankItemsParams,
819) -> Result<models::DataPageSimpleItemSchema, Error<GetBankItemsError>> {
820    let local_var_configuration = configuration;
821
822    // unbox the parameters
823    let item_code = params.item_code;
824    // unbox the parameters
825    let page = params.page;
826    // unbox the parameters
827    let size = params.size;
828
829    let local_var_client = &local_var_configuration.client;
830
831    let local_var_uri_str = format!("{}/my/bank/items", local_var_configuration.base_path);
832    let mut local_var_req_builder =
833        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
834
835    if let Some(ref local_var_str) = item_code {
836        local_var_req_builder =
837            local_var_req_builder.query(&[("item_code", &local_var_str.to_string())]);
838    }
839    if let Some(ref local_var_str) = page {
840        local_var_req_builder =
841            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
842    }
843    if let Some(ref local_var_str) = size {
844        local_var_req_builder =
845            local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
846    }
847    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
848        local_var_req_builder =
849            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
850    }
851    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
852        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
853    };
854
855    let local_var_req = local_var_req_builder.build()?;
856    let local_var_resp = local_var_client.execute(local_var_req).await?;
857
858    let local_var_status = local_var_resp.status();
859    let local_var_content = local_var_resp.text().await?;
860
861    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
862        serde_json::from_str(&local_var_content).map_err(Error::from)
863    } else {
864        let local_var_entity: Option<GetBankItemsError> =
865            serde_json::from_str(&local_var_content).ok();
866        let local_var_error = ResponseContent {
867            status: local_var_status,
868            content: local_var_content,
869            entity: local_var_entity,
870        };
871        Err(Error::ResponseError(local_var_error))
872    }
873}
874
875/// Fetch your transaction history of the last 7 days (buy and sell orders).
876pub async fn get_ge_history(
877    configuration: &configuration::Configuration,
878    params: GetGeHistoryParams,
879) -> Result<models::DataPageGeOrderHistorySchema, Error<GetGeHistoryError>> {
880    let local_var_configuration = configuration;
881
882    // unbox the parameters
883    let id = params.id;
884    // unbox the parameters
885    let code = params.code;
886    // unbox the parameters
887    let page = params.page;
888    // unbox the parameters
889    let size = params.size;
890
891    let local_var_client = &local_var_configuration.client;
892
893    let local_var_uri_str = format!(
894        "{}/my/grandexchange/history",
895        local_var_configuration.base_path
896    );
897    let mut local_var_req_builder =
898        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
899
900    if let Some(ref local_var_str) = id {
901        local_var_req_builder = local_var_req_builder.query(&[("id", &local_var_str.to_string())]);
902    }
903    if let Some(ref local_var_str) = code {
904        local_var_req_builder =
905            local_var_req_builder.query(&[("code", &local_var_str.to_string())]);
906    }
907    if let Some(ref local_var_str) = page {
908        local_var_req_builder =
909            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
910    }
911    if let Some(ref local_var_str) = size {
912        local_var_req_builder =
913            local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
914    }
915    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
916        local_var_req_builder =
917            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
918    }
919    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
920        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
921    };
922
923    let local_var_req = local_var_req_builder.build()?;
924    let local_var_resp = local_var_client.execute(local_var_req).await?;
925
926    let local_var_status = local_var_resp.status();
927    let local_var_content = local_var_resp.text().await?;
928
929    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
930        serde_json::from_str(&local_var_content).map_err(Error::from)
931    } else {
932        let local_var_entity: Option<GetGeHistoryError> =
933            serde_json::from_str(&local_var_content).ok();
934        let local_var_error = ResponseContent {
935            status: local_var_status,
936            content: local_var_content,
937            entity: local_var_entity,
938        };
939        Err(Error::ResponseError(local_var_error))
940    }
941}
942
943/// Fetch your orders details (sell and buy orders).
944pub async fn get_ge_orders(
945    configuration: &configuration::Configuration,
946    params: GetGeOrdersParams,
947) -> Result<models::DataPageGeOrderSchema, Error<GetGeOrdersError>> {
948    let local_var_configuration = configuration;
949
950    // unbox the parameters
951    let code = params.code;
952    // unbox the parameters
953    let r#type = params.r#type;
954    // unbox the parameters
955    let page = params.page;
956    // unbox the parameters
957    let size = params.size;
958
959    let local_var_client = &local_var_configuration.client;
960
961    let local_var_uri_str = format!(
962        "{}/my/grandexchange/orders",
963        local_var_configuration.base_path
964    );
965    let mut local_var_req_builder =
966        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
967
968    if let Some(ref local_var_str) = code {
969        local_var_req_builder =
970            local_var_req_builder.query(&[("code", &local_var_str.to_string())]);
971    }
972    if let Some(ref local_var_str) = r#type {
973        local_var_req_builder =
974            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
975    }
976    if let Some(ref local_var_str) = page {
977        local_var_req_builder =
978            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
979    }
980    if let Some(ref local_var_str) = size {
981        local_var_req_builder =
982            local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
983    }
984    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
985        local_var_req_builder =
986            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
987    }
988    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
989        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
990    };
991
992    let local_var_req = local_var_req_builder.build()?;
993    let local_var_resp = local_var_client.execute(local_var_req).await?;
994
995    let local_var_status = local_var_resp.status();
996    let local_var_content = local_var_resp.text().await?;
997
998    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
999        serde_json::from_str(&local_var_content).map_err(Error::from)
1000    } else {
1001        let local_var_entity: Option<GetGeOrdersError> =
1002            serde_json::from_str(&local_var_content).ok();
1003        let local_var_error = ResponseContent {
1004            status: local_var_status,
1005            content: local_var_content,
1006            entity: local_var_entity,
1007        };
1008        Err(Error::ResponseError(local_var_error))
1009    }
1010}
1011
1012/// List all gem credits and debits.
1013pub async fn get_my_gems_history(
1014    configuration: &configuration::Configuration,
1015) -> Result<models::GemTransactionListResponseSchema, Error<GetMyGemsHistoryError>> {
1016    let local_var_configuration = configuration;
1017
1018    let local_var_client = &local_var_configuration.client;
1019
1020    let local_var_uri_str = format!("{}/my/gems_history", local_var_configuration.base_path);
1021    let mut local_var_req_builder =
1022        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1023
1024    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1025        local_var_req_builder =
1026            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1027    }
1028    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1029        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1030    };
1031
1032    let local_var_req = local_var_req_builder.build()?;
1033    let local_var_resp = local_var_client.execute(local_var_req).await?;
1034
1035    let local_var_status = local_var_resp.status();
1036    let local_var_content = local_var_resp.text().await?;
1037
1038    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1039        serde_json::from_str(&local_var_content).map_err(Error::from)
1040    } else {
1041        let local_var_entity: Option<GetMyGemsHistoryError> =
1042            serde_json::from_str(&local_var_content).ok();
1043        let local_var_error = ResponseContent {
1044            status: local_var_status,
1045            content: local_var_content,
1046            entity: local_var_entity,
1047        };
1048        Err(Error::ResponseError(local_var_error))
1049    }
1050}
1051
1052/// List all purchases (subscriptions and gem packs).
1053pub async fn get_my_purchase_history(
1054    configuration: &configuration::Configuration,
1055) -> Result<models::PurchaseHistoryListResponseSchema, Error<GetMyPurchaseHistoryError>> {
1056    let local_var_configuration = configuration;
1057
1058    let local_var_client = &local_var_configuration.client;
1059
1060    let local_var_uri_str = format!("{}/my/purchase_history", local_var_configuration.base_path);
1061    let mut local_var_req_builder =
1062        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1063
1064    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1065        local_var_req_builder =
1066            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1067    }
1068    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1069        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1070    };
1071
1072    let local_var_req = local_var_req_builder.build()?;
1073    let local_var_resp = local_var_client.execute(local_var_req).await?;
1074
1075    let local_var_status = local_var_resp.status();
1076    let local_var_content = local_var_resp.text().await?;
1077
1078    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1079        serde_json::from_str(&local_var_content).map_err(Error::from)
1080    } else {
1081        let local_var_entity: Option<GetMyPurchaseHistoryError> =
1082            serde_json::from_str(&local_var_content).ok();
1083        let local_var_error = ResponseContent {
1084            status: local_var_status,
1085            content: local_var_content,
1086            entity: local_var_entity,
1087        };
1088        Err(Error::ResponseError(local_var_error))
1089    }
1090}
1091
1092/// Get current subscription details.
1093pub async fn get_my_subscription(
1094    configuration: &configuration::Configuration,
1095) -> Result<models::SubscriptionResponseSchema, Error<GetMySubscriptionError>> {
1096    let local_var_configuration = configuration;
1097
1098    let local_var_client = &local_var_configuration.client;
1099
1100    let local_var_uri_str = format!("{}/my/subscription", local_var_configuration.base_path);
1101    let mut local_var_req_builder =
1102        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1103
1104    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1105        local_var_req_builder =
1106            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1107    }
1108    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1109        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1110    };
1111
1112    let local_var_req = local_var_req_builder.build()?;
1113    let local_var_resp = local_var_client.execute(local_var_req).await?;
1114
1115    let local_var_status = local_var_resp.status();
1116    let local_var_content = local_var_resp.text().await?;
1117
1118    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1119        serde_json::from_str(&local_var_content).map_err(Error::from)
1120    } else {
1121        let local_var_entity: Option<GetMySubscriptionError> =
1122            serde_json::from_str(&local_var_content).ok();
1123        let local_var_error = ResponseContent {
1124            status: local_var_status,
1125            content: local_var_content,
1126            entity: local_var_entity,
1127        };
1128        Err(Error::ResponseError(local_var_error))
1129    }
1130}
1131
1132/// Retrieve all unclaimed pending items for your account.  These are items from various sources (achievements, grand exchange, events, etc.) that can be claimed by any character on your account using /my/{name}/action/claim/{id}.
1133pub async fn get_pending_items(
1134    configuration: &configuration::Configuration,
1135    params: GetPendingItemsParams,
1136) -> Result<models::DataPagePendingItemSchema, Error<GetPendingItemsError>> {
1137    let local_var_configuration = configuration;
1138
1139    // unbox the parameters
1140    let page = params.page;
1141    // unbox the parameters
1142    let size = params.size;
1143
1144    let local_var_client = &local_var_configuration.client;
1145
1146    let local_var_uri_str = format!("{}/my/pending_items", local_var_configuration.base_path);
1147    let mut local_var_req_builder =
1148        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1149
1150    if let Some(ref local_var_str) = page {
1151        local_var_req_builder =
1152            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1153    }
1154    if let Some(ref local_var_str) = size {
1155        local_var_req_builder =
1156            local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
1157    }
1158    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1159        local_var_req_builder =
1160            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1161    }
1162    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1163        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1164    };
1165
1166    let local_var_req = local_var_req_builder.build()?;
1167    let local_var_resp = local_var_client.execute(local_var_req).await?;
1168
1169    let local_var_status = local_var_resp.status();
1170    let local_var_content = local_var_resp.text().await?;
1171
1172    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1173        serde_json::from_str(&local_var_content).map_err(Error::from)
1174    } else {
1175        let local_var_entity: Option<GetPendingItemsError> =
1176            serde_json::from_str(&local_var_content).ok();
1177        let local_var_error = ResponseContent {
1178            status: local_var_status,
1179            content: local_var_content,
1180            entity: local_var_entity,
1181        };
1182        Err(Error::ResponseError(local_var_error))
1183    }
1184}
1185
1186/// Get all rate limits.
1187pub async fn get_rate_limits(
1188    configuration: &configuration::Configuration,
1189) -> Result<models::RateLimitsSchema, Error<GetRateLimitsError>> {
1190    let local_var_configuration = configuration;
1191
1192    let local_var_client = &local_var_configuration.client;
1193
1194    let local_var_uri_str = format!("{}/my/rates", local_var_configuration.base_path);
1195    let mut local_var_req_builder =
1196        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1197
1198    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1199        local_var_req_builder =
1200            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1201    }
1202    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1203        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1204    };
1205
1206    let local_var_req = local_var_req_builder.build()?;
1207    let local_var_resp = local_var_client.execute(local_var_req).await?;
1208
1209    let local_var_status = local_var_resp.status();
1210    let local_var_content = local_var_resp.text().await?;
1211
1212    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1213        serde_json::from_str(&local_var_content).map_err(Error::from)
1214    } else {
1215        let local_var_entity: Option<GetRateLimitsError> =
1216            serde_json::from_str(&local_var_content).ok();
1217        let local_var_error = ResponseContent {
1218            status: local_var_status,
1219            content: local_var_content,
1220            entity: local_var_entity,
1221        };
1222        Err(Error::ResponseError(local_var_error))
1223    }
1224}
1225
1226/// Redeem a member token to start or extend membership by 30 days. Member tokens are manually granted as rewards for events. Member tokens cannot be redeemed while a Stripe subscription is active.
1227pub async fn subscribe_with_member_token(
1228    configuration: &configuration::Configuration,
1229) -> Result<models::MemberTokenSubscriptionResponseSchema, Error<SubscribeWithMemberTokenError>> {
1230    let local_var_configuration = configuration;
1231
1232    let local_var_client = &local_var_configuration.client;
1233
1234    let local_var_uri_str = format!(
1235        "{}/my/subscribe/member_token",
1236        local_var_configuration.base_path
1237    );
1238    let mut local_var_req_builder =
1239        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1240
1241    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1242        local_var_req_builder =
1243            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1244    }
1245    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1246        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1247    };
1248
1249    let local_var_req = local_var_req_builder.build()?;
1250    let local_var_resp = local_var_client.execute(local_var_req).await?;
1251
1252    let local_var_status = local_var_resp.status();
1253    let local_var_content = local_var_resp.text().await?;
1254
1255    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1256        serde_json::from_str(&local_var_content).map_err(Error::from)
1257    } else {
1258        let local_var_entity: Option<SubscribeWithMemberTokenError> =
1259            serde_json::from_str(&local_var_content).ok();
1260        let local_var_error = ResponseContent {
1261            status: local_var_status,
1262            content: local_var_content,
1263            entity: local_var_entity,
1264        };
1265        Err(Error::ResponseError(local_var_error))
1266    }
1267}