amazon_spapi/client_apis/
finances_v0.rs

1use anyhow::Result;
2
3use crate::{client::SpapiClient, models};
4
5impl SpapiClient {
6    pub async fn list_financial_event_groups(
7        &self,
8        max_results_per_page: Option<i32>,
9        financial_event_group_started_before: Option<String>,
10        financial_event_group_started_after: Option<String>,
11        next_token: Option<&str>,
12    ) -> Result<models::finances_v0::ListFinancialEventGroupsResponse> {
13        let configuration = self.create_configuration().await?;
14        let _ = self
15            .limiter()
16            .wait("/finances/v0/financialEventGroups", 0.5, 30)
17            .await?;
18        let res = crate::apis::finances_v0::list_financial_event_groups(
19            &configuration,
20            max_results_per_page,
21            financial_event_group_started_before,
22            financial_event_group_started_after,
23            next_token,
24        )
25        .await?;
26        Ok(res)
27    }
28
29    /// max_results_per_page: 1 to 100 default to 100
30    pub async fn list_financial_events(
31        &self,
32        max_results_per_page: Option<i32>,
33        posted_after: Option<String>,
34        posted_before: Option<String>,
35        next_token: Option<&str>,
36    ) -> Result<models::finances_v0::ListFinancialEventsResponse> {
37        let configuration = self.create_configuration().await?;
38        let _ = self
39            .limiter()
40            .wait("/finances/v0/financialEvents", 0.5, 30)
41            .await?;
42        let res = crate::apis::finances_v0::list_financial_events(
43            &configuration,
44            max_results_per_page,
45            posted_after,
46            posted_before,
47            next_token,
48        )
49        .await?;
50        Ok(res)
51    }
52
53    pub async fn list_financial_events_by_group_id(
54        &self,
55        event_group_id: &str,
56        max_results_per_page: Option<i32>,
57        posted_after: Option<String>,
58        posted_before: Option<String>,
59        next_token: Option<&str>,
60    ) -> Result<models::finances_v0::ListFinancialEventsResponse> {
61        let configuration = self.create_configuration().await?;
62        let _ = self
63            .limiter()
64            .wait("/finances/v0/financialEventsByGroupId", 0.5, 30)
65            .await?;
66        let res = crate::apis::finances_v0::list_financial_events_by_group_id(
67            &configuration,
68            event_group_id,
69            max_results_per_page,
70            posted_after,
71            posted_before,
72            next_token,
73        )
74        .await?;
75        Ok(res)
76    }
77
78    pub async fn list_financial_events_by_order_id(
79        &self,
80        order_id: &str,
81        max_results_per_page: Option<i32>,
82        next_token: Option<&str>,
83    ) -> Result<models::finances_v0::ListFinancialEventsResponse> {
84        let configuration = self.create_configuration().await?;
85        let _ = self
86            .limiter()
87            .wait("/finances/v0/financialEventsByOrderId", 0.5, 30)
88            .await?;
89        let res = crate::apis::finances_v0::list_financial_events_by_order_id(
90            &configuration,
91            order_id,
92            max_results_per_page,
93            next_token,
94        )
95        .await?;
96        Ok(res)
97    }
98}