Skip to main content

binance/spot/apis/
vip_loan_api.rs

1/*
2 * Binance Spot API
3 *
4 * OpenAPI specification for Binance exchange - Spot API
5 *
6 * The version of the OpenAPI document: 0.3.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::spot::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`create_loan_vip_renew_v1`]
18#[derive(Clone, Debug, Default)]
19pub struct CreateLoanVipRenewV1Params {
20    pub loan_term: i32,
21    pub order_id: i64,
22    pub timestamp: i64,
23    pub recv_window: Option<i64>
24}
25
26/// struct for passing parameters to the method [`create_loan_vip_repay_v1`]
27#[derive(Clone, Debug, Default)]
28pub struct CreateLoanVipRepayV1Params {
29    pub amount: String,
30    pub order_id: i64,
31    pub timestamp: i64,
32    pub recv_window: Option<i64>
33}
34
35/// struct for passing parameters to the method [`get_loan_vip_accrued_interest_v1`]
36#[derive(Clone, Debug, Default)]
37pub struct GetLoanVipAccruedInterestV1Params {
38    pub recv_window: i64,
39    pub timestamp: i64,
40    pub order_id: Option<i64>,
41    pub loan_coin: Option<String>,
42    pub start_time: Option<i64>,
43    pub end_time: Option<i64>,
44    /// Current querying page. Start from 1; default: 1; max: 1000
45    pub current: Option<i64>,
46    /// Default: 10; max: 100
47    pub limit: Option<i64>
48}
49
50/// struct for passing parameters to the method [`get_loan_vip_collateral_account_v1`]
51#[derive(Clone, Debug, Default)]
52pub struct GetLoanVipCollateralAccountV1Params {
53    pub timestamp: i64,
54    pub order_id: Option<i64>,
55    pub collateral_account_id: Option<i64>,
56    pub recv_window: Option<i64>
57}
58
59/// struct for passing parameters to the method [`get_loan_vip_collateral_data_v1`]
60#[derive(Clone, Debug, Default)]
61pub struct GetLoanVipCollateralDataV1Params {
62    pub timestamp: i64,
63    pub collateral_coin: Option<String>,
64    pub recv_window: Option<i64>
65}
66
67/// struct for passing parameters to the method [`get_loan_vip_interest_rate_history_v1`]
68#[derive(Clone, Debug, Default)]
69pub struct GetLoanVipInterestRateHistoryV1Params {
70    pub coin: String,
71    pub recv_window: i64,
72    pub timestamp: i64,
73    pub start_time: Option<i64>,
74    pub end_time: Option<i64>,
75    /// Check current querying page, start from 1. Default:1;Max:1000.
76    pub current: Option<i64>,
77    /// Default:10; Max:100.
78    pub limit: Option<i64>
79}
80
81/// struct for passing parameters to the method [`get_loan_vip_loanable_data_v1`]
82#[derive(Clone, Debug, Default)]
83pub struct GetLoanVipLoanableDataV1Params {
84    pub timestamp: i64,
85    pub loan_coin: Option<String>,
86    /// default:user&#39;s vip level
87    pub vip_level: Option<i32>,
88    pub recv_window: Option<i64>
89}
90
91/// struct for passing parameters to the method [`get_loan_vip_ongoing_orders_v1`]
92#[derive(Clone, Debug, Default)]
93pub struct GetLoanVipOngoingOrdersV1Params {
94    pub timestamp: i64,
95    pub order_id: Option<i64>,
96    pub collateral_account_id: Option<i64>,
97    pub loan_coin: Option<String>,
98    pub collateral_coin: Option<String>,
99    /// Currently querying page. Start from 1, Default:1, Max: 1000.
100    pub current: Option<i64>,
101    /// Default: 10, Max: 100
102    pub limit: Option<i64>,
103    pub recv_window: Option<i64>
104}
105
106/// struct for passing parameters to the method [`get_loan_vip_repay_history_v1`]
107#[derive(Clone, Debug, Default)]
108pub struct GetLoanVipRepayHistoryV1Params {
109    pub timestamp: i64,
110    pub order_id: Option<i64>,
111    pub loan_coin: Option<String>,
112    pub start_time: Option<i64>,
113    pub end_time: Option<i64>,
114    /// Currently querying page. Start from 1, Default:1, Max: 1000
115    pub current: Option<i64>,
116    /// Default: 10, Max: 100
117    pub limit: Option<i64>,
118    pub recv_window: Option<i64>
119}
120
121/// struct for passing parameters to the method [`get_loan_vip_request_data_v1`]
122#[derive(Clone, Debug, Default)]
123pub struct GetLoanVipRequestDataV1Params {
124    pub timestamp: i64,
125    /// Currently querying page. Start from 1, Default:1, Max: 1000
126    pub current: Option<i64>,
127    /// Default: 10, Max: 100
128    pub limit: Option<i64>,
129    pub recv_window: Option<i64>
130}
131
132/// struct for passing parameters to the method [`get_loan_vip_request_interest_rate_v1`]
133#[derive(Clone, Debug, Default)]
134pub struct GetLoanVipRequestInterestRateV1Params {
135    /// Max 10 assets, Multiple split by &#34;,&#34;
136    pub loan_coin: String,
137    pub timestamp: i64,
138    pub recv_window: Option<i64>
139}
140
141
142/// struct for typed errors of method [`create_loan_vip_borrow_v1`]
143#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum CreateLoanVipBorrowV1Error {
146    Status4XX(models::ApiError),
147    Status5XX(models::ApiError),
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`create_loan_vip_renew_v1`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum CreateLoanVipRenewV1Error {
155    Status4XX(models::ApiError),
156    Status5XX(models::ApiError),
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`create_loan_vip_repay_v1`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum CreateLoanVipRepayV1Error {
164    Status4XX(models::ApiError),
165    Status5XX(models::ApiError),
166    UnknownValue(serde_json::Value),
167}
168
169/// struct for typed errors of method [`get_loan_vip_accrued_interest_v1`]
170#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum GetLoanVipAccruedInterestV1Error {
173    Status4XX(models::ApiError),
174    Status5XX(models::ApiError),
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`get_loan_vip_collateral_account_v1`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum GetLoanVipCollateralAccountV1Error {
182    Status4XX(models::ApiError),
183    Status5XX(models::ApiError),
184    UnknownValue(serde_json::Value),
185}
186
187/// struct for typed errors of method [`get_loan_vip_collateral_data_v1`]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum GetLoanVipCollateralDataV1Error {
191    Status4XX(models::ApiError),
192    Status5XX(models::ApiError),
193    UnknownValue(serde_json::Value),
194}
195
196/// struct for typed errors of method [`get_loan_vip_interest_rate_history_v1`]
197#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum GetLoanVipInterestRateHistoryV1Error {
200    Status4XX(models::ApiError),
201    Status5XX(models::ApiError),
202    UnknownValue(serde_json::Value),
203}
204
205/// struct for typed errors of method [`get_loan_vip_loanable_data_v1`]
206#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum GetLoanVipLoanableDataV1Error {
209    Status4XX(models::ApiError),
210    Status5XX(models::ApiError),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`get_loan_vip_ongoing_orders_v1`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum GetLoanVipOngoingOrdersV1Error {
218    Status4XX(models::ApiError),
219    Status5XX(models::ApiError),
220    UnknownValue(serde_json::Value),
221}
222
223/// struct for typed errors of method [`get_loan_vip_repay_history_v1`]
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum GetLoanVipRepayHistoryV1Error {
227    Status4XX(models::ApiError),
228    Status5XX(models::ApiError),
229    UnknownValue(serde_json::Value),
230}
231
232/// struct for typed errors of method [`get_loan_vip_request_data_v1`]
233#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum GetLoanVipRequestDataV1Error {
236    Status4XX(models::ApiError),
237    Status5XX(models::ApiError),
238    UnknownValue(serde_json::Value),
239}
240
241/// struct for typed errors of method [`get_loan_vip_request_interest_rate_v1`]
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum GetLoanVipRequestInterestRateV1Error {
245    Status4XX(models::ApiError),
246    Status5XX(models::ApiError),
247    UnknownValue(serde_json::Value),
248}
249
250
251/// VIP loan is available for VIP users only.
252pub async fn create_loan_vip_borrow_v1(configuration: &configuration::Configuration) -> Result<models::CreateLoanVipBorrowV1Resp, Error<CreateLoanVipBorrowV1Error>> {
253
254    let uri_str = format!("{}/sapi/v1/loan/vip/borrow", configuration.base_path);
255    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
256
257    // Create a mutable vector for query parameters
258    let mut query_params: Vec<(String, String)> = Vec::new();
259
260
261    // Create header parameters collection
262    let mut header_params = std::collections::HashMap::new();
263
264    // Handle Binance Auth first if configured
265    if let Some(ref binance_auth) = configuration.binance_auth {
266        // Add API key to headers
267        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
268        
269        // Generate request body for signing (if any)
270        let body_string: Option<Vec<u8>> = None;
271        
272        // Sign the request
273        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
274            Ok(sig) => sig,
275            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
276        };
277        
278        // Add signature to query params
279        query_params.push(("signature".to_string(), signature));
280    }
281
282    // Apply all query parameters
283    if !query_params.is_empty() {
284        req_builder = req_builder.query(&query_params);
285    }
286
287
288    // Add user agent if configured
289    if let Some(ref user_agent) = configuration.user_agent {
290        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
291    }
292
293    // Apply all header parameters
294    for (header_name, header_value) in header_params {
295        req_builder = req_builder.header(&header_name, &header_value);
296    }
297
298
299    let req = req_builder.build()?;
300    let resp = configuration.client.execute(req).await?;
301
302    let status = resp.status();
303    let content_type = resp
304        .headers()
305        .get("content-type")
306        .and_then(|v| v.to_str().ok())
307        .unwrap_or("application/octet-stream");
308    let content_type = super::ContentType::from(content_type);
309
310    if !status.is_client_error() && !status.is_server_error() {
311        let content = resp.text().await?;
312        match content_type {
313            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
314            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateLoanVipBorrowV1Resp`"))),
315            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::CreateLoanVipBorrowV1Resp`")))),
316        }
317    } else {
318        let content = resp.text().await?;
319        let entity: Option<CreateLoanVipBorrowV1Error> = serde_json::from_str(&content).ok();
320        Err(Error::ResponseError(ResponseContent { status, content, entity }))
321    }
322}
323
324/// VIP loan is available for VIP users only.
325pub async fn create_loan_vip_renew_v1(configuration: &configuration::Configuration, params: CreateLoanVipRenewV1Params) -> Result<models::CreateLoanVipRenewV1Resp, Error<CreateLoanVipRenewV1Error>> {
326
327    let uri_str = format!("{}/sapi/v1/loan/vip/renew", configuration.base_path);
328    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
329
330    // Create a mutable vector for query parameters
331    let mut query_params: Vec<(String, String)> = Vec::new();
332
333
334    // Create header parameters collection
335    let mut header_params = std::collections::HashMap::new();
336
337    // Handle Binance Auth first if configured
338    if let Some(ref binance_auth) = configuration.binance_auth {
339        // Add API key to headers
340        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
341        
342        // Generate request body for signing (if any)
343        let body_string: Option<Vec<u8>> = None;
344        
345        // Sign the request
346        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
347            Ok(sig) => sig,
348            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
349        };
350        
351        // Add signature to query params
352        query_params.push(("signature".to_string(), signature));
353    }
354
355    // Apply all query parameters
356    if !query_params.is_empty() {
357        req_builder = req_builder.query(&query_params);
358    }
359
360
361    // Add user agent if configured
362    if let Some(ref user_agent) = configuration.user_agent {
363        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
364    }
365
366    // Apply all header parameters
367    for (header_name, header_value) in header_params {
368        req_builder = req_builder.header(&header_name, &header_value);
369    }
370
371    let mut multipart_form_params = std::collections::HashMap::new();
372    multipart_form_params.insert("loanTerm", params.loan_term.to_string());
373    multipart_form_params.insert("orderId", params.order_id.to_string());
374    if let Some(param_value) = params.recv_window {
375        multipart_form_params.insert("recvWindow", param_value.to_string());
376    }
377    multipart_form_params.insert("timestamp", params.timestamp.to_string());
378    req_builder = req_builder.form(&multipart_form_params);
379
380    let req = req_builder.build()?;
381    let resp = configuration.client.execute(req).await?;
382
383    let status = resp.status();
384    let content_type = resp
385        .headers()
386        .get("content-type")
387        .and_then(|v| v.to_str().ok())
388        .unwrap_or("application/octet-stream");
389    let content_type = super::ContentType::from(content_type);
390
391    if !status.is_client_error() && !status.is_server_error() {
392        let content = resp.text().await?;
393        match content_type {
394            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
395            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateLoanVipRenewV1Resp`"))),
396            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateLoanVipRenewV1Resp`")))),
397        }
398    } else {
399        let content = resp.text().await?;
400        let entity: Option<CreateLoanVipRenewV1Error> = serde_json::from_str(&content).ok();
401        Err(Error::ResponseError(ResponseContent { status, content, entity }))
402    }
403}
404
405/// VIP loan is available for VIP users only.
406pub async fn create_loan_vip_repay_v1(configuration: &configuration::Configuration, params: CreateLoanVipRepayV1Params) -> Result<models::CreateLoanVipRepayV1Resp, Error<CreateLoanVipRepayV1Error>> {
407
408    let uri_str = format!("{}/sapi/v1/loan/vip/repay", configuration.base_path);
409    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
410
411    // Create a mutable vector for query parameters
412    let mut query_params: Vec<(String, String)> = Vec::new();
413
414
415    // Create header parameters collection
416    let mut header_params = std::collections::HashMap::new();
417
418    // Handle Binance Auth first if configured
419    if let Some(ref binance_auth) = configuration.binance_auth {
420        // Add API key to headers
421        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
422        
423        // Generate request body for signing (if any)
424        let body_string: Option<Vec<u8>> = None;
425        
426        // Sign the request
427        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
428            Ok(sig) => sig,
429            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
430        };
431        
432        // Add signature to query params
433        query_params.push(("signature".to_string(), signature));
434    }
435
436    // Apply all query parameters
437    if !query_params.is_empty() {
438        req_builder = req_builder.query(&query_params);
439    }
440
441
442    // Add user agent if configured
443    if let Some(ref user_agent) = configuration.user_agent {
444        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
445    }
446
447    // Apply all header parameters
448    for (header_name, header_value) in header_params {
449        req_builder = req_builder.header(&header_name, &header_value);
450    }
451
452    let mut multipart_form_params = std::collections::HashMap::new();
453    multipart_form_params.insert("amount", params.amount.to_string());
454    multipart_form_params.insert("orderId", params.order_id.to_string());
455    if let Some(param_value) = params.recv_window {
456        multipart_form_params.insert("recvWindow", param_value.to_string());
457    }
458    multipart_form_params.insert("timestamp", params.timestamp.to_string());
459    req_builder = req_builder.form(&multipart_form_params);
460
461    let req = req_builder.build()?;
462    let resp = configuration.client.execute(req).await?;
463
464    let status = resp.status();
465    let content_type = resp
466        .headers()
467        .get("content-type")
468        .and_then(|v| v.to_str().ok())
469        .unwrap_or("application/octet-stream");
470    let content_type = super::ContentType::from(content_type);
471
472    if !status.is_client_error() && !status.is_server_error() {
473        let content = resp.text().await?;
474        match content_type {
475            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
476            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateLoanVipRepayV1Resp`"))),
477            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::CreateLoanVipRepayV1Resp`")))),
478        }
479    } else {
480        let content = resp.text().await?;
481        let entity: Option<CreateLoanVipRepayV1Error> = serde_json::from_str(&content).ok();
482        Err(Error::ResponseError(ResponseContent { status, content, entity }))
483    }
484}
485
486/// GET /sapi/v1/loan/vip/accruedInterest
487pub async fn get_loan_vip_accrued_interest_v1(configuration: &configuration::Configuration, params: GetLoanVipAccruedInterestV1Params) -> Result<models::GetLoanVipAccruedInterestV1Resp, Error<GetLoanVipAccruedInterestV1Error>> {
488
489    let uri_str = format!("{}/sapi/v1/loan/vip/accruedInterest", configuration.base_path);
490    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
491
492    // Create a mutable vector for query parameters
493    let mut query_params: Vec<(String, String)> = Vec::new();
494
495    if let Some(ref param_value) = params.order_id {
496        query_params.push(("orderId".to_string(), param_value.to_string()));
497    }
498    if let Some(ref param_value) = params.loan_coin {
499        query_params.push(("loanCoin".to_string(), param_value.to_string()));
500    }
501    if let Some(ref param_value) = params.start_time {
502        query_params.push(("startTime".to_string(), param_value.to_string()));
503    }
504    if let Some(ref param_value) = params.end_time {
505        query_params.push(("endTime".to_string(), param_value.to_string()));
506    }
507    if let Some(ref param_value) = params.current {
508        query_params.push(("current".to_string(), param_value.to_string()));
509    }
510    if let Some(ref param_value) = params.limit {
511        query_params.push(("limit".to_string(), param_value.to_string()));
512    }
513    query_params.push(("recvWindow".to_string(), params.recv_window.to_string()));
514    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
515
516    // Create header parameters collection
517    let mut header_params = std::collections::HashMap::new();
518
519    // Handle Binance Auth first if configured
520    if let Some(ref binance_auth) = configuration.binance_auth {
521        // Add API key to headers
522        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
523        
524        // Generate request body for signing (if any)
525        let body_string: Option<Vec<u8>> = None;
526        
527        // Sign the request
528        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
529            Ok(sig) => sig,
530            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
531        };
532        
533        // Add signature to query params
534        query_params.push(("signature".to_string(), signature));
535    }
536
537    // Apply all query parameters
538    if !query_params.is_empty() {
539        req_builder = req_builder.query(&query_params);
540    }
541
542
543    // Add user agent if configured
544    if let Some(ref user_agent) = configuration.user_agent {
545        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
546    }
547
548    // Apply all header parameters
549    for (header_name, header_value) in header_params {
550        req_builder = req_builder.header(&header_name, &header_value);
551    }
552
553
554    let req = req_builder.build()?;
555    let resp = configuration.client.execute(req).await?;
556
557    let status = resp.status();
558    let content_type = resp
559        .headers()
560        .get("content-type")
561        .and_then(|v| v.to_str().ok())
562        .unwrap_or("application/octet-stream");
563    let content_type = super::ContentType::from(content_type);
564
565    if !status.is_client_error() && !status.is_server_error() {
566        let content = resp.text().await?;
567        match content_type {
568            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
569            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLoanVipAccruedInterestV1Resp`"))),
570            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::GetLoanVipAccruedInterestV1Resp`")))),
571        }
572    } else {
573        let content = resp.text().await?;
574        let entity: Option<GetLoanVipAccruedInterestV1Error> = serde_json::from_str(&content).ok();
575        Err(Error::ResponseError(ResponseContent { status, content, entity }))
576    }
577}
578
579/// VIP loan is available for VIP users only
580pub async fn get_loan_vip_collateral_account_v1(configuration: &configuration::Configuration, params: GetLoanVipCollateralAccountV1Params) -> Result<models::GetLoanVipCollateralAccountV1Resp, Error<GetLoanVipCollateralAccountV1Error>> {
581
582    let uri_str = format!("{}/sapi/v1/loan/vip/collateral/account", configuration.base_path);
583    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
584
585    // Create a mutable vector for query parameters
586    let mut query_params: Vec<(String, String)> = Vec::new();
587
588    if let Some(ref param_value) = params.order_id {
589        query_params.push(("orderId".to_string(), param_value.to_string()));
590    }
591    if let Some(ref param_value) = params.collateral_account_id {
592        query_params.push(("collateralAccountId".to_string(), param_value.to_string()));
593    }
594    if let Some(ref param_value) = params.recv_window {
595        query_params.push(("recvWindow".to_string(), param_value.to_string()));
596    }
597    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
598
599    // Create header parameters collection
600    let mut header_params = std::collections::HashMap::new();
601
602    // Handle Binance Auth first if configured
603    if let Some(ref binance_auth) = configuration.binance_auth {
604        // Add API key to headers
605        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
606        
607        // Generate request body for signing (if any)
608        let body_string: Option<Vec<u8>> = None;
609        
610        // Sign the request
611        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
612            Ok(sig) => sig,
613            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
614        };
615        
616        // Add signature to query params
617        query_params.push(("signature".to_string(), signature));
618    }
619
620    // Apply all query parameters
621    if !query_params.is_empty() {
622        req_builder = req_builder.query(&query_params);
623    }
624
625
626    // Add user agent if configured
627    if let Some(ref user_agent) = configuration.user_agent {
628        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
629    }
630
631    // Apply all header parameters
632    for (header_name, header_value) in header_params {
633        req_builder = req_builder.header(&header_name, &header_value);
634    }
635
636
637    let req = req_builder.build()?;
638    let resp = configuration.client.execute(req).await?;
639
640    let status = resp.status();
641    let content_type = resp
642        .headers()
643        .get("content-type")
644        .and_then(|v| v.to_str().ok())
645        .unwrap_or("application/octet-stream");
646    let content_type = super::ContentType::from(content_type);
647
648    if !status.is_client_error() && !status.is_server_error() {
649        let content = resp.text().await?;
650        match content_type {
651            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
652            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLoanVipCollateralAccountV1Resp`"))),
653            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::GetLoanVipCollateralAccountV1Resp`")))),
654        }
655    } else {
656        let content = resp.text().await?;
657        let entity: Option<GetLoanVipCollateralAccountV1Error> = serde_json::from_str(&content).ok();
658        Err(Error::ResponseError(ResponseContent { status, content, entity }))
659    }
660}
661
662/// Get Collateral Asset Data
663pub async fn get_loan_vip_collateral_data_v1(configuration: &configuration::Configuration, params: GetLoanVipCollateralDataV1Params) -> Result<models::GetLoanVipCollateralDataV1Resp, Error<GetLoanVipCollateralDataV1Error>> {
664
665    let uri_str = format!("{}/sapi/v1/loan/vip/collateral/data", configuration.base_path);
666    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
667
668    // Create a mutable vector for query parameters
669    let mut query_params: Vec<(String, String)> = Vec::new();
670
671    if let Some(ref param_value) = params.collateral_coin {
672        query_params.push(("collateralCoin".to_string(), param_value.to_string()));
673    }
674    if let Some(ref param_value) = params.recv_window {
675        query_params.push(("recvWindow".to_string(), param_value.to_string()));
676    }
677    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
678
679    // Create header parameters collection
680    let mut header_params = std::collections::HashMap::new();
681
682    // Handle Binance Auth first if configured
683    if let Some(ref binance_auth) = configuration.binance_auth {
684        // Add API key to headers
685        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
686        
687        // Generate request body for signing (if any)
688        let body_string: Option<Vec<u8>> = None;
689        
690        // Sign the request
691        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
692            Ok(sig) => sig,
693            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
694        };
695        
696        // Add signature to query params
697        query_params.push(("signature".to_string(), signature));
698    }
699
700    // Apply all query parameters
701    if !query_params.is_empty() {
702        req_builder = req_builder.query(&query_params);
703    }
704
705
706    // Add user agent if configured
707    if let Some(ref user_agent) = configuration.user_agent {
708        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
709    }
710
711    // Apply all header parameters
712    for (header_name, header_value) in header_params {
713        req_builder = req_builder.header(&header_name, &header_value);
714    }
715
716
717    let req = req_builder.build()?;
718    let resp = configuration.client.execute(req).await?;
719
720    let status = resp.status();
721    let content_type = resp
722        .headers()
723        .get("content-type")
724        .and_then(|v| v.to_str().ok())
725        .unwrap_or("application/octet-stream");
726    let content_type = super::ContentType::from(content_type);
727
728    if !status.is_client_error() && !status.is_server_error() {
729        let content = resp.text().await?;
730        match content_type {
731            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
732            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLoanVipCollateralDataV1Resp`"))),
733            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::GetLoanVipCollateralDataV1Resp`")))),
734        }
735    } else {
736        let content = resp.text().await?;
737        let entity: Option<GetLoanVipCollateralDataV1Error> = serde_json::from_str(&content).ok();
738        Err(Error::ResponseError(ResponseContent { status, content, entity }))
739    }
740}
741
742/// Get VIP Loan Interest Rate History
743pub async fn get_loan_vip_interest_rate_history_v1(configuration: &configuration::Configuration, params: GetLoanVipInterestRateHistoryV1Params) -> Result<models::GetLoanVipInterestRateHistoryV1Resp, Error<GetLoanVipInterestRateHistoryV1Error>> {
744
745    let uri_str = format!("{}/sapi/v1/loan/vip/interestRateHistory", configuration.base_path);
746    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
747
748    // Create a mutable vector for query parameters
749    let mut query_params: Vec<(String, String)> = Vec::new();
750
751    query_params.push(("coin".to_string(), params.coin.to_string()));
752    if let Some(ref param_value) = params.start_time {
753        query_params.push(("startTime".to_string(), param_value.to_string()));
754    }
755    if let Some(ref param_value) = params.end_time {
756        query_params.push(("endTime".to_string(), param_value.to_string()));
757    }
758    if let Some(ref param_value) = params.current {
759        query_params.push(("current".to_string(), param_value.to_string()));
760    }
761    if let Some(ref param_value) = params.limit {
762        query_params.push(("limit".to_string(), param_value.to_string()));
763    }
764    query_params.push(("recvWindow".to_string(), params.recv_window.to_string()));
765    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
766
767    // Create header parameters collection
768    let mut header_params = std::collections::HashMap::new();
769
770    // Handle Binance Auth first if configured
771    if let Some(ref binance_auth) = configuration.binance_auth {
772        // Add API key to headers
773        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
774        
775        // Generate request body for signing (if any)
776        let body_string: Option<Vec<u8>> = None;
777        
778        // Sign the request
779        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
780            Ok(sig) => sig,
781            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
782        };
783        
784        // Add signature to query params
785        query_params.push(("signature".to_string(), signature));
786    }
787
788    // Apply all query parameters
789    if !query_params.is_empty() {
790        req_builder = req_builder.query(&query_params);
791    }
792
793
794    // Add user agent if configured
795    if let Some(ref user_agent) = configuration.user_agent {
796        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
797    }
798
799    // Apply all header parameters
800    for (header_name, header_value) in header_params {
801        req_builder = req_builder.header(&header_name, &header_value);
802    }
803
804
805    let req = req_builder.build()?;
806    let resp = configuration.client.execute(req).await?;
807
808    let status = resp.status();
809    let content_type = resp
810        .headers()
811        .get("content-type")
812        .and_then(|v| v.to_str().ok())
813        .unwrap_or("application/octet-stream");
814    let content_type = super::ContentType::from(content_type);
815
816    if !status.is_client_error() && !status.is_server_error() {
817        let content = resp.text().await?;
818        match content_type {
819            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
820            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLoanVipInterestRateHistoryV1Resp`"))),
821            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::GetLoanVipInterestRateHistoryV1Resp`")))),
822        }
823    } else {
824        let content = resp.text().await?;
825        let entity: Option<GetLoanVipInterestRateHistoryV1Error> = serde_json::from_str(&content).ok();
826        Err(Error::ResponseError(ResponseContent { status, content, entity }))
827    }
828}
829
830/// Get interest rate and borrow limit of loanable assets. The borrow limit is shown in USD value.
831pub async fn get_loan_vip_loanable_data_v1(configuration: &configuration::Configuration, params: GetLoanVipLoanableDataV1Params) -> Result<models::GetLoanVipLoanableDataV1Resp, Error<GetLoanVipLoanableDataV1Error>> {
832
833    let uri_str = format!("{}/sapi/v1/loan/vip/loanable/data", configuration.base_path);
834    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
835
836    // Create a mutable vector for query parameters
837    let mut query_params: Vec<(String, String)> = Vec::new();
838
839    if let Some(ref param_value) = params.loan_coin {
840        query_params.push(("loanCoin".to_string(), param_value.to_string()));
841    }
842    if let Some(ref param_value) = params.vip_level {
843        query_params.push(("vipLevel".to_string(), param_value.to_string()));
844    }
845    if let Some(ref param_value) = params.recv_window {
846        query_params.push(("recvWindow".to_string(), param_value.to_string()));
847    }
848    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
849
850    // Create header parameters collection
851    let mut header_params = std::collections::HashMap::new();
852
853    // Handle Binance Auth first if configured
854    if let Some(ref binance_auth) = configuration.binance_auth {
855        // Add API key to headers
856        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
857        
858        // Generate request body for signing (if any)
859        let body_string: Option<Vec<u8>> = None;
860        
861        // Sign the request
862        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
863            Ok(sig) => sig,
864            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
865        };
866        
867        // Add signature to query params
868        query_params.push(("signature".to_string(), signature));
869    }
870
871    // Apply all query parameters
872    if !query_params.is_empty() {
873        req_builder = req_builder.query(&query_params);
874    }
875
876
877    // Add user agent if configured
878    if let Some(ref user_agent) = configuration.user_agent {
879        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
880    }
881
882    // Apply all header parameters
883    for (header_name, header_value) in header_params {
884        req_builder = req_builder.header(&header_name, &header_value);
885    }
886
887
888    let req = req_builder.build()?;
889    let resp = configuration.client.execute(req).await?;
890
891    let status = resp.status();
892    let content_type = resp
893        .headers()
894        .get("content-type")
895        .and_then(|v| v.to_str().ok())
896        .unwrap_or("application/octet-stream");
897    let content_type = super::ContentType::from(content_type);
898
899    if !status.is_client_error() && !status.is_server_error() {
900        let content = resp.text().await?;
901        match content_type {
902            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
903            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLoanVipLoanableDataV1Resp`"))),
904            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::GetLoanVipLoanableDataV1Resp`")))),
905        }
906    } else {
907        let content = resp.text().await?;
908        let entity: Option<GetLoanVipLoanableDataV1Error> = serde_json::from_str(&content).ok();
909        Err(Error::ResponseError(ResponseContent { status, content, entity }))
910    }
911}
912
913/// VIP loan is available for VIP users only.
914pub async fn get_loan_vip_ongoing_orders_v1(configuration: &configuration::Configuration, params: GetLoanVipOngoingOrdersV1Params) -> Result<models::GetLoanVipOngoingOrdersV1Resp, Error<GetLoanVipOngoingOrdersV1Error>> {
915
916    let uri_str = format!("{}/sapi/v1/loan/vip/ongoing/orders", configuration.base_path);
917    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
918
919    // Create a mutable vector for query parameters
920    let mut query_params: Vec<(String, String)> = Vec::new();
921
922    if let Some(ref param_value) = params.order_id {
923        query_params.push(("orderId".to_string(), param_value.to_string()));
924    }
925    if let Some(ref param_value) = params.collateral_account_id {
926        query_params.push(("collateralAccountId".to_string(), param_value.to_string()));
927    }
928    if let Some(ref param_value) = params.loan_coin {
929        query_params.push(("loanCoin".to_string(), param_value.to_string()));
930    }
931    if let Some(ref param_value) = params.collateral_coin {
932        query_params.push(("collateralCoin".to_string(), param_value.to_string()));
933    }
934    if let Some(ref param_value) = params.current {
935        query_params.push(("current".to_string(), param_value.to_string()));
936    }
937    if let Some(ref param_value) = params.limit {
938        query_params.push(("limit".to_string(), param_value.to_string()));
939    }
940    if let Some(ref param_value) = params.recv_window {
941        query_params.push(("recvWindow".to_string(), param_value.to_string()));
942    }
943    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
944
945    // Create header parameters collection
946    let mut header_params = std::collections::HashMap::new();
947
948    // Handle Binance Auth first if configured
949    if let Some(ref binance_auth) = configuration.binance_auth {
950        // Add API key to headers
951        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
952        
953        // Generate request body for signing (if any)
954        let body_string: Option<Vec<u8>> = None;
955        
956        // Sign the request
957        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
958            Ok(sig) => sig,
959            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
960        };
961        
962        // Add signature to query params
963        query_params.push(("signature".to_string(), signature));
964    }
965
966    // Apply all query parameters
967    if !query_params.is_empty() {
968        req_builder = req_builder.query(&query_params);
969    }
970
971
972    // Add user agent if configured
973    if let Some(ref user_agent) = configuration.user_agent {
974        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
975    }
976
977    // Apply all header parameters
978    for (header_name, header_value) in header_params {
979        req_builder = req_builder.header(&header_name, &header_value);
980    }
981
982
983    let req = req_builder.build()?;
984    let resp = configuration.client.execute(req).await?;
985
986    let status = resp.status();
987    let content_type = resp
988        .headers()
989        .get("content-type")
990        .and_then(|v| v.to_str().ok())
991        .unwrap_or("application/octet-stream");
992    let content_type = super::ContentType::from(content_type);
993
994    if !status.is_client_error() && !status.is_server_error() {
995        let content = resp.text().await?;
996        match content_type {
997            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
998            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLoanVipOngoingOrdersV1Resp`"))),
999            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::GetLoanVipOngoingOrdersV1Resp`")))),
1000        }
1001    } else {
1002        let content = resp.text().await?;
1003        let entity: Option<GetLoanVipOngoingOrdersV1Error> = serde_json::from_str(&content).ok();
1004        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1005    }
1006}
1007
1008/// GET /sapi/v1/loan/vip/repay/history
1009pub async fn get_loan_vip_repay_history_v1(configuration: &configuration::Configuration, params: GetLoanVipRepayHistoryV1Params) -> Result<models::GetLoanVipRepayHistoryV1Resp, Error<GetLoanVipRepayHistoryV1Error>> {
1010
1011    let uri_str = format!("{}/sapi/v1/loan/vip/repay/history", configuration.base_path);
1012    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1013
1014    // Create a mutable vector for query parameters
1015    let mut query_params: Vec<(String, String)> = Vec::new();
1016
1017    if let Some(ref param_value) = params.order_id {
1018        query_params.push(("orderId".to_string(), param_value.to_string()));
1019    }
1020    if let Some(ref param_value) = params.loan_coin {
1021        query_params.push(("loanCoin".to_string(), param_value.to_string()));
1022    }
1023    if let Some(ref param_value) = params.start_time {
1024        query_params.push(("startTime".to_string(), param_value.to_string()));
1025    }
1026    if let Some(ref param_value) = params.end_time {
1027        query_params.push(("endTime".to_string(), param_value.to_string()));
1028    }
1029    if let Some(ref param_value) = params.current {
1030        query_params.push(("current".to_string(), param_value.to_string()));
1031    }
1032    if let Some(ref param_value) = params.limit {
1033        query_params.push(("limit".to_string(), param_value.to_string()));
1034    }
1035    if let Some(ref param_value) = params.recv_window {
1036        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1037    }
1038    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1039
1040    // Create header parameters collection
1041    let mut header_params = std::collections::HashMap::new();
1042
1043    // Handle Binance Auth first if configured
1044    if let Some(ref binance_auth) = configuration.binance_auth {
1045        // Add API key to headers
1046        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1047        
1048        // Generate request body for signing (if any)
1049        let body_string: Option<Vec<u8>> = None;
1050        
1051        // Sign the request
1052        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1053            Ok(sig) => sig,
1054            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1055        };
1056        
1057        // Add signature to query params
1058        query_params.push(("signature".to_string(), signature));
1059    }
1060
1061    // Apply all query parameters
1062    if !query_params.is_empty() {
1063        req_builder = req_builder.query(&query_params);
1064    }
1065
1066
1067    // Add user agent if configured
1068    if let Some(ref user_agent) = configuration.user_agent {
1069        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1070    }
1071
1072    // Apply all header parameters
1073    for (header_name, header_value) in header_params {
1074        req_builder = req_builder.header(&header_name, &header_value);
1075    }
1076
1077
1078    let req = req_builder.build()?;
1079    let resp = configuration.client.execute(req).await?;
1080
1081    let status = resp.status();
1082    let content_type = resp
1083        .headers()
1084        .get("content-type")
1085        .and_then(|v| v.to_str().ok())
1086        .unwrap_or("application/octet-stream");
1087    let content_type = super::ContentType::from(content_type);
1088
1089    if !status.is_client_error() && !status.is_server_error() {
1090        let content = resp.text().await?;
1091        match content_type {
1092            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1093            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLoanVipRepayHistoryV1Resp`"))),
1094            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::GetLoanVipRepayHistoryV1Resp`")))),
1095        }
1096    } else {
1097        let content = resp.text().await?;
1098        let entity: Option<GetLoanVipRepayHistoryV1Error> = serde_json::from_str(&content).ok();
1099        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1100    }
1101}
1102
1103/// Query Application Status
1104pub async fn get_loan_vip_request_data_v1(configuration: &configuration::Configuration, params: GetLoanVipRequestDataV1Params) -> Result<models::GetLoanVipRequestDataV1Resp, Error<GetLoanVipRequestDataV1Error>> {
1105
1106    let uri_str = format!("{}/sapi/v1/loan/vip/request/data", configuration.base_path);
1107    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1108
1109    // Create a mutable vector for query parameters
1110    let mut query_params: Vec<(String, String)> = Vec::new();
1111
1112    if let Some(ref param_value) = params.current {
1113        query_params.push(("current".to_string(), param_value.to_string()));
1114    }
1115    if let Some(ref param_value) = params.limit {
1116        query_params.push(("limit".to_string(), param_value.to_string()));
1117    }
1118    if let Some(ref param_value) = params.recv_window {
1119        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1120    }
1121    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1122
1123    // Create header parameters collection
1124    let mut header_params = std::collections::HashMap::new();
1125
1126    // Handle Binance Auth first if configured
1127    if let Some(ref binance_auth) = configuration.binance_auth {
1128        // Add API key to headers
1129        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1130        
1131        // Generate request body for signing (if any)
1132        let body_string: Option<Vec<u8>> = None;
1133        
1134        // Sign the request
1135        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1136            Ok(sig) => sig,
1137            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1138        };
1139        
1140        // Add signature to query params
1141        query_params.push(("signature".to_string(), signature));
1142    }
1143
1144    // Apply all query parameters
1145    if !query_params.is_empty() {
1146        req_builder = req_builder.query(&query_params);
1147    }
1148
1149
1150    // Add user agent if configured
1151    if let Some(ref user_agent) = configuration.user_agent {
1152        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1153    }
1154
1155    // Apply all header parameters
1156    for (header_name, header_value) in header_params {
1157        req_builder = req_builder.header(&header_name, &header_value);
1158    }
1159
1160
1161    let req = req_builder.build()?;
1162    let resp = configuration.client.execute(req).await?;
1163
1164    let status = resp.status();
1165    let content_type = resp
1166        .headers()
1167        .get("content-type")
1168        .and_then(|v| v.to_str().ok())
1169        .unwrap_or("application/octet-stream");
1170    let content_type = super::ContentType::from(content_type);
1171
1172    if !status.is_client_error() && !status.is_server_error() {
1173        let content = resp.text().await?;
1174        match content_type {
1175            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1176            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLoanVipRequestDataV1Resp`"))),
1177            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::GetLoanVipRequestDataV1Resp`")))),
1178        }
1179    } else {
1180        let content = resp.text().await?;
1181        let entity: Option<GetLoanVipRequestDataV1Error> = serde_json::from_str(&content).ok();
1182        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1183    }
1184}
1185
1186/// Get Borrow Interest Rate
1187pub async fn get_loan_vip_request_interest_rate_v1(configuration: &configuration::Configuration, params: GetLoanVipRequestInterestRateV1Params) -> Result<Vec<models::GetLoanVipRequestInterestRateV1RespItem>, Error<GetLoanVipRequestInterestRateV1Error>> {
1188
1189    let uri_str = format!("{}/sapi/v1/loan/vip/request/interestRate", configuration.base_path);
1190    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1191
1192    // Create a mutable vector for query parameters
1193    let mut query_params: Vec<(String, String)> = Vec::new();
1194
1195    query_params.push(("loanCoin".to_string(), params.loan_coin.to_string()));
1196    if let Some(ref param_value) = params.recv_window {
1197        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1198    }
1199    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1200
1201    // Create header parameters collection
1202    let mut header_params = std::collections::HashMap::new();
1203
1204    // Handle Binance Auth first if configured
1205    if let Some(ref binance_auth) = configuration.binance_auth {
1206        // Add API key to headers
1207        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1208        
1209        // Generate request body for signing (if any)
1210        let body_string: Option<Vec<u8>> = None;
1211        
1212        // Sign the request
1213        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1214            Ok(sig) => sig,
1215            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1216        };
1217        
1218        // Add signature to query params
1219        query_params.push(("signature".to_string(), signature));
1220    }
1221
1222    // Apply all query parameters
1223    if !query_params.is_empty() {
1224        req_builder = req_builder.query(&query_params);
1225    }
1226
1227
1228    // Add user agent if configured
1229    if let Some(ref user_agent) = configuration.user_agent {
1230        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1231    }
1232
1233    // Apply all header parameters
1234    for (header_name, header_value) in header_params {
1235        req_builder = req_builder.header(&header_name, &header_value);
1236    }
1237
1238
1239    let req = req_builder.build()?;
1240    let resp = configuration.client.execute(req).await?;
1241
1242    let status = resp.status();
1243    let content_type = resp
1244        .headers()
1245        .get("content-type")
1246        .and_then(|v| v.to_str().ok())
1247        .unwrap_or("application/octet-stream");
1248    let content_type = super::ContentType::from(content_type);
1249
1250    if !status.is_client_error() && !status.is_server_error() {
1251        let content = resp.text().await?;
1252        match content_type {
1253            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1254            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::GetLoanVipRequestInterestRateV1RespItem&gt;`"))),
1255            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::GetLoanVipRequestInterestRateV1RespItem&gt;`")))),
1256        }
1257    } else {
1258        let content = resp.text().await?;
1259        let entity: Option<GetLoanVipRequestInterestRateV1Error> = serde_json::from_str(&content).ok();
1260        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1261    }
1262}
1263