plaid/request/
sandbox_transfer_test_clock_create.rs

1use crate::FluentRequest;
2use serde::{Serialize, Deserialize};
3use httpclient::InMemoryResponseExt;
4/**You should use this struct via [`PlaidClient::sandbox_transfer_test_clock_create`].
5
6On request success, this will return a [`SandboxTransferTestClockCreateResponse`].*/
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct SandboxTransferTestClockCreateRequest {
9    pub virtual_time: Option<chrono::DateTime<chrono::Utc>>,
10}
11impl FluentRequest<'_, SandboxTransferTestClockCreateRequest> {
12    ///Set the value of the virtual_time field.
13    pub fn virtual_time(mut self, virtual_time: chrono::DateTime<chrono::Utc>) -> Self {
14        self.params.virtual_time = Some(virtual_time);
15        self
16    }
17}
18impl<'a> ::std::future::IntoFuture
19for FluentRequest<'a, SandboxTransferTestClockCreateRequest> {
20    type Output = httpclient::InMemoryResult<
21        crate::model::SandboxTransferTestClockCreateResponse,
22    >;
23    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
24    fn into_future(self) -> Self::IntoFuture {
25        Box::pin(async move {
26            let url = "/sandbox/transfer/test_clock/create";
27            let mut r = self.client.client.post(url);
28            if let Some(ref unwrapped) = self.params.virtual_time {
29                r = r.json(serde_json::json!({ "virtual_time" : unwrapped }));
30            }
31            r = self.client.authenticate(r);
32            let res = r.await?;
33            res.json().map_err(Into::into)
34        })
35    }
36}
37impl crate::PlaidClient {
38    /**Create a test clock
39
40Use the `/sandbox/transfer/test_clock/create` endpoint to create a `test_clock` in the Sandbox environment.
41
42A test clock object represents an independent timeline and has a `virtual_time` field indicating the current timestamp of the timeline. Test clocks are used for testing recurring transfers in Sandbox.
43
44A test clock can be associated with up to 5 recurring transfers.
45
46See endpoint docs at <https://plaid.com/docs/api/sandbox/#sandboxtransfertest_clockcreate>.*/
47    pub fn sandbox_transfer_test_clock_create(
48        &self,
49    ) -> FluentRequest<'_, SandboxTransferTestClockCreateRequest> {
50        FluentRequest {
51            client: self,
52            params: SandboxTransferTestClockCreateRequest {
53                virtual_time: None,
54            },
55        }
56    }
57}