1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::spot::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[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#[derive(Clone, Debug, Default)]
28pub struct CreateEthStakingEthStakeV2Params {
29 pub amount: String,
30 pub timestamp: i64,
31 pub recv_window: Option<i64>
32}
33
34#[derive(Clone, Debug, Default)]
36pub struct CreateEthStakingWbethWrapV1Params {
37 pub amount: String,
38 pub timestamp: i64,
39 pub recv_window: Option<i64>
40}
41
42#[derive(Clone, Debug, Default)]
44pub struct CreateSolStakingSolClaimV1Params {
45 pub timestamp: i64,
46 pub recv_window: Option<i64>
47}
48
49#[derive(Clone, Debug, Default)]
51pub struct CreateSolStakingSolRedeemV1Params {
52 pub amount: String,
53 pub timestamp: i64,
54 pub recv_window: Option<i64>
55}
56
57#[derive(Clone, Debug, Default)]
59pub struct CreateSolStakingSolStakeV1Params {
60 pub amount: String,
61 pub timestamp: i64,
62 pub recv_window: Option<i64>
63}
64
65#[derive(Clone, Debug, Default)]
67pub struct GetEthStakingAccountV2Params {
68 pub timestamp: i64,
69 pub recv_window: Option<i64>
70}
71
72#[derive(Clone, Debug, Default)]
74pub struct GetEthStakingEthHistoryRateHistoryV1Params {
75 pub timestamp: i64,
76 pub start_time: Option<i64>,
77 pub end_time: Option<i64>,
78 pub current: Option<i64>,
80 pub size: Option<i64>,
82 pub recv_window: Option<i64>
83}
84
85#[derive(Clone, Debug, Default)]
87pub struct GetEthStakingEthHistoryRedemptionHistoryV1Params {
88 pub timestamp: i64,
89 pub start_time: Option<i64>,
90 pub end_time: Option<i64>,
91 pub current: Option<i64>,
93 pub size: Option<i64>,
95 pub recv_window: Option<i64>
96}
97
98#[derive(Clone, Debug, Default)]
100pub struct GetEthStakingEthHistoryRewardsHistoryV1Params {
101 pub timestamp: i64,
102 pub start_time: Option<i64>,
103 pub end_time: Option<i64>,
104 pub current: Option<i64>,
106 pub size: Option<i64>,
108 pub recv_window: Option<i64>
109}
110
111#[derive(Clone, Debug, Default)]
113pub struct GetEthStakingEthHistoryStakingHistoryV1Params {
114 pub timestamp: i64,
115 pub start_time: Option<i64>,
116 pub end_time: Option<i64>,
117 pub current: Option<i64>,
119 pub size: Option<i64>,
121 pub recv_window: Option<i64>
122}
123
124#[derive(Clone, Debug, Default)]
126pub struct GetEthStakingEthHistoryWbethRewardsHistoryV1Params {
127 pub timestamp: i64,
128 pub start_time: Option<i64>,
129 pub end_time: Option<i64>,
130 pub current: Option<i64>,
132 pub size: Option<i64>,
134 pub recv_window: Option<i64>
135}
136
137#[derive(Clone, Debug, Default)]
139pub struct GetEthStakingEthQuotaV1Params {
140 pub timestamp: i64,
141 pub recv_window: Option<i64>
142}
143
144#[derive(Clone, Debug, Default)]
146pub struct GetEthStakingWbethHistoryUnwrapHistoryV1Params {
147 pub timestamp: i64,
148 pub start_time: Option<i64>,
149 pub end_time: Option<i64>,
150 pub current: Option<i64>,
152 pub size: Option<i64>,
154 pub recv_window: Option<i64>
155}
156
157#[derive(Clone, Debug, Default)]
159pub struct GetEthStakingWbethHistoryWrapHistoryV1Params {
160 pub timestamp: i64,
161 pub start_time: Option<i64>,
162 pub end_time: Option<i64>,
163 pub current: Option<i64>,
165 pub size: Option<i64>,
167 pub recv_window: Option<i64>
168}
169
170#[derive(Clone, Debug, Default)]
172pub struct GetSolStakingAccountV1Params {
173 pub timestamp: i64,
174 pub recv_window: Option<i64>
176}
177
178#[derive(Clone, Debug, Default)]
180pub struct GetSolStakingSolHistoryBnsolRewardsHistoryV1Params {
181 pub timestamp: i64,
182 pub start_time: Option<i64>,
183 pub end_time: Option<i64>,
184 pub current: Option<i64>,
186 pub size: Option<i64>,
188 pub recv_window: Option<i64>
189}
190
191#[derive(Clone, Debug, Default)]
193pub struct GetSolStakingSolHistoryBoostRewardsHistoryV1Params {
194 pub r#type: String,
196 pub timestamp: i64,
197 pub start_time: Option<i64>,
198 pub end_time: Option<i64>,
199 pub current: Option<i64>,
201 pub size: Option<i64>,
203 pub recv_window: Option<i64>
204}
205
206#[derive(Clone, Debug, Default)]
208pub struct GetSolStakingSolHistoryRateHistoryV1Params {
209 pub timestamp: i64,
210 pub start_time: Option<i64>,
211 pub end_time: Option<i64>,
212 pub current: Option<i64>,
214 pub size: Option<i64>,
216 pub recv_window: Option<i64>
218}
219
220#[derive(Clone, Debug, Default)]
222pub struct GetSolStakingSolHistoryRedemptionHistoryV1Params {
223 pub timestamp: i64,
224 pub start_time: Option<i64>,
225 pub end_time: Option<i64>,
226 pub current: Option<i64>,
228 pub size: Option<i64>,
230 pub recv_window: Option<i64>
231}
232
233#[derive(Clone, Debug, Default)]
235pub struct GetSolStakingSolHistoryStakingHistoryV1Params {
236 pub timestamp: i64,
237 pub start_time: Option<i64>,
238 pub end_time: Option<i64>,
239 pub current: Option<i64>,
241 pub size: Option<i64>,
243 pub recv_window: Option<i64>
244}
245
246#[derive(Clone, Debug, Default)]
248pub struct GetSolStakingSolHistoryUnclaimedRewardsV1Params {
249 pub timestamp: i64,
250 pub recv_window: Option<i64>
251}
252
253#[derive(Clone, Debug, Default)]
255pub struct GetSolStakingSolQuotaV1Params {
256 pub timestamp: i64,
257 pub recv_window: Option<i64>
259}
260
261
262#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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
470pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
478
479
480 let mut header_params = std::collections::HashMap::new();
482
483 if let Some(ref binance_auth) = configuration.binance_auth {
485 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
487
488 let body_string: Option<Vec<u8>> = None;
490
491 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 query_params.push(("signature".to_string(), signature));
499 }
500
501 if !query_params.is_empty() {
503 req_builder = req_builder.query(&query_params);
504 }
505
506
507 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 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
553pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
561
562
563 let mut header_params = std::collections::HashMap::new();
565
566 if let Some(ref binance_auth) = configuration.binance_auth {
568 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
570
571 let body_string: Option<Vec<u8>> = None;
573
574 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 query_params.push(("signature".to_string(), signature));
582 }
583
584 if !query_params.is_empty() {
586 req_builder = req_builder.query(&query_params);
587 }
588
589
590 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 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
633pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
641
642
643 let mut header_params = std::collections::HashMap::new();
645
646 if let Some(ref binance_auth) = configuration.binance_auth {
648 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
650
651 let body_string: Option<Vec<u8>> = None;
653
654 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 query_params.push(("signature".to_string(), signature));
662 }
663
664 if !query_params.is_empty() {
666 req_builder = req_builder.query(&query_params);
667 }
668
669
670 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 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
713pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
721
722
723 let mut header_params = std::collections::HashMap::new();
725
726 if let Some(ref binance_auth) = configuration.binance_auth {
728 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
730
731 let body_string: Option<Vec<u8>> = None;
733
734 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 query_params.push(("signature".to_string(), signature));
742 }
743
744 if !query_params.is_empty() {
746 req_builder = req_builder.query(&query_params);
747 }
748
749
750 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 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
792pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
800
801
802 let mut header_params = std::collections::HashMap::new();
804
805 if let Some(ref binance_auth) = configuration.binance_auth {
807 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
809
810 let body_string: Option<Vec<u8>> = None;
812
813 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 query_params.push(("signature".to_string(), signature));
821 }
822
823 if !query_params.is_empty() {
825 req_builder = req_builder.query(&query_params);
826 }
827
828
829 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 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
872pub 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 let mut query_params: Vec<(String, String)> = Vec::new();
880
881
882 let mut header_params = std::collections::HashMap::new();
884
885 if let Some(ref binance_auth) = configuration.binance_auth {
887 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
889
890 let body_string: Option<Vec<u8>> = None;
892
893 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 query_params.push(("signature".to_string(), signature));
901 }
902
903 if !query_params.is_empty() {
905 req_builder = req_builder.query(&query_params);
906 }
907
908
909 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 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
952pub 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 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 let mut header_params = std::collections::HashMap::new();
968
969 if let Some(ref binance_auth) = configuration.binance_auth {
971 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
973
974 let body_string: Option<Vec<u8>> = None;
976
977 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 query_params.push(("signature".to_string(), signature));
985 }
986
987 if !query_params.is_empty() {
989 req_builder = req_builder.query(&query_params);
990 }
991
992
993 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 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
1029pub 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 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 let mut header_params = std::collections::HashMap::new();
1057
1058 if let Some(ref binance_auth) = configuration.binance_auth {
1060 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1062
1063 let body_string: Option<Vec<u8>> = None;
1065
1066 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 query_params.push(("signature".to_string(), signature));
1074 }
1075
1076 if !query_params.is_empty() {
1078 req_builder = req_builder.query(&query_params);
1079 }
1080
1081
1082 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 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
1118pub 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 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 let mut header_params = std::collections::HashMap::new();
1146
1147 if let Some(ref binance_auth) = configuration.binance_auth {
1149 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1151
1152 let body_string: Option<Vec<u8>> = None;
1154
1155 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 query_params.push(("signature".to_string(), signature));
1163 }
1164
1165 if !query_params.is_empty() {
1167 req_builder = req_builder.query(&query_params);
1168 }
1169
1170
1171 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 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
1207pub 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 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 let mut header_params = std::collections::HashMap::new();
1235
1236 if let Some(ref binance_auth) = configuration.binance_auth {
1238 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1240
1241 let body_string: Option<Vec<u8>> = None;
1243
1244 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 query_params.push(("signature".to_string(), signature));
1252 }
1253
1254 if !query_params.is_empty() {
1256 req_builder = req_builder.query(&query_params);
1257 }
1258
1259
1260 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 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
1296pub 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 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 let mut header_params = std::collections::HashMap::new();
1324
1325 if let Some(ref binance_auth) = configuration.binance_auth {
1327 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1329
1330 let body_string: Option<Vec<u8>> = None;
1332
1333 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 query_params.push(("signature".to_string(), signature));
1341 }
1342
1343 if !query_params.is_empty() {
1345 req_builder = req_builder.query(&query_params);
1346 }
1347
1348
1349 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 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
1385pub 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 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 let mut header_params = std::collections::HashMap::new();
1413
1414 if let Some(ref binance_auth) = configuration.binance_auth {
1416 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1418
1419 let body_string: Option<Vec<u8>> = None;
1421
1422 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 query_params.push(("signature".to_string(), signature));
1430 }
1431
1432 if !query_params.is_empty() {
1434 req_builder = req_builder.query(&query_params);
1435 }
1436
1437
1438 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 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
1474pub 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 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 let mut header_params = std::collections::HashMap::new();
1490
1491 if let Some(ref binance_auth) = configuration.binance_auth {
1493 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1495
1496 let body_string: Option<Vec<u8>> = None;
1498
1499 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 query_params.push(("signature".to_string(), signature));
1507 }
1508
1509 if !query_params.is_empty() {
1511 req_builder = req_builder.query(&query_params);
1512 }
1513
1514
1515 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 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
1551pub 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 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 let mut header_params = std::collections::HashMap::new();
1579
1580 if let Some(ref binance_auth) = configuration.binance_auth {
1582 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1584
1585 let body_string: Option<Vec<u8>> = None;
1587
1588 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 query_params.push(("signature".to_string(), signature));
1596 }
1597
1598 if !query_params.is_empty() {
1600 req_builder = req_builder.query(&query_params);
1601 }
1602
1603
1604 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 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
1640pub 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 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 let mut header_params = std::collections::HashMap::new();
1668
1669 if let Some(ref binance_auth) = configuration.binance_auth {
1671 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1673
1674 let body_string: Option<Vec<u8>> = None;
1676
1677 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 query_params.push(("signature".to_string(), signature));
1685 }
1686
1687 if !query_params.is_empty() {
1689 req_builder = req_builder.query(&query_params);
1690 }
1691
1692
1693 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 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
1729pub 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 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 let mut header_params = std::collections::HashMap::new();
1745
1746 if let Some(ref binance_auth) = configuration.binance_auth {
1748 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1750
1751 let body_string: Option<Vec<u8>> = None;
1753
1754 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 query_params.push(("signature".to_string(), signature));
1762 }
1763
1764 if !query_params.is_empty() {
1766 req_builder = req_builder.query(&query_params);
1767 }
1768
1769
1770 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 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
1806pub 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 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 let mut header_params = std::collections::HashMap::new();
1834
1835 if let Some(ref binance_auth) = configuration.binance_auth {
1837 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1839
1840 let body_string: Option<Vec<u8>> = None;
1842
1843 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 query_params.push(("signature".to_string(), signature));
1851 }
1852
1853 if !query_params.is_empty() {
1855 req_builder = req_builder.query(&query_params);
1856 }
1857
1858
1859 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 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
1895pub 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 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 let mut header_params = std::collections::HashMap::new();
1924
1925 if let Some(ref binance_auth) = configuration.binance_auth {
1927 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1929
1930 let body_string: Option<Vec<u8>> = None;
1932
1933 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 query_params.push(("signature".to_string(), signature));
1941 }
1942
1943 if !query_params.is_empty() {
1945 req_builder = req_builder.query(&query_params);
1946 }
1947
1948
1949 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 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
1985pub 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 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 let mut header_params = std::collections::HashMap::new();
2013
2014 if let Some(ref binance_auth) = configuration.binance_auth {
2016 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2018
2019 let body_string: Option<Vec<u8>> = None;
2021
2022 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 query_params.push(("signature".to_string(), signature));
2030 }
2031
2032 if !query_params.is_empty() {
2034 req_builder = req_builder.query(&query_params);
2035 }
2036
2037
2038 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 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
2074pub 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 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 let mut header_params = std::collections::HashMap::new();
2102
2103 if let Some(ref binance_auth) = configuration.binance_auth {
2105 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2107
2108 let body_string: Option<Vec<u8>> = None;
2110
2111 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 query_params.push(("signature".to_string(), signature));
2119 }
2120
2121 if !query_params.is_empty() {
2123 req_builder = req_builder.query(&query_params);
2124 }
2125
2126
2127 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 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
2163pub 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 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 let mut header_params = std::collections::HashMap::new();
2191
2192 if let Some(ref binance_auth) = configuration.binance_auth {
2194 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2196
2197 let body_string: Option<Vec<u8>> = None;
2199
2200 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 query_params.push(("signature".to_string(), signature));
2208 }
2209
2210 if !query_params.is_empty() {
2212 req_builder = req_builder.query(&query_params);
2213 }
2214
2215
2216 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 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
2252pub 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 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 let mut header_params = std::collections::HashMap::new();
2268
2269 if let Some(ref binance_auth) = configuration.binance_auth {
2271 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2273
2274 let body_string: Option<Vec<u8>> = None;
2276
2277 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 query_params.push(("signature".to_string(), signature));
2285 }
2286
2287 if !query_params.is_empty() {
2289 req_builder = req_builder.query(&query_params);
2290 }
2291
2292
2293 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 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<models::GetSolStakingSolHistoryUnclaimedRewardsV1RespItem>`"))),
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<models::GetSolStakingSolHistoryUnclaimedRewardsV1RespItem>`")))),
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
2329pub 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 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 let mut header_params = std::collections::HashMap::new();
2345
2346 if let Some(ref binance_auth) = configuration.binance_auth {
2348 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2350
2351 let body_string: Option<Vec<u8>> = None;
2353
2354 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 query_params.push(("signature".to_string(), signature));
2362 }
2363
2364 if !query_params.is_empty() {
2366 req_builder = req_builder.query(&query_params);
2367 }
2368
2369
2370 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 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