1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use serde_json::json;
use crate::model::*;
use crate::PlaidClient;
#[derive(Clone)]
pub struct TransferMigrateAccountRequest<'a> {
pub(crate) http_client: &'a PlaidClient,
pub account_number: String,
pub account_type: String,
pub routing_number: String,
pub wire_routing_number: Option<String>,
}
impl<'a> TransferMigrateAccountRequest<'a> {
pub async fn send(
self,
) -> ::httpclient::InMemoryResult<TransferMigrateAccountResponse> {
let mut r = self.http_client.client.post("/transfer/migrate_account");
r = r.json(json!({ "account_number" : self.account_number }));
r = r.json(json!({ "account_type" : self.account_type }));
r = r.json(json!({ "routing_number" : self.routing_number }));
if let Some(ref unwrapped) = self.wire_routing_number {
r = r.json(json!({ "wire_routing_number" : unwrapped }));
}
r = self.http_client.authenticate(r);
let res = r.send_awaiting_body().await?;
res.json()
}
pub fn wire_routing_number(mut self, wire_routing_number: &str) -> Self {
self.wire_routing_number = Some(wire_routing_number.to_owned());
self
}
}
impl<'a> ::std::future::IntoFuture for TransferMigrateAccountRequest<'a> {
type Output = httpclient::InMemoryResult<TransferMigrateAccountResponse>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.send())
}
}