plaid/request/
bank_transfer_event_list.rs

1use crate::FluentRequest;
2use serde::{Serialize, Deserialize};
3use httpclient::InMemoryResponseExt;
4use crate::model::{
5    BankTransferEventListBankTransferType, BankTransferEventListDirection,
6    BankTransferEventType,
7};
8/**You should use this struct via [`PlaidClient::bank_transfer_event_list`].
9
10On request success, this will return a [`BankTransferEventListResponse`].*/
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct BankTransferEventListRequest {
13    pub account_id: Option<String>,
14    pub bank_transfer_id: Option<String>,
15    pub bank_transfer_type: Option<BankTransferEventListBankTransferType>,
16    pub count: Option<i64>,
17    pub direction: Option<BankTransferEventListDirection>,
18    pub end_date: Option<chrono::DateTime<chrono::Utc>>,
19    pub event_types: Option<Vec<BankTransferEventType>>,
20    pub offset: Option<i64>,
21    pub origination_account_id: Option<String>,
22    pub start_date: Option<chrono::DateTime<chrono::Utc>>,
23}
24impl FluentRequest<'_, BankTransferEventListRequest> {
25    ///Set the value of the account_id field.
26    pub fn account_id(mut self, account_id: &str) -> Self {
27        self.params.account_id = Some(account_id.to_owned());
28        self
29    }
30    ///Set the value of the bank_transfer_id field.
31    pub fn bank_transfer_id(mut self, bank_transfer_id: &str) -> Self {
32        self.params.bank_transfer_id = Some(bank_transfer_id.to_owned());
33        self
34    }
35    ///Set the value of the bank_transfer_type field.
36    pub fn bank_transfer_type(
37        mut self,
38        bank_transfer_type: BankTransferEventListBankTransferType,
39    ) -> Self {
40        self.params.bank_transfer_type = Some(bank_transfer_type);
41        self
42    }
43    ///Set the value of the count field.
44    pub fn count(mut self, count: i64) -> Self {
45        self.params.count = Some(count);
46        self
47    }
48    ///Set the value of the direction field.
49    pub fn direction(mut self, direction: BankTransferEventListDirection) -> Self {
50        self.params.direction = Some(direction);
51        self
52    }
53    ///Set the value of the end_date field.
54    pub fn end_date(mut self, end_date: chrono::DateTime<chrono::Utc>) -> Self {
55        self.params.end_date = Some(end_date);
56        self
57    }
58    ///Set the value of the event_types field.
59    pub fn event_types(mut self, event_types: Vec<BankTransferEventType>) -> Self {
60        self.params.event_types = Some(event_types);
61        self
62    }
63    ///Set the value of the offset field.
64    pub fn offset(mut self, offset: i64) -> Self {
65        self.params.offset = Some(offset);
66        self
67    }
68    ///Set the value of the origination_account_id field.
69    pub fn origination_account_id(mut self, origination_account_id: &str) -> Self {
70        self.params.origination_account_id = Some(origination_account_id.to_owned());
71        self
72    }
73    ///Set the value of the start_date field.
74    pub fn start_date(mut self, start_date: chrono::DateTime<chrono::Utc>) -> Self {
75        self.params.start_date = Some(start_date);
76        self
77    }
78}
79impl<'a> ::std::future::IntoFuture for FluentRequest<'a, BankTransferEventListRequest> {
80    type Output = httpclient::InMemoryResult<
81        crate::model::BankTransferEventListResponse,
82    >;
83    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
84    fn into_future(self) -> Self::IntoFuture {
85        Box::pin(async move {
86            let url = "/bank_transfer/event/list";
87            let mut r = self.client.client.post(url);
88            if let Some(ref unwrapped) = self.params.account_id {
89                r = r.json(serde_json::json!({ "account_id" : unwrapped }));
90            }
91            if let Some(ref unwrapped) = self.params.bank_transfer_id {
92                r = r.json(serde_json::json!({ "bank_transfer_id" : unwrapped }));
93            }
94            if let Some(ref unwrapped) = self.params.bank_transfer_type {
95                r = r.json(serde_json::json!({ "bank_transfer_type" : unwrapped }));
96            }
97            if let Some(ref unwrapped) = self.params.count {
98                r = r.json(serde_json::json!({ "count" : unwrapped }));
99            }
100            if let Some(ref unwrapped) = self.params.direction {
101                r = r.json(serde_json::json!({ "direction" : unwrapped }));
102            }
103            if let Some(ref unwrapped) = self.params.end_date {
104                r = r.json(serde_json::json!({ "end_date" : unwrapped }));
105            }
106            if let Some(ref unwrapped) = self.params.event_types {
107                r = r.json(serde_json::json!({ "event_types" : unwrapped }));
108            }
109            if let Some(ref unwrapped) = self.params.offset {
110                r = r.json(serde_json::json!({ "offset" : unwrapped }));
111            }
112            if let Some(ref unwrapped) = self.params.origination_account_id {
113                r = r.json(serde_json::json!({ "origination_account_id" : unwrapped }));
114            }
115            if let Some(ref unwrapped) = self.params.start_date {
116                r = r.json(serde_json::json!({ "start_date" : unwrapped }));
117            }
118            r = self.client.authenticate(r);
119            let res = r.await?;
120            res.json().map_err(Into::into)
121        })
122    }
123}
124impl crate::PlaidClient {
125    /**List bank transfer events
126
127Use the `/bank_transfer/event/list` endpoint to get a list of Plaid-initiated ACH or bank transfer events based on specified filter criteria. When using Auth with micro-deposit verification enabled, this endpoint can be used to fetch status updates on ACH micro-deposits. For more details, see [micro-deposit events](https://plaid.com/docs/auth/coverage/microdeposit-events/).
128
129See endpoint docs at <https://plaid.com/docs/api/products/auth#bank_transfereventlist>.*/
130    pub fn bank_transfer_event_list(
131        &self,
132    ) -> FluentRequest<'_, BankTransferEventListRequest> {
133        FluentRequest {
134            client: self,
135            params: BankTransferEventListRequest {
136                account_id: None,
137                bank_transfer_id: None,
138                bank_transfer_type: None,
139                count: None,
140                direction: None,
141                end_date: None,
142                event_types: None,
143                offset: None,
144                origination_account_id: None,
145                start_date: None,
146            },
147        }
148    }
149}