plaid/request/
wallet_transaction_list.rs

1use crate::FluentRequest;
2use serde::{Serialize, Deserialize};
3use httpclient::InMemoryResponseExt;
4use crate::model::WalletTransactionListRequestOptions;
5/**You should use this struct via [`PlaidClient::wallet_transaction_list`].
6
7On request success, this will return a [`WalletTransactionListResponse`].*/
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct WalletTransactionListRequest {
10    pub count: Option<i64>,
11    pub cursor: Option<String>,
12    pub options: Option<WalletTransactionListRequestOptions>,
13    pub wallet_id: String,
14}
15impl FluentRequest<'_, WalletTransactionListRequest> {
16    ///Set the value of the count field.
17    pub fn count(mut self, count: i64) -> Self {
18        self.params.count = Some(count);
19        self
20    }
21    ///Set the value of the cursor field.
22    pub fn cursor(mut self, cursor: &str) -> Self {
23        self.params.cursor = Some(cursor.to_owned());
24        self
25    }
26    ///Set the value of the options field.
27    pub fn options(mut self, options: WalletTransactionListRequestOptions) -> Self {
28        self.params.options = Some(options);
29        self
30    }
31}
32impl<'a> ::std::future::IntoFuture for FluentRequest<'a, WalletTransactionListRequest> {
33    type Output = httpclient::InMemoryResult<
34        crate::model::WalletTransactionListResponse,
35    >;
36    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
37    fn into_future(self) -> Self::IntoFuture {
38        Box::pin(async move {
39            let url = "/wallet/transaction/list";
40            let mut r = self.client.client.post(url);
41            if let Some(ref unwrapped) = self.params.count {
42                r = r.json(serde_json::json!({ "count" : unwrapped }));
43            }
44            if let Some(ref unwrapped) = self.params.cursor {
45                r = r.json(serde_json::json!({ "cursor" : unwrapped }));
46            }
47            if let Some(ref unwrapped) = self.params.options {
48                r = r.json(serde_json::json!({ "options" : unwrapped }));
49            }
50            r = r.json(serde_json::json!({ "wallet_id" : self.params.wallet_id }));
51            r = self.client.authenticate(r);
52            let res = r.await?;
53            res.json().map_err(Into::into)
54        })
55    }
56}
57impl crate::PlaidClient {
58    /**List e-wallet transactions
59
60This endpoint lists the latest transactions of the specified e-wallet. Transactions are returned in descending order by the `created_at` time.
61
62See endpoint docs at <https://plaid.com/docs/api/products/virtual-accounts/#wallettransactionlist>.*/
63    pub fn wallet_transaction_list(
64        &self,
65        wallet_id: &str,
66    ) -> FluentRequest<'_, WalletTransactionListRequest> {
67        FluentRequest {
68            client: self,
69            params: WalletTransactionListRequest {
70                count: None,
71                cursor: None,
72                options: None,
73                wallet_id: wallet_id.to_owned(),
74            },
75        }
76    }
77}