binance/wallet/apis/
travel_rule_api.rs

1/*
2 * Binance Wallet API
3 *
4 * OpenAPI specification for Binance exchange - Wallet API
5 *
6 * The version of the OpenAPI document: 0.1.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::wallet::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`wallet_create_localentity_broker_withdraw_apply_v1`]
18#[derive(Clone, Debug, Default)]
19pub struct WalletCreateLocalentityBrokerWithdrawApplyV1Params {
20    pub address: String,
21    pub amount: String,
22    pub coin: String,
23    pub originator_pii: String,
24    pub questionnaire: String,
25    pub signature: String,
26    pub sub_account_id: String,
27    pub timestamp: i64,
28    pub withdraw_order_id: String,
29    pub address_name: Option<String>,
30    pub address_tag: Option<String>,
31    pub network: Option<String>,
32    pub transaction_fee_flag: Option<bool>,
33    pub wallet_type: Option<i32>
34}
35
36/// struct for passing parameters to the method [`wallet_create_localentity_withdraw_apply_v1`]
37#[derive(Clone, Debug, Default)]
38pub struct WalletCreateLocalentityWithdrawApplyV1Params {
39    pub address: String,
40    pub amount: String,
41    pub coin: String,
42    pub questionnaire: String,
43    pub timestamp: i64,
44    pub address_tag: Option<String>,
45    pub name: Option<String>,
46    pub network: Option<String>,
47    pub recv_window: Option<i64>,
48    pub transaction_fee_flag: Option<bool>,
49    pub wallet_type: Option<i32>,
50    pub withdraw_order_id: Option<String>
51}
52
53/// struct for passing parameters to the method [`wallet_get_localentity_deposit_history_v1`]
54#[derive(Clone, Debug, Default)]
55pub struct WalletGetLocalentityDepositHistoryV1Params {
56    pub timestamp: i64,
57    /// Comma(,) separated list of travel rule record Ids.
58    pub tr_id: Option<String>,
59    /// Comma(,) separated list of transaction Ids.
60    pub tx_id: Option<String>,
61    /// Comma(,) separated list of wallet tran Ids.
62    pub tran_id: Option<String>,
63    pub network: Option<String>,
64    pub coin: Option<String>,
65    /// 0:Completed,1:Pending,2:Failed
66    pub travel_rule_status: Option<i32>,
67    /// true: Only return records that pending deposit questionnaire. false/not provided: return all records.
68    pub pending_questionnaire: Option<bool>,
69    /// Default: 90 days from current timestamp
70    pub start_time: Option<i64>,
71    /// Default: present timestamp
72    pub end_time: Option<i64>,
73    /// Default:0
74    pub offset: Option<i32>,
75    /// Default:1000, Max:1000
76    pub limit: Option<i32>
77}
78
79/// struct for passing parameters to the method [`wallet_get_localentity_withdraw_history_v1`]
80#[derive(Clone, Debug, Default)]
81pub struct WalletGetLocalentityWithdrawHistoryV1Params {
82    pub timestamp: i64,
83    /// Comma(,) separated list of travel rule record Ids.
84    pub tr_id: Option<String>,
85    /// Comma(,) separated list of transaction Ids.
86    pub tx_id: Option<String>,
87    /// Comma(,) separated list of withdrawID defined by the client (i.e. client&#39;s internal withdrawID).
88    pub withdraw_order_id: Option<String>,
89    pub network: Option<String>,
90    pub coin: Option<String>,
91    /// 0:Completed,1:Pending,2:Failed
92    pub travel_rule_status: Option<i32>,
93    /// Default: 0
94    pub offset: Option<i32>,
95    /// Default: 1000, Max: 1000
96    pub limit: Option<i32>,
97    /// Default: 90 days from current timestamp
98    pub start_time: Option<i64>,
99    /// Default: present timestamp
100    pub end_time: Option<i64>,
101    pub recv_window: Option<i64>
102}
103
104/// struct for passing parameters to the method [`wallet_get_localentity_withdraw_history_v2`]
105#[derive(Clone, Debug, Default)]
106pub struct WalletGetLocalentityWithdrawHistoryV2Params {
107    pub timestamp: i64,
108    /// Comma(,) separated list of travel rule record Ids.
109    pub tr_id: Option<String>,
110    /// Comma(,) separated list of transaction Ids.
111    pub tx_id: Option<String>,
112    /// Withdraw ID defined by the client (i.e. client&#39;s internal withdrawID).
113    pub withdraw_order_id: Option<String>,
114    pub network: Option<String>,
115    pub coin: Option<String>,
116    /// 0:Completed,1:Pending,2:Failed
117    pub travel_rule_status: Option<i32>,
118    /// Default: 0
119    pub offset: Option<i32>,
120    /// Default: 1000, Max: 1000
121    pub limit: Option<i32>,
122    /// Default: 90 days from current timestamp
123    pub start_time: Option<i64>,
124    /// Default: present timestamp
125    pub end_time: Option<i64>,
126    pub recv_window: Option<i64>
127}
128
129/// struct for passing parameters to the method [`wallet_update_localentity_broker_deposit_provide_info_v1`]
130#[derive(Clone, Debug, Default)]
131pub struct WalletUpdateLocalentityBrokerDepositProvideInfoV1Params {
132    pub beneficiary_pii: String,
133    pub deposit_id: String,
134    pub questionnaire: String,
135    pub signature: String,
136    pub sub_account_id: String,
137    pub timestamp: i64,
138    pub address: Option<String>,
139    pub address_tag: Option<String>,
140    pub amount: Option<String>,
141    pub coin: Option<String>,
142    pub network: Option<String>
143}
144
145/// struct for passing parameters to the method [`wallet_update_localentity_deposit_provide_info_v1`]
146#[derive(Clone, Debug, Default)]
147pub struct WalletUpdateLocalentityDepositProvideInfoV1Params {
148    pub questionnaire: String,
149    pub timestamp: i64,
150    pub tran_id: i64
151}
152
153
154/// struct for typed errors of method [`wallet_create_localentity_broker_withdraw_apply_v1`]
155#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum WalletCreateLocalentityBrokerWithdrawApplyV1Error {
158    Status4XX(models::ApiError),
159    Status5XX(models::ApiError),
160    UnknownValue(serde_json::Value),
161}
162
163/// struct for typed errors of method [`wallet_create_localentity_withdraw_apply_v1`]
164#[derive(Debug, Clone, Serialize, Deserialize)]
165#[serde(untagged)]
166pub enum WalletCreateLocalentityWithdrawApplyV1Error {
167    Status4XX(models::ApiError),
168    Status5XX(models::ApiError),
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`wallet_get_localentity_deposit_history_v1`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum WalletGetLocalentityDepositHistoryV1Error {
176    Status4XX(models::ApiError),
177    Status5XX(models::ApiError),
178    UnknownValue(serde_json::Value),
179}
180
181/// struct for typed errors of method [`wallet_get_localentity_vasp_v1`]
182#[derive(Debug, Clone, Serialize, Deserialize)]
183#[serde(untagged)]
184pub enum WalletGetLocalentityVaspV1Error {
185    Status4XX(models::ApiError),
186    Status5XX(models::ApiError),
187    UnknownValue(serde_json::Value),
188}
189
190/// struct for typed errors of method [`wallet_get_localentity_withdraw_history_v1`]
191#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum WalletGetLocalentityWithdrawHistoryV1Error {
194    Status4XX(models::ApiError),
195    Status5XX(models::ApiError),
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`wallet_get_localentity_withdraw_history_v2`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum WalletGetLocalentityWithdrawHistoryV2Error {
203    Status4XX(models::ApiError),
204    Status5XX(models::ApiError),
205    UnknownValue(serde_json::Value),
206}
207
208/// struct for typed errors of method [`wallet_update_localentity_broker_deposit_provide_info_v1`]
209#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum WalletUpdateLocalentityBrokerDepositProvideInfoV1Error {
212    Status4XX(models::ApiError),
213    Status5XX(models::ApiError),
214    UnknownValue(serde_json::Value),
215}
216
217/// struct for typed errors of method [`wallet_update_localentity_deposit_provide_info_v1`]
218#[derive(Debug, Clone, Serialize, Deserialize)]
219#[serde(untagged)]
220pub enum WalletUpdateLocalentityDepositProvideInfoV1Error {
221    Status4XX(models::ApiError),
222    Status5XX(models::ApiError),
223    UnknownValue(serde_json::Value),
224}
225
226
227/// Submit a withdrawal request for brokers of local entities that required travel rule.
228pub async fn wallet_create_localentity_broker_withdraw_apply_v1(configuration: &configuration::Configuration, params: WalletCreateLocalentityBrokerWithdrawApplyV1Params) -> Result<models::WalletCreateLocalentityBrokerWithdrawApplyV1Resp, Error<WalletCreateLocalentityBrokerWithdrawApplyV1Error>> {
229
230    let uri_str = format!("{}/sapi/v1/localentity/broker/withdraw/apply", configuration.base_path);
231    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
232
233    // Create a mutable vector for query parameters
234    let mut query_params: Vec<(String, String)> = Vec::new();
235
236
237    // Create header parameters collection
238    let mut header_params = std::collections::HashMap::new();
239
240    // Handle Binance Auth first if configured
241    if let Some(ref binance_auth) = configuration.binance_auth {
242        // Add API key to headers
243        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
244        
245        // Generate request body for signing (if any)
246        let body_string: Option<Vec<u8>> = None;
247        
248        // Sign the request
249        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
250            Ok(sig) => sig,
251            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
252        };
253        
254        // Add signature to query params
255        query_params.push(("signature".to_string(), signature));
256    }
257
258    // Apply all query parameters
259    if !query_params.is_empty() {
260        req_builder = req_builder.query(&query_params);
261    }
262
263
264    // Add user agent if configured
265    if let Some(ref user_agent) = configuration.user_agent {
266        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
267    }
268
269    // Apply all header parameters
270    for (header_name, header_value) in header_params {
271        req_builder = req_builder.header(&header_name, &header_value);
272    }
273
274    let mut multipart_form_params = std::collections::HashMap::new();
275    multipart_form_params.insert("address", params.address.to_string());
276    if let Some(param_value) = params.address_name {
277        multipart_form_params.insert("addressName", param_value.to_string());
278    }
279    if let Some(param_value) = params.address_tag {
280        multipart_form_params.insert("addressTag", param_value.to_string());
281    }
282    multipart_form_params.insert("amount", params.amount.to_string());
283    multipart_form_params.insert("coin", params.coin.to_string());
284    if let Some(param_value) = params.network {
285        multipart_form_params.insert("network", param_value.to_string());
286    }
287    multipart_form_params.insert("originatorPii", params.originator_pii.to_string());
288    multipart_form_params.insert("questionnaire", params.questionnaire.to_string());
289    multipart_form_params.insert("signature", params.signature.to_string());
290    multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
291    multipart_form_params.insert("timestamp", params.timestamp.to_string());
292    if let Some(param_value) = params.transaction_fee_flag {
293        multipart_form_params.insert("transactionFeeFlag", param_value.to_string());
294    }
295    if let Some(param_value) = params.wallet_type {
296        multipart_form_params.insert("walletType", param_value.to_string());
297    }
298    multipart_form_params.insert("withdrawOrderId", params.withdraw_order_id.to_string());
299    req_builder = req_builder.form(&multipart_form_params);
300
301    let req = req_builder.build()?;
302    let resp = configuration.client.execute(req).await?;
303
304    let status = resp.status();
305    let content_type = resp
306        .headers()
307        .get("content-type")
308        .and_then(|v| v.to_str().ok())
309        .unwrap_or("application/octet-stream");
310    let content_type = super::ContentType::from(content_type);
311
312    if !status.is_client_error() && !status.is_server_error() {
313        let content = resp.text().await?;
314        match content_type {
315            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
316            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletCreateLocalentityBrokerWithdrawApplyV1Resp`"))),
317            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WalletCreateLocalentityBrokerWithdrawApplyV1Resp`")))),
318        }
319    } else {
320        let content = resp.text().await?;
321        let entity: Option<WalletCreateLocalentityBrokerWithdrawApplyV1Error> = serde_json::from_str(&content).ok();
322        Err(Error::ResponseError(ResponseContent { status, content, entity }))
323    }
324}
325
326/// Submit a withdrawal request for local entities that required travel rule.
327pub async fn wallet_create_localentity_withdraw_apply_v1(configuration: &configuration::Configuration, params: WalletCreateLocalentityWithdrawApplyV1Params) -> Result<models::WalletCreateLocalentityWithdrawApplyV1Resp, Error<WalletCreateLocalentityWithdrawApplyV1Error>> {
328
329    let uri_str = format!("{}/sapi/v1/localentity/withdraw/apply", configuration.base_path);
330    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
331
332    // Create a mutable vector for query parameters
333    let mut query_params: Vec<(String, String)> = Vec::new();
334
335
336    // Create header parameters collection
337    let mut header_params = std::collections::HashMap::new();
338
339    // Handle Binance Auth first if configured
340    if let Some(ref binance_auth) = configuration.binance_auth {
341        // Add API key to headers
342        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
343        
344        // Generate request body for signing (if any)
345        let body_string: Option<Vec<u8>> = None;
346        
347        // Sign the request
348        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
349            Ok(sig) => sig,
350            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
351        };
352        
353        // Add signature to query params
354        query_params.push(("signature".to_string(), signature));
355    }
356
357    // Apply all query parameters
358    if !query_params.is_empty() {
359        req_builder = req_builder.query(&query_params);
360    }
361
362
363    // Add user agent if configured
364    if let Some(ref user_agent) = configuration.user_agent {
365        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
366    }
367
368    // Apply all header parameters
369    for (header_name, header_value) in header_params {
370        req_builder = req_builder.header(&header_name, &header_value);
371    }
372
373    let mut multipart_form_params = std::collections::HashMap::new();
374    multipart_form_params.insert("address", params.address.to_string());
375    if let Some(param_value) = params.address_tag {
376        multipart_form_params.insert("addressTag", param_value.to_string());
377    }
378    multipart_form_params.insert("amount", params.amount.to_string());
379    multipart_form_params.insert("coin", params.coin.to_string());
380    if let Some(param_value) = params.name {
381        multipart_form_params.insert("name", param_value.to_string());
382    }
383    if let Some(param_value) = params.network {
384        multipart_form_params.insert("network", param_value.to_string());
385    }
386    multipart_form_params.insert("questionnaire", params.questionnaire.to_string());
387    if let Some(param_value) = params.recv_window {
388        multipart_form_params.insert("recvWindow", param_value.to_string());
389    }
390    multipart_form_params.insert("timestamp", params.timestamp.to_string());
391    if let Some(param_value) = params.transaction_fee_flag {
392        multipart_form_params.insert("transactionFeeFlag", param_value.to_string());
393    }
394    if let Some(param_value) = params.wallet_type {
395        multipart_form_params.insert("walletType", param_value.to_string());
396    }
397    if let Some(param_value) = params.withdraw_order_id {
398        multipart_form_params.insert("withdrawOrderId", param_value.to_string());
399    }
400    req_builder = req_builder.form(&multipart_form_params);
401
402    let req = req_builder.build()?;
403    let resp = configuration.client.execute(req).await?;
404
405    let status = resp.status();
406    let content_type = resp
407        .headers()
408        .get("content-type")
409        .and_then(|v| v.to_str().ok())
410        .unwrap_or("application/octet-stream");
411    let content_type = super::ContentType::from(content_type);
412
413    if !status.is_client_error() && !status.is_server_error() {
414        let content = resp.text().await?;
415        match content_type {
416            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
417            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletCreateLocalentityWithdrawApplyV1Resp`"))),
418            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WalletCreateLocalentityWithdrawApplyV1Resp`")))),
419        }
420    } else {
421        let content = resp.text().await?;
422        let entity: Option<WalletCreateLocalentityWithdrawApplyV1Error> = serde_json::from_str(&content).ok();
423        Err(Error::ResponseError(ResponseContent { status, content, entity }))
424    }
425}
426
427/// Fetch deposit history for local entities that required travel rule.
428pub async fn wallet_get_localentity_deposit_history_v1(configuration: &configuration::Configuration, params: WalletGetLocalentityDepositHistoryV1Params) -> Result<Vec<models::WalletGetLocalentityDepositHistoryV1RespItem>, Error<WalletGetLocalentityDepositHistoryV1Error>> {
429
430    let uri_str = format!("{}/sapi/v1/localentity/deposit/history", configuration.base_path);
431    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
432
433    // Create a mutable vector for query parameters
434    let mut query_params: Vec<(String, String)> = Vec::new();
435
436    if let Some(ref param_value) = params.tr_id {
437        query_params.push(("trId".to_string(), param_value.to_string()));
438    }
439    if let Some(ref param_value) = params.tx_id {
440        query_params.push(("txId".to_string(), param_value.to_string()));
441    }
442    if let Some(ref param_value) = params.tran_id {
443        query_params.push(("tranId".to_string(), param_value.to_string()));
444    }
445    if let Some(ref param_value) = params.network {
446        query_params.push(("network".to_string(), param_value.to_string()));
447    }
448    if let Some(ref param_value) = params.coin {
449        query_params.push(("coin".to_string(), param_value.to_string()));
450    }
451    if let Some(ref param_value) = params.travel_rule_status {
452        query_params.push(("travelRuleStatus".to_string(), param_value.to_string()));
453    }
454    if let Some(ref param_value) = params.pending_questionnaire {
455        query_params.push(("pendingQuestionnaire".to_string(), param_value.to_string()));
456    }
457    if let Some(ref param_value) = params.start_time {
458        query_params.push(("startTime".to_string(), param_value.to_string()));
459    }
460    if let Some(ref param_value) = params.end_time {
461        query_params.push(("endTime".to_string(), param_value.to_string()));
462    }
463    if let Some(ref param_value) = params.offset {
464        query_params.push(("offset".to_string(), param_value.to_string()));
465    }
466    if let Some(ref param_value) = params.limit {
467        query_params.push(("limit".to_string(), param_value.to_string()));
468    }
469    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
470
471    // Create header parameters collection
472    let mut header_params = std::collections::HashMap::new();
473
474    // Handle Binance Auth first if configured
475    if let Some(ref binance_auth) = configuration.binance_auth {
476        // Add API key to headers
477        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
478        
479        // Generate request body for signing (if any)
480        let body_string: Option<Vec<u8>> = None;
481        
482        // Sign the request
483        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
484            Ok(sig) => sig,
485            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
486        };
487        
488        // Add signature to query params
489        query_params.push(("signature".to_string(), signature));
490    }
491
492    // Apply all query parameters
493    if !query_params.is_empty() {
494        req_builder = req_builder.query(&query_params);
495    }
496
497
498    // Add user agent if configured
499    if let Some(ref user_agent) = configuration.user_agent {
500        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
501    }
502
503    // Apply all header parameters
504    for (header_name, header_value) in header_params {
505        req_builder = req_builder.header(&header_name, &header_value);
506    }
507
508
509    let req = req_builder.build()?;
510    let resp = configuration.client.execute(req).await?;
511
512    let status = resp.status();
513    let content_type = resp
514        .headers()
515        .get("content-type")
516        .and_then(|v| v.to_str().ok())
517        .unwrap_or("application/octet-stream");
518    let content_type = super::ContentType::from(content_type);
519
520    if !status.is_client_error() && !status.is_server_error() {
521        let content = resp.text().await?;
522        match content_type {
523            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
524            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::WalletGetLocalentityDepositHistoryV1RespItem&gt;`"))),
525            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::WalletGetLocalentityDepositHistoryV1RespItem&gt;`")))),
526        }
527    } else {
528        let content = resp.text().await?;
529        let entity: Option<WalletGetLocalentityDepositHistoryV1Error> = serde_json::from_str(&content).ok();
530        Err(Error::ResponseError(ResponseContent { status, content, entity }))
531    }
532}
533
534/// Fetch the onboarded VASP list for local entities that required travel rule.
535pub async fn wallet_get_localentity_vasp_v1(configuration: &configuration::Configuration) -> Result<Vec<models::WalletGetLocalentityVaspV1RespItem>, Error<WalletGetLocalentityVaspV1Error>> {
536
537    let uri_str = format!("{}/sapi/v1/localentity/vasp", configuration.base_path);
538    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
539
540    // Create a mutable vector for query parameters
541    let mut query_params: Vec<(String, String)> = Vec::new();
542
543
544    // Create header parameters collection
545    let mut header_params = std::collections::HashMap::new();
546
547    // Handle Binance Auth first if configured
548    if let Some(ref binance_auth) = configuration.binance_auth {
549        // Add API key to headers
550        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
551        
552        // Generate request body for signing (if any)
553        let body_string: Option<Vec<u8>> = None;
554        
555        // Sign the request
556        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
557            Ok(sig) => sig,
558            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
559        };
560        
561        // Add signature to query params
562        query_params.push(("signature".to_string(), signature));
563    }
564
565    // Apply all query parameters
566    if !query_params.is_empty() {
567        req_builder = req_builder.query(&query_params);
568    }
569
570
571    // Add user agent if configured
572    if let Some(ref user_agent) = configuration.user_agent {
573        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
574    }
575
576    // Apply all header parameters
577    for (header_name, header_value) in header_params {
578        req_builder = req_builder.header(&header_name, &header_value);
579    }
580
581
582    let req = req_builder.build()?;
583    let resp = configuration.client.execute(req).await?;
584
585    let status = resp.status();
586    let content_type = resp
587        .headers()
588        .get("content-type")
589        .and_then(|v| v.to_str().ok())
590        .unwrap_or("application/octet-stream");
591    let content_type = super::ContentType::from(content_type);
592
593    if !status.is_client_error() && !status.is_server_error() {
594        let content = resp.text().await?;
595        match content_type {
596            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
597            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::WalletGetLocalentityVaspV1RespItem&gt;`"))),
598            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::WalletGetLocalentityVaspV1RespItem&gt;`")))),
599        }
600    } else {
601        let content = resp.text().await?;
602        let entity: Option<WalletGetLocalentityVaspV1Error> = serde_json::from_str(&content).ok();
603        Err(Error::ResponseError(ResponseContent { status, content, entity }))
604    }
605}
606
607/// Fetch withdraw history for local entities that required travel rule.
608pub async fn wallet_get_localentity_withdraw_history_v1(configuration: &configuration::Configuration, params: WalletGetLocalentityWithdrawHistoryV1Params) -> Result<Vec<models::WalletGetLocalentityWithdrawHistoryV1RespItem>, Error<WalletGetLocalentityWithdrawHistoryV1Error>> {
609
610    let uri_str = format!("{}/sapi/v1/localentity/withdraw/history", configuration.base_path);
611    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
612
613    // Create a mutable vector for query parameters
614    let mut query_params: Vec<(String, String)> = Vec::new();
615
616    if let Some(ref param_value) = params.tr_id {
617        query_params.push(("trId".to_string(), param_value.to_string()));
618    }
619    if let Some(ref param_value) = params.tx_id {
620        query_params.push(("txId".to_string(), param_value.to_string()));
621    }
622    if let Some(ref param_value) = params.withdraw_order_id {
623        query_params.push(("withdrawOrderId".to_string(), param_value.to_string()));
624    }
625    if let Some(ref param_value) = params.network {
626        query_params.push(("network".to_string(), param_value.to_string()));
627    }
628    if let Some(ref param_value) = params.coin {
629        query_params.push(("coin".to_string(), param_value.to_string()));
630    }
631    if let Some(ref param_value) = params.travel_rule_status {
632        query_params.push(("travelRuleStatus".to_string(), param_value.to_string()));
633    }
634    if let Some(ref param_value) = params.offset {
635        query_params.push(("offset".to_string(), param_value.to_string()));
636    }
637    if let Some(ref param_value) = params.limit {
638        query_params.push(("limit".to_string(), param_value.to_string()));
639    }
640    if let Some(ref param_value) = params.start_time {
641        query_params.push(("startTime".to_string(), param_value.to_string()));
642    }
643    if let Some(ref param_value) = params.end_time {
644        query_params.push(("endTime".to_string(), param_value.to_string()));
645    }
646    if let Some(ref param_value) = params.recv_window {
647        query_params.push(("recvWindow".to_string(), param_value.to_string()));
648    }
649    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
650
651    // Create header parameters collection
652    let mut header_params = std::collections::HashMap::new();
653
654    // Handle Binance Auth first if configured
655    if let Some(ref binance_auth) = configuration.binance_auth {
656        // Add API key to headers
657        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
658        
659        // Generate request body for signing (if any)
660        let body_string: Option<Vec<u8>> = None;
661        
662        // Sign the request
663        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
664            Ok(sig) => sig,
665            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
666        };
667        
668        // Add signature to query params
669        query_params.push(("signature".to_string(), signature));
670    }
671
672    // Apply all query parameters
673    if !query_params.is_empty() {
674        req_builder = req_builder.query(&query_params);
675    }
676
677
678    // Add user agent if configured
679    if let Some(ref user_agent) = configuration.user_agent {
680        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
681    }
682
683    // Apply all header parameters
684    for (header_name, header_value) in header_params {
685        req_builder = req_builder.header(&header_name, &header_value);
686    }
687
688
689    let req = req_builder.build()?;
690    let resp = configuration.client.execute(req).await?;
691
692    let status = resp.status();
693    let content_type = resp
694        .headers()
695        .get("content-type")
696        .and_then(|v| v.to_str().ok())
697        .unwrap_or("application/octet-stream");
698    let content_type = super::ContentType::from(content_type);
699
700    if !status.is_client_error() && !status.is_server_error() {
701        let content = resp.text().await?;
702        match content_type {
703            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
704            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::WalletGetLocalentityWithdrawHistoryV1RespItem&gt;`"))),
705            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::WalletGetLocalentityWithdrawHistoryV1RespItem&gt;`")))),
706        }
707    } else {
708        let content = resp.text().await?;
709        let entity: Option<WalletGetLocalentityWithdrawHistoryV1Error> = serde_json::from_str(&content).ok();
710        Err(Error::ResponseError(ResponseContent { status, content, entity }))
711    }
712}
713
714/// Fetch withdraw history for local entities that required travel rule.
715pub async fn wallet_get_localentity_withdraw_history_v2(configuration: &configuration::Configuration, params: WalletGetLocalentityWithdrawHistoryV2Params) -> Result<Vec<models::WalletGetLocalentityWithdrawHistoryV2RespItem>, Error<WalletGetLocalentityWithdrawHistoryV2Error>> {
716
717    let uri_str = format!("{}/sapi/v2/localentity/withdraw/history", configuration.base_path);
718    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
719
720    // Create a mutable vector for query parameters
721    let mut query_params: Vec<(String, String)> = Vec::new();
722
723    if let Some(ref param_value) = params.tr_id {
724        query_params.push(("trId".to_string(), param_value.to_string()));
725    }
726    if let Some(ref param_value) = params.tx_id {
727        query_params.push(("txId".to_string(), param_value.to_string()));
728    }
729    if let Some(ref param_value) = params.withdraw_order_id {
730        query_params.push(("withdrawOrderId".to_string(), param_value.to_string()));
731    }
732    if let Some(ref param_value) = params.network {
733        query_params.push(("network".to_string(), param_value.to_string()));
734    }
735    if let Some(ref param_value) = params.coin {
736        query_params.push(("coin".to_string(), param_value.to_string()));
737    }
738    if let Some(ref param_value) = params.travel_rule_status {
739        query_params.push(("travelRuleStatus".to_string(), param_value.to_string()));
740    }
741    if let Some(ref param_value) = params.offset {
742        query_params.push(("offset".to_string(), param_value.to_string()));
743    }
744    if let Some(ref param_value) = params.limit {
745        query_params.push(("limit".to_string(), param_value.to_string()));
746    }
747    if let Some(ref param_value) = params.start_time {
748        query_params.push(("startTime".to_string(), param_value.to_string()));
749    }
750    if let Some(ref param_value) = params.end_time {
751        query_params.push(("endTime".to_string(), param_value.to_string()));
752    }
753    if let Some(ref param_value) = params.recv_window {
754        query_params.push(("recvWindow".to_string(), param_value.to_string()));
755    }
756    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
757
758    // Create header parameters collection
759    let mut header_params = std::collections::HashMap::new();
760
761    // Handle Binance Auth first if configured
762    if let Some(ref binance_auth) = configuration.binance_auth {
763        // Add API key to headers
764        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
765        
766        // Generate request body for signing (if any)
767        let body_string: Option<Vec<u8>> = None;
768        
769        // Sign the request
770        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
771            Ok(sig) => sig,
772            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
773        };
774        
775        // Add signature to query params
776        query_params.push(("signature".to_string(), signature));
777    }
778
779    // Apply all query parameters
780    if !query_params.is_empty() {
781        req_builder = req_builder.query(&query_params);
782    }
783
784
785    // Add user agent if configured
786    if let Some(ref user_agent) = configuration.user_agent {
787        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
788    }
789
790    // Apply all header parameters
791    for (header_name, header_value) in header_params {
792        req_builder = req_builder.header(&header_name, &header_value);
793    }
794
795
796    let req = req_builder.build()?;
797    let resp = configuration.client.execute(req).await?;
798
799    let status = resp.status();
800    let content_type = resp
801        .headers()
802        .get("content-type")
803        .and_then(|v| v.to_str().ok())
804        .unwrap_or("application/octet-stream");
805    let content_type = super::ContentType::from(content_type);
806
807    if !status.is_client_error() && !status.is_server_error() {
808        let content = resp.text().await?;
809        match content_type {
810            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
811            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::WalletGetLocalentityWithdrawHistoryV2RespItem&gt;`"))),
812            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::WalletGetLocalentityWithdrawHistoryV2RespItem&gt;`")))),
813        }
814    } else {
815        let content = resp.text().await?;
816        let entity: Option<WalletGetLocalentityWithdrawHistoryV2Error> = serde_json::from_str(&content).ok();
817        Err(Error::ResponseError(ResponseContent { status, content, entity }))
818    }
819}
820
821/// Submit questionnaire for brokers of local entities that require travel rule. The questionnaire is only applies to transactions from un-hosted wallets or VASPs that are not yet onboarded with GTR.
822pub async fn wallet_update_localentity_broker_deposit_provide_info_v1(configuration: &configuration::Configuration, params: WalletUpdateLocalentityBrokerDepositProvideInfoV1Params) -> Result<models::WalletUpdateLocalentityBrokerDepositProvideInfoV1Resp, Error<WalletUpdateLocalentityBrokerDepositProvideInfoV1Error>> {
823
824    let uri_str = format!("{}/sapi/v1/localentity/broker/deposit/provide-info", configuration.base_path);
825    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
826
827    // Create a mutable vector for query parameters
828    let mut query_params: Vec<(String, String)> = Vec::new();
829
830
831    // Create header parameters collection
832    let mut header_params = std::collections::HashMap::new();
833
834    // Handle Binance Auth first if configured
835    if let Some(ref binance_auth) = configuration.binance_auth {
836        // Add API key to headers
837        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
838        
839        // Generate request body for signing (if any)
840        let body_string: Option<Vec<u8>> = None;
841        
842        // Sign the request
843        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
844            Ok(sig) => sig,
845            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
846        };
847        
848        // Add signature to query params
849        query_params.push(("signature".to_string(), signature));
850    }
851
852    // Apply all query parameters
853    if !query_params.is_empty() {
854        req_builder = req_builder.query(&query_params);
855    }
856
857
858    // Add user agent if configured
859    if let Some(ref user_agent) = configuration.user_agent {
860        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
861    }
862
863    // Apply all header parameters
864    for (header_name, header_value) in header_params {
865        req_builder = req_builder.header(&header_name, &header_value);
866    }
867
868    let mut multipart_form_params = std::collections::HashMap::new();
869    if let Some(param_value) = params.address {
870        multipart_form_params.insert("address", param_value.to_string());
871    }
872    if let Some(param_value) = params.address_tag {
873        multipart_form_params.insert("addressTag", param_value.to_string());
874    }
875    if let Some(param_value) = params.amount {
876        multipart_form_params.insert("amount", param_value.to_string());
877    }
878    multipart_form_params.insert("beneficiaryPii", params.beneficiary_pii.to_string());
879    if let Some(param_value) = params.coin {
880        multipart_form_params.insert("coin", param_value.to_string());
881    }
882    multipart_form_params.insert("depositId", params.deposit_id.to_string());
883    if let Some(param_value) = params.network {
884        multipart_form_params.insert("network", param_value.to_string());
885    }
886    multipart_form_params.insert("questionnaire", params.questionnaire.to_string());
887    multipart_form_params.insert("signature", params.signature.to_string());
888    multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
889    multipart_form_params.insert("timestamp", params.timestamp.to_string());
890    req_builder = req_builder.form(&multipart_form_params);
891
892    let req = req_builder.build()?;
893    let resp = configuration.client.execute(req).await?;
894
895    let status = resp.status();
896    let content_type = resp
897        .headers()
898        .get("content-type")
899        .and_then(|v| v.to_str().ok())
900        .unwrap_or("application/octet-stream");
901    let content_type = super::ContentType::from(content_type);
902
903    if !status.is_client_error() && !status.is_server_error() {
904        let content = resp.text().await?;
905        match content_type {
906            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
907            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletUpdateLocalentityBrokerDepositProvideInfoV1Resp`"))),
908            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WalletUpdateLocalentityBrokerDepositProvideInfoV1Resp`")))),
909        }
910    } else {
911        let content = resp.text().await?;
912        let entity: Option<WalletUpdateLocalentityBrokerDepositProvideInfoV1Error> = serde_json::from_str(&content).ok();
913        Err(Error::ResponseError(ResponseContent { status, content, entity }))
914    }
915}
916
917/// Submit questionnaire for local entities that require travel rule. The questionnaire is only applies to transactions from unhosted wallets or VASPs that are not yet onboarded with GTR.
918pub async fn wallet_update_localentity_deposit_provide_info_v1(configuration: &configuration::Configuration, params: WalletUpdateLocalentityDepositProvideInfoV1Params) -> Result<models::WalletUpdateLocalentityDepositProvideInfoV1Resp, Error<WalletUpdateLocalentityDepositProvideInfoV1Error>> {
919
920    let uri_str = format!("{}/sapi/v1/localentity/deposit/provide-info", configuration.base_path);
921    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
922
923    // Create a mutable vector for query parameters
924    let mut query_params: Vec<(String, String)> = Vec::new();
925
926
927    // Create header parameters collection
928    let mut header_params = std::collections::HashMap::new();
929
930    // Handle Binance Auth first if configured
931    if let Some(ref binance_auth) = configuration.binance_auth {
932        // Add API key to headers
933        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
934        
935        // Generate request body for signing (if any)
936        let body_string: Option<Vec<u8>> = None;
937        
938        // Sign the request
939        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
940            Ok(sig) => sig,
941            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
942        };
943        
944        // Add signature to query params
945        query_params.push(("signature".to_string(), signature));
946    }
947
948    // Apply all query parameters
949    if !query_params.is_empty() {
950        req_builder = req_builder.query(&query_params);
951    }
952
953
954    // Add user agent if configured
955    if let Some(ref user_agent) = configuration.user_agent {
956        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
957    }
958
959    // Apply all header parameters
960    for (header_name, header_value) in header_params {
961        req_builder = req_builder.header(&header_name, &header_value);
962    }
963
964    let mut multipart_form_params = std::collections::HashMap::new();
965    multipart_form_params.insert("questionnaire", params.questionnaire.to_string());
966    multipart_form_params.insert("timestamp", params.timestamp.to_string());
967    multipart_form_params.insert("tranId", params.tran_id.to_string());
968    req_builder = req_builder.form(&multipart_form_params);
969
970    let req = req_builder.build()?;
971    let resp = configuration.client.execute(req).await?;
972
973    let status = resp.status();
974    let content_type = resp
975        .headers()
976        .get("content-type")
977        .and_then(|v| v.to_str().ok())
978        .unwrap_or("application/octet-stream");
979    let content_type = super::ContentType::from(content_type);
980
981    if !status.is_client_error() && !status.is_server_error() {
982        let content = resp.text().await?;
983        match content_type {
984            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
985            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletUpdateLocalentityDepositProvideInfoV1Resp`"))),
986            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WalletUpdateLocalentityDepositProvideInfoV1Resp`")))),
987        }
988    } else {
989        let content = resp.text().await?;
990        let entity: Option<WalletUpdateLocalentityDepositProvideInfoV1Error> = serde_json::from_str(&content).ok();
991        Err(Error::ResponseError(ResponseContent { status, content, entity }))
992    }
993}
994