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 CreateSimpleEarnFlexibleRedeemV1Params {
20 pub product_id: String,
21 pub timestamp: i64,
22 pub amount: Option<String>,
23 pub dest_account: Option<String>,
24 pub recv_window: Option<i64>,
25 pub redeem_all: Option<bool>
26}
27
28#[derive(Clone, Debug, Default)]
30pub struct CreateSimpleEarnFlexibleSetAutoSubscribeV1Params {
31 pub auto_subscribe: bool,
32 pub product_id: String,
33 pub timestamp: i64,
34 pub recv_window: Option<i64>
35}
36
37#[derive(Clone, Debug, Default)]
39pub struct CreateSimpleEarnFlexibleSubscribeV1Params {
40 pub amount: String,
41 pub product_id: String,
42 pub timestamp: i64,
43 pub auto_subscribe: Option<bool>,
44 pub recv_window: Option<i64>,
45 pub source_account: Option<String>
46}
47
48#[derive(Clone, Debug, Default)]
50pub struct CreateSimpleEarnLockedRedeemV1Params {
51 pub position_id: i32,
52 pub timestamp: i64,
53 pub recv_window: Option<i64>
54}
55
56#[derive(Clone, Debug, Default)]
58pub struct CreateSimpleEarnLockedSetAutoSubscribeV1Params {
59 pub auto_subscribe: bool,
60 pub position_id: i32,
61 pub timestamp: i64,
62 pub recv_window: Option<i64>
63}
64
65#[derive(Clone, Debug, Default)]
67pub struct CreateSimpleEarnLockedSetRedeemOptionV1Params {
68 pub position_id: String,
69 pub redeem_to: String,
70 pub timestamp: i64,
71 pub recv_window: Option<i64>
72}
73
74#[derive(Clone, Debug, Default)]
76pub struct CreateSimpleEarnLockedSubscribeV1Params {
77 pub amount: String,
78 pub project_id: String,
79 pub timestamp: i64,
80 pub auto_subscribe: Option<bool>,
81 pub recv_window: Option<i64>,
82 pub redeem_to: Option<String>,
83 pub source_account: Option<String>
84}
85
86#[derive(Clone, Debug, Default)]
88pub struct GetSimpleEarnAccountV1Params {
89 pub timestamp: i64,
90 pub recv_window: Option<i64>
92}
93
94#[derive(Clone, Debug, Default)]
96pub struct GetSimpleEarnFlexibleHistoryCollateralRecordV1Params {
97 pub timestamp: i64,
98 pub product_id: Option<String>,
99 pub start_time: Option<i64>,
100 pub end_time: Option<i64>,
101 pub current: Option<i64>,
103 pub size: Option<i64>,
105 pub recv_window: Option<i64>
107}
108
109#[derive(Clone, Debug, Default)]
111pub struct GetSimpleEarnFlexibleHistoryRateHistoryV1Params {
112 pub product_id: String,
113 pub timestamp: i64,
114 pub apr_period: Option<String>,
116 pub start_time: Option<i64>,
117 pub end_time: Option<i64>,
118 pub current: Option<i64>,
120 pub size: Option<i64>,
122 pub recv_window: Option<i64>
124}
125
126#[derive(Clone, Debug, Default)]
128pub struct GetSimpleEarnFlexibleHistoryRedemptionRecordV1Params {
129 pub product_id: Option<String>,
130 pub redeem_id: Option<String>,
131 pub asset: Option<String>,
132 pub start_time: Option<i64>,
133 pub end_time: Option<i64>,
134 pub current: Option<i64>,
136 pub size: Option<i64>
138}
139
140#[derive(Clone, Debug, Default)]
142pub struct GetSimpleEarnFlexibleHistoryRewardsRecordV1Params {
143 pub r#type: String,
145 pub timestamp: i64,
146 pub product_id: Option<String>,
147 pub asset: Option<String>,
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 GetSimpleEarnFlexibleHistorySubscriptionRecordV1Params {
160 pub timestamp: i64,
161 pub product_id: Option<String>,
162 pub purchase_id: Option<String>,
163 pub asset: Option<String>,
164 pub start_time: Option<i64>,
165 pub end_time: Option<i64>,
166 pub current: Option<i64>,
168 pub size: Option<i64>,
170 pub recv_window: Option<i64>
171}
172
173#[derive(Clone, Debug, Default)]
175pub struct GetSimpleEarnFlexibleListV1Params {
176 pub timestamp: i64,
177 pub asset: Option<String>,
178 pub current: Option<i64>,
180 pub size: Option<i64>,
182 pub recv_window: Option<i64>
183}
184
185#[derive(Clone, Debug, Default)]
187pub struct GetSimpleEarnFlexiblePersonalLeftQuotaV1Params {
188 pub product_id: String,
189 pub timestamp: i64,
190 pub recv_window: Option<i64>
191}
192
193#[derive(Clone, Debug, Default)]
195pub struct GetSimpleEarnFlexiblePositionV1Params {
196 pub timestamp: i64,
197 pub asset: Option<String>,
198 pub product_id: Option<String>,
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 GetSimpleEarnFlexibleSubscriptionPreviewV1Params {
209 pub product_id: String,
210 pub amount: String,
211 pub timestamp: i64,
212 pub recv_window: Option<i64>
213}
214
215#[derive(Clone, Debug, Default)]
217pub struct GetSimpleEarnLockedHistoryRedemptionRecordV1Params {
218 pub timestamp: i64,
219 pub position_id: Option<i32>,
220 pub redeem_id: Option<String>,
221 pub asset: Option<String>,
222 pub start_time: Option<i64>,
223 pub end_time: Option<i64>,
224 pub current: Option<i64>,
226 pub size: Option<i64>,
228 pub recv_window: Option<i64>
229}
230
231#[derive(Clone, Debug, Default)]
233pub struct GetSimpleEarnLockedHistoryRewardsRecordV1Params {
234 pub timestamp: i64,
235 pub position_id: Option<i32>,
236 pub asset: Option<String>,
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 GetSimpleEarnLockedHistorySubscriptionRecordV1Params {
249 pub timestamp: i64,
250 pub purchase_id: Option<String>,
251 pub asset: Option<String>,
252 pub start_time: Option<i64>,
253 pub end_time: Option<i64>,
254 pub current: Option<i64>,
256 pub size: Option<i64>,
258 pub recv_window: Option<i64>
259}
260
261#[derive(Clone, Debug, Default)]
263pub struct GetSimpleEarnLockedListV1Params {
264 pub timestamp: i64,
265 pub asset: Option<String>,
266 pub current: Option<i64>,
268 pub size: Option<i64>,
270 pub recv_window: Option<i64>
271}
272
273#[derive(Clone, Debug, Default)]
275pub struct GetSimpleEarnLockedPersonalLeftQuotaV1Params {
276 pub project_id: String,
277 pub timestamp: i64,
278 pub recv_window: Option<i64>
279}
280
281#[derive(Clone, Debug, Default)]
283pub struct GetSimpleEarnLockedPositionV1Params {
284 pub timestamp: i64,
285 pub asset: Option<String>,
286 pub position_id: Option<i32>,
287 pub project_id: Option<String>,
288 pub current: Option<i64>,
290 pub size: Option<i64>,
292 pub recv_window: Option<i64>
293}
294
295#[derive(Clone, Debug, Default)]
297pub struct GetSimpleEarnLockedSubscriptionPreviewV1Params {
298 pub project_id: String,
299 pub amount: String,
300 pub timestamp: i64,
301 pub auto_subscribe: Option<bool>,
303 pub recv_window: Option<i64>
304}
305
306
307#[derive(Debug, Clone, Serialize, Deserialize)]
309#[serde(untagged)]
310pub enum CreateSimpleEarnFlexibleRedeemV1Error {
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 CreateSimpleEarnFlexibleSetAutoSubscribeV1Error {
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 CreateSimpleEarnFlexibleSubscribeV1Error {
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 CreateSimpleEarnLockedRedeemV1Error {
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 CreateSimpleEarnLockedSetAutoSubscribeV1Error {
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 CreateSimpleEarnLockedSetRedeemOptionV1Error {
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 CreateSimpleEarnLockedSubscribeV1Error {
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 GetSimpleEarnAccountV1Error {
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 GetSimpleEarnFlexibleHistoryCollateralRecordV1Error {
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 GetSimpleEarnFlexibleHistoryRateHistoryV1Error {
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 GetSimpleEarnFlexibleHistoryRedemptionRecordV1Error {
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 GetSimpleEarnFlexibleHistoryRewardsRecordV1Error {
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 GetSimpleEarnFlexibleHistorySubscriptionRecordV1Error {
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 GetSimpleEarnFlexibleListV1Error {
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 GetSimpleEarnFlexiblePersonalLeftQuotaV1Error {
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 GetSimpleEarnFlexiblePositionV1Error {
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 GetSimpleEarnFlexibleSubscriptionPreviewV1Error {
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 GetSimpleEarnLockedHistoryRedemptionRecordV1Error {
464 Status4XX(models::ApiError),
465 Status5XX(models::ApiError),
466 UnknownValue(serde_json::Value),
467}
468
469#[derive(Debug, Clone, Serialize, Deserialize)]
471#[serde(untagged)]
472pub enum GetSimpleEarnLockedHistoryRewardsRecordV1Error {
473 Status4XX(models::ApiError),
474 Status5XX(models::ApiError),
475 UnknownValue(serde_json::Value),
476}
477
478#[derive(Debug, Clone, Serialize, Deserialize)]
480#[serde(untagged)]
481pub enum GetSimpleEarnLockedHistorySubscriptionRecordV1Error {
482 Status4XX(models::ApiError),
483 Status5XX(models::ApiError),
484 UnknownValue(serde_json::Value),
485}
486
487#[derive(Debug, Clone, Serialize, Deserialize)]
489#[serde(untagged)]
490pub enum GetSimpleEarnLockedListV1Error {
491 Status4XX(models::ApiError),
492 Status5XX(models::ApiError),
493 UnknownValue(serde_json::Value),
494}
495
496#[derive(Debug, Clone, Serialize, Deserialize)]
498#[serde(untagged)]
499pub enum GetSimpleEarnLockedPersonalLeftQuotaV1Error {
500 Status4XX(models::ApiError),
501 Status5XX(models::ApiError),
502 UnknownValue(serde_json::Value),
503}
504
505#[derive(Debug, Clone, Serialize, Deserialize)]
507#[serde(untagged)]
508pub enum GetSimpleEarnLockedPositionV1Error {
509 Status4XX(models::ApiError),
510 Status5XX(models::ApiError),
511 UnknownValue(serde_json::Value),
512}
513
514#[derive(Debug, Clone, Serialize, Deserialize)]
516#[serde(untagged)]
517pub enum GetSimpleEarnLockedSubscriptionPreviewV1Error {
518 Status4XX(models::ApiError),
519 Status5XX(models::ApiError),
520 UnknownValue(serde_json::Value),
521}
522
523
524pub async fn create_simple_earn_flexible_redeem_v1(configuration: &configuration::Configuration, params: CreateSimpleEarnFlexibleRedeemV1Params) -> Result<models::CreateSimpleEarnFlexibleRedeemV1Resp, Error<CreateSimpleEarnFlexibleRedeemV1Error>> {
526
527 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/redeem", configuration.base_path);
528 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
529
530 let mut query_params: Vec<(String, String)> = Vec::new();
532
533
534 let mut header_params = std::collections::HashMap::new();
536
537 if let Some(ref binance_auth) = configuration.binance_auth {
539 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
541
542 let body_string: Option<Vec<u8>> = None;
544
545 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
547 Ok(sig) => sig,
548 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
549 };
550
551 query_params.push(("signature".to_string(), signature));
553 }
554
555 if !query_params.is_empty() {
557 req_builder = req_builder.query(&query_params);
558 }
559
560
561 if let Some(ref user_agent) = configuration.user_agent {
563 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
564 }
565
566 for (header_name, header_value) in header_params {
568 req_builder = req_builder.header(&header_name, &header_value);
569 }
570
571 let mut multipart_form_params = std::collections::HashMap::new();
572 if let Some(param_value) = params.amount {
573 multipart_form_params.insert("amount", param_value.to_string());
574 }
575 if let Some(param_value) = params.dest_account {
576 multipart_form_params.insert("destAccount", param_value.to_string());
577 }
578 multipart_form_params.insert("productId", params.product_id.to_string());
579 if let Some(param_value) = params.recv_window {
580 multipart_form_params.insert("recvWindow", param_value.to_string());
581 }
582 if let Some(param_value) = params.redeem_all {
583 multipart_form_params.insert("redeemAll", param_value.to_string());
584 }
585 multipart_form_params.insert("timestamp", params.timestamp.to_string());
586 req_builder = req_builder.form(&multipart_form_params);
587
588 let req = req_builder.build()?;
589 let resp = configuration.client.execute(req).await?;
590
591 let status = resp.status();
592 let content_type = resp
593 .headers()
594 .get("content-type")
595 .and_then(|v| v.to_str().ok())
596 .unwrap_or("application/octet-stream");
597 let content_type = super::ContentType::from(content_type);
598
599 if !status.is_client_error() && !status.is_server_error() {
600 let content = resp.text().await?;
601 match content_type {
602 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
603 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSimpleEarnFlexibleRedeemV1Resp`"))),
604 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::CreateSimpleEarnFlexibleRedeemV1Resp`")))),
605 }
606 } else {
607 let content = resp.text().await?;
608 let entity: Option<CreateSimpleEarnFlexibleRedeemV1Error> = serde_json::from_str(&content).ok();
609 Err(Error::ResponseError(ResponseContent { status, content, entity }))
610 }
611}
612
613pub async fn create_simple_earn_flexible_set_auto_subscribe_v1(configuration: &configuration::Configuration, params: CreateSimpleEarnFlexibleSetAutoSubscribeV1Params) -> Result<models::CreateSimpleEarnFlexibleSetAutoSubscribeV1Resp, Error<CreateSimpleEarnFlexibleSetAutoSubscribeV1Error>> {
615
616 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/setAutoSubscribe", configuration.base_path);
617 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
618
619 let mut query_params: Vec<(String, String)> = Vec::new();
621
622
623 let mut header_params = std::collections::HashMap::new();
625
626 if let Some(ref binance_auth) = configuration.binance_auth {
628 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
630
631 let body_string: Option<Vec<u8>> = None;
633
634 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
636 Ok(sig) => sig,
637 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
638 };
639
640 query_params.push(("signature".to_string(), signature));
642 }
643
644 if !query_params.is_empty() {
646 req_builder = req_builder.query(&query_params);
647 }
648
649
650 if let Some(ref user_agent) = configuration.user_agent {
652 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
653 }
654
655 for (header_name, header_value) in header_params {
657 req_builder = req_builder.header(&header_name, &header_value);
658 }
659
660 let mut multipart_form_params = std::collections::HashMap::new();
661 multipart_form_params.insert("autoSubscribe", params.auto_subscribe.to_string());
662 multipart_form_params.insert("productId", params.product_id.to_string());
663 if let Some(param_value) = params.recv_window {
664 multipart_form_params.insert("recvWindow", param_value.to_string());
665 }
666 multipart_form_params.insert("timestamp", params.timestamp.to_string());
667 req_builder = req_builder.form(&multipart_form_params);
668
669 let req = req_builder.build()?;
670 let resp = configuration.client.execute(req).await?;
671
672 let status = resp.status();
673 let content_type = resp
674 .headers()
675 .get("content-type")
676 .and_then(|v| v.to_str().ok())
677 .unwrap_or("application/octet-stream");
678 let content_type = super::ContentType::from(content_type);
679
680 if !status.is_client_error() && !status.is_server_error() {
681 let content = resp.text().await?;
682 match content_type {
683 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
684 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSimpleEarnFlexibleSetAutoSubscribeV1Resp`"))),
685 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::CreateSimpleEarnFlexibleSetAutoSubscribeV1Resp`")))),
686 }
687 } else {
688 let content = resp.text().await?;
689 let entity: Option<CreateSimpleEarnFlexibleSetAutoSubscribeV1Error> = serde_json::from_str(&content).ok();
690 Err(Error::ResponseError(ResponseContent { status, content, entity }))
691 }
692}
693
694pub async fn create_simple_earn_flexible_subscribe_v1(configuration: &configuration::Configuration, params: CreateSimpleEarnFlexibleSubscribeV1Params) -> Result<models::CreateSimpleEarnFlexibleSubscribeV1Resp, Error<CreateSimpleEarnFlexibleSubscribeV1Error>> {
696
697 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/subscribe", configuration.base_path);
698 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
699
700 let mut query_params: Vec<(String, String)> = Vec::new();
702
703
704 let mut header_params = std::collections::HashMap::new();
706
707 if let Some(ref binance_auth) = configuration.binance_auth {
709 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
711
712 let body_string: Option<Vec<u8>> = None;
714
715 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
717 Ok(sig) => sig,
718 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
719 };
720
721 query_params.push(("signature".to_string(), signature));
723 }
724
725 if !query_params.is_empty() {
727 req_builder = req_builder.query(&query_params);
728 }
729
730
731 if let Some(ref user_agent) = configuration.user_agent {
733 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
734 }
735
736 for (header_name, header_value) in header_params {
738 req_builder = req_builder.header(&header_name, &header_value);
739 }
740
741 let mut multipart_form_params = std::collections::HashMap::new();
742 multipart_form_params.insert("amount", params.amount.to_string());
743 if let Some(param_value) = params.auto_subscribe {
744 multipart_form_params.insert("autoSubscribe", param_value.to_string());
745 }
746 multipart_form_params.insert("productId", params.product_id.to_string());
747 if let Some(param_value) = params.recv_window {
748 multipart_form_params.insert("recvWindow", param_value.to_string());
749 }
750 if let Some(param_value) = params.source_account {
751 multipart_form_params.insert("sourceAccount", param_value.to_string());
752 }
753 multipart_form_params.insert("timestamp", params.timestamp.to_string());
754 req_builder = req_builder.form(&multipart_form_params);
755
756 let req = req_builder.build()?;
757 let resp = configuration.client.execute(req).await?;
758
759 let status = resp.status();
760 let content_type = resp
761 .headers()
762 .get("content-type")
763 .and_then(|v| v.to_str().ok())
764 .unwrap_or("application/octet-stream");
765 let content_type = super::ContentType::from(content_type);
766
767 if !status.is_client_error() && !status.is_server_error() {
768 let content = resp.text().await?;
769 match content_type {
770 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
771 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSimpleEarnFlexibleSubscribeV1Resp`"))),
772 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::CreateSimpleEarnFlexibleSubscribeV1Resp`")))),
773 }
774 } else {
775 let content = resp.text().await?;
776 let entity: Option<CreateSimpleEarnFlexibleSubscribeV1Error> = serde_json::from_str(&content).ok();
777 Err(Error::ResponseError(ResponseContent { status, content, entity }))
778 }
779}
780
781pub async fn create_simple_earn_locked_redeem_v1(configuration: &configuration::Configuration, params: CreateSimpleEarnLockedRedeemV1Params) -> Result<models::CreateSimpleEarnLockedRedeemV1Resp, Error<CreateSimpleEarnLockedRedeemV1Error>> {
783
784 let uri_str = format!("{}/sapi/v1/simple-earn/locked/redeem", configuration.base_path);
785 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
786
787 let mut query_params: Vec<(String, String)> = Vec::new();
789
790
791 let mut header_params = std::collections::HashMap::new();
793
794 if let Some(ref binance_auth) = configuration.binance_auth {
796 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
798
799 let body_string: Option<Vec<u8>> = None;
801
802 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
804 Ok(sig) => sig,
805 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
806 };
807
808 query_params.push(("signature".to_string(), signature));
810 }
811
812 if !query_params.is_empty() {
814 req_builder = req_builder.query(&query_params);
815 }
816
817
818 if let Some(ref user_agent) = configuration.user_agent {
820 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
821 }
822
823 for (header_name, header_value) in header_params {
825 req_builder = req_builder.header(&header_name, &header_value);
826 }
827
828 let mut multipart_form_params = std::collections::HashMap::new();
829 multipart_form_params.insert("positionId", params.position_id.to_string());
830 if let Some(param_value) = params.recv_window {
831 multipart_form_params.insert("recvWindow", param_value.to_string());
832 }
833 multipart_form_params.insert("timestamp", params.timestamp.to_string());
834 req_builder = req_builder.form(&multipart_form_params);
835
836 let req = req_builder.build()?;
837 let resp = configuration.client.execute(req).await?;
838
839 let status = resp.status();
840 let content_type = resp
841 .headers()
842 .get("content-type")
843 .and_then(|v| v.to_str().ok())
844 .unwrap_or("application/octet-stream");
845 let content_type = super::ContentType::from(content_type);
846
847 if !status.is_client_error() && !status.is_server_error() {
848 let content = resp.text().await?;
849 match content_type {
850 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
851 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSimpleEarnLockedRedeemV1Resp`"))),
852 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::CreateSimpleEarnLockedRedeemV1Resp`")))),
853 }
854 } else {
855 let content = resp.text().await?;
856 let entity: Option<CreateSimpleEarnLockedRedeemV1Error> = serde_json::from_str(&content).ok();
857 Err(Error::ResponseError(ResponseContent { status, content, entity }))
858 }
859}
860
861pub async fn create_simple_earn_locked_set_auto_subscribe_v1(configuration: &configuration::Configuration, params: CreateSimpleEarnLockedSetAutoSubscribeV1Params) -> Result<models::CreateSimpleEarnLockedSetAutoSubscribeV1Resp, Error<CreateSimpleEarnLockedSetAutoSubscribeV1Error>> {
863
864 let uri_str = format!("{}/sapi/v1/simple-earn/locked/setAutoSubscribe", configuration.base_path);
865 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
866
867 let mut query_params: Vec<(String, String)> = Vec::new();
869
870
871 let mut header_params = std::collections::HashMap::new();
873
874 if let Some(ref binance_auth) = configuration.binance_auth {
876 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
878
879 let body_string: Option<Vec<u8>> = None;
881
882 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
884 Ok(sig) => sig,
885 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
886 };
887
888 query_params.push(("signature".to_string(), signature));
890 }
891
892 if !query_params.is_empty() {
894 req_builder = req_builder.query(&query_params);
895 }
896
897
898 if let Some(ref user_agent) = configuration.user_agent {
900 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
901 }
902
903 for (header_name, header_value) in header_params {
905 req_builder = req_builder.header(&header_name, &header_value);
906 }
907
908 let mut multipart_form_params = std::collections::HashMap::new();
909 multipart_form_params.insert("autoSubscribe", params.auto_subscribe.to_string());
910 multipart_form_params.insert("positionId", params.position_id.to_string());
911 if let Some(param_value) = params.recv_window {
912 multipart_form_params.insert("recvWindow", param_value.to_string());
913 }
914 multipart_form_params.insert("timestamp", params.timestamp.to_string());
915 req_builder = req_builder.form(&multipart_form_params);
916
917 let req = req_builder.build()?;
918 let resp = configuration.client.execute(req).await?;
919
920 let status = resp.status();
921 let content_type = resp
922 .headers()
923 .get("content-type")
924 .and_then(|v| v.to_str().ok())
925 .unwrap_or("application/octet-stream");
926 let content_type = super::ContentType::from(content_type);
927
928 if !status.is_client_error() && !status.is_server_error() {
929 let content = resp.text().await?;
930 match content_type {
931 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
932 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSimpleEarnLockedSetAutoSubscribeV1Resp`"))),
933 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::CreateSimpleEarnLockedSetAutoSubscribeV1Resp`")))),
934 }
935 } else {
936 let content = resp.text().await?;
937 let entity: Option<CreateSimpleEarnLockedSetAutoSubscribeV1Error> = serde_json::from_str(&content).ok();
938 Err(Error::ResponseError(ResponseContent { status, content, entity }))
939 }
940}
941
942pub async fn create_simple_earn_locked_set_redeem_option_v1(configuration: &configuration::Configuration, params: CreateSimpleEarnLockedSetRedeemOptionV1Params) -> Result<models::CreateSimpleEarnLockedSetRedeemOptionV1Resp, Error<CreateSimpleEarnLockedSetRedeemOptionV1Error>> {
944
945 let uri_str = format!("{}/sapi/v1/simple-earn/locked/setRedeemOption", configuration.base_path);
946 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
947
948 let mut query_params: Vec<(String, String)> = Vec::new();
950
951
952 let mut header_params = std::collections::HashMap::new();
954
955 if let Some(ref binance_auth) = configuration.binance_auth {
957 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
959
960 let body_string: Option<Vec<u8>> = None;
962
963 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
965 Ok(sig) => sig,
966 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
967 };
968
969 query_params.push(("signature".to_string(), signature));
971 }
972
973 if !query_params.is_empty() {
975 req_builder = req_builder.query(&query_params);
976 }
977
978
979 if let Some(ref user_agent) = configuration.user_agent {
981 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
982 }
983
984 for (header_name, header_value) in header_params {
986 req_builder = req_builder.header(&header_name, &header_value);
987 }
988
989 let mut multipart_form_params = std::collections::HashMap::new();
990 multipart_form_params.insert("positionId", params.position_id.to_string());
991 if let Some(param_value) = params.recv_window {
992 multipart_form_params.insert("recvWindow", param_value.to_string());
993 }
994 multipart_form_params.insert("redeemTo", params.redeem_to.to_string());
995 multipart_form_params.insert("timestamp", params.timestamp.to_string());
996 req_builder = req_builder.form(&multipart_form_params);
997
998 let req = req_builder.build()?;
999 let resp = configuration.client.execute(req).await?;
1000
1001 let status = resp.status();
1002 let content_type = resp
1003 .headers()
1004 .get("content-type")
1005 .and_then(|v| v.to_str().ok())
1006 .unwrap_or("application/octet-stream");
1007 let content_type = super::ContentType::from(content_type);
1008
1009 if !status.is_client_error() && !status.is_server_error() {
1010 let content = resp.text().await?;
1011 match content_type {
1012 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1013 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSimpleEarnLockedSetRedeemOptionV1Resp`"))),
1014 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::CreateSimpleEarnLockedSetRedeemOptionV1Resp`")))),
1015 }
1016 } else {
1017 let content = resp.text().await?;
1018 let entity: Option<CreateSimpleEarnLockedSetRedeemOptionV1Error> = serde_json::from_str(&content).ok();
1019 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1020 }
1021}
1022
1023pub async fn create_simple_earn_locked_subscribe_v1(configuration: &configuration::Configuration, params: CreateSimpleEarnLockedSubscribeV1Params) -> Result<models::CreateSimpleEarnLockedSubscribeV1Resp, Error<CreateSimpleEarnLockedSubscribeV1Error>> {
1025
1026 let uri_str = format!("{}/sapi/v1/simple-earn/locked/subscribe", configuration.base_path);
1027 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1028
1029 let mut query_params: Vec<(String, String)> = Vec::new();
1031
1032
1033 let mut header_params = std::collections::HashMap::new();
1035
1036 if let Some(ref binance_auth) = configuration.binance_auth {
1038 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1040
1041 let body_string: Option<Vec<u8>> = None;
1043
1044 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1046 Ok(sig) => sig,
1047 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1048 };
1049
1050 query_params.push(("signature".to_string(), signature));
1052 }
1053
1054 if !query_params.is_empty() {
1056 req_builder = req_builder.query(&query_params);
1057 }
1058
1059
1060 if let Some(ref user_agent) = configuration.user_agent {
1062 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1063 }
1064
1065 for (header_name, header_value) in header_params {
1067 req_builder = req_builder.header(&header_name, &header_value);
1068 }
1069
1070 let mut multipart_form_params = std::collections::HashMap::new();
1071 multipart_form_params.insert("amount", params.amount.to_string());
1072 if let Some(param_value) = params.auto_subscribe {
1073 multipart_form_params.insert("autoSubscribe", param_value.to_string());
1074 }
1075 multipart_form_params.insert("projectId", params.project_id.to_string());
1076 if let Some(param_value) = params.recv_window {
1077 multipart_form_params.insert("recvWindow", param_value.to_string());
1078 }
1079 if let Some(param_value) = params.redeem_to {
1080 multipart_form_params.insert("redeemTo", param_value.to_string());
1081 }
1082 if let Some(param_value) = params.source_account {
1083 multipart_form_params.insert("sourceAccount", param_value.to_string());
1084 }
1085 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1086 req_builder = req_builder.form(&multipart_form_params);
1087
1088 let req = req_builder.build()?;
1089 let resp = configuration.client.execute(req).await?;
1090
1091 let status = resp.status();
1092 let content_type = resp
1093 .headers()
1094 .get("content-type")
1095 .and_then(|v| v.to_str().ok())
1096 .unwrap_or("application/octet-stream");
1097 let content_type = super::ContentType::from(content_type);
1098
1099 if !status.is_client_error() && !status.is_server_error() {
1100 let content = resp.text().await?;
1101 match content_type {
1102 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1103 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSimpleEarnLockedSubscribeV1Resp`"))),
1104 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::CreateSimpleEarnLockedSubscribeV1Resp`")))),
1105 }
1106 } else {
1107 let content = resp.text().await?;
1108 let entity: Option<CreateSimpleEarnLockedSubscribeV1Error> = serde_json::from_str(&content).ok();
1109 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1110 }
1111}
1112
1113pub async fn get_simple_earn_account_v1(configuration: &configuration::Configuration, params: GetSimpleEarnAccountV1Params) -> Result<models::GetSimpleEarnAccountV1Resp, Error<GetSimpleEarnAccountV1Error>> {
1115
1116 let uri_str = format!("{}/sapi/v1/simple-earn/account", configuration.base_path);
1117 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1118
1119 let mut query_params: Vec<(String, String)> = Vec::new();
1121
1122 if let Some(ref param_value) = params.recv_window {
1123 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1124 }
1125 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1126
1127 let mut header_params = std::collections::HashMap::new();
1129
1130 if let Some(ref binance_auth) = configuration.binance_auth {
1132 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1134
1135 let body_string: Option<Vec<u8>> = None;
1137
1138 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1140 Ok(sig) => sig,
1141 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1142 };
1143
1144 query_params.push(("signature".to_string(), signature));
1146 }
1147
1148 if !query_params.is_empty() {
1150 req_builder = req_builder.query(&query_params);
1151 }
1152
1153
1154 if let Some(ref user_agent) = configuration.user_agent {
1156 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1157 }
1158
1159 for (header_name, header_value) in header_params {
1161 req_builder = req_builder.header(&header_name, &header_value);
1162 }
1163
1164
1165 let req = req_builder.build()?;
1166 let resp = configuration.client.execute(req).await?;
1167
1168 let status = resp.status();
1169 let content_type = resp
1170 .headers()
1171 .get("content-type")
1172 .and_then(|v| v.to_str().ok())
1173 .unwrap_or("application/octet-stream");
1174 let content_type = super::ContentType::from(content_type);
1175
1176 if !status.is_client_error() && !status.is_server_error() {
1177 let content = resp.text().await?;
1178 match content_type {
1179 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1180 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnAccountV1Resp`"))),
1181 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::GetSimpleEarnAccountV1Resp`")))),
1182 }
1183 } else {
1184 let content = resp.text().await?;
1185 let entity: Option<GetSimpleEarnAccountV1Error> = serde_json::from_str(&content).ok();
1186 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1187 }
1188}
1189
1190pub async fn get_simple_earn_flexible_history_collateral_record_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexibleHistoryCollateralRecordV1Params) -> Result<models::GetSimpleEarnFlexibleHistoryCollateralRecordV1Resp, Error<GetSimpleEarnFlexibleHistoryCollateralRecordV1Error>> {
1192
1193 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/history/collateralRecord", configuration.base_path);
1194 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1195
1196 let mut query_params: Vec<(String, String)> = Vec::new();
1198
1199 if let Some(ref param_value) = params.product_id {
1200 query_params.push(("productId".to_string(), param_value.to_string()));
1201 }
1202 if let Some(ref param_value) = params.start_time {
1203 query_params.push(("startTime".to_string(), param_value.to_string()));
1204 }
1205 if let Some(ref param_value) = params.end_time {
1206 query_params.push(("endTime".to_string(), param_value.to_string()));
1207 }
1208 if let Some(ref param_value) = params.current {
1209 query_params.push(("current".to_string(), param_value.to_string()));
1210 }
1211 if let Some(ref param_value) = params.size {
1212 query_params.push(("size".to_string(), param_value.to_string()));
1213 }
1214 if let Some(ref param_value) = params.recv_window {
1215 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1216 }
1217 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1218
1219 let mut header_params = std::collections::HashMap::new();
1221
1222 if let Some(ref binance_auth) = configuration.binance_auth {
1224 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1226
1227 let body_string: Option<Vec<u8>> = None;
1229
1230 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1232 Ok(sig) => sig,
1233 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1234 };
1235
1236 query_params.push(("signature".to_string(), signature));
1238 }
1239
1240 if !query_params.is_empty() {
1242 req_builder = req_builder.query(&query_params);
1243 }
1244
1245
1246 if let Some(ref user_agent) = configuration.user_agent {
1248 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1249 }
1250
1251 for (header_name, header_value) in header_params {
1253 req_builder = req_builder.header(&header_name, &header_value);
1254 }
1255
1256
1257 let req = req_builder.build()?;
1258 let resp = configuration.client.execute(req).await?;
1259
1260 let status = resp.status();
1261 let content_type = resp
1262 .headers()
1263 .get("content-type")
1264 .and_then(|v| v.to_str().ok())
1265 .unwrap_or("application/octet-stream");
1266 let content_type = super::ContentType::from(content_type);
1267
1268 if !status.is_client_error() && !status.is_server_error() {
1269 let content = resp.text().await?;
1270 match content_type {
1271 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1272 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexibleHistoryCollateralRecordV1Resp`"))),
1273 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::GetSimpleEarnFlexibleHistoryCollateralRecordV1Resp`")))),
1274 }
1275 } else {
1276 let content = resp.text().await?;
1277 let entity: Option<GetSimpleEarnFlexibleHistoryCollateralRecordV1Error> = serde_json::from_str(&content).ok();
1278 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1279 }
1280}
1281
1282pub async fn get_simple_earn_flexible_history_rate_history_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexibleHistoryRateHistoryV1Params) -> Result<models::GetSimpleEarnFlexibleHistoryRateHistoryV1Resp, Error<GetSimpleEarnFlexibleHistoryRateHistoryV1Error>> {
1284
1285 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/history/rateHistory", configuration.base_path);
1286 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1287
1288 let mut query_params: Vec<(String, String)> = Vec::new();
1290
1291 query_params.push(("productId".to_string(), params.product_id.to_string()));
1292 if let Some(ref param_value) = params.apr_period {
1293 query_params.push(("aprPeriod".to_string(), param_value.to_string()));
1294 }
1295 if let Some(ref param_value) = params.start_time {
1296 query_params.push(("startTime".to_string(), param_value.to_string()));
1297 }
1298 if let Some(ref param_value) = params.end_time {
1299 query_params.push(("endTime".to_string(), param_value.to_string()));
1300 }
1301 if let Some(ref param_value) = params.current {
1302 query_params.push(("current".to_string(), param_value.to_string()));
1303 }
1304 if let Some(ref param_value) = params.size {
1305 query_params.push(("size".to_string(), param_value.to_string()));
1306 }
1307 if let Some(ref param_value) = params.recv_window {
1308 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1309 }
1310 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1311
1312 let mut header_params = std::collections::HashMap::new();
1314
1315 if let Some(ref binance_auth) = configuration.binance_auth {
1317 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1319
1320 let body_string: Option<Vec<u8>> = None;
1322
1323 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1325 Ok(sig) => sig,
1326 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1327 };
1328
1329 query_params.push(("signature".to_string(), signature));
1331 }
1332
1333 if !query_params.is_empty() {
1335 req_builder = req_builder.query(&query_params);
1336 }
1337
1338
1339 if let Some(ref user_agent) = configuration.user_agent {
1341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1342 }
1343
1344 for (header_name, header_value) in header_params {
1346 req_builder = req_builder.header(&header_name, &header_value);
1347 }
1348
1349
1350 let req = req_builder.build()?;
1351 let resp = configuration.client.execute(req).await?;
1352
1353 let status = resp.status();
1354 let content_type = resp
1355 .headers()
1356 .get("content-type")
1357 .and_then(|v| v.to_str().ok())
1358 .unwrap_or("application/octet-stream");
1359 let content_type = super::ContentType::from(content_type);
1360
1361 if !status.is_client_error() && !status.is_server_error() {
1362 let content = resp.text().await?;
1363 match content_type {
1364 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1365 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexibleHistoryRateHistoryV1Resp`"))),
1366 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::GetSimpleEarnFlexibleHistoryRateHistoryV1Resp`")))),
1367 }
1368 } else {
1369 let content = resp.text().await?;
1370 let entity: Option<GetSimpleEarnFlexibleHistoryRateHistoryV1Error> = serde_json::from_str(&content).ok();
1371 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1372 }
1373}
1374
1375pub async fn get_simple_earn_flexible_history_redemption_record_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexibleHistoryRedemptionRecordV1Params) -> Result<models::GetSimpleEarnFlexibleHistoryRedemptionRecordV1Resp, Error<GetSimpleEarnFlexibleHistoryRedemptionRecordV1Error>> {
1377
1378 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/history/redemptionRecord", configuration.base_path);
1379 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1380
1381 let mut query_params: Vec<(String, String)> = Vec::new();
1383
1384 if let Some(ref param_value) = params.product_id {
1385 query_params.push(("productId".to_string(), param_value.to_string()));
1386 }
1387 if let Some(ref param_value) = params.redeem_id {
1388 query_params.push(("redeemId".to_string(), param_value.to_string()));
1389 }
1390 if let Some(ref param_value) = params.asset {
1391 query_params.push(("asset".to_string(), param_value.to_string()));
1392 }
1393 if let Some(ref param_value) = params.start_time {
1394 query_params.push(("startTime".to_string(), param_value.to_string()));
1395 }
1396 if let Some(ref param_value) = params.end_time {
1397 query_params.push(("endTime".to_string(), param_value.to_string()));
1398 }
1399 if let Some(ref param_value) = params.current {
1400 query_params.push(("current".to_string(), param_value.to_string()));
1401 }
1402 if let Some(ref param_value) = params.size {
1403 query_params.push(("size".to_string(), param_value.to_string()));
1404 }
1405
1406 let mut header_params = std::collections::HashMap::new();
1408
1409 if let Some(ref binance_auth) = configuration.binance_auth {
1411 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1413
1414 let body_string: Option<Vec<u8>> = None;
1416
1417 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1419 Ok(sig) => sig,
1420 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1421 };
1422
1423 query_params.push(("signature".to_string(), signature));
1425 }
1426
1427 if !query_params.is_empty() {
1429 req_builder = req_builder.query(&query_params);
1430 }
1431
1432
1433 if let Some(ref user_agent) = configuration.user_agent {
1435 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1436 }
1437
1438 for (header_name, header_value) in header_params {
1440 req_builder = req_builder.header(&header_name, &header_value);
1441 }
1442
1443
1444 let req = req_builder.build()?;
1445 let resp = configuration.client.execute(req).await?;
1446
1447 let status = resp.status();
1448 let content_type = resp
1449 .headers()
1450 .get("content-type")
1451 .and_then(|v| v.to_str().ok())
1452 .unwrap_or("application/octet-stream");
1453 let content_type = super::ContentType::from(content_type);
1454
1455 if !status.is_client_error() && !status.is_server_error() {
1456 let content = resp.text().await?;
1457 match content_type {
1458 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1459 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexibleHistoryRedemptionRecordV1Resp`"))),
1460 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::GetSimpleEarnFlexibleHistoryRedemptionRecordV1Resp`")))),
1461 }
1462 } else {
1463 let content = resp.text().await?;
1464 let entity: Option<GetSimpleEarnFlexibleHistoryRedemptionRecordV1Error> = serde_json::from_str(&content).ok();
1465 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1466 }
1467}
1468
1469pub async fn get_simple_earn_flexible_history_rewards_record_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexibleHistoryRewardsRecordV1Params) -> Result<models::GetSimpleEarnFlexibleHistoryRewardsRecordV1Resp, Error<GetSimpleEarnFlexibleHistoryRewardsRecordV1Error>> {
1471
1472 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/history/rewardsRecord", configuration.base_path);
1473 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1474
1475 let mut query_params: Vec<(String, String)> = Vec::new();
1477
1478 if let Some(ref param_value) = params.product_id {
1479 query_params.push(("productId".to_string(), param_value.to_string()));
1480 }
1481 if let Some(ref param_value) = params.asset {
1482 query_params.push(("asset".to_string(), param_value.to_string()));
1483 }
1484 if let Some(ref param_value) = params.start_time {
1485 query_params.push(("startTime".to_string(), param_value.to_string()));
1486 }
1487 if let Some(ref param_value) = params.end_time {
1488 query_params.push(("endTime".to_string(), param_value.to_string()));
1489 }
1490 query_params.push(("type".to_string(), params.r#type.to_string()));
1491 if let Some(ref param_value) = params.current {
1492 query_params.push(("current".to_string(), param_value.to_string()));
1493 }
1494 if let Some(ref param_value) = params.size {
1495 query_params.push(("size".to_string(), param_value.to_string()));
1496 }
1497 if let Some(ref param_value) = params.recv_window {
1498 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1499 }
1500 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1501
1502 let mut header_params = std::collections::HashMap::new();
1504
1505 if let Some(ref binance_auth) = configuration.binance_auth {
1507 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1509
1510 let body_string: Option<Vec<u8>> = None;
1512
1513 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1515 Ok(sig) => sig,
1516 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1517 };
1518
1519 query_params.push(("signature".to_string(), signature));
1521 }
1522
1523 if !query_params.is_empty() {
1525 req_builder = req_builder.query(&query_params);
1526 }
1527
1528
1529 if let Some(ref user_agent) = configuration.user_agent {
1531 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1532 }
1533
1534 for (header_name, header_value) in header_params {
1536 req_builder = req_builder.header(&header_name, &header_value);
1537 }
1538
1539
1540 let req = req_builder.build()?;
1541 let resp = configuration.client.execute(req).await?;
1542
1543 let status = resp.status();
1544 let content_type = resp
1545 .headers()
1546 .get("content-type")
1547 .and_then(|v| v.to_str().ok())
1548 .unwrap_or("application/octet-stream");
1549 let content_type = super::ContentType::from(content_type);
1550
1551 if !status.is_client_error() && !status.is_server_error() {
1552 let content = resp.text().await?;
1553 match content_type {
1554 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1555 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexibleHistoryRewardsRecordV1Resp`"))),
1556 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::GetSimpleEarnFlexibleHistoryRewardsRecordV1Resp`")))),
1557 }
1558 } else {
1559 let content = resp.text().await?;
1560 let entity: Option<GetSimpleEarnFlexibleHistoryRewardsRecordV1Error> = serde_json::from_str(&content).ok();
1561 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1562 }
1563}
1564
1565pub async fn get_simple_earn_flexible_history_subscription_record_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexibleHistorySubscriptionRecordV1Params) -> Result<models::GetSimpleEarnFlexibleHistorySubscriptionRecordV1Resp, Error<GetSimpleEarnFlexibleHistorySubscriptionRecordV1Error>> {
1567
1568 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/history/subscriptionRecord", configuration.base_path);
1569 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1570
1571 let mut query_params: Vec<(String, String)> = Vec::new();
1573
1574 if let Some(ref param_value) = params.product_id {
1575 query_params.push(("productId".to_string(), param_value.to_string()));
1576 }
1577 if let Some(ref param_value) = params.purchase_id {
1578 query_params.push(("purchaseId".to_string(), param_value.to_string()));
1579 }
1580 if let Some(ref param_value) = params.asset {
1581 query_params.push(("asset".to_string(), param_value.to_string()));
1582 }
1583 if let Some(ref param_value) = params.start_time {
1584 query_params.push(("startTime".to_string(), param_value.to_string()));
1585 }
1586 if let Some(ref param_value) = params.end_time {
1587 query_params.push(("endTime".to_string(), param_value.to_string()));
1588 }
1589 if let Some(ref param_value) = params.current {
1590 query_params.push(("current".to_string(), param_value.to_string()));
1591 }
1592 if let Some(ref param_value) = params.size {
1593 query_params.push(("size".to_string(), param_value.to_string()));
1594 }
1595 if let Some(ref param_value) = params.recv_window {
1596 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1597 }
1598 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1599
1600 let mut header_params = std::collections::HashMap::new();
1602
1603 if let Some(ref binance_auth) = configuration.binance_auth {
1605 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1607
1608 let body_string: Option<Vec<u8>> = None;
1610
1611 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1613 Ok(sig) => sig,
1614 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1615 };
1616
1617 query_params.push(("signature".to_string(), signature));
1619 }
1620
1621 if !query_params.is_empty() {
1623 req_builder = req_builder.query(&query_params);
1624 }
1625
1626
1627 if let Some(ref user_agent) = configuration.user_agent {
1629 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1630 }
1631
1632 for (header_name, header_value) in header_params {
1634 req_builder = req_builder.header(&header_name, &header_value);
1635 }
1636
1637
1638 let req = req_builder.build()?;
1639 let resp = configuration.client.execute(req).await?;
1640
1641 let status = resp.status();
1642 let content_type = resp
1643 .headers()
1644 .get("content-type")
1645 .and_then(|v| v.to_str().ok())
1646 .unwrap_or("application/octet-stream");
1647 let content_type = super::ContentType::from(content_type);
1648
1649 if !status.is_client_error() && !status.is_server_error() {
1650 let content = resp.text().await?;
1651 match content_type {
1652 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1653 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexibleHistorySubscriptionRecordV1Resp`"))),
1654 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::GetSimpleEarnFlexibleHistorySubscriptionRecordV1Resp`")))),
1655 }
1656 } else {
1657 let content = resp.text().await?;
1658 let entity: Option<GetSimpleEarnFlexibleHistorySubscriptionRecordV1Error> = serde_json::from_str(&content).ok();
1659 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1660 }
1661}
1662
1663pub async fn get_simple_earn_flexible_list_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexibleListV1Params) -> Result<models::GetSimpleEarnFlexibleListV1Resp, Error<GetSimpleEarnFlexibleListV1Error>> {
1665
1666 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/list", configuration.base_path);
1667 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1668
1669 let mut query_params: Vec<(String, String)> = Vec::new();
1671
1672 if let Some(ref param_value) = params.asset {
1673 query_params.push(("asset".to_string(), param_value.to_string()));
1674 }
1675 if let Some(ref param_value) = params.current {
1676 query_params.push(("current".to_string(), param_value.to_string()));
1677 }
1678 if let Some(ref param_value) = params.size {
1679 query_params.push(("size".to_string(), param_value.to_string()));
1680 }
1681 if let Some(ref param_value) = params.recv_window {
1682 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1683 }
1684 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1685
1686 let mut header_params = std::collections::HashMap::new();
1688
1689 if let Some(ref binance_auth) = configuration.binance_auth {
1691 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1693
1694 let body_string: Option<Vec<u8>> = None;
1696
1697 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1699 Ok(sig) => sig,
1700 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1701 };
1702
1703 query_params.push(("signature".to_string(), signature));
1705 }
1706
1707 if !query_params.is_empty() {
1709 req_builder = req_builder.query(&query_params);
1710 }
1711
1712
1713 if let Some(ref user_agent) = configuration.user_agent {
1715 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1716 }
1717
1718 for (header_name, header_value) in header_params {
1720 req_builder = req_builder.header(&header_name, &header_value);
1721 }
1722
1723
1724 let req = req_builder.build()?;
1725 let resp = configuration.client.execute(req).await?;
1726
1727 let status = resp.status();
1728 let content_type = resp
1729 .headers()
1730 .get("content-type")
1731 .and_then(|v| v.to_str().ok())
1732 .unwrap_or("application/octet-stream");
1733 let content_type = super::ContentType::from(content_type);
1734
1735 if !status.is_client_error() && !status.is_server_error() {
1736 let content = resp.text().await?;
1737 match content_type {
1738 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1739 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexibleListV1Resp`"))),
1740 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::GetSimpleEarnFlexibleListV1Resp`")))),
1741 }
1742 } else {
1743 let content = resp.text().await?;
1744 let entity: Option<GetSimpleEarnFlexibleListV1Error> = serde_json::from_str(&content).ok();
1745 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1746 }
1747}
1748
1749pub async fn get_simple_earn_flexible_personal_left_quota_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexiblePersonalLeftQuotaV1Params) -> Result<models::GetSimpleEarnFlexiblePersonalLeftQuotaV1Resp, Error<GetSimpleEarnFlexiblePersonalLeftQuotaV1Error>> {
1751
1752 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/personalLeftQuota", configuration.base_path);
1753 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1754
1755 let mut query_params: Vec<(String, String)> = Vec::new();
1757
1758 query_params.push(("productId".to_string(), params.product_id.to_string()));
1759 if let Some(ref param_value) = params.recv_window {
1760 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1761 }
1762 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1763
1764 let mut header_params = std::collections::HashMap::new();
1766
1767 if let Some(ref binance_auth) = configuration.binance_auth {
1769 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1771
1772 let body_string: Option<Vec<u8>> = None;
1774
1775 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1777 Ok(sig) => sig,
1778 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1779 };
1780
1781 query_params.push(("signature".to_string(), signature));
1783 }
1784
1785 if !query_params.is_empty() {
1787 req_builder = req_builder.query(&query_params);
1788 }
1789
1790
1791 if let Some(ref user_agent) = configuration.user_agent {
1793 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1794 }
1795
1796 for (header_name, header_value) in header_params {
1798 req_builder = req_builder.header(&header_name, &header_value);
1799 }
1800
1801
1802 let req = req_builder.build()?;
1803 let resp = configuration.client.execute(req).await?;
1804
1805 let status = resp.status();
1806 let content_type = resp
1807 .headers()
1808 .get("content-type")
1809 .and_then(|v| v.to_str().ok())
1810 .unwrap_or("application/octet-stream");
1811 let content_type = super::ContentType::from(content_type);
1812
1813 if !status.is_client_error() && !status.is_server_error() {
1814 let content = resp.text().await?;
1815 match content_type {
1816 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1817 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexiblePersonalLeftQuotaV1Resp`"))),
1818 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::GetSimpleEarnFlexiblePersonalLeftQuotaV1Resp`")))),
1819 }
1820 } else {
1821 let content = resp.text().await?;
1822 let entity: Option<GetSimpleEarnFlexiblePersonalLeftQuotaV1Error> = serde_json::from_str(&content).ok();
1823 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1824 }
1825}
1826
1827pub async fn get_simple_earn_flexible_position_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexiblePositionV1Params) -> Result<models::GetSimpleEarnFlexiblePositionV1Resp, Error<GetSimpleEarnFlexiblePositionV1Error>> {
1829
1830 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/position", configuration.base_path);
1831 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1832
1833 let mut query_params: Vec<(String, String)> = Vec::new();
1835
1836 if let Some(ref param_value) = params.asset {
1837 query_params.push(("asset".to_string(), param_value.to_string()));
1838 }
1839 if let Some(ref param_value) = params.product_id {
1840 query_params.push(("productId".to_string(), param_value.to_string()));
1841 }
1842 if let Some(ref param_value) = params.current {
1843 query_params.push(("current".to_string(), param_value.to_string()));
1844 }
1845 if let Some(ref param_value) = params.size {
1846 query_params.push(("size".to_string(), param_value.to_string()));
1847 }
1848 if let Some(ref param_value) = params.recv_window {
1849 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1850 }
1851 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1852
1853 let mut header_params = std::collections::HashMap::new();
1855
1856 if let Some(ref binance_auth) = configuration.binance_auth {
1858 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1860
1861 let body_string: Option<Vec<u8>> = None;
1863
1864 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1866 Ok(sig) => sig,
1867 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1868 };
1869
1870 query_params.push(("signature".to_string(), signature));
1872 }
1873
1874 if !query_params.is_empty() {
1876 req_builder = req_builder.query(&query_params);
1877 }
1878
1879
1880 if let Some(ref user_agent) = configuration.user_agent {
1882 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1883 }
1884
1885 for (header_name, header_value) in header_params {
1887 req_builder = req_builder.header(&header_name, &header_value);
1888 }
1889
1890
1891 let req = req_builder.build()?;
1892 let resp = configuration.client.execute(req).await?;
1893
1894 let status = resp.status();
1895 let content_type = resp
1896 .headers()
1897 .get("content-type")
1898 .and_then(|v| v.to_str().ok())
1899 .unwrap_or("application/octet-stream");
1900 let content_type = super::ContentType::from(content_type);
1901
1902 if !status.is_client_error() && !status.is_server_error() {
1903 let content = resp.text().await?;
1904 match content_type {
1905 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1906 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexiblePositionV1Resp`"))),
1907 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::GetSimpleEarnFlexiblePositionV1Resp`")))),
1908 }
1909 } else {
1910 let content = resp.text().await?;
1911 let entity: Option<GetSimpleEarnFlexiblePositionV1Error> = serde_json::from_str(&content).ok();
1912 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1913 }
1914}
1915
1916pub async fn get_simple_earn_flexible_subscription_preview_v1(configuration: &configuration::Configuration, params: GetSimpleEarnFlexibleSubscriptionPreviewV1Params) -> Result<models::GetSimpleEarnFlexibleSubscriptionPreviewV1Resp, Error<GetSimpleEarnFlexibleSubscriptionPreviewV1Error>> {
1918
1919 let uri_str = format!("{}/sapi/v1/simple-earn/flexible/subscriptionPreview", configuration.base_path);
1920 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1921
1922 let mut query_params: Vec<(String, String)> = Vec::new();
1924
1925 query_params.push(("productId".to_string(), params.product_id.to_string()));
1926 query_params.push(("amount".to_string(), params.amount.to_string()));
1927 if let Some(ref param_value) = params.recv_window {
1928 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1929 }
1930 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1931
1932 let mut header_params = std::collections::HashMap::new();
1934
1935 if let Some(ref binance_auth) = configuration.binance_auth {
1937 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1939
1940 let body_string: Option<Vec<u8>> = None;
1942
1943 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1945 Ok(sig) => sig,
1946 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1947 };
1948
1949 query_params.push(("signature".to_string(), signature));
1951 }
1952
1953 if !query_params.is_empty() {
1955 req_builder = req_builder.query(&query_params);
1956 }
1957
1958
1959 if let Some(ref user_agent) = configuration.user_agent {
1961 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1962 }
1963
1964 for (header_name, header_value) in header_params {
1966 req_builder = req_builder.header(&header_name, &header_value);
1967 }
1968
1969
1970 let req = req_builder.build()?;
1971 let resp = configuration.client.execute(req).await?;
1972
1973 let status = resp.status();
1974 let content_type = resp
1975 .headers()
1976 .get("content-type")
1977 .and_then(|v| v.to_str().ok())
1978 .unwrap_or("application/octet-stream");
1979 let content_type = super::ContentType::from(content_type);
1980
1981 if !status.is_client_error() && !status.is_server_error() {
1982 let content = resp.text().await?;
1983 match content_type {
1984 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1985 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnFlexibleSubscriptionPreviewV1Resp`"))),
1986 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::GetSimpleEarnFlexibleSubscriptionPreviewV1Resp`")))),
1987 }
1988 } else {
1989 let content = resp.text().await?;
1990 let entity: Option<GetSimpleEarnFlexibleSubscriptionPreviewV1Error> = serde_json::from_str(&content).ok();
1991 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1992 }
1993}
1994
1995pub async fn get_simple_earn_locked_history_redemption_record_v1(configuration: &configuration::Configuration, params: GetSimpleEarnLockedHistoryRedemptionRecordV1Params) -> Result<models::GetSimpleEarnLockedHistoryRedemptionRecordV1Resp, Error<GetSimpleEarnLockedHistoryRedemptionRecordV1Error>> {
1997
1998 let uri_str = format!("{}/sapi/v1/simple-earn/locked/history/redemptionRecord", configuration.base_path);
1999 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2000
2001 let mut query_params: Vec<(String, String)> = Vec::new();
2003
2004 if let Some(ref param_value) = params.position_id {
2005 query_params.push(("positionId".to_string(), param_value.to_string()));
2006 }
2007 if let Some(ref param_value) = params.redeem_id {
2008 query_params.push(("redeemId".to_string(), param_value.to_string()));
2009 }
2010 if let Some(ref param_value) = params.asset {
2011 query_params.push(("asset".to_string(), param_value.to_string()));
2012 }
2013 if let Some(ref param_value) = params.start_time {
2014 query_params.push(("startTime".to_string(), param_value.to_string()));
2015 }
2016 if let Some(ref param_value) = params.end_time {
2017 query_params.push(("endTime".to_string(), param_value.to_string()));
2018 }
2019 if let Some(ref param_value) = params.current {
2020 query_params.push(("current".to_string(), param_value.to_string()));
2021 }
2022 if let Some(ref param_value) = params.size {
2023 query_params.push(("size".to_string(), param_value.to_string()));
2024 }
2025 if let Some(ref param_value) = params.recv_window {
2026 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2027 }
2028 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2029
2030 let mut header_params = std::collections::HashMap::new();
2032
2033 if let Some(ref binance_auth) = configuration.binance_auth {
2035 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2037
2038 let body_string: Option<Vec<u8>> = None;
2040
2041 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2043 Ok(sig) => sig,
2044 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2045 };
2046
2047 query_params.push(("signature".to_string(), signature));
2049 }
2050
2051 if !query_params.is_empty() {
2053 req_builder = req_builder.query(&query_params);
2054 }
2055
2056
2057 if let Some(ref user_agent) = configuration.user_agent {
2059 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2060 }
2061
2062 for (header_name, header_value) in header_params {
2064 req_builder = req_builder.header(&header_name, &header_value);
2065 }
2066
2067
2068 let req = req_builder.build()?;
2069 let resp = configuration.client.execute(req).await?;
2070
2071 let status = resp.status();
2072 let content_type = resp
2073 .headers()
2074 .get("content-type")
2075 .and_then(|v| v.to_str().ok())
2076 .unwrap_or("application/octet-stream");
2077 let content_type = super::ContentType::from(content_type);
2078
2079 if !status.is_client_error() && !status.is_server_error() {
2080 let content = resp.text().await?;
2081 match content_type {
2082 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2083 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnLockedHistoryRedemptionRecordV1Resp`"))),
2084 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::GetSimpleEarnLockedHistoryRedemptionRecordV1Resp`")))),
2085 }
2086 } else {
2087 let content = resp.text().await?;
2088 let entity: Option<GetSimpleEarnLockedHistoryRedemptionRecordV1Error> = serde_json::from_str(&content).ok();
2089 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2090 }
2091}
2092
2093pub async fn get_simple_earn_locked_history_rewards_record_v1(configuration: &configuration::Configuration, params: GetSimpleEarnLockedHistoryRewardsRecordV1Params) -> Result<models::GetSimpleEarnLockedHistoryRewardsRecordV1Resp, Error<GetSimpleEarnLockedHistoryRewardsRecordV1Error>> {
2095
2096 let uri_str = format!("{}/sapi/v1/simple-earn/locked/history/rewardsRecord", configuration.base_path);
2097 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2098
2099 let mut query_params: Vec<(String, String)> = Vec::new();
2101
2102 if let Some(ref param_value) = params.position_id {
2103 query_params.push(("positionId".to_string(), param_value.to_string()));
2104 }
2105 if let Some(ref param_value) = params.asset {
2106 query_params.push(("asset".to_string(), param_value.to_string()));
2107 }
2108 if let Some(ref param_value) = params.start_time {
2109 query_params.push(("startTime".to_string(), param_value.to_string()));
2110 }
2111 if let Some(ref param_value) = params.end_time {
2112 query_params.push(("endTime".to_string(), param_value.to_string()));
2113 }
2114 if let Some(ref param_value) = params.current {
2115 query_params.push(("current".to_string(), param_value.to_string()));
2116 }
2117 if let Some(ref param_value) = params.size {
2118 query_params.push(("size".to_string(), param_value.to_string()));
2119 }
2120 if let Some(ref param_value) = params.recv_window {
2121 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2122 }
2123 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2124
2125 let mut header_params = std::collections::HashMap::new();
2127
2128 if let Some(ref binance_auth) = configuration.binance_auth {
2130 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2132
2133 let body_string: Option<Vec<u8>> = None;
2135
2136 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2138 Ok(sig) => sig,
2139 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2140 };
2141
2142 query_params.push(("signature".to_string(), signature));
2144 }
2145
2146 if !query_params.is_empty() {
2148 req_builder = req_builder.query(&query_params);
2149 }
2150
2151
2152 if let Some(ref user_agent) = configuration.user_agent {
2154 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2155 }
2156
2157 for (header_name, header_value) in header_params {
2159 req_builder = req_builder.header(&header_name, &header_value);
2160 }
2161
2162
2163 let req = req_builder.build()?;
2164 let resp = configuration.client.execute(req).await?;
2165
2166 let status = resp.status();
2167 let content_type = resp
2168 .headers()
2169 .get("content-type")
2170 .and_then(|v| v.to_str().ok())
2171 .unwrap_or("application/octet-stream");
2172 let content_type = super::ContentType::from(content_type);
2173
2174 if !status.is_client_error() && !status.is_server_error() {
2175 let content = resp.text().await?;
2176 match content_type {
2177 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2178 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnLockedHistoryRewardsRecordV1Resp`"))),
2179 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::GetSimpleEarnLockedHistoryRewardsRecordV1Resp`")))),
2180 }
2181 } else {
2182 let content = resp.text().await?;
2183 let entity: Option<GetSimpleEarnLockedHistoryRewardsRecordV1Error> = serde_json::from_str(&content).ok();
2184 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2185 }
2186}
2187
2188pub async fn get_simple_earn_locked_history_subscription_record_v1(configuration: &configuration::Configuration, params: GetSimpleEarnLockedHistorySubscriptionRecordV1Params) -> Result<models::GetSimpleEarnLockedHistorySubscriptionRecordV1Resp, Error<GetSimpleEarnLockedHistorySubscriptionRecordV1Error>> {
2190
2191 let uri_str = format!("{}/sapi/v1/simple-earn/locked/history/subscriptionRecord", configuration.base_path);
2192 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2193
2194 let mut query_params: Vec<(String, String)> = Vec::new();
2196
2197 if let Some(ref param_value) = params.purchase_id {
2198 query_params.push(("purchaseId".to_string(), param_value.to_string()));
2199 }
2200 if let Some(ref param_value) = params.asset {
2201 query_params.push(("asset".to_string(), param_value.to_string()));
2202 }
2203 if let Some(ref param_value) = params.start_time {
2204 query_params.push(("startTime".to_string(), param_value.to_string()));
2205 }
2206 if let Some(ref param_value) = params.end_time {
2207 query_params.push(("endTime".to_string(), param_value.to_string()));
2208 }
2209 if let Some(ref param_value) = params.current {
2210 query_params.push(("current".to_string(), param_value.to_string()));
2211 }
2212 if let Some(ref param_value) = params.size {
2213 query_params.push(("size".to_string(), param_value.to_string()));
2214 }
2215 if let Some(ref param_value) = params.recv_window {
2216 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2217 }
2218 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2219
2220 let mut header_params = std::collections::HashMap::new();
2222
2223 if let Some(ref binance_auth) = configuration.binance_auth {
2225 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2227
2228 let body_string: Option<Vec<u8>> = None;
2230
2231 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2233 Ok(sig) => sig,
2234 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2235 };
2236
2237 query_params.push(("signature".to_string(), signature));
2239 }
2240
2241 if !query_params.is_empty() {
2243 req_builder = req_builder.query(&query_params);
2244 }
2245
2246
2247 if let Some(ref user_agent) = configuration.user_agent {
2249 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2250 }
2251
2252 for (header_name, header_value) in header_params {
2254 req_builder = req_builder.header(&header_name, &header_value);
2255 }
2256
2257
2258 let req = req_builder.build()?;
2259 let resp = configuration.client.execute(req).await?;
2260
2261 let status = resp.status();
2262 let content_type = resp
2263 .headers()
2264 .get("content-type")
2265 .and_then(|v| v.to_str().ok())
2266 .unwrap_or("application/octet-stream");
2267 let content_type = super::ContentType::from(content_type);
2268
2269 if !status.is_client_error() && !status.is_server_error() {
2270 let content = resp.text().await?;
2271 match content_type {
2272 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2273 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnLockedHistorySubscriptionRecordV1Resp`"))),
2274 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::GetSimpleEarnLockedHistorySubscriptionRecordV1Resp`")))),
2275 }
2276 } else {
2277 let content = resp.text().await?;
2278 let entity: Option<GetSimpleEarnLockedHistorySubscriptionRecordV1Error> = serde_json::from_str(&content).ok();
2279 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2280 }
2281}
2282
2283pub async fn get_simple_earn_locked_list_v1(configuration: &configuration::Configuration, params: GetSimpleEarnLockedListV1Params) -> Result<models::GetSimpleEarnLockedListV1Resp, Error<GetSimpleEarnLockedListV1Error>> {
2285
2286 let uri_str = format!("{}/sapi/v1/simple-earn/locked/list", configuration.base_path);
2287 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2288
2289 let mut query_params: Vec<(String, String)> = Vec::new();
2291
2292 if let Some(ref param_value) = params.asset {
2293 query_params.push(("asset".to_string(), param_value.to_string()));
2294 }
2295 if let Some(ref param_value) = params.current {
2296 query_params.push(("current".to_string(), param_value.to_string()));
2297 }
2298 if let Some(ref param_value) = params.size {
2299 query_params.push(("size".to_string(), param_value.to_string()));
2300 }
2301 if let Some(ref param_value) = params.recv_window {
2302 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2303 }
2304 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2305
2306 let mut header_params = std::collections::HashMap::new();
2308
2309 if let Some(ref binance_auth) = configuration.binance_auth {
2311 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2313
2314 let body_string: Option<Vec<u8>> = None;
2316
2317 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2319 Ok(sig) => sig,
2320 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2321 };
2322
2323 query_params.push(("signature".to_string(), signature));
2325 }
2326
2327 if !query_params.is_empty() {
2329 req_builder = req_builder.query(&query_params);
2330 }
2331
2332
2333 if let Some(ref user_agent) = configuration.user_agent {
2335 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2336 }
2337
2338 for (header_name, header_value) in header_params {
2340 req_builder = req_builder.header(&header_name, &header_value);
2341 }
2342
2343
2344 let req = req_builder.build()?;
2345 let resp = configuration.client.execute(req).await?;
2346
2347 let status = resp.status();
2348 let content_type = resp
2349 .headers()
2350 .get("content-type")
2351 .and_then(|v| v.to_str().ok())
2352 .unwrap_or("application/octet-stream");
2353 let content_type = super::ContentType::from(content_type);
2354
2355 if !status.is_client_error() && !status.is_server_error() {
2356 let content = resp.text().await?;
2357 match content_type {
2358 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2359 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnLockedListV1Resp`"))),
2360 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::GetSimpleEarnLockedListV1Resp`")))),
2361 }
2362 } else {
2363 let content = resp.text().await?;
2364 let entity: Option<GetSimpleEarnLockedListV1Error> = serde_json::from_str(&content).ok();
2365 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2366 }
2367}
2368
2369pub async fn get_simple_earn_locked_personal_left_quota_v1(configuration: &configuration::Configuration, params: GetSimpleEarnLockedPersonalLeftQuotaV1Params) -> Result<models::GetSimpleEarnLockedPersonalLeftQuotaV1Resp, Error<GetSimpleEarnLockedPersonalLeftQuotaV1Error>> {
2371
2372 let uri_str = format!("{}/sapi/v1/simple-earn/locked/personalLeftQuota", configuration.base_path);
2373 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2374
2375 let mut query_params: Vec<(String, String)> = Vec::new();
2377
2378 query_params.push(("projectId".to_string(), params.project_id.to_string()));
2379 if let Some(ref param_value) = params.recv_window {
2380 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2381 }
2382 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2383
2384 let mut header_params = std::collections::HashMap::new();
2386
2387 if let Some(ref binance_auth) = configuration.binance_auth {
2389 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2391
2392 let body_string: Option<Vec<u8>> = None;
2394
2395 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2397 Ok(sig) => sig,
2398 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2399 };
2400
2401 query_params.push(("signature".to_string(), signature));
2403 }
2404
2405 if !query_params.is_empty() {
2407 req_builder = req_builder.query(&query_params);
2408 }
2409
2410
2411 if let Some(ref user_agent) = configuration.user_agent {
2413 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2414 }
2415
2416 for (header_name, header_value) in header_params {
2418 req_builder = req_builder.header(&header_name, &header_value);
2419 }
2420
2421
2422 let req = req_builder.build()?;
2423 let resp = configuration.client.execute(req).await?;
2424
2425 let status = resp.status();
2426 let content_type = resp
2427 .headers()
2428 .get("content-type")
2429 .and_then(|v| v.to_str().ok())
2430 .unwrap_or("application/octet-stream");
2431 let content_type = super::ContentType::from(content_type);
2432
2433 if !status.is_client_error() && !status.is_server_error() {
2434 let content = resp.text().await?;
2435 match content_type {
2436 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2437 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnLockedPersonalLeftQuotaV1Resp`"))),
2438 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::GetSimpleEarnLockedPersonalLeftQuotaV1Resp`")))),
2439 }
2440 } else {
2441 let content = resp.text().await?;
2442 let entity: Option<GetSimpleEarnLockedPersonalLeftQuotaV1Error> = serde_json::from_str(&content).ok();
2443 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2444 }
2445}
2446
2447pub async fn get_simple_earn_locked_position_v1(configuration: &configuration::Configuration, params: GetSimpleEarnLockedPositionV1Params) -> Result<models::GetSimpleEarnLockedPositionV1Resp, Error<GetSimpleEarnLockedPositionV1Error>> {
2449
2450 let uri_str = format!("{}/sapi/v1/simple-earn/locked/position", configuration.base_path);
2451 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2452
2453 let mut query_params: Vec<(String, String)> = Vec::new();
2455
2456 if let Some(ref param_value) = params.asset {
2457 query_params.push(("asset".to_string(), param_value.to_string()));
2458 }
2459 if let Some(ref param_value) = params.position_id {
2460 query_params.push(("positionId".to_string(), param_value.to_string()));
2461 }
2462 if let Some(ref param_value) = params.project_id {
2463 query_params.push(("projectId".to_string(), param_value.to_string()));
2464 }
2465 if let Some(ref param_value) = params.current {
2466 query_params.push(("current".to_string(), param_value.to_string()));
2467 }
2468 if let Some(ref param_value) = params.size {
2469 query_params.push(("size".to_string(), param_value.to_string()));
2470 }
2471 if let Some(ref param_value) = params.recv_window {
2472 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2473 }
2474 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2475
2476 let mut header_params = std::collections::HashMap::new();
2478
2479 if let Some(ref binance_auth) = configuration.binance_auth {
2481 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2483
2484 let body_string: Option<Vec<u8>> = None;
2486
2487 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2489 Ok(sig) => sig,
2490 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2491 };
2492
2493 query_params.push(("signature".to_string(), signature));
2495 }
2496
2497 if !query_params.is_empty() {
2499 req_builder = req_builder.query(&query_params);
2500 }
2501
2502
2503 if let Some(ref user_agent) = configuration.user_agent {
2505 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2506 }
2507
2508 for (header_name, header_value) in header_params {
2510 req_builder = req_builder.header(&header_name, &header_value);
2511 }
2512
2513
2514 let req = req_builder.build()?;
2515 let resp = configuration.client.execute(req).await?;
2516
2517 let status = resp.status();
2518 let content_type = resp
2519 .headers()
2520 .get("content-type")
2521 .and_then(|v| v.to_str().ok())
2522 .unwrap_or("application/octet-stream");
2523 let content_type = super::ContentType::from(content_type);
2524
2525 if !status.is_client_error() && !status.is_server_error() {
2526 let content = resp.text().await?;
2527 match content_type {
2528 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2529 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSimpleEarnLockedPositionV1Resp`"))),
2530 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::GetSimpleEarnLockedPositionV1Resp`")))),
2531 }
2532 } else {
2533 let content = resp.text().await?;
2534 let entity: Option<GetSimpleEarnLockedPositionV1Error> = serde_json::from_str(&content).ok();
2535 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2536 }
2537}
2538
2539pub async fn get_simple_earn_locked_subscription_preview_v1(configuration: &configuration::Configuration, params: GetSimpleEarnLockedSubscriptionPreviewV1Params) -> Result<Vec<models::GetSimpleEarnLockedSubscriptionPreviewV1RespItem>, Error<GetSimpleEarnLockedSubscriptionPreviewV1Error>> {
2541
2542 let uri_str = format!("{}/sapi/v1/simple-earn/locked/subscriptionPreview", configuration.base_path);
2543 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2544
2545 let mut query_params: Vec<(String, String)> = Vec::new();
2547
2548 query_params.push(("projectId".to_string(), params.project_id.to_string()));
2549 query_params.push(("amount".to_string(), params.amount.to_string()));
2550 if let Some(ref param_value) = params.auto_subscribe {
2551 query_params.push(("autoSubscribe".to_string(), param_value.to_string()));
2552 }
2553 if let Some(ref param_value) = params.recv_window {
2554 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2555 }
2556 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2557
2558 let mut header_params = std::collections::HashMap::new();
2560
2561 if let Some(ref binance_auth) = configuration.binance_auth {
2563 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2565
2566 let body_string: Option<Vec<u8>> = None;
2568
2569 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2571 Ok(sig) => sig,
2572 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2573 };
2574
2575 query_params.push(("signature".to_string(), signature));
2577 }
2578
2579 if !query_params.is_empty() {
2581 req_builder = req_builder.query(&query_params);
2582 }
2583
2584
2585 if let Some(ref user_agent) = configuration.user_agent {
2587 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2588 }
2589
2590 for (header_name, header_value) in header_params {
2592 req_builder = req_builder.header(&header_name, &header_value);
2593 }
2594
2595
2596 let req = req_builder.build()?;
2597 let resp = configuration.client.execute(req).await?;
2598
2599 let status = resp.status();
2600 let content_type = resp
2601 .headers()
2602 .get("content-type")
2603 .and_then(|v| v.to_str().ok())
2604 .unwrap_or("application/octet-stream");
2605 let content_type = super::ContentType::from(content_type);
2606
2607 if !status.is_client_error() && !status.is_server_error() {
2608 let content = resp.text().await?;
2609 match content_type {
2610 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2611 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetSimpleEarnLockedSubscriptionPreviewV1RespItem>`"))),
2612 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::GetSimpleEarnLockedSubscriptionPreviewV1RespItem>`")))),
2613 }
2614 } else {
2615 let content = resp.text().await?;
2616 let entity: Option<GetSimpleEarnLockedSubscriptionPreviewV1Error> = serde_json::from_str(&content).ok();
2617 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2618 }
2619}
2620