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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
use serde_json::json;
use crate::model::*;
use crate::FluentRequest;
use serde::{Serialize, Deserialize};
use httpclient::InMemoryResponseExt;
use crate::PlaidClient;
/**You should use this struct via [`PlaidClient::link_token_create`].

On request success, this will return a [`LinkTokenCreateResponse`].*/
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LinkTokenCreateRequest {
    pub access_token: Option<String>,
    pub access_tokens: Option<Vec<String>>,
    pub account_filters: Option<LinkTokenAccountFilters>,
    pub additional_consented_products: Option<Vec<String>>,
    pub android_package_name: Option<String>,
    pub auth: Option<LinkTokenCreateRequestAuth>,
    pub base_report: Option<LinkTokenCreateRequestBaseReport>,
    pub card_switch: Option<LinkTokenCreateCardSwitch>,
    pub client_name: String,
    pub consumer_report_permissible_purpose: Option<String>,
    pub country_codes: Vec<String>,
    pub cra_enabled: Option<bool>,
    pub deposit_switch: Option<LinkTokenCreateRequestDepositSwitch>,
    pub employment: Option<LinkTokenCreateRequestEmployment>,
    pub eu_config: Option<LinkTokenEuConfig>,
    pub hosted_link: Option<LinkTokenCreateHostedLink>,
    pub identity_verification: Option<LinkTokenCreateRequestIdentityVerification>,
    pub income_verification: Option<LinkTokenCreateRequestIncomeVerification>,
    pub institution_data: Option<LinkTokenCreateInstitutionData>,
    pub institution_id: Option<String>,
    pub investments: Option<LinkTokenInvestments>,
    pub investments_auth: Option<LinkTokenInvestmentsAuth>,
    pub language: String,
    pub link_customization_name: Option<String>,
    pub optional_products: Option<Vec<String>>,
    pub payment_initiation: Option<LinkTokenCreateRequestPaymentInitiation>,
    pub products: Option<Vec<String>>,
    pub redirect_uri: Option<String>,
    pub required_if_supported_products: Option<Vec<String>>,
    pub statements: Option<LinkTokenCreateRequestStatements>,
    pub transactions: Option<LinkTokenTransactions>,
    pub transfer: Option<LinkTokenCreateRequestTransfer>,
    pub update: Option<LinkTokenCreateRequestUpdate>,
    pub user: LinkTokenCreateRequestUser,
    pub user_token: Option<String>,
    pub webhook: Option<String>,
}
impl LinkTokenCreateRequest {}
pub struct LinkTokenCreateRequired<'a> {
    pub client_name: &'a str,
    pub country_codes: &'a [&'a str],
    pub language: &'a str,
    pub user: LinkTokenCreateRequestUser,
}
impl<'a> LinkTokenCreateRequired<'a> {}
impl FluentRequest<'_, LinkTokenCreateRequest> {
    pub fn access_token(mut self, access_token: &str) -> Self {
        self.params.access_token = Some(access_token.to_owned());
        self
    }
    pub fn access_tokens(
        mut self,
        access_tokens: impl IntoIterator<Item = impl AsRef<str>>,
    ) -> Self {
        self
            .params
            .access_tokens = Some(
            access_tokens.into_iter().map(|s| s.as_ref().to_owned()).collect(),
        );
        self
    }
    pub fn account_filters(mut self, account_filters: LinkTokenAccountFilters) -> Self {
        self.params.account_filters = Some(account_filters);
        self
    }
    pub fn additional_consented_products(
        mut self,
        additional_consented_products: impl IntoIterator<Item = impl AsRef<str>>,
    ) -> Self {
        self
            .params
            .additional_consented_products = Some(
            additional_consented_products
                .into_iter()
                .map(|s| s.as_ref().to_owned())
                .collect(),
        );
        self
    }
    pub fn android_package_name(mut self, android_package_name: &str) -> Self {
        self.params.android_package_name = Some(android_package_name.to_owned());
        self
    }
    pub fn auth(mut self, auth: LinkTokenCreateRequestAuth) -> Self {
        self.params.auth = Some(auth);
        self
    }
    pub fn base_report(mut self, base_report: LinkTokenCreateRequestBaseReport) -> Self {
        self.params.base_report = Some(base_report);
        self
    }
    pub fn card_switch(mut self, card_switch: LinkTokenCreateCardSwitch) -> Self {
        self.params.card_switch = Some(card_switch);
        self
    }
    pub fn consumer_report_permissible_purpose(
        mut self,
        consumer_report_permissible_purpose: &str,
    ) -> Self {
        self
            .params
            .consumer_report_permissible_purpose = Some(
            consumer_report_permissible_purpose.to_owned(),
        );
        self
    }
    pub fn cra_enabled(mut self, cra_enabled: bool) -> Self {
        self.params.cra_enabled = Some(cra_enabled);
        self
    }
    pub fn deposit_switch(
        mut self,
        deposit_switch: LinkTokenCreateRequestDepositSwitch,
    ) -> Self {
        self.params.deposit_switch = Some(deposit_switch);
        self
    }
    pub fn employment(mut self, employment: LinkTokenCreateRequestEmployment) -> Self {
        self.params.employment = Some(employment);
        self
    }
    pub fn eu_config(mut self, eu_config: LinkTokenEuConfig) -> Self {
        self.params.eu_config = Some(eu_config);
        self
    }
    pub fn hosted_link(mut self, hosted_link: LinkTokenCreateHostedLink) -> Self {
        self.params.hosted_link = Some(hosted_link);
        self
    }
    pub fn identity_verification(
        mut self,
        identity_verification: LinkTokenCreateRequestIdentityVerification,
    ) -> Self {
        self.params.identity_verification = Some(identity_verification);
        self
    }
    pub fn income_verification(
        mut self,
        income_verification: LinkTokenCreateRequestIncomeVerification,
    ) -> Self {
        self.params.income_verification = Some(income_verification);
        self
    }
    pub fn institution_data(
        mut self,
        institution_data: LinkTokenCreateInstitutionData,
    ) -> Self {
        self.params.institution_data = Some(institution_data);
        self
    }
    pub fn institution_id(mut self, institution_id: &str) -> Self {
        self.params.institution_id = Some(institution_id.to_owned());
        self
    }
    pub fn investments(mut self, investments: LinkTokenInvestments) -> Self {
        self.params.investments = Some(investments);
        self
    }
    pub fn investments_auth(
        mut self,
        investments_auth: LinkTokenInvestmentsAuth,
    ) -> Self {
        self.params.investments_auth = Some(investments_auth);
        self
    }
    pub fn link_customization_name(mut self, link_customization_name: &str) -> Self {
        self.params.link_customization_name = Some(link_customization_name.to_owned());
        self
    }
    pub fn optional_products(
        mut self,
        optional_products: impl IntoIterator<Item = impl AsRef<str>>,
    ) -> Self {
        self
            .params
            .optional_products = Some(
            optional_products.into_iter().map(|s| s.as_ref().to_owned()).collect(),
        );
        self
    }
    pub fn payment_initiation(
        mut self,
        payment_initiation: LinkTokenCreateRequestPaymentInitiation,
    ) -> Self {
        self.params.payment_initiation = Some(payment_initiation);
        self
    }
    pub fn products(
        mut self,
        products: impl IntoIterator<Item = impl AsRef<str>>,
    ) -> Self {
        self
            .params
            .products = Some(
            products.into_iter().map(|s| s.as_ref().to_owned()).collect(),
        );
        self
    }
    pub fn redirect_uri(mut self, redirect_uri: &str) -> Self {
        self.params.redirect_uri = Some(redirect_uri.to_owned());
        self
    }
    pub fn required_if_supported_products(
        mut self,
        required_if_supported_products: impl IntoIterator<Item = impl AsRef<str>>,
    ) -> Self {
        self
            .params
            .required_if_supported_products = Some(
            required_if_supported_products
                .into_iter()
                .map(|s| s.as_ref().to_owned())
                .collect(),
        );
        self
    }
    pub fn statements(mut self, statements: LinkTokenCreateRequestStatements) -> Self {
        self.params.statements = Some(statements);
        self
    }
    pub fn transactions(mut self, transactions: LinkTokenTransactions) -> Self {
        self.params.transactions = Some(transactions);
        self
    }
    pub fn transfer(mut self, transfer: LinkTokenCreateRequestTransfer) -> Self {
        self.params.transfer = Some(transfer);
        self
    }
    pub fn update(mut self, update: LinkTokenCreateRequestUpdate) -> Self {
        self.params.update = Some(update);
        self
    }
    pub fn user_token(mut self, user_token: &str) -> Self {
        self.params.user_token = Some(user_token.to_owned());
        self
    }
    pub fn webhook(mut self, webhook: &str) -> Self {
        self.params.webhook = Some(webhook.to_owned());
        self
    }
}
impl<'a> ::std::future::IntoFuture for FluentRequest<'a, LinkTokenCreateRequest> {
    type Output = httpclient::InMemoryResult<LinkTokenCreateResponse>;
    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
    fn into_future(self) -> Self::IntoFuture {
        Box::pin(async {
            let url = "/link/token/create";
            let mut r = self.client.client.post(url);
            r = r.set_query(self.params);
            r = self.client.authenticate(r);
            let res = r.await?;
            res.json().map_err(Into::into)
        })
    }
}