1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::wallet::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug, Default)]
19pub struct WalletCreateCapitalDepositCreditApplyV1Params {
20 pub deposit_id: Option<i64>,
21 pub sub_account_id: Option<i64>,
22 pub sub_user_id: Option<i64>,
23 pub tx_id: Option<String>
24}
25
26#[derive(Clone, Debug, Default)]
28pub struct WalletCreateCapitalWithdrawApplyV1Params {
29 pub address: String,
30 pub amount: String,
31 pub coin: String,
32 pub timestamp: i64,
33 pub address_tag: Option<String>,
34 pub name: Option<String>,
35 pub network: Option<String>,
36 pub recv_window: Option<i64>,
37 pub transaction_fee_flag: Option<bool>,
38 pub wallet_type: Option<i32>,
39 pub withdraw_order_id: Option<String>
40}
41
42#[derive(Clone, Debug, Default)]
44pub struct WalletGetCapitalConfigGetallV1Params {
45 pub timestamp: i64,
46 pub recv_window: Option<i64>
47}
48
49#[derive(Clone, Debug, Default)]
51pub struct WalletGetCapitalDepositAddressListV1Params {
52 pub coin: String,
54 pub timestamp: i64,
55 pub network: Option<String>
56}
57
58#[derive(Clone, Debug, Default)]
60pub struct WalletGetCapitalDepositAddressV1Params {
61 pub coin: String,
62 pub timestamp: i64,
63 pub network: Option<String>,
64 pub amount: Option<String>,
65 pub recv_window: Option<i64>
66}
67
68#[derive(Clone, Debug, Default)]
70pub struct WalletGetCapitalDepositHisrecV1Params {
71 pub timestamp: i64,
72 pub include_source: Option<bool>,
74 pub coin: Option<String>,
75 pub status: Option<i32>,
77 pub start_time: Option<i64>,
79 pub end_time: Option<i64>,
81 pub offset: Option<i32>,
83 pub limit: Option<i32>,
85 pub recv_window: Option<i64>,
86 pub tx_id: Option<String>
87}
88
89#[derive(Clone, Debug, Default)]
91pub struct WalletGetCapitalWithdrawHistoryV1Params {
92 pub timestamp: i64,
93 pub coin: Option<String>,
94 pub withdraw_order_id: Option<String>,
95 pub status: Option<i32>,
97 pub offset: Option<i32>,
98 pub limit: Option<i32>,
100 pub id_list: Option<String>,
102 pub start_time: Option<i64>,
104 pub end_time: Option<i64>,
106 pub recv_window: Option<i64>
107}
108
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum WalletCreateCapitalDepositCreditApplyV1Error {
114 Status4XX(models::ApiError),
115 Status5XX(models::ApiError),
116 UnknownValue(serde_json::Value),
117}
118
119#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(untagged)]
122pub enum WalletCreateCapitalWithdrawApplyV1Error {
123 Status4XX(models::ApiError),
124 Status5XX(models::ApiError),
125 UnknownValue(serde_json::Value),
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum WalletGetCapitalConfigGetallV1Error {
132 Status4XX(models::ApiError),
133 Status5XX(models::ApiError),
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum WalletGetCapitalDepositAddressListV1Error {
141 Status4XX(models::ApiError),
142 Status5XX(models::ApiError),
143 UnknownValue(serde_json::Value),
144}
145
146#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(untagged)]
149pub enum WalletGetCapitalDepositAddressV1Error {
150 Status4XX(models::ApiError),
151 Status5XX(models::ApiError),
152 UnknownValue(serde_json::Value),
153}
154
155#[derive(Debug, Clone, Serialize, Deserialize)]
157#[serde(untagged)]
158pub enum WalletGetCapitalDepositHisrecV1Error {
159 Status4XX(models::ApiError),
160 Status5XX(models::ApiError),
161 UnknownValue(serde_json::Value),
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum WalletGetCapitalWithdrawAddressListV1Error {
168 Status4XX(models::ApiError),
169 Status5XX(models::ApiError),
170 UnknownValue(serde_json::Value),
171}
172
173#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum WalletGetCapitalWithdrawHistoryV1Error {
177 Status4XX(models::ApiError),
178 Status5XX(models::ApiError),
179 UnknownValue(serde_json::Value),
180}
181
182
183pub async fn wallet_create_capital_deposit_credit_apply_v1(configuration: &configuration::Configuration, params: WalletCreateCapitalDepositCreditApplyV1Params) -> Result<models::WalletCreateCapitalDepositCreditApplyV1Resp, Error<WalletCreateCapitalDepositCreditApplyV1Error>> {
185
186 let uri_str = format!("{}/sapi/v1/capital/deposit/credit-apply", configuration.base_path);
187 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
188
189 let mut query_params: Vec<(String, String)> = Vec::new();
191
192
193 let mut header_params = std::collections::HashMap::new();
195
196 if let Some(ref binance_auth) = configuration.binance_auth {
198 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
200
201 let body_string: Option<Vec<u8>> = None;
203
204 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
206 Ok(sig) => sig,
207 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
208 };
209
210 query_params.push(("signature".to_string(), signature));
212 }
213
214 if !query_params.is_empty() {
216 req_builder = req_builder.query(&query_params);
217 }
218
219
220 if let Some(ref user_agent) = configuration.user_agent {
222 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
223 }
224
225 for (header_name, header_value) in header_params {
227 req_builder = req_builder.header(&header_name, &header_value);
228 }
229
230 let mut multipart_form_params = std::collections::HashMap::new();
231 if let Some(param_value) = params.deposit_id {
232 multipart_form_params.insert("depositId", param_value.to_string());
233 }
234 if let Some(param_value) = params.sub_account_id {
235 multipart_form_params.insert("subAccountId", param_value.to_string());
236 }
237 if let Some(param_value) = params.sub_user_id {
238 multipart_form_params.insert("subUserId", param_value.to_string());
239 }
240 if let Some(param_value) = params.tx_id {
241 multipart_form_params.insert("txId", param_value.to_string());
242 }
243 req_builder = req_builder.form(&multipart_form_params);
244
245 let req = req_builder.build()?;
246 let resp = configuration.client.execute(req).await?;
247
248 let status = resp.status();
249 let content_type = resp
250 .headers()
251 .get("content-type")
252 .and_then(|v| v.to_str().ok())
253 .unwrap_or("application/octet-stream");
254 let content_type = super::ContentType::from(content_type);
255
256 if !status.is_client_error() && !status.is_server_error() {
257 let content = resp.text().await?;
258 match content_type {
259 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
260 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletCreateCapitalDepositCreditApplyV1Resp`"))),
261 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::WalletCreateCapitalDepositCreditApplyV1Resp`")))),
262 }
263 } else {
264 let content = resp.text().await?;
265 let entity: Option<WalletCreateCapitalDepositCreditApplyV1Error> = serde_json::from_str(&content).ok();
266 Err(Error::ResponseError(ResponseContent { status, content, entity }))
267 }
268}
269
270pub async fn wallet_create_capital_withdraw_apply_v1(configuration: &configuration::Configuration, params: WalletCreateCapitalWithdrawApplyV1Params) -> Result<models::WalletCreateCapitalWithdrawApplyV1Resp, Error<WalletCreateCapitalWithdrawApplyV1Error>> {
272
273 let uri_str = format!("{}/sapi/v1/capital/withdraw/apply", configuration.base_path);
274 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
275
276 let mut query_params: Vec<(String, String)> = Vec::new();
278
279
280 let mut header_params = std::collections::HashMap::new();
282
283 if let Some(ref binance_auth) = configuration.binance_auth {
285 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
287
288 let body_string: Option<Vec<u8>> = None;
290
291 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
293 Ok(sig) => sig,
294 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
295 };
296
297 query_params.push(("signature".to_string(), signature));
299 }
300
301 if !query_params.is_empty() {
303 req_builder = req_builder.query(&query_params);
304 }
305
306
307 if let Some(ref user_agent) = configuration.user_agent {
309 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
310 }
311
312 for (header_name, header_value) in header_params {
314 req_builder = req_builder.header(&header_name, &header_value);
315 }
316
317 let mut multipart_form_params = std::collections::HashMap::new();
318 multipart_form_params.insert("address", params.address.to_string());
319 if let Some(param_value) = params.address_tag {
320 multipart_form_params.insert("addressTag", param_value.to_string());
321 }
322 multipart_form_params.insert("amount", params.amount.to_string());
323 multipart_form_params.insert("coin", params.coin.to_string());
324 if let Some(param_value) = params.name {
325 multipart_form_params.insert("name", param_value.to_string());
326 }
327 if let Some(param_value) = params.network {
328 multipart_form_params.insert("network", param_value.to_string());
329 }
330 if let Some(param_value) = params.recv_window {
331 multipart_form_params.insert("recvWindow", param_value.to_string());
332 }
333 multipart_form_params.insert("timestamp", params.timestamp.to_string());
334 if let Some(param_value) = params.transaction_fee_flag {
335 multipart_form_params.insert("transactionFeeFlag", param_value.to_string());
336 }
337 if let Some(param_value) = params.wallet_type {
338 multipart_form_params.insert("walletType", param_value.to_string());
339 }
340 if let Some(param_value) = params.withdraw_order_id {
341 multipart_form_params.insert("withdrawOrderId", param_value.to_string());
342 }
343 req_builder = req_builder.form(&multipart_form_params);
344
345 let req = req_builder.build()?;
346 let resp = configuration.client.execute(req).await?;
347
348 let status = resp.status();
349 let content_type = resp
350 .headers()
351 .get("content-type")
352 .and_then(|v| v.to_str().ok())
353 .unwrap_or("application/octet-stream");
354 let content_type = super::ContentType::from(content_type);
355
356 if !status.is_client_error() && !status.is_server_error() {
357 let content = resp.text().await?;
358 match content_type {
359 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
360 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletCreateCapitalWithdrawApplyV1Resp`"))),
361 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::WalletCreateCapitalWithdrawApplyV1Resp`")))),
362 }
363 } else {
364 let content = resp.text().await?;
365 let entity: Option<WalletCreateCapitalWithdrawApplyV1Error> = serde_json::from_str(&content).ok();
366 Err(Error::ResponseError(ResponseContent { status, content, entity }))
367 }
368}
369
370pub async fn wallet_get_capital_config_getall_v1(configuration: &configuration::Configuration, params: WalletGetCapitalConfigGetallV1Params) -> Result<Vec<models::WalletGetCapitalConfigGetallV1RespItem>, Error<WalletGetCapitalConfigGetallV1Error>> {
372
373 let uri_str = format!("{}/sapi/v1/capital/config/getall", configuration.base_path);
374 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
375
376 let mut query_params: Vec<(String, String)> = Vec::new();
378
379 if let Some(ref param_value) = params.recv_window {
380 query_params.push(("recvWindow".to_string(), param_value.to_string()));
381 }
382 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
383
384 let mut header_params = std::collections::HashMap::new();
386
387 if let Some(ref binance_auth) = configuration.binance_auth {
389 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
391
392 let body_string: Option<Vec<u8>> = None;
394
395 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
397 Ok(sig) => sig,
398 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
399 };
400
401 query_params.push(("signature".to_string(), signature));
403 }
404
405 if !query_params.is_empty() {
407 req_builder = req_builder.query(&query_params);
408 }
409
410
411 if let Some(ref user_agent) = configuration.user_agent {
413 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
414 }
415
416 for (header_name, header_value) in header_params {
418 req_builder = req_builder.header(&header_name, &header_value);
419 }
420
421
422 let req = req_builder.build()?;
423 let resp = configuration.client.execute(req).await?;
424
425 let status = resp.status();
426 let content_type = resp
427 .headers()
428 .get("content-type")
429 .and_then(|v| v.to_str().ok())
430 .unwrap_or("application/octet-stream");
431 let content_type = super::ContentType::from(content_type);
432
433 if !status.is_client_error() && !status.is_server_error() {
434 let content = resp.text().await?;
435 match content_type {
436 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
437 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetCapitalConfigGetallV1RespItem>`"))),
438 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::WalletGetCapitalConfigGetallV1RespItem>`")))),
439 }
440 } else {
441 let content = resp.text().await?;
442 let entity: Option<WalletGetCapitalConfigGetallV1Error> = serde_json::from_str(&content).ok();
443 Err(Error::ResponseError(ResponseContent { status, content, entity }))
444 }
445}
446
447pub async fn wallet_get_capital_deposit_address_list_v1(configuration: &configuration::Configuration, params: WalletGetCapitalDepositAddressListV1Params) -> Result<Vec<models::WalletGetCapitalDepositAddressListV1RespItem>, Error<WalletGetCapitalDepositAddressListV1Error>> {
449
450 let uri_str = format!("{}/sapi/v1/capital/deposit/address/list", configuration.base_path);
451 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
452
453 let mut query_params: Vec<(String, String)> = Vec::new();
455
456 query_params.push(("coin".to_string(), params.coin.to_string()));
457 if let Some(ref param_value) = params.network {
458 query_params.push(("network".to_string(), param_value.to_string()));
459 }
460 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
461
462 let mut header_params = std::collections::HashMap::new();
464
465 if let Some(ref binance_auth) = configuration.binance_auth {
467 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
469
470 let body_string: Option<Vec<u8>> = None;
472
473 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
475 Ok(sig) => sig,
476 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
477 };
478
479 query_params.push(("signature".to_string(), signature));
481 }
482
483 if !query_params.is_empty() {
485 req_builder = req_builder.query(&query_params);
486 }
487
488
489 if let Some(ref user_agent) = configuration.user_agent {
491 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
492 }
493
494 for (header_name, header_value) in header_params {
496 req_builder = req_builder.header(&header_name, &header_value);
497 }
498
499
500 let req = req_builder.build()?;
501 let resp = configuration.client.execute(req).await?;
502
503 let status = resp.status();
504 let content_type = resp
505 .headers()
506 .get("content-type")
507 .and_then(|v| v.to_str().ok())
508 .unwrap_or("application/octet-stream");
509 let content_type = super::ContentType::from(content_type);
510
511 if !status.is_client_error() && !status.is_server_error() {
512 let content = resp.text().await?;
513 match content_type {
514 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
515 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetCapitalDepositAddressListV1RespItem>`"))),
516 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::WalletGetCapitalDepositAddressListV1RespItem>`")))),
517 }
518 } else {
519 let content = resp.text().await?;
520 let entity: Option<WalletGetCapitalDepositAddressListV1Error> = serde_json::from_str(&content).ok();
521 Err(Error::ResponseError(ResponseContent { status, content, entity }))
522 }
523}
524
525pub async fn wallet_get_capital_deposit_address_v1(configuration: &configuration::Configuration, params: WalletGetCapitalDepositAddressV1Params) -> Result<models::WalletGetCapitalDepositAddressV1Resp, Error<WalletGetCapitalDepositAddressV1Error>> {
527
528 let uri_str = format!("{}/sapi/v1/capital/deposit/address", configuration.base_path);
529 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
530
531 let mut query_params: Vec<(String, String)> = Vec::new();
533
534 query_params.push(("coin".to_string(), params.coin.to_string()));
535 if let Some(ref param_value) = params.network {
536 query_params.push(("network".to_string(), param_value.to_string()));
537 }
538 if let Some(ref param_value) = params.amount {
539 query_params.push(("amount".to_string(), param_value.to_string()));
540 }
541 if let Some(ref param_value) = params.recv_window {
542 query_params.push(("recvWindow".to_string(), param_value.to_string()));
543 }
544 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
545
546 let mut header_params = std::collections::HashMap::new();
548
549 if let Some(ref binance_auth) = configuration.binance_auth {
551 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
553
554 let body_string: Option<Vec<u8>> = None;
556
557 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
559 Ok(sig) => sig,
560 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
561 };
562
563 query_params.push(("signature".to_string(), signature));
565 }
566
567 if !query_params.is_empty() {
569 req_builder = req_builder.query(&query_params);
570 }
571
572
573 if let Some(ref user_agent) = configuration.user_agent {
575 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
576 }
577
578 for (header_name, header_value) in header_params {
580 req_builder = req_builder.header(&header_name, &header_value);
581 }
582
583
584 let req = req_builder.build()?;
585 let resp = configuration.client.execute(req).await?;
586
587 let status = resp.status();
588 let content_type = resp
589 .headers()
590 .get("content-type")
591 .and_then(|v| v.to_str().ok())
592 .unwrap_or("application/octet-stream");
593 let content_type = super::ContentType::from(content_type);
594
595 if !status.is_client_error() && !status.is_server_error() {
596 let content = resp.text().await?;
597 match content_type {
598 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
599 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WalletGetCapitalDepositAddressV1Resp`"))),
600 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::WalletGetCapitalDepositAddressV1Resp`")))),
601 }
602 } else {
603 let content = resp.text().await?;
604 let entity: Option<WalletGetCapitalDepositAddressV1Error> = serde_json::from_str(&content).ok();
605 Err(Error::ResponseError(ResponseContent { status, content, entity }))
606 }
607}
608
609pub async fn wallet_get_capital_deposit_hisrec_v1(configuration: &configuration::Configuration, params: WalletGetCapitalDepositHisrecV1Params) -> Result<Vec<models::WalletGetCapitalDepositHisrecV1RespItem>, Error<WalletGetCapitalDepositHisrecV1Error>> {
611
612 let uri_str = format!("{}/sapi/v1/capital/deposit/hisrec", configuration.base_path);
613 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
614
615 let mut query_params: Vec<(String, String)> = Vec::new();
617
618 if let Some(ref param_value) = params.include_source {
619 query_params.push(("includeSource".to_string(), param_value.to_string()));
620 }
621 if let Some(ref param_value) = params.coin {
622 query_params.push(("coin".to_string(), param_value.to_string()));
623 }
624 if let Some(ref param_value) = params.status {
625 query_params.push(("status".to_string(), param_value.to_string()));
626 }
627 if let Some(ref param_value) = params.start_time {
628 query_params.push(("startTime".to_string(), param_value.to_string()));
629 }
630 if let Some(ref param_value) = params.end_time {
631 query_params.push(("endTime".to_string(), param_value.to_string()));
632 }
633 if let Some(ref param_value) = params.offset {
634 query_params.push(("offset".to_string(), param_value.to_string()));
635 }
636 if let Some(ref param_value) = params.limit {
637 query_params.push(("limit".to_string(), param_value.to_string()));
638 }
639 if let Some(ref param_value) = params.recv_window {
640 query_params.push(("recvWindow".to_string(), param_value.to_string()));
641 }
642 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
643 if let Some(ref param_value) = params.tx_id {
644 query_params.push(("txId".to_string(), param_value.to_string()));
645 }
646
647 let mut header_params = std::collections::HashMap::new();
649
650 if let Some(ref binance_auth) = configuration.binance_auth {
652 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
654
655 let body_string: Option<Vec<u8>> = None;
657
658 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
660 Ok(sig) => sig,
661 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
662 };
663
664 query_params.push(("signature".to_string(), signature));
666 }
667
668 if !query_params.is_empty() {
670 req_builder = req_builder.query(&query_params);
671 }
672
673
674 if let Some(ref user_agent) = configuration.user_agent {
676 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
677 }
678
679 for (header_name, header_value) in header_params {
681 req_builder = req_builder.header(&header_name, &header_value);
682 }
683
684
685 let req = req_builder.build()?;
686 let resp = configuration.client.execute(req).await?;
687
688 let status = resp.status();
689 let content_type = resp
690 .headers()
691 .get("content-type")
692 .and_then(|v| v.to_str().ok())
693 .unwrap_or("application/octet-stream");
694 let content_type = super::ContentType::from(content_type);
695
696 if !status.is_client_error() && !status.is_server_error() {
697 let content = resp.text().await?;
698 match content_type {
699 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
700 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetCapitalDepositHisrecV1RespItem>`"))),
701 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::WalletGetCapitalDepositHisrecV1RespItem>`")))),
702 }
703 } else {
704 let content = resp.text().await?;
705 let entity: Option<WalletGetCapitalDepositHisrecV1Error> = serde_json::from_str(&content).ok();
706 Err(Error::ResponseError(ResponseContent { status, content, entity }))
707 }
708}
709
710pub async fn wallet_get_capital_withdraw_address_list_v1(configuration: &configuration::Configuration) -> Result<Vec<models::WalletGetCapitalWithdrawAddressListV1RespItem>, Error<WalletGetCapitalWithdrawAddressListV1Error>> {
712
713 let uri_str = format!("{}/sapi/v1/capital/withdraw/address/list", configuration.base_path);
714 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
715
716 let mut query_params: Vec<(String, String)> = Vec::new();
718
719
720 let mut header_params = std::collections::HashMap::new();
722
723 if let Some(ref binance_auth) = configuration.binance_auth {
725 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
727
728 let body_string: Option<Vec<u8>> = None;
730
731 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
733 Ok(sig) => sig,
734 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
735 };
736
737 query_params.push(("signature".to_string(), signature));
739 }
740
741 if !query_params.is_empty() {
743 req_builder = req_builder.query(&query_params);
744 }
745
746
747 if let Some(ref user_agent) = configuration.user_agent {
749 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
750 }
751
752 for (header_name, header_value) in header_params {
754 req_builder = req_builder.header(&header_name, &header_value);
755 }
756
757
758 let req = req_builder.build()?;
759 let resp = configuration.client.execute(req).await?;
760
761 let status = resp.status();
762 let content_type = resp
763 .headers()
764 .get("content-type")
765 .and_then(|v| v.to_str().ok())
766 .unwrap_or("application/octet-stream");
767 let content_type = super::ContentType::from(content_type);
768
769 if !status.is_client_error() && !status.is_server_error() {
770 let content = resp.text().await?;
771 match content_type {
772 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
773 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetCapitalWithdrawAddressListV1RespItem>`"))),
774 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::WalletGetCapitalWithdrawAddressListV1RespItem>`")))),
775 }
776 } else {
777 let content = resp.text().await?;
778 let entity: Option<WalletGetCapitalWithdrawAddressListV1Error> = serde_json::from_str(&content).ok();
779 Err(Error::ResponseError(ResponseContent { status, content, entity }))
780 }
781}
782
783pub async fn wallet_get_capital_withdraw_history_v1(configuration: &configuration::Configuration, params: WalletGetCapitalWithdrawHistoryV1Params) -> Result<Vec<models::WalletGetCapitalWithdrawHistoryV1RespItem>, Error<WalletGetCapitalWithdrawHistoryV1Error>> {
785
786 let uri_str = format!("{}/sapi/v1/capital/withdraw/history", configuration.base_path);
787 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
788
789 let mut query_params: Vec<(String, String)> = Vec::new();
791
792 if let Some(ref param_value) = params.coin {
793 query_params.push(("coin".to_string(), param_value.to_string()));
794 }
795 if let Some(ref param_value) = params.withdraw_order_id {
796 query_params.push(("withdrawOrderId".to_string(), param_value.to_string()));
797 }
798 if let Some(ref param_value) = params.status {
799 query_params.push(("status".to_string(), param_value.to_string()));
800 }
801 if let Some(ref param_value) = params.offset {
802 query_params.push(("offset".to_string(), param_value.to_string()));
803 }
804 if let Some(ref param_value) = params.limit {
805 query_params.push(("limit".to_string(), param_value.to_string()));
806 }
807 if let Some(ref param_value) = params.id_list {
808 query_params.push(("idList".to_string(), param_value.to_string()));
809 }
810 if let Some(ref param_value) = params.start_time {
811 query_params.push(("startTime".to_string(), param_value.to_string()));
812 }
813 if let Some(ref param_value) = params.end_time {
814 query_params.push(("endTime".to_string(), param_value.to_string()));
815 }
816 if let Some(ref param_value) = params.recv_window {
817 query_params.push(("recvWindow".to_string(), param_value.to_string()));
818 }
819 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
820
821 let mut header_params = std::collections::HashMap::new();
823
824 if let Some(ref binance_auth) = configuration.binance_auth {
826 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
828
829 let body_string: Option<Vec<u8>> = None;
831
832 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
834 Ok(sig) => sig,
835 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
836 };
837
838 query_params.push(("signature".to_string(), signature));
840 }
841
842 if !query_params.is_empty() {
844 req_builder = req_builder.query(&query_params);
845 }
846
847
848 if let Some(ref user_agent) = configuration.user_agent {
850 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
851 }
852
853 for (header_name, header_value) in header_params {
855 req_builder = req_builder.header(&header_name, &header_value);
856 }
857
858
859 let req = req_builder.build()?;
860 let resp = configuration.client.execute(req).await?;
861
862 let status = resp.status();
863 let content_type = resp
864 .headers()
865 .get("content-type")
866 .and_then(|v| v.to_str().ok())
867 .unwrap_or("application/octet-stream");
868 let content_type = super::ContentType::from(content_type);
869
870 if !status.is_client_error() && !status.is_server_error() {
871 let content = resp.text().await?;
872 match content_type {
873 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
874 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WalletGetCapitalWithdrawHistoryV1RespItem>`"))),
875 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::WalletGetCapitalWithdrawHistoryV1RespItem>`")))),
876 }
877 } else {
878 let content = resp.text().await?;
879 let entity: Option<WalletGetCapitalWithdrawHistoryV1Error> = serde_json::from_str(&content).ok();
880 Err(Error::ResponseError(ResponseContent { status, content, entity }))
881 }
882}
883