binance/spot/apis/
staking_api.rs

1/*
2 * Binance Spot API
3 *
4 * OpenAPI specification for Binance exchange - Spot API
5 *
6 * The version of the OpenAPI document: 0.3.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::spot::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`create_eth_staking_eth_redeem_v1`]
18#[derive(Clone, Debug, Default)]
19pub struct CreateEthStakingEthRedeemV1Params {
20    pub amount: String,
21    pub timestamp: i64,
22    pub asset: Option<String>,
23    pub recv_window: Option<i64>
24}
25
26/// struct for passing parameters to the method [`create_eth_staking_eth_stake_v2`]
27#[derive(Clone, Debug, Default)]
28pub struct CreateEthStakingEthStakeV2Params {
29    pub amount: String,
30    pub timestamp: i64,
31    pub recv_window: Option<i64>
32}
33
34/// struct for passing parameters to the method [`create_eth_staking_wbeth_wrap_v1`]
35#[derive(Clone, Debug, Default)]
36pub struct CreateEthStakingWbethWrapV1Params {
37    pub amount: String,
38    pub timestamp: i64,
39    pub recv_window: Option<i64>
40}
41
42/// struct for passing parameters to the method [`create_sol_staking_sol_claim_v1`]
43#[derive(Clone, Debug, Default)]
44pub struct CreateSolStakingSolClaimV1Params {
45    pub timestamp: i64,
46    pub recv_window: Option<i64>
47}
48
49/// struct for passing parameters to the method [`create_sol_staking_sol_redeem_v1`]
50#[derive(Clone, Debug, Default)]
51pub struct CreateSolStakingSolRedeemV1Params {
52    pub amount: String,
53    pub timestamp: i64,
54    pub recv_window: Option<i64>
55}
56
57/// struct for passing parameters to the method [`create_sol_staking_sol_stake_v1`]
58#[derive(Clone, Debug, Default)]
59pub struct CreateSolStakingSolStakeV1Params {
60    pub amount: String,
61    pub timestamp: i64,
62    pub recv_window: Option<i64>
63}
64
65/// struct for passing parameters to the method [`get_eth_staking_account_v2`]
66#[derive(Clone, Debug, Default)]
67pub struct GetEthStakingAccountV2Params {
68    pub timestamp: i64,
69    pub recv_window: Option<i64>
70}
71
72/// struct for passing parameters to the method [`get_eth_staking_eth_history_rate_history_v1`]
73#[derive(Clone, Debug, Default)]
74pub struct GetEthStakingEthHistoryRateHistoryV1Params {
75    pub timestamp: i64,
76    pub start_time: Option<i64>,
77    pub end_time: Option<i64>,
78    /// Currently querying page. Start from 1. Default:1
79    pub current: Option<i64>,
80    /// Default:10, Max:100
81    pub size: Option<i64>,
82    pub recv_window: Option<i64>
83}
84
85/// struct for passing parameters to the method [`get_eth_staking_eth_history_redemption_history_v1`]
86#[derive(Clone, Debug, Default)]
87pub struct GetEthStakingEthHistoryRedemptionHistoryV1Params {
88    pub timestamp: i64,
89    pub start_time: Option<i64>,
90    pub end_time: Option<i64>,
91    /// Currently querying page. Start from 1. Default: 1
92    pub current: Option<i64>,
93    /// Default: 10, Max: 100
94    pub size: Option<i64>,
95    pub recv_window: Option<i64>
96}
97
98/// struct for passing parameters to the method [`get_eth_staking_eth_history_rewards_history_v1`]
99#[derive(Clone, Debug, Default)]
100pub struct GetEthStakingEthHistoryRewardsHistoryV1Params {
101    pub timestamp: i64,
102    pub start_time: Option<i64>,
103    pub end_time: Option<i64>,
104    /// Currently querying page. Start from 1. Default: 1
105    pub current: Option<i64>,
106    /// Default: 10, Max: 100
107    pub size: Option<i64>,
108    pub recv_window: Option<i64>
109}
110
111/// struct for passing parameters to the method [`get_eth_staking_eth_history_staking_history_v1`]
112#[derive(Clone, Debug, Default)]
113pub struct GetEthStakingEthHistoryStakingHistoryV1Params {
114    pub timestamp: i64,
115    pub start_time: Option<i64>,
116    pub end_time: Option<i64>,
117    /// Currently querying page. Start from 1. Default: 1
118    pub current: Option<i64>,
119    /// Default: 10, Max: 100
120    pub size: Option<i64>,
121    pub recv_window: Option<i64>
122}
123
124/// struct for passing parameters to the method [`get_eth_staking_eth_history_wbeth_rewards_history_v1`]
125#[derive(Clone, Debug, Default)]
126pub struct GetEthStakingEthHistoryWbethRewardsHistoryV1Params {
127    pub timestamp: i64,
128    pub start_time: Option<i64>,
129    pub end_time: Option<i64>,
130    /// Currently querying page. Start from 1. Default: 1
131    pub current: Option<i64>,
132    /// Default: 10, Max: 100
133    pub size: Option<i64>,
134    pub recv_window: Option<i64>
135}
136
137/// struct for passing parameters to the method [`get_eth_staking_eth_quota_v1`]
138#[derive(Clone, Debug, Default)]
139pub struct GetEthStakingEthQuotaV1Params {
140    pub timestamp: i64,
141    pub recv_window: Option<i64>
142}
143
144/// struct for passing parameters to the method [`get_eth_staking_wbeth_history_unwrap_history_v1`]
145#[derive(Clone, Debug, Default)]
146pub struct GetEthStakingWbethHistoryUnwrapHistoryV1Params {
147    pub timestamp: i64,
148    pub start_time: Option<i64>,
149    pub end_time: Option<i64>,
150    /// Currently querying page. Start from 1. Default:1
151    pub current: Option<i64>,
152    /// Default:10, Max:100
153    pub size: Option<i64>,
154    pub recv_window: Option<i64>
155}
156
157/// struct for passing parameters to the method [`get_eth_staking_wbeth_history_wrap_history_v1`]
158#[derive(Clone, Debug, Default)]
159pub struct GetEthStakingWbethHistoryWrapHistoryV1Params {
160    pub timestamp: i64,
161    pub start_time: Option<i64>,
162    pub end_time: Option<i64>,
163    /// Currently querying page. Start from 1. Default:1
164    pub current: Option<i64>,
165    /// Default:10, Max:100
166    pub size: Option<i64>,
167    pub recv_window: Option<i64>
168}
169
170/// struct for passing parameters to the method [`get_sol_staking_account_v1`]
171#[derive(Clone, Debug, Default)]
172pub struct GetSolStakingAccountV1Params {
173    pub timestamp: i64,
174    /// The value cannot be greater than 60000
175    pub recv_window: Option<i64>
176}
177
178/// struct for passing parameters to the method [`get_sol_staking_sol_history_bnsol_rewards_history_v1`]
179#[derive(Clone, Debug, Default)]
180pub struct GetSolStakingSolHistoryBnsolRewardsHistoryV1Params {
181    pub timestamp: i64,
182    pub start_time: Option<i64>,
183    pub end_time: Option<i64>,
184    /// Currently querying page. Start from 1. Default: 1
185    pub current: Option<i64>,
186    /// Default: 10, Max: 100
187    pub size: Option<i64>,
188    pub recv_window: Option<i64>
189}
190
191/// struct for passing parameters to the method [`get_sol_staking_sol_history_boost_rewards_history_v1`]
192#[derive(Clone, Debug, Default)]
193pub struct GetSolStakingSolHistoryBoostRewardsHistoryV1Params {
194    /// &#34;CLAIM&#34;, &#34;DISTRIBUTE&#34;, default &#34;CLAIM&#34;
195    pub r#type: String,
196    pub timestamp: i64,
197    pub start_time: Option<i64>,
198    pub end_time: Option<i64>,
199    /// Currently querying page. Start from 1. Default: 1
200    pub current: Option<i64>,
201    /// Default: 10, Max: 100
202    pub size: Option<i64>,
203    pub recv_window: Option<i64>
204}
205
206/// struct for passing parameters to the method [`get_sol_staking_sol_history_rate_history_v1`]
207#[derive(Clone, Debug, Default)]
208pub struct GetSolStakingSolHistoryRateHistoryV1Params {
209    pub timestamp: i64,
210    pub start_time: Option<i64>,
211    pub end_time: Option<i64>,
212    /// Currently querying page. Start from 1. Default:1
213    pub current: Option<i64>,
214    /// Default:10, Max:100
215    pub size: Option<i64>,
216    /// The value cannot be greater than 60000
217    pub recv_window: Option<i64>
218}
219
220/// struct for passing parameters to the method [`get_sol_staking_sol_history_redemption_history_v1`]
221#[derive(Clone, Debug, Default)]
222pub struct GetSolStakingSolHistoryRedemptionHistoryV1Params {
223    pub timestamp: i64,
224    pub start_time: Option<i64>,
225    pub end_time: Option<i64>,
226    /// Currently querying page. Start from 1. Default: 1
227    pub current: Option<i64>,
228    /// Default: 10, Max: 100
229    pub size: Option<i64>,
230    pub recv_window: Option<i64>
231}
232
233/// struct for passing parameters to the method [`get_sol_staking_sol_history_staking_history_v1`]
234#[derive(Clone, Debug, Default)]
235pub struct GetSolStakingSolHistoryStakingHistoryV1Params {
236    pub timestamp: i64,
237    pub start_time: Option<i64>,
238    pub end_time: Option<i64>,
239    /// Currently querying page. Start from 1. Default: 1
240    pub current: Option<i64>,
241    /// Default: 10, Max: 100
242    pub size: Option<i64>,
243    pub recv_window: Option<i64>
244}
245
246/// struct for passing parameters to the method [`get_sol_staking_sol_history_unclaimed_rewards_v1`]
247#[derive(Clone, Debug, Default)]
248pub struct GetSolStakingSolHistoryUnclaimedRewardsV1Params {
249    pub timestamp: i64,
250    pub recv_window: Option<i64>
251}
252
253/// struct for passing parameters to the method [`get_sol_staking_sol_quota_v1`]
254#[derive(Clone, Debug, Default)]
255pub struct GetSolStakingSolQuotaV1Params {
256    pub timestamp: i64,
257    /// The value cannot be greater than 60000
258    pub recv_window: Option<i64>
259}
260
261
262/// struct for typed errors of method [`create_eth_staking_eth_redeem_v1`]
263#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum CreateEthStakingEthRedeemV1Error {
266    Status4XX(models::ApiError),
267    Status5XX(models::ApiError),
268    UnknownValue(serde_json::Value),
269}
270
271/// struct for typed errors of method [`create_eth_staking_eth_stake_v2`]
272#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum CreateEthStakingEthStakeV2Error {
275    Status4XX(models::ApiError),
276    Status5XX(models::ApiError),
277    UnknownValue(serde_json::Value),
278}
279
280/// struct for typed errors of method [`create_eth_staking_wbeth_wrap_v1`]
281#[derive(Debug, Clone, Serialize, Deserialize)]
282#[serde(untagged)]
283pub enum CreateEthStakingWbethWrapV1Error {
284    Status4XX(models::ApiError),
285    Status5XX(models::ApiError),
286    UnknownValue(serde_json::Value),
287}
288
289/// struct for typed errors of method [`create_sol_staking_sol_claim_v1`]
290#[derive(Debug, Clone, Serialize, Deserialize)]
291#[serde(untagged)]
292pub enum CreateSolStakingSolClaimV1Error {
293    Status4XX(models::ApiError),
294    Status5XX(models::ApiError),
295    UnknownValue(serde_json::Value),
296}
297
298/// struct for typed errors of method [`create_sol_staking_sol_redeem_v1`]
299#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum CreateSolStakingSolRedeemV1Error {
302    Status4XX(models::ApiError),
303    Status5XX(models::ApiError),
304    UnknownValue(serde_json::Value),
305}
306
307/// struct for typed errors of method [`create_sol_staking_sol_stake_v1`]
308#[derive(Debug, Clone, Serialize, Deserialize)]
309#[serde(untagged)]
310pub enum CreateSolStakingSolStakeV1Error {
311    Status4XX(models::ApiError),
312    Status5XX(models::ApiError),
313    UnknownValue(serde_json::Value),
314}
315
316/// struct for typed errors of method [`get_eth_staking_account_v2`]
317#[derive(Debug, Clone, Serialize, Deserialize)]
318#[serde(untagged)]
319pub enum GetEthStakingAccountV2Error {
320    Status4XX(models::ApiError),
321    Status5XX(models::ApiError),
322    UnknownValue(serde_json::Value),
323}
324
325/// struct for typed errors of method [`get_eth_staking_eth_history_rate_history_v1`]
326#[derive(Debug, Clone, Serialize, Deserialize)]
327#[serde(untagged)]
328pub enum GetEthStakingEthHistoryRateHistoryV1Error {
329    Status4XX(models::ApiError),
330    Status5XX(models::ApiError),
331    UnknownValue(serde_json::Value),
332}
333
334/// struct for typed errors of method [`get_eth_staking_eth_history_redemption_history_v1`]
335#[derive(Debug, Clone, Serialize, Deserialize)]
336#[serde(untagged)]
337pub enum GetEthStakingEthHistoryRedemptionHistoryV1Error {
338    Status4XX(models::ApiError),
339    Status5XX(models::ApiError),
340    UnknownValue(serde_json::Value),
341}
342
343/// struct for typed errors of method [`get_eth_staking_eth_history_rewards_history_v1`]
344#[derive(Debug, Clone, Serialize, Deserialize)]
345#[serde(untagged)]
346pub enum GetEthStakingEthHistoryRewardsHistoryV1Error {
347    Status4XX(models::ApiError),
348    Status5XX(models::ApiError),
349    UnknownValue(serde_json::Value),
350}
351
352/// struct for typed errors of method [`get_eth_staking_eth_history_staking_history_v1`]
353#[derive(Debug, Clone, Serialize, Deserialize)]
354#[serde(untagged)]
355pub enum GetEthStakingEthHistoryStakingHistoryV1Error {
356    Status4XX(models::ApiError),
357    Status5XX(models::ApiError),
358    UnknownValue(serde_json::Value),
359}
360
361/// struct for typed errors of method [`get_eth_staking_eth_history_wbeth_rewards_history_v1`]
362#[derive(Debug, Clone, Serialize, Deserialize)]
363#[serde(untagged)]
364pub enum GetEthStakingEthHistoryWbethRewardsHistoryV1Error {
365    Status4XX(models::ApiError),
366    Status5XX(models::ApiError),
367    UnknownValue(serde_json::Value),
368}
369
370/// struct for typed errors of method [`get_eth_staking_eth_quota_v1`]
371#[derive(Debug, Clone, Serialize, Deserialize)]
372#[serde(untagged)]
373pub enum GetEthStakingEthQuotaV1Error {
374    Status4XX(models::ApiError),
375    Status5XX(models::ApiError),
376    UnknownValue(serde_json::Value),
377}
378
379/// struct for typed errors of method [`get_eth_staking_wbeth_history_unwrap_history_v1`]
380#[derive(Debug, Clone, Serialize, Deserialize)]
381#[serde(untagged)]
382pub enum GetEthStakingWbethHistoryUnwrapHistoryV1Error {
383    Status4XX(models::ApiError),
384    Status5XX(models::ApiError),
385    UnknownValue(serde_json::Value),
386}
387
388/// struct for typed errors of method [`get_eth_staking_wbeth_history_wrap_history_v1`]
389#[derive(Debug, Clone, Serialize, Deserialize)]
390#[serde(untagged)]
391pub enum GetEthStakingWbethHistoryWrapHistoryV1Error {
392    Status4XX(models::ApiError),
393    Status5XX(models::ApiError),
394    UnknownValue(serde_json::Value),
395}
396
397/// struct for typed errors of method [`get_sol_staking_account_v1`]
398#[derive(Debug, Clone, Serialize, Deserialize)]
399#[serde(untagged)]
400pub enum GetSolStakingAccountV1Error {
401    Status4XX(models::ApiError),
402    Status5XX(models::ApiError),
403    UnknownValue(serde_json::Value),
404}
405
406/// struct for typed errors of method [`get_sol_staking_sol_history_bnsol_rewards_history_v1`]
407#[derive(Debug, Clone, Serialize, Deserialize)]
408#[serde(untagged)]
409pub enum GetSolStakingSolHistoryBnsolRewardsHistoryV1Error {
410    Status4XX(models::ApiError),
411    Status5XX(models::ApiError),
412    UnknownValue(serde_json::Value),
413}
414
415/// struct for typed errors of method [`get_sol_staking_sol_history_boost_rewards_history_v1`]
416#[derive(Debug, Clone, Serialize, Deserialize)]
417#[serde(untagged)]
418pub enum GetSolStakingSolHistoryBoostRewardsHistoryV1Error {
419    Status4XX(models::ApiError),
420    Status5XX(models::ApiError),
421    UnknownValue(serde_json::Value),
422}
423
424/// struct for typed errors of method [`get_sol_staking_sol_history_rate_history_v1`]
425#[derive(Debug, Clone, Serialize, Deserialize)]
426#[serde(untagged)]
427pub enum GetSolStakingSolHistoryRateHistoryV1Error {
428    Status4XX(models::ApiError),
429    Status5XX(models::ApiError),
430    UnknownValue(serde_json::Value),
431}
432
433/// struct for typed errors of method [`get_sol_staking_sol_history_redemption_history_v1`]
434#[derive(Debug, Clone, Serialize, Deserialize)]
435#[serde(untagged)]
436pub enum GetSolStakingSolHistoryRedemptionHistoryV1Error {
437    Status4XX(models::ApiError),
438    Status5XX(models::ApiError),
439    UnknownValue(serde_json::Value),
440}
441
442/// struct for typed errors of method [`get_sol_staking_sol_history_staking_history_v1`]
443#[derive(Debug, Clone, Serialize, Deserialize)]
444#[serde(untagged)]
445pub enum GetSolStakingSolHistoryStakingHistoryV1Error {
446    Status4XX(models::ApiError),
447    Status5XX(models::ApiError),
448    UnknownValue(serde_json::Value),
449}
450
451/// struct for typed errors of method [`get_sol_staking_sol_history_unclaimed_rewards_v1`]
452#[derive(Debug, Clone, Serialize, Deserialize)]
453#[serde(untagged)]
454pub enum GetSolStakingSolHistoryUnclaimedRewardsV1Error {
455    Status4XX(models::ApiError),
456    Status5XX(models::ApiError),
457    UnknownValue(serde_json::Value),
458}
459
460/// struct for typed errors of method [`get_sol_staking_sol_quota_v1`]
461#[derive(Debug, Clone, Serialize, Deserialize)]
462#[serde(untagged)]
463pub enum GetSolStakingSolQuotaV1Error {
464    Status4XX(models::ApiError),
465    Status5XX(models::ApiError),
466    UnknownValue(serde_json::Value),
467}
468
469
470/// Redeem WBETH or BETH and get ETH
471pub async fn create_eth_staking_eth_redeem_v1(configuration: &configuration::Configuration, params: CreateEthStakingEthRedeemV1Params) -> Result<models::CreateEthStakingEthRedeemV1Resp, Error<CreateEthStakingEthRedeemV1Error>> {
472
473    let uri_str = format!("{}/sapi/v1/eth-staking/eth/redeem", configuration.base_path);
474    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
475
476    // Create a mutable vector for query parameters
477    let mut query_params: Vec<(String, String)> = Vec::new();
478
479
480    // Create header parameters collection
481    let mut header_params = std::collections::HashMap::new();
482
483    // Handle Binance Auth first if configured
484    if let Some(ref binance_auth) = configuration.binance_auth {
485        // Add API key to headers
486        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
487        
488        // Generate request body for signing (if any)
489        let body_string: Option<Vec<u8>> = None;
490        
491        // Sign the request
492        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
493            Ok(sig) => sig,
494            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
495        };
496        
497        // Add signature to query params
498        query_params.push(("signature".to_string(), signature));
499    }
500
501    // Apply all query parameters
502    if !query_params.is_empty() {
503        req_builder = req_builder.query(&query_params);
504    }
505
506
507    // Add user agent if configured
508    if let Some(ref user_agent) = configuration.user_agent {
509        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
510    }
511
512    // Apply all header parameters
513    for (header_name, header_value) in header_params {
514        req_builder = req_builder.header(&header_name, &header_value);
515    }
516
517    let mut multipart_form_params = std::collections::HashMap::new();
518    multipart_form_params.insert("amount", params.amount.to_string());
519    if let Some(param_value) = params.asset {
520        multipart_form_params.insert("asset", param_value.to_string());
521    }
522    if let Some(param_value) = params.recv_window {
523        multipart_form_params.insert("recvWindow", param_value.to_string());
524    }
525    multipart_form_params.insert("timestamp", params.timestamp.to_string());
526    req_builder = req_builder.form(&multipart_form_params);
527
528    let req = req_builder.build()?;
529    let resp = configuration.client.execute(req).await?;
530
531    let status = resp.status();
532    let content_type = resp
533        .headers()
534        .get("content-type")
535        .and_then(|v| v.to_str().ok())
536        .unwrap_or("application/octet-stream");
537    let content_type = super::ContentType::from(content_type);
538
539    if !status.is_client_error() && !status.is_server_error() {
540        let content = resp.text().await?;
541        match content_type {
542            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
543            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateEthStakingEthRedeemV1Resp`"))),
544            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::CreateEthStakingEthRedeemV1Resp`")))),
545        }
546    } else {
547        let content = resp.text().await?;
548        let entity: Option<CreateEthStakingEthRedeemV1Error> = serde_json::from_str(&content).ok();
549        Err(Error::ResponseError(ResponseContent { status, content, entity }))
550    }
551}
552
553/// Subscribe ETH Staking
554pub async fn create_eth_staking_eth_stake_v2(configuration: &configuration::Configuration, params: CreateEthStakingEthStakeV2Params) -> Result<models::CreateEthStakingEthStakeV2Resp, Error<CreateEthStakingEthStakeV2Error>> {
555
556    let uri_str = format!("{}/sapi/v2/eth-staking/eth/stake", configuration.base_path);
557    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
558
559    // Create a mutable vector for query parameters
560    let mut query_params: Vec<(String, String)> = Vec::new();
561
562
563    // Create header parameters collection
564    let mut header_params = std::collections::HashMap::new();
565
566    // Handle Binance Auth first if configured
567    if let Some(ref binance_auth) = configuration.binance_auth {
568        // Add API key to headers
569        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
570        
571        // Generate request body for signing (if any)
572        let body_string: Option<Vec<u8>> = None;
573        
574        // Sign the request
575        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
576            Ok(sig) => sig,
577            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
578        };
579        
580        // Add signature to query params
581        query_params.push(("signature".to_string(), signature));
582    }
583
584    // Apply all query parameters
585    if !query_params.is_empty() {
586        req_builder = req_builder.query(&query_params);
587    }
588
589
590    // Add user agent if configured
591    if let Some(ref user_agent) = configuration.user_agent {
592        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
593    }
594
595    // Apply all header parameters
596    for (header_name, header_value) in header_params {
597        req_builder = req_builder.header(&header_name, &header_value);
598    }
599
600    let mut multipart_form_params = std::collections::HashMap::new();
601    multipart_form_params.insert("amount", params.amount.to_string());
602    if let Some(param_value) = params.recv_window {
603        multipart_form_params.insert("recvWindow", param_value.to_string());
604    }
605    multipart_form_params.insert("timestamp", params.timestamp.to_string());
606    req_builder = req_builder.form(&multipart_form_params);
607
608    let req = req_builder.build()?;
609    let resp = configuration.client.execute(req).await?;
610
611    let status = resp.status();
612    let content_type = resp
613        .headers()
614        .get("content-type")
615        .and_then(|v| v.to_str().ok())
616        .unwrap_or("application/octet-stream");
617    let content_type = super::ContentType::from(content_type);
618
619    if !status.is_client_error() && !status.is_server_error() {
620        let content = resp.text().await?;
621        match content_type {
622            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
623            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateEthStakingEthStakeV2Resp`"))),
624            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::CreateEthStakingEthStakeV2Resp`")))),
625        }
626    } else {
627        let content = resp.text().await?;
628        let entity: Option<CreateEthStakingEthStakeV2Error> = serde_json::from_str(&content).ok();
629        Err(Error::ResponseError(ResponseContent { status, content, entity }))
630    }
631}
632
633/// Wrap BETH
634pub async fn create_eth_staking_wbeth_wrap_v1(configuration: &configuration::Configuration, params: CreateEthStakingWbethWrapV1Params) -> Result<models::CreateEthStakingWbethWrapV1Resp, Error<CreateEthStakingWbethWrapV1Error>> {
635
636    let uri_str = format!("{}/sapi/v1/eth-staking/wbeth/wrap", configuration.base_path);
637    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
638
639    // Create a mutable vector for query parameters
640    let mut query_params: Vec<(String, String)> = Vec::new();
641
642
643    // Create header parameters collection
644    let mut header_params = std::collections::HashMap::new();
645
646    // Handle Binance Auth first if configured
647    if let Some(ref binance_auth) = configuration.binance_auth {
648        // Add API key to headers
649        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
650        
651        // Generate request body for signing (if any)
652        let body_string: Option<Vec<u8>> = None;
653        
654        // Sign the request
655        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
656            Ok(sig) => sig,
657            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
658        };
659        
660        // Add signature to query params
661        query_params.push(("signature".to_string(), signature));
662    }
663
664    // Apply all query parameters
665    if !query_params.is_empty() {
666        req_builder = req_builder.query(&query_params);
667    }
668
669
670    // Add user agent if configured
671    if let Some(ref user_agent) = configuration.user_agent {
672        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
673    }
674
675    // Apply all header parameters
676    for (header_name, header_value) in header_params {
677        req_builder = req_builder.header(&header_name, &header_value);
678    }
679
680    let mut multipart_form_params = std::collections::HashMap::new();
681    multipart_form_params.insert("amount", params.amount.to_string());
682    if let Some(param_value) = params.recv_window {
683        multipart_form_params.insert("recvWindow", param_value.to_string());
684    }
685    multipart_form_params.insert("timestamp", params.timestamp.to_string());
686    req_builder = req_builder.form(&multipart_form_params);
687
688    let req = req_builder.build()?;
689    let resp = configuration.client.execute(req).await?;
690
691    let status = resp.status();
692    let content_type = resp
693        .headers()
694        .get("content-type")
695        .and_then(|v| v.to_str().ok())
696        .unwrap_or("application/octet-stream");
697    let content_type = super::ContentType::from(content_type);
698
699    if !status.is_client_error() && !status.is_server_error() {
700        let content = resp.text().await?;
701        match content_type {
702            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
703            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateEthStakingWbethWrapV1Resp`"))),
704            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::CreateEthStakingWbethWrapV1Resp`")))),
705        }
706    } else {
707        let content = resp.text().await?;
708        let entity: Option<CreateEthStakingWbethWrapV1Error> = serde_json::from_str(&content).ok();
709        Err(Error::ResponseError(ResponseContent { status, content, entity }))
710    }
711}
712
713/// Claim Boost APR Airdrop Rewards
714pub async fn create_sol_staking_sol_claim_v1(configuration: &configuration::Configuration, params: CreateSolStakingSolClaimV1Params) -> Result<models::CreateSolStakingSolClaimV1Resp, Error<CreateSolStakingSolClaimV1Error>> {
715
716    let uri_str = format!("{}/sapi/v1/sol-staking/sol/claim", configuration.base_path);
717    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
718
719    // Create a mutable vector for query parameters
720    let mut query_params: Vec<(String, String)> = Vec::new();
721
722
723    // Create header parameters collection
724    let mut header_params = std::collections::HashMap::new();
725
726    // Handle Binance Auth first if configured
727    if let Some(ref binance_auth) = configuration.binance_auth {
728        // Add API key to headers
729        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
730        
731        // Generate request body for signing (if any)
732        let body_string: Option<Vec<u8>> = None;
733        
734        // Sign the request
735        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
736            Ok(sig) => sig,
737            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
738        };
739        
740        // Add signature to query params
741        query_params.push(("signature".to_string(), signature));
742    }
743
744    // Apply all query parameters
745    if !query_params.is_empty() {
746        req_builder = req_builder.query(&query_params);
747    }
748
749
750    // Add user agent if configured
751    if let Some(ref user_agent) = configuration.user_agent {
752        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
753    }
754
755    // Apply all header parameters
756    for (header_name, header_value) in header_params {
757        req_builder = req_builder.header(&header_name, &header_value);
758    }
759
760    let mut multipart_form_params = std::collections::HashMap::new();
761    if let Some(param_value) = params.recv_window {
762        multipart_form_params.insert("recvWindow", param_value.to_string());
763    }
764    multipart_form_params.insert("timestamp", params.timestamp.to_string());
765    req_builder = req_builder.form(&multipart_form_params);
766
767    let req = req_builder.build()?;
768    let resp = configuration.client.execute(req).await?;
769
770    let status = resp.status();
771    let content_type = resp
772        .headers()
773        .get("content-type")
774        .and_then(|v| v.to_str().ok())
775        .unwrap_or("application/octet-stream");
776    let content_type = super::ContentType::from(content_type);
777
778    if !status.is_client_error() && !status.is_server_error() {
779        let content = resp.text().await?;
780        match content_type {
781            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
782            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSolStakingSolClaimV1Resp`"))),
783            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::CreateSolStakingSolClaimV1Resp`")))),
784        }
785    } else {
786        let content = resp.text().await?;
787        let entity: Option<CreateSolStakingSolClaimV1Error> = serde_json::from_str(&content).ok();
788        Err(Error::ResponseError(ResponseContent { status, content, entity }))
789    }
790}
791
792/// Redeem BNSOL get SOL
793pub async fn create_sol_staking_sol_redeem_v1(configuration: &configuration::Configuration, params: CreateSolStakingSolRedeemV1Params) -> Result<models::CreateSolStakingSolRedeemV1Resp, Error<CreateSolStakingSolRedeemV1Error>> {
794
795    let uri_str = format!("{}/sapi/v1/sol-staking/sol/redeem", configuration.base_path);
796    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
797
798    // Create a mutable vector for query parameters
799    let mut query_params: Vec<(String, String)> = Vec::new();
800
801
802    // Create header parameters collection
803    let mut header_params = std::collections::HashMap::new();
804
805    // Handle Binance Auth first if configured
806    if let Some(ref binance_auth) = configuration.binance_auth {
807        // Add API key to headers
808        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
809        
810        // Generate request body for signing (if any)
811        let body_string: Option<Vec<u8>> = None;
812        
813        // Sign the request
814        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
815            Ok(sig) => sig,
816            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
817        };
818        
819        // Add signature to query params
820        query_params.push(("signature".to_string(), signature));
821    }
822
823    // Apply all query parameters
824    if !query_params.is_empty() {
825        req_builder = req_builder.query(&query_params);
826    }
827
828
829    // Add user agent if configured
830    if let Some(ref user_agent) = configuration.user_agent {
831        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
832    }
833
834    // Apply all header parameters
835    for (header_name, header_value) in header_params {
836        req_builder = req_builder.header(&header_name, &header_value);
837    }
838
839    let mut multipart_form_params = std::collections::HashMap::new();
840    multipart_form_params.insert("amount", params.amount.to_string());
841    if let Some(param_value) = params.recv_window {
842        multipart_form_params.insert("recvWindow", param_value.to_string());
843    }
844    multipart_form_params.insert("timestamp", params.timestamp.to_string());
845    req_builder = req_builder.form(&multipart_form_params);
846
847    let req = req_builder.build()?;
848    let resp = configuration.client.execute(req).await?;
849
850    let status = resp.status();
851    let content_type = resp
852        .headers()
853        .get("content-type")
854        .and_then(|v| v.to_str().ok())
855        .unwrap_or("application/octet-stream");
856    let content_type = super::ContentType::from(content_type);
857
858    if !status.is_client_error() && !status.is_server_error() {
859        let content = resp.text().await?;
860        match content_type {
861            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
862            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSolStakingSolRedeemV1Resp`"))),
863            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::CreateSolStakingSolRedeemV1Resp`")))),
864        }
865    } else {
866        let content = resp.text().await?;
867        let entity: Option<CreateSolStakingSolRedeemV1Error> = serde_json::from_str(&content).ok();
868        Err(Error::ResponseError(ResponseContent { status, content, entity }))
869    }
870}
871
872/// Subscribe SOL Staking
873pub async fn create_sol_staking_sol_stake_v1(configuration: &configuration::Configuration, params: CreateSolStakingSolStakeV1Params) -> Result<models::CreateSolStakingSolStakeV1Resp, Error<CreateSolStakingSolStakeV1Error>> {
874
875    let uri_str = format!("{}/sapi/v1/sol-staking/sol/stake", configuration.base_path);
876    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
877
878    // Create a mutable vector for query parameters
879    let mut query_params: Vec<(String, String)> = Vec::new();
880
881
882    // Create header parameters collection
883    let mut header_params = std::collections::HashMap::new();
884
885    // Handle Binance Auth first if configured
886    if let Some(ref binance_auth) = configuration.binance_auth {
887        // Add API key to headers
888        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
889        
890        // Generate request body for signing (if any)
891        let body_string: Option<Vec<u8>> = None;
892        
893        // Sign the request
894        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
895            Ok(sig) => sig,
896            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
897        };
898        
899        // Add signature to query params
900        query_params.push(("signature".to_string(), signature));
901    }
902
903    // Apply all query parameters
904    if !query_params.is_empty() {
905        req_builder = req_builder.query(&query_params);
906    }
907
908
909    // Add user agent if configured
910    if let Some(ref user_agent) = configuration.user_agent {
911        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
912    }
913
914    // Apply all header parameters
915    for (header_name, header_value) in header_params {
916        req_builder = req_builder.header(&header_name, &header_value);
917    }
918
919    let mut multipart_form_params = std::collections::HashMap::new();
920    multipart_form_params.insert("amount", params.amount.to_string());
921    if let Some(param_value) = params.recv_window {
922        multipart_form_params.insert("recvWindow", param_value.to_string());
923    }
924    multipart_form_params.insert("timestamp", params.timestamp.to_string());
925    req_builder = req_builder.form(&multipart_form_params);
926
927    let req = req_builder.build()?;
928    let resp = configuration.client.execute(req).await?;
929
930    let status = resp.status();
931    let content_type = resp
932        .headers()
933        .get("content-type")
934        .and_then(|v| v.to_str().ok())
935        .unwrap_or("application/octet-stream");
936    let content_type = super::ContentType::from(content_type);
937
938    if !status.is_client_error() && !status.is_server_error() {
939        let content = resp.text().await?;
940        match content_type {
941            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
942            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSolStakingSolStakeV1Resp`"))),
943            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::CreateSolStakingSolStakeV1Resp`")))),
944        }
945    } else {
946        let content = resp.text().await?;
947        let entity: Option<CreateSolStakingSolStakeV1Error> = serde_json::from_str(&content).ok();
948        Err(Error::ResponseError(ResponseContent { status, content, entity }))
949    }
950}
951
952/// ETH Staking account
953pub async fn get_eth_staking_account_v2(configuration: &configuration::Configuration, params: GetEthStakingAccountV2Params) -> Result<models::GetEthStakingAccountV2Resp, Error<GetEthStakingAccountV2Error>> {
954
955    let uri_str = format!("{}/sapi/v2/eth-staking/account", configuration.base_path);
956    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
957
958    // Create a mutable vector for query parameters
959    let mut query_params: Vec<(String, String)> = Vec::new();
960
961    if let Some(ref param_value) = params.recv_window {
962        query_params.push(("recvWindow".to_string(), param_value.to_string()));
963    }
964    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
965
966    // Create header parameters collection
967    let mut header_params = std::collections::HashMap::new();
968
969    // Handle Binance Auth first if configured
970    if let Some(ref binance_auth) = configuration.binance_auth {
971        // Add API key to headers
972        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
973        
974        // Generate request body for signing (if any)
975        let body_string: Option<Vec<u8>> = None;
976        
977        // Sign the request
978        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
979            Ok(sig) => sig,
980            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
981        };
982        
983        // Add signature to query params
984        query_params.push(("signature".to_string(), signature));
985    }
986
987    // Apply all query parameters
988    if !query_params.is_empty() {
989        req_builder = req_builder.query(&query_params);
990    }
991
992
993    // Add user agent if configured
994    if let Some(ref user_agent) = configuration.user_agent {
995        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
996    }
997
998    // Apply all header parameters
999    for (header_name, header_value) in header_params {
1000        req_builder = req_builder.header(&header_name, &header_value);
1001    }
1002
1003
1004    let req = req_builder.build()?;
1005    let resp = configuration.client.execute(req).await?;
1006
1007    let status = resp.status();
1008    let content_type = resp
1009        .headers()
1010        .get("content-type")
1011        .and_then(|v| v.to_str().ok())
1012        .unwrap_or("application/octet-stream");
1013    let content_type = super::ContentType::from(content_type);
1014
1015    if !status.is_client_error() && !status.is_server_error() {
1016        let content = resp.text().await?;
1017        match content_type {
1018            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1019            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingAccountV2Resp`"))),
1020            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::GetEthStakingAccountV2Resp`")))),
1021        }
1022    } else {
1023        let content = resp.text().await?;
1024        let entity: Option<GetEthStakingAccountV2Error> = serde_json::from_str(&content).ok();
1025        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1026    }
1027}
1028
1029/// Get WBETH Rate History
1030pub async fn get_eth_staking_eth_history_rate_history_v1(configuration: &configuration::Configuration, params: GetEthStakingEthHistoryRateHistoryV1Params) -> Result<models::GetEthStakingEthHistoryRateHistoryV1Resp, Error<GetEthStakingEthHistoryRateHistoryV1Error>> {
1031
1032    let uri_str = format!("{}/sapi/v1/eth-staking/eth/history/rateHistory", configuration.base_path);
1033    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1034
1035    // Create a mutable vector for query parameters
1036    let mut query_params: Vec<(String, String)> = Vec::new();
1037
1038    if let Some(ref param_value) = params.start_time {
1039        query_params.push(("startTime".to_string(), param_value.to_string()));
1040    }
1041    if let Some(ref param_value) = params.end_time {
1042        query_params.push(("endTime".to_string(), param_value.to_string()));
1043    }
1044    if let Some(ref param_value) = params.current {
1045        query_params.push(("current".to_string(), param_value.to_string()));
1046    }
1047    if let Some(ref param_value) = params.size {
1048        query_params.push(("size".to_string(), param_value.to_string()));
1049    }
1050    if let Some(ref param_value) = params.recv_window {
1051        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1052    }
1053    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1054
1055    // Create header parameters collection
1056    let mut header_params = std::collections::HashMap::new();
1057
1058    // Handle Binance Auth first if configured
1059    if let Some(ref binance_auth) = configuration.binance_auth {
1060        // Add API key to headers
1061        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1062        
1063        // Generate request body for signing (if any)
1064        let body_string: Option<Vec<u8>> = None;
1065        
1066        // Sign the request
1067        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1068            Ok(sig) => sig,
1069            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1070        };
1071        
1072        // Add signature to query params
1073        query_params.push(("signature".to_string(), signature));
1074    }
1075
1076    // Apply all query parameters
1077    if !query_params.is_empty() {
1078        req_builder = req_builder.query(&query_params);
1079    }
1080
1081
1082    // Add user agent if configured
1083    if let Some(ref user_agent) = configuration.user_agent {
1084        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1085    }
1086
1087    // Apply all header parameters
1088    for (header_name, header_value) in header_params {
1089        req_builder = req_builder.header(&header_name, &header_value);
1090    }
1091
1092
1093    let req = req_builder.build()?;
1094    let resp = configuration.client.execute(req).await?;
1095
1096    let status = resp.status();
1097    let content_type = resp
1098        .headers()
1099        .get("content-type")
1100        .and_then(|v| v.to_str().ok())
1101        .unwrap_or("application/octet-stream");
1102    let content_type = super::ContentType::from(content_type);
1103
1104    if !status.is_client_error() && !status.is_server_error() {
1105        let content = resp.text().await?;
1106        match content_type {
1107            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1108            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingEthHistoryRateHistoryV1Resp`"))),
1109            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::GetEthStakingEthHistoryRateHistoryV1Resp`")))),
1110        }
1111    } else {
1112        let content = resp.text().await?;
1113        let entity: Option<GetEthStakingEthHistoryRateHistoryV1Error> = serde_json::from_str(&content).ok();
1114        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1115    }
1116}
1117
1118/// Get ETH redemption history
1119pub async fn get_eth_staking_eth_history_redemption_history_v1(configuration: &configuration::Configuration, params: GetEthStakingEthHistoryRedemptionHistoryV1Params) -> Result<models::GetEthStakingEthHistoryRedemptionHistoryV1Resp, Error<GetEthStakingEthHistoryRedemptionHistoryV1Error>> {
1120
1121    let uri_str = format!("{}/sapi/v1/eth-staking/eth/history/redemptionHistory", configuration.base_path);
1122    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1123
1124    // Create a mutable vector for query parameters
1125    let mut query_params: Vec<(String, String)> = Vec::new();
1126
1127    if let Some(ref param_value) = params.start_time {
1128        query_params.push(("startTime".to_string(), param_value.to_string()));
1129    }
1130    if let Some(ref param_value) = params.end_time {
1131        query_params.push(("endTime".to_string(), param_value.to_string()));
1132    }
1133    if let Some(ref param_value) = params.current {
1134        query_params.push(("current".to_string(), param_value.to_string()));
1135    }
1136    if let Some(ref param_value) = params.size {
1137        query_params.push(("size".to_string(), param_value.to_string()));
1138    }
1139    if let Some(ref param_value) = params.recv_window {
1140        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1141    }
1142    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1143
1144    // Create header parameters collection
1145    let mut header_params = std::collections::HashMap::new();
1146
1147    // Handle Binance Auth first if configured
1148    if let Some(ref binance_auth) = configuration.binance_auth {
1149        // Add API key to headers
1150        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1151        
1152        // Generate request body for signing (if any)
1153        let body_string: Option<Vec<u8>> = None;
1154        
1155        // Sign the request
1156        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1157            Ok(sig) => sig,
1158            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1159        };
1160        
1161        // Add signature to query params
1162        query_params.push(("signature".to_string(), signature));
1163    }
1164
1165    // Apply all query parameters
1166    if !query_params.is_empty() {
1167        req_builder = req_builder.query(&query_params);
1168    }
1169
1170
1171    // Add user agent if configured
1172    if let Some(ref user_agent) = configuration.user_agent {
1173        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1174    }
1175
1176    // Apply all header parameters
1177    for (header_name, header_value) in header_params {
1178        req_builder = req_builder.header(&header_name, &header_value);
1179    }
1180
1181
1182    let req = req_builder.build()?;
1183    let resp = configuration.client.execute(req).await?;
1184
1185    let status = resp.status();
1186    let content_type = resp
1187        .headers()
1188        .get("content-type")
1189        .and_then(|v| v.to_str().ok())
1190        .unwrap_or("application/octet-stream");
1191    let content_type = super::ContentType::from(content_type);
1192
1193    if !status.is_client_error() && !status.is_server_error() {
1194        let content = resp.text().await?;
1195        match content_type {
1196            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1197            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingEthHistoryRedemptionHistoryV1Resp`"))),
1198            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::GetEthStakingEthHistoryRedemptionHistoryV1Resp`")))),
1199        }
1200    } else {
1201        let content = resp.text().await?;
1202        let entity: Option<GetEthStakingEthHistoryRedemptionHistoryV1Error> = serde_json::from_str(&content).ok();
1203        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1204    }
1205}
1206
1207/// Get BETH rewards distribution history
1208pub async fn get_eth_staking_eth_history_rewards_history_v1(configuration: &configuration::Configuration, params: GetEthStakingEthHistoryRewardsHistoryV1Params) -> Result<models::GetEthStakingEthHistoryRewardsHistoryV1Resp, Error<GetEthStakingEthHistoryRewardsHistoryV1Error>> {
1209
1210    let uri_str = format!("{}/sapi/v1/eth-staking/eth/history/rewardsHistory", configuration.base_path);
1211    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1212
1213    // Create a mutable vector for query parameters
1214    let mut query_params: Vec<(String, String)> = Vec::new();
1215
1216    if let Some(ref param_value) = params.start_time {
1217        query_params.push(("startTime".to_string(), param_value.to_string()));
1218    }
1219    if let Some(ref param_value) = params.end_time {
1220        query_params.push(("endTime".to_string(), param_value.to_string()));
1221    }
1222    if let Some(ref param_value) = params.current {
1223        query_params.push(("current".to_string(), param_value.to_string()));
1224    }
1225    if let Some(ref param_value) = params.size {
1226        query_params.push(("size".to_string(), param_value.to_string()));
1227    }
1228    if let Some(ref param_value) = params.recv_window {
1229        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1230    }
1231    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1232
1233    // Create header parameters collection
1234    let mut header_params = std::collections::HashMap::new();
1235
1236    // Handle Binance Auth first if configured
1237    if let Some(ref binance_auth) = configuration.binance_auth {
1238        // Add API key to headers
1239        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1240        
1241        // Generate request body for signing (if any)
1242        let body_string: Option<Vec<u8>> = None;
1243        
1244        // Sign the request
1245        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1246            Ok(sig) => sig,
1247            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1248        };
1249        
1250        // Add signature to query params
1251        query_params.push(("signature".to_string(), signature));
1252    }
1253
1254    // Apply all query parameters
1255    if !query_params.is_empty() {
1256        req_builder = req_builder.query(&query_params);
1257    }
1258
1259
1260    // Add user agent if configured
1261    if let Some(ref user_agent) = configuration.user_agent {
1262        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1263    }
1264
1265    // Apply all header parameters
1266    for (header_name, header_value) in header_params {
1267        req_builder = req_builder.header(&header_name, &header_value);
1268    }
1269
1270
1271    let req = req_builder.build()?;
1272    let resp = configuration.client.execute(req).await?;
1273
1274    let status = resp.status();
1275    let content_type = resp
1276        .headers()
1277        .get("content-type")
1278        .and_then(|v| v.to_str().ok())
1279        .unwrap_or("application/octet-stream");
1280    let content_type = super::ContentType::from(content_type);
1281
1282    if !status.is_client_error() && !status.is_server_error() {
1283        let content = resp.text().await?;
1284        match content_type {
1285            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1286            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingEthHistoryRewardsHistoryV1Resp`"))),
1287            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::GetEthStakingEthHistoryRewardsHistoryV1Resp`")))),
1288        }
1289    } else {
1290        let content = resp.text().await?;
1291        let entity: Option<GetEthStakingEthHistoryRewardsHistoryV1Error> = serde_json::from_str(&content).ok();
1292        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1293    }
1294}
1295
1296/// Get ETH staking history
1297pub async fn get_eth_staking_eth_history_staking_history_v1(configuration: &configuration::Configuration, params: GetEthStakingEthHistoryStakingHistoryV1Params) -> Result<models::GetEthStakingEthHistoryStakingHistoryV1Resp, Error<GetEthStakingEthHistoryStakingHistoryV1Error>> {
1298
1299    let uri_str = format!("{}/sapi/v1/eth-staking/eth/history/stakingHistory", configuration.base_path);
1300    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1301
1302    // Create a mutable vector for query parameters
1303    let mut query_params: Vec<(String, String)> = Vec::new();
1304
1305    if let Some(ref param_value) = params.start_time {
1306        query_params.push(("startTime".to_string(), param_value.to_string()));
1307    }
1308    if let Some(ref param_value) = params.end_time {
1309        query_params.push(("endTime".to_string(), param_value.to_string()));
1310    }
1311    if let Some(ref param_value) = params.current {
1312        query_params.push(("current".to_string(), param_value.to_string()));
1313    }
1314    if let Some(ref param_value) = params.size {
1315        query_params.push(("size".to_string(), param_value.to_string()));
1316    }
1317    if let Some(ref param_value) = params.recv_window {
1318        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1319    }
1320    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1321
1322    // Create header parameters collection
1323    let mut header_params = std::collections::HashMap::new();
1324
1325    // Handle Binance Auth first if configured
1326    if let Some(ref binance_auth) = configuration.binance_auth {
1327        // Add API key to headers
1328        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1329        
1330        // Generate request body for signing (if any)
1331        let body_string: Option<Vec<u8>> = None;
1332        
1333        // Sign the request
1334        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1335            Ok(sig) => sig,
1336            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1337        };
1338        
1339        // Add signature to query params
1340        query_params.push(("signature".to_string(), signature));
1341    }
1342
1343    // Apply all query parameters
1344    if !query_params.is_empty() {
1345        req_builder = req_builder.query(&query_params);
1346    }
1347
1348
1349    // Add user agent if configured
1350    if let Some(ref user_agent) = configuration.user_agent {
1351        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1352    }
1353
1354    // Apply all header parameters
1355    for (header_name, header_value) in header_params {
1356        req_builder = req_builder.header(&header_name, &header_value);
1357    }
1358
1359
1360    let req = req_builder.build()?;
1361    let resp = configuration.client.execute(req).await?;
1362
1363    let status = resp.status();
1364    let content_type = resp
1365        .headers()
1366        .get("content-type")
1367        .and_then(|v| v.to_str().ok())
1368        .unwrap_or("application/octet-stream");
1369    let content_type = super::ContentType::from(content_type);
1370
1371    if !status.is_client_error() && !status.is_server_error() {
1372        let content = resp.text().await?;
1373        match content_type {
1374            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1375            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingEthHistoryStakingHistoryV1Resp`"))),
1376            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::GetEthStakingEthHistoryStakingHistoryV1Resp`")))),
1377        }
1378    } else {
1379        let content = resp.text().await?;
1380        let entity: Option<GetEthStakingEthHistoryStakingHistoryV1Error> = serde_json::from_str(&content).ok();
1381        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1382    }
1383}
1384
1385/// Get WBETH rewards history
1386pub async fn get_eth_staking_eth_history_wbeth_rewards_history_v1(configuration: &configuration::Configuration, params: GetEthStakingEthHistoryWbethRewardsHistoryV1Params) -> Result<models::GetEthStakingEthHistoryWbethRewardsHistoryV1Resp, Error<GetEthStakingEthHistoryWbethRewardsHistoryV1Error>> {
1387
1388    let uri_str = format!("{}/sapi/v1/eth-staking/eth/history/wbethRewardsHistory", configuration.base_path);
1389    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1390
1391    // Create a mutable vector for query parameters
1392    let mut query_params: Vec<(String, String)> = Vec::new();
1393
1394    if let Some(ref param_value) = params.start_time {
1395        query_params.push(("startTime".to_string(), param_value.to_string()));
1396    }
1397    if let Some(ref param_value) = params.end_time {
1398        query_params.push(("endTime".to_string(), param_value.to_string()));
1399    }
1400    if let Some(ref param_value) = params.current {
1401        query_params.push(("current".to_string(), param_value.to_string()));
1402    }
1403    if let Some(ref param_value) = params.size {
1404        query_params.push(("size".to_string(), param_value.to_string()));
1405    }
1406    if let Some(ref param_value) = params.recv_window {
1407        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1408    }
1409    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1410
1411    // Create header parameters collection
1412    let mut header_params = std::collections::HashMap::new();
1413
1414    // Handle Binance Auth first if configured
1415    if let Some(ref binance_auth) = configuration.binance_auth {
1416        // Add API key to headers
1417        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1418        
1419        // Generate request body for signing (if any)
1420        let body_string: Option<Vec<u8>> = None;
1421        
1422        // Sign the request
1423        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1424            Ok(sig) => sig,
1425            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1426        };
1427        
1428        // Add signature to query params
1429        query_params.push(("signature".to_string(), signature));
1430    }
1431
1432    // Apply all query parameters
1433    if !query_params.is_empty() {
1434        req_builder = req_builder.query(&query_params);
1435    }
1436
1437
1438    // Add user agent if configured
1439    if let Some(ref user_agent) = configuration.user_agent {
1440        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1441    }
1442
1443    // Apply all header parameters
1444    for (header_name, header_value) in header_params {
1445        req_builder = req_builder.header(&header_name, &header_value);
1446    }
1447
1448
1449    let req = req_builder.build()?;
1450    let resp = configuration.client.execute(req).await?;
1451
1452    let status = resp.status();
1453    let content_type = resp
1454        .headers()
1455        .get("content-type")
1456        .and_then(|v| v.to_str().ok())
1457        .unwrap_or("application/octet-stream");
1458    let content_type = super::ContentType::from(content_type);
1459
1460    if !status.is_client_error() && !status.is_server_error() {
1461        let content = resp.text().await?;
1462        match content_type {
1463            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1464            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingEthHistoryWbethRewardsHistoryV1Resp`"))),
1465            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::GetEthStakingEthHistoryWbethRewardsHistoryV1Resp`")))),
1466        }
1467    } else {
1468        let content = resp.text().await?;
1469        let entity: Option<GetEthStakingEthHistoryWbethRewardsHistoryV1Error> = serde_json::from_str(&content).ok();
1470        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1471    }
1472}
1473
1474/// Get current ETH staking quota
1475pub async fn get_eth_staking_eth_quota_v1(configuration: &configuration::Configuration, params: GetEthStakingEthQuotaV1Params) -> Result<models::GetEthStakingEthQuotaV1Resp, Error<GetEthStakingEthQuotaV1Error>> {
1476
1477    let uri_str = format!("{}/sapi/v1/eth-staking/eth/quota", configuration.base_path);
1478    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1479
1480    // Create a mutable vector for query parameters
1481    let mut query_params: Vec<(String, String)> = Vec::new();
1482
1483    if let Some(ref param_value) = params.recv_window {
1484        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1485    }
1486    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1487
1488    // Create header parameters collection
1489    let mut header_params = std::collections::HashMap::new();
1490
1491    // Handle Binance Auth first if configured
1492    if let Some(ref binance_auth) = configuration.binance_auth {
1493        // Add API key to headers
1494        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1495        
1496        // Generate request body for signing (if any)
1497        let body_string: Option<Vec<u8>> = None;
1498        
1499        // Sign the request
1500        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1501            Ok(sig) => sig,
1502            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1503        };
1504        
1505        // Add signature to query params
1506        query_params.push(("signature".to_string(), signature));
1507    }
1508
1509    // Apply all query parameters
1510    if !query_params.is_empty() {
1511        req_builder = req_builder.query(&query_params);
1512    }
1513
1514
1515    // Add user agent if configured
1516    if let Some(ref user_agent) = configuration.user_agent {
1517        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1518    }
1519
1520    // Apply all header parameters
1521    for (header_name, header_value) in header_params {
1522        req_builder = req_builder.header(&header_name, &header_value);
1523    }
1524
1525
1526    let req = req_builder.build()?;
1527    let resp = configuration.client.execute(req).await?;
1528
1529    let status = resp.status();
1530    let content_type = resp
1531        .headers()
1532        .get("content-type")
1533        .and_then(|v| v.to_str().ok())
1534        .unwrap_or("application/octet-stream");
1535    let content_type = super::ContentType::from(content_type);
1536
1537    if !status.is_client_error() && !status.is_server_error() {
1538        let content = resp.text().await?;
1539        match content_type {
1540            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1541            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingEthQuotaV1Resp`"))),
1542            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::GetEthStakingEthQuotaV1Resp`")))),
1543        }
1544    } else {
1545        let content = resp.text().await?;
1546        let entity: Option<GetEthStakingEthQuotaV1Error> = serde_json::from_str(&content).ok();
1547        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1548    }
1549}
1550
1551/// Get WBETH unwrap history
1552pub async fn get_eth_staking_wbeth_history_unwrap_history_v1(configuration: &configuration::Configuration, params: GetEthStakingWbethHistoryUnwrapHistoryV1Params) -> Result<models::GetEthStakingWbethHistoryUnwrapHistoryV1Resp, Error<GetEthStakingWbethHistoryUnwrapHistoryV1Error>> {
1553
1554    let uri_str = format!("{}/sapi/v1/eth-staking/wbeth/history/unwrapHistory", configuration.base_path);
1555    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1556
1557    // Create a mutable vector for query parameters
1558    let mut query_params: Vec<(String, String)> = Vec::new();
1559
1560    if let Some(ref param_value) = params.start_time {
1561        query_params.push(("startTime".to_string(), param_value.to_string()));
1562    }
1563    if let Some(ref param_value) = params.end_time {
1564        query_params.push(("endTime".to_string(), param_value.to_string()));
1565    }
1566    if let Some(ref param_value) = params.current {
1567        query_params.push(("current".to_string(), param_value.to_string()));
1568    }
1569    if let Some(ref param_value) = params.size {
1570        query_params.push(("size".to_string(), param_value.to_string()));
1571    }
1572    if let Some(ref param_value) = params.recv_window {
1573        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1574    }
1575    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1576
1577    // Create header parameters collection
1578    let mut header_params = std::collections::HashMap::new();
1579
1580    // Handle Binance Auth first if configured
1581    if let Some(ref binance_auth) = configuration.binance_auth {
1582        // Add API key to headers
1583        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1584        
1585        // Generate request body for signing (if any)
1586        let body_string: Option<Vec<u8>> = None;
1587        
1588        // Sign the request
1589        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1590            Ok(sig) => sig,
1591            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1592        };
1593        
1594        // Add signature to query params
1595        query_params.push(("signature".to_string(), signature));
1596    }
1597
1598    // Apply all query parameters
1599    if !query_params.is_empty() {
1600        req_builder = req_builder.query(&query_params);
1601    }
1602
1603
1604    // Add user agent if configured
1605    if let Some(ref user_agent) = configuration.user_agent {
1606        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1607    }
1608
1609    // Apply all header parameters
1610    for (header_name, header_value) in header_params {
1611        req_builder = req_builder.header(&header_name, &header_value);
1612    }
1613
1614
1615    let req = req_builder.build()?;
1616    let resp = configuration.client.execute(req).await?;
1617
1618    let status = resp.status();
1619    let content_type = resp
1620        .headers()
1621        .get("content-type")
1622        .and_then(|v| v.to_str().ok())
1623        .unwrap_or("application/octet-stream");
1624    let content_type = super::ContentType::from(content_type);
1625
1626    if !status.is_client_error() && !status.is_server_error() {
1627        let content = resp.text().await?;
1628        match content_type {
1629            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1630            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingWbethHistoryUnwrapHistoryV1Resp`"))),
1631            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::GetEthStakingWbethHistoryUnwrapHistoryV1Resp`")))),
1632        }
1633    } else {
1634        let content = resp.text().await?;
1635        let entity: Option<GetEthStakingWbethHistoryUnwrapHistoryV1Error> = serde_json::from_str(&content).ok();
1636        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1637    }
1638}
1639
1640/// Get WBETH wrap history
1641pub async fn get_eth_staking_wbeth_history_wrap_history_v1(configuration: &configuration::Configuration, params: GetEthStakingWbethHistoryWrapHistoryV1Params) -> Result<models::GetEthStakingWbethHistoryWrapHistoryV1Resp, Error<GetEthStakingWbethHistoryWrapHistoryV1Error>> {
1642
1643    let uri_str = format!("{}/sapi/v1/eth-staking/wbeth/history/wrapHistory", configuration.base_path);
1644    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1645
1646    // Create a mutable vector for query parameters
1647    let mut query_params: Vec<(String, String)> = Vec::new();
1648
1649    if let Some(ref param_value) = params.start_time {
1650        query_params.push(("startTime".to_string(), param_value.to_string()));
1651    }
1652    if let Some(ref param_value) = params.end_time {
1653        query_params.push(("endTime".to_string(), param_value.to_string()));
1654    }
1655    if let Some(ref param_value) = params.current {
1656        query_params.push(("current".to_string(), param_value.to_string()));
1657    }
1658    if let Some(ref param_value) = params.size {
1659        query_params.push(("size".to_string(), param_value.to_string()));
1660    }
1661    if let Some(ref param_value) = params.recv_window {
1662        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1663    }
1664    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1665
1666    // Create header parameters collection
1667    let mut header_params = std::collections::HashMap::new();
1668
1669    // Handle Binance Auth first if configured
1670    if let Some(ref binance_auth) = configuration.binance_auth {
1671        // Add API key to headers
1672        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1673        
1674        // Generate request body for signing (if any)
1675        let body_string: Option<Vec<u8>> = None;
1676        
1677        // Sign the request
1678        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1679            Ok(sig) => sig,
1680            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1681        };
1682        
1683        // Add signature to query params
1684        query_params.push(("signature".to_string(), signature));
1685    }
1686
1687    // Apply all query parameters
1688    if !query_params.is_empty() {
1689        req_builder = req_builder.query(&query_params);
1690    }
1691
1692
1693    // Add user agent if configured
1694    if let Some(ref user_agent) = configuration.user_agent {
1695        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1696    }
1697
1698    // Apply all header parameters
1699    for (header_name, header_value) in header_params {
1700        req_builder = req_builder.header(&header_name, &header_value);
1701    }
1702
1703
1704    let req = req_builder.build()?;
1705    let resp = configuration.client.execute(req).await?;
1706
1707    let status = resp.status();
1708    let content_type = resp
1709        .headers()
1710        .get("content-type")
1711        .and_then(|v| v.to_str().ok())
1712        .unwrap_or("application/octet-stream");
1713    let content_type = super::ContentType::from(content_type);
1714
1715    if !status.is_client_error() && !status.is_server_error() {
1716        let content = resp.text().await?;
1717        match content_type {
1718            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1719            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEthStakingWbethHistoryWrapHistoryV1Resp`"))),
1720            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::GetEthStakingWbethHistoryWrapHistoryV1Resp`")))),
1721        }
1722    } else {
1723        let content = resp.text().await?;
1724        let entity: Option<GetEthStakingWbethHistoryWrapHistoryV1Error> = serde_json::from_str(&content).ok();
1725        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1726    }
1727}
1728
1729/// SOL Staking account
1730pub async fn get_sol_staking_account_v1(configuration: &configuration::Configuration, params: GetSolStakingAccountV1Params) -> Result<models::GetSolStakingAccountV1Resp, Error<GetSolStakingAccountV1Error>> {
1731
1732    let uri_str = format!("{}/sapi/v1/sol-staking/account", configuration.base_path);
1733    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1734
1735    // Create a mutable vector for query parameters
1736    let mut query_params: Vec<(String, String)> = Vec::new();
1737
1738    if let Some(ref param_value) = params.recv_window {
1739        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1740    }
1741    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1742
1743    // Create header parameters collection
1744    let mut header_params = std::collections::HashMap::new();
1745
1746    // Handle Binance Auth first if configured
1747    if let Some(ref binance_auth) = configuration.binance_auth {
1748        // Add API key to headers
1749        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1750        
1751        // Generate request body for signing (if any)
1752        let body_string: Option<Vec<u8>> = None;
1753        
1754        // Sign the request
1755        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1756            Ok(sig) => sig,
1757            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1758        };
1759        
1760        // Add signature to query params
1761        query_params.push(("signature".to_string(), signature));
1762    }
1763
1764    // Apply all query parameters
1765    if !query_params.is_empty() {
1766        req_builder = req_builder.query(&query_params);
1767    }
1768
1769
1770    // Add user agent if configured
1771    if let Some(ref user_agent) = configuration.user_agent {
1772        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1773    }
1774
1775    // Apply all header parameters
1776    for (header_name, header_value) in header_params {
1777        req_builder = req_builder.header(&header_name, &header_value);
1778    }
1779
1780
1781    let req = req_builder.build()?;
1782    let resp = configuration.client.execute(req).await?;
1783
1784    let status = resp.status();
1785    let content_type = resp
1786        .headers()
1787        .get("content-type")
1788        .and_then(|v| v.to_str().ok())
1789        .unwrap_or("application/octet-stream");
1790    let content_type = super::ContentType::from(content_type);
1791
1792    if !status.is_client_error() && !status.is_server_error() {
1793        let content = resp.text().await?;
1794        match content_type {
1795            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1796            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSolStakingAccountV1Resp`"))),
1797            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::GetSolStakingAccountV1Resp`")))),
1798        }
1799    } else {
1800        let content = resp.text().await?;
1801        let entity: Option<GetSolStakingAccountV1Error> = serde_json::from_str(&content).ok();
1802        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1803    }
1804}
1805
1806/// Get BNSOL rewards history
1807pub async fn get_sol_staking_sol_history_bnsol_rewards_history_v1(configuration: &configuration::Configuration, params: GetSolStakingSolHistoryBnsolRewardsHistoryV1Params) -> Result<models::GetSolStakingSolHistoryBnsolRewardsHistoryV1Resp, Error<GetSolStakingSolHistoryBnsolRewardsHistoryV1Error>> {
1808
1809    let uri_str = format!("{}/sapi/v1/sol-staking/sol/history/bnsolRewardsHistory", configuration.base_path);
1810    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1811
1812    // Create a mutable vector for query parameters
1813    let mut query_params: Vec<(String, String)> = Vec::new();
1814
1815    if let Some(ref param_value) = params.start_time {
1816        query_params.push(("startTime".to_string(), param_value.to_string()));
1817    }
1818    if let Some(ref param_value) = params.end_time {
1819        query_params.push(("endTime".to_string(), param_value.to_string()));
1820    }
1821    if let Some(ref param_value) = params.current {
1822        query_params.push(("current".to_string(), param_value.to_string()));
1823    }
1824    if let Some(ref param_value) = params.size {
1825        query_params.push(("size".to_string(), param_value.to_string()));
1826    }
1827    if let Some(ref param_value) = params.recv_window {
1828        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1829    }
1830    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1831
1832    // Create header parameters collection
1833    let mut header_params = std::collections::HashMap::new();
1834
1835    // Handle Binance Auth first if configured
1836    if let Some(ref binance_auth) = configuration.binance_auth {
1837        // Add API key to headers
1838        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1839        
1840        // Generate request body for signing (if any)
1841        let body_string: Option<Vec<u8>> = None;
1842        
1843        // Sign the request
1844        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1845            Ok(sig) => sig,
1846            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1847        };
1848        
1849        // Add signature to query params
1850        query_params.push(("signature".to_string(), signature));
1851    }
1852
1853    // Apply all query parameters
1854    if !query_params.is_empty() {
1855        req_builder = req_builder.query(&query_params);
1856    }
1857
1858
1859    // Add user agent if configured
1860    if let Some(ref user_agent) = configuration.user_agent {
1861        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1862    }
1863
1864    // Apply all header parameters
1865    for (header_name, header_value) in header_params {
1866        req_builder = req_builder.header(&header_name, &header_value);
1867    }
1868
1869
1870    let req = req_builder.build()?;
1871    let resp = configuration.client.execute(req).await?;
1872
1873    let status = resp.status();
1874    let content_type = resp
1875        .headers()
1876        .get("content-type")
1877        .and_then(|v| v.to_str().ok())
1878        .unwrap_or("application/octet-stream");
1879    let content_type = super::ContentType::from(content_type);
1880
1881    if !status.is_client_error() && !status.is_server_error() {
1882        let content = resp.text().await?;
1883        match content_type {
1884            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1885            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSolStakingSolHistoryBnsolRewardsHistoryV1Resp`"))),
1886            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::GetSolStakingSolHistoryBnsolRewardsHistoryV1Resp`")))),
1887        }
1888    } else {
1889        let content = resp.text().await?;
1890        let entity: Option<GetSolStakingSolHistoryBnsolRewardsHistoryV1Error> = serde_json::from_str(&content).ok();
1891        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1892    }
1893}
1894
1895/// Get Boost rewards history
1896pub async fn get_sol_staking_sol_history_boost_rewards_history_v1(configuration: &configuration::Configuration, params: GetSolStakingSolHistoryBoostRewardsHistoryV1Params) -> Result<models::GetSolStakingSolHistoryBoostRewardsHistoryV1Resp, Error<GetSolStakingSolHistoryBoostRewardsHistoryV1Error>> {
1897
1898    let uri_str = format!("{}/sapi/v1/sol-staking/sol/history/boostRewardsHistory", configuration.base_path);
1899    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1900
1901    // Create a mutable vector for query parameters
1902    let mut query_params: Vec<(String, String)> = Vec::new();
1903
1904    query_params.push(("type".to_string(), params.r#type.to_string()));
1905    if let Some(ref param_value) = params.start_time {
1906        query_params.push(("startTime".to_string(), param_value.to_string()));
1907    }
1908    if let Some(ref param_value) = params.end_time {
1909        query_params.push(("endTime".to_string(), param_value.to_string()));
1910    }
1911    if let Some(ref param_value) = params.current {
1912        query_params.push(("current".to_string(), param_value.to_string()));
1913    }
1914    if let Some(ref param_value) = params.size {
1915        query_params.push(("size".to_string(), param_value.to_string()));
1916    }
1917    if let Some(ref param_value) = params.recv_window {
1918        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1919    }
1920    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1921
1922    // Create header parameters collection
1923    let mut header_params = std::collections::HashMap::new();
1924
1925    // Handle Binance Auth first if configured
1926    if let Some(ref binance_auth) = configuration.binance_auth {
1927        // Add API key to headers
1928        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1929        
1930        // Generate request body for signing (if any)
1931        let body_string: Option<Vec<u8>> = None;
1932        
1933        // Sign the request
1934        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1935            Ok(sig) => sig,
1936            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1937        };
1938        
1939        // Add signature to query params
1940        query_params.push(("signature".to_string(), signature));
1941    }
1942
1943    // Apply all query parameters
1944    if !query_params.is_empty() {
1945        req_builder = req_builder.query(&query_params);
1946    }
1947
1948
1949    // Add user agent if configured
1950    if let Some(ref user_agent) = configuration.user_agent {
1951        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1952    }
1953
1954    // Apply all header parameters
1955    for (header_name, header_value) in header_params {
1956        req_builder = req_builder.header(&header_name, &header_value);
1957    }
1958
1959
1960    let req = req_builder.build()?;
1961    let resp = configuration.client.execute(req).await?;
1962
1963    let status = resp.status();
1964    let content_type = resp
1965        .headers()
1966        .get("content-type")
1967        .and_then(|v| v.to_str().ok())
1968        .unwrap_or("application/octet-stream");
1969    let content_type = super::ContentType::from(content_type);
1970
1971    if !status.is_client_error() && !status.is_server_error() {
1972        let content = resp.text().await?;
1973        match content_type {
1974            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1975            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSolStakingSolHistoryBoostRewardsHistoryV1Resp`"))),
1976            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::GetSolStakingSolHistoryBoostRewardsHistoryV1Resp`")))),
1977        }
1978    } else {
1979        let content = resp.text().await?;
1980        let entity: Option<GetSolStakingSolHistoryBoostRewardsHistoryV1Error> = serde_json::from_str(&content).ok();
1981        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1982    }
1983}
1984
1985/// Get BNSOL Rate History
1986pub async fn get_sol_staking_sol_history_rate_history_v1(configuration: &configuration::Configuration, params: GetSolStakingSolHistoryRateHistoryV1Params) -> Result<models::GetSolStakingSolHistoryRateHistoryV1Resp, Error<GetSolStakingSolHistoryRateHistoryV1Error>> {
1987
1988    let uri_str = format!("{}/sapi/v1/sol-staking/sol/history/rateHistory", configuration.base_path);
1989    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1990
1991    // Create a mutable vector for query parameters
1992    let mut query_params: Vec<(String, String)> = Vec::new();
1993
1994    if let Some(ref param_value) = params.start_time {
1995        query_params.push(("startTime".to_string(), param_value.to_string()));
1996    }
1997    if let Some(ref param_value) = params.end_time {
1998        query_params.push(("endTime".to_string(), param_value.to_string()));
1999    }
2000    if let Some(ref param_value) = params.current {
2001        query_params.push(("current".to_string(), param_value.to_string()));
2002    }
2003    if let Some(ref param_value) = params.size {
2004        query_params.push(("size".to_string(), param_value.to_string()));
2005    }
2006    if let Some(ref param_value) = params.recv_window {
2007        query_params.push(("recvWindow".to_string(), param_value.to_string()));
2008    }
2009    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2010
2011    // Create header parameters collection
2012    let mut header_params = std::collections::HashMap::new();
2013
2014    // Handle Binance Auth first if configured
2015    if let Some(ref binance_auth) = configuration.binance_auth {
2016        // Add API key to headers
2017        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2018        
2019        // Generate request body for signing (if any)
2020        let body_string: Option<Vec<u8>> = None;
2021        
2022        // Sign the request
2023        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2024            Ok(sig) => sig,
2025            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2026        };
2027        
2028        // Add signature to query params
2029        query_params.push(("signature".to_string(), signature));
2030    }
2031
2032    // Apply all query parameters
2033    if !query_params.is_empty() {
2034        req_builder = req_builder.query(&query_params);
2035    }
2036
2037
2038    // Add user agent if configured
2039    if let Some(ref user_agent) = configuration.user_agent {
2040        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2041    }
2042
2043    // Apply all header parameters
2044    for (header_name, header_value) in header_params {
2045        req_builder = req_builder.header(&header_name, &header_value);
2046    }
2047
2048
2049    let req = req_builder.build()?;
2050    let resp = configuration.client.execute(req).await?;
2051
2052    let status = resp.status();
2053    let content_type = resp
2054        .headers()
2055        .get("content-type")
2056        .and_then(|v| v.to_str().ok())
2057        .unwrap_or("application/octet-stream");
2058    let content_type = super::ContentType::from(content_type);
2059
2060    if !status.is_client_error() && !status.is_server_error() {
2061        let content = resp.text().await?;
2062        match content_type {
2063            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2064            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSolStakingSolHistoryRateHistoryV1Resp`"))),
2065            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::GetSolStakingSolHistoryRateHistoryV1Resp`")))),
2066        }
2067    } else {
2068        let content = resp.text().await?;
2069        let entity: Option<GetSolStakingSolHistoryRateHistoryV1Error> = serde_json::from_str(&content).ok();
2070        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2071    }
2072}
2073
2074/// Get SOL redemption history
2075pub async fn get_sol_staking_sol_history_redemption_history_v1(configuration: &configuration::Configuration, params: GetSolStakingSolHistoryRedemptionHistoryV1Params) -> Result<models::GetSolStakingSolHistoryRedemptionHistoryV1Resp, Error<GetSolStakingSolHistoryRedemptionHistoryV1Error>> {
2076
2077    let uri_str = format!("{}/sapi/v1/sol-staking/sol/history/redemptionHistory", configuration.base_path);
2078    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2079
2080    // Create a mutable vector for query parameters
2081    let mut query_params: Vec<(String, String)> = Vec::new();
2082
2083    if let Some(ref param_value) = params.start_time {
2084        query_params.push(("startTime".to_string(), param_value.to_string()));
2085    }
2086    if let Some(ref param_value) = params.end_time {
2087        query_params.push(("endTime".to_string(), param_value.to_string()));
2088    }
2089    if let Some(ref param_value) = params.current {
2090        query_params.push(("current".to_string(), param_value.to_string()));
2091    }
2092    if let Some(ref param_value) = params.size {
2093        query_params.push(("size".to_string(), param_value.to_string()));
2094    }
2095    if let Some(ref param_value) = params.recv_window {
2096        query_params.push(("recvWindow".to_string(), param_value.to_string()));
2097    }
2098    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2099
2100    // Create header parameters collection
2101    let mut header_params = std::collections::HashMap::new();
2102
2103    // Handle Binance Auth first if configured
2104    if let Some(ref binance_auth) = configuration.binance_auth {
2105        // Add API key to headers
2106        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2107        
2108        // Generate request body for signing (if any)
2109        let body_string: Option<Vec<u8>> = None;
2110        
2111        // Sign the request
2112        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2113            Ok(sig) => sig,
2114            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2115        };
2116        
2117        // Add signature to query params
2118        query_params.push(("signature".to_string(), signature));
2119    }
2120
2121    // Apply all query parameters
2122    if !query_params.is_empty() {
2123        req_builder = req_builder.query(&query_params);
2124    }
2125
2126
2127    // Add user agent if configured
2128    if let Some(ref user_agent) = configuration.user_agent {
2129        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2130    }
2131
2132    // Apply all header parameters
2133    for (header_name, header_value) in header_params {
2134        req_builder = req_builder.header(&header_name, &header_value);
2135    }
2136
2137
2138    let req = req_builder.build()?;
2139    let resp = configuration.client.execute(req).await?;
2140
2141    let status = resp.status();
2142    let content_type = resp
2143        .headers()
2144        .get("content-type")
2145        .and_then(|v| v.to_str().ok())
2146        .unwrap_or("application/octet-stream");
2147    let content_type = super::ContentType::from(content_type);
2148
2149    if !status.is_client_error() && !status.is_server_error() {
2150        let content = resp.text().await?;
2151        match content_type {
2152            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2153            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSolStakingSolHistoryRedemptionHistoryV1Resp`"))),
2154            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::GetSolStakingSolHistoryRedemptionHistoryV1Resp`")))),
2155        }
2156    } else {
2157        let content = resp.text().await?;
2158        let entity: Option<GetSolStakingSolHistoryRedemptionHistoryV1Error> = serde_json::from_str(&content).ok();
2159        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2160    }
2161}
2162
2163/// Get SOL staking history
2164pub async fn get_sol_staking_sol_history_staking_history_v1(configuration: &configuration::Configuration, params: GetSolStakingSolHistoryStakingHistoryV1Params) -> Result<models::GetSolStakingSolHistoryStakingHistoryV1Resp, Error<GetSolStakingSolHistoryStakingHistoryV1Error>> {
2165
2166    let uri_str = format!("{}/sapi/v1/sol-staking/sol/history/stakingHistory", configuration.base_path);
2167    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2168
2169    // Create a mutable vector for query parameters
2170    let mut query_params: Vec<(String, String)> = Vec::new();
2171
2172    if let Some(ref param_value) = params.start_time {
2173        query_params.push(("startTime".to_string(), param_value.to_string()));
2174    }
2175    if let Some(ref param_value) = params.end_time {
2176        query_params.push(("endTime".to_string(), param_value.to_string()));
2177    }
2178    if let Some(ref param_value) = params.current {
2179        query_params.push(("current".to_string(), param_value.to_string()));
2180    }
2181    if let Some(ref param_value) = params.size {
2182        query_params.push(("size".to_string(), param_value.to_string()));
2183    }
2184    if let Some(ref param_value) = params.recv_window {
2185        query_params.push(("recvWindow".to_string(), param_value.to_string()));
2186    }
2187    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2188
2189    // Create header parameters collection
2190    let mut header_params = std::collections::HashMap::new();
2191
2192    // Handle Binance Auth first if configured
2193    if let Some(ref binance_auth) = configuration.binance_auth {
2194        // Add API key to headers
2195        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2196        
2197        // Generate request body for signing (if any)
2198        let body_string: Option<Vec<u8>> = None;
2199        
2200        // Sign the request
2201        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2202            Ok(sig) => sig,
2203            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2204        };
2205        
2206        // Add signature to query params
2207        query_params.push(("signature".to_string(), signature));
2208    }
2209
2210    // Apply all query parameters
2211    if !query_params.is_empty() {
2212        req_builder = req_builder.query(&query_params);
2213    }
2214
2215
2216    // Add user agent if configured
2217    if let Some(ref user_agent) = configuration.user_agent {
2218        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2219    }
2220
2221    // Apply all header parameters
2222    for (header_name, header_value) in header_params {
2223        req_builder = req_builder.header(&header_name, &header_value);
2224    }
2225
2226
2227    let req = req_builder.build()?;
2228    let resp = configuration.client.execute(req).await?;
2229
2230    let status = resp.status();
2231    let content_type = resp
2232        .headers()
2233        .get("content-type")
2234        .and_then(|v| v.to_str().ok())
2235        .unwrap_or("application/octet-stream");
2236    let content_type = super::ContentType::from(content_type);
2237
2238    if !status.is_client_error() && !status.is_server_error() {
2239        let content = resp.text().await?;
2240        match content_type {
2241            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2242            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSolStakingSolHistoryStakingHistoryV1Resp`"))),
2243            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::GetSolStakingSolHistoryStakingHistoryV1Resp`")))),
2244        }
2245    } else {
2246        let content = resp.text().await?;
2247        let entity: Option<GetSolStakingSolHistoryStakingHistoryV1Error> = serde_json::from_str(&content).ok();
2248        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2249    }
2250}
2251
2252/// Get Unclaimed rewards
2253pub async fn get_sol_staking_sol_history_unclaimed_rewards_v1(configuration: &configuration::Configuration, params: GetSolStakingSolHistoryUnclaimedRewardsV1Params) -> Result<Vec<models::GetSolStakingSolHistoryUnclaimedRewardsV1RespItem>, Error<GetSolStakingSolHistoryUnclaimedRewardsV1Error>> {
2254
2255    let uri_str = format!("{}/sapi/v1/sol-staking/sol/history/unclaimedRewards", configuration.base_path);
2256    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2257
2258    // Create a mutable vector for query parameters
2259    let mut query_params: Vec<(String, String)> = Vec::new();
2260
2261    if let Some(ref param_value) = params.recv_window {
2262        query_params.push(("recvWindow".to_string(), param_value.to_string()));
2263    }
2264    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2265
2266    // Create header parameters collection
2267    let mut header_params = std::collections::HashMap::new();
2268
2269    // Handle Binance Auth first if configured
2270    if let Some(ref binance_auth) = configuration.binance_auth {
2271        // Add API key to headers
2272        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2273        
2274        // Generate request body for signing (if any)
2275        let body_string: Option<Vec<u8>> = None;
2276        
2277        // Sign the request
2278        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2279            Ok(sig) => sig,
2280            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2281        };
2282        
2283        // Add signature to query params
2284        query_params.push(("signature".to_string(), signature));
2285    }
2286
2287    // Apply all query parameters
2288    if !query_params.is_empty() {
2289        req_builder = req_builder.query(&query_params);
2290    }
2291
2292
2293    // Add user agent if configured
2294    if let Some(ref user_agent) = configuration.user_agent {
2295        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2296    }
2297
2298    // Apply all header parameters
2299    for (header_name, header_value) in header_params {
2300        req_builder = req_builder.header(&header_name, &header_value);
2301    }
2302
2303
2304    let req = req_builder.build()?;
2305    let resp = configuration.client.execute(req).await?;
2306
2307    let status = resp.status();
2308    let content_type = resp
2309        .headers()
2310        .get("content-type")
2311        .and_then(|v| v.to_str().ok())
2312        .unwrap_or("application/octet-stream");
2313    let content_type = super::ContentType::from(content_type);
2314
2315    if !status.is_client_error() && !status.is_server_error() {
2316        let content = resp.text().await?;
2317        match content_type {
2318            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2319            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::GetSolStakingSolHistoryUnclaimedRewardsV1RespItem&gt;`"))),
2320            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::GetSolStakingSolHistoryUnclaimedRewardsV1RespItem&gt;`")))),
2321        }
2322    } else {
2323        let content = resp.text().await?;
2324        let entity: Option<GetSolStakingSolHistoryUnclaimedRewardsV1Error> = serde_json::from_str(&content).ok();
2325        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2326    }
2327}
2328
2329/// Get SOL staking quota
2330pub async fn get_sol_staking_sol_quota_v1(configuration: &configuration::Configuration, params: GetSolStakingSolQuotaV1Params) -> Result<models::GetSolStakingSolQuotaV1Resp, Error<GetSolStakingSolQuotaV1Error>> {
2331
2332    let uri_str = format!("{}/sapi/v1/sol-staking/sol/quota", configuration.base_path);
2333    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2334
2335    // Create a mutable vector for query parameters
2336    let mut query_params: Vec<(String, String)> = Vec::new();
2337
2338    if let Some(ref param_value) = params.recv_window {
2339        query_params.push(("recvWindow".to_string(), param_value.to_string()));
2340    }
2341    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2342
2343    // Create header parameters collection
2344    let mut header_params = std::collections::HashMap::new();
2345
2346    // Handle Binance Auth first if configured
2347    if let Some(ref binance_auth) = configuration.binance_auth {
2348        // Add API key to headers
2349        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2350        
2351        // Generate request body for signing (if any)
2352        let body_string: Option<Vec<u8>> = None;
2353        
2354        // Sign the request
2355        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2356            Ok(sig) => sig,
2357            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2358        };
2359        
2360        // Add signature to query params
2361        query_params.push(("signature".to_string(), signature));
2362    }
2363
2364    // Apply all query parameters
2365    if !query_params.is_empty() {
2366        req_builder = req_builder.query(&query_params);
2367    }
2368
2369
2370    // Add user agent if configured
2371    if let Some(ref user_agent) = configuration.user_agent {
2372        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2373    }
2374
2375    // Apply all header parameters
2376    for (header_name, header_value) in header_params {
2377        req_builder = req_builder.header(&header_name, &header_value);
2378    }
2379
2380
2381    let req = req_builder.build()?;
2382    let resp = configuration.client.execute(req).await?;
2383
2384    let status = resp.status();
2385    let content_type = resp
2386        .headers()
2387        .get("content-type")
2388        .and_then(|v| v.to_str().ok())
2389        .unwrap_or("application/octet-stream");
2390    let content_type = super::ContentType::from(content_type);
2391
2392    if !status.is_client_error() && !status.is_server_error() {
2393        let content = resp.text().await?;
2394        match content_type {
2395            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2396            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSolStakingSolQuotaV1Resp`"))),
2397            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::GetSolStakingSolQuotaV1Resp`")))),
2398        }
2399    } else {
2400        let content = resp.text().await?;
2401        let entity: Option<GetSolStakingSolQuotaV1Error> = serde_json::from_str(&content).ok();
2402        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2403    }
2404}
2405