binance/wallet/apis/
asset_api.rs

1/*
2 * Binance Wallet API
3 *
4 * OpenAPI specification for Binance exchange - Wallet API
5 *
6 * The version of the OpenAPI document: 0.1.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::wallet::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`wallet_create_asset_dust_btc_v1`]
18#[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/// struct for passing parameters to the method [`wallet_create_asset_dust_v1`]
26#[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/// struct for passing parameters to the method [`wallet_create_asset_get_funding_asset_v1`]
35#[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/// struct for passing parameters to the method [`wallet_create_asset_get_user_asset_v3`]
44#[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/// struct for passing parameters to the method [`wallet_create_asset_transfer_v1`]
53#[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/// struct for passing parameters to the method [`wallet_create_bnb_burn_v1`]
65#[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/// struct for passing parameters to the method [`wallet_get_asset_asset_detail_v1`]
74#[derive(Clone, Debug, Default)]
75pub struct WalletGetAssetAssetDetailV1Params {
76    pub timestamp: i64,
77    pub recv_window: Option<i64>
78}
79
80/// struct for passing parameters to the method [`wallet_get_asset_asset_dividend_v1`]
81#[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    /// Default 20, max 500
88    pub limit: Option<i32>,
89    pub recv_window: Option<i64>
90}
91
92/// struct for passing parameters to the method [`wallet_get_asset_custody_transfer_history_v1`]
93#[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    /// Delegate/Undelegate
100    pub r#type: Option<String>,
101    pub asset: Option<String>,
102    /// default 1
103    pub current: Option<i32>,
104    /// default 10, max 100
105    pub size: Option<i32>,
106    pub recv_window: Option<i64>
107}
108
109/// struct for passing parameters to the method [`wallet_get_asset_dribblet_v1`]
110#[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/// struct for passing parameters to the method [`wallet_get_asset_ledger_transfer_cloud_mining_query_by_page_v1`]
119#[derive(Clone, Debug, Default)]
120pub struct WalletGetAssetLedgerTransferCloudMiningQueryByPageV1Params {
121    /// inclusive, unit: ms
122    pub start_time: i64,
123    /// exclusive, unit: ms
124    pub end_time: i64,
125    /// The transaction id
126    pub tran_id: Option<i64>,
127    /// The unique flag
128    pub client_tran_id: Option<String>,
129    /// If it is blank, we will query all assets
130    pub asset: Option<String>,
131    /// current page, default 1, the min value is 1
132    pub current: Option<i32>,
133    /// page size, default 10, the max value is 100
134    pub size: Option<i32>
135}
136
137/// struct for passing parameters to the method [`wallet_get_asset_trade_fee_v1`]
138#[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/// struct for passing parameters to the method [`wallet_get_asset_transfer_v1`]
146#[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    /// Default 1
153    pub current: Option<i32>,
154    /// Default 10, Max 100
155    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/// struct for passing parameters to the method [`wallet_get_asset_wallet_balance_v1`]
162#[derive(Clone, Debug, Default)]
163pub struct WalletGetAssetWalletBalanceV1Params {
164    pub timestamp: i64,
165    /// `USDT`, `ETH`, `USDC`, `BNB`, etc. default `BTC`
166    pub quote_asset: Option<String>,
167    pub recv_window: Option<i64>
168}
169
170/// struct for passing parameters to the method [`wallet_get_spot_delist_schedule_v1`]
171#[derive(Clone, Debug, Default)]
172pub struct WalletGetSpotDelistScheduleV1Params {
173    pub timestamp: i64,
174    pub recv_window: Option<i64>
175}
176
177
178/// struct for typed errors of method [`wallet_create_asset_dust_btc_v1`]
179#[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/// struct for typed errors of method [`wallet_create_asset_dust_v1`]
188#[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/// struct for typed errors of method [`wallet_create_asset_get_funding_asset_v1`]
197#[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/// struct for typed errors of method [`wallet_create_asset_get_user_asset_v3`]
206#[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/// struct for typed errors of method [`wallet_create_asset_transfer_v1`]
215#[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/// struct for typed errors of method [`wallet_create_bnb_burn_v1`]
224#[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/// struct for typed errors of method [`wallet_get_asset_asset_detail_v1`]
233#[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/// struct for typed errors of method [`wallet_get_asset_asset_dividend_v1`]
242#[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/// struct for typed errors of method [`wallet_get_asset_custody_transfer_history_v1`]
251#[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/// struct for typed errors of method [`wallet_get_asset_dribblet_v1`]
260#[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/// struct for typed errors of method [`wallet_get_asset_ledger_transfer_cloud_mining_query_by_page_v1`]
269#[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/// struct for typed errors of method [`wallet_get_asset_trade_fee_v1`]
278#[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/// struct for typed errors of method [`wallet_get_asset_transfer_v1`]
287#[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/// struct for typed errors of method [`wallet_get_asset_wallet_balance_v1`]
296#[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/// struct for typed errors of method [`wallet_get_spot_delist_schedule_v1`]
305#[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/// struct for typed errors of method [`wallet_get_spot_open_symbol_list_v1`]
314#[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
323/// Get Assets That Can Be Converted Into BNB
324pub 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    // Create a mutable vector for query parameters
330    let mut query_params: Vec<(String, String)> = Vec::new();
331
332
333    // Create header parameters collection
334    let mut header_params = std::collections::HashMap::new();
335
336    // Handle Binance Auth first if configured
337    if let Some(ref binance_auth) = configuration.binance_auth {
338        // Add API key to headers
339        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
340        
341        // Generate request body for signing (if any)
342        let body_string: Option<Vec<u8>> = None;
343        
344        // Sign the request
345        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        // Add signature to query params
351        query_params.push(("signature".to_string(), signature));
352    }
353
354    // Apply all query parameters
355    if !query_params.is_empty() {
356        req_builder = req_builder.query(&query_params);
357    }
358
359
360    // Add user agent if configured
361    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    // Apply all header parameters
366    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
405/// Convert dust assets to BNB.
406pub 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    // Create a mutable vector for query parameters
412    let mut query_params: Vec<(String, String)> = Vec::new();
413
414
415    // Create header parameters collection
416    let mut header_params = std::collections::HashMap::new();
417
418    // Handle Binance Auth first if configured
419    if let Some(ref binance_auth) = configuration.binance_auth {
420        // Add API key to headers
421        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
422        
423        // Generate request body for signing (if any)
424        let body_string: Option<Vec<u8>> = None;
425        
426        // Sign the request
427        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        // Add signature to query params
433        query_params.push(("signature".to_string(), signature));
434    }
435
436    // Apply all query parameters
437    if !query_params.is_empty() {
438        req_builder = req_builder.query(&query_params);
439    }
440
441
442    // Add user agent if configured
443    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    // Apply all header parameters
448    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
488/// Query Funding Wallet
489pub 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    // Create a mutable vector for query parameters
495    let mut query_params: Vec<(String, String)> = Vec::new();
496
497
498    // Create header parameters collection
499    let mut header_params = std::collections::HashMap::new();
500
501    // Handle Binance Auth first if configured
502    if let Some(ref binance_auth) = configuration.binance_auth {
503        // Add API key to headers
504        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
505        
506        // Generate request body for signing (if any)
507        let body_string: Option<Vec<u8>> = None;
508        
509        // Sign the request
510        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        // Add signature to query params
516        query_params.push(("signature".to_string(), signature));
517    }
518
519    // Apply all query parameters
520    if !query_params.is_empty() {
521        req_builder = req_builder.query(&query_params);
522    }
523
524
525    // Add user agent if configured
526    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    // Apply all header parameters
531    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&lt;models::WalletCreateAssetGetFundingAssetV1RespItem&gt;`"))),
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&lt;models::WalletCreateAssetGetFundingAssetV1RespItem&gt;`")))),
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
573/// Get user assets, just for positive data.
574pub 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    // Create a mutable vector for query parameters
580    let mut query_params: Vec<(String, String)> = Vec::new();
581
582
583    // Create header parameters collection
584    let mut header_params = std::collections::HashMap::new();
585
586    // Handle Binance Auth first if configured
587    if let Some(ref binance_auth) = configuration.binance_auth {
588        // Add API key to headers
589        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
590        
591        // Generate request body for signing (if any)
592        let body_string: Option<Vec<u8>> = None;
593        
594        // Sign the request
595        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        // Add signature to query params
601        query_params.push(("signature".to_string(), signature));
602    }
603
604    // Apply all query parameters
605    if !query_params.is_empty() {
606        req_builder = req_builder.query(&query_params);
607    }
608
609
610    // Add user agent if configured
611    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    // Apply all header parameters
616    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&lt;models::WalletCreateAssetGetUserAssetV3RespItem&gt;`"))),
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&lt;models::WalletCreateAssetGetUserAssetV3RespItem&gt;`")))),
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
658/// user universal transfer
659pub 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    // Create a mutable vector for query parameters
665    let mut query_params: Vec<(String, String)> = Vec::new();
666
667
668    // Create header parameters collection
669    let mut header_params = std::collections::HashMap::new();
670
671    // Handle Binance Auth first if configured
672    if let Some(ref binance_auth) = configuration.binance_auth {
673        // Add API key to headers
674        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
675        
676        // Generate request body for signing (if any)
677        let body_string: Option<Vec<u8>> = None;
678        
679        // Sign the request
680        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        // Add signature to query params
686        query_params.push(("signature".to_string(), signature));
687    }
688
689    // Apply all query parameters
690    if !query_params.is_empty() {
691        req_builder = req_builder.query(&query_params);
692    }
693
694
695    // Add user agent if configured
696    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    // Apply all header parameters
701    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
746/// Toggle BNB Burn On Spot Trade And Margin Interest
747pub 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    // Create a mutable vector for query parameters
753    let mut query_params: Vec<(String, String)> = Vec::new();
754
755
756    // Create header parameters collection
757    let mut header_params = std::collections::HashMap::new();
758
759    // Handle Binance Auth first if configured
760    if let Some(ref binance_auth) = configuration.binance_auth {
761        // Add API key to headers
762        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
763        
764        // Generate request body for signing (if any)
765        let body_string: Option<Vec<u8>> = None;
766        
767        // Sign the request
768        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        // Add signature to query params
774        query_params.push(("signature".to_string(), signature));
775    }
776
777    // Apply all query parameters
778    if !query_params.is_empty() {
779        req_builder = req_builder.query(&query_params);
780    }
781
782
783    // Add user agent if configured
784    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    // Apply all header parameters
789    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
831/// Fetch details of assets supported on Binance.
832pub 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    // Create a mutable vector for query parameters
838    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    // Create header parameters collection
846    let mut header_params = std::collections::HashMap::new();
847
848    // Handle Binance Auth first if configured
849    if let Some(ref binance_auth) = configuration.binance_auth {
850        // Add API key to headers
851        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
852        
853        // Generate request body for signing (if any)
854        let body_string: Option<Vec<u8>> = None;
855        
856        // Sign the request
857        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        // Add signature to query params
863        query_params.push(("signature".to_string(), signature));
864    }
865
866    // Apply all query parameters
867    if !query_params.is_empty() {
868        req_builder = req_builder.query(&query_params);
869    }
870
871
872    // Add user agent if configured
873    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    // Apply all header parameters
878    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&lt;String, models::WalletGetAssetAssetDetailV1RespValue&gt;`"))),
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&lt;String, models::WalletGetAssetAssetDetailV1RespValue&gt;`")))),
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
908/// Query asset dividend record.
909pub 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    // Create a mutable vector for query parameters
915    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    // Create header parameters collection
935    let mut header_params = std::collections::HashMap::new();
936
937    // Handle Binance Auth first if configured
938    if let Some(ref binance_auth) = configuration.binance_auth {
939        // Add API key to headers
940        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
941        
942        // Generate request body for signing (if any)
943        let body_string: Option<Vec<u8>> = None;
944        
945        // Sign the request
946        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        // Add signature to query params
952        query_params.push(("signature".to_string(), signature));
953    }
954
955    // Apply all query parameters
956    if !query_params.is_empty() {
957        req_builder = req_builder.query(&query_params);
958    }
959
960
961    // Add user agent if configured
962    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    // Apply all header parameters
967    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
997/// Query User Delegation History
998pub 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    // Create a mutable vector for query parameters
1004    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    // Create header parameters collection
1027    let mut header_params = std::collections::HashMap::new();
1028
1029    // Handle Binance Auth first if configured
1030    if let Some(ref binance_auth) = configuration.binance_auth {
1031        // Add API key to headers
1032        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1033        
1034        // Generate request body for signing (if any)
1035        let body_string: Option<Vec<u8>> = None;
1036        
1037        // Sign the request
1038        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        // Add signature to query params
1044        query_params.push(("signature".to_string(), signature));
1045    }
1046
1047    // Apply all query parameters
1048    if !query_params.is_empty() {
1049        req_builder = req_builder.query(&query_params);
1050    }
1051
1052
1053    // Add user agent if configured
1054    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    // Apply all header parameters
1059    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
1089/// Dustlog
1090pub 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    // Create a mutable vector for query parameters
1096    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    // Create header parameters collection
1110    let mut header_params = std::collections::HashMap::new();
1111
1112    // Handle Binance Auth first if configured
1113    if let Some(ref binance_auth) = configuration.binance_auth {
1114        // Add API key to headers
1115        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1116        
1117        // Generate request body for signing (if any)
1118        let body_string: Option<Vec<u8>> = None;
1119        
1120        // Sign the request
1121        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        // Add signature to query params
1127        query_params.push(("signature".to_string(), signature));
1128    }
1129
1130    // Apply all query parameters
1131    if !query_params.is_empty() {
1132        req_builder = req_builder.query(&query_params);
1133    }
1134
1135
1136    // Add user agent if configured
1137    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    // Apply all header parameters
1142    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
1172/// The query of Cloud-Mining payment and refund history
1173pub 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    // Create a mutable vector for query parameters
1179    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    // Create header parameters collection
1200    let mut header_params = std::collections::HashMap::new();
1201
1202    // Handle Binance Auth first if configured
1203    if let Some(ref binance_auth) = configuration.binance_auth {
1204        // Add API key to headers
1205        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1206        
1207        // Generate request body for signing (if any)
1208        let body_string: Option<Vec<u8>> = None;
1209        
1210        // Sign the request
1211        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        // Add signature to query params
1217        query_params.push(("signature".to_string(), signature));
1218    }
1219
1220    // Apply all query parameters
1221    if !query_params.is_empty() {
1222        req_builder = req_builder.query(&query_params);
1223    }
1224
1225
1226    // Add user agent if configured
1227    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    // Apply all header parameters
1232    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
1262/// Fetch trade fee
1263pub 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    // Create a mutable vector for query parameters
1269    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    // Create header parameters collection
1280    let mut header_params = std::collections::HashMap::new();
1281
1282    // Handle Binance Auth first if configured
1283    if let Some(ref binance_auth) = configuration.binance_auth {
1284        // Add API key to headers
1285        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1286        
1287        // Generate request body for signing (if any)
1288        let body_string: Option<Vec<u8>> = None;
1289        
1290        // Sign the request
1291        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        // Add signature to query params
1297        query_params.push(("signature".to_string(), signature));
1298    }
1299
1300    // Apply all query parameters
1301    if !query_params.is_empty() {
1302        req_builder = req_builder.query(&query_params);
1303    }
1304
1305
1306    // Add user agent if configured
1307    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    // Apply all header parameters
1312    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&lt;models::WalletGetAssetTradeFeeV1RespItem&gt;`"))),
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&lt;models::WalletGetAssetTradeFeeV1RespItem&gt;`")))),
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
1342/// Query User Universal Transfer History
1343pub 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    // Create a mutable vector for query parameters
1349    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    // Create header parameters collection
1376    let mut header_params = std::collections::HashMap::new();
1377
1378    // Handle Binance Auth first if configured
1379    if let Some(ref binance_auth) = configuration.binance_auth {
1380        // Add API key to headers
1381        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1382        
1383        // Generate request body for signing (if any)
1384        let body_string: Option<Vec<u8>> = None;
1385        
1386        // Sign the request
1387        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        // Add signature to query params
1393        query_params.push(("signature".to_string(), signature));
1394    }
1395
1396    // Apply all query parameters
1397    if !query_params.is_empty() {
1398        req_builder = req_builder.query(&query_params);
1399    }
1400
1401
1402    // Add user agent if configured
1403    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    // Apply all header parameters
1408    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
1438/// Query User Wallet Balance
1439pub 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    // Create a mutable vector for query parameters
1445    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    // Create header parameters collection
1456    let mut header_params = std::collections::HashMap::new();
1457
1458    // Handle Binance Auth first if configured
1459    if let Some(ref binance_auth) = configuration.binance_auth {
1460        // Add API key to headers
1461        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1462        
1463        // Generate request body for signing (if any)
1464        let body_string: Option<Vec<u8>> = None;
1465        
1466        // Sign the request
1467        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        // Add signature to query params
1473        query_params.push(("signature".to_string(), signature));
1474    }
1475
1476    // Apply all query parameters
1477    if !query_params.is_empty() {
1478        req_builder = req_builder.query(&query_params);
1479    }
1480
1481
1482    // Add user agent if configured
1483    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    // Apply all header parameters
1488    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&lt;models::WalletGetAssetWalletBalanceV1RespItem&gt;`"))),
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&lt;models::WalletGetAssetWalletBalanceV1RespItem&gt;`")))),
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
1518/// Get symbols delist schedule for spot
1519pub 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    // Create a mutable vector for query parameters
1525    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    // Create header parameters collection
1533    let mut header_params = std::collections::HashMap::new();
1534
1535    // Handle Binance Auth first if configured
1536    if let Some(ref binance_auth) = configuration.binance_auth {
1537        // Add API key to headers
1538        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1539        
1540        // Generate request body for signing (if any)
1541        let body_string: Option<Vec<u8>> = None;
1542        
1543        // Sign the request
1544        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        // Add signature to query params
1550        query_params.push(("signature".to_string(), signature));
1551    }
1552
1553    // Apply all query parameters
1554    if !query_params.is_empty() {
1555        req_builder = req_builder.query(&query_params);
1556    }
1557
1558
1559    // Add user agent if configured
1560    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    // Apply all header parameters
1565    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&lt;models::WalletGetSpotDelistScheduleV1RespItem&gt;`"))),
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&lt;models::WalletGetSpotDelistScheduleV1RespItem&gt;`")))),
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
1595/// Get the list of symbols that are scheduled to be opened for trading in the market.
1596pub 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    // Create a mutable vector for query parameters
1602    let mut query_params: Vec<(String, String)> = Vec::new();
1603
1604
1605    // Create header parameters collection
1606    let mut header_params = std::collections::HashMap::new();
1607
1608    // Handle Binance Auth first if configured
1609    if let Some(ref binance_auth) = configuration.binance_auth {
1610        // Add API key to headers
1611        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1612        
1613        // Generate request body for signing (if any)
1614        let body_string: Option<Vec<u8>> = None;
1615        
1616        // Sign the request
1617        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        // Add signature to query params
1623        query_params.push(("signature".to_string(), signature));
1624    }
1625
1626    // Apply all query parameters
1627    if !query_params.is_empty() {
1628        req_builder = req_builder.query(&query_params);
1629    }
1630
1631
1632    // Add user agent if configured
1633    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    // Apply all header parameters
1638    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&lt;models::WalletGetSpotOpenSymbolListV1RespItem&gt;`"))),
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&lt;models::WalletGetSpotOpenSymbolListV1RespItem&gt;`")))),
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