plaid/request/
bank_transfer_event_list.rs1use crate::FluentRequest;
2use serde::{Serialize, Deserialize};
3use httpclient::InMemoryResponseExt;
4use crate::model::{
5 BankTransferEventListBankTransferType, BankTransferEventListDirection,
6 BankTransferEventType,
7};
8#[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 pub fn account_id(mut self, account_id: &str) -> Self {
27 self.params.account_id = Some(account_id.to_owned());
28 self
29 }
30 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 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 pub fn count(mut self, count: i64) -> Self {
45 self.params.count = Some(count);
46 self
47 }
48 pub fn direction(mut self, direction: BankTransferEventListDirection) -> Self {
50 self.params.direction = Some(direction);
51 self
52 }
53 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 pub fn event_types(mut self, event_types: Vec<BankTransferEventType>) -> Self {
60 self.params.event_types = Some(event_types);
61 self
62 }
63 pub fn offset(mut self, offset: i64) -> Self {
65 self.params.offset = Some(offset);
66 self
67 }
68 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 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 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}