use crate::FluentRequest;
use serde::{Serialize, Deserialize};
use httpclient::InMemoryResponseExt;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TransferLedgerGetRequest {
pub ledger_id: Option<String>,
pub originator_client_id: Option<String>,
}
impl FluentRequest<'_, TransferLedgerGetRequest> {
pub fn ledger_id(mut self, ledger_id: &str) -> Self {
self.params.ledger_id = Some(ledger_id.to_owned());
self
}
pub fn originator_client_id(mut self, originator_client_id: &str) -> Self {
self.params.originator_client_id = Some(originator_client_id.to_owned());
self
}
}
impl<'a> ::std::future::IntoFuture for FluentRequest<'a, TransferLedgerGetRequest> {
type Output = httpclient::InMemoryResult<crate::model::TransferLedgerGetResponse>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let url = "/transfer/ledger/get";
let mut r = self.client.client.post(url);
if let Some(ref unwrapped) = self.params.ledger_id {
r = r.json(serde_json::json!({ "ledger_id" : unwrapped }));
}
if let Some(ref unwrapped) = self.params.originator_client_id {
r = r.json(serde_json::json!({ "originator_client_id" : unwrapped }));
}
r = self.client.authenticate(r);
let res = r.await?;
res.json().map_err(Into::into)
})
}
}
impl crate::PlaidClient {
pub fn transfer_ledger_get(&self) -> FluentRequest<'_, TransferLedgerGetRequest> {
FluentRequest {
client: self,
params: TransferLedgerGetRequest {
ledger_id: None,
originator_client_id: None,
},
}
}
}