binance/spot/apis/
mining_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_mining_hash_transfer_config_cancel_v1`]
18#[derive(Clone, Debug, Default)]
19pub struct CreateMiningHashTransferConfigCancelV1Params {
20    pub config_id: i32,
21    pub timestamp: i64,
22    pub user_name: String,
23    pub recv_window: Option<i64>
24}
25
26/// struct for passing parameters to the method [`create_mining_hash_transfer_config_v1`]
27#[derive(Clone, Debug, Default)]
28pub struct CreateMiningHashTransferConfigV1Params {
29    pub algo: String,
30    pub end_date: i64,
31    pub hash_rate: i64,
32    pub start_date: i64,
33    pub timestamp: i64,
34    pub to_pool_user: String,
35    pub user_name: String,
36    pub recv_window: Option<i64>
37}
38
39/// struct for passing parameters to the method [`get_mining_hash_transfer_config_details_list_v1`]
40#[derive(Clone, Debug, Default)]
41pub struct GetMiningHashTransferConfigDetailsListV1Params {
42    pub timestamp: i64,
43    /// Page number, empty default first page, starting from 1
44    pub page_index: Option<i32>,
45    /// Number of pages, minimum 10, maximum 200
46    pub page_size: Option<i32>,
47    pub recv_window: Option<i64>
48}
49
50/// struct for passing parameters to the method [`get_mining_hash_transfer_profit_details_v1`]
51#[derive(Clone, Debug, Default)]
52pub struct GetMiningHashTransferProfitDetailsV1Params {
53    /// Mining ID
54    pub config_id: i32,
55    /// Mining Account
56    pub user_name: String,
57    pub timestamp: i64,
58    /// Page number, empty default first page, starting from 1
59    pub page_index: Option<i32>,
60    /// Number of pages, minimum 10, maximum 200
61    pub page_size: Option<i32>,
62    pub recv_window: Option<i64>
63}
64
65/// struct for passing parameters to the method [`get_mining_payment_list_v1`]
66#[derive(Clone, Debug, Default)]
67pub struct GetMiningPaymentListV1Params {
68    /// Transfer algorithm(sha256)
69    pub algo: String,
70    /// Mining account
71    pub user_name: String,
72    pub timestamp: i64,
73    /// Coin name
74    pub coin: Option<String>,
75    /// Search date, millisecond timestamp, while empty query all
76    pub start_date: Option<i64>,
77    /// Search date, millisecond timestamp, while empty query all
78    pub end_date: Option<i64>,
79    /// Page number, empty default first page, starting from 1
80    pub page_index: Option<i32>,
81    /// Number of pages, minimum 10, maximum 200
82    pub page_size: Option<i32>,
83    pub recv_window: Option<i64>
84}
85
86/// struct for passing parameters to the method [`get_mining_payment_other_v1`]
87#[derive(Clone, Debug, Default)]
88pub struct GetMiningPaymentOtherV1Params {
89    /// Transfer algorithm(sha256)
90    pub algo: String,
91    /// Mining Account
92    pub user_name: String,
93    pub timestamp: i64,
94    /// Coin Name
95    pub coin: Option<String>,
96    /// Search date, millisecond timestamp, while empty query all
97    pub start_date: Option<i64>,
98    /// Search date, millisecond timestamp, while empty query all
99    pub end_date: Option<i64>,
100    /// Page number, empty default first page, starting from 1
101    pub page_index: Option<i32>,
102    /// Number of pages, minimum 10, maximum 200
103    pub page_size: Option<i32>,
104    pub recv_window: Option<i64>
105}
106
107/// struct for passing parameters to the method [`get_mining_payment_uid_v1`]
108#[derive(Clone, Debug, Default)]
109pub struct GetMiningPaymentUidV1Params {
110    /// Algorithm(sha256)
111    pub algo: String,
112    pub timestamp: i64,
113    /// Millisecond timestamp
114    pub start_date: Option<i64>,
115    /// Millisecond timestamp
116    pub end_date: Option<i64>,
117    /// Default 1
118    pub page_index: Option<i32>,
119    /// Min 10,Max 200
120    pub page_size: Option<i32>,
121    pub recv_window: Option<i64>
122}
123
124/// struct for passing parameters to the method [`get_mining_statistics_user_list_v1`]
125#[derive(Clone, Debug, Default)]
126pub struct GetMiningStatisticsUserListV1Params {
127    /// Algorithm(sha256)
128    pub algo: String,
129    /// Mining account
130    pub user_name: String,
131    pub timestamp: i64,
132    pub recv_window: Option<i64>
133}
134
135/// struct for passing parameters to the method [`get_mining_statistics_user_status_v1`]
136#[derive(Clone, Debug, Default)]
137pub struct GetMiningStatisticsUserStatusV1Params {
138    /// Algorithm(sha256)
139    pub algo: String,
140    /// Mining account
141    pub user_name: String,
142    pub timestamp: i64,
143    pub recv_window: Option<i64>
144}
145
146/// struct for passing parameters to the method [`get_mining_worker_detail_v1`]
147#[derive(Clone, Debug, Default)]
148pub struct GetMiningWorkerDetailV1Params {
149    /// Algorithm(sha256)
150    pub algo: String,
151    /// Mining account
152    pub user_name: String,
153    /// Miner’s name(required)
154    pub worker_name: String,
155    pub timestamp: i64,
156    pub recv_window: Option<i64>
157}
158
159/// struct for passing parameters to the method [`get_mining_worker_list_v1`]
160#[derive(Clone, Debug, Default)]
161pub struct GetMiningWorkerListV1Params {
162    /// Algorithm(sha256)
163    pub algo: String,
164    /// Mining account
165    pub user_name: String,
166    pub timestamp: i64,
167    /// Page number,default is first page,start form 1
168    pub page_index: Option<i32>,
169    /// sort sequence(default=0)0 positive sequence,1 negative sequence
170    pub sort: Option<i32>,
171    /// Sort by( default 1): <br/><br/>1: miner name, <br/><br/>2: real-time computing power, <br/><br/>3: daily average computing power, <br/><br/>4: real-time rejection rate, <br/><br/>5: last submission time
172    pub sort_column: Option<i32>,
173    /// miners status(default=0),0 all,1 valid,2 invalid,3 failure
174    pub worker_status: Option<i32>,
175    pub recv_window: Option<i64>
176}
177
178
179/// struct for typed errors of method [`create_mining_hash_transfer_config_cancel_v1`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum CreateMiningHashTransferConfigCancelV1Error {
183    Status4XX(models::ApiError),
184    Status5XX(models::ApiError),
185    UnknownValue(serde_json::Value),
186}
187
188/// struct for typed errors of method [`create_mining_hash_transfer_config_v1`]
189#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum CreateMiningHashTransferConfigV1Error {
192    Status4XX(models::ApiError),
193    Status5XX(models::ApiError),
194    UnknownValue(serde_json::Value),
195}
196
197/// struct for typed errors of method [`get_mining_hash_transfer_config_details_list_v1`]
198#[derive(Debug, Clone, Serialize, Deserialize)]
199#[serde(untagged)]
200pub enum GetMiningHashTransferConfigDetailsListV1Error {
201    Status4XX(models::ApiError),
202    Status5XX(models::ApiError),
203    UnknownValue(serde_json::Value),
204}
205
206/// struct for typed errors of method [`get_mining_hash_transfer_profit_details_v1`]
207#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum GetMiningHashTransferProfitDetailsV1Error {
210    Status4XX(models::ApiError),
211    Status5XX(models::ApiError),
212    UnknownValue(serde_json::Value),
213}
214
215/// struct for typed errors of method [`get_mining_payment_list_v1`]
216#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum GetMiningPaymentListV1Error {
219    Status4XX(models::ApiError),
220    Status5XX(models::ApiError),
221    UnknownValue(serde_json::Value),
222}
223
224/// struct for typed errors of method [`get_mining_payment_other_v1`]
225#[derive(Debug, Clone, Serialize, Deserialize)]
226#[serde(untagged)]
227pub enum GetMiningPaymentOtherV1Error {
228    Status4XX(models::ApiError),
229    Status5XX(models::ApiError),
230    UnknownValue(serde_json::Value),
231}
232
233/// struct for typed errors of method [`get_mining_payment_uid_v1`]
234#[derive(Debug, Clone, Serialize, Deserialize)]
235#[serde(untagged)]
236pub enum GetMiningPaymentUidV1Error {
237    Status4XX(models::ApiError),
238    Status5XX(models::ApiError),
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`get_mining_pub_algo_list_v1`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum GetMiningPubAlgoListV1Error {
246    Status4XX(models::ApiError),
247    Status5XX(models::ApiError),
248    UnknownValue(serde_json::Value),
249}
250
251/// struct for typed errors of method [`get_mining_pub_coin_list_v1`]
252#[derive(Debug, Clone, Serialize, Deserialize)]
253#[serde(untagged)]
254pub enum GetMiningPubCoinListV1Error {
255    Status4XX(models::ApiError),
256    Status5XX(models::ApiError),
257    UnknownValue(serde_json::Value),
258}
259
260/// struct for typed errors of method [`get_mining_statistics_user_list_v1`]
261#[derive(Debug, Clone, Serialize, Deserialize)]
262#[serde(untagged)]
263pub enum GetMiningStatisticsUserListV1Error {
264    Status4XX(models::ApiError),
265    Status5XX(models::ApiError),
266    UnknownValue(serde_json::Value),
267}
268
269/// struct for typed errors of method [`get_mining_statistics_user_status_v1`]
270#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum GetMiningStatisticsUserStatusV1Error {
273    Status4XX(models::ApiError),
274    Status5XX(models::ApiError),
275    UnknownValue(serde_json::Value),
276}
277
278/// struct for typed errors of method [`get_mining_worker_detail_v1`]
279#[derive(Debug, Clone, Serialize, Deserialize)]
280#[serde(untagged)]
281pub enum GetMiningWorkerDetailV1Error {
282    Status4XX(models::ApiError),
283    Status5XX(models::ApiError),
284    UnknownValue(serde_json::Value),
285}
286
287/// struct for typed errors of method [`get_mining_worker_list_v1`]
288#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum GetMiningWorkerListV1Error {
291    Status4XX(models::ApiError),
292    Status5XX(models::ApiError),
293    UnknownValue(serde_json::Value),
294}
295
296
297pub async fn create_mining_hash_transfer_config_cancel_v1(configuration: &configuration::Configuration, params: CreateMiningHashTransferConfigCancelV1Params) -> Result<models::CreateMiningHashTransferConfigCancelV1Resp, Error<CreateMiningHashTransferConfigCancelV1Error>> {
298
299    let uri_str = format!("{}/sapi/v1/mining/hash-transfer/config/cancel", configuration.base_path);
300    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
301
302    // Create a mutable vector for query parameters
303    let mut query_params: Vec<(String, String)> = Vec::new();
304
305
306    // Create header parameters collection
307    let mut header_params = std::collections::HashMap::new();
308
309    // Handle Binance Auth first if configured
310    if let Some(ref binance_auth) = configuration.binance_auth {
311        // Add API key to headers
312        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
313        
314        // Generate request body for signing (if any)
315        let body_string: Option<Vec<u8>> = None;
316        
317        // Sign the request
318        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
319            Ok(sig) => sig,
320            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
321        };
322        
323        // Add signature to query params
324        query_params.push(("signature".to_string(), signature));
325    }
326
327    // Apply all query parameters
328    if !query_params.is_empty() {
329        req_builder = req_builder.query(&query_params);
330    }
331
332
333    // Add user agent if configured
334    if let Some(ref user_agent) = configuration.user_agent {
335        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
336    }
337
338    // Apply all header parameters
339    for (header_name, header_value) in header_params {
340        req_builder = req_builder.header(&header_name, &header_value);
341    }
342
343    let mut multipart_form_params = std::collections::HashMap::new();
344    multipart_form_params.insert("configId", params.config_id.to_string());
345    if let Some(param_value) = params.recv_window {
346        multipart_form_params.insert("recvWindow", param_value.to_string());
347    }
348    multipart_form_params.insert("timestamp", params.timestamp.to_string());
349    multipart_form_params.insert("userName", params.user_name.to_string());
350    req_builder = req_builder.form(&multipart_form_params);
351
352    let req = req_builder.build()?;
353    let resp = configuration.client.execute(req).await?;
354
355    let status = resp.status();
356    let content_type = resp
357        .headers()
358        .get("content-type")
359        .and_then(|v| v.to_str().ok())
360        .unwrap_or("application/octet-stream");
361    let content_type = super::ContentType::from(content_type);
362
363    if !status.is_client_error() && !status.is_server_error() {
364        let content = resp.text().await?;
365        match content_type {
366            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
367            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateMiningHashTransferConfigCancelV1Resp`"))),
368            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::CreateMiningHashTransferConfigCancelV1Resp`")))),
369        }
370    } else {
371        let content = resp.text().await?;
372        let entity: Option<CreateMiningHashTransferConfigCancelV1Error> = serde_json::from_str(&content).ok();
373        Err(Error::ResponseError(ResponseContent { status, content, entity }))
374    }
375}
376
377/// Hashrate Resale Request
378pub async fn create_mining_hash_transfer_config_v1(configuration: &configuration::Configuration, params: CreateMiningHashTransferConfigV1Params) -> Result<models::CreateMiningHashTransferConfigV1Resp, Error<CreateMiningHashTransferConfigV1Error>> {
379
380    let uri_str = format!("{}/sapi/v1/mining/hash-transfer/config", configuration.base_path);
381    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
382
383    // Create a mutable vector for query parameters
384    let mut query_params: Vec<(String, String)> = Vec::new();
385
386
387    // Create header parameters collection
388    let mut header_params = std::collections::HashMap::new();
389
390    // Handle Binance Auth first if configured
391    if let Some(ref binance_auth) = configuration.binance_auth {
392        // Add API key to headers
393        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
394        
395        // Generate request body for signing (if any)
396        let body_string: Option<Vec<u8>> = None;
397        
398        // Sign the request
399        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
400            Ok(sig) => sig,
401            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
402        };
403        
404        // Add signature to query params
405        query_params.push(("signature".to_string(), signature));
406    }
407
408    // Apply all query parameters
409    if !query_params.is_empty() {
410        req_builder = req_builder.query(&query_params);
411    }
412
413
414    // Add user agent if configured
415    if let Some(ref user_agent) = configuration.user_agent {
416        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
417    }
418
419    // Apply all header parameters
420    for (header_name, header_value) in header_params {
421        req_builder = req_builder.header(&header_name, &header_value);
422    }
423
424    let mut multipart_form_params = std::collections::HashMap::new();
425    multipart_form_params.insert("algo", params.algo.to_string());
426    multipart_form_params.insert("endDate", params.end_date.to_string());
427    multipart_form_params.insert("hashRate", params.hash_rate.to_string());
428    if let Some(param_value) = params.recv_window {
429        multipart_form_params.insert("recvWindow", param_value.to_string());
430    }
431    multipart_form_params.insert("startDate", params.start_date.to_string());
432    multipart_form_params.insert("timestamp", params.timestamp.to_string());
433    multipart_form_params.insert("toPoolUser", params.to_pool_user.to_string());
434    multipart_form_params.insert("userName", params.user_name.to_string());
435    req_builder = req_builder.form(&multipart_form_params);
436
437    let req = req_builder.build()?;
438    let resp = configuration.client.execute(req).await?;
439
440    let status = resp.status();
441    let content_type = resp
442        .headers()
443        .get("content-type")
444        .and_then(|v| v.to_str().ok())
445        .unwrap_or("application/octet-stream");
446    let content_type = super::ContentType::from(content_type);
447
448    if !status.is_client_error() && !status.is_server_error() {
449        let content = resp.text().await?;
450        match content_type {
451            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
452            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateMiningHashTransferConfigV1Resp`"))),
453            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::CreateMiningHashTransferConfigV1Resp`")))),
454        }
455    } else {
456        let content = resp.text().await?;
457        let entity: Option<CreateMiningHashTransferConfigV1Error> = serde_json::from_str(&content).ok();
458        Err(Error::ResponseError(ResponseContent { status, content, entity }))
459    }
460}
461
462/// Hashrate Resale List
463pub async fn get_mining_hash_transfer_config_details_list_v1(configuration: &configuration::Configuration, params: GetMiningHashTransferConfigDetailsListV1Params) -> Result<models::GetMiningHashTransferConfigDetailsListV1Resp, Error<GetMiningHashTransferConfigDetailsListV1Error>> {
464
465    let uri_str = format!("{}/sapi/v1/mining/hash-transfer/config/details/list", configuration.base_path);
466    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
467
468    // Create a mutable vector for query parameters
469    let mut query_params: Vec<(String, String)> = Vec::new();
470
471    if let Some(ref param_value) = params.page_index {
472        query_params.push(("pageIndex".to_string(), param_value.to_string()));
473    }
474    if let Some(ref param_value) = params.page_size {
475        query_params.push(("pageSize".to_string(), param_value.to_string()));
476    }
477    if let Some(ref param_value) = params.recv_window {
478        query_params.push(("recvWindow".to_string(), param_value.to_string()));
479    }
480    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
481
482    // Create header parameters collection
483    let mut header_params = std::collections::HashMap::new();
484
485    // Handle Binance Auth first if configured
486    if let Some(ref binance_auth) = configuration.binance_auth {
487        // Add API key to headers
488        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
489        
490        // Generate request body for signing (if any)
491        let body_string: Option<Vec<u8>> = None;
492        
493        // Sign the request
494        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
495            Ok(sig) => sig,
496            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
497        };
498        
499        // Add signature to query params
500        query_params.push(("signature".to_string(), signature));
501    }
502
503    // Apply all query parameters
504    if !query_params.is_empty() {
505        req_builder = req_builder.query(&query_params);
506    }
507
508
509    // Add user agent if configured
510    if let Some(ref user_agent) = configuration.user_agent {
511        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
512    }
513
514    // Apply all header parameters
515    for (header_name, header_value) in header_params {
516        req_builder = req_builder.header(&header_name, &header_value);
517    }
518
519
520    let req = req_builder.build()?;
521    let resp = configuration.client.execute(req).await?;
522
523    let status = resp.status();
524    let content_type = resp
525        .headers()
526        .get("content-type")
527        .and_then(|v| v.to_str().ok())
528        .unwrap_or("application/octet-stream");
529    let content_type = super::ContentType::from(content_type);
530
531    if !status.is_client_error() && !status.is_server_error() {
532        let content = resp.text().await?;
533        match content_type {
534            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
535            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningHashTransferConfigDetailsListV1Resp`"))),
536            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::GetMiningHashTransferConfigDetailsListV1Resp`")))),
537        }
538    } else {
539        let content = resp.text().await?;
540        let entity: Option<GetMiningHashTransferConfigDetailsListV1Error> = serde_json::from_str(&content).ok();
541        Err(Error::ResponseError(ResponseContent { status, content, entity }))
542    }
543}
544
545/// Hashrate Resale Detail(USER_DATA)
546pub async fn get_mining_hash_transfer_profit_details_v1(configuration: &configuration::Configuration, params: GetMiningHashTransferProfitDetailsV1Params) -> Result<models::GetMiningHashTransferProfitDetailsV1Resp, Error<GetMiningHashTransferProfitDetailsV1Error>> {
547
548    let uri_str = format!("{}/sapi/v1/mining/hash-transfer/profit/details", configuration.base_path);
549    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
550
551    // Create a mutable vector for query parameters
552    let mut query_params: Vec<(String, String)> = Vec::new();
553
554    query_params.push(("configId".to_string(), params.config_id.to_string()));
555    query_params.push(("userName".to_string(), params.user_name.to_string()));
556    if let Some(ref param_value) = params.page_index {
557        query_params.push(("pageIndex".to_string(), param_value.to_string()));
558    }
559    if let Some(ref param_value) = params.page_size {
560        query_params.push(("pageSize".to_string(), param_value.to_string()));
561    }
562    if let Some(ref param_value) = params.recv_window {
563        query_params.push(("recvWindow".to_string(), param_value.to_string()));
564    }
565    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
566
567    // Create header parameters collection
568    let mut header_params = std::collections::HashMap::new();
569
570    // Handle Binance Auth first if configured
571    if let Some(ref binance_auth) = configuration.binance_auth {
572        // Add API key to headers
573        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
574        
575        // Generate request body for signing (if any)
576        let body_string: Option<Vec<u8>> = None;
577        
578        // Sign the request
579        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
580            Ok(sig) => sig,
581            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
582        };
583        
584        // Add signature to query params
585        query_params.push(("signature".to_string(), signature));
586    }
587
588    // Apply all query parameters
589    if !query_params.is_empty() {
590        req_builder = req_builder.query(&query_params);
591    }
592
593
594    // Add user agent if configured
595    if let Some(ref user_agent) = configuration.user_agent {
596        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
597    }
598
599    // Apply all header parameters
600    for (header_name, header_value) in header_params {
601        req_builder = req_builder.header(&header_name, &header_value);
602    }
603
604
605    let req = req_builder.build()?;
606    let resp = configuration.client.execute(req).await?;
607
608    let status = resp.status();
609    let content_type = resp
610        .headers()
611        .get("content-type")
612        .and_then(|v| v.to_str().ok())
613        .unwrap_or("application/octet-stream");
614    let content_type = super::ContentType::from(content_type);
615
616    if !status.is_client_error() && !status.is_server_error() {
617        let content = resp.text().await?;
618        match content_type {
619            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
620            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningHashTransferProfitDetailsV1Resp`"))),
621            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::GetMiningHashTransferProfitDetailsV1Resp`")))),
622        }
623    } else {
624        let content = resp.text().await?;
625        let entity: Option<GetMiningHashTransferProfitDetailsV1Error> = serde_json::from_str(&content).ok();
626        Err(Error::ResponseError(ResponseContent { status, content, entity }))
627    }
628}
629
630/// Query Earnings List
631pub async fn get_mining_payment_list_v1(configuration: &configuration::Configuration, params: GetMiningPaymentListV1Params) -> Result<models::GetMiningPaymentListV1Resp, Error<GetMiningPaymentListV1Error>> {
632
633    let uri_str = format!("{}/sapi/v1/mining/payment/list", configuration.base_path);
634    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
635
636    // Create a mutable vector for query parameters
637    let mut query_params: Vec<(String, String)> = Vec::new();
638
639    query_params.push(("algo".to_string(), params.algo.to_string()));
640    query_params.push(("userName".to_string(), params.user_name.to_string()));
641    if let Some(ref param_value) = params.coin {
642        query_params.push(("coin".to_string(), param_value.to_string()));
643    }
644    if let Some(ref param_value) = params.start_date {
645        query_params.push(("startDate".to_string(), param_value.to_string()));
646    }
647    if let Some(ref param_value) = params.end_date {
648        query_params.push(("endDate".to_string(), param_value.to_string()));
649    }
650    if let Some(ref param_value) = params.page_index {
651        query_params.push(("pageIndex".to_string(), param_value.to_string()));
652    }
653    if let Some(ref param_value) = params.page_size {
654        query_params.push(("pageSize".to_string(), param_value.to_string()));
655    }
656    if let Some(ref param_value) = params.recv_window {
657        query_params.push(("recvWindow".to_string(), param_value.to_string()));
658    }
659    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
660
661    // Create header parameters collection
662    let mut header_params = std::collections::HashMap::new();
663
664    // Handle Binance Auth first if configured
665    if let Some(ref binance_auth) = configuration.binance_auth {
666        // Add API key to headers
667        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
668        
669        // Generate request body for signing (if any)
670        let body_string: Option<Vec<u8>> = None;
671        
672        // Sign the request
673        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
674            Ok(sig) => sig,
675            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
676        };
677        
678        // Add signature to query params
679        query_params.push(("signature".to_string(), signature));
680    }
681
682    // Apply all query parameters
683    if !query_params.is_empty() {
684        req_builder = req_builder.query(&query_params);
685    }
686
687
688    // Add user agent if configured
689    if let Some(ref user_agent) = configuration.user_agent {
690        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
691    }
692
693    // Apply all header parameters
694    for (header_name, header_value) in header_params {
695        req_builder = req_builder.header(&header_name, &header_value);
696    }
697
698
699    let req = req_builder.build()?;
700    let resp = configuration.client.execute(req).await?;
701
702    let status = resp.status();
703    let content_type = resp
704        .headers()
705        .get("content-type")
706        .and_then(|v| v.to_str().ok())
707        .unwrap_or("application/octet-stream");
708    let content_type = super::ContentType::from(content_type);
709
710    if !status.is_client_error() && !status.is_server_error() {
711        let content = resp.text().await?;
712        match content_type {
713            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
714            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningPaymentListV1Resp`"))),
715            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::GetMiningPaymentListV1Resp`")))),
716        }
717    } else {
718        let content = resp.text().await?;
719        let entity: Option<GetMiningPaymentListV1Error> = serde_json::from_str(&content).ok();
720        Err(Error::ResponseError(ResponseContent { status, content, entity }))
721    }
722}
723
724/// Extra Bonus List
725pub async fn get_mining_payment_other_v1(configuration: &configuration::Configuration, params: GetMiningPaymentOtherV1Params) -> Result<models::GetMiningPaymentOtherV1Resp, Error<GetMiningPaymentOtherV1Error>> {
726
727    let uri_str = format!("{}/sapi/v1/mining/payment/other", configuration.base_path);
728    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
729
730    // Create a mutable vector for query parameters
731    let mut query_params: Vec<(String, String)> = Vec::new();
732
733    query_params.push(("algo".to_string(), params.algo.to_string()));
734    query_params.push(("userName".to_string(), params.user_name.to_string()));
735    if let Some(ref param_value) = params.coin {
736        query_params.push(("coin".to_string(), param_value.to_string()));
737    }
738    if let Some(ref param_value) = params.start_date {
739        query_params.push(("startDate".to_string(), param_value.to_string()));
740    }
741    if let Some(ref param_value) = params.end_date {
742        query_params.push(("endDate".to_string(), param_value.to_string()));
743    }
744    if let Some(ref param_value) = params.page_index {
745        query_params.push(("pageIndex".to_string(), param_value.to_string()));
746    }
747    if let Some(ref param_value) = params.page_size {
748        query_params.push(("pageSize".to_string(), param_value.to_string()));
749    }
750    if let Some(ref param_value) = params.recv_window {
751        query_params.push(("recvWindow".to_string(), param_value.to_string()));
752    }
753    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
754
755    // Create header parameters collection
756    let mut header_params = std::collections::HashMap::new();
757
758    // Handle Binance Auth first if configured
759    if let Some(ref binance_auth) = configuration.binance_auth {
760        // Add API key to headers
761        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
762        
763        // Generate request body for signing (if any)
764        let body_string: Option<Vec<u8>> = None;
765        
766        // Sign the request
767        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
768            Ok(sig) => sig,
769            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
770        };
771        
772        // Add signature to query params
773        query_params.push(("signature".to_string(), signature));
774    }
775
776    // Apply all query parameters
777    if !query_params.is_empty() {
778        req_builder = req_builder.query(&query_params);
779    }
780
781
782    // Add user agent if configured
783    if let Some(ref user_agent) = configuration.user_agent {
784        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
785    }
786
787    // Apply all header parameters
788    for (header_name, header_value) in header_params {
789        req_builder = req_builder.header(&header_name, &header_value);
790    }
791
792
793    let req = req_builder.build()?;
794    let resp = configuration.client.execute(req).await?;
795
796    let status = resp.status();
797    let content_type = resp
798        .headers()
799        .get("content-type")
800        .and_then(|v| v.to_str().ok())
801        .unwrap_or("application/octet-stream");
802    let content_type = super::ContentType::from(content_type);
803
804    if !status.is_client_error() && !status.is_server_error() {
805        let content = resp.text().await?;
806        match content_type {
807            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
808            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningPaymentOtherV1Resp`"))),
809            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::GetMiningPaymentOtherV1Resp`")))),
810        }
811    } else {
812        let content = resp.text().await?;
813        let entity: Option<GetMiningPaymentOtherV1Error> = serde_json::from_str(&content).ok();
814        Err(Error::ResponseError(ResponseContent { status, content, entity }))
815    }
816}
817
818/// Mining Account Earning
819pub async fn get_mining_payment_uid_v1(configuration: &configuration::Configuration, params: GetMiningPaymentUidV1Params) -> Result<models::GetMiningPaymentUidV1Resp, Error<GetMiningPaymentUidV1Error>> {
820
821    let uri_str = format!("{}/sapi/v1/mining/payment/uid", configuration.base_path);
822    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
823
824    // Create a mutable vector for query parameters
825    let mut query_params: Vec<(String, String)> = Vec::new();
826
827    query_params.push(("algo".to_string(), params.algo.to_string()));
828    if let Some(ref param_value) = params.start_date {
829        query_params.push(("startDate".to_string(), param_value.to_string()));
830    }
831    if let Some(ref param_value) = params.end_date {
832        query_params.push(("endDate".to_string(), param_value.to_string()));
833    }
834    if let Some(ref param_value) = params.page_index {
835        query_params.push(("pageIndex".to_string(), param_value.to_string()));
836    }
837    if let Some(ref param_value) = params.page_size {
838        query_params.push(("pageSize".to_string(), param_value.to_string()));
839    }
840    if let Some(ref param_value) = params.recv_window {
841        query_params.push(("recvWindow".to_string(), param_value.to_string()));
842    }
843    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
844
845    // Create header parameters collection
846    let mut header_params = std::collections::HashMap::new();
847
848    // Handle Binance Auth first if configured
849    if let Some(ref binance_auth) = configuration.binance_auth {
850        // Add API key to headers
851        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
852        
853        // Generate request body for signing (if any)
854        let body_string: Option<Vec<u8>> = None;
855        
856        // Sign the request
857        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
858            Ok(sig) => sig,
859            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
860        };
861        
862        // Add signature to query params
863        query_params.push(("signature".to_string(), signature));
864    }
865
866    // Apply all query parameters
867    if !query_params.is_empty() {
868        req_builder = req_builder.query(&query_params);
869    }
870
871
872    // Add user agent if configured
873    if let Some(ref user_agent) = configuration.user_agent {
874        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
875    }
876
877    // Apply all header parameters
878    for (header_name, header_value) in header_params {
879        req_builder = req_builder.header(&header_name, &header_value);
880    }
881
882
883    let req = req_builder.build()?;
884    let resp = configuration.client.execute(req).await?;
885
886    let status = resp.status();
887    let content_type = resp
888        .headers()
889        .get("content-type")
890        .and_then(|v| v.to_str().ok())
891        .unwrap_or("application/octet-stream");
892    let content_type = super::ContentType::from(content_type);
893
894    if !status.is_client_error() && !status.is_server_error() {
895        let content = resp.text().await?;
896        match content_type {
897            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
898            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningPaymentUidV1Resp`"))),
899            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetMiningPaymentUidV1Resp`")))),
900        }
901    } else {
902        let content = resp.text().await?;
903        let entity: Option<GetMiningPaymentUidV1Error> = serde_json::from_str(&content).ok();
904        Err(Error::ResponseError(ResponseContent { status, content, entity }))
905    }
906}
907
908/// Acquiring Algorithm
909pub async fn get_mining_pub_algo_list_v1(configuration: &configuration::Configuration) -> Result<models::GetMiningPubAlgoListV1Resp, Error<GetMiningPubAlgoListV1Error>> {
910
911    let uri_str = format!("{}/sapi/v1/mining/pub/algoList", configuration.base_path);
912    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
913
914    // Create a mutable vector for query parameters
915    let mut query_params: Vec<(String, String)> = Vec::new();
916
917
918    // Create header parameters collection
919    let mut header_params = std::collections::HashMap::new();
920
921    // Handle Binance Auth first if configured
922    if let Some(ref binance_auth) = configuration.binance_auth {
923        // Add API key to headers
924        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
925        
926        // Generate request body for signing (if any)
927        let body_string: Option<Vec<u8>> = None;
928        
929        // Sign the request
930        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
931            Ok(sig) => sig,
932            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
933        };
934        
935        // Add signature to query params
936        query_params.push(("signature".to_string(), signature));
937    }
938
939    // Apply all query parameters
940    if !query_params.is_empty() {
941        req_builder = req_builder.query(&query_params);
942    }
943
944
945    // Add user agent if configured
946    if let Some(ref user_agent) = configuration.user_agent {
947        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
948    }
949
950    // Apply all header parameters
951    for (header_name, header_value) in header_params {
952        req_builder = req_builder.header(&header_name, &header_value);
953    }
954
955
956    let req = req_builder.build()?;
957    let resp = configuration.client.execute(req).await?;
958
959    let status = resp.status();
960    let content_type = resp
961        .headers()
962        .get("content-type")
963        .and_then(|v| v.to_str().ok())
964        .unwrap_or("application/octet-stream");
965    let content_type = super::ContentType::from(content_type);
966
967    if !status.is_client_error() && !status.is_server_error() {
968        let content = resp.text().await?;
969        match content_type {
970            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
971            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningPubAlgoListV1Resp`"))),
972            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::GetMiningPubAlgoListV1Resp`")))),
973        }
974    } else {
975        let content = resp.text().await?;
976        let entity: Option<GetMiningPubAlgoListV1Error> = serde_json::from_str(&content).ok();
977        Err(Error::ResponseError(ResponseContent { status, content, entity }))
978    }
979}
980
981/// Acquiring CoinName
982pub async fn get_mining_pub_coin_list_v1(configuration: &configuration::Configuration) -> Result<models::GetMiningPubCoinListV1Resp, Error<GetMiningPubCoinListV1Error>> {
983
984    let uri_str = format!("{}/sapi/v1/mining/pub/coinList", configuration.base_path);
985    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
986
987    // Create a mutable vector for query parameters
988    let mut query_params: Vec<(String, String)> = Vec::new();
989
990
991    // Create header parameters collection
992    let mut header_params = std::collections::HashMap::new();
993
994    // Handle Binance Auth first if configured
995    if let Some(ref binance_auth) = configuration.binance_auth {
996        // Add API key to headers
997        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
998        
999        // Generate request body for signing (if any)
1000        let body_string: Option<Vec<u8>> = None;
1001        
1002        // Sign the request
1003        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1004            Ok(sig) => sig,
1005            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1006        };
1007        
1008        // Add signature to query params
1009        query_params.push(("signature".to_string(), signature));
1010    }
1011
1012    // Apply all query parameters
1013    if !query_params.is_empty() {
1014        req_builder = req_builder.query(&query_params);
1015    }
1016
1017
1018    // Add user agent if configured
1019    if let Some(ref user_agent) = configuration.user_agent {
1020        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1021    }
1022
1023    // Apply all header parameters
1024    for (header_name, header_value) in header_params {
1025        req_builder = req_builder.header(&header_name, &header_value);
1026    }
1027
1028
1029    let req = req_builder.build()?;
1030    let resp = configuration.client.execute(req).await?;
1031
1032    let status = resp.status();
1033    let content_type = resp
1034        .headers()
1035        .get("content-type")
1036        .and_then(|v| v.to_str().ok())
1037        .unwrap_or("application/octet-stream");
1038    let content_type = super::ContentType::from(content_type);
1039
1040    if !status.is_client_error() && !status.is_server_error() {
1041        let content = resp.text().await?;
1042        match content_type {
1043            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1044            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningPubCoinListV1Resp`"))),
1045            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::GetMiningPubCoinListV1Resp`")))),
1046        }
1047    } else {
1048        let content = resp.text().await?;
1049        let entity: Option<GetMiningPubCoinListV1Error> = serde_json::from_str(&content).ok();
1050        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1051    }
1052}
1053
1054/// Query Account List
1055pub async fn get_mining_statistics_user_list_v1(configuration: &configuration::Configuration, params: GetMiningStatisticsUserListV1Params) -> Result<models::GetMiningStatisticsUserListV1Resp, Error<GetMiningStatisticsUserListV1Error>> {
1056
1057    let uri_str = format!("{}/sapi/v1/mining/statistics/user/list", configuration.base_path);
1058    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1059
1060    // Create a mutable vector for query parameters
1061    let mut query_params: Vec<(String, String)> = Vec::new();
1062
1063    query_params.push(("algo".to_string(), params.algo.to_string()));
1064    query_params.push(("userName".to_string(), params.user_name.to_string()));
1065    if let Some(ref param_value) = params.recv_window {
1066        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1067    }
1068    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1069
1070    // Create header parameters collection
1071    let mut header_params = std::collections::HashMap::new();
1072
1073    // Handle Binance Auth first if configured
1074    if let Some(ref binance_auth) = configuration.binance_auth {
1075        // Add API key to headers
1076        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1077        
1078        // Generate request body for signing (if any)
1079        let body_string: Option<Vec<u8>> = None;
1080        
1081        // Sign the request
1082        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1083            Ok(sig) => sig,
1084            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1085        };
1086        
1087        // Add signature to query params
1088        query_params.push(("signature".to_string(), signature));
1089    }
1090
1091    // Apply all query parameters
1092    if !query_params.is_empty() {
1093        req_builder = req_builder.query(&query_params);
1094    }
1095
1096
1097    // Add user agent if configured
1098    if let Some(ref user_agent) = configuration.user_agent {
1099        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1100    }
1101
1102    // Apply all header parameters
1103    for (header_name, header_value) in header_params {
1104        req_builder = req_builder.header(&header_name, &header_value);
1105    }
1106
1107
1108    let req = req_builder.build()?;
1109    let resp = configuration.client.execute(req).await?;
1110
1111    let status = resp.status();
1112    let content_type = resp
1113        .headers()
1114        .get("content-type")
1115        .and_then(|v| v.to_str().ok())
1116        .unwrap_or("application/octet-stream");
1117    let content_type = super::ContentType::from(content_type);
1118
1119    if !status.is_client_error() && !status.is_server_error() {
1120        let content = resp.text().await?;
1121        match content_type {
1122            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1123            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningStatisticsUserListV1Resp`"))),
1124            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::GetMiningStatisticsUserListV1Resp`")))),
1125        }
1126    } else {
1127        let content = resp.text().await?;
1128        let entity: Option<GetMiningStatisticsUserListV1Error> = serde_json::from_str(&content).ok();
1129        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1130    }
1131}
1132
1133/// Statistic List
1134pub async fn get_mining_statistics_user_status_v1(configuration: &configuration::Configuration, params: GetMiningStatisticsUserStatusV1Params) -> Result<models::GetMiningStatisticsUserStatusV1Resp, Error<GetMiningStatisticsUserStatusV1Error>> {
1135
1136    let uri_str = format!("{}/sapi/v1/mining/statistics/user/status", configuration.base_path);
1137    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1138
1139    // Create a mutable vector for query parameters
1140    let mut query_params: Vec<(String, String)> = Vec::new();
1141
1142    query_params.push(("algo".to_string(), params.algo.to_string()));
1143    query_params.push(("userName".to_string(), params.user_name.to_string()));
1144    if let Some(ref param_value) = params.recv_window {
1145        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1146    }
1147    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1148
1149    // Create header parameters collection
1150    let mut header_params = std::collections::HashMap::new();
1151
1152    // Handle Binance Auth first if configured
1153    if let Some(ref binance_auth) = configuration.binance_auth {
1154        // Add API key to headers
1155        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1156        
1157        // Generate request body for signing (if any)
1158        let body_string: Option<Vec<u8>> = None;
1159        
1160        // Sign the request
1161        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1162            Ok(sig) => sig,
1163            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1164        };
1165        
1166        // Add signature to query params
1167        query_params.push(("signature".to_string(), signature));
1168    }
1169
1170    // Apply all query parameters
1171    if !query_params.is_empty() {
1172        req_builder = req_builder.query(&query_params);
1173    }
1174
1175
1176    // Add user agent if configured
1177    if let Some(ref user_agent) = configuration.user_agent {
1178        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1179    }
1180
1181    // Apply all header parameters
1182    for (header_name, header_value) in header_params {
1183        req_builder = req_builder.header(&header_name, &header_value);
1184    }
1185
1186
1187    let req = req_builder.build()?;
1188    let resp = configuration.client.execute(req).await?;
1189
1190    let status = resp.status();
1191    let content_type = resp
1192        .headers()
1193        .get("content-type")
1194        .and_then(|v| v.to_str().ok())
1195        .unwrap_or("application/octet-stream");
1196    let content_type = super::ContentType::from(content_type);
1197
1198    if !status.is_client_error() && !status.is_server_error() {
1199        let content = resp.text().await?;
1200        match content_type {
1201            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1202            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningStatisticsUserStatusV1Resp`"))),
1203            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::GetMiningStatisticsUserStatusV1Resp`")))),
1204        }
1205    } else {
1206        let content = resp.text().await?;
1207        let entity: Option<GetMiningStatisticsUserStatusV1Error> = serde_json::from_str(&content).ok();
1208        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1209    }
1210}
1211
1212/// Request for Detail Miner List
1213pub async fn get_mining_worker_detail_v1(configuration: &configuration::Configuration, params: GetMiningWorkerDetailV1Params) -> Result<models::GetMiningWorkerDetailV1Resp, Error<GetMiningWorkerDetailV1Error>> {
1214
1215    let uri_str = format!("{}/sapi/v1/mining/worker/detail", configuration.base_path);
1216    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1217
1218    // Create a mutable vector for query parameters
1219    let mut query_params: Vec<(String, String)> = Vec::new();
1220
1221    query_params.push(("algo".to_string(), params.algo.to_string()));
1222    query_params.push(("userName".to_string(), params.user_name.to_string()));
1223    query_params.push(("workerName".to_string(), params.worker_name.to_string()));
1224    if let Some(ref param_value) = params.recv_window {
1225        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1226    }
1227    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1228
1229    // Create header parameters collection
1230    let mut header_params = std::collections::HashMap::new();
1231
1232    // Handle Binance Auth first if configured
1233    if let Some(ref binance_auth) = configuration.binance_auth {
1234        // Add API key to headers
1235        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1236        
1237        // Generate request body for signing (if any)
1238        let body_string: Option<Vec<u8>> = None;
1239        
1240        // Sign the request
1241        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1242            Ok(sig) => sig,
1243            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1244        };
1245        
1246        // Add signature to query params
1247        query_params.push(("signature".to_string(), signature));
1248    }
1249
1250    // Apply all query parameters
1251    if !query_params.is_empty() {
1252        req_builder = req_builder.query(&query_params);
1253    }
1254
1255
1256    // Add user agent if configured
1257    if let Some(ref user_agent) = configuration.user_agent {
1258        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1259    }
1260
1261    // Apply all header parameters
1262    for (header_name, header_value) in header_params {
1263        req_builder = req_builder.header(&header_name, &header_value);
1264    }
1265
1266
1267    let req = req_builder.build()?;
1268    let resp = configuration.client.execute(req).await?;
1269
1270    let status = resp.status();
1271    let content_type = resp
1272        .headers()
1273        .get("content-type")
1274        .and_then(|v| v.to_str().ok())
1275        .unwrap_or("application/octet-stream");
1276    let content_type = super::ContentType::from(content_type);
1277
1278    if !status.is_client_error() && !status.is_server_error() {
1279        let content = resp.text().await?;
1280        match content_type {
1281            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1282            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningWorkerDetailV1Resp`"))),
1283            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::GetMiningWorkerDetailV1Resp`")))),
1284        }
1285    } else {
1286        let content = resp.text().await?;
1287        let entity: Option<GetMiningWorkerDetailV1Error> = serde_json::from_str(&content).ok();
1288        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1289    }
1290}
1291
1292/// Request for Miner List
1293pub async fn get_mining_worker_list_v1(configuration: &configuration::Configuration, params: GetMiningWorkerListV1Params) -> Result<models::GetMiningWorkerListV1Resp, Error<GetMiningWorkerListV1Error>> {
1294
1295    let uri_str = format!("{}/sapi/v1/mining/worker/list", configuration.base_path);
1296    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1297
1298    // Create a mutable vector for query parameters
1299    let mut query_params: Vec<(String, String)> = Vec::new();
1300
1301    query_params.push(("algo".to_string(), params.algo.to_string()));
1302    query_params.push(("userName".to_string(), params.user_name.to_string()));
1303    if let Some(ref param_value) = params.page_index {
1304        query_params.push(("pageIndex".to_string(), param_value.to_string()));
1305    }
1306    if let Some(ref param_value) = params.sort {
1307        query_params.push(("sort".to_string(), param_value.to_string()));
1308    }
1309    if let Some(ref param_value) = params.sort_column {
1310        query_params.push(("sortColumn".to_string(), param_value.to_string()));
1311    }
1312    if let Some(ref param_value) = params.worker_status {
1313        query_params.push(("workerStatus".to_string(), param_value.to_string()));
1314    }
1315    if let Some(ref param_value) = params.recv_window {
1316        query_params.push(("recvWindow".to_string(), param_value.to_string()));
1317    }
1318    query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1319
1320    // Create header parameters collection
1321    let mut header_params = std::collections::HashMap::new();
1322
1323    // Handle Binance Auth first if configured
1324    if let Some(ref binance_auth) = configuration.binance_auth {
1325        // Add API key to headers
1326        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1327        
1328        // Generate request body for signing (if any)
1329        let body_string: Option<Vec<u8>> = None;
1330        
1331        // Sign the request
1332        let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1333            Ok(sig) => sig,
1334            Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1335        };
1336        
1337        // Add signature to query params
1338        query_params.push(("signature".to_string(), signature));
1339    }
1340
1341    // Apply all query parameters
1342    if !query_params.is_empty() {
1343        req_builder = req_builder.query(&query_params);
1344    }
1345
1346
1347    // Add user agent if configured
1348    if let Some(ref user_agent) = configuration.user_agent {
1349        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1350    }
1351
1352    // Apply all header parameters
1353    for (header_name, header_value) in header_params {
1354        req_builder = req_builder.header(&header_name, &header_value);
1355    }
1356
1357
1358    let req = req_builder.build()?;
1359    let resp = configuration.client.execute(req).await?;
1360
1361    let status = resp.status();
1362    let content_type = resp
1363        .headers()
1364        .get("content-type")
1365        .and_then(|v| v.to_str().ok())
1366        .unwrap_or("application/octet-stream");
1367    let content_type = super::ContentType::from(content_type);
1368
1369    if !status.is_client_error() && !status.is_server_error() {
1370        let content = resp.text().await?;
1371        match content_type {
1372            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1373            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMiningWorkerListV1Resp`"))),
1374            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::GetMiningWorkerListV1Resp`")))),
1375        }
1376    } else {
1377        let content = resp.text().await?;
1378        let entity: Option<GetMiningWorkerListV1Error> = serde_json::from_str(&content).ok();
1379        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1380    }
1381}
1382