use crate::FluentRequest;
use serde::{Serialize, Deserialize};
use httpclient::InMemoryResponseExt;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TransferRecurringListRequest {
pub count: Option<i64>,
pub end_time: Option<chrono::DateTime<chrono::Utc>>,
pub funding_account_id: Option<String>,
pub offset: Option<i64>,
pub start_time: Option<chrono::DateTime<chrono::Utc>>,
}
impl FluentRequest<'_, TransferRecurringListRequest> {
pub fn count(mut self, count: i64) -> Self {
self.params.count = Some(count);
self
}
pub fn end_time(mut self, end_time: chrono::DateTime<chrono::Utc>) -> Self {
self.params.end_time = Some(end_time);
self
}
pub fn funding_account_id(mut self, funding_account_id: &str) -> Self {
self.params.funding_account_id = Some(funding_account_id.to_owned());
self
}
pub fn offset(mut self, offset: i64) -> Self {
self.params.offset = Some(offset);
self
}
pub fn start_time(mut self, start_time: chrono::DateTime<chrono::Utc>) -> Self {
self.params.start_time = Some(start_time);
self
}
}
impl<'a> ::std::future::IntoFuture for FluentRequest<'a, TransferRecurringListRequest> {
type Output = httpclient::InMemoryResult<
crate::model::TransferRecurringListResponse,
>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let url = "/transfer/recurring/list";
let mut r = self.client.client.post(url);
if let Some(ref unwrapped) = self.params.count {
r = r.json(serde_json::json!({ "count" : unwrapped }));
}
if let Some(ref unwrapped) = self.params.end_time {
r = r.json(serde_json::json!({ "end_time" : unwrapped }));
}
if let Some(ref unwrapped) = self.params.funding_account_id {
r = r.json(serde_json::json!({ "funding_account_id" : unwrapped }));
}
if let Some(ref unwrapped) = self.params.offset {
r = r.json(serde_json::json!({ "offset" : unwrapped }));
}
if let Some(ref unwrapped) = self.params.start_time {
r = r.json(serde_json::json!({ "start_time" : unwrapped }));
}
r = self.client.authenticate(r);
let res = r.await?;
res.json().map_err(Into::into)
})
}
}
impl crate::PlaidClient {
pub fn transfer_recurring_list(
&self,
) -> FluentRequest<'_, TransferRecurringListRequest> {
FluentRequest {
client: self,
params: TransferRecurringListRequest {
count: None,
end_time: None,
funding_account_id: None,
offset: None,
start_time: None,
},
}
}
}