1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::wallet::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[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#[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#[derive(Clone, Debug, Default)]
55pub struct WalletGetLocalentityDepositHistoryV1Params {
56 pub timestamp: i64,
57 pub tr_id: Option<String>,
59 pub tx_id: Option<String>,
61 pub tran_id: Option<String>,
63 pub network: Option<String>,
64 pub coin: Option<String>,
65 pub travel_rule_status: Option<i32>,
67 pub pending_questionnaire: Option<bool>,
69 pub start_time: Option<i64>,
71 pub end_time: Option<i64>,
73 pub offset: Option<i32>,
75 pub limit: Option<i32>
77}
78
79#[derive(Clone, Debug, Default)]
81pub struct WalletGetLocalentityWithdrawHistoryV1Params {
82 pub timestamp: i64,
83 pub tr_id: Option<String>,
85 pub tx_id: Option<String>,
87 pub withdraw_order_id: Option<String>,
89 pub network: Option<String>,
90 pub coin: Option<String>,
91 pub travel_rule_status: Option<i32>,
93 pub offset: Option<i32>,
95 pub limit: Option<i32>,
97 pub start_time: Option<i64>,
99 pub end_time: Option<i64>,
101 pub recv_window: Option<i64>
102}
103
104#[derive(Clone, Debug, Default)]
106pub struct WalletGetLocalentityWithdrawHistoryV2Params {
107 pub timestamp: i64,
108 pub tr_id: Option<String>,
110 pub tx_id: Option<String>,
112 pub withdraw_order_id: Option<String>,
114 pub network: Option<String>,
115 pub coin: Option<String>,
116 pub travel_rule_status: Option<i32>,
118 pub offset: Option<i32>,
120 pub limit: Option<i32>,
122 pub start_time: Option<i64>,
124 pub end_time: Option<i64>,
126 pub recv_window: Option<i64>
127}
128
129#[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#[derive(Clone, Debug, Default)]
147pub struct WalletUpdateLocalentityDepositProvideInfoV1Params {
148 pub questionnaire: String,
149 pub timestamp: i64,
150 pub tran_id: i64
151}
152
153
154#[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#[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#[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#[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#[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#[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#[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#[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
227pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
235
236
237 let mut header_params = std::collections::HashMap::new();
239
240 if let Some(ref binance_auth) = configuration.binance_auth {
242 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
244
245 let body_string: Option<Vec<u8>> = None;
247
248 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 query_params.push(("signature".to_string(), signature));
256 }
257
258 if !query_params.is_empty() {
260 req_builder = req_builder.query(&query_params);
261 }
262
263
264 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 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
326pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
334
335
336 let mut header_params = std::collections::HashMap::new();
338
339 if let Some(ref binance_auth) = configuration.binance_auth {
341 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
343
344 let body_string: Option<Vec<u8>> = None;
346
347 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 query_params.push(("signature".to_string(), signature));
355 }
356
357 if !query_params.is_empty() {
359 req_builder = req_builder.query(&query_params);
360 }
361
362
363 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 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
427pub 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 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 let mut header_params = std::collections::HashMap::new();
473
474 if let Some(ref binance_auth) = configuration.binance_auth {
476 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
478
479 let body_string: Option<Vec<u8>> = None;
481
482 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 query_params.push(("signature".to_string(), signature));
490 }
491
492 if !query_params.is_empty() {
494 req_builder = req_builder.query(&query_params);
495 }
496
497
498 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 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<models::WalletGetLocalentityDepositHistoryV1RespItem>`"))),
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<models::WalletGetLocalentityDepositHistoryV1RespItem>`")))),
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
534pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
542
543
544 let mut header_params = std::collections::HashMap::new();
546
547 if let Some(ref binance_auth) = configuration.binance_auth {
549 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
551
552 let body_string: Option<Vec<u8>> = None;
554
555 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 query_params.push(("signature".to_string(), signature));
563 }
564
565 if !query_params.is_empty() {
567 req_builder = req_builder.query(&query_params);
568 }
569
570
571 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 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<models::WalletGetLocalentityVaspV1RespItem>`"))),
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<models::WalletGetLocalentityVaspV1RespItem>`")))),
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
607pub 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 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 let mut header_params = std::collections::HashMap::new();
653
654 if let Some(ref binance_auth) = configuration.binance_auth {
656 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
658
659 let body_string: Option<Vec<u8>> = None;
661
662 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 query_params.push(("signature".to_string(), signature));
670 }
671
672 if !query_params.is_empty() {
674 req_builder = req_builder.query(&query_params);
675 }
676
677
678 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 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<models::WalletGetLocalentityWithdrawHistoryV1RespItem>`"))),
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<models::WalletGetLocalentityWithdrawHistoryV1RespItem>`")))),
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
714pub 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 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 let mut header_params = std::collections::HashMap::new();
760
761 if let Some(ref binance_auth) = configuration.binance_auth {
763 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
765
766 let body_string: Option<Vec<u8>> = None;
768
769 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 query_params.push(("signature".to_string(), signature));
777 }
778
779 if !query_params.is_empty() {
781 req_builder = req_builder.query(&query_params);
782 }
783
784
785 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 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<models::WalletGetLocalentityWithdrawHistoryV2RespItem>`"))),
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<models::WalletGetLocalentityWithdrawHistoryV2RespItem>`")))),
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
821pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
829
830
831 let mut header_params = std::collections::HashMap::new();
833
834 if let Some(ref binance_auth) = configuration.binance_auth {
836 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
838
839 let body_string: Option<Vec<u8>> = None;
841
842 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 query_params.push(("signature".to_string(), signature));
850 }
851
852 if !query_params.is_empty() {
854 req_builder = req_builder.query(&query_params);
855 }
856
857
858 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 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
917pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
925
926
927 let mut header_params = std::collections::HashMap::new();
929
930 if let Some(ref binance_auth) = configuration.binance_auth {
932 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
934
935 let body_string: Option<Vec<u8>> = None;
937
938 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 query_params.push(("signature".to_string(), signature));
946 }
947
948 if !query_params.is_empty() {
950 req_builder = req_builder.query(&query_params);
951 }
952
953
954 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 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