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 WalletCreateAssetDustBtcV1Params {
20 pub timestamp: i64,
21 pub account_type: Option<String>,
22 pub recv_window: Option<i64>
23}
24
25#[derive(Clone, Debug, Default)]
27pub struct WalletCreateAssetDustV1Params {
28 pub asset: Vec<String>,
29 pub timestamp: i64,
30 pub account_type: Option<String>,
31 pub recv_window: Option<i64>
32}
33
34#[derive(Clone, Debug, Default)]
36pub struct WalletCreateAssetGetFundingAssetV1Params {
37 pub timestamp: i64,
38 pub asset: Option<String>,
39 pub need_btc_valuation: Option<String>,
40 pub recv_window: Option<i64>
41}
42
43#[derive(Clone, Debug, Default)]
45pub struct WalletCreateAssetGetUserAssetV3Params {
46 pub timestamp: i64,
47 pub asset: Option<String>,
48 pub need_btc_valuation: Option<bool>,
49 pub recv_window: Option<i64>
50}
51
52#[derive(Clone, Debug, Default)]
54pub struct WalletCreateAssetTransferV1Params {
55 pub amount: String,
56 pub asset: String,
57 pub timestamp: i64,
58 pub r#type: String,
59 pub from_symbol: Option<String>,
60 pub recv_window: Option<i64>,
61 pub to_symbol: Option<String>
62}
63
64#[derive(Clone, Debug, Default)]
66pub struct WalletCreateBnbBurnV1Params {
67 pub timestamp: i64,
68 pub interest_bnb_burn: Option<String>,
69 pub recv_window: Option<i64>,
70 pub spot_bnb_burn: Option<String>
71}
72
73#[derive(Clone, Debug, Default)]
75pub struct WalletGetAssetAssetDetailV1Params {
76 pub timestamp: i64,
77 pub recv_window: Option<i64>
78}
79
80#[derive(Clone, Debug, Default)]
82pub struct WalletGetAssetAssetDividendV1Params {
83 pub timestamp: i64,
84 pub asset: Option<String>,
85 pub start_time: Option<i64>,
86 pub end_time: Option<i64>,
87 pub limit: Option<i32>,
89 pub recv_window: Option<i64>
90}
91
92#[derive(Clone, Debug, Default)]
94pub struct WalletGetAssetCustodyTransferHistoryV1Params {
95 pub email: String,
96 pub start_time: i64,
97 pub end_time: i64,
98 pub timestamp: i64,
99 pub r#type: Option<String>,
101 pub asset: Option<String>,
102 pub current: Option<i32>,
104 pub size: Option<i32>,
106 pub recv_window: Option<i64>
107}
108
109#[derive(Clone, Debug, Default)]
111pub struct WalletGetAssetDribbletV1Params {
112 pub timestamp: i64,
113 pub start_time: Option<i64>,
114 pub end_time: Option<i64>,
115 pub recv_window: Option<i64>
116}
117
118#[derive(Clone, Debug, Default)]
120pub struct WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Params {
121 pub start_time: i64,
123 pub end_time: i64,
125 pub tran_id: Option<i64>,
127 pub client_tran_id: Option<String>,
129 pub asset: Option<String>,
131 pub current: Option<i32>,
133 pub size: Option<i32>
135}
136
137#[derive(Clone, Debug, Default)]
139pub struct WalletGetAssetTradeFeeV1Params {
140 pub timestamp: i64,
141 pub symbol: Option<String>,
142 pub recv_window: Option<i64>
143}
144
145#[derive(Clone, Debug, Default)]
147pub struct WalletGetAssetTransferV1Params {
148 pub r#type: String,
149 pub timestamp: i64,
150 pub start_time: Option<i64>,
151 pub end_time: Option<i64>,
152 pub current: Option<i32>,
154 pub size: Option<i32>,
156 pub from_symbol: Option<String>,
157 pub to_symbol: Option<String>,
158 pub recv_window: Option<i64>
159}
160
161#[derive(Clone, Debug, Default)]
163pub struct WalletGetAssetWalletBalanceV1Params {
164 pub timestamp: i64,
165 pub quote_asset: Option<String>,
167 pub recv_window: Option<i64>
168}
169
170#[derive(Clone, Debug, Default)]
172pub struct WalletGetSpotDelistScheduleV1Params {
173 pub timestamp: i64,
174 pub recv_window: Option<i64>
175}
176
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum WalletCreateAssetDustBtcV1Error {
182 Status4XX(models::ApiError),
183 Status5XX(models::ApiError),
184 UnknownValue(serde_json::Value),
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum WalletCreateAssetDustV1Error {
191 Status4XX(models::ApiError),
192 Status5XX(models::ApiError),
193 UnknownValue(serde_json::Value),
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum WalletCreateAssetGetFundingAssetV1Error {
200 Status4XX(models::ApiError),
201 Status5XX(models::ApiError),
202 UnknownValue(serde_json::Value),
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum WalletCreateAssetGetUserAssetV3Error {
209 Status4XX(models::ApiError),
210 Status5XX(models::ApiError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum WalletCreateAssetTransferV1Error {
218 Status4XX(models::ApiError),
219 Status5XX(models::ApiError),
220 UnknownValue(serde_json::Value),
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum WalletCreateBnbBurnV1Error {
227 Status4XX(models::ApiError),
228 Status5XX(models::ApiError),
229 UnknownValue(serde_json::Value),
230}
231
232#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum WalletGetAssetAssetDetailV1Error {
236 Status4XX(models::ApiError),
237 Status5XX(models::ApiError),
238 UnknownValue(serde_json::Value),
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum WalletGetAssetAssetDividendV1Error {
245 Status4XX(models::ApiError),
246 Status5XX(models::ApiError),
247 UnknownValue(serde_json::Value),
248}
249
250#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum WalletGetAssetCustodyTransferHistoryV1Error {
254 Status4XX(models::ApiError),
255 Status5XX(models::ApiError),
256 UnknownValue(serde_json::Value),
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize)]
261#[serde(untagged)]
262pub enum WalletGetAssetDribbletV1Error {
263 Status4XX(models::ApiError),
264 Status5XX(models::ApiError),
265 UnknownValue(serde_json::Value),
266}
267
268#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Error {
272 Status4XX(models::ApiError),
273 Status5XX(models::ApiError),
274 UnknownValue(serde_json::Value),
275}
276
277#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum WalletGetAssetTradeFeeV1Error {
281 Status4XX(models::ApiError),
282 Status5XX(models::ApiError),
283 UnknownValue(serde_json::Value),
284}
285
286#[derive(Debug, Clone, Serialize, Deserialize)]
288#[serde(untagged)]
289pub enum WalletGetAssetTransferV1Error {
290 Status4XX(models::ApiError),
291 Status5XX(models::ApiError),
292 UnknownValue(serde_json::Value),
293}
294
295#[derive(Debug, Clone, Serialize, Deserialize)]
297#[serde(untagged)]
298pub enum WalletGetAssetWalletBalanceV1Error {
299 Status4XX(models::ApiError),
300 Status5XX(models::ApiError),
301 UnknownValue(serde_json::Value),
302}
303
304#[derive(Debug, Clone, Serialize, Deserialize)]
306#[serde(untagged)]
307pub enum WalletGetSpotDelistScheduleV1Error {
308 Status4XX(models::ApiError),
309 Status5XX(models::ApiError),
310 UnknownValue(serde_json::Value),
311}
312
313#[derive(Debug, Clone, Serialize, Deserialize)]
315#[serde(untagged)]
316pub enum WalletGetSpotOpenSymbolListV1Error {
317 Status4XX(models::ApiError),
318 Status5XX(models::ApiError),
319 UnknownValue(serde_json::Value),
320}
321
322
323pub async fn wallet_create_asset_dust_btc_v1(configuration: &configuration::Configuration, params: WalletCreateAssetDustBtcV1Params) -> Result<models::WalletCreateAssetDustBtcV1Resp, Error<WalletCreateAssetDustBtcV1Error>> {
325
326 let uri_str = format!("{}/sapi/v1/asset/dust-btc", configuration.base_path);
327 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
328
329 let mut query_params: Vec<(String, String)> = Vec::new();
331
332
333 let mut header_params = std::collections::HashMap::new();
335
336 if let Some(ref binance_auth) = configuration.binance_auth {
338 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
340
341 let body_string: Option<Vec<u8>> = None;
343
344 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
346 Ok(sig) => sig,
347 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
348 };
349
350 query_params.push(("signature".to_string(), signature));
352 }
353
354 if !query_params.is_empty() {
356 req_builder = req_builder.query(&query_params);
357 }
358
359
360 if let Some(ref user_agent) = configuration.user_agent {
362 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
363 }
364
365 for (header_name, header_value) in header_params {
367 req_builder = req_builder.header(&header_name, &header_value);
368 }
369
370 let mut multipart_form_params = std::collections::HashMap::new();
371 if let Some(param_value) = params.account_type {
372 multipart_form_params.insert("accountType", param_value.to_string());
373 }
374 if let Some(param_value) = params.recv_window {
375 multipart_form_params.insert("recvWindow", param_value.to_string());
376 }
377 multipart_form_params.insert("timestamp", params.timestamp.to_string());
378 req_builder = req_builder.form(&multipart_form_params);
379
380 let req = req_builder.build()?;
381 let resp = configuration.client.execute(req).await?;
382
383 let status = resp.status();
384 let content_type = resp
385 .headers()
386 .get("content-type")
387 .and_then(|v| v.to_str().ok())
388 .unwrap_or("application/octet-stream");
389 let content_type = super::ContentType::from(content_type);
390
391 if !status.is_client_error() && !status.is_server_error() {
392 let content = resp.text().await?;
393 match content_type {
394 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
395 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletCreateAssetDustBtcV1Resp`"))),
396 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::WalletCreateAssetDustBtcV1Resp`")))),
397 }
398 } else {
399 let content = resp.text().await?;
400 let entity: Option<WalletCreateAssetDustBtcV1Error> = serde_json::from_str(&content).ok();
401 Err(Error::ResponseError(ResponseContent { status, content, entity }))
402 }
403}
404
405pub async fn wallet_create_asset_dust_v1(configuration: &configuration::Configuration, params: WalletCreateAssetDustV1Params) -> Result<models::WalletCreateAssetDustV1Resp, Error<WalletCreateAssetDustV1Error>> {
407
408 let uri_str = format!("{}/sapi/v1/asset/dust", configuration.base_path);
409 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
410
411 let mut query_params: Vec<(String, String)> = Vec::new();
413
414
415 let mut header_params = std::collections::HashMap::new();
417
418 if let Some(ref binance_auth) = configuration.binance_auth {
420 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
422
423 let body_string: Option<Vec<u8>> = None;
425
426 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
428 Ok(sig) => sig,
429 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
430 };
431
432 query_params.push(("signature".to_string(), signature));
434 }
435
436 if !query_params.is_empty() {
438 req_builder = req_builder.query(&query_params);
439 }
440
441
442 if let Some(ref user_agent) = configuration.user_agent {
444 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
445 }
446
447 for (header_name, header_value) in header_params {
449 req_builder = req_builder.header(&header_name, &header_value);
450 }
451
452 let mut multipart_form_params = std::collections::HashMap::new();
453 if let Some(param_value) = params.account_type {
454 multipart_form_params.insert("accountType", param_value.to_string());
455 }
456 multipart_form_params.insert("asset", params.asset.into_iter().map(|p| serde_json::to_string(&p).unwrap_or_default()).collect::<Vec<String>>().join(",").to_string());
457 if let Some(param_value) = params.recv_window {
458 multipart_form_params.insert("recvWindow", param_value.to_string());
459 }
460 multipart_form_params.insert("timestamp", params.timestamp.to_string());
461 req_builder = req_builder.form(&multipart_form_params);
462
463 let req = req_builder.build()?;
464 let resp = configuration.client.execute(req).await?;
465
466 let status = resp.status();
467 let content_type = resp
468 .headers()
469 .get("content-type")
470 .and_then(|v| v.to_str().ok())
471 .unwrap_or("application/octet-stream");
472 let content_type = super::ContentType::from(content_type);
473
474 if !status.is_client_error() && !status.is_server_error() {
475 let content = resp.text().await?;
476 match content_type {
477 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
478 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletCreateAssetDustV1Resp`"))),
479 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::WalletCreateAssetDustV1Resp`")))),
480 }
481 } else {
482 let content = resp.text().await?;
483 let entity: Option<WalletCreateAssetDustV1Error> = serde_json::from_str(&content).ok();
484 Err(Error::ResponseError(ResponseContent { status, content, entity }))
485 }
486}
487
488pub async fn wallet_create_asset_get_funding_asset_v1(configuration: &configuration::Configuration, params: WalletCreateAssetGetFundingAssetV1Params) -> Result<Vec<models::WalletCreateAssetGetFundingAssetV1RespItem>, Error<WalletCreateAssetGetFundingAssetV1Error>> {
490
491 let uri_str = format!("{}/sapi/v1/asset/get-funding-asset", configuration.base_path);
492 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
493
494 let mut query_params: Vec<(String, String)> = Vec::new();
496
497
498 let mut header_params = std::collections::HashMap::new();
500
501 if let Some(ref binance_auth) = configuration.binance_auth {
503 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
505
506 let body_string: Option<Vec<u8>> = None;
508
509 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
511 Ok(sig) => sig,
512 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
513 };
514
515 query_params.push(("signature".to_string(), signature));
517 }
518
519 if !query_params.is_empty() {
521 req_builder = req_builder.query(&query_params);
522 }
523
524
525 if let Some(ref user_agent) = configuration.user_agent {
527 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
528 }
529
530 for (header_name, header_value) in header_params {
532 req_builder = req_builder.header(&header_name, &header_value);
533 }
534
535 let mut multipart_form_params = std::collections::HashMap::new();
536 if let Some(param_value) = params.asset {
537 multipart_form_params.insert("asset", param_value.to_string());
538 }
539 if let Some(param_value) = params.need_btc_valuation {
540 multipart_form_params.insert("needBtcValuation", param_value.to_string());
541 }
542 if let Some(param_value) = params.recv_window {
543 multipart_form_params.insert("recvWindow", param_value.to_string());
544 }
545 multipart_form_params.insert("timestamp", params.timestamp.to_string());
546 req_builder = req_builder.form(&multipart_form_params);
547
548 let req = req_builder.build()?;
549 let resp = configuration.client.execute(req).await?;
550
551 let status = resp.status();
552 let content_type = resp
553 .headers()
554 .get("content-type")
555 .and_then(|v| v.to_str().ok())
556 .unwrap_or("application/octet-stream");
557 let content_type = super::ContentType::from(content_type);
558
559 if !status.is_client_error() && !status.is_server_error() {
560 let content = resp.text().await?;
561 match content_type {
562 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
563 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletCreateAssetGetFundingAssetV1RespItem>`"))),
564 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::WalletCreateAssetGetFundingAssetV1RespItem>`")))),
565 }
566 } else {
567 let content = resp.text().await?;
568 let entity: Option<WalletCreateAssetGetFundingAssetV1Error> = serde_json::from_str(&content).ok();
569 Err(Error::ResponseError(ResponseContent { status, content, entity }))
570 }
571}
572
573pub async fn wallet_create_asset_get_user_asset_v3(configuration: &configuration::Configuration, params: WalletCreateAssetGetUserAssetV3Params) -> Result<Vec<models::WalletCreateAssetGetUserAssetV3RespItem>, Error<WalletCreateAssetGetUserAssetV3Error>> {
575
576 let uri_str = format!("{}/sapi/v3/asset/getUserAsset", configuration.base_path);
577 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
578
579 let mut query_params: Vec<(String, String)> = Vec::new();
581
582
583 let mut header_params = std::collections::HashMap::new();
585
586 if let Some(ref binance_auth) = configuration.binance_auth {
588 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
590
591 let body_string: Option<Vec<u8>> = None;
593
594 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
596 Ok(sig) => sig,
597 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
598 };
599
600 query_params.push(("signature".to_string(), signature));
602 }
603
604 if !query_params.is_empty() {
606 req_builder = req_builder.query(&query_params);
607 }
608
609
610 if let Some(ref user_agent) = configuration.user_agent {
612 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
613 }
614
615 for (header_name, header_value) in header_params {
617 req_builder = req_builder.header(&header_name, &header_value);
618 }
619
620 let mut multipart_form_params = std::collections::HashMap::new();
621 if let Some(param_value) = params.asset {
622 multipart_form_params.insert("asset", param_value.to_string());
623 }
624 if let Some(param_value) = params.need_btc_valuation {
625 multipart_form_params.insert("needBtcValuation", param_value.to_string());
626 }
627 if let Some(param_value) = params.recv_window {
628 multipart_form_params.insert("recvWindow", param_value.to_string());
629 }
630 multipart_form_params.insert("timestamp", params.timestamp.to_string());
631 req_builder = req_builder.form(&multipart_form_params);
632
633 let req = req_builder.build()?;
634 let resp = configuration.client.execute(req).await?;
635
636 let status = resp.status();
637 let content_type = resp
638 .headers()
639 .get("content-type")
640 .and_then(|v| v.to_str().ok())
641 .unwrap_or("application/octet-stream");
642 let content_type = super::ContentType::from(content_type);
643
644 if !status.is_client_error() && !status.is_server_error() {
645 let content = resp.text().await?;
646 match content_type {
647 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
648 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletCreateAssetGetUserAssetV3RespItem>`"))),
649 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::WalletCreateAssetGetUserAssetV3RespItem>`")))),
650 }
651 } else {
652 let content = resp.text().await?;
653 let entity: Option<WalletCreateAssetGetUserAssetV3Error> = serde_json::from_str(&content).ok();
654 Err(Error::ResponseError(ResponseContent { status, content, entity }))
655 }
656}
657
658pub async fn wallet_create_asset_transfer_v1(configuration: &configuration::Configuration, params: WalletCreateAssetTransferV1Params) -> Result<models::WalletCreateAssetTransferV1Resp, Error<WalletCreateAssetTransferV1Error>> {
660
661 let uri_str = format!("{}/sapi/v1/asset/transfer", configuration.base_path);
662 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
663
664 let mut query_params: Vec<(String, String)> = Vec::new();
666
667
668 let mut header_params = std::collections::HashMap::new();
670
671 if let Some(ref binance_auth) = configuration.binance_auth {
673 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
675
676 let body_string: Option<Vec<u8>> = None;
678
679 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
681 Ok(sig) => sig,
682 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
683 };
684
685 query_params.push(("signature".to_string(), signature));
687 }
688
689 if !query_params.is_empty() {
691 req_builder = req_builder.query(&query_params);
692 }
693
694
695 if let Some(ref user_agent) = configuration.user_agent {
697 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
698 }
699
700 for (header_name, header_value) in header_params {
702 req_builder = req_builder.header(&header_name, &header_value);
703 }
704
705 let mut multipart_form_params = std::collections::HashMap::new();
706 multipart_form_params.insert("amount", params.amount.to_string());
707 multipart_form_params.insert("asset", params.asset.to_string());
708 if let Some(param_value) = params.from_symbol {
709 multipart_form_params.insert("fromSymbol", param_value.to_string());
710 }
711 if let Some(param_value) = params.recv_window {
712 multipart_form_params.insert("recvWindow", param_value.to_string());
713 }
714 multipart_form_params.insert("timestamp", params.timestamp.to_string());
715 if let Some(param_value) = params.to_symbol {
716 multipart_form_params.insert("toSymbol", param_value.to_string());
717 }
718 multipart_form_params.insert("type", params.r#type.to_string());
719 req_builder = req_builder.form(&multipart_form_params);
720
721 let req = req_builder.build()?;
722 let resp = configuration.client.execute(req).await?;
723
724 let status = resp.status();
725 let content_type = resp
726 .headers()
727 .get("content-type")
728 .and_then(|v| v.to_str().ok())
729 .unwrap_or("application/octet-stream");
730 let content_type = super::ContentType::from(content_type);
731
732 if !status.is_client_error() && !status.is_server_error() {
733 let content = resp.text().await?;
734 match content_type {
735 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
736 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletCreateAssetTransferV1Resp`"))),
737 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::WalletCreateAssetTransferV1Resp`")))),
738 }
739 } else {
740 let content = resp.text().await?;
741 let entity: Option<WalletCreateAssetTransferV1Error> = serde_json::from_str(&content).ok();
742 Err(Error::ResponseError(ResponseContent { status, content, entity }))
743 }
744}
745
746pub async fn wallet_create_bnb_burn_v1(configuration: &configuration::Configuration, params: WalletCreateBnbBurnV1Params) -> Result<models::WalletCreateBnbBurnV1Resp, Error<WalletCreateBnbBurnV1Error>> {
748
749 let uri_str = format!("{}/sapi/v1/bnbBurn", configuration.base_path);
750 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
751
752 let mut query_params: Vec<(String, String)> = Vec::new();
754
755
756 let mut header_params = std::collections::HashMap::new();
758
759 if let Some(ref binance_auth) = configuration.binance_auth {
761 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
763
764 let body_string: Option<Vec<u8>> = None;
766
767 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
769 Ok(sig) => sig,
770 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
771 };
772
773 query_params.push(("signature".to_string(), signature));
775 }
776
777 if !query_params.is_empty() {
779 req_builder = req_builder.query(&query_params);
780 }
781
782
783 if let Some(ref user_agent) = configuration.user_agent {
785 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
786 }
787
788 for (header_name, header_value) in header_params {
790 req_builder = req_builder.header(&header_name, &header_value);
791 }
792
793 let mut multipart_form_params = std::collections::HashMap::new();
794 if let Some(param_value) = params.interest_bnb_burn {
795 multipart_form_params.insert("interestBNBBurn", param_value.to_string());
796 }
797 if let Some(param_value) = params.recv_window {
798 multipart_form_params.insert("recvWindow", param_value.to_string());
799 }
800 if let Some(param_value) = params.spot_bnb_burn {
801 multipart_form_params.insert("spotBNBBurn", param_value.to_string());
802 }
803 multipart_form_params.insert("timestamp", params.timestamp.to_string());
804 req_builder = req_builder.form(&multipart_form_params);
805
806 let req = req_builder.build()?;
807 let resp = configuration.client.execute(req).await?;
808
809 let status = resp.status();
810 let content_type = resp
811 .headers()
812 .get("content-type")
813 .and_then(|v| v.to_str().ok())
814 .unwrap_or("application/octet-stream");
815 let content_type = super::ContentType::from(content_type);
816
817 if !status.is_client_error() && !status.is_server_error() {
818 let content = resp.text().await?;
819 match content_type {
820 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
821 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletCreateBnbBurnV1Resp`"))),
822 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::WalletCreateBnbBurnV1Resp`")))),
823 }
824 } else {
825 let content = resp.text().await?;
826 let entity: Option<WalletCreateBnbBurnV1Error> = serde_json::from_str(&content).ok();
827 Err(Error::ResponseError(ResponseContent { status, content, entity }))
828 }
829}
830
831pub async fn wallet_get_asset_asset_detail_v1(configuration: &configuration::Configuration, params: WalletGetAssetAssetDetailV1Params) -> Result<std::collections::HashMap<String, models::WalletGetAssetAssetDetailV1RespValue>, Error<WalletGetAssetAssetDetailV1Error>> {
833
834 let uri_str = format!("{}/sapi/v1/asset/assetDetail", configuration.base_path);
835 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
836
837 let mut query_params: Vec<(String, String)> = Vec::new();
839
840 if let Some(ref param_value) = params.recv_window {
841 query_params.push(("recvWindow".to_string(), param_value.to_string()));
842 }
843 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
844
845 let mut header_params = std::collections::HashMap::new();
847
848 if let Some(ref binance_auth) = configuration.binance_auth {
850 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
852
853 let body_string: Option<Vec<u8>> = None;
855
856 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
858 Ok(sig) => sig,
859 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
860 };
861
862 query_params.push(("signature".to_string(), signature));
864 }
865
866 if !query_params.is_empty() {
868 req_builder = req_builder.query(&query_params);
869 }
870
871
872 if let Some(ref user_agent) = configuration.user_agent {
874 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
875 }
876
877 for (header_name, header_value) in header_params {
879 req_builder = req_builder.header(&header_name, &header_value);
880 }
881
882
883 let req = req_builder.build()?;
884 let resp = configuration.client.execute(req).await?;
885
886 let status = resp.status();
887 let content_type = resp
888 .headers()
889 .get("content-type")
890 .and_then(|v| v.to_str().ok())
891 .unwrap_or("application/octet-stream");
892 let content_type = super::ContentType::from(content_type);
893
894 if !status.is_client_error() && !status.is_server_error() {
895 let content = resp.text().await?;
896 match content_type {
897 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
898 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, models::WalletGetAssetAssetDetailV1RespValue>`"))),
899 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, models::WalletGetAssetAssetDetailV1RespValue>`")))),
900 }
901 } else {
902 let content = resp.text().await?;
903 let entity: Option<WalletGetAssetAssetDetailV1Error> = serde_json::from_str(&content).ok();
904 Err(Error::ResponseError(ResponseContent { status, content, entity }))
905 }
906}
907
908pub async fn wallet_get_asset_asset_dividend_v1(configuration: &configuration::Configuration, params: WalletGetAssetAssetDividendV1Params) -> Result<models::WalletGetAssetAssetDividendV1Resp, Error<WalletGetAssetAssetDividendV1Error>> {
910
911 let uri_str = format!("{}/sapi/v1/asset/assetDividend", configuration.base_path);
912 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
913
914 let mut query_params: Vec<(String, String)> = Vec::new();
916
917 if let Some(ref param_value) = params.asset {
918 query_params.push(("asset".to_string(), param_value.to_string()));
919 }
920 if let Some(ref param_value) = params.start_time {
921 query_params.push(("startTime".to_string(), param_value.to_string()));
922 }
923 if let Some(ref param_value) = params.end_time {
924 query_params.push(("endTime".to_string(), param_value.to_string()));
925 }
926 if let Some(ref param_value) = params.limit {
927 query_params.push(("limit".to_string(), param_value.to_string()));
928 }
929 if let Some(ref param_value) = params.recv_window {
930 query_params.push(("recvWindow".to_string(), param_value.to_string()));
931 }
932 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
933
934 let mut header_params = std::collections::HashMap::new();
936
937 if let Some(ref binance_auth) = configuration.binance_auth {
939 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
941
942 let body_string: Option<Vec<u8>> = None;
944
945 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
947 Ok(sig) => sig,
948 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
949 };
950
951 query_params.push(("signature".to_string(), signature));
953 }
954
955 if !query_params.is_empty() {
957 req_builder = req_builder.query(&query_params);
958 }
959
960
961 if let Some(ref user_agent) = configuration.user_agent {
963 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
964 }
965
966 for (header_name, header_value) in header_params {
968 req_builder = req_builder.header(&header_name, &header_value);
969 }
970
971
972 let req = req_builder.build()?;
973 let resp = configuration.client.execute(req).await?;
974
975 let status = resp.status();
976 let content_type = resp
977 .headers()
978 .get("content-type")
979 .and_then(|v| v.to_str().ok())
980 .unwrap_or("application/octet-stream");
981 let content_type = super::ContentType::from(content_type);
982
983 if !status.is_client_error() && !status.is_server_error() {
984 let content = resp.text().await?;
985 match content_type {
986 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
987 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletGetAssetAssetDividendV1Resp`"))),
988 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::WalletGetAssetAssetDividendV1Resp`")))),
989 }
990 } else {
991 let content = resp.text().await?;
992 let entity: Option<WalletGetAssetAssetDividendV1Error> = serde_json::from_str(&content).ok();
993 Err(Error::ResponseError(ResponseContent { status, content, entity }))
994 }
995}
996
997pub async fn wallet_get_asset_custody_transfer_history_v1(configuration: &configuration::Configuration, params: WalletGetAssetCustodyTransferHistoryV1Params) -> Result<models::WalletGetAssetCustodyTransferHistoryV1Resp, Error<WalletGetAssetCustodyTransferHistoryV1Error>> {
999
1000 let uri_str = format!("{}/sapi/v1/asset/custody/transfer-history", configuration.base_path);
1001 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1002
1003 let mut query_params: Vec<(String, String)> = Vec::new();
1005
1006 query_params.push(("email".to_string(), params.email.to_string()));
1007 query_params.push(("startTime".to_string(), params.start_time.to_string()));
1008 query_params.push(("endTime".to_string(), params.end_time.to_string()));
1009 if let Some(ref param_value) = params.r#type {
1010 query_params.push(("type".to_string(), param_value.to_string()));
1011 }
1012 if let Some(ref param_value) = params.asset {
1013 query_params.push(("asset".to_string(), param_value.to_string()));
1014 }
1015 if let Some(ref param_value) = params.current {
1016 query_params.push(("current".to_string(), param_value.to_string()));
1017 }
1018 if let Some(ref param_value) = params.size {
1019 query_params.push(("size".to_string(), param_value.to_string()));
1020 }
1021 if let Some(ref param_value) = params.recv_window {
1022 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1023 }
1024 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1025
1026 let mut header_params = std::collections::HashMap::new();
1028
1029 if let Some(ref binance_auth) = configuration.binance_auth {
1031 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1033
1034 let body_string: Option<Vec<u8>> = None;
1036
1037 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1039 Ok(sig) => sig,
1040 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1041 };
1042
1043 query_params.push(("signature".to_string(), signature));
1045 }
1046
1047 if !query_params.is_empty() {
1049 req_builder = req_builder.query(&query_params);
1050 }
1051
1052
1053 if let Some(ref user_agent) = configuration.user_agent {
1055 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1056 }
1057
1058 for (header_name, header_value) in header_params {
1060 req_builder = req_builder.header(&header_name, &header_value);
1061 }
1062
1063
1064 let req = req_builder.build()?;
1065 let resp = configuration.client.execute(req).await?;
1066
1067 let status = resp.status();
1068 let content_type = resp
1069 .headers()
1070 .get("content-type")
1071 .and_then(|v| v.to_str().ok())
1072 .unwrap_or("application/octet-stream");
1073 let content_type = super::ContentType::from(content_type);
1074
1075 if !status.is_client_error() && !status.is_server_error() {
1076 let content = resp.text().await?;
1077 match content_type {
1078 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1079 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletGetAssetCustodyTransferHistoryV1Resp`"))),
1080 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::WalletGetAssetCustodyTransferHistoryV1Resp`")))),
1081 }
1082 } else {
1083 let content = resp.text().await?;
1084 let entity: Option<WalletGetAssetCustodyTransferHistoryV1Error> = serde_json::from_str(&content).ok();
1085 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1086 }
1087}
1088
1089pub async fn wallet_get_asset_dribblet_v1(configuration: &configuration::Configuration, params: WalletGetAssetDribbletV1Params) -> Result<models::WalletGetAssetDribbletV1Resp, Error<WalletGetAssetDribbletV1Error>> {
1091
1092 let uri_str = format!("{}/sapi/v1/asset/dribblet", configuration.base_path);
1093 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1094
1095 let mut query_params: Vec<(String, String)> = Vec::new();
1097
1098 if let Some(ref param_value) = params.start_time {
1099 query_params.push(("startTime".to_string(), param_value.to_string()));
1100 }
1101 if let Some(ref param_value) = params.end_time {
1102 query_params.push(("endTime".to_string(), param_value.to_string()));
1103 }
1104 if let Some(ref param_value) = params.recv_window {
1105 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1106 }
1107 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1108
1109 let mut header_params = std::collections::HashMap::new();
1111
1112 if let Some(ref binance_auth) = configuration.binance_auth {
1114 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1116
1117 let body_string: Option<Vec<u8>> = None;
1119
1120 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1122 Ok(sig) => sig,
1123 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1124 };
1125
1126 query_params.push(("signature".to_string(), signature));
1128 }
1129
1130 if !query_params.is_empty() {
1132 req_builder = req_builder.query(&query_params);
1133 }
1134
1135
1136 if let Some(ref user_agent) = configuration.user_agent {
1138 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1139 }
1140
1141 for (header_name, header_value) in header_params {
1143 req_builder = req_builder.header(&header_name, &header_value);
1144 }
1145
1146
1147 let req = req_builder.build()?;
1148 let resp = configuration.client.execute(req).await?;
1149
1150 let status = resp.status();
1151 let content_type = resp
1152 .headers()
1153 .get("content-type")
1154 .and_then(|v| v.to_str().ok())
1155 .unwrap_or("application/octet-stream");
1156 let content_type = super::ContentType::from(content_type);
1157
1158 if !status.is_client_error() && !status.is_server_error() {
1159 let content = resp.text().await?;
1160 match content_type {
1161 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1162 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletGetAssetDribbletV1Resp`"))),
1163 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::WalletGetAssetDribbletV1Resp`")))),
1164 }
1165 } else {
1166 let content = resp.text().await?;
1167 let entity: Option<WalletGetAssetDribbletV1Error> = serde_json::from_str(&content).ok();
1168 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1169 }
1170}
1171
1172pub async fn wallet_get_asset_ledger_transfer_cloud_mining_query_by_page_v1(configuration: &configuration::Configuration, params: WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Params) -> Result<models::WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Resp, Error<WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Error>> {
1174
1175 let uri_str = format!("{}/sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage", configuration.base_path);
1176 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1177
1178 let mut query_params: Vec<(String, String)> = Vec::new();
1180
1181 if let Some(ref param_value) = params.tran_id {
1182 query_params.push(("tranId".to_string(), param_value.to_string()));
1183 }
1184 if let Some(ref param_value) = params.client_tran_id {
1185 query_params.push(("clientTranId".to_string(), param_value.to_string()));
1186 }
1187 if let Some(ref param_value) = params.asset {
1188 query_params.push(("asset".to_string(), param_value.to_string()));
1189 }
1190 query_params.push(("startTime".to_string(), params.start_time.to_string()));
1191 query_params.push(("endTime".to_string(), params.end_time.to_string()));
1192 if let Some(ref param_value) = params.current {
1193 query_params.push(("current".to_string(), param_value.to_string()));
1194 }
1195 if let Some(ref param_value) = params.size {
1196 query_params.push(("size".to_string(), param_value.to_string()));
1197 }
1198
1199 let mut header_params = std::collections::HashMap::new();
1201
1202 if let Some(ref binance_auth) = configuration.binance_auth {
1204 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1206
1207 let body_string: Option<Vec<u8>> = None;
1209
1210 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1212 Ok(sig) => sig,
1213 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1214 };
1215
1216 query_params.push(("signature".to_string(), signature));
1218 }
1219
1220 if !query_params.is_empty() {
1222 req_builder = req_builder.query(&query_params);
1223 }
1224
1225
1226 if let Some(ref user_agent) = configuration.user_agent {
1228 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1229 }
1230
1231 for (header_name, header_value) in header_params {
1233 req_builder = req_builder.header(&header_name, &header_value);
1234 }
1235
1236
1237 let req = req_builder.build()?;
1238 let resp = configuration.client.execute(req).await?;
1239
1240 let status = resp.status();
1241 let content_type = resp
1242 .headers()
1243 .get("content-type")
1244 .and_then(|v| v.to_str().ok())
1245 .unwrap_or("application/octet-stream");
1246 let content_type = super::ContentType::from(content_type);
1247
1248 if !status.is_client_error() && !status.is_server_error() {
1249 let content = resp.text().await?;
1250 match content_type {
1251 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1252 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Resp`"))),
1253 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::WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Resp`")))),
1254 }
1255 } else {
1256 let content = resp.text().await?;
1257 let entity: Option<WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Error> = serde_json::from_str(&content).ok();
1258 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1259 }
1260}
1261
1262pub async fn wallet_get_asset_trade_fee_v1(configuration: &configuration::Configuration, params: WalletGetAssetTradeFeeV1Params) -> Result<Vec<models::WalletGetAssetTradeFeeV1RespItem>, Error<WalletGetAssetTradeFeeV1Error>> {
1264
1265 let uri_str = format!("{}/sapi/v1/asset/tradeFee", configuration.base_path);
1266 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1267
1268 let mut query_params: Vec<(String, String)> = Vec::new();
1270
1271 if let Some(ref param_value) = params.symbol {
1272 query_params.push(("symbol".to_string(), param_value.to_string()));
1273 }
1274 if let Some(ref param_value) = params.recv_window {
1275 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1276 }
1277 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1278
1279 let mut header_params = std::collections::HashMap::new();
1281
1282 if let Some(ref binance_auth) = configuration.binance_auth {
1284 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1286
1287 let body_string: Option<Vec<u8>> = None;
1289
1290 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1292 Ok(sig) => sig,
1293 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1294 };
1295
1296 query_params.push(("signature".to_string(), signature));
1298 }
1299
1300 if !query_params.is_empty() {
1302 req_builder = req_builder.query(&query_params);
1303 }
1304
1305
1306 if let Some(ref user_agent) = configuration.user_agent {
1308 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1309 }
1310
1311 for (header_name, header_value) in header_params {
1313 req_builder = req_builder.header(&header_name, &header_value);
1314 }
1315
1316
1317 let req = req_builder.build()?;
1318 let resp = configuration.client.execute(req).await?;
1319
1320 let status = resp.status();
1321 let content_type = resp
1322 .headers()
1323 .get("content-type")
1324 .and_then(|v| v.to_str().ok())
1325 .unwrap_or("application/octet-stream");
1326 let content_type = super::ContentType::from(content_type);
1327
1328 if !status.is_client_error() && !status.is_server_error() {
1329 let content = resp.text().await?;
1330 match content_type {
1331 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1332 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetAssetTradeFeeV1RespItem>`"))),
1333 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::WalletGetAssetTradeFeeV1RespItem>`")))),
1334 }
1335 } else {
1336 let content = resp.text().await?;
1337 let entity: Option<WalletGetAssetTradeFeeV1Error> = serde_json::from_str(&content).ok();
1338 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1339 }
1340}
1341
1342pub async fn wallet_get_asset_transfer_v1(configuration: &configuration::Configuration, params: WalletGetAssetTransferV1Params) -> Result<models::WalletGetAssetTransferV1Resp, Error<WalletGetAssetTransferV1Error>> {
1344
1345 let uri_str = format!("{}/sapi/v1/asset/transfer", configuration.base_path);
1346 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1347
1348 let mut query_params: Vec<(String, String)> = Vec::new();
1350
1351 query_params.push(("type".to_string(), params.r#type.to_string()));
1352 if let Some(ref param_value) = params.start_time {
1353 query_params.push(("startTime".to_string(), param_value.to_string()));
1354 }
1355 if let Some(ref param_value) = params.end_time {
1356 query_params.push(("endTime".to_string(), param_value.to_string()));
1357 }
1358 if let Some(ref param_value) = params.current {
1359 query_params.push(("current".to_string(), param_value.to_string()));
1360 }
1361 if let Some(ref param_value) = params.size {
1362 query_params.push(("size".to_string(), param_value.to_string()));
1363 }
1364 if let Some(ref param_value) = params.from_symbol {
1365 query_params.push(("fromSymbol".to_string(), param_value.to_string()));
1366 }
1367 if let Some(ref param_value) = params.to_symbol {
1368 query_params.push(("toSymbol".to_string(), param_value.to_string()));
1369 }
1370 if let Some(ref param_value) = params.recv_window {
1371 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1372 }
1373 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1374
1375 let mut header_params = std::collections::HashMap::new();
1377
1378 if let Some(ref binance_auth) = configuration.binance_auth {
1380 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1382
1383 let body_string: Option<Vec<u8>> = None;
1385
1386 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1388 Ok(sig) => sig,
1389 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1390 };
1391
1392 query_params.push(("signature".to_string(), signature));
1394 }
1395
1396 if !query_params.is_empty() {
1398 req_builder = req_builder.query(&query_params);
1399 }
1400
1401
1402 if let Some(ref user_agent) = configuration.user_agent {
1404 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1405 }
1406
1407 for (header_name, header_value) in header_params {
1409 req_builder = req_builder.header(&header_name, &header_value);
1410 }
1411
1412
1413 let req = req_builder.build()?;
1414 let resp = configuration.client.execute(req).await?;
1415
1416 let status = resp.status();
1417 let content_type = resp
1418 .headers()
1419 .get("content-type")
1420 .and_then(|v| v.to_str().ok())
1421 .unwrap_or("application/octet-stream");
1422 let content_type = super::ContentType::from(content_type);
1423
1424 if !status.is_client_error() && !status.is_server_error() {
1425 let content = resp.text().await?;
1426 match content_type {
1427 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1428 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletGetAssetTransferV1Resp`"))),
1429 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::WalletGetAssetTransferV1Resp`")))),
1430 }
1431 } else {
1432 let content = resp.text().await?;
1433 let entity: Option<WalletGetAssetTransferV1Error> = serde_json::from_str(&content).ok();
1434 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1435 }
1436}
1437
1438pub async fn wallet_get_asset_wallet_balance_v1(configuration: &configuration::Configuration, params: WalletGetAssetWalletBalanceV1Params) -> Result<Vec<models::WalletGetAssetWalletBalanceV1RespItem>, Error<WalletGetAssetWalletBalanceV1Error>> {
1440
1441 let uri_str = format!("{}/sapi/v1/asset/wallet/balance", configuration.base_path);
1442 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1443
1444 let mut query_params: Vec<(String, String)> = Vec::new();
1446
1447 if let Some(ref param_value) = params.quote_asset {
1448 query_params.push(("quoteAsset".to_string(), param_value.to_string()));
1449 }
1450 if let Some(ref param_value) = params.recv_window {
1451 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1452 }
1453 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1454
1455 let mut header_params = std::collections::HashMap::new();
1457
1458 if let Some(ref binance_auth) = configuration.binance_auth {
1460 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1462
1463 let body_string: Option<Vec<u8>> = None;
1465
1466 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1468 Ok(sig) => sig,
1469 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1470 };
1471
1472 query_params.push(("signature".to_string(), signature));
1474 }
1475
1476 if !query_params.is_empty() {
1478 req_builder = req_builder.query(&query_params);
1479 }
1480
1481
1482 if let Some(ref user_agent) = configuration.user_agent {
1484 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1485 }
1486
1487 for (header_name, header_value) in header_params {
1489 req_builder = req_builder.header(&header_name, &header_value);
1490 }
1491
1492
1493 let req = req_builder.build()?;
1494 let resp = configuration.client.execute(req).await?;
1495
1496 let status = resp.status();
1497 let content_type = resp
1498 .headers()
1499 .get("content-type")
1500 .and_then(|v| v.to_str().ok())
1501 .unwrap_or("application/octet-stream");
1502 let content_type = super::ContentType::from(content_type);
1503
1504 if !status.is_client_error() && !status.is_server_error() {
1505 let content = resp.text().await?;
1506 match content_type {
1507 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1508 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetAssetWalletBalanceV1RespItem>`"))),
1509 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::WalletGetAssetWalletBalanceV1RespItem>`")))),
1510 }
1511 } else {
1512 let content = resp.text().await?;
1513 let entity: Option<WalletGetAssetWalletBalanceV1Error> = serde_json::from_str(&content).ok();
1514 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1515 }
1516}
1517
1518pub async fn wallet_get_spot_delist_schedule_v1(configuration: &configuration::Configuration, params: WalletGetSpotDelistScheduleV1Params) -> Result<Vec<models::WalletGetSpotDelistScheduleV1RespItem>, Error<WalletGetSpotDelistScheduleV1Error>> {
1520
1521 let uri_str = format!("{}/sapi/v1/spot/delist-schedule", configuration.base_path);
1522 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1523
1524 let mut query_params: Vec<(String, String)> = Vec::new();
1526
1527 if let Some(ref param_value) = params.recv_window {
1528 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1529 }
1530 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1531
1532 let mut header_params = std::collections::HashMap::new();
1534
1535 if let Some(ref binance_auth) = configuration.binance_auth {
1537 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1539
1540 let body_string: Option<Vec<u8>> = None;
1542
1543 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1545 Ok(sig) => sig,
1546 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1547 };
1548
1549 query_params.push(("signature".to_string(), signature));
1551 }
1552
1553 if !query_params.is_empty() {
1555 req_builder = req_builder.query(&query_params);
1556 }
1557
1558
1559 if let Some(ref user_agent) = configuration.user_agent {
1561 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1562 }
1563
1564 for (header_name, header_value) in header_params {
1566 req_builder = req_builder.header(&header_name, &header_value);
1567 }
1568
1569
1570 let req = req_builder.build()?;
1571 let resp = configuration.client.execute(req).await?;
1572
1573 let status = resp.status();
1574 let content_type = resp
1575 .headers()
1576 .get("content-type")
1577 .and_then(|v| v.to_str().ok())
1578 .unwrap_or("application/octet-stream");
1579 let content_type = super::ContentType::from(content_type);
1580
1581 if !status.is_client_error() && !status.is_server_error() {
1582 let content = resp.text().await?;
1583 match content_type {
1584 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1585 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetSpotDelistScheduleV1RespItem>`"))),
1586 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::WalletGetSpotDelistScheduleV1RespItem>`")))),
1587 }
1588 } else {
1589 let content = resp.text().await?;
1590 let entity: Option<WalletGetSpotDelistScheduleV1Error> = serde_json::from_str(&content).ok();
1591 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1592 }
1593}
1594
1595pub async fn wallet_get_spot_open_symbol_list_v1(configuration: &configuration::Configuration) -> Result<Vec<models::WalletGetSpotOpenSymbolListV1RespItem>, Error<WalletGetSpotOpenSymbolListV1Error>> {
1597
1598 let uri_str = format!("{}/sapi/v1/spot/open-symbol-list", configuration.base_path);
1599 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1600
1601 let mut query_params: Vec<(String, String)> = Vec::new();
1603
1604
1605 let mut header_params = std::collections::HashMap::new();
1607
1608 if let Some(ref binance_auth) = configuration.binance_auth {
1610 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1612
1613 let body_string: Option<Vec<u8>> = None;
1615
1616 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1618 Ok(sig) => sig,
1619 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1620 };
1621
1622 query_params.push(("signature".to_string(), signature));
1624 }
1625
1626 if !query_params.is_empty() {
1628 req_builder = req_builder.query(&query_params);
1629 }
1630
1631
1632 if let Some(ref user_agent) = configuration.user_agent {
1634 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1635 }
1636
1637 for (header_name, header_value) in header_params {
1639 req_builder = req_builder.header(&header_name, &header_value);
1640 }
1641
1642
1643 let req = req_builder.build()?;
1644 let resp = configuration.client.execute(req).await?;
1645
1646 let status = resp.status();
1647 let content_type = resp
1648 .headers()
1649 .get("content-type")
1650 .and_then(|v| v.to_str().ok())
1651 .unwrap_or("application/octet-stream");
1652 let content_type = super::ContentType::from(content_type);
1653
1654 if !status.is_client_error() && !status.is_server_error() {
1655 let content = resp.text().await?;
1656 match content_type {
1657 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1658 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetSpotOpenSymbolListV1RespItem>`"))),
1659 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::WalletGetSpotOpenSymbolListV1RespItem>`")))),
1660 }
1661 } else {
1662 let content = resp.text().await?;
1663 let entity: Option<WalletGetSpotOpenSymbolListV1Error> = serde_json::from_str(&content).ok();
1664 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1665 }
1666}
1667