1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::spot::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug, Default)]
19pub struct CreateApiReferralCustomizationV1Params {
20 pub customer_id: String,
21 pub email: String,
22 pub timestamp: i64,
23 pub recv_window: Option<i64>
24}
25
26#[derive(Clone, Debug, Default)]
28pub struct CreateApiReferralUserCustomizationV1Params {
29 pub api_agent_code: String,
30 pub customer_id: String,
31 pub timestamp: i64,
32 pub recv_window: Option<i64>
33}
34
35#[derive(Clone, Debug, Default)]
37pub struct CreateBrokerSubAccountApiCommissionCoinFuturesV1Params {
38 pub maker_adjustment: i32,
39 pub pair: String,
40 pub sub_account_id: String,
41 pub taker_adjustment: i32,
42 pub timestamp: i64,
43 pub recv_window: Option<i64>
44}
45
46#[derive(Clone, Debug, Default)]
48pub struct CreateBrokerSubAccountApiCommissionFuturesV1Params {
49 pub maker_adjustment: i32,
50 pub sub_account_id: String,
51 pub symbol: String,
52 pub taker_adjustment: i32,
53 pub timestamp: i64,
54 pub recv_window: Option<i64>
55}
56
57#[derive(Clone, Debug, Default)]
59pub struct CreateBrokerSubAccountApiCommissionV1Params {
60 pub maker_commission: f64,
61 pub sub_account_id: String,
62 pub taker_commission: f64,
63 pub timestamp: i64,
64 pub margin_maker_commission: Option<f64>,
65 pub margin_taker_commission: Option<f64>,
66 pub recv_window: Option<i64>
67}
68
69#[derive(Clone, Debug, Default)]
71pub struct CreateBrokerSubAccountApiIpRestrictionV2Params {
72 pub status: String,
73 pub sub_account_api_key: String,
74 pub sub_account_id: String,
75 pub timestamp: i64,
76 pub ip_address: Option<String>,
77 pub recv_window: Option<i64>
78}
79
80#[derive(Clone, Debug, Default)]
82pub struct CreateBrokerSubAccountApiPermissionUniversalTransferV1Params {
83 pub can_universal_transfer: String,
84 pub sub_account_api_key: String,
85 pub sub_account_id: i64,
86 pub timestamp: i64,
87 pub recv_window: Option<i64>
88}
89
90#[derive(Clone, Debug, Default)]
92pub struct CreateBrokerSubAccountApiPermissionV1Params {
93 pub can_trade: String,
94 pub futures_trade: String,
95 pub margin_trade: String,
96 pub sub_account_api_key: String,
97 pub sub_account_id: String,
98 pub timestamp: i64,
99 pub recv_window: Option<i64>
100}
101
102#[derive(Clone, Debug, Default)]
104pub struct CreateBrokerSubAccountApiV1Params {
105 pub can_trade: String,
106 pub sub_account_id: String,
107 pub timestamp: i64,
108 pub futures_trade: Option<String>,
109 pub margin_trade: Option<String>,
110 pub public_key: Option<String>,
111 pub recv_window: Option<i64>
112}
113
114#[derive(Clone, Debug, Default)]
116pub struct CreateBrokerSubAccountBnbBurnMarginInterestV1Params {
117 pub interest_bnb_burn: String,
118 pub sub_account_id: String,
119 pub timestamp: i64,
120 pub recv_window: Option<i64>
121}
122
123#[derive(Clone, Debug, Default)]
125pub struct CreateBrokerSubAccountBnbBurnSpotV1Params {
126 pub spot_bnb_burn: String,
127 pub sub_account_id: String,
128 pub timestamp: i64,
129 pub recv_window: Option<i64>
130}
131
132#[derive(Clone, Debug, Default)]
134pub struct CreateBrokerSubAccountFuturesV1Params {
135 pub futures: String,
136 pub sub_account_id: String,
137 pub timestamp: i64,
138 pub recv_window: Option<i64>
139}
140
141#[derive(Clone, Debug, Default)]
143pub struct CreateBrokerSubAccountV1Params {
144 pub timestamp: i64,
145 pub recv_window: Option<i64>,
146 pub tag: Option<String>
147}
148
149#[derive(Clone, Debug, Default)]
151pub struct CreateBrokerTransferFuturesV1Params {
152 pub amount: String,
153 pub asset: String,
154 pub futures_type: i64,
155 pub timestamp: i64,
156 pub client_tran_id: Option<String>,
157 pub from_id: Option<String>,
158 pub recv_window: Option<i64>,
159 pub to_id: Option<String>
160}
161
162#[derive(Clone, Debug, Default)]
164pub struct CreateBrokerTransferV1Params {
165 pub amount: String,
166 pub asset: String,
167 pub timestamp: i64,
168 pub client_tran_id: Option<String>,
169 pub from_id: Option<String>,
170 pub recv_window: Option<i64>,
171 pub to_id: Option<String>
172}
173
174#[derive(Clone, Debug, Default)]
176pub struct CreateBrokerUniversalTransferV1Params {
177 pub amount: String,
178 pub asset: String,
179 pub from_account_type: String,
180 pub timestamp: i64,
181 pub to_account_type: String,
182 pub client_tran_id: Option<String>,
183 pub from_id: Option<String>,
184 pub recv_window: Option<i64>,
185 pub to_id: Option<String>
186}
187
188#[derive(Clone, Debug, Default)]
190pub struct DeleteBrokerSubAccountApiIpRestrictionIpListV1Params {
191 pub sub_account_id: String,
192 pub sub_account_api_key: String,
193 pub timestamp: i64,
194 pub ip_address: Option<String>,
195 pub recv_window: Option<i64>
196}
197
198#[derive(Clone, Debug, Default)]
200pub struct DeleteBrokerSubAccountApiV1Params {
201 pub sub_account_id: String,
202 pub sub_account_api_key: String,
203 pub timestamp: i64,
204 pub recv_window: Option<i64>
205}
206
207#[derive(Clone, Debug, Default)]
209pub struct DeleteBrokerSubAccountV1Params {
210 pub sub_account_id: String,
211 pub timestamp: i64,
212 pub recv_window: Option<i64>
213}
214
215#[derive(Clone, Debug, Default)]
217pub struct GetApiReferralCustomizationV1Params {
218 pub timestamp: i64,
219 pub customer_id: Option<String>,
220 pub email: Option<String>,
221 pub recv_window: Option<i64>
222}
223
224#[derive(Clone, Debug, Default)]
226pub struct GetApiReferralIfNewUserV1Params {
227 pub api_agent_code: String,
229 pub timestamp: i64,
230 pub recv_window: Option<i64>
231}
232
233#[derive(Clone, Debug, Default)]
235pub struct GetApiReferralKickbackRecentRecordV1Params {
236 pub timestamp: i64,
237 pub start_time: Option<i64>,
238 pub end_time: Option<i64>,
239 pub limit: Option<i32>,
241 pub recv_window: Option<i64>
242}
243
244#[derive(Clone, Debug, Default)]
246pub struct GetApiReferralRebateRecentRecordV1Params {
247 pub start_time: i64,
248 pub end_time: i64,
249 pub limit: i32,
251 pub timestamp: i64,
252 pub customer_id: Option<String>,
253 pub recv_window: Option<i64>
254}
255
256#[derive(Clone, Debug, Default)]
258pub struct GetApiReferralUserCustomizationV1Params {
259 pub api_agent_code: String,
261 pub timestamp: i64,
262 pub recv_window: Option<i64>
263}
264
265#[derive(Clone, Debug, Default)]
267pub struct GetBrokerInfoV1Params {
268 pub timestamp: i64,
269 pub recv_window: Option<i64>
270}
271
272#[derive(Clone, Debug, Default)]
274pub struct GetBrokerRebateFuturesRecentRecordV1Params {
275 pub futures_type: i64,
277 pub start_time: i64,
278 pub end_time: i64,
279 pub timestamp: i64,
280 pub page: Option<i64>,
282 pub size: Option<i64>,
284 pub filter_result: Option<bool>,
286 pub recv_window: Option<i64>
287}
288
289#[derive(Clone, Debug, Default)]
291pub struct GetBrokerRebateRecentRecordV1Params {
292 pub timestamp: i64,
293 pub sub_account_id: Option<String>,
294 pub start_time: Option<i64>,
296 pub end_time: Option<i64>,
298 pub page: Option<i64>,
300 pub size: Option<i64>,
302 pub recv_window: Option<i64>
303}
304
305#[derive(Clone, Debug, Default)]
307pub struct GetBrokerSubAccountApiCommissionCoinFuturesV1Params {
308 pub sub_account_id: String,
309 pub timestamp: i64,
310 pub pair: Option<String>,
312 pub recv_window: Option<i64>
313}
314
315#[derive(Clone, Debug, Default)]
317pub struct GetBrokerSubAccountApiCommissionFuturesV1Params {
318 pub sub_account_id: String,
319 pub timestamp: i64,
320 pub symbol: Option<String>,
321 pub recv_window: Option<i64>
322}
323
324#[derive(Clone, Debug, Default)]
326pub struct GetBrokerSubAccountApiIpRestrictionV1Params {
327 pub sub_account_id: String,
328 pub sub_account_api_key: String,
329 pub timestamp: i64,
330 pub recv_window: Option<i64>
331}
332
333#[derive(Clone, Debug, Default)]
335pub struct GetBrokerSubAccountApiV1Params {
336 pub sub_account_id: String,
337 pub timestamp: i64,
338 pub sub_account_api_key: Option<String>,
339 pub page: Option<i64>,
341 pub size: Option<i64>,
343 pub recv_window: Option<i64>
344}
345
346#[derive(Clone, Debug, Default)]
348pub struct GetBrokerSubAccountBnbBurnStatusV1Params {
349 pub sub_account_id: String,
350 pub timestamp: i64,
351 pub recv_window: Option<i64>
352}
353
354#[derive(Clone, Debug, Default)]
356pub struct GetBrokerSubAccountDepositHistV1Params {
357 pub timestamp: i64,
358 pub sub_account_id: Option<String>,
359 pub coin: Option<String>,
360 pub status: Option<i32>,
362 pub start_time: Option<i64>,
364 pub end_time: Option<i64>,
366 pub limit: Option<i32>,
368 pub offset: Option<i32>,
370 pub recv_window: Option<i64>
371}
372
373#[derive(Clone, Debug, Default)]
375pub struct GetBrokerSubAccountDepositHistV2Params {
376 pub deposit_id: String,
377 pub sub_account_id: String,
378 pub timestamp: i64,
379 pub limit: Option<i32>,
381 pub offset: Option<i32>,
383 pub recv_window: Option<i64>
384}
385
386#[derive(Clone, Debug, Default)]
388pub struct GetBrokerSubAccountFuturesSummaryV3Params {
389 pub futures_type: i32,
391 pub timestamp: i64,
392 pub sub_account_id: Option<String>,
393 pub page: Option<i64>,
395 pub size: Option<i64>,
397 pub recv_window: Option<i64>
398}
399
400#[derive(Clone, Debug, Default)]
402pub struct GetBrokerSubAccountMarginSummaryV1Params {
403 pub timestamp: i64,
404 pub sub_account_id: Option<String>,
405 pub page: Option<i64>,
407 pub size: Option<i64>,
409 pub recv_window: Option<i64>
410}
411
412#[derive(Clone, Debug, Default)]
414pub struct GetBrokerSubAccountSpotSummaryV1Params {
415 pub timestamp: i64,
416 pub sub_account_id: Option<String>,
417 pub page: Option<i64>,
419 pub size: Option<i64>,
421 pub recv_window: Option<i64>
422}
423
424#[derive(Clone, Debug, Default)]
426pub struct GetBrokerSubAccountV1Params {
427 pub timestamp: i64,
428 pub sub_account_id: Option<String>,
429 pub page: Option<i64>,
431 pub size: Option<i64>,
433 pub recv_window: Option<i64>
434}
435
436#[derive(Clone, Debug, Default)]
438pub struct GetBrokerTransferFuturesV1Params {
439 pub sub_account_id: String,
440 pub futures_type: i64,
442 pub timestamp: i64,
443 pub client_tran_id: Option<String>,
444 pub start_time: Option<i64>,
446 pub end_time: Option<i64>,
448 pub page: Option<i32>,
450 pub limit: Option<i32>,
452 pub recv_window: Option<i64>
453}
454
455#[derive(Clone, Debug, Default)]
457pub struct GetBrokerTransferV1Params {
458 pub timestamp: i64,
459 pub from_id: Option<String>,
460 pub to_id: Option<String>,
461 pub client_tran_id: Option<String>,
463 pub show_all_status: Option<String>,
465 pub start_time: Option<i64>,
466 pub end_time: Option<i64>,
467 pub page: Option<i32>,
468 pub limit: Option<i32>,
470 pub recv_window: Option<i64>
471}
472
473#[derive(Clone, Debug, Default)]
475pub struct GetBrokerUniversalTransferV1Params {
476 pub timestamp: i64,
477 pub from_id: Option<String>,
478 pub to_id: Option<String>,
479 pub client_tran_id: Option<String>,
481 pub start_time: Option<i64>,
482 pub end_time: Option<i64>,
483 pub page: Option<i32>,
485 pub limit: Option<i32>,
487 pub show_all_status: Option<bool>,
489 pub recv_window: Option<i64>
490}
491
492
493#[derive(Debug, Clone, Serialize, Deserialize)]
495#[serde(untagged)]
496pub enum CreateApiReferralCustomizationV1Error {
497 Status4XX(models::ApiError),
498 Status5XX(models::ApiError),
499 UnknownValue(serde_json::Value),
500}
501
502#[derive(Debug, Clone, Serialize, Deserialize)]
504#[serde(untagged)]
505pub enum CreateApiReferralUserCustomizationV1Error {
506 Status4XX(models::ApiError),
507 Status5XX(models::ApiError),
508 UnknownValue(serde_json::Value),
509}
510
511#[derive(Debug, Clone, Serialize, Deserialize)]
513#[serde(untagged)]
514pub enum CreateBrokerSubAccountApiCommissionCoinFuturesV1Error {
515 Status4XX(models::ApiError),
516 Status5XX(models::ApiError),
517 UnknownValue(serde_json::Value),
518}
519
520#[derive(Debug, Clone, Serialize, Deserialize)]
522#[serde(untagged)]
523pub enum CreateBrokerSubAccountApiCommissionFuturesV1Error {
524 Status4XX(models::ApiError),
525 Status5XX(models::ApiError),
526 UnknownValue(serde_json::Value),
527}
528
529#[derive(Debug, Clone, Serialize, Deserialize)]
531#[serde(untagged)]
532pub enum CreateBrokerSubAccountApiCommissionV1Error {
533 Status4XX(models::ApiError),
534 Status5XX(models::ApiError),
535 UnknownValue(serde_json::Value),
536}
537
538#[derive(Debug, Clone, Serialize, Deserialize)]
540#[serde(untagged)]
541pub enum CreateBrokerSubAccountApiIpRestrictionV2Error {
542 Status4XX(models::ApiError),
543 Status5XX(models::ApiError),
544 UnknownValue(serde_json::Value),
545}
546
547#[derive(Debug, Clone, Serialize, Deserialize)]
549#[serde(untagged)]
550pub enum CreateBrokerSubAccountApiPermissionUniversalTransferV1Error {
551 Status4XX(models::ApiError),
552 Status5XX(models::ApiError),
553 UnknownValue(serde_json::Value),
554}
555
556#[derive(Debug, Clone, Serialize, Deserialize)]
558#[serde(untagged)]
559pub enum CreateBrokerSubAccountApiPermissionV1Error {
560 Status4XX(models::ApiError),
561 Status5XX(models::ApiError),
562 UnknownValue(serde_json::Value),
563}
564
565#[derive(Debug, Clone, Serialize, Deserialize)]
567#[serde(untagged)]
568pub enum CreateBrokerSubAccountApiV1Error {
569 Status4XX(models::ApiError),
570 Status5XX(models::ApiError),
571 UnknownValue(serde_json::Value),
572}
573
574#[derive(Debug, Clone, Serialize, Deserialize)]
576#[serde(untagged)]
577pub enum CreateBrokerSubAccountBnbBurnMarginInterestV1Error {
578 Status4XX(models::ApiError),
579 Status5XX(models::ApiError),
580 UnknownValue(serde_json::Value),
581}
582
583#[derive(Debug, Clone, Serialize, Deserialize)]
585#[serde(untagged)]
586pub enum CreateBrokerSubAccountBnbBurnSpotV1Error {
587 Status4XX(models::ApiError),
588 Status5XX(models::ApiError),
589 UnknownValue(serde_json::Value),
590}
591
592#[derive(Debug, Clone, Serialize, Deserialize)]
594#[serde(untagged)]
595pub enum CreateBrokerSubAccountFuturesV1Error {
596 Status4XX(models::ApiError),
597 Status5XX(models::ApiError),
598 UnknownValue(serde_json::Value),
599}
600
601#[derive(Debug, Clone, Serialize, Deserialize)]
603#[serde(untagged)]
604pub enum CreateBrokerSubAccountV1Error {
605 Status4XX(models::ApiError),
606 Status5XX(models::ApiError),
607 UnknownValue(serde_json::Value),
608}
609
610#[derive(Debug, Clone, Serialize, Deserialize)]
612#[serde(untagged)]
613pub enum CreateBrokerTransferFuturesV1Error {
614 Status4XX(models::ApiError),
615 Status5XX(models::ApiError),
616 UnknownValue(serde_json::Value),
617}
618
619#[derive(Debug, Clone, Serialize, Deserialize)]
621#[serde(untagged)]
622pub enum CreateBrokerTransferV1Error {
623 Status4XX(models::ApiError),
624 Status5XX(models::ApiError),
625 UnknownValue(serde_json::Value),
626}
627
628#[derive(Debug, Clone, Serialize, Deserialize)]
630#[serde(untagged)]
631pub enum CreateBrokerUniversalTransferV1Error {
632 Status4XX(models::ApiError),
633 Status5XX(models::ApiError),
634 UnknownValue(serde_json::Value),
635}
636
637#[derive(Debug, Clone, Serialize, Deserialize)]
639#[serde(untagged)]
640pub enum DeleteBrokerSubAccountApiIpRestrictionIpListV1Error {
641 Status4XX(models::ApiError),
642 Status5XX(models::ApiError),
643 UnknownValue(serde_json::Value),
644}
645
646#[derive(Debug, Clone, Serialize, Deserialize)]
648#[serde(untagged)]
649pub enum DeleteBrokerSubAccountApiV1Error {
650 Status4XX(models::ApiError),
651 Status5XX(models::ApiError),
652 UnknownValue(serde_json::Value),
653}
654
655#[derive(Debug, Clone, Serialize, Deserialize)]
657#[serde(untagged)]
658pub enum DeleteBrokerSubAccountV1Error {
659 Status4XX(models::ApiError),
660 Status5XX(models::ApiError),
661 UnknownValue(serde_json::Value),
662}
663
664#[derive(Debug, Clone, Serialize, Deserialize)]
666#[serde(untagged)]
667pub enum GetApiReferralCustomizationV1Error {
668 Status4XX(models::ApiError),
669 Status5XX(models::ApiError),
670 UnknownValue(serde_json::Value),
671}
672
673#[derive(Debug, Clone, Serialize, Deserialize)]
675#[serde(untagged)]
676pub enum GetApiReferralIfNewUserV1Error {
677 Status4XX(models::ApiError),
678 Status5XX(models::ApiError),
679 UnknownValue(serde_json::Value),
680}
681
682#[derive(Debug, Clone, Serialize, Deserialize)]
684#[serde(untagged)]
685pub enum GetApiReferralKickbackRecentRecordV1Error {
686 Status4XX(models::ApiError),
687 Status5XX(models::ApiError),
688 UnknownValue(serde_json::Value),
689}
690
691#[derive(Debug, Clone, Serialize, Deserialize)]
693#[serde(untagged)]
694pub enum GetApiReferralRebateRecentRecordV1Error {
695 Status4XX(models::ApiError),
696 Status5XX(models::ApiError),
697 UnknownValue(serde_json::Value),
698}
699
700#[derive(Debug, Clone, Serialize, Deserialize)]
702#[serde(untagged)]
703pub enum GetApiReferralUserCustomizationV1Error {
704 Status4XX(models::ApiError),
705 Status5XX(models::ApiError),
706 UnknownValue(serde_json::Value),
707}
708
709#[derive(Debug, Clone, Serialize, Deserialize)]
711#[serde(untagged)]
712pub enum GetBrokerInfoV1Error {
713 Status4XX(models::ApiError),
714 Status5XX(models::ApiError),
715 UnknownValue(serde_json::Value),
716}
717
718#[derive(Debug, Clone, Serialize, Deserialize)]
720#[serde(untagged)]
721pub enum GetBrokerRebateFuturesRecentRecordV1Error {
722 Status4XX(models::ApiError),
723 Status5XX(models::ApiError),
724 UnknownValue(serde_json::Value),
725}
726
727#[derive(Debug, Clone, Serialize, Deserialize)]
729#[serde(untagged)]
730pub enum GetBrokerRebateRecentRecordV1Error {
731 Status4XX(models::ApiError),
732 Status5XX(models::ApiError),
733 UnknownValue(serde_json::Value),
734}
735
736#[derive(Debug, Clone, Serialize, Deserialize)]
738#[serde(untagged)]
739pub enum GetBrokerSubAccountApiCommissionCoinFuturesV1Error {
740 Status4XX(models::ApiError),
741 Status5XX(models::ApiError),
742 UnknownValue(serde_json::Value),
743}
744
745#[derive(Debug, Clone, Serialize, Deserialize)]
747#[serde(untagged)]
748pub enum GetBrokerSubAccountApiCommissionFuturesV1Error {
749 Status4XX(models::ApiError),
750 Status5XX(models::ApiError),
751 UnknownValue(serde_json::Value),
752}
753
754#[derive(Debug, Clone, Serialize, Deserialize)]
756#[serde(untagged)]
757pub enum GetBrokerSubAccountApiIpRestrictionV1Error {
758 Status4XX(models::ApiError),
759 Status5XX(models::ApiError),
760 UnknownValue(serde_json::Value),
761}
762
763#[derive(Debug, Clone, Serialize, Deserialize)]
765#[serde(untagged)]
766pub enum GetBrokerSubAccountApiV1Error {
767 Status4XX(models::ApiError),
768 Status5XX(models::ApiError),
769 UnknownValue(serde_json::Value),
770}
771
772#[derive(Debug, Clone, Serialize, Deserialize)]
774#[serde(untagged)]
775pub enum GetBrokerSubAccountBnbBurnStatusV1Error {
776 Status4XX(models::ApiError),
777 Status5XX(models::ApiError),
778 UnknownValue(serde_json::Value),
779}
780
781#[derive(Debug, Clone, Serialize, Deserialize)]
783#[serde(untagged)]
784pub enum GetBrokerSubAccountDepositHistV1Error {
785 Status4XX(models::ApiError),
786 Status5XX(models::ApiError),
787 UnknownValue(serde_json::Value),
788}
789
790#[derive(Debug, Clone, Serialize, Deserialize)]
792#[serde(untagged)]
793pub enum GetBrokerSubAccountDepositHistV2Error {
794 Status4XX(models::ApiError),
795 Status5XX(models::ApiError),
796 UnknownValue(serde_json::Value),
797}
798
799#[derive(Debug, Clone, Serialize, Deserialize)]
801#[serde(untagged)]
802pub enum GetBrokerSubAccountFuturesSummaryV3Error {
803 Status4XX(models::ApiError),
804 Status5XX(models::ApiError),
805 UnknownValue(serde_json::Value),
806}
807
808#[derive(Debug, Clone, Serialize, Deserialize)]
810#[serde(untagged)]
811pub enum GetBrokerSubAccountMarginSummaryV1Error {
812 Status4XX(models::ApiError),
813 Status5XX(models::ApiError),
814 UnknownValue(serde_json::Value),
815}
816
817#[derive(Debug, Clone, Serialize, Deserialize)]
819#[serde(untagged)]
820pub enum GetBrokerSubAccountSpotSummaryV1Error {
821 Status4XX(models::ApiError),
822 Status5XX(models::ApiError),
823 UnknownValue(serde_json::Value),
824}
825
826#[derive(Debug, Clone, Serialize, Deserialize)]
828#[serde(untagged)]
829pub enum GetBrokerSubAccountV1Error {
830 Status4XX(models::ApiError),
831 Status5XX(models::ApiError),
832 UnknownValue(serde_json::Value),
833}
834
835#[derive(Debug, Clone, Serialize, Deserialize)]
837#[serde(untagged)]
838pub enum GetBrokerTransferFuturesV1Error {
839 Status4XX(models::ApiError),
840 Status5XX(models::ApiError),
841 UnknownValue(serde_json::Value),
842}
843
844#[derive(Debug, Clone, Serialize, Deserialize)]
846#[serde(untagged)]
847pub enum GetBrokerTransferV1Error {
848 Status4XX(models::ApiError),
849 Status5XX(models::ApiError),
850 UnknownValue(serde_json::Value),
851}
852
853#[derive(Debug, Clone, Serialize, Deserialize)]
855#[serde(untagged)]
856pub enum GetBrokerUniversalTransferV1Error {
857 Status4XX(models::ApiError),
858 Status5XX(models::ApiError),
859 UnknownValue(serde_json::Value),
860}
861
862
863pub async fn create_api_referral_customization_v1(configuration: &configuration::Configuration, params: CreateApiReferralCustomizationV1Params) -> Result<models::CreateApiReferralCustomizationV1Resp, Error<CreateApiReferralCustomizationV1Error>> {
865
866 let uri_str = format!("{}/sapi/v1/apiReferral/customization", configuration.base_path);
867 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
868
869 let mut query_params: Vec<(String, String)> = Vec::new();
871
872
873 let mut header_params = std::collections::HashMap::new();
875
876 if let Some(ref binance_auth) = configuration.binance_auth {
878 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
880
881 let body_string: Option<Vec<u8>> = None;
883
884 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
886 Ok(sig) => sig,
887 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
888 };
889
890 query_params.push(("signature".to_string(), signature));
892 }
893
894 if !query_params.is_empty() {
896 req_builder = req_builder.query(&query_params);
897 }
898
899
900 if let Some(ref user_agent) = configuration.user_agent {
902 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
903 }
904
905 for (header_name, header_value) in header_params {
907 req_builder = req_builder.header(&header_name, &header_value);
908 }
909
910 let mut multipart_form_params = std::collections::HashMap::new();
911 multipart_form_params.insert("customerId", params.customer_id.to_string());
912 multipart_form_params.insert("email", params.email.to_string());
913 if let Some(param_value) = params.recv_window {
914 multipart_form_params.insert("recvWindow", param_value.to_string());
915 }
916 multipart_form_params.insert("timestamp", params.timestamp.to_string());
917 req_builder = req_builder.form(&multipart_form_params);
918
919 let req = req_builder.build()?;
920 let resp = configuration.client.execute(req).await?;
921
922 let status = resp.status();
923 let content_type = resp
924 .headers()
925 .get("content-type")
926 .and_then(|v| v.to_str().ok())
927 .unwrap_or("application/octet-stream");
928 let content_type = super::ContentType::from(content_type);
929
930 if !status.is_client_error() && !status.is_server_error() {
931 let content = resp.text().await?;
932 match content_type {
933 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
934 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateApiReferralCustomizationV1Resp`"))),
935 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::CreateApiReferralCustomizationV1Resp`")))),
936 }
937 } else {
938 let content = resp.text().await?;
939 let entity: Option<CreateApiReferralCustomizationV1Error> = serde_json::from_str(&content).ok();
940 Err(Error::ResponseError(ResponseContent { status, content, entity }))
941 }
942}
943
944pub async fn create_api_referral_user_customization_v1(configuration: &configuration::Configuration, params: CreateApiReferralUserCustomizationV1Params) -> Result<models::CreateApiReferralUserCustomizationV1Resp, Error<CreateApiReferralUserCustomizationV1Error>> {
946
947 let uri_str = format!("{}/sapi/v1/apiReferral/userCustomization", configuration.base_path);
948 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
949
950 let mut query_params: Vec<(String, String)> = Vec::new();
952
953
954 let mut header_params = std::collections::HashMap::new();
956
957 if let Some(ref binance_auth) = configuration.binance_auth {
959 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
961
962 let body_string: Option<Vec<u8>> = None;
964
965 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
967 Ok(sig) => sig,
968 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
969 };
970
971 query_params.push(("signature".to_string(), signature));
973 }
974
975 if !query_params.is_empty() {
977 req_builder = req_builder.query(&query_params);
978 }
979
980
981 if let Some(ref user_agent) = configuration.user_agent {
983 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
984 }
985
986 for (header_name, header_value) in header_params {
988 req_builder = req_builder.header(&header_name, &header_value);
989 }
990
991 let mut multipart_form_params = std::collections::HashMap::new();
992 multipart_form_params.insert("apiAgentCode", params.api_agent_code.to_string());
993 multipart_form_params.insert("customerId", params.customer_id.to_string());
994 if let Some(param_value) = params.recv_window {
995 multipart_form_params.insert("recvWindow", param_value.to_string());
996 }
997 multipart_form_params.insert("timestamp", params.timestamp.to_string());
998 req_builder = req_builder.form(&multipart_form_params);
999
1000 let req = req_builder.build()?;
1001 let resp = configuration.client.execute(req).await?;
1002
1003 let status = resp.status();
1004 let content_type = resp
1005 .headers()
1006 .get("content-type")
1007 .and_then(|v| v.to_str().ok())
1008 .unwrap_or("application/octet-stream");
1009 let content_type = super::ContentType::from(content_type);
1010
1011 if !status.is_client_error() && !status.is_server_error() {
1012 let content = resp.text().await?;
1013 match content_type {
1014 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1015 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateApiReferralUserCustomizationV1Resp`"))),
1016 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::CreateApiReferralUserCustomizationV1Resp`")))),
1017 }
1018 } else {
1019 let content = resp.text().await?;
1020 let entity: Option<CreateApiReferralUserCustomizationV1Error> = serde_json::from_str(&content).ok();
1021 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1022 }
1023}
1024
1025pub async fn create_broker_sub_account_api_commission_coin_futures_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiCommissionCoinFuturesV1Params) -> Result<models::CreateBrokerSubAccountApiCommissionCoinFuturesV1Resp, Error<CreateBrokerSubAccountApiCommissionCoinFuturesV1Error>> {
1027
1028 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission/coinFutures", configuration.base_path);
1029 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1030
1031 let mut query_params: Vec<(String, String)> = Vec::new();
1033
1034
1035 let mut header_params = std::collections::HashMap::new();
1037
1038 if let Some(ref binance_auth) = configuration.binance_auth {
1040 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1042
1043 let body_string: Option<Vec<u8>> = None;
1045
1046 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1048 Ok(sig) => sig,
1049 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1050 };
1051
1052 query_params.push(("signature".to_string(), signature));
1054 }
1055
1056 if !query_params.is_empty() {
1058 req_builder = req_builder.query(&query_params);
1059 }
1060
1061
1062 if let Some(ref user_agent) = configuration.user_agent {
1064 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1065 }
1066
1067 for (header_name, header_value) in header_params {
1069 req_builder = req_builder.header(&header_name, &header_value);
1070 }
1071
1072 let mut multipart_form_params = std::collections::HashMap::new();
1073 multipart_form_params.insert("makerAdjustment", params.maker_adjustment.to_string());
1074 multipart_form_params.insert("pair", params.pair.to_string());
1075 if let Some(param_value) = params.recv_window {
1076 multipart_form_params.insert("recvWindow", param_value.to_string());
1077 }
1078 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1079 multipart_form_params.insert("takerAdjustment", params.taker_adjustment.to_string());
1080 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1081 req_builder = req_builder.form(&multipart_form_params);
1082
1083 let req = req_builder.build()?;
1084 let resp = configuration.client.execute(req).await?;
1085
1086 let status = resp.status();
1087 let content_type = resp
1088 .headers()
1089 .get("content-type")
1090 .and_then(|v| v.to_str().ok())
1091 .unwrap_or("application/octet-stream");
1092 let content_type = super::ContentType::from(content_type);
1093
1094 if !status.is_client_error() && !status.is_server_error() {
1095 let content = resp.text().await?;
1096 match content_type {
1097 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1098 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiCommissionCoinFuturesV1Resp`"))),
1099 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::CreateBrokerSubAccountApiCommissionCoinFuturesV1Resp`")))),
1100 }
1101 } else {
1102 let content = resp.text().await?;
1103 let entity: Option<CreateBrokerSubAccountApiCommissionCoinFuturesV1Error> = serde_json::from_str(&content).ok();
1104 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1105 }
1106}
1107
1108pub async fn create_broker_sub_account_api_commission_futures_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiCommissionFuturesV1Params) -> Result<models::CreateBrokerSubAccountApiCommissionFuturesV1Resp, Error<CreateBrokerSubAccountApiCommissionFuturesV1Error>> {
1110
1111 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission/futures", configuration.base_path);
1112 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1113
1114 let mut query_params: Vec<(String, String)> = Vec::new();
1116
1117
1118 let mut header_params = std::collections::HashMap::new();
1120
1121 if let Some(ref binance_auth) = configuration.binance_auth {
1123 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1125
1126 let body_string: Option<Vec<u8>> = None;
1128
1129 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1131 Ok(sig) => sig,
1132 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1133 };
1134
1135 query_params.push(("signature".to_string(), signature));
1137 }
1138
1139 if !query_params.is_empty() {
1141 req_builder = req_builder.query(&query_params);
1142 }
1143
1144
1145 if let Some(ref user_agent) = configuration.user_agent {
1147 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1148 }
1149
1150 for (header_name, header_value) in header_params {
1152 req_builder = req_builder.header(&header_name, &header_value);
1153 }
1154
1155 let mut multipart_form_params = std::collections::HashMap::new();
1156 multipart_form_params.insert("makerAdjustment", params.maker_adjustment.to_string());
1157 if let Some(param_value) = params.recv_window {
1158 multipart_form_params.insert("recvWindow", param_value.to_string());
1159 }
1160 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1161 multipart_form_params.insert("symbol", params.symbol.to_string());
1162 multipart_form_params.insert("takerAdjustment", params.taker_adjustment.to_string());
1163 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1164 req_builder = req_builder.form(&multipart_form_params);
1165
1166 let req = req_builder.build()?;
1167 let resp = configuration.client.execute(req).await?;
1168
1169 let status = resp.status();
1170 let content_type = resp
1171 .headers()
1172 .get("content-type")
1173 .and_then(|v| v.to_str().ok())
1174 .unwrap_or("application/octet-stream");
1175 let content_type = super::ContentType::from(content_type);
1176
1177 if !status.is_client_error() && !status.is_server_error() {
1178 let content = resp.text().await?;
1179 match content_type {
1180 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1181 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiCommissionFuturesV1Resp`"))),
1182 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::CreateBrokerSubAccountApiCommissionFuturesV1Resp`")))),
1183 }
1184 } else {
1185 let content = resp.text().await?;
1186 let entity: Option<CreateBrokerSubAccountApiCommissionFuturesV1Error> = serde_json::from_str(&content).ok();
1187 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1188 }
1189}
1190
1191pub async fn create_broker_sub_account_api_commission_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiCommissionV1Params) -> Result<models::CreateBrokerSubAccountApiCommissionV1Resp, Error<CreateBrokerSubAccountApiCommissionV1Error>> {
1193
1194 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission", configuration.base_path);
1195 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1196
1197 let mut query_params: Vec<(String, String)> = Vec::new();
1199
1200
1201 let mut header_params = std::collections::HashMap::new();
1203
1204 if let Some(ref binance_auth) = configuration.binance_auth {
1206 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1208
1209 let body_string: Option<Vec<u8>> = None;
1211
1212 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1214 Ok(sig) => sig,
1215 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1216 };
1217
1218 query_params.push(("signature".to_string(), signature));
1220 }
1221
1222 if !query_params.is_empty() {
1224 req_builder = req_builder.query(&query_params);
1225 }
1226
1227
1228 if let Some(ref user_agent) = configuration.user_agent {
1230 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1231 }
1232
1233 for (header_name, header_value) in header_params {
1235 req_builder = req_builder.header(&header_name, &header_value);
1236 }
1237
1238 let mut multipart_form_params = std::collections::HashMap::new();
1239 multipart_form_params.insert("makerCommission", params.maker_commission.to_string());
1240 if let Some(param_value) = params.margin_maker_commission {
1241 multipart_form_params.insert("marginMakerCommission", param_value.to_string());
1242 }
1243 if let Some(param_value) = params.margin_taker_commission {
1244 multipart_form_params.insert("marginTakerCommission", param_value.to_string());
1245 }
1246 if let Some(param_value) = params.recv_window {
1247 multipart_form_params.insert("recvWindow", param_value.to_string());
1248 }
1249 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1250 multipart_form_params.insert("takerCommission", params.taker_commission.to_string());
1251 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1252 req_builder = req_builder.form(&multipart_form_params);
1253
1254 let req = req_builder.build()?;
1255 let resp = configuration.client.execute(req).await?;
1256
1257 let status = resp.status();
1258 let content_type = resp
1259 .headers()
1260 .get("content-type")
1261 .and_then(|v| v.to_str().ok())
1262 .unwrap_or("application/octet-stream");
1263 let content_type = super::ContentType::from(content_type);
1264
1265 if !status.is_client_error() && !status.is_server_error() {
1266 let content = resp.text().await?;
1267 match content_type {
1268 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1269 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiCommissionV1Resp`"))),
1270 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::CreateBrokerSubAccountApiCommissionV1Resp`")))),
1271 }
1272 } else {
1273 let content = resp.text().await?;
1274 let entity: Option<CreateBrokerSubAccountApiCommissionV1Error> = serde_json::from_str(&content).ok();
1275 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1276 }
1277}
1278
1279pub async fn create_broker_sub_account_api_ip_restriction_v2(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiIpRestrictionV2Params) -> Result<models::CreateBrokerSubAccountApiIpRestrictionV2Resp, Error<CreateBrokerSubAccountApiIpRestrictionV2Error>> {
1280
1281 let uri_str = format!("{}/sapi/v2/broker/subAccountApi/ipRestriction", configuration.base_path);
1282 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1283
1284 let mut query_params: Vec<(String, String)> = Vec::new();
1286
1287
1288 let mut header_params = std::collections::HashMap::new();
1290
1291 if let Some(ref binance_auth) = configuration.binance_auth {
1293 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1295
1296 let body_string: Option<Vec<u8>> = None;
1298
1299 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1301 Ok(sig) => sig,
1302 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1303 };
1304
1305 query_params.push(("signature".to_string(), signature));
1307 }
1308
1309 if !query_params.is_empty() {
1311 req_builder = req_builder.query(&query_params);
1312 }
1313
1314
1315 if let Some(ref user_agent) = configuration.user_agent {
1317 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1318 }
1319
1320 for (header_name, header_value) in header_params {
1322 req_builder = req_builder.header(&header_name, &header_value);
1323 }
1324
1325 let mut multipart_form_params = std::collections::HashMap::new();
1326 if let Some(param_value) = params.ip_address {
1327 multipart_form_params.insert("ipAddress", param_value.to_string());
1328 }
1329 if let Some(param_value) = params.recv_window {
1330 multipart_form_params.insert("recvWindow", param_value.to_string());
1331 }
1332 multipart_form_params.insert("status", params.status.to_string());
1333 multipart_form_params.insert("subAccountApiKey", params.sub_account_api_key.to_string());
1334 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1335 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1336 req_builder = req_builder.form(&multipart_form_params);
1337
1338 let req = req_builder.build()?;
1339 let resp = configuration.client.execute(req).await?;
1340
1341 let status = resp.status();
1342 let content_type = resp
1343 .headers()
1344 .get("content-type")
1345 .and_then(|v| v.to_str().ok())
1346 .unwrap_or("application/octet-stream");
1347 let content_type = super::ContentType::from(content_type);
1348
1349 if !status.is_client_error() && !status.is_server_error() {
1350 let content = resp.text().await?;
1351 match content_type {
1352 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1353 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiIpRestrictionV2Resp`"))),
1354 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::CreateBrokerSubAccountApiIpRestrictionV2Resp`")))),
1355 }
1356 } else {
1357 let content = resp.text().await?;
1358 let entity: Option<CreateBrokerSubAccountApiIpRestrictionV2Error> = serde_json::from_str(&content).ok();
1359 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1360 }
1361}
1362
1363pub async fn create_broker_sub_account_api_permission_universal_transfer_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiPermissionUniversalTransferV1Params) -> Result<models::CreateBrokerSubAccountApiPermissionUniversalTransferV1Resp, Error<CreateBrokerSubAccountApiPermissionUniversalTransferV1Error>> {
1365
1366 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/permission/universalTransfer", configuration.base_path);
1367 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1368
1369 let mut query_params: Vec<(String, String)> = Vec::new();
1371
1372
1373 let mut header_params = std::collections::HashMap::new();
1375
1376 if let Some(ref binance_auth) = configuration.binance_auth {
1378 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1380
1381 let body_string: Option<Vec<u8>> = None;
1383
1384 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1386 Ok(sig) => sig,
1387 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1388 };
1389
1390 query_params.push(("signature".to_string(), signature));
1392 }
1393
1394 if !query_params.is_empty() {
1396 req_builder = req_builder.query(&query_params);
1397 }
1398
1399
1400 if let Some(ref user_agent) = configuration.user_agent {
1402 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1403 }
1404
1405 for (header_name, header_value) in header_params {
1407 req_builder = req_builder.header(&header_name, &header_value);
1408 }
1409
1410 let mut multipart_form_params = std::collections::HashMap::new();
1411 multipart_form_params.insert("canUniversalTransfer", params.can_universal_transfer.to_string());
1412 if let Some(param_value) = params.recv_window {
1413 multipart_form_params.insert("recvWindow", param_value.to_string());
1414 }
1415 multipart_form_params.insert("subAccountApiKey", params.sub_account_api_key.to_string());
1416 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1417 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1418 req_builder = req_builder.form(&multipart_form_params);
1419
1420 let req = req_builder.build()?;
1421 let resp = configuration.client.execute(req).await?;
1422
1423 let status = resp.status();
1424 let content_type = resp
1425 .headers()
1426 .get("content-type")
1427 .and_then(|v| v.to_str().ok())
1428 .unwrap_or("application/octet-stream");
1429 let content_type = super::ContentType::from(content_type);
1430
1431 if !status.is_client_error() && !status.is_server_error() {
1432 let content = resp.text().await?;
1433 match content_type {
1434 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1435 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiPermissionUniversalTransferV1Resp`"))),
1436 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::CreateBrokerSubAccountApiPermissionUniversalTransferV1Resp`")))),
1437 }
1438 } else {
1439 let content = resp.text().await?;
1440 let entity: Option<CreateBrokerSubAccountApiPermissionUniversalTransferV1Error> = serde_json::from_str(&content).ok();
1441 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1442 }
1443}
1444
1445pub async fn create_broker_sub_account_api_permission_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiPermissionV1Params) -> Result<models::CreateBrokerSubAccountApiPermissionV1Resp, Error<CreateBrokerSubAccountApiPermissionV1Error>> {
1447
1448 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/permission", configuration.base_path);
1449 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1450
1451 let mut query_params: Vec<(String, String)> = Vec::new();
1453
1454
1455 let mut header_params = std::collections::HashMap::new();
1457
1458 if let Some(ref binance_auth) = configuration.binance_auth {
1460 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1462
1463 let body_string: Option<Vec<u8>> = None;
1465
1466 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1468 Ok(sig) => sig,
1469 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1470 };
1471
1472 query_params.push(("signature".to_string(), signature));
1474 }
1475
1476 if !query_params.is_empty() {
1478 req_builder = req_builder.query(&query_params);
1479 }
1480
1481
1482 if let Some(ref user_agent) = configuration.user_agent {
1484 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1485 }
1486
1487 for (header_name, header_value) in header_params {
1489 req_builder = req_builder.header(&header_name, &header_value);
1490 }
1491
1492 let mut multipart_form_params = std::collections::HashMap::new();
1493 multipart_form_params.insert("canTrade", params.can_trade.to_string());
1494 multipart_form_params.insert("futuresTrade", params.futures_trade.to_string());
1495 multipart_form_params.insert("marginTrade", params.margin_trade.to_string());
1496 if let Some(param_value) = params.recv_window {
1497 multipart_form_params.insert("recvWindow", param_value.to_string());
1498 }
1499 multipart_form_params.insert("subAccountApiKey", params.sub_account_api_key.to_string());
1500 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1501 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1502 req_builder = req_builder.form(&multipart_form_params);
1503
1504 let req = req_builder.build()?;
1505 let resp = configuration.client.execute(req).await?;
1506
1507 let status = resp.status();
1508 let content_type = resp
1509 .headers()
1510 .get("content-type")
1511 .and_then(|v| v.to_str().ok())
1512 .unwrap_or("application/octet-stream");
1513 let content_type = super::ContentType::from(content_type);
1514
1515 if !status.is_client_error() && !status.is_server_error() {
1516 let content = resp.text().await?;
1517 match content_type {
1518 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1519 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiPermissionV1Resp`"))),
1520 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::CreateBrokerSubAccountApiPermissionV1Resp`")))),
1521 }
1522 } else {
1523 let content = resp.text().await?;
1524 let entity: Option<CreateBrokerSubAccountApiPermissionV1Error> = serde_json::from_str(&content).ok();
1525 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1526 }
1527}
1528
1529pub async fn create_broker_sub_account_api_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiV1Params) -> Result<models::CreateBrokerSubAccountApiV1Resp, Error<CreateBrokerSubAccountApiV1Error>> {
1531
1532 let uri_str = format!("{}/sapi/v1/broker/subAccountApi", configuration.base_path);
1533 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1534
1535 let mut query_params: Vec<(String, String)> = Vec::new();
1537
1538
1539 let mut header_params = std::collections::HashMap::new();
1541
1542 if let Some(ref binance_auth) = configuration.binance_auth {
1544 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1546
1547 let body_string: Option<Vec<u8>> = None;
1549
1550 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1552 Ok(sig) => sig,
1553 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1554 };
1555
1556 query_params.push(("signature".to_string(), signature));
1558 }
1559
1560 if !query_params.is_empty() {
1562 req_builder = req_builder.query(&query_params);
1563 }
1564
1565
1566 if let Some(ref user_agent) = configuration.user_agent {
1568 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1569 }
1570
1571 for (header_name, header_value) in header_params {
1573 req_builder = req_builder.header(&header_name, &header_value);
1574 }
1575
1576 let mut multipart_form_params = std::collections::HashMap::new();
1577 multipart_form_params.insert("canTrade", params.can_trade.to_string());
1578 if let Some(param_value) = params.futures_trade {
1579 multipart_form_params.insert("futuresTrade", param_value.to_string());
1580 }
1581 if let Some(param_value) = params.margin_trade {
1582 multipart_form_params.insert("marginTrade", param_value.to_string());
1583 }
1584 if let Some(param_value) = params.public_key {
1585 multipart_form_params.insert("publicKey", param_value.to_string());
1586 }
1587 if let Some(param_value) = params.recv_window {
1588 multipart_form_params.insert("recvWindow", param_value.to_string());
1589 }
1590 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1591 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1592 req_builder = req_builder.form(&multipart_form_params);
1593
1594 let req = req_builder.build()?;
1595 let resp = configuration.client.execute(req).await?;
1596
1597 let status = resp.status();
1598 let content_type = resp
1599 .headers()
1600 .get("content-type")
1601 .and_then(|v| v.to_str().ok())
1602 .unwrap_or("application/octet-stream");
1603 let content_type = super::ContentType::from(content_type);
1604
1605 if !status.is_client_error() && !status.is_server_error() {
1606 let content = resp.text().await?;
1607 match content_type {
1608 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1609 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiV1Resp`"))),
1610 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::CreateBrokerSubAccountApiV1Resp`")))),
1611 }
1612 } else {
1613 let content = resp.text().await?;
1614 let entity: Option<CreateBrokerSubAccountApiV1Error> = serde_json::from_str(&content).ok();
1615 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1616 }
1617}
1618
1619pub async fn create_broker_sub_account_bnb_burn_margin_interest_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountBnbBurnMarginInterestV1Params) -> Result<models::CreateBrokerSubAccountBnbBurnMarginInterestV1Resp, Error<CreateBrokerSubAccountBnbBurnMarginInterestV1Error>> {
1621
1622 let uri_str = format!("{}/sapi/v1/broker/subAccount/bnbBurn/marginInterest", configuration.base_path);
1623 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1624
1625 let mut query_params: Vec<(String, String)> = Vec::new();
1627
1628
1629 let mut header_params = std::collections::HashMap::new();
1631
1632 if let Some(ref binance_auth) = configuration.binance_auth {
1634 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1636
1637 let body_string: Option<Vec<u8>> = None;
1639
1640 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1642 Ok(sig) => sig,
1643 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1644 };
1645
1646 query_params.push(("signature".to_string(), signature));
1648 }
1649
1650 if !query_params.is_empty() {
1652 req_builder = req_builder.query(&query_params);
1653 }
1654
1655
1656 if let Some(ref user_agent) = configuration.user_agent {
1658 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1659 }
1660
1661 for (header_name, header_value) in header_params {
1663 req_builder = req_builder.header(&header_name, &header_value);
1664 }
1665
1666 let mut multipart_form_params = std::collections::HashMap::new();
1667 multipart_form_params.insert("interestBNBBurn", params.interest_bnb_burn.to_string());
1668 if let Some(param_value) = params.recv_window {
1669 multipart_form_params.insert("recvWindow", param_value.to_string());
1670 }
1671 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1672 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1673 req_builder = req_builder.form(&multipart_form_params);
1674
1675 let req = req_builder.build()?;
1676 let resp = configuration.client.execute(req).await?;
1677
1678 let status = resp.status();
1679 let content_type = resp
1680 .headers()
1681 .get("content-type")
1682 .and_then(|v| v.to_str().ok())
1683 .unwrap_or("application/octet-stream");
1684 let content_type = super::ContentType::from(content_type);
1685
1686 if !status.is_client_error() && !status.is_server_error() {
1687 let content = resp.text().await?;
1688 match content_type {
1689 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1690 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountBnbBurnMarginInterestV1Resp`"))),
1691 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::CreateBrokerSubAccountBnbBurnMarginInterestV1Resp`")))),
1692 }
1693 } else {
1694 let content = resp.text().await?;
1695 let entity: Option<CreateBrokerSubAccountBnbBurnMarginInterestV1Error> = serde_json::from_str(&content).ok();
1696 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1697 }
1698}
1699
1700pub async fn create_broker_sub_account_bnb_burn_spot_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountBnbBurnSpotV1Params) -> Result<models::CreateBrokerSubAccountBnbBurnSpotV1Resp, Error<CreateBrokerSubAccountBnbBurnSpotV1Error>> {
1701
1702 let uri_str = format!("{}/sapi/v1/broker/subAccount/bnbBurn/spot", configuration.base_path);
1703 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1704
1705 let mut query_params: Vec<(String, String)> = Vec::new();
1707
1708
1709 let mut header_params = std::collections::HashMap::new();
1711
1712 if let Some(ref binance_auth) = configuration.binance_auth {
1714 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1716
1717 let body_string: Option<Vec<u8>> = None;
1719
1720 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1722 Ok(sig) => sig,
1723 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1724 };
1725
1726 query_params.push(("signature".to_string(), signature));
1728 }
1729
1730 if !query_params.is_empty() {
1732 req_builder = req_builder.query(&query_params);
1733 }
1734
1735
1736 if let Some(ref user_agent) = configuration.user_agent {
1738 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1739 }
1740
1741 for (header_name, header_value) in header_params {
1743 req_builder = req_builder.header(&header_name, &header_value);
1744 }
1745
1746 let mut multipart_form_params = std::collections::HashMap::new();
1747 if let Some(param_value) = params.recv_window {
1748 multipart_form_params.insert("recvWindow", param_value.to_string());
1749 }
1750 multipart_form_params.insert("spotBNBBurn", params.spot_bnb_burn.to_string());
1751 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1752 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1753 req_builder = req_builder.form(&multipart_form_params);
1754
1755 let req = req_builder.build()?;
1756 let resp = configuration.client.execute(req).await?;
1757
1758 let status = resp.status();
1759 let content_type = resp
1760 .headers()
1761 .get("content-type")
1762 .and_then(|v| v.to_str().ok())
1763 .unwrap_or("application/octet-stream");
1764 let content_type = super::ContentType::from(content_type);
1765
1766 if !status.is_client_error() && !status.is_server_error() {
1767 let content = resp.text().await?;
1768 match content_type {
1769 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1770 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountBnbBurnSpotV1Resp`"))),
1771 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::CreateBrokerSubAccountBnbBurnSpotV1Resp`")))),
1772 }
1773 } else {
1774 let content = resp.text().await?;
1775 let entity: Option<CreateBrokerSubAccountBnbBurnSpotV1Error> = serde_json::from_str(&content).ok();
1776 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1777 }
1778}
1779
1780pub async fn create_broker_sub_account_futures_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountFuturesV1Params) -> Result<models::CreateBrokerSubAccountFuturesV1Resp, Error<CreateBrokerSubAccountFuturesV1Error>> {
1781
1782 let uri_str = format!("{}/sapi/v1/broker/subAccount/futures", configuration.base_path);
1783 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1784
1785 let mut query_params: Vec<(String, String)> = Vec::new();
1787
1788
1789 let mut header_params = std::collections::HashMap::new();
1791
1792 if let Some(ref binance_auth) = configuration.binance_auth {
1794 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1796
1797 let body_string: Option<Vec<u8>> = None;
1799
1800 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1802 Ok(sig) => sig,
1803 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1804 };
1805
1806 query_params.push(("signature".to_string(), signature));
1808 }
1809
1810 if !query_params.is_empty() {
1812 req_builder = req_builder.query(&query_params);
1813 }
1814
1815
1816 if let Some(ref user_agent) = configuration.user_agent {
1818 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1819 }
1820
1821 for (header_name, header_value) in header_params {
1823 req_builder = req_builder.header(&header_name, &header_value);
1824 }
1825
1826 let mut multipart_form_params = std::collections::HashMap::new();
1827 multipart_form_params.insert("futures", params.futures.to_string());
1828 if let Some(param_value) = params.recv_window {
1829 multipart_form_params.insert("recvWindow", param_value.to_string());
1830 }
1831 multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
1832 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1833 req_builder = req_builder.form(&multipart_form_params);
1834
1835 let req = req_builder.build()?;
1836 let resp = configuration.client.execute(req).await?;
1837
1838 let status = resp.status();
1839 let content_type = resp
1840 .headers()
1841 .get("content-type")
1842 .and_then(|v| v.to_str().ok())
1843 .unwrap_or("application/octet-stream");
1844 let content_type = super::ContentType::from(content_type);
1845
1846 if !status.is_client_error() && !status.is_server_error() {
1847 let content = resp.text().await?;
1848 match content_type {
1849 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1850 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountFuturesV1Resp`"))),
1851 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::CreateBrokerSubAccountFuturesV1Resp`")))),
1852 }
1853 } else {
1854 let content = resp.text().await?;
1855 let entity: Option<CreateBrokerSubAccountFuturesV1Error> = serde_json::from_str(&content).ok();
1856 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1857 }
1858}
1859
1860pub async fn create_broker_sub_account_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountV1Params) -> Result<models::CreateBrokerSubAccountV1Resp, Error<CreateBrokerSubAccountV1Error>> {
1862
1863 let uri_str = format!("{}/sapi/v1/broker/subAccount", configuration.base_path);
1864 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1865
1866 let mut query_params: Vec<(String, String)> = Vec::new();
1868
1869
1870 let mut header_params = std::collections::HashMap::new();
1872
1873 if let Some(ref binance_auth) = configuration.binance_auth {
1875 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1877
1878 let body_string: Option<Vec<u8>> = None;
1880
1881 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1883 Ok(sig) => sig,
1884 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1885 };
1886
1887 query_params.push(("signature".to_string(), signature));
1889 }
1890
1891 if !query_params.is_empty() {
1893 req_builder = req_builder.query(&query_params);
1894 }
1895
1896
1897 if let Some(ref user_agent) = configuration.user_agent {
1899 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1900 }
1901
1902 for (header_name, header_value) in header_params {
1904 req_builder = req_builder.header(&header_name, &header_value);
1905 }
1906
1907 let mut multipart_form_params = std::collections::HashMap::new();
1908 if let Some(param_value) = params.recv_window {
1909 multipart_form_params.insert("recvWindow", param_value.to_string());
1910 }
1911 if let Some(param_value) = params.tag {
1912 multipart_form_params.insert("tag", param_value.to_string());
1913 }
1914 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1915 req_builder = req_builder.form(&multipart_form_params);
1916
1917 let req = req_builder.build()?;
1918 let resp = configuration.client.execute(req).await?;
1919
1920 let status = resp.status();
1921 let content_type = resp
1922 .headers()
1923 .get("content-type")
1924 .and_then(|v| v.to_str().ok())
1925 .unwrap_or("application/octet-stream");
1926 let content_type = super::ContentType::from(content_type);
1927
1928 if !status.is_client_error() && !status.is_server_error() {
1929 let content = resp.text().await?;
1930 match content_type {
1931 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1932 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountV1Resp`"))),
1933 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::CreateBrokerSubAccountV1Resp`")))),
1934 }
1935 } else {
1936 let content = resp.text().await?;
1937 let entity: Option<CreateBrokerSubAccountV1Error> = serde_json::from_str(&content).ok();
1938 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1939 }
1940}
1941
1942pub async fn create_broker_transfer_futures_v1(configuration: &configuration::Configuration, params: CreateBrokerTransferFuturesV1Params) -> Result<models::CreateBrokerTransferFuturesV1Resp, Error<CreateBrokerTransferFuturesV1Error>> {
1944
1945 let uri_str = format!("{}/sapi/v1/broker/transfer/futures", configuration.base_path);
1946 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1947
1948 let mut query_params: Vec<(String, String)> = Vec::new();
1950
1951
1952 let mut header_params = std::collections::HashMap::new();
1954
1955 if let Some(ref binance_auth) = configuration.binance_auth {
1957 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1959
1960 let body_string: Option<Vec<u8>> = None;
1962
1963 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1965 Ok(sig) => sig,
1966 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1967 };
1968
1969 query_params.push(("signature".to_string(), signature));
1971 }
1972
1973 if !query_params.is_empty() {
1975 req_builder = req_builder.query(&query_params);
1976 }
1977
1978
1979 if let Some(ref user_agent) = configuration.user_agent {
1981 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1982 }
1983
1984 for (header_name, header_value) in header_params {
1986 req_builder = req_builder.header(&header_name, &header_value);
1987 }
1988
1989 let mut multipart_form_params = std::collections::HashMap::new();
1990 multipart_form_params.insert("amount", params.amount.to_string());
1991 multipart_form_params.insert("asset", params.asset.to_string());
1992 if let Some(param_value) = params.client_tran_id {
1993 multipart_form_params.insert("clientTranId", param_value.to_string());
1994 }
1995 if let Some(param_value) = params.from_id {
1996 multipart_form_params.insert("fromId", param_value.to_string());
1997 }
1998 multipart_form_params.insert("futuresType", params.futures_type.to_string());
1999 if let Some(param_value) = params.recv_window {
2000 multipart_form_params.insert("recvWindow", param_value.to_string());
2001 }
2002 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2003 if let Some(param_value) = params.to_id {
2004 multipart_form_params.insert("toId", param_value.to_string());
2005 }
2006 req_builder = req_builder.form(&multipart_form_params);
2007
2008 let req = req_builder.build()?;
2009 let resp = configuration.client.execute(req).await?;
2010
2011 let status = resp.status();
2012 let content_type = resp
2013 .headers()
2014 .get("content-type")
2015 .and_then(|v| v.to_str().ok())
2016 .unwrap_or("application/octet-stream");
2017 let content_type = super::ContentType::from(content_type);
2018
2019 if !status.is_client_error() && !status.is_server_error() {
2020 let content = resp.text().await?;
2021 match content_type {
2022 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2023 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerTransferFuturesV1Resp`"))),
2024 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::CreateBrokerTransferFuturesV1Resp`")))),
2025 }
2026 } else {
2027 let content = resp.text().await?;
2028 let entity: Option<CreateBrokerTransferFuturesV1Error> = serde_json::from_str(&content).ok();
2029 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2030 }
2031}
2032
2033pub async fn create_broker_transfer_v1(configuration: &configuration::Configuration, params: CreateBrokerTransferV1Params) -> Result<models::CreateBrokerTransferV1Resp, Error<CreateBrokerTransferV1Error>> {
2035
2036 let uri_str = format!("{}/sapi/v1/broker/transfer", configuration.base_path);
2037 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2038
2039 let mut query_params: Vec<(String, String)> = Vec::new();
2041
2042
2043 let mut header_params = std::collections::HashMap::new();
2045
2046 if let Some(ref binance_auth) = configuration.binance_auth {
2048 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2050
2051 let body_string: Option<Vec<u8>> = None;
2053
2054 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2056 Ok(sig) => sig,
2057 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2058 };
2059
2060 query_params.push(("signature".to_string(), signature));
2062 }
2063
2064 if !query_params.is_empty() {
2066 req_builder = req_builder.query(&query_params);
2067 }
2068
2069
2070 if let Some(ref user_agent) = configuration.user_agent {
2072 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2073 }
2074
2075 for (header_name, header_value) in header_params {
2077 req_builder = req_builder.header(&header_name, &header_value);
2078 }
2079
2080 let mut multipart_form_params = std::collections::HashMap::new();
2081 multipart_form_params.insert("amount", params.amount.to_string());
2082 multipart_form_params.insert("asset", params.asset.to_string());
2083 if let Some(param_value) = params.client_tran_id {
2084 multipart_form_params.insert("clientTranId", param_value.to_string());
2085 }
2086 if let Some(param_value) = params.from_id {
2087 multipart_form_params.insert("fromId", param_value.to_string());
2088 }
2089 if let Some(param_value) = params.recv_window {
2090 multipart_form_params.insert("recvWindow", param_value.to_string());
2091 }
2092 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2093 if let Some(param_value) = params.to_id {
2094 multipart_form_params.insert("toId", param_value.to_string());
2095 }
2096 req_builder = req_builder.form(&multipart_form_params);
2097
2098 let req = req_builder.build()?;
2099 let resp = configuration.client.execute(req).await?;
2100
2101 let status = resp.status();
2102 let content_type = resp
2103 .headers()
2104 .get("content-type")
2105 .and_then(|v| v.to_str().ok())
2106 .unwrap_or("application/octet-stream");
2107 let content_type = super::ContentType::from(content_type);
2108
2109 if !status.is_client_error() && !status.is_server_error() {
2110 let content = resp.text().await?;
2111 match content_type {
2112 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2113 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerTransferV1Resp`"))),
2114 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::CreateBrokerTransferV1Resp`")))),
2115 }
2116 } else {
2117 let content = resp.text().await?;
2118 let entity: Option<CreateBrokerTransferV1Error> = serde_json::from_str(&content).ok();
2119 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2120 }
2121}
2122
2123pub async fn create_broker_universal_transfer_v1(configuration: &configuration::Configuration, params: CreateBrokerUniversalTransferV1Params) -> Result<models::CreateBrokerUniversalTransferV1Resp, Error<CreateBrokerUniversalTransferV1Error>> {
2125
2126 let uri_str = format!("{}/sapi/v1/broker/universalTransfer", configuration.base_path);
2127 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2128
2129 let mut query_params: Vec<(String, String)> = Vec::new();
2131
2132
2133 let mut header_params = std::collections::HashMap::new();
2135
2136 if let Some(ref binance_auth) = configuration.binance_auth {
2138 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2140
2141 let body_string: Option<Vec<u8>> = None;
2143
2144 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2146 Ok(sig) => sig,
2147 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2148 };
2149
2150 query_params.push(("signature".to_string(), signature));
2152 }
2153
2154 if !query_params.is_empty() {
2156 req_builder = req_builder.query(&query_params);
2157 }
2158
2159
2160 if let Some(ref user_agent) = configuration.user_agent {
2162 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2163 }
2164
2165 for (header_name, header_value) in header_params {
2167 req_builder = req_builder.header(&header_name, &header_value);
2168 }
2169
2170 let mut multipart_form_params = std::collections::HashMap::new();
2171 multipart_form_params.insert("amount", params.amount.to_string());
2172 multipart_form_params.insert("asset", params.asset.to_string());
2173 if let Some(param_value) = params.client_tran_id {
2174 multipart_form_params.insert("clientTranId", param_value.to_string());
2175 }
2176 multipart_form_params.insert("fromAccountType", params.from_account_type.to_string());
2177 if let Some(param_value) = params.from_id {
2178 multipart_form_params.insert("fromId", param_value.to_string());
2179 }
2180 if let Some(param_value) = params.recv_window {
2181 multipart_form_params.insert("recvWindow", param_value.to_string());
2182 }
2183 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2184 multipart_form_params.insert("toAccountType", params.to_account_type.to_string());
2185 if let Some(param_value) = params.to_id {
2186 multipart_form_params.insert("toId", param_value.to_string());
2187 }
2188 req_builder = req_builder.form(&multipart_form_params);
2189
2190 let req = req_builder.build()?;
2191 let resp = configuration.client.execute(req).await?;
2192
2193 let status = resp.status();
2194 let content_type = resp
2195 .headers()
2196 .get("content-type")
2197 .and_then(|v| v.to_str().ok())
2198 .unwrap_or("application/octet-stream");
2199 let content_type = super::ContentType::from(content_type);
2200
2201 if !status.is_client_error() && !status.is_server_error() {
2202 let content = resp.text().await?;
2203 match content_type {
2204 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2205 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerUniversalTransferV1Resp`"))),
2206 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::CreateBrokerUniversalTransferV1Resp`")))),
2207 }
2208 } else {
2209 let content = resp.text().await?;
2210 let entity: Option<CreateBrokerUniversalTransferV1Error> = serde_json::from_str(&content).ok();
2211 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2212 }
2213}
2214
2215pub async fn delete_broker_sub_account_api_ip_restriction_ip_list_v1(configuration: &configuration::Configuration, params: DeleteBrokerSubAccountApiIpRestrictionIpListV1Params) -> Result<models::DeleteBrokerSubAccountApiIpRestrictionIpListV1Resp, Error<DeleteBrokerSubAccountApiIpRestrictionIpListV1Error>> {
2216
2217 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/ipRestriction/ipList", configuration.base_path);
2218 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2219
2220 let mut query_params: Vec<(String, String)> = Vec::new();
2222
2223 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
2224 query_params.push(("subAccountApiKey".to_string(), params.sub_account_api_key.to_string()));
2225 if let Some(ref param_value) = params.ip_address {
2226 query_params.push(("ipAddress".to_string(), param_value.to_string()));
2227 }
2228 if let Some(ref param_value) = params.recv_window {
2229 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2230 }
2231 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2232
2233 let mut header_params = std::collections::HashMap::new();
2235
2236 if let Some(ref binance_auth) = configuration.binance_auth {
2238 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2240
2241 let body_string: Option<Vec<u8>> = None;
2243
2244 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2246 Ok(sig) => sig,
2247 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2248 };
2249
2250 query_params.push(("signature".to_string(), signature));
2252 }
2253
2254 if !query_params.is_empty() {
2256 req_builder = req_builder.query(&query_params);
2257 }
2258
2259
2260 if let Some(ref user_agent) = configuration.user_agent {
2262 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2263 }
2264
2265 for (header_name, header_value) in header_params {
2267 req_builder = req_builder.header(&header_name, &header_value);
2268 }
2269
2270
2271 let req = req_builder.build()?;
2272 let resp = configuration.client.execute(req).await?;
2273
2274 let status = resp.status();
2275 let content_type = resp
2276 .headers()
2277 .get("content-type")
2278 .and_then(|v| v.to_str().ok())
2279 .unwrap_or("application/octet-stream");
2280 let content_type = super::ContentType::from(content_type);
2281
2282 if !status.is_client_error() && !status.is_server_error() {
2283 let content = resp.text().await?;
2284 match content_type {
2285 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2286 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteBrokerSubAccountApiIpRestrictionIpListV1Resp`"))),
2287 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::DeleteBrokerSubAccountApiIpRestrictionIpListV1Resp`")))),
2288 }
2289 } else {
2290 let content = resp.text().await?;
2291 let entity: Option<DeleteBrokerSubAccountApiIpRestrictionIpListV1Error> = serde_json::from_str(&content).ok();
2292 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2293 }
2294}
2295
2296pub async fn delete_broker_sub_account_api_v1(configuration: &configuration::Configuration, params: DeleteBrokerSubAccountApiV1Params) -> Result<serde_json::Value, Error<DeleteBrokerSubAccountApiV1Error>> {
2298
2299 let uri_str = format!("{}/sapi/v1/broker/subAccountApi", configuration.base_path);
2300 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2301
2302 let mut query_params: Vec<(String, String)> = Vec::new();
2304
2305 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
2306 query_params.push(("subAccountApiKey".to_string(), params.sub_account_api_key.to_string()));
2307 if let Some(ref param_value) = params.recv_window {
2308 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2309 }
2310 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2311
2312 let mut header_params = std::collections::HashMap::new();
2314
2315 if let Some(ref binance_auth) = configuration.binance_auth {
2317 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2319
2320 let body_string: Option<Vec<u8>> = None;
2322
2323 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2325 Ok(sig) => sig,
2326 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2327 };
2328
2329 query_params.push(("signature".to_string(), signature));
2331 }
2332
2333 if !query_params.is_empty() {
2335 req_builder = req_builder.query(&query_params);
2336 }
2337
2338
2339 if let Some(ref user_agent) = configuration.user_agent {
2341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2342 }
2343
2344 for (header_name, header_value) in header_params {
2346 req_builder = req_builder.header(&header_name, &header_value);
2347 }
2348
2349
2350 let req = req_builder.build()?;
2351 let resp = configuration.client.execute(req).await?;
2352
2353 let status = resp.status();
2354 let content_type = resp
2355 .headers()
2356 .get("content-type")
2357 .and_then(|v| v.to_str().ok())
2358 .unwrap_or("application/octet-stream");
2359 let content_type = super::ContentType::from(content_type);
2360
2361 if !status.is_client_error() && !status.is_server_error() {
2362 let content = resp.text().await?;
2363 match content_type {
2364 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2365 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2366 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
2367 }
2368 } else {
2369 let content = resp.text().await?;
2370 let entity: Option<DeleteBrokerSubAccountApiV1Error> = serde_json::from_str(&content).ok();
2371 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2372 }
2373}
2374
2375pub async fn delete_broker_sub_account_v1(configuration: &configuration::Configuration, params: DeleteBrokerSubAccountV1Params) -> Result<serde_json::Value, Error<DeleteBrokerSubAccountV1Error>> {
2376
2377 let uri_str = format!("{}/sapi/v1/broker/subAccount", configuration.base_path);
2378 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2379
2380 let mut query_params: Vec<(String, String)> = Vec::new();
2382
2383 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
2384 if let Some(ref param_value) = params.recv_window {
2385 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2386 }
2387 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2388
2389 let mut header_params = std::collections::HashMap::new();
2391
2392 if let Some(ref binance_auth) = configuration.binance_auth {
2394 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2396
2397 let body_string: Option<Vec<u8>> = None;
2399
2400 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2402 Ok(sig) => sig,
2403 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2404 };
2405
2406 query_params.push(("signature".to_string(), signature));
2408 }
2409
2410 if !query_params.is_empty() {
2412 req_builder = req_builder.query(&query_params);
2413 }
2414
2415
2416 if let Some(ref user_agent) = configuration.user_agent {
2418 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2419 }
2420
2421 for (header_name, header_value) in header_params {
2423 req_builder = req_builder.header(&header_name, &header_value);
2424 }
2425
2426
2427 let req = req_builder.build()?;
2428 let resp = configuration.client.execute(req).await?;
2429
2430 let status = resp.status();
2431 let content_type = resp
2432 .headers()
2433 .get("content-type")
2434 .and_then(|v| v.to_str().ok())
2435 .unwrap_or("application/octet-stream");
2436 let content_type = super::ContentType::from(content_type);
2437
2438 if !status.is_client_error() && !status.is_server_error() {
2439 let content = resp.text().await?;
2440 match content_type {
2441 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2442 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2443 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
2444 }
2445 } else {
2446 let content = resp.text().await?;
2447 let entity: Option<DeleteBrokerSubAccountV1Error> = serde_json::from_str(&content).ok();
2448 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2449 }
2450}
2451
2452pub async fn get_api_referral_customization_v1(configuration: &configuration::Configuration, params: GetApiReferralCustomizationV1Params) -> Result<Vec<models::GetApiReferralCustomizationV1RespItem>, Error<GetApiReferralCustomizationV1Error>> {
2454
2455 let uri_str = format!("{}/sapi/v1/apiReferral/customization", configuration.base_path);
2456 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2457
2458 let mut query_params: Vec<(String, String)> = Vec::new();
2460
2461 if let Some(ref param_value) = params.customer_id {
2462 query_params.push(("customerId".to_string(), param_value.to_string()));
2463 }
2464 if let Some(ref param_value) = params.email {
2465 query_params.push(("email".to_string(), param_value.to_string()));
2466 }
2467 if let Some(ref param_value) = params.recv_window {
2468 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2469 }
2470 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2471
2472 let mut header_params = std::collections::HashMap::new();
2474
2475 if let Some(ref binance_auth) = configuration.binance_auth {
2477 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2479
2480 let body_string: Option<Vec<u8>> = None;
2482
2483 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2485 Ok(sig) => sig,
2486 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2487 };
2488
2489 query_params.push(("signature".to_string(), signature));
2491 }
2492
2493 if !query_params.is_empty() {
2495 req_builder = req_builder.query(&query_params);
2496 }
2497
2498
2499 if let Some(ref user_agent) = configuration.user_agent {
2501 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2502 }
2503
2504 for (header_name, header_value) in header_params {
2506 req_builder = req_builder.header(&header_name, &header_value);
2507 }
2508
2509
2510 let req = req_builder.build()?;
2511 let resp = configuration.client.execute(req).await?;
2512
2513 let status = resp.status();
2514 let content_type = resp
2515 .headers()
2516 .get("content-type")
2517 .and_then(|v| v.to_str().ok())
2518 .unwrap_or("application/octet-stream");
2519 let content_type = super::ContentType::from(content_type);
2520
2521 if !status.is_client_error() && !status.is_server_error() {
2522 let content = resp.text().await?;
2523 match content_type {
2524 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2525 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralCustomizationV1RespItem>`"))),
2526 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::GetApiReferralCustomizationV1RespItem>`")))),
2527 }
2528 } else {
2529 let content = resp.text().await?;
2530 let entity: Option<GetApiReferralCustomizationV1Error> = serde_json::from_str(&content).ok();
2531 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2532 }
2533}
2534
2535pub async fn get_api_referral_if_new_user_v1(configuration: &configuration::Configuration, params: GetApiReferralIfNewUserV1Params) -> Result<models::GetApiReferralIfNewUserV1Resp, Error<GetApiReferralIfNewUserV1Error>> {
2536
2537 let uri_str = format!("{}/sapi/v1/apiReferral/ifNewUser", configuration.base_path);
2538 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2539
2540 let mut query_params: Vec<(String, String)> = Vec::new();
2542
2543 query_params.push(("apiAgentCode".to_string(), params.api_agent_code.to_string()));
2544 if let Some(ref param_value) = params.recv_window {
2545 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2546 }
2547 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2548
2549 let mut header_params = std::collections::HashMap::new();
2551
2552 if let Some(ref binance_auth) = configuration.binance_auth {
2554 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2556
2557 let body_string: Option<Vec<u8>> = None;
2559
2560 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2562 Ok(sig) => sig,
2563 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2564 };
2565
2566 query_params.push(("signature".to_string(), signature));
2568 }
2569
2570 if !query_params.is_empty() {
2572 req_builder = req_builder.query(&query_params);
2573 }
2574
2575
2576 if let Some(ref user_agent) = configuration.user_agent {
2578 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2579 }
2580
2581 for (header_name, header_value) in header_params {
2583 req_builder = req_builder.header(&header_name, &header_value);
2584 }
2585
2586
2587 let req = req_builder.build()?;
2588 let resp = configuration.client.execute(req).await?;
2589
2590 let status = resp.status();
2591 let content_type = resp
2592 .headers()
2593 .get("content-type")
2594 .and_then(|v| v.to_str().ok())
2595 .unwrap_or("application/octet-stream");
2596 let content_type = super::ContentType::from(content_type);
2597
2598 if !status.is_client_error() && !status.is_server_error() {
2599 let content = resp.text().await?;
2600 match content_type {
2601 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2602 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralIfNewUserV1Resp`"))),
2603 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::GetApiReferralIfNewUserV1Resp`")))),
2604 }
2605 } else {
2606 let content = resp.text().await?;
2607 let entity: Option<GetApiReferralIfNewUserV1Error> = serde_json::from_str(&content).ok();
2608 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2609 }
2610}
2611
2612pub async fn get_api_referral_kickback_recent_record_v1(configuration: &configuration::Configuration, params: GetApiReferralKickbackRecentRecordV1Params) -> Result<Vec<models::GetApiReferralKickbackRecentRecordV1RespItem>, Error<GetApiReferralKickbackRecentRecordV1Error>> {
2614
2615 let uri_str = format!("{}/sapi/v1/apiReferral/kickback/recentRecord", configuration.base_path);
2616 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2617
2618 let mut query_params: Vec<(String, String)> = Vec::new();
2620
2621 if let Some(ref param_value) = params.start_time {
2622 query_params.push(("startTime".to_string(), param_value.to_string()));
2623 }
2624 if let Some(ref param_value) = params.end_time {
2625 query_params.push(("endTime".to_string(), param_value.to_string()));
2626 }
2627 if let Some(ref param_value) = params.limit {
2628 query_params.push(("limit".to_string(), param_value.to_string()));
2629 }
2630 if let Some(ref param_value) = params.recv_window {
2631 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2632 }
2633 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2634
2635 let mut header_params = std::collections::HashMap::new();
2637
2638 if let Some(ref binance_auth) = configuration.binance_auth {
2640 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2642
2643 let body_string: Option<Vec<u8>> = None;
2645
2646 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2648 Ok(sig) => sig,
2649 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2650 };
2651
2652 query_params.push(("signature".to_string(), signature));
2654 }
2655
2656 if !query_params.is_empty() {
2658 req_builder = req_builder.query(&query_params);
2659 }
2660
2661
2662 if let Some(ref user_agent) = configuration.user_agent {
2664 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2665 }
2666
2667 for (header_name, header_value) in header_params {
2669 req_builder = req_builder.header(&header_name, &header_value);
2670 }
2671
2672
2673 let req = req_builder.build()?;
2674 let resp = configuration.client.execute(req).await?;
2675
2676 let status = resp.status();
2677 let content_type = resp
2678 .headers()
2679 .get("content-type")
2680 .and_then(|v| v.to_str().ok())
2681 .unwrap_or("application/octet-stream");
2682 let content_type = super::ContentType::from(content_type);
2683
2684 if !status.is_client_error() && !status.is_server_error() {
2685 let content = resp.text().await?;
2686 match content_type {
2687 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2688 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralKickbackRecentRecordV1RespItem>`"))),
2689 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::GetApiReferralKickbackRecentRecordV1RespItem>`")))),
2690 }
2691 } else {
2692 let content = resp.text().await?;
2693 let entity: Option<GetApiReferralKickbackRecentRecordV1Error> = serde_json::from_str(&content).ok();
2694 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2695 }
2696}
2697
2698pub async fn get_api_referral_rebate_recent_record_v1(configuration: &configuration::Configuration, params: GetApiReferralRebateRecentRecordV1Params) -> Result<Vec<models::GetApiReferralRebateRecentRecordV1RespItem>, Error<GetApiReferralRebateRecentRecordV1Error>> {
2700
2701 let uri_str = format!("{}/sapi/v1/apiReferral/rebate/recentRecord", configuration.base_path);
2702 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2703
2704 let mut query_params: Vec<(String, String)> = Vec::new();
2706
2707 if let Some(ref param_value) = params.customer_id {
2708 query_params.push(("customerId".to_string(), param_value.to_string()));
2709 }
2710 query_params.push(("startTime".to_string(), params.start_time.to_string()));
2711 query_params.push(("endTime".to_string(), params.end_time.to_string()));
2712 query_params.push(("limit".to_string(), params.limit.to_string()));
2713 if let Some(ref param_value) = params.recv_window {
2714 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2715 }
2716 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2717
2718 let mut header_params = std::collections::HashMap::new();
2720
2721 if let Some(ref binance_auth) = configuration.binance_auth {
2723 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2725
2726 let body_string: Option<Vec<u8>> = None;
2728
2729 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2731 Ok(sig) => sig,
2732 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2733 };
2734
2735 query_params.push(("signature".to_string(), signature));
2737 }
2738
2739 if !query_params.is_empty() {
2741 req_builder = req_builder.query(&query_params);
2742 }
2743
2744
2745 if let Some(ref user_agent) = configuration.user_agent {
2747 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2748 }
2749
2750 for (header_name, header_value) in header_params {
2752 req_builder = req_builder.header(&header_name, &header_value);
2753 }
2754
2755
2756 let req = req_builder.build()?;
2757 let resp = configuration.client.execute(req).await?;
2758
2759 let status = resp.status();
2760 let content_type = resp
2761 .headers()
2762 .get("content-type")
2763 .and_then(|v| v.to_str().ok())
2764 .unwrap_or("application/octet-stream");
2765 let content_type = super::ContentType::from(content_type);
2766
2767 if !status.is_client_error() && !status.is_server_error() {
2768 let content = resp.text().await?;
2769 match content_type {
2770 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2771 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralRebateRecentRecordV1RespItem>`"))),
2772 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::GetApiReferralRebateRecentRecordV1RespItem>`")))),
2773 }
2774 } else {
2775 let content = resp.text().await?;
2776 let entity: Option<GetApiReferralRebateRecentRecordV1Error> = serde_json::from_str(&content).ok();
2777 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2778 }
2779}
2780
2781pub async fn get_api_referral_user_customization_v1(configuration: &configuration::Configuration, params: GetApiReferralUserCustomizationV1Params) -> Result<models::GetApiReferralUserCustomizationV1Resp, Error<GetApiReferralUserCustomizationV1Error>> {
2783
2784 let uri_str = format!("{}/sapi/v1/apiReferral/userCustomization", configuration.base_path);
2785 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2786
2787 let mut query_params: Vec<(String, String)> = Vec::new();
2789
2790 query_params.push(("apiAgentCode".to_string(), params.api_agent_code.to_string()));
2791 if let Some(ref param_value) = params.recv_window {
2792 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2793 }
2794 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2795
2796 let mut header_params = std::collections::HashMap::new();
2798
2799 if let Some(ref binance_auth) = configuration.binance_auth {
2801 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2803
2804 let body_string: Option<Vec<u8>> = None;
2806
2807 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2809 Ok(sig) => sig,
2810 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2811 };
2812
2813 query_params.push(("signature".to_string(), signature));
2815 }
2816
2817 if !query_params.is_empty() {
2819 req_builder = req_builder.query(&query_params);
2820 }
2821
2822
2823 if let Some(ref user_agent) = configuration.user_agent {
2825 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2826 }
2827
2828 for (header_name, header_value) in header_params {
2830 req_builder = req_builder.header(&header_name, &header_value);
2831 }
2832
2833
2834 let req = req_builder.build()?;
2835 let resp = configuration.client.execute(req).await?;
2836
2837 let status = resp.status();
2838 let content_type = resp
2839 .headers()
2840 .get("content-type")
2841 .and_then(|v| v.to_str().ok())
2842 .unwrap_or("application/octet-stream");
2843 let content_type = super::ContentType::from(content_type);
2844
2845 if !status.is_client_error() && !status.is_server_error() {
2846 let content = resp.text().await?;
2847 match content_type {
2848 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2849 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralUserCustomizationV1Resp`"))),
2850 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::GetApiReferralUserCustomizationV1Resp`")))),
2851 }
2852 } else {
2853 let content = resp.text().await?;
2854 let entity: Option<GetApiReferralUserCustomizationV1Error> = serde_json::from_str(&content).ok();
2855 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2856 }
2857}
2858
2859pub async fn get_broker_info_v1(configuration: &configuration::Configuration, params: GetBrokerInfoV1Params) -> Result<models::GetBrokerInfoV1Resp, Error<GetBrokerInfoV1Error>> {
2860
2861 let uri_str = format!("{}/sapi/v1/broker/info", configuration.base_path);
2862 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2863
2864 let mut query_params: Vec<(String, String)> = Vec::new();
2866
2867 if let Some(ref param_value) = params.recv_window {
2868 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2869 }
2870 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2871
2872 let mut header_params = std::collections::HashMap::new();
2874
2875 if let Some(ref binance_auth) = configuration.binance_auth {
2877 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2879
2880 let body_string: Option<Vec<u8>> = None;
2882
2883 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2885 Ok(sig) => sig,
2886 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2887 };
2888
2889 query_params.push(("signature".to_string(), signature));
2891 }
2892
2893 if !query_params.is_empty() {
2895 req_builder = req_builder.query(&query_params);
2896 }
2897
2898
2899 if let Some(ref user_agent) = configuration.user_agent {
2901 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2902 }
2903
2904 for (header_name, header_value) in header_params {
2906 req_builder = req_builder.header(&header_name, &header_value);
2907 }
2908
2909
2910 let req = req_builder.build()?;
2911 let resp = configuration.client.execute(req).await?;
2912
2913 let status = resp.status();
2914 let content_type = resp
2915 .headers()
2916 .get("content-type")
2917 .and_then(|v| v.to_str().ok())
2918 .unwrap_or("application/octet-stream");
2919 let content_type = super::ContentType::from(content_type);
2920
2921 if !status.is_client_error() && !status.is_server_error() {
2922 let content = resp.text().await?;
2923 match content_type {
2924 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2925 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerInfoV1Resp`"))),
2926 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::GetBrokerInfoV1Resp`")))),
2927 }
2928 } else {
2929 let content = resp.text().await?;
2930 let entity: Option<GetBrokerInfoV1Error> = serde_json::from_str(&content).ok();
2931 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2932 }
2933}
2934
2935pub async fn get_broker_rebate_futures_recent_record_v1(configuration: &configuration::Configuration, params: GetBrokerRebateFuturesRecentRecordV1Params) -> Result<Vec<models::GetBrokerRebateFuturesRecentRecordV1RespItem>, Error<GetBrokerRebateFuturesRecentRecordV1Error>> {
2937
2938 let uri_str = format!("{}/sapi/v1/broker/rebate/futures/recentRecord", configuration.base_path);
2939 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2940
2941 let mut query_params: Vec<(String, String)> = Vec::new();
2943
2944 query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
2945 query_params.push(("startTime".to_string(), params.start_time.to_string()));
2946 query_params.push(("endTime".to_string(), params.end_time.to_string()));
2947 if let Some(ref param_value) = params.page {
2948 query_params.push(("page".to_string(), param_value.to_string()));
2949 }
2950 if let Some(ref param_value) = params.size {
2951 query_params.push(("size".to_string(), param_value.to_string()));
2952 }
2953 if let Some(ref param_value) = params.filter_result {
2954 query_params.push(("filterResult".to_string(), param_value.to_string()));
2955 }
2956 if let Some(ref param_value) = params.recv_window {
2957 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2958 }
2959 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2960
2961 let mut header_params = std::collections::HashMap::new();
2963
2964 if let Some(ref binance_auth) = configuration.binance_auth {
2966 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2968
2969 let body_string: Option<Vec<u8>> = None;
2971
2972 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2974 Ok(sig) => sig,
2975 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2976 };
2977
2978 query_params.push(("signature".to_string(), signature));
2980 }
2981
2982 if !query_params.is_empty() {
2984 req_builder = req_builder.query(&query_params);
2985 }
2986
2987
2988 if let Some(ref user_agent) = configuration.user_agent {
2990 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2991 }
2992
2993 for (header_name, header_value) in header_params {
2995 req_builder = req_builder.header(&header_name, &header_value);
2996 }
2997
2998
2999 let req = req_builder.build()?;
3000 let resp = configuration.client.execute(req).await?;
3001
3002 let status = resp.status();
3003 let content_type = resp
3004 .headers()
3005 .get("content-type")
3006 .and_then(|v| v.to_str().ok())
3007 .unwrap_or("application/octet-stream");
3008 let content_type = super::ContentType::from(content_type);
3009
3010 if !status.is_client_error() && !status.is_server_error() {
3011 let content = resp.text().await?;
3012 match content_type {
3013 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3014 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerRebateFuturesRecentRecordV1RespItem>`"))),
3015 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::GetBrokerRebateFuturesRecentRecordV1RespItem>`")))),
3016 }
3017 } else {
3018 let content = resp.text().await?;
3019 let entity: Option<GetBrokerRebateFuturesRecentRecordV1Error> = serde_json::from_str(&content).ok();
3020 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3021 }
3022}
3023
3024pub async fn get_broker_rebate_recent_record_v1(configuration: &configuration::Configuration, params: GetBrokerRebateRecentRecordV1Params) -> Result<Vec<models::GetBrokerRebateRecentRecordV1RespItem>, Error<GetBrokerRebateRecentRecordV1Error>> {
3026
3027 let uri_str = format!("{}/sapi/v1/broker/rebate/recentRecord", configuration.base_path);
3028 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3029
3030 let mut query_params: Vec<(String, String)> = Vec::new();
3032
3033 if let Some(ref param_value) = params.sub_account_id {
3034 query_params.push(("subAccountId".to_string(), param_value.to_string()));
3035 }
3036 if let Some(ref param_value) = params.start_time {
3037 query_params.push(("startTime".to_string(), param_value.to_string()));
3038 }
3039 if let Some(ref param_value) = params.end_time {
3040 query_params.push(("endTime".to_string(), param_value.to_string()));
3041 }
3042 if let Some(ref param_value) = params.page {
3043 query_params.push(("page".to_string(), param_value.to_string()));
3044 }
3045 if let Some(ref param_value) = params.size {
3046 query_params.push(("size".to_string(), param_value.to_string()));
3047 }
3048 if let Some(ref param_value) = params.recv_window {
3049 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3050 }
3051 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3052
3053 let mut header_params = std::collections::HashMap::new();
3055
3056 if let Some(ref binance_auth) = configuration.binance_auth {
3058 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3060
3061 let body_string: Option<Vec<u8>> = None;
3063
3064 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3066 Ok(sig) => sig,
3067 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3068 };
3069
3070 query_params.push(("signature".to_string(), signature));
3072 }
3073
3074 if !query_params.is_empty() {
3076 req_builder = req_builder.query(&query_params);
3077 }
3078
3079
3080 if let Some(ref user_agent) = configuration.user_agent {
3082 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3083 }
3084
3085 for (header_name, header_value) in header_params {
3087 req_builder = req_builder.header(&header_name, &header_value);
3088 }
3089
3090
3091 let req = req_builder.build()?;
3092 let resp = configuration.client.execute(req).await?;
3093
3094 let status = resp.status();
3095 let content_type = resp
3096 .headers()
3097 .get("content-type")
3098 .and_then(|v| v.to_str().ok())
3099 .unwrap_or("application/octet-stream");
3100 let content_type = super::ContentType::from(content_type);
3101
3102 if !status.is_client_error() && !status.is_server_error() {
3103 let content = resp.text().await?;
3104 match content_type {
3105 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3106 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerRebateRecentRecordV1RespItem>`"))),
3107 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::GetBrokerRebateRecentRecordV1RespItem>`")))),
3108 }
3109 } else {
3110 let content = resp.text().await?;
3111 let entity: Option<GetBrokerRebateRecentRecordV1Error> = serde_json::from_str(&content).ok();
3112 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3113 }
3114}
3115
3116pub async fn get_broker_sub_account_api_commission_coin_futures_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountApiCommissionCoinFuturesV1Params) -> Result<Vec<models::GetBrokerSubAccountApiCommissionCoinFuturesV1RespItem>, Error<GetBrokerSubAccountApiCommissionCoinFuturesV1Error>> {
3118
3119 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission/coinFutures", configuration.base_path);
3120 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3121
3122 let mut query_params: Vec<(String, String)> = Vec::new();
3124
3125 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
3126 if let Some(ref param_value) = params.pair {
3127 query_params.push(("pair".to_string(), param_value.to_string()));
3128 }
3129 if let Some(ref param_value) = params.recv_window {
3130 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3131 }
3132 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3133
3134 let mut header_params = std::collections::HashMap::new();
3136
3137 if let Some(ref binance_auth) = configuration.binance_auth {
3139 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3141
3142 let body_string: Option<Vec<u8>> = None;
3144
3145 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3147 Ok(sig) => sig,
3148 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3149 };
3150
3151 query_params.push(("signature".to_string(), signature));
3153 }
3154
3155 if !query_params.is_empty() {
3157 req_builder = req_builder.query(&query_params);
3158 }
3159
3160
3161 if let Some(ref user_agent) = configuration.user_agent {
3163 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3164 }
3165
3166 for (header_name, header_value) in header_params {
3168 req_builder = req_builder.header(&header_name, &header_value);
3169 }
3170
3171
3172 let req = req_builder.build()?;
3173 let resp = configuration.client.execute(req).await?;
3174
3175 let status = resp.status();
3176 let content_type = resp
3177 .headers()
3178 .get("content-type")
3179 .and_then(|v| v.to_str().ok())
3180 .unwrap_or("application/octet-stream");
3181 let content_type = super::ContentType::from(content_type);
3182
3183 if !status.is_client_error() && !status.is_server_error() {
3184 let content = resp.text().await?;
3185 match content_type {
3186 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3187 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountApiCommissionCoinFuturesV1RespItem>`"))),
3188 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::GetBrokerSubAccountApiCommissionCoinFuturesV1RespItem>`")))),
3189 }
3190 } else {
3191 let content = resp.text().await?;
3192 let entity: Option<GetBrokerSubAccountApiCommissionCoinFuturesV1Error> = serde_json::from_str(&content).ok();
3193 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3194 }
3195}
3196
3197pub async fn get_broker_sub_account_api_commission_futures_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountApiCommissionFuturesV1Params) -> Result<Vec<models::GetBrokerSubAccountApiCommissionFuturesV1RespItem>, Error<GetBrokerSubAccountApiCommissionFuturesV1Error>> {
3199
3200 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission/futures", configuration.base_path);
3201 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3202
3203 let mut query_params: Vec<(String, String)> = Vec::new();
3205
3206 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
3207 if let Some(ref param_value) = params.symbol {
3208 query_params.push(("symbol".to_string(), param_value.to_string()));
3209 }
3210 if let Some(ref param_value) = params.recv_window {
3211 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3212 }
3213 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3214
3215 let mut header_params = std::collections::HashMap::new();
3217
3218 if let Some(ref binance_auth) = configuration.binance_auth {
3220 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3222
3223 let body_string: Option<Vec<u8>> = None;
3225
3226 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3228 Ok(sig) => sig,
3229 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3230 };
3231
3232 query_params.push(("signature".to_string(), signature));
3234 }
3235
3236 if !query_params.is_empty() {
3238 req_builder = req_builder.query(&query_params);
3239 }
3240
3241
3242 if let Some(ref user_agent) = configuration.user_agent {
3244 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3245 }
3246
3247 for (header_name, header_value) in header_params {
3249 req_builder = req_builder.header(&header_name, &header_value);
3250 }
3251
3252
3253 let req = req_builder.build()?;
3254 let resp = configuration.client.execute(req).await?;
3255
3256 let status = resp.status();
3257 let content_type = resp
3258 .headers()
3259 .get("content-type")
3260 .and_then(|v| v.to_str().ok())
3261 .unwrap_or("application/octet-stream");
3262 let content_type = super::ContentType::from(content_type);
3263
3264 if !status.is_client_error() && !status.is_server_error() {
3265 let content = resp.text().await?;
3266 match content_type {
3267 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3268 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountApiCommissionFuturesV1RespItem>`"))),
3269 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::GetBrokerSubAccountApiCommissionFuturesV1RespItem>`")))),
3270 }
3271 } else {
3272 let content = resp.text().await?;
3273 let entity: Option<GetBrokerSubAccountApiCommissionFuturesV1Error> = serde_json::from_str(&content).ok();
3274 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3275 }
3276}
3277
3278pub async fn get_broker_sub_account_api_ip_restriction_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountApiIpRestrictionV1Params) -> Result<models::GetBrokerSubAccountApiIpRestrictionV1Resp, Error<GetBrokerSubAccountApiIpRestrictionV1Error>> {
3279
3280 let uri_str = format!("{}/sapi/v1/broker/subAccountApi/ipRestriction", configuration.base_path);
3281 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3282
3283 let mut query_params: Vec<(String, String)> = Vec::new();
3285
3286 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
3287 query_params.push(("subAccountApiKey".to_string(), params.sub_account_api_key.to_string()));
3288 if let Some(ref param_value) = params.recv_window {
3289 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3290 }
3291 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3292
3293 let mut header_params = std::collections::HashMap::new();
3295
3296 if let Some(ref binance_auth) = configuration.binance_auth {
3298 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3300
3301 let body_string: Option<Vec<u8>> = None;
3303
3304 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3306 Ok(sig) => sig,
3307 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3308 };
3309
3310 query_params.push(("signature".to_string(), signature));
3312 }
3313
3314 if !query_params.is_empty() {
3316 req_builder = req_builder.query(&query_params);
3317 }
3318
3319
3320 if let Some(ref user_agent) = configuration.user_agent {
3322 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3323 }
3324
3325 for (header_name, header_value) in header_params {
3327 req_builder = req_builder.header(&header_name, &header_value);
3328 }
3329
3330
3331 let req = req_builder.build()?;
3332 let resp = configuration.client.execute(req).await?;
3333
3334 let status = resp.status();
3335 let content_type = resp
3336 .headers()
3337 .get("content-type")
3338 .and_then(|v| v.to_str().ok())
3339 .unwrap_or("application/octet-stream");
3340 let content_type = super::ContentType::from(content_type);
3341
3342 if !status.is_client_error() && !status.is_server_error() {
3343 let content = resp.text().await?;
3344 match content_type {
3345 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3346 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerSubAccountApiIpRestrictionV1Resp`"))),
3347 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::GetBrokerSubAccountApiIpRestrictionV1Resp`")))),
3348 }
3349 } else {
3350 let content = resp.text().await?;
3351 let entity: Option<GetBrokerSubAccountApiIpRestrictionV1Error> = serde_json::from_str(&content).ok();
3352 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3353 }
3354}
3355
3356pub async fn get_broker_sub_account_api_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountApiV1Params) -> Result<Vec<models::GetBrokerSubAccountApiV1RespItem>, Error<GetBrokerSubAccountApiV1Error>> {
3358
3359 let uri_str = format!("{}/sapi/v1/broker/subAccountApi", configuration.base_path);
3360 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3361
3362 let mut query_params: Vec<(String, String)> = Vec::new();
3364
3365 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
3366 if let Some(ref param_value) = params.sub_account_api_key {
3367 query_params.push(("subAccountApiKey".to_string(), param_value.to_string()));
3368 }
3369 if let Some(ref param_value) = params.page {
3370 query_params.push(("page".to_string(), param_value.to_string()));
3371 }
3372 if let Some(ref param_value) = params.size {
3373 query_params.push(("size".to_string(), param_value.to_string()));
3374 }
3375 if let Some(ref param_value) = params.recv_window {
3376 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3377 }
3378 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3379
3380 let mut header_params = std::collections::HashMap::new();
3382
3383 if let Some(ref binance_auth) = configuration.binance_auth {
3385 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3387
3388 let body_string: Option<Vec<u8>> = None;
3390
3391 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3393 Ok(sig) => sig,
3394 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3395 };
3396
3397 query_params.push(("signature".to_string(), signature));
3399 }
3400
3401 if !query_params.is_empty() {
3403 req_builder = req_builder.query(&query_params);
3404 }
3405
3406
3407 if let Some(ref user_agent) = configuration.user_agent {
3409 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3410 }
3411
3412 for (header_name, header_value) in header_params {
3414 req_builder = req_builder.header(&header_name, &header_value);
3415 }
3416
3417
3418 let req = req_builder.build()?;
3419 let resp = configuration.client.execute(req).await?;
3420
3421 let status = resp.status();
3422 let content_type = resp
3423 .headers()
3424 .get("content-type")
3425 .and_then(|v| v.to_str().ok())
3426 .unwrap_or("application/octet-stream");
3427 let content_type = super::ContentType::from(content_type);
3428
3429 if !status.is_client_error() && !status.is_server_error() {
3430 let content = resp.text().await?;
3431 match content_type {
3432 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3433 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountApiV1RespItem>`"))),
3434 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::GetBrokerSubAccountApiV1RespItem>`")))),
3435 }
3436 } else {
3437 let content = resp.text().await?;
3438 let entity: Option<GetBrokerSubAccountApiV1Error> = serde_json::from_str(&content).ok();
3439 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3440 }
3441}
3442
3443pub async fn get_broker_sub_account_bnb_burn_status_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountBnbBurnStatusV1Params) -> Result<models::GetBrokerSubAccountBnbBurnStatusV1Resp, Error<GetBrokerSubAccountBnbBurnStatusV1Error>> {
3444
3445 let uri_str = format!("{}/sapi/v1/broker/subAccount/bnbBurn/status", configuration.base_path);
3446 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3447
3448 let mut query_params: Vec<(String, String)> = Vec::new();
3450
3451 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
3452 if let Some(ref param_value) = params.recv_window {
3453 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3454 }
3455 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3456
3457 let mut header_params = std::collections::HashMap::new();
3459
3460 if let Some(ref binance_auth) = configuration.binance_auth {
3462 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3464
3465 let body_string: Option<Vec<u8>> = None;
3467
3468 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3470 Ok(sig) => sig,
3471 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3472 };
3473
3474 query_params.push(("signature".to_string(), signature));
3476 }
3477
3478 if !query_params.is_empty() {
3480 req_builder = req_builder.query(&query_params);
3481 }
3482
3483
3484 if let Some(ref user_agent) = configuration.user_agent {
3486 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3487 }
3488
3489 for (header_name, header_value) in header_params {
3491 req_builder = req_builder.header(&header_name, &header_value);
3492 }
3493
3494
3495 let req = req_builder.build()?;
3496 let resp = configuration.client.execute(req).await?;
3497
3498 let status = resp.status();
3499 let content_type = resp
3500 .headers()
3501 .get("content-type")
3502 .and_then(|v| v.to_str().ok())
3503 .unwrap_or("application/octet-stream");
3504 let content_type = super::ContentType::from(content_type);
3505
3506 if !status.is_client_error() && !status.is_server_error() {
3507 let content = resp.text().await?;
3508 match content_type {
3509 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3510 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerSubAccountBnbBurnStatusV1Resp`"))),
3511 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::GetBrokerSubAccountBnbBurnStatusV1Resp`")))),
3512 }
3513 } else {
3514 let content = resp.text().await?;
3515 let entity: Option<GetBrokerSubAccountBnbBurnStatusV1Error> = serde_json::from_str(&content).ok();
3516 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3517 }
3518}
3519
3520pub async fn get_broker_sub_account_deposit_hist_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountDepositHistV1Params) -> Result<Vec<models::GetBrokerSubAccountDepositHistV1RespItem>, Error<GetBrokerSubAccountDepositHistV1Error>> {
3522
3523 let uri_str = format!("{}/sapi/v1/broker/subAccount/depositHist", configuration.base_path);
3524 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3525
3526 let mut query_params: Vec<(String, String)> = Vec::new();
3528
3529 if let Some(ref param_value) = params.sub_account_id {
3530 query_params.push(("subAccountId".to_string(), param_value.to_string()));
3531 }
3532 if let Some(ref param_value) = params.coin {
3533 query_params.push(("coin".to_string(), param_value.to_string()));
3534 }
3535 if let Some(ref param_value) = params.status {
3536 query_params.push(("status".to_string(), param_value.to_string()));
3537 }
3538 if let Some(ref param_value) = params.start_time {
3539 query_params.push(("startTime".to_string(), param_value.to_string()));
3540 }
3541 if let Some(ref param_value) = params.end_time {
3542 query_params.push(("endTime".to_string(), param_value.to_string()));
3543 }
3544 if let Some(ref param_value) = params.limit {
3545 query_params.push(("limit".to_string(), param_value.to_string()));
3546 }
3547 if let Some(ref param_value) = params.offset {
3548 query_params.push(("offset".to_string(), param_value.to_string()));
3549 }
3550 if let Some(ref param_value) = params.recv_window {
3551 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3552 }
3553 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3554
3555 let mut header_params = std::collections::HashMap::new();
3557
3558 if let Some(ref binance_auth) = configuration.binance_auth {
3560 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3562
3563 let body_string: Option<Vec<u8>> = None;
3565
3566 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3568 Ok(sig) => sig,
3569 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3570 };
3571
3572 query_params.push(("signature".to_string(), signature));
3574 }
3575
3576 if !query_params.is_empty() {
3578 req_builder = req_builder.query(&query_params);
3579 }
3580
3581
3582 if let Some(ref user_agent) = configuration.user_agent {
3584 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3585 }
3586
3587 for (header_name, header_value) in header_params {
3589 req_builder = req_builder.header(&header_name, &header_value);
3590 }
3591
3592
3593 let req = req_builder.build()?;
3594 let resp = configuration.client.execute(req).await?;
3595
3596 let status = resp.status();
3597 let content_type = resp
3598 .headers()
3599 .get("content-type")
3600 .and_then(|v| v.to_str().ok())
3601 .unwrap_or("application/octet-stream");
3602 let content_type = super::ContentType::from(content_type);
3603
3604 if !status.is_client_error() && !status.is_server_error() {
3605 let content = resp.text().await?;
3606 match content_type {
3607 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3608 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountDepositHistV1RespItem>`"))),
3609 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::GetBrokerSubAccountDepositHistV1RespItem>`")))),
3610 }
3611 } else {
3612 let content = resp.text().await?;
3613 let entity: Option<GetBrokerSubAccountDepositHistV1Error> = serde_json::from_str(&content).ok();
3614 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3615 }
3616}
3617
3618pub async fn get_broker_sub_account_deposit_hist_v2(configuration: &configuration::Configuration, params: GetBrokerSubAccountDepositHistV2Params) -> Result<Vec<models::GetBrokerSubAccountDepositHistV2RespItem>, Error<GetBrokerSubAccountDepositHistV2Error>> {
3619
3620 let uri_str = format!("{}/sapi/v2/broker/subAccount/depositHist", configuration.base_path);
3621 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3622
3623 let mut query_params: Vec<(String, String)> = Vec::new();
3625
3626 query_params.push(("depositId".to_string(), params.deposit_id.to_string()));
3627 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
3628 if let Some(ref param_value) = params.limit {
3629 query_params.push(("limit".to_string(), param_value.to_string()));
3630 }
3631 if let Some(ref param_value) = params.offset {
3632 query_params.push(("offset".to_string(), param_value.to_string()));
3633 }
3634 if let Some(ref param_value) = params.recv_window {
3635 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3636 }
3637 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3638
3639 let mut header_params = std::collections::HashMap::new();
3641
3642 if let Some(ref binance_auth) = configuration.binance_auth {
3644 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3646
3647 let body_string: Option<Vec<u8>> = None;
3649
3650 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3652 Ok(sig) => sig,
3653 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3654 };
3655
3656 query_params.push(("signature".to_string(), signature));
3658 }
3659
3660 if !query_params.is_empty() {
3662 req_builder = req_builder.query(&query_params);
3663 }
3664
3665
3666 if let Some(ref user_agent) = configuration.user_agent {
3668 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3669 }
3670
3671 for (header_name, header_value) in header_params {
3673 req_builder = req_builder.header(&header_name, &header_value);
3674 }
3675
3676
3677 let req = req_builder.build()?;
3678 let resp = configuration.client.execute(req).await?;
3679
3680 let status = resp.status();
3681 let content_type = resp
3682 .headers()
3683 .get("content-type")
3684 .and_then(|v| v.to_str().ok())
3685 .unwrap_or("application/octet-stream");
3686 let content_type = super::ContentType::from(content_type);
3687
3688 if !status.is_client_error() && !status.is_server_error() {
3689 let content = resp.text().await?;
3690 match content_type {
3691 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3692 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountDepositHistV2RespItem>`"))),
3693 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::GetBrokerSubAccountDepositHistV2RespItem>`")))),
3694 }
3695 } else {
3696 let content = resp.text().await?;
3697 let entity: Option<GetBrokerSubAccountDepositHistV2Error> = serde_json::from_str(&content).ok();
3698 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3699 }
3700}
3701
3702pub async fn get_broker_sub_account_futures_summary_v3(configuration: &configuration::Configuration, params: GetBrokerSubAccountFuturesSummaryV3Params) -> Result<models::ExchangelinkGetBrokerSubAccountFuturesSummaryV3Resp, Error<GetBrokerSubAccountFuturesSummaryV3Error>> {
3703
3704 let uri_str = format!("{}/sapi/v3/broker/subAccount/futuresSummary", configuration.base_path);
3705 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3706
3707 let mut query_params: Vec<(String, String)> = Vec::new();
3709
3710 if let Some(ref param_value) = params.sub_account_id {
3711 query_params.push(("subAccountId".to_string(), param_value.to_string()));
3712 }
3713 query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
3714 if let Some(ref param_value) = params.page {
3715 query_params.push(("page".to_string(), param_value.to_string()));
3716 }
3717 if let Some(ref param_value) = params.size {
3718 query_params.push(("size".to_string(), param_value.to_string()));
3719 }
3720 if let Some(ref param_value) = params.recv_window {
3721 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3722 }
3723 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3724
3725 let mut header_params = std::collections::HashMap::new();
3727
3728 if let Some(ref binance_auth) = configuration.binance_auth {
3730 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3732
3733 let body_string: Option<Vec<u8>> = None;
3735
3736 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3738 Ok(sig) => sig,
3739 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3740 };
3741
3742 query_params.push(("signature".to_string(), signature));
3744 }
3745
3746 if !query_params.is_empty() {
3748 req_builder = req_builder.query(&query_params);
3749 }
3750
3751
3752 if let Some(ref user_agent) = configuration.user_agent {
3754 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3755 }
3756
3757 for (header_name, header_value) in header_params {
3759 req_builder = req_builder.header(&header_name, &header_value);
3760 }
3761
3762
3763 let req = req_builder.build()?;
3764 let resp = configuration.client.execute(req).await?;
3765
3766 let status = resp.status();
3767 let content_type = resp
3768 .headers()
3769 .get("content-type")
3770 .and_then(|v| v.to_str().ok())
3771 .unwrap_or("application/octet-stream");
3772 let content_type = super::ContentType::from(content_type);
3773
3774 if !status.is_client_error() && !status.is_server_error() {
3775 let content = resp.text().await?;
3776 match content_type {
3777 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3778 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ExchangelinkGetBrokerSubAccountFuturesSummaryV3Resp`"))),
3779 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::ExchangelinkGetBrokerSubAccountFuturesSummaryV3Resp`")))),
3780 }
3781 } else {
3782 let content = resp.text().await?;
3783 let entity: Option<GetBrokerSubAccountFuturesSummaryV3Error> = serde_json::from_str(&content).ok();
3784 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3785 }
3786}
3787
3788pub async fn get_broker_sub_account_margin_summary_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountMarginSummaryV1Params) -> Result<models::GetBrokerSubAccountMarginSummaryV1Resp, Error<GetBrokerSubAccountMarginSummaryV1Error>> {
3790
3791 let uri_str = format!("{}/sapi/v1/broker/subAccount/marginSummary", configuration.base_path);
3792 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3793
3794 let mut query_params: Vec<(String, String)> = Vec::new();
3796
3797 if let Some(ref param_value) = params.sub_account_id {
3798 query_params.push(("subAccountId".to_string(), param_value.to_string()));
3799 }
3800 if let Some(ref param_value) = params.page {
3801 query_params.push(("page".to_string(), param_value.to_string()));
3802 }
3803 if let Some(ref param_value) = params.size {
3804 query_params.push(("size".to_string(), param_value.to_string()));
3805 }
3806 if let Some(ref param_value) = params.recv_window {
3807 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3808 }
3809 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3810
3811 let mut header_params = std::collections::HashMap::new();
3813
3814 if let Some(ref binance_auth) = configuration.binance_auth {
3816 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3818
3819 let body_string: Option<Vec<u8>> = None;
3821
3822 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3824 Ok(sig) => sig,
3825 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3826 };
3827
3828 query_params.push(("signature".to_string(), signature));
3830 }
3831
3832 if !query_params.is_empty() {
3834 req_builder = req_builder.query(&query_params);
3835 }
3836
3837
3838 if let Some(ref user_agent) = configuration.user_agent {
3840 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3841 }
3842
3843 for (header_name, header_value) in header_params {
3845 req_builder = req_builder.header(&header_name, &header_value);
3846 }
3847
3848
3849 let req = req_builder.build()?;
3850 let resp = configuration.client.execute(req).await?;
3851
3852 let status = resp.status();
3853 let content_type = resp
3854 .headers()
3855 .get("content-type")
3856 .and_then(|v| v.to_str().ok())
3857 .unwrap_or("application/octet-stream");
3858 let content_type = super::ContentType::from(content_type);
3859
3860 if !status.is_client_error() && !status.is_server_error() {
3861 let content = resp.text().await?;
3862 match content_type {
3863 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3864 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerSubAccountMarginSummaryV1Resp`"))),
3865 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::GetBrokerSubAccountMarginSummaryV1Resp`")))),
3866 }
3867 } else {
3868 let content = resp.text().await?;
3869 let entity: Option<GetBrokerSubAccountMarginSummaryV1Error> = serde_json::from_str(&content).ok();
3870 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3871 }
3872}
3873
3874pub async fn get_broker_sub_account_spot_summary_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountSpotSummaryV1Params) -> Result<models::GetBrokerSubAccountSpotSummaryV1Resp, Error<GetBrokerSubAccountSpotSummaryV1Error>> {
3876
3877 let uri_str = format!("{}/sapi/v1/broker/subAccount/spotSummary", configuration.base_path);
3878 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3879
3880 let mut query_params: Vec<(String, String)> = Vec::new();
3882
3883 if let Some(ref param_value) = params.sub_account_id {
3884 query_params.push(("subAccountId".to_string(), param_value.to_string()));
3885 }
3886 if let Some(ref param_value) = params.page {
3887 query_params.push(("page".to_string(), param_value.to_string()));
3888 }
3889 if let Some(ref param_value) = params.size {
3890 query_params.push(("size".to_string(), param_value.to_string()));
3891 }
3892 if let Some(ref param_value) = params.recv_window {
3893 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3894 }
3895 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3896
3897 let mut header_params = std::collections::HashMap::new();
3899
3900 if let Some(ref binance_auth) = configuration.binance_auth {
3902 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3904
3905 let body_string: Option<Vec<u8>> = None;
3907
3908 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3910 Ok(sig) => sig,
3911 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3912 };
3913
3914 query_params.push(("signature".to_string(), signature));
3916 }
3917
3918 if !query_params.is_empty() {
3920 req_builder = req_builder.query(&query_params);
3921 }
3922
3923
3924 if let Some(ref user_agent) = configuration.user_agent {
3926 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3927 }
3928
3929 for (header_name, header_value) in header_params {
3931 req_builder = req_builder.header(&header_name, &header_value);
3932 }
3933
3934
3935 let req = req_builder.build()?;
3936 let resp = configuration.client.execute(req).await?;
3937
3938 let status = resp.status();
3939 let content_type = resp
3940 .headers()
3941 .get("content-type")
3942 .and_then(|v| v.to_str().ok())
3943 .unwrap_or("application/octet-stream");
3944 let content_type = super::ContentType::from(content_type);
3945
3946 if !status.is_client_error() && !status.is_server_error() {
3947 let content = resp.text().await?;
3948 match content_type {
3949 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3950 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerSubAccountSpotSummaryV1Resp`"))),
3951 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::GetBrokerSubAccountSpotSummaryV1Resp`")))),
3952 }
3953 } else {
3954 let content = resp.text().await?;
3955 let entity: Option<GetBrokerSubAccountSpotSummaryV1Error> = serde_json::from_str(&content).ok();
3956 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3957 }
3958}
3959
3960pub async fn get_broker_sub_account_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountV1Params) -> Result<Vec<models::GetBrokerSubAccountV1RespItem>, Error<GetBrokerSubAccountV1Error>> {
3961
3962 let uri_str = format!("{}/sapi/v1/broker/subAccount", configuration.base_path);
3963 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3964
3965 let mut query_params: Vec<(String, String)> = Vec::new();
3967
3968 if let Some(ref param_value) = params.sub_account_id {
3969 query_params.push(("subAccountId".to_string(), param_value.to_string()));
3970 }
3971 if let Some(ref param_value) = params.page {
3972 query_params.push(("page".to_string(), param_value.to_string()));
3973 }
3974 if let Some(ref param_value) = params.size {
3975 query_params.push(("size".to_string(), param_value.to_string()));
3976 }
3977 if let Some(ref param_value) = params.recv_window {
3978 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3979 }
3980 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3981
3982 let mut header_params = std::collections::HashMap::new();
3984
3985 if let Some(ref binance_auth) = configuration.binance_auth {
3987 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3989
3990 let body_string: Option<Vec<u8>> = None;
3992
3993 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3995 Ok(sig) => sig,
3996 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3997 };
3998
3999 query_params.push(("signature".to_string(), signature));
4001 }
4002
4003 if !query_params.is_empty() {
4005 req_builder = req_builder.query(&query_params);
4006 }
4007
4008
4009 if let Some(ref user_agent) = configuration.user_agent {
4011 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4012 }
4013
4014 for (header_name, header_value) in header_params {
4016 req_builder = req_builder.header(&header_name, &header_value);
4017 }
4018
4019
4020 let req = req_builder.build()?;
4021 let resp = configuration.client.execute(req).await?;
4022
4023 let status = resp.status();
4024 let content_type = resp
4025 .headers()
4026 .get("content-type")
4027 .and_then(|v| v.to_str().ok())
4028 .unwrap_or("application/octet-stream");
4029 let content_type = super::ContentType::from(content_type);
4030
4031 if !status.is_client_error() && !status.is_server_error() {
4032 let content = resp.text().await?;
4033 match content_type {
4034 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4035 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountV1RespItem>`"))),
4036 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::GetBrokerSubAccountV1RespItem>`")))),
4037 }
4038 } else {
4039 let content = resp.text().await?;
4040 let entity: Option<GetBrokerSubAccountV1Error> = serde_json::from_str(&content).ok();
4041 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4042 }
4043}
4044
4045pub async fn get_broker_transfer_futures_v1(configuration: &configuration::Configuration, params: GetBrokerTransferFuturesV1Params) -> Result<models::GetBrokerTransferFuturesV1Resp, Error<GetBrokerTransferFuturesV1Error>> {
4047
4048 let uri_str = format!("{}/sapi/v1/broker/transfer/futures", configuration.base_path);
4049 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4050
4051 let mut query_params: Vec<(String, String)> = Vec::new();
4053
4054 query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
4055 query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
4056 if let Some(ref param_value) = params.client_tran_id {
4057 query_params.push(("clientTranId".to_string(), param_value.to_string()));
4058 }
4059 if let Some(ref param_value) = params.start_time {
4060 query_params.push(("startTime".to_string(), param_value.to_string()));
4061 }
4062 if let Some(ref param_value) = params.end_time {
4063 query_params.push(("endTime".to_string(), param_value.to_string()));
4064 }
4065 if let Some(ref param_value) = params.page {
4066 query_params.push(("page".to_string(), param_value.to_string()));
4067 }
4068 if let Some(ref param_value) = params.limit {
4069 query_params.push(("limit".to_string(), param_value.to_string()));
4070 }
4071 if let Some(ref param_value) = params.recv_window {
4072 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4073 }
4074 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4075
4076 let mut header_params = std::collections::HashMap::new();
4078
4079 if let Some(ref binance_auth) = configuration.binance_auth {
4081 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4083
4084 let body_string: Option<Vec<u8>> = None;
4086
4087 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4089 Ok(sig) => sig,
4090 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4091 };
4092
4093 query_params.push(("signature".to_string(), signature));
4095 }
4096
4097 if !query_params.is_empty() {
4099 req_builder = req_builder.query(&query_params);
4100 }
4101
4102
4103 if let Some(ref user_agent) = configuration.user_agent {
4105 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4106 }
4107
4108 for (header_name, header_value) in header_params {
4110 req_builder = req_builder.header(&header_name, &header_value);
4111 }
4112
4113
4114 let req = req_builder.build()?;
4115 let resp = configuration.client.execute(req).await?;
4116
4117 let status = resp.status();
4118 let content_type = resp
4119 .headers()
4120 .get("content-type")
4121 .and_then(|v| v.to_str().ok())
4122 .unwrap_or("application/octet-stream");
4123 let content_type = super::ContentType::from(content_type);
4124
4125 if !status.is_client_error() && !status.is_server_error() {
4126 let content = resp.text().await?;
4127 match content_type {
4128 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4129 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerTransferFuturesV1Resp`"))),
4130 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::GetBrokerTransferFuturesV1Resp`")))),
4131 }
4132 } else {
4133 let content = resp.text().await?;
4134 let entity: Option<GetBrokerTransferFuturesV1Error> = serde_json::from_str(&content).ok();
4135 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4136 }
4137}
4138
4139pub async fn get_broker_transfer_v1(configuration: &configuration::Configuration, params: GetBrokerTransferV1Params) -> Result<Vec<models::GetBrokerTransferV1RespItem>, Error<GetBrokerTransferV1Error>> {
4141
4142 let uri_str = format!("{}/sapi/v1/broker/transfer", configuration.base_path);
4143 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4144
4145 let mut query_params: Vec<(String, String)> = Vec::new();
4147
4148 if let Some(ref param_value) = params.from_id {
4149 query_params.push(("fromId".to_string(), param_value.to_string()));
4150 }
4151 if let Some(ref param_value) = params.to_id {
4152 query_params.push(("toId".to_string(), param_value.to_string()));
4153 }
4154 if let Some(ref param_value) = params.client_tran_id {
4155 query_params.push(("clientTranId".to_string(), param_value.to_string()));
4156 }
4157 if let Some(ref param_value) = params.show_all_status {
4158 query_params.push(("showAllStatus".to_string(), param_value.to_string()));
4159 }
4160 if let Some(ref param_value) = params.start_time {
4161 query_params.push(("startTime".to_string(), param_value.to_string()));
4162 }
4163 if let Some(ref param_value) = params.end_time {
4164 query_params.push(("endTime".to_string(), param_value.to_string()));
4165 }
4166 if let Some(ref param_value) = params.page {
4167 query_params.push(("page".to_string(), param_value.to_string()));
4168 }
4169 if let Some(ref param_value) = params.limit {
4170 query_params.push(("limit".to_string(), param_value.to_string()));
4171 }
4172 if let Some(ref param_value) = params.recv_window {
4173 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4174 }
4175 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4176
4177 let mut header_params = std::collections::HashMap::new();
4179
4180 if let Some(ref binance_auth) = configuration.binance_auth {
4182 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4184
4185 let body_string: Option<Vec<u8>> = None;
4187
4188 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4190 Ok(sig) => sig,
4191 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4192 };
4193
4194 query_params.push(("signature".to_string(), signature));
4196 }
4197
4198 if !query_params.is_empty() {
4200 req_builder = req_builder.query(&query_params);
4201 }
4202
4203
4204 if let Some(ref user_agent) = configuration.user_agent {
4206 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4207 }
4208
4209 for (header_name, header_value) in header_params {
4211 req_builder = req_builder.header(&header_name, &header_value);
4212 }
4213
4214
4215 let req = req_builder.build()?;
4216 let resp = configuration.client.execute(req).await?;
4217
4218 let status = resp.status();
4219 let content_type = resp
4220 .headers()
4221 .get("content-type")
4222 .and_then(|v| v.to_str().ok())
4223 .unwrap_or("application/octet-stream");
4224 let content_type = super::ContentType::from(content_type);
4225
4226 if !status.is_client_error() && !status.is_server_error() {
4227 let content = resp.text().await?;
4228 match content_type {
4229 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4230 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerTransferV1RespItem>`"))),
4231 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::GetBrokerTransferV1RespItem>`")))),
4232 }
4233 } else {
4234 let content = resp.text().await?;
4235 let entity: Option<GetBrokerTransferV1Error> = serde_json::from_str(&content).ok();
4236 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4237 }
4238}
4239
4240pub async fn get_broker_universal_transfer_v1(configuration: &configuration::Configuration, params: GetBrokerUniversalTransferV1Params) -> Result<Vec<models::GetBrokerUniversalTransferV1RespItem>, Error<GetBrokerUniversalTransferV1Error>> {
4242
4243 let uri_str = format!("{}/sapi/v1/broker/universalTransfer", configuration.base_path);
4244 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4245
4246 let mut query_params: Vec<(String, String)> = Vec::new();
4248
4249 if let Some(ref param_value) = params.from_id {
4250 query_params.push(("fromId".to_string(), param_value.to_string()));
4251 }
4252 if let Some(ref param_value) = params.to_id {
4253 query_params.push(("toId".to_string(), param_value.to_string()));
4254 }
4255 if let Some(ref param_value) = params.client_tran_id {
4256 query_params.push(("clientTranId".to_string(), param_value.to_string()));
4257 }
4258 if let Some(ref param_value) = params.start_time {
4259 query_params.push(("startTime".to_string(), param_value.to_string()));
4260 }
4261 if let Some(ref param_value) = params.end_time {
4262 query_params.push(("endTime".to_string(), param_value.to_string()));
4263 }
4264 if let Some(ref param_value) = params.page {
4265 query_params.push(("page".to_string(), param_value.to_string()));
4266 }
4267 if let Some(ref param_value) = params.limit {
4268 query_params.push(("limit".to_string(), param_value.to_string()));
4269 }
4270 if let Some(ref param_value) = params.show_all_status {
4271 query_params.push(("showAllStatus".to_string(), param_value.to_string()));
4272 }
4273 if let Some(ref param_value) = params.recv_window {
4274 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4275 }
4276 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4277
4278 let mut header_params = std::collections::HashMap::new();
4280
4281 if let Some(ref binance_auth) = configuration.binance_auth {
4283 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4285
4286 let body_string: Option<Vec<u8>> = None;
4288
4289 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4291 Ok(sig) => sig,
4292 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4293 };
4294
4295 query_params.push(("signature".to_string(), signature));
4297 }
4298
4299 if !query_params.is_empty() {
4301 req_builder = req_builder.query(&query_params);
4302 }
4303
4304
4305 if let Some(ref user_agent) = configuration.user_agent {
4307 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4308 }
4309
4310 for (header_name, header_value) in header_params {
4312 req_builder = req_builder.header(&header_name, &header_value);
4313 }
4314
4315
4316 let req = req_builder.build()?;
4317 let resp = configuration.client.execute(req).await?;
4318
4319 let status = resp.status();
4320 let content_type = resp
4321 .headers()
4322 .get("content-type")
4323 .and_then(|v| v.to_str().ok())
4324 .unwrap_or("application/octet-stream");
4325 let content_type = super::ContentType::from(content_type);
4326
4327 if !status.is_client_error() && !status.is_server_error() {
4328 let content = resp.text().await?;
4329 match content_type {
4330 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4331 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerUniversalTransferV1RespItem>`"))),
4332 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::GetBrokerUniversalTransferV1RespItem>`")))),
4333 }
4334 } else {
4335 let content = resp.text().await?;
4336 let entity: Option<GetBrokerUniversalTransferV1Error> = serde_json::from_str(&content).ok();
4337 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4338 }
4339}
4340