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 CreateManagedSubaccountDepositV1Params {
20 pub amount: String,
21 pub asset: String,
22 pub timestamp: i64,
23 pub to_email: String,
24 pub recv_window: Option<i64>
25}
26
27#[derive(Clone, Debug, Default)]
29pub struct CreateManagedSubaccountWithdrawV1Params {
30 pub amount: String,
31 pub asset: String,
32 pub from_email: String,
33 pub timestamp: i64,
34 pub recv_window: Option<i64>,
35 pub transfer_date: Option<i64>
36}
37
38#[derive(Clone, Debug, Default)]
40pub struct CreateSubAccountBlvtEnableV1Params {
41 pub email: String,
42 pub enable_blvt: bool,
43 pub timestamp: i64,
44 pub recv_window: Option<i64>
45}
46
47#[derive(Clone, Debug, Default)]
49pub struct CreateSubAccountEoptionsEnableV1Params {
50 pub email: String,
51 pub timestamp: i64,
52 pub recv_window: Option<i64>
53}
54
55#[derive(Clone, Debug, Default)]
57pub struct CreateSubAccountFuturesEnableV1Params {
58 pub email: String,
59 pub timestamp: i64,
60 pub recv_window: Option<i64>
61}
62
63#[derive(Clone, Debug, Default)]
65pub struct CreateSubAccountFuturesInternalTransferV1Params {
66 pub amount: String,
67 pub asset: String,
68 pub from_email: String,
69 pub futures_type: i64,
70 pub timestamp: i64,
71 pub to_email: String,
72 pub recv_window: Option<i64>
73}
74
75#[derive(Clone, Debug, Default)]
77pub struct CreateSubAccountFuturesMovePositionV1Params {
78 pub from_user_email: String,
79 pub order_args: Vec<serde_json::Value>,
80 pub product_type: String,
81 pub timestamp: i64,
82 pub to_user_email: String,
83 pub recv_window: Option<i64>
84}
85
86#[derive(Clone, Debug, Default)]
88pub struct CreateSubAccountFuturesTransferV1Params {
89 pub amount: String,
90 pub asset: String,
91 pub email: String,
92 pub timestamp: i64,
93 pub r#type: i32,
94 pub recv_window: Option<i64>
95}
96
97#[derive(Clone, Debug, Default)]
99pub struct CreateSubAccountMarginEnableV1Params {
100 pub email: String,
101 pub timestamp: i64,
102 pub recv_window: Option<i64>
103}
104
105#[derive(Clone, Debug, Default)]
107pub struct CreateSubAccountMarginTransferV1Params {
108 pub amount: String,
109 pub asset: String,
110 pub email: String,
111 pub timestamp: i64,
112 pub r#type: i32,
113 pub recv_window: Option<i64>
114}
115
116#[derive(Clone, Debug, Default)]
118pub struct CreateSubAccountSubAccountApiIpRestrictionV2Params {
119 pub email: String,
120 pub status: String,
121 pub sub_account_api_key: String,
122 pub timestamp: i64,
123 pub ip_address: Option<String>,
124 pub recv_window: Option<i64>
125}
126
127#[derive(Clone, Debug, Default)]
129pub struct CreateSubAccountTransferSubToMasterV1Params {
130 pub amount: String,
131 pub asset: String,
132 pub timestamp: i64,
133 pub recv_window: Option<i64>
134}
135
136#[derive(Clone, Debug, Default)]
138pub struct CreateSubAccountTransferSubToSubV1Params {
139 pub amount: String,
140 pub asset: String,
141 pub timestamp: i64,
142 pub to_email: String,
143 pub recv_window: Option<i64>
144}
145
146#[derive(Clone, Debug, Default)]
148pub struct CreateSubAccountUniversalTransferV1Params {
149 pub amount: String,
150 pub asset: String,
151 pub from_account_type: String,
152 pub timestamp: i64,
153 pub to_account_type: String,
154 pub client_tran_id: Option<String>,
155 pub from_email: Option<String>,
156 pub recv_window: Option<i64>,
157 pub symbol: Option<String>,
158 pub to_email: Option<String>
159}
160
161#[derive(Clone, Debug, Default)]
163pub struct CreateSubAccountVirtualSubAccountV1Params {
164 pub sub_account_string: String,
165 pub timestamp: i64,
166 pub recv_window: Option<i64>
167}
168
169#[derive(Clone, Debug, Default)]
171pub struct DeleteSubAccountSubAccountApiIpRestrictionIpListV1Params {
172 pub email: String,
174 pub sub_account_api_key: String,
175 pub timestamp: i64,
176 pub ip_address: Option<String>,
178 pub recv_window: Option<i64>
179}
180
181#[derive(Clone, Debug, Default)]
183pub struct GetCapitalDepositSubAddressV1Params {
184 pub email: String,
186 pub coin: String,
187 pub timestamp: i64,
188 pub network: Option<String>,
189 pub amount: Option<String>,
190 pub recv_window: Option<i64>
191}
192
193#[derive(Clone, Debug, Default)]
195pub struct GetCapitalDepositSubHisrecV1Params {
196 pub email: String,
198 pub timestamp: i64,
199 pub coin: Option<String>,
200 pub status: Option<i32>,
202 pub start_time: Option<i64>,
203 pub end_time: Option<i64>,
204 pub limit: Option<i32>,
205 pub offset: Option<i32>,
207 pub recv_window: Option<i64>,
208 pub tx_id: Option<String>
209}
210
211#[derive(Clone, Debug, Default)]
213pub struct GetManagedSubaccountAccountSnapshotV1Params {
214 pub email: String,
215 pub r#type: String,
217 pub timestamp: i64,
218 pub start_time: Option<i64>,
219 pub end_time: Option<i64>,
220 pub limit: Option<i32>,
222 pub recv_window: Option<i64>
223}
224
225#[derive(Clone, Debug, Default)]
227pub struct GetManagedSubaccountAssetV1Params {
228 pub email: String,
229 pub timestamp: i64,
230 pub recv_window: Option<i64>
231}
232
233#[derive(Clone, Debug, Default)]
235pub struct GetManagedSubaccountDepositAddressV1Params {
236 pub email: String,
238 pub coin: String,
239 pub timestamp: i64,
240 pub network: Option<String>,
242 pub amount: Option<String>,
243 pub recv_window: Option<i64>
244}
245
246#[derive(Clone, Debug, Default)]
248pub struct GetManagedSubaccountFetchFutureAssetV1Params {
249 pub email: String,
251 pub account_type: Option<String>
253}
254
255#[derive(Clone, Debug, Default)]
257pub struct GetManagedSubaccountInfoV1Params {
258 pub timestamp: i64,
259 pub email: Option<String>,
261 pub page: Option<i32>,
263 pub limit: Option<i32>,
265 pub recv_window: Option<i64>
266}
267
268#[derive(Clone, Debug, Default)]
270pub struct GetManagedSubaccountMarginAssetV1Params {
271 pub email: String,
273 pub account_type: Option<String>
275}
276
277#[derive(Clone, Debug, Default)]
279pub struct GetManagedSubaccountQueryTransLogForInvestorV1Params {
280 pub email: String,
282 pub start_time: i64,
284 pub end_time: i64,
286 pub page: i32,
288 pub limit: i32,
290 pub transfers: Option<String>,
292 pub transfer_function_account_type: Option<String>
294}
295
296#[derive(Clone, Debug, Default)]
298pub struct GetManagedSubaccountQueryTransLogForTradeParentV1Params {
299 pub email: String,
301 pub start_time: i64,
303 pub end_time: i64,
305 pub page: i32,
307 pub limit: i32,
309 pub transfers: Option<String>,
311 pub transfer_function_account_type: Option<String>
313}
314
315#[derive(Clone, Debug, Default)]
317pub struct GetManagedSubaccountQueryTransLogV1Params {
318 pub start_time: i64,
320 pub end_time: i64,
322 pub page: i32,
324 pub limit: i32,
326 pub timestamp: i64,
327 pub transfers: Option<String>,
329 pub transfer_function_account_type: Option<String>,
331 pub recv_window: Option<i64>
332}
333
334#[derive(Clone, Debug, Default)]
336pub struct GetSubAccountAssetsV3Params {
337 pub email: String,
339 pub timestamp: i64,
340 pub recv_window: Option<i64>
341}
342
343#[derive(Clone, Debug, Default)]
345pub struct GetSubAccountAssetsV4Params {
346 pub email: String,
348 pub timestamp: i64,
349 pub recv_window: Option<i64>
350}
351
352#[derive(Clone, Debug, Default)]
354pub struct GetSubAccountFuturesAccountSummaryV1Params {
355 pub timestamp: i64,
356 pub recv_window: Option<i64>
357}
358
359#[derive(Clone, Debug, Default)]
361pub struct GetSubAccountFuturesAccountSummaryV2Params {
362 pub futures_type: i32,
364 pub timestamp: i64,
365 pub page: Option<i32>,
367 pub limit: Option<i32>,
369 pub recv_window: Option<i64>
370}
371
372#[derive(Clone, Debug, Default)]
374pub struct GetSubAccountFuturesAccountV1Params {
375 pub email: String,
377 pub timestamp: i64,
378 pub recv_window: Option<i64>
379}
380
381#[derive(Clone, Debug, Default)]
383pub struct GetSubAccountFuturesAccountV2Params {
384 pub email: String,
386 pub futures_type: i32,
388 pub timestamp: i64,
389 pub recv_window: Option<i64>
390}
391
392#[derive(Clone, Debug, Default)]
394pub struct GetSubAccountFuturesInternalTransferV1Params {
395 pub email: String,
397 pub futures_type: i64,
399 pub timestamp: i64,
400 pub start_time: Option<i64>,
402 pub end_time: Option<i64>,
403 pub page: Option<i32>,
405 pub limit: Option<i32>,
407 pub recv_window: Option<i64>
408}
409
410#[derive(Clone, Debug, Default)]
412pub struct GetSubAccountFuturesMovePositionV1Params {
413 pub symbol: String,
414 pub page: i32,
415 pub row: i32,
416 pub timestamp: i64,
417 pub start_time: Option<i64>,
418 pub end_time: Option<i64>,
419 pub recv_window: Option<i64>
420}
421
422#[derive(Clone, Debug, Default)]
424pub struct GetSubAccountFuturesPositionRiskV1Params {
425 pub email: String,
427 pub timestamp: i64,
428 pub recv_window: Option<i64>
429}
430
431#[derive(Clone, Debug, Default)]
433pub struct GetSubAccountFuturesPositionRiskV2Params {
434 pub email: String,
436 pub futures_type: i32,
438 pub timestamp: i64,
439 pub recv_window: Option<i64>
440}
441
442#[derive(Clone, Debug, Default)]
444pub struct GetSubAccountListV1Params {
445 pub timestamp: i64,
446 pub email: Option<String>,
448 pub is_freeze: Option<String>,
450 pub page: Option<i32>,
452 pub limit: Option<i32>,
454 pub recv_window: Option<i64>
455}
456
457#[derive(Clone, Debug, Default)]
459pub struct GetSubAccountMarginAccountSummaryV1Params {
460 pub timestamp: i64,
461 pub recv_window: Option<i64>
462}
463
464#[derive(Clone, Debug, Default)]
466pub struct GetSubAccountMarginAccountV1Params {
467 pub email: String,
469 pub timestamp: i64,
470 pub recv_window: Option<i64>
471}
472
473#[derive(Clone, Debug, Default)]
475pub struct GetSubAccountSpotSummaryV1Params {
476 pub timestamp: i64,
477 pub email: Option<String>,
479 pub page: Option<i64>,
481 pub size: Option<i64>,
483 pub recv_window: Option<i64>
484}
485
486#[derive(Clone, Debug, Default)]
488pub struct GetSubAccountStatusV1Params {
489 pub timestamp: i64,
490 pub email: Option<String>,
492 pub recv_window: Option<i64>
493}
494
495#[derive(Clone, Debug, Default)]
497pub struct GetSubAccountSubAccountApiIpRestrictionV1Params {
498 pub email: String,
500 pub sub_account_api_key: String,
501 pub timestamp: i64,
502 pub recv_window: Option<i64>
503}
504
505#[derive(Clone, Debug, Default)]
507pub struct GetSubAccountSubTransferHistoryV1Params {
508 pub timestamp: i64,
509 pub from_email: Option<String>,
510 pub to_email: Option<String>,
511 pub start_time: Option<i64>,
512 pub end_time: Option<i64>,
513 pub page: Option<i32>,
515 pub limit: Option<i32>,
517 pub recv_window: Option<i64>
518}
519
520#[derive(Clone, Debug, Default)]
522pub struct GetSubAccountTransactionStatisticsV1Params {
523 pub email: String,
525 pub timestamp: i64,
526 pub recv_window: Option<i64>
527}
528
529#[derive(Clone, Debug, Default)]
531pub struct GetSubAccountTransferSubUserHistoryV1Params {
532 pub timestamp: i64,
533 pub asset: Option<String>,
535 pub r#type: Option<i32>,
537 pub start_time: Option<i64>,
538 pub end_time: Option<i64>,
539 pub limit: Option<i32>,
541 pub return_fail_history: Option<bool>,
543 pub recv_window: Option<i64>
544}
545
546#[derive(Clone, Debug, Default)]
548pub struct GetSubAccountUniversalTransferV1Params {
549 pub timestamp: i64,
550 pub from_email: Option<String>,
551 pub to_email: Option<String>,
552 pub client_tran_id: Option<String>,
553 pub start_time: Option<i64>,
554 pub end_time: Option<i64>,
555 pub page: Option<i32>,
557 pub limit: Option<i32>,
559 pub recv_window: Option<i64>
560}
561
562
563#[derive(Debug, Clone, Serialize, Deserialize)]
565#[serde(untagged)]
566pub enum CreateManagedSubaccountDepositV1Error {
567 Status4XX(models::ApiError),
568 Status5XX(models::ApiError),
569 UnknownValue(serde_json::Value),
570}
571
572#[derive(Debug, Clone, Serialize, Deserialize)]
574#[serde(untagged)]
575pub enum CreateManagedSubaccountWithdrawV1Error {
576 Status4XX(models::ApiError),
577 Status5XX(models::ApiError),
578 UnknownValue(serde_json::Value),
579}
580
581#[derive(Debug, Clone, Serialize, Deserialize)]
583#[serde(untagged)]
584pub enum CreateSubAccountBlvtEnableV1Error {
585 Status4XX(models::ApiError),
586 Status5XX(models::ApiError),
587 UnknownValue(serde_json::Value),
588}
589
590#[derive(Debug, Clone, Serialize, Deserialize)]
592#[serde(untagged)]
593pub enum CreateSubAccountEoptionsEnableV1Error {
594 Status4XX(models::ApiError),
595 Status5XX(models::ApiError),
596 UnknownValue(serde_json::Value),
597}
598
599#[derive(Debug, Clone, Serialize, Deserialize)]
601#[serde(untagged)]
602pub enum CreateSubAccountFuturesEnableV1Error {
603 Status4XX(models::ApiError),
604 Status5XX(models::ApiError),
605 UnknownValue(serde_json::Value),
606}
607
608#[derive(Debug, Clone, Serialize, Deserialize)]
610#[serde(untagged)]
611pub enum CreateSubAccountFuturesInternalTransferV1Error {
612 Status4XX(models::ApiError),
613 Status5XX(models::ApiError),
614 UnknownValue(serde_json::Value),
615}
616
617#[derive(Debug, Clone, Serialize, Deserialize)]
619#[serde(untagged)]
620pub enum CreateSubAccountFuturesMovePositionV1Error {
621 Status4XX(models::ApiError),
622 Status5XX(models::ApiError),
623 UnknownValue(serde_json::Value),
624}
625
626#[derive(Debug, Clone, Serialize, Deserialize)]
628#[serde(untagged)]
629pub enum CreateSubAccountFuturesTransferV1Error {
630 Status4XX(models::ApiError),
631 Status5XX(models::ApiError),
632 UnknownValue(serde_json::Value),
633}
634
635#[derive(Debug, Clone, Serialize, Deserialize)]
637#[serde(untagged)]
638pub enum CreateSubAccountMarginEnableV1Error {
639 Status4XX(models::ApiError),
640 Status5XX(models::ApiError),
641 UnknownValue(serde_json::Value),
642}
643
644#[derive(Debug, Clone, Serialize, Deserialize)]
646#[serde(untagged)]
647pub enum CreateSubAccountMarginTransferV1Error {
648 Status4XX(models::ApiError),
649 Status5XX(models::ApiError),
650 UnknownValue(serde_json::Value),
651}
652
653#[derive(Debug, Clone, Serialize, Deserialize)]
655#[serde(untagged)]
656pub enum CreateSubAccountSubAccountApiIpRestrictionV2Error {
657 Status4XX(models::ApiError),
658 Status5XX(models::ApiError),
659 UnknownValue(serde_json::Value),
660}
661
662#[derive(Debug, Clone, Serialize, Deserialize)]
664#[serde(untagged)]
665pub enum CreateSubAccountTransferSubToMasterV1Error {
666 Status4XX(models::ApiError),
667 Status5XX(models::ApiError),
668 UnknownValue(serde_json::Value),
669}
670
671#[derive(Debug, Clone, Serialize, Deserialize)]
673#[serde(untagged)]
674pub enum CreateSubAccountTransferSubToSubV1Error {
675 Status4XX(models::ApiError),
676 Status5XX(models::ApiError),
677 UnknownValue(serde_json::Value),
678}
679
680#[derive(Debug, Clone, Serialize, Deserialize)]
682#[serde(untagged)]
683pub enum CreateSubAccountUniversalTransferV1Error {
684 Status4XX(models::ApiError),
685 Status5XX(models::ApiError),
686 UnknownValue(serde_json::Value),
687}
688
689#[derive(Debug, Clone, Serialize, Deserialize)]
691#[serde(untagged)]
692pub enum CreateSubAccountVirtualSubAccountV1Error {
693 Status4XX(models::ApiError),
694 Status5XX(models::ApiError),
695 UnknownValue(serde_json::Value),
696}
697
698#[derive(Debug, Clone, Serialize, Deserialize)]
700#[serde(untagged)]
701pub enum DeleteSubAccountSubAccountApiIpRestrictionIpListV1Error {
702 Status4XX(models::ApiError),
703 Status5XX(models::ApiError),
704 UnknownValue(serde_json::Value),
705}
706
707#[derive(Debug, Clone, Serialize, Deserialize)]
709#[serde(untagged)]
710pub enum GetCapitalDepositSubAddressV1Error {
711 Status4XX(models::ApiError),
712 Status5XX(models::ApiError),
713 UnknownValue(serde_json::Value),
714}
715
716#[derive(Debug, Clone, Serialize, Deserialize)]
718#[serde(untagged)]
719pub enum GetCapitalDepositSubHisrecV1Error {
720 Status4XX(models::ApiError),
721 Status5XX(models::ApiError),
722 UnknownValue(serde_json::Value),
723}
724
725#[derive(Debug, Clone, Serialize, Deserialize)]
727#[serde(untagged)]
728pub enum GetManagedSubaccountAccountSnapshotV1Error {
729 Status4XX(models::ApiError),
730 Status5XX(models::ApiError),
731 UnknownValue(serde_json::Value),
732}
733
734#[derive(Debug, Clone, Serialize, Deserialize)]
736#[serde(untagged)]
737pub enum GetManagedSubaccountAssetV1Error {
738 Status4XX(models::ApiError),
739 Status5XX(models::ApiError),
740 UnknownValue(serde_json::Value),
741}
742
743#[derive(Debug, Clone, Serialize, Deserialize)]
745#[serde(untagged)]
746pub enum GetManagedSubaccountDepositAddressV1Error {
747 Status4XX(models::ApiError),
748 Status5XX(models::ApiError),
749 UnknownValue(serde_json::Value),
750}
751
752#[derive(Debug, Clone, Serialize, Deserialize)]
754#[serde(untagged)]
755pub enum GetManagedSubaccountFetchFutureAssetV1Error {
756 Status4XX(models::ApiError),
757 Status5XX(models::ApiError),
758 UnknownValue(serde_json::Value),
759}
760
761#[derive(Debug, Clone, Serialize, Deserialize)]
763#[serde(untagged)]
764pub enum GetManagedSubaccountInfoV1Error {
765 Status4XX(models::ApiError),
766 Status5XX(models::ApiError),
767 UnknownValue(serde_json::Value),
768}
769
770#[derive(Debug, Clone, Serialize, Deserialize)]
772#[serde(untagged)]
773pub enum GetManagedSubaccountMarginAssetV1Error {
774 Status4XX(models::ApiError),
775 Status5XX(models::ApiError),
776 UnknownValue(serde_json::Value),
777}
778
779#[derive(Debug, Clone, Serialize, Deserialize)]
781#[serde(untagged)]
782pub enum GetManagedSubaccountQueryTransLogForInvestorV1Error {
783 Status4XX(models::ApiError),
784 Status5XX(models::ApiError),
785 UnknownValue(serde_json::Value),
786}
787
788#[derive(Debug, Clone, Serialize, Deserialize)]
790#[serde(untagged)]
791pub enum GetManagedSubaccountQueryTransLogForTradeParentV1Error {
792 Status4XX(models::ApiError),
793 Status5XX(models::ApiError),
794 UnknownValue(serde_json::Value),
795}
796
797#[derive(Debug, Clone, Serialize, Deserialize)]
799#[serde(untagged)]
800pub enum GetManagedSubaccountQueryTransLogV1Error {
801 Status4XX(models::ApiError),
802 Status5XX(models::ApiError),
803 UnknownValue(serde_json::Value),
804}
805
806#[derive(Debug, Clone, Serialize, Deserialize)]
808#[serde(untagged)]
809pub enum GetSubAccountAssetsV3Error {
810 Status4XX(models::ApiError),
811 Status5XX(models::ApiError),
812 UnknownValue(serde_json::Value),
813}
814
815#[derive(Debug, Clone, Serialize, Deserialize)]
817#[serde(untagged)]
818pub enum GetSubAccountAssetsV4Error {
819 Status4XX(models::ApiError),
820 Status5XX(models::ApiError),
821 UnknownValue(serde_json::Value),
822}
823
824#[derive(Debug, Clone, Serialize, Deserialize)]
826#[serde(untagged)]
827pub enum GetSubAccountFuturesAccountSummaryV1Error {
828 Status4XX(models::ApiError),
829 Status5XX(models::ApiError),
830 UnknownValue(serde_json::Value),
831}
832
833#[derive(Debug, Clone, Serialize, Deserialize)]
835#[serde(untagged)]
836pub enum GetSubAccountFuturesAccountSummaryV2Error {
837 Status4XX(models::ApiError),
838 Status5XX(models::ApiError),
839 UnknownValue(serde_json::Value),
840}
841
842#[derive(Debug, Clone, Serialize, Deserialize)]
844#[serde(untagged)]
845pub enum GetSubAccountFuturesAccountV1Error {
846 Status4XX(models::ApiError),
847 Status5XX(models::ApiError),
848 UnknownValue(serde_json::Value),
849}
850
851#[derive(Debug, Clone, Serialize, Deserialize)]
853#[serde(untagged)]
854pub enum GetSubAccountFuturesAccountV2Error {
855 Status4XX(models::ApiError),
856 Status5XX(models::ApiError),
857 UnknownValue(serde_json::Value),
858}
859
860#[derive(Debug, Clone, Serialize, Deserialize)]
862#[serde(untagged)]
863pub enum GetSubAccountFuturesInternalTransferV1Error {
864 Status4XX(models::ApiError),
865 Status5XX(models::ApiError),
866 UnknownValue(serde_json::Value),
867}
868
869#[derive(Debug, Clone, Serialize, Deserialize)]
871#[serde(untagged)]
872pub enum GetSubAccountFuturesMovePositionV1Error {
873 Status4XX(models::ApiError),
874 Status5XX(models::ApiError),
875 UnknownValue(serde_json::Value),
876}
877
878#[derive(Debug, Clone, Serialize, Deserialize)]
880#[serde(untagged)]
881pub enum GetSubAccountFuturesPositionRiskV1Error {
882 Status4XX(models::ApiError),
883 Status5XX(models::ApiError),
884 UnknownValue(serde_json::Value),
885}
886
887#[derive(Debug, Clone, Serialize, Deserialize)]
889#[serde(untagged)]
890pub enum GetSubAccountFuturesPositionRiskV2Error {
891 Status4XX(models::ApiError),
892 Status5XX(models::ApiError),
893 UnknownValue(serde_json::Value),
894}
895
896#[derive(Debug, Clone, Serialize, Deserialize)]
898#[serde(untagged)]
899pub enum GetSubAccountListV1Error {
900 Status4XX(models::ApiError),
901 Status5XX(models::ApiError),
902 UnknownValue(serde_json::Value),
903}
904
905#[derive(Debug, Clone, Serialize, Deserialize)]
907#[serde(untagged)]
908pub enum GetSubAccountMarginAccountSummaryV1Error {
909 Status4XX(models::ApiError),
910 Status5XX(models::ApiError),
911 UnknownValue(serde_json::Value),
912}
913
914#[derive(Debug, Clone, Serialize, Deserialize)]
916#[serde(untagged)]
917pub enum GetSubAccountMarginAccountV1Error {
918 Status4XX(models::ApiError),
919 Status5XX(models::ApiError),
920 UnknownValue(serde_json::Value),
921}
922
923#[derive(Debug, Clone, Serialize, Deserialize)]
925#[serde(untagged)]
926pub enum GetSubAccountSpotSummaryV1Error {
927 Status4XX(models::ApiError),
928 Status5XX(models::ApiError),
929 UnknownValue(serde_json::Value),
930}
931
932#[derive(Debug, Clone, Serialize, Deserialize)]
934#[serde(untagged)]
935pub enum GetSubAccountStatusV1Error {
936 Status4XX(models::ApiError),
937 Status5XX(models::ApiError),
938 UnknownValue(serde_json::Value),
939}
940
941#[derive(Debug, Clone, Serialize, Deserialize)]
943#[serde(untagged)]
944pub enum GetSubAccountSubAccountApiIpRestrictionV1Error {
945 Status4XX(models::ApiError),
946 Status5XX(models::ApiError),
947 UnknownValue(serde_json::Value),
948}
949
950#[derive(Debug, Clone, Serialize, Deserialize)]
952#[serde(untagged)]
953pub enum GetSubAccountSubTransferHistoryV1Error {
954 Status4XX(models::ApiError),
955 Status5XX(models::ApiError),
956 UnknownValue(serde_json::Value),
957}
958
959#[derive(Debug, Clone, Serialize, Deserialize)]
961#[serde(untagged)]
962pub enum GetSubAccountTransactionStatisticsV1Error {
963 Status4XX(models::ApiError),
964 Status5XX(models::ApiError),
965 UnknownValue(serde_json::Value),
966}
967
968#[derive(Debug, Clone, Serialize, Deserialize)]
970#[serde(untagged)]
971pub enum GetSubAccountTransferSubUserHistoryV1Error {
972 Status4XX(models::ApiError),
973 Status5XX(models::ApiError),
974 UnknownValue(serde_json::Value),
975}
976
977#[derive(Debug, Clone, Serialize, Deserialize)]
979#[serde(untagged)]
980pub enum GetSubAccountUniversalTransferV1Error {
981 Status4XX(models::ApiError),
982 Status5XX(models::ApiError),
983 UnknownValue(serde_json::Value),
984}
985
986
987pub async fn create_managed_subaccount_deposit_v1(configuration: &configuration::Configuration, params: CreateManagedSubaccountDepositV1Params) -> Result<models::CreateManagedSubaccountDepositV1Resp, Error<CreateManagedSubaccountDepositV1Error>> {
989
990 let uri_str = format!("{}/sapi/v1/managed-subaccount/deposit", configuration.base_path);
991 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
992
993 let mut query_params: Vec<(String, String)> = Vec::new();
995
996
997 let mut header_params = std::collections::HashMap::new();
999
1000 if let Some(ref binance_auth) = configuration.binance_auth {
1002 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1004
1005 let body_string: Option<Vec<u8>> = None;
1007
1008 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1010 Ok(sig) => sig,
1011 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1012 };
1013
1014 query_params.push(("signature".to_string(), signature));
1016 }
1017
1018 if !query_params.is_empty() {
1020 req_builder = req_builder.query(&query_params);
1021 }
1022
1023
1024 if let Some(ref user_agent) = configuration.user_agent {
1026 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1027 }
1028
1029 for (header_name, header_value) in header_params {
1031 req_builder = req_builder.header(&header_name, &header_value);
1032 }
1033
1034 let mut multipart_form_params = std::collections::HashMap::new();
1035 multipart_form_params.insert("amount", params.amount.to_string());
1036 multipart_form_params.insert("asset", params.asset.to_string());
1037 if let Some(param_value) = params.recv_window {
1038 multipart_form_params.insert("recvWindow", param_value.to_string());
1039 }
1040 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1041 multipart_form_params.insert("toEmail", params.to_email.to_string());
1042 req_builder = req_builder.form(&multipart_form_params);
1043
1044 let req = req_builder.build()?;
1045 let resp = configuration.client.execute(req).await?;
1046
1047 let status = resp.status();
1048 let content_type = resp
1049 .headers()
1050 .get("content-type")
1051 .and_then(|v| v.to_str().ok())
1052 .unwrap_or("application/octet-stream");
1053 let content_type = super::ContentType::from(content_type);
1054
1055 if !status.is_client_error() && !status.is_server_error() {
1056 let content = resp.text().await?;
1057 match content_type {
1058 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1059 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateManagedSubaccountDepositV1Resp`"))),
1060 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::CreateManagedSubaccountDepositV1Resp`")))),
1061 }
1062 } else {
1063 let content = resp.text().await?;
1064 let entity: Option<CreateManagedSubaccountDepositV1Error> = serde_json::from_str(&content).ok();
1065 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1066 }
1067}
1068
1069pub async fn create_managed_subaccount_withdraw_v1(configuration: &configuration::Configuration, params: CreateManagedSubaccountWithdrawV1Params) -> Result<models::CreateManagedSubaccountWithdrawV1Resp, Error<CreateManagedSubaccountWithdrawV1Error>> {
1071
1072 let uri_str = format!("{}/sapi/v1/managed-subaccount/withdraw", configuration.base_path);
1073 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1074
1075 let mut query_params: Vec<(String, String)> = Vec::new();
1077
1078
1079 let mut header_params = std::collections::HashMap::new();
1081
1082 if let Some(ref binance_auth) = configuration.binance_auth {
1084 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1086
1087 let body_string: Option<Vec<u8>> = None;
1089
1090 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1092 Ok(sig) => sig,
1093 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1094 };
1095
1096 query_params.push(("signature".to_string(), signature));
1098 }
1099
1100 if !query_params.is_empty() {
1102 req_builder = req_builder.query(&query_params);
1103 }
1104
1105
1106 if let Some(ref user_agent) = configuration.user_agent {
1108 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1109 }
1110
1111 for (header_name, header_value) in header_params {
1113 req_builder = req_builder.header(&header_name, &header_value);
1114 }
1115
1116 let mut multipart_form_params = std::collections::HashMap::new();
1117 multipart_form_params.insert("amount", params.amount.to_string());
1118 multipart_form_params.insert("asset", params.asset.to_string());
1119 multipart_form_params.insert("fromEmail", params.from_email.to_string());
1120 if let Some(param_value) = params.recv_window {
1121 multipart_form_params.insert("recvWindow", param_value.to_string());
1122 }
1123 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1124 if let Some(param_value) = params.transfer_date {
1125 multipart_form_params.insert("transferDate", param_value.to_string());
1126 }
1127 req_builder = req_builder.form(&multipart_form_params);
1128
1129 let req = req_builder.build()?;
1130 let resp = configuration.client.execute(req).await?;
1131
1132 let status = resp.status();
1133 let content_type = resp
1134 .headers()
1135 .get("content-type")
1136 .and_then(|v| v.to_str().ok())
1137 .unwrap_or("application/octet-stream");
1138 let content_type = super::ContentType::from(content_type);
1139
1140 if !status.is_client_error() && !status.is_server_error() {
1141 let content = resp.text().await?;
1142 match content_type {
1143 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1144 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateManagedSubaccountWithdrawV1Resp`"))),
1145 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::CreateManagedSubaccountWithdrawV1Resp`")))),
1146 }
1147 } else {
1148 let content = resp.text().await?;
1149 let entity: Option<CreateManagedSubaccountWithdrawV1Error> = serde_json::from_str(&content).ok();
1150 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1151 }
1152}
1153
1154pub async fn create_sub_account_blvt_enable_v1(configuration: &configuration::Configuration, params: CreateSubAccountBlvtEnableV1Params) -> Result<models::CreateSubAccountBlvtEnableV1Resp, Error<CreateSubAccountBlvtEnableV1Error>> {
1156
1157 let uri_str = format!("{}/sapi/v1/sub-account/blvt/enable", configuration.base_path);
1158 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1159
1160 let mut query_params: Vec<(String, String)> = Vec::new();
1162
1163
1164 let mut header_params = std::collections::HashMap::new();
1166
1167 if let Some(ref binance_auth) = configuration.binance_auth {
1169 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1171
1172 let body_string: Option<Vec<u8>> = None;
1174
1175 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1177 Ok(sig) => sig,
1178 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1179 };
1180
1181 query_params.push(("signature".to_string(), signature));
1183 }
1184
1185 if !query_params.is_empty() {
1187 req_builder = req_builder.query(&query_params);
1188 }
1189
1190
1191 if let Some(ref user_agent) = configuration.user_agent {
1193 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1194 }
1195
1196 for (header_name, header_value) in header_params {
1198 req_builder = req_builder.header(&header_name, &header_value);
1199 }
1200
1201 let mut multipart_form_params = std::collections::HashMap::new();
1202 multipart_form_params.insert("email", params.email.to_string());
1203 multipart_form_params.insert("enableBlvt", params.enable_blvt.to_string());
1204 if let Some(param_value) = params.recv_window {
1205 multipart_form_params.insert("recvWindow", param_value.to_string());
1206 }
1207 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1208 req_builder = req_builder.form(&multipart_form_params);
1209
1210 let req = req_builder.build()?;
1211 let resp = configuration.client.execute(req).await?;
1212
1213 let status = resp.status();
1214 let content_type = resp
1215 .headers()
1216 .get("content-type")
1217 .and_then(|v| v.to_str().ok())
1218 .unwrap_or("application/octet-stream");
1219 let content_type = super::ContentType::from(content_type);
1220
1221 if !status.is_client_error() && !status.is_server_error() {
1222 let content = resp.text().await?;
1223 match content_type {
1224 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1225 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountBlvtEnableV1Resp`"))),
1226 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::CreateSubAccountBlvtEnableV1Resp`")))),
1227 }
1228 } else {
1229 let content = resp.text().await?;
1230 let entity: Option<CreateSubAccountBlvtEnableV1Error> = serde_json::from_str(&content).ok();
1231 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1232 }
1233}
1234
1235pub async fn create_sub_account_eoptions_enable_v1(configuration: &configuration::Configuration, params: CreateSubAccountEoptionsEnableV1Params) -> Result<models::CreateSubAccountEoptionsEnableV1Resp, Error<CreateSubAccountEoptionsEnableV1Error>> {
1237
1238 let uri_str = format!("{}/sapi/v1/sub-account/eoptions/enable", configuration.base_path);
1239 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1240
1241 let mut query_params: Vec<(String, String)> = Vec::new();
1243
1244
1245 let mut header_params = std::collections::HashMap::new();
1247
1248 if let Some(ref binance_auth) = configuration.binance_auth {
1250 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1252
1253 let body_string: Option<Vec<u8>> = None;
1255
1256 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1258 Ok(sig) => sig,
1259 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1260 };
1261
1262 query_params.push(("signature".to_string(), signature));
1264 }
1265
1266 if !query_params.is_empty() {
1268 req_builder = req_builder.query(&query_params);
1269 }
1270
1271
1272 if let Some(ref user_agent) = configuration.user_agent {
1274 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1275 }
1276
1277 for (header_name, header_value) in header_params {
1279 req_builder = req_builder.header(&header_name, &header_value);
1280 }
1281
1282 let mut multipart_form_params = std::collections::HashMap::new();
1283 multipart_form_params.insert("email", params.email.to_string());
1284 if let Some(param_value) = params.recv_window {
1285 multipart_form_params.insert("recvWindow", param_value.to_string());
1286 }
1287 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1288 req_builder = req_builder.form(&multipart_form_params);
1289
1290 let req = req_builder.build()?;
1291 let resp = configuration.client.execute(req).await?;
1292
1293 let status = resp.status();
1294 let content_type = resp
1295 .headers()
1296 .get("content-type")
1297 .and_then(|v| v.to_str().ok())
1298 .unwrap_or("application/octet-stream");
1299 let content_type = super::ContentType::from(content_type);
1300
1301 if !status.is_client_error() && !status.is_server_error() {
1302 let content = resp.text().await?;
1303 match content_type {
1304 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1305 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountEoptionsEnableV1Resp`"))),
1306 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::CreateSubAccountEoptionsEnableV1Resp`")))),
1307 }
1308 } else {
1309 let content = resp.text().await?;
1310 let entity: Option<CreateSubAccountEoptionsEnableV1Error> = serde_json::from_str(&content).ok();
1311 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1312 }
1313}
1314
1315pub async fn create_sub_account_futures_enable_v1(configuration: &configuration::Configuration, params: CreateSubAccountFuturesEnableV1Params) -> Result<models::CreateSubAccountFuturesEnableV1Resp, Error<CreateSubAccountFuturesEnableV1Error>> {
1317
1318 let uri_str = format!("{}/sapi/v1/sub-account/futures/enable", configuration.base_path);
1319 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1320
1321 let mut query_params: Vec<(String, String)> = Vec::new();
1323
1324
1325 let mut header_params = std::collections::HashMap::new();
1327
1328 if let Some(ref binance_auth) = configuration.binance_auth {
1330 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1332
1333 let body_string: Option<Vec<u8>> = None;
1335
1336 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1338 Ok(sig) => sig,
1339 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1340 };
1341
1342 query_params.push(("signature".to_string(), signature));
1344 }
1345
1346 if !query_params.is_empty() {
1348 req_builder = req_builder.query(&query_params);
1349 }
1350
1351
1352 if let Some(ref user_agent) = configuration.user_agent {
1354 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1355 }
1356
1357 for (header_name, header_value) in header_params {
1359 req_builder = req_builder.header(&header_name, &header_value);
1360 }
1361
1362 let mut multipart_form_params = std::collections::HashMap::new();
1363 multipart_form_params.insert("email", params.email.to_string());
1364 if let Some(param_value) = params.recv_window {
1365 multipart_form_params.insert("recvWindow", param_value.to_string());
1366 }
1367 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1368 req_builder = req_builder.form(&multipart_form_params);
1369
1370 let req = req_builder.build()?;
1371 let resp = configuration.client.execute(req).await?;
1372
1373 let status = resp.status();
1374 let content_type = resp
1375 .headers()
1376 .get("content-type")
1377 .and_then(|v| v.to_str().ok())
1378 .unwrap_or("application/octet-stream");
1379 let content_type = super::ContentType::from(content_type);
1380
1381 if !status.is_client_error() && !status.is_server_error() {
1382 let content = resp.text().await?;
1383 match content_type {
1384 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1385 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountFuturesEnableV1Resp`"))),
1386 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::CreateSubAccountFuturesEnableV1Resp`")))),
1387 }
1388 } else {
1389 let content = resp.text().await?;
1390 let entity: Option<CreateSubAccountFuturesEnableV1Error> = serde_json::from_str(&content).ok();
1391 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1392 }
1393}
1394
1395pub async fn create_sub_account_futures_internal_transfer_v1(configuration: &configuration::Configuration, params: CreateSubAccountFuturesInternalTransferV1Params) -> Result<models::CreateSubAccountFuturesInternalTransferV1Resp, Error<CreateSubAccountFuturesInternalTransferV1Error>> {
1397
1398 let uri_str = format!("{}/sapi/v1/sub-account/futures/internalTransfer", configuration.base_path);
1399 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1400
1401 let mut query_params: Vec<(String, String)> = Vec::new();
1403
1404
1405 let mut header_params = std::collections::HashMap::new();
1407
1408 if let Some(ref binance_auth) = configuration.binance_auth {
1410 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1412
1413 let body_string: Option<Vec<u8>> = None;
1415
1416 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1418 Ok(sig) => sig,
1419 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1420 };
1421
1422 query_params.push(("signature".to_string(), signature));
1424 }
1425
1426 if !query_params.is_empty() {
1428 req_builder = req_builder.query(&query_params);
1429 }
1430
1431
1432 if let Some(ref user_agent) = configuration.user_agent {
1434 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1435 }
1436
1437 for (header_name, header_value) in header_params {
1439 req_builder = req_builder.header(&header_name, &header_value);
1440 }
1441
1442 let mut multipart_form_params = std::collections::HashMap::new();
1443 multipart_form_params.insert("amount", params.amount.to_string());
1444 multipart_form_params.insert("asset", params.asset.to_string());
1445 multipart_form_params.insert("fromEmail", params.from_email.to_string());
1446 multipart_form_params.insert("futuresType", params.futures_type.to_string());
1447 if let Some(param_value) = params.recv_window {
1448 multipart_form_params.insert("recvWindow", param_value.to_string());
1449 }
1450 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1451 multipart_form_params.insert("toEmail", params.to_email.to_string());
1452 req_builder = req_builder.form(&multipart_form_params);
1453
1454 let req = req_builder.build()?;
1455 let resp = configuration.client.execute(req).await?;
1456
1457 let status = resp.status();
1458 let content_type = resp
1459 .headers()
1460 .get("content-type")
1461 .and_then(|v| v.to_str().ok())
1462 .unwrap_or("application/octet-stream");
1463 let content_type = super::ContentType::from(content_type);
1464
1465 if !status.is_client_error() && !status.is_server_error() {
1466 let content = resp.text().await?;
1467 match content_type {
1468 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1469 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountFuturesInternalTransferV1Resp`"))),
1470 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::CreateSubAccountFuturesInternalTransferV1Resp`")))),
1471 }
1472 } else {
1473 let content = resp.text().await?;
1474 let entity: Option<CreateSubAccountFuturesInternalTransferV1Error> = serde_json::from_str(&content).ok();
1475 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1476 }
1477}
1478
1479pub async fn create_sub_account_futures_move_position_v1(configuration: &configuration::Configuration, params: CreateSubAccountFuturesMovePositionV1Params) -> Result<models::CreateSubAccountFuturesMovePositionV1Resp, Error<CreateSubAccountFuturesMovePositionV1Error>> {
1481
1482 let uri_str = format!("{}/sapi/v1/sub-account/futures/move-position", configuration.base_path);
1483 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1484
1485 let mut query_params: Vec<(String, String)> = Vec::new();
1487
1488
1489 let mut header_params = std::collections::HashMap::new();
1491
1492 if let Some(ref binance_auth) = configuration.binance_auth {
1494 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1496
1497 let body_string: Option<Vec<u8>> = None;
1499
1500 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1502 Ok(sig) => sig,
1503 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1504 };
1505
1506 query_params.push(("signature".to_string(), signature));
1508 }
1509
1510 if !query_params.is_empty() {
1512 req_builder = req_builder.query(&query_params);
1513 }
1514
1515
1516 if let Some(ref user_agent) = configuration.user_agent {
1518 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1519 }
1520
1521 for (header_name, header_value) in header_params {
1523 req_builder = req_builder.header(&header_name, &header_value);
1524 }
1525
1526 let mut multipart_form_params = std::collections::HashMap::new();
1527 multipart_form_params.insert("fromUserEmail", params.from_user_email.to_string());
1528 multipart_form_params.insert("orderArgs", params.order_args.into_iter().map(|p| serde_json::to_string(&p).unwrap_or_default()).collect::<Vec<String>>().join(",").to_string());
1529 multipart_form_params.insert("productType", params.product_type.to_string());
1530 if let Some(param_value) = params.recv_window {
1531 multipart_form_params.insert("recvWindow", param_value.to_string());
1532 }
1533 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1534 multipart_form_params.insert("toUserEmail", params.to_user_email.to_string());
1535 req_builder = req_builder.form(&multipart_form_params);
1536
1537 let req = req_builder.build()?;
1538 let resp = configuration.client.execute(req).await?;
1539
1540 let status = resp.status();
1541 let content_type = resp
1542 .headers()
1543 .get("content-type")
1544 .and_then(|v| v.to_str().ok())
1545 .unwrap_or("application/octet-stream");
1546 let content_type = super::ContentType::from(content_type);
1547
1548 if !status.is_client_error() && !status.is_server_error() {
1549 let content = resp.text().await?;
1550 match content_type {
1551 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1552 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountFuturesMovePositionV1Resp`"))),
1553 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::CreateSubAccountFuturesMovePositionV1Resp`")))),
1554 }
1555 } else {
1556 let content = resp.text().await?;
1557 let entity: Option<CreateSubAccountFuturesMovePositionV1Error> = serde_json::from_str(&content).ok();
1558 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1559 }
1560}
1561
1562pub async fn create_sub_account_futures_transfer_v1(configuration: &configuration::Configuration, params: CreateSubAccountFuturesTransferV1Params) -> Result<models::CreateSubAccountFuturesTransferV1Resp, Error<CreateSubAccountFuturesTransferV1Error>> {
1564
1565 let uri_str = format!("{}/sapi/v1/sub-account/futures/transfer", configuration.base_path);
1566 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1567
1568 let mut query_params: Vec<(String, String)> = Vec::new();
1570
1571
1572 let mut header_params = std::collections::HashMap::new();
1574
1575 if let Some(ref binance_auth) = configuration.binance_auth {
1577 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1579
1580 let body_string: Option<Vec<u8>> = None;
1582
1583 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1585 Ok(sig) => sig,
1586 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1587 };
1588
1589 query_params.push(("signature".to_string(), signature));
1591 }
1592
1593 if !query_params.is_empty() {
1595 req_builder = req_builder.query(&query_params);
1596 }
1597
1598
1599 if let Some(ref user_agent) = configuration.user_agent {
1601 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1602 }
1603
1604 for (header_name, header_value) in header_params {
1606 req_builder = req_builder.header(&header_name, &header_value);
1607 }
1608
1609 let mut multipart_form_params = std::collections::HashMap::new();
1610 multipart_form_params.insert("amount", params.amount.to_string());
1611 multipart_form_params.insert("asset", params.asset.to_string());
1612 multipart_form_params.insert("email", params.email.to_string());
1613 if let Some(param_value) = params.recv_window {
1614 multipart_form_params.insert("recvWindow", param_value.to_string());
1615 }
1616 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1617 multipart_form_params.insert("type", params.r#type.to_string());
1618 req_builder = req_builder.form(&multipart_form_params);
1619
1620 let req = req_builder.build()?;
1621 let resp = configuration.client.execute(req).await?;
1622
1623 let status = resp.status();
1624 let content_type = resp
1625 .headers()
1626 .get("content-type")
1627 .and_then(|v| v.to_str().ok())
1628 .unwrap_or("application/octet-stream");
1629 let content_type = super::ContentType::from(content_type);
1630
1631 if !status.is_client_error() && !status.is_server_error() {
1632 let content = resp.text().await?;
1633 match content_type {
1634 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1635 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountFuturesTransferV1Resp`"))),
1636 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::CreateSubAccountFuturesTransferV1Resp`")))),
1637 }
1638 } else {
1639 let content = resp.text().await?;
1640 let entity: Option<CreateSubAccountFuturesTransferV1Error> = serde_json::from_str(&content).ok();
1641 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1642 }
1643}
1644
1645pub async fn create_sub_account_margin_enable_v1(configuration: &configuration::Configuration, params: CreateSubAccountMarginEnableV1Params) -> Result<models::CreateSubAccountMarginEnableV1Resp, Error<CreateSubAccountMarginEnableV1Error>> {
1647
1648 let uri_str = format!("{}/sapi/v1/sub-account/margin/enable", configuration.base_path);
1649 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1650
1651 let mut query_params: Vec<(String, String)> = Vec::new();
1653
1654
1655 let mut header_params = std::collections::HashMap::new();
1657
1658 if let Some(ref binance_auth) = configuration.binance_auth {
1660 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1662
1663 let body_string: Option<Vec<u8>> = None;
1665
1666 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1668 Ok(sig) => sig,
1669 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1670 };
1671
1672 query_params.push(("signature".to_string(), signature));
1674 }
1675
1676 if !query_params.is_empty() {
1678 req_builder = req_builder.query(&query_params);
1679 }
1680
1681
1682 if let Some(ref user_agent) = configuration.user_agent {
1684 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1685 }
1686
1687 for (header_name, header_value) in header_params {
1689 req_builder = req_builder.header(&header_name, &header_value);
1690 }
1691
1692 let mut multipart_form_params = std::collections::HashMap::new();
1693 multipart_form_params.insert("email", params.email.to_string());
1694 if let Some(param_value) = params.recv_window {
1695 multipart_form_params.insert("recvWindow", param_value.to_string());
1696 }
1697 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1698 req_builder = req_builder.form(&multipart_form_params);
1699
1700 let req = req_builder.build()?;
1701 let resp = configuration.client.execute(req).await?;
1702
1703 let status = resp.status();
1704 let content_type = resp
1705 .headers()
1706 .get("content-type")
1707 .and_then(|v| v.to_str().ok())
1708 .unwrap_or("application/octet-stream");
1709 let content_type = super::ContentType::from(content_type);
1710
1711 if !status.is_client_error() && !status.is_server_error() {
1712 let content = resp.text().await?;
1713 match content_type {
1714 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1715 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountMarginEnableV1Resp`"))),
1716 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::CreateSubAccountMarginEnableV1Resp`")))),
1717 }
1718 } else {
1719 let content = resp.text().await?;
1720 let entity: Option<CreateSubAccountMarginEnableV1Error> = serde_json::from_str(&content).ok();
1721 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1722 }
1723}
1724
1725pub async fn create_sub_account_margin_transfer_v1(configuration: &configuration::Configuration, params: CreateSubAccountMarginTransferV1Params) -> Result<models::CreateSubAccountMarginTransferV1Resp, Error<CreateSubAccountMarginTransferV1Error>> {
1727
1728 let uri_str = format!("{}/sapi/v1/sub-account/margin/transfer", configuration.base_path);
1729 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1730
1731 let mut query_params: Vec<(String, String)> = Vec::new();
1733
1734
1735 let mut header_params = std::collections::HashMap::new();
1737
1738 if let Some(ref binance_auth) = configuration.binance_auth {
1740 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1742
1743 let body_string: Option<Vec<u8>> = None;
1745
1746 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1748 Ok(sig) => sig,
1749 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1750 };
1751
1752 query_params.push(("signature".to_string(), signature));
1754 }
1755
1756 if !query_params.is_empty() {
1758 req_builder = req_builder.query(&query_params);
1759 }
1760
1761
1762 if let Some(ref user_agent) = configuration.user_agent {
1764 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1765 }
1766
1767 for (header_name, header_value) in header_params {
1769 req_builder = req_builder.header(&header_name, &header_value);
1770 }
1771
1772 let mut multipart_form_params = std::collections::HashMap::new();
1773 multipart_form_params.insert("amount", params.amount.to_string());
1774 multipart_form_params.insert("asset", params.asset.to_string());
1775 multipart_form_params.insert("email", params.email.to_string());
1776 if let Some(param_value) = params.recv_window {
1777 multipart_form_params.insert("recvWindow", param_value.to_string());
1778 }
1779 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1780 multipart_form_params.insert("type", params.r#type.to_string());
1781 req_builder = req_builder.form(&multipart_form_params);
1782
1783 let req = req_builder.build()?;
1784 let resp = configuration.client.execute(req).await?;
1785
1786 let status = resp.status();
1787 let content_type = resp
1788 .headers()
1789 .get("content-type")
1790 .and_then(|v| v.to_str().ok())
1791 .unwrap_or("application/octet-stream");
1792 let content_type = super::ContentType::from(content_type);
1793
1794 if !status.is_client_error() && !status.is_server_error() {
1795 let content = resp.text().await?;
1796 match content_type {
1797 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1798 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountMarginTransferV1Resp`"))),
1799 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::CreateSubAccountMarginTransferV1Resp`")))),
1800 }
1801 } else {
1802 let content = resp.text().await?;
1803 let entity: Option<CreateSubAccountMarginTransferV1Error> = serde_json::from_str(&content).ok();
1804 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1805 }
1806}
1807
1808pub async fn create_sub_account_sub_account_api_ip_restriction_v2(configuration: &configuration::Configuration, params: CreateSubAccountSubAccountApiIpRestrictionV2Params) -> Result<models::CreateSubAccountSubAccountApiIpRestrictionV2Resp, Error<CreateSubAccountSubAccountApiIpRestrictionV2Error>> {
1810
1811 let uri_str = format!("{}/sapi/v2/sub-account/subAccountApi/ipRestriction", configuration.base_path);
1812 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1813
1814 let mut query_params: Vec<(String, String)> = Vec::new();
1816
1817
1818 let mut header_params = std::collections::HashMap::new();
1820
1821 if let Some(ref binance_auth) = configuration.binance_auth {
1823 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1825
1826 let body_string: Option<Vec<u8>> = None;
1828
1829 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1831 Ok(sig) => sig,
1832 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1833 };
1834
1835 query_params.push(("signature".to_string(), signature));
1837 }
1838
1839 if !query_params.is_empty() {
1841 req_builder = req_builder.query(&query_params);
1842 }
1843
1844
1845 if let Some(ref user_agent) = configuration.user_agent {
1847 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1848 }
1849
1850 for (header_name, header_value) in header_params {
1852 req_builder = req_builder.header(&header_name, &header_value);
1853 }
1854
1855 let mut multipart_form_params = std::collections::HashMap::new();
1856 multipart_form_params.insert("email", params.email.to_string());
1857 if let Some(param_value) = params.ip_address {
1858 multipart_form_params.insert("ipAddress", param_value.to_string());
1859 }
1860 if let Some(param_value) = params.recv_window {
1861 multipart_form_params.insert("recvWindow", param_value.to_string());
1862 }
1863 multipart_form_params.insert("status", params.status.to_string());
1864 multipart_form_params.insert("subAccountApiKey", params.sub_account_api_key.to_string());
1865 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1866 req_builder = req_builder.form(&multipart_form_params);
1867
1868 let req = req_builder.build()?;
1869 let resp = configuration.client.execute(req).await?;
1870
1871 let status = resp.status();
1872 let content_type = resp
1873 .headers()
1874 .get("content-type")
1875 .and_then(|v| v.to_str().ok())
1876 .unwrap_or("application/octet-stream");
1877 let content_type = super::ContentType::from(content_type);
1878
1879 if !status.is_client_error() && !status.is_server_error() {
1880 let content = resp.text().await?;
1881 match content_type {
1882 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1883 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountSubAccountApiIpRestrictionV2Resp`"))),
1884 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::CreateSubAccountSubAccountApiIpRestrictionV2Resp`")))),
1885 }
1886 } else {
1887 let content = resp.text().await?;
1888 let entity: Option<CreateSubAccountSubAccountApiIpRestrictionV2Error> = serde_json::from_str(&content).ok();
1889 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1890 }
1891}
1892
1893pub async fn create_sub_account_transfer_sub_to_master_v1(configuration: &configuration::Configuration, params: CreateSubAccountTransferSubToMasterV1Params) -> Result<models::CreateSubAccountTransferSubToMasterV1Resp, Error<CreateSubAccountTransferSubToMasterV1Error>> {
1895
1896 let uri_str = format!("{}/sapi/v1/sub-account/transfer/subToMaster", configuration.base_path);
1897 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1898
1899 let mut query_params: Vec<(String, String)> = Vec::new();
1901
1902
1903 let mut header_params = std::collections::HashMap::new();
1905
1906 if let Some(ref binance_auth) = configuration.binance_auth {
1908 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1910
1911 let body_string: Option<Vec<u8>> = None;
1913
1914 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1916 Ok(sig) => sig,
1917 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1918 };
1919
1920 query_params.push(("signature".to_string(), signature));
1922 }
1923
1924 if !query_params.is_empty() {
1926 req_builder = req_builder.query(&query_params);
1927 }
1928
1929
1930 if let Some(ref user_agent) = configuration.user_agent {
1932 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1933 }
1934
1935 for (header_name, header_value) in header_params {
1937 req_builder = req_builder.header(&header_name, &header_value);
1938 }
1939
1940 let mut multipart_form_params = std::collections::HashMap::new();
1941 multipart_form_params.insert("amount", params.amount.to_string());
1942 multipart_form_params.insert("asset", params.asset.to_string());
1943 if let Some(param_value) = params.recv_window {
1944 multipart_form_params.insert("recvWindow", param_value.to_string());
1945 }
1946 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1947 req_builder = req_builder.form(&multipart_form_params);
1948
1949 let req = req_builder.build()?;
1950 let resp = configuration.client.execute(req).await?;
1951
1952 let status = resp.status();
1953 let content_type = resp
1954 .headers()
1955 .get("content-type")
1956 .and_then(|v| v.to_str().ok())
1957 .unwrap_or("application/octet-stream");
1958 let content_type = super::ContentType::from(content_type);
1959
1960 if !status.is_client_error() && !status.is_server_error() {
1961 let content = resp.text().await?;
1962 match content_type {
1963 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1964 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountTransferSubToMasterV1Resp`"))),
1965 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::CreateSubAccountTransferSubToMasterV1Resp`")))),
1966 }
1967 } else {
1968 let content = resp.text().await?;
1969 let entity: Option<CreateSubAccountTransferSubToMasterV1Error> = serde_json::from_str(&content).ok();
1970 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1971 }
1972}
1973
1974pub async fn create_sub_account_transfer_sub_to_sub_v1(configuration: &configuration::Configuration, params: CreateSubAccountTransferSubToSubV1Params) -> Result<models::CreateSubAccountTransferSubToSubV1Resp, Error<CreateSubAccountTransferSubToSubV1Error>> {
1976
1977 let uri_str = format!("{}/sapi/v1/sub-account/transfer/subToSub", configuration.base_path);
1978 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1979
1980 let mut query_params: Vec<(String, String)> = Vec::new();
1982
1983
1984 let mut header_params = std::collections::HashMap::new();
1986
1987 if let Some(ref binance_auth) = configuration.binance_auth {
1989 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1991
1992 let body_string: Option<Vec<u8>> = None;
1994
1995 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1997 Ok(sig) => sig,
1998 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1999 };
2000
2001 query_params.push(("signature".to_string(), signature));
2003 }
2004
2005 if !query_params.is_empty() {
2007 req_builder = req_builder.query(&query_params);
2008 }
2009
2010
2011 if let Some(ref user_agent) = configuration.user_agent {
2013 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2014 }
2015
2016 for (header_name, header_value) in header_params {
2018 req_builder = req_builder.header(&header_name, &header_value);
2019 }
2020
2021 let mut multipart_form_params = std::collections::HashMap::new();
2022 multipart_form_params.insert("amount", params.amount.to_string());
2023 multipart_form_params.insert("asset", params.asset.to_string());
2024 if let Some(param_value) = params.recv_window {
2025 multipart_form_params.insert("recvWindow", param_value.to_string());
2026 }
2027 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2028 multipart_form_params.insert("toEmail", params.to_email.to_string());
2029 req_builder = req_builder.form(&multipart_form_params);
2030
2031 let req = req_builder.build()?;
2032 let resp = configuration.client.execute(req).await?;
2033
2034 let status = resp.status();
2035 let content_type = resp
2036 .headers()
2037 .get("content-type")
2038 .and_then(|v| v.to_str().ok())
2039 .unwrap_or("application/octet-stream");
2040 let content_type = super::ContentType::from(content_type);
2041
2042 if !status.is_client_error() && !status.is_server_error() {
2043 let content = resp.text().await?;
2044 match content_type {
2045 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2046 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountTransferSubToSubV1Resp`"))),
2047 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::CreateSubAccountTransferSubToSubV1Resp`")))),
2048 }
2049 } else {
2050 let content = resp.text().await?;
2051 let entity: Option<CreateSubAccountTransferSubToSubV1Error> = serde_json::from_str(&content).ok();
2052 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2053 }
2054}
2055
2056pub async fn create_sub_account_universal_transfer_v1(configuration: &configuration::Configuration, params: CreateSubAccountUniversalTransferV1Params) -> Result<models::CreateSubAccountUniversalTransferV1Resp, Error<CreateSubAccountUniversalTransferV1Error>> {
2058
2059 let uri_str = format!("{}/sapi/v1/sub-account/universalTransfer", configuration.base_path);
2060 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2061
2062 let mut query_params: Vec<(String, String)> = Vec::new();
2064
2065
2066 let mut header_params = std::collections::HashMap::new();
2068
2069 if let Some(ref binance_auth) = configuration.binance_auth {
2071 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2073
2074 let body_string: Option<Vec<u8>> = None;
2076
2077 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2079 Ok(sig) => sig,
2080 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2081 };
2082
2083 query_params.push(("signature".to_string(), signature));
2085 }
2086
2087 if !query_params.is_empty() {
2089 req_builder = req_builder.query(&query_params);
2090 }
2091
2092
2093 if let Some(ref user_agent) = configuration.user_agent {
2095 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2096 }
2097
2098 for (header_name, header_value) in header_params {
2100 req_builder = req_builder.header(&header_name, &header_value);
2101 }
2102
2103 let mut multipart_form_params = std::collections::HashMap::new();
2104 multipart_form_params.insert("amount", params.amount.to_string());
2105 multipart_form_params.insert("asset", params.asset.to_string());
2106 if let Some(param_value) = params.client_tran_id {
2107 multipart_form_params.insert("clientTranId", param_value.to_string());
2108 }
2109 multipart_form_params.insert("fromAccountType", params.from_account_type.to_string());
2110 if let Some(param_value) = params.from_email {
2111 multipart_form_params.insert("fromEmail", param_value.to_string());
2112 }
2113 if let Some(param_value) = params.recv_window {
2114 multipart_form_params.insert("recvWindow", param_value.to_string());
2115 }
2116 if let Some(param_value) = params.symbol {
2117 multipart_form_params.insert("symbol", param_value.to_string());
2118 }
2119 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2120 multipart_form_params.insert("toAccountType", params.to_account_type.to_string());
2121 if let Some(param_value) = params.to_email {
2122 multipart_form_params.insert("toEmail", param_value.to_string());
2123 }
2124 req_builder = req_builder.form(&multipart_form_params);
2125
2126 let req = req_builder.build()?;
2127 let resp = configuration.client.execute(req).await?;
2128
2129 let status = resp.status();
2130 let content_type = resp
2131 .headers()
2132 .get("content-type")
2133 .and_then(|v| v.to_str().ok())
2134 .unwrap_or("application/octet-stream");
2135 let content_type = super::ContentType::from(content_type);
2136
2137 if !status.is_client_error() && !status.is_server_error() {
2138 let content = resp.text().await?;
2139 match content_type {
2140 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2141 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountUniversalTransferV1Resp`"))),
2142 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::CreateSubAccountUniversalTransferV1Resp`")))),
2143 }
2144 } else {
2145 let content = resp.text().await?;
2146 let entity: Option<CreateSubAccountUniversalTransferV1Error> = serde_json::from_str(&content).ok();
2147 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2148 }
2149}
2150
2151pub async fn create_sub_account_virtual_sub_account_v1(configuration: &configuration::Configuration, params: CreateSubAccountVirtualSubAccountV1Params) -> Result<models::CreateSubAccountVirtualSubAccountV1Resp, Error<CreateSubAccountVirtualSubAccountV1Error>> {
2153
2154 let uri_str = format!("{}/sapi/v1/sub-account/virtualSubAccount", configuration.base_path);
2155 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2156
2157 let mut query_params: Vec<(String, String)> = Vec::new();
2159
2160
2161 let mut header_params = std::collections::HashMap::new();
2163
2164 if let Some(ref binance_auth) = configuration.binance_auth {
2166 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2168
2169 let body_string: Option<Vec<u8>> = None;
2171
2172 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2174 Ok(sig) => sig,
2175 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2176 };
2177
2178 query_params.push(("signature".to_string(), signature));
2180 }
2181
2182 if !query_params.is_empty() {
2184 req_builder = req_builder.query(&query_params);
2185 }
2186
2187
2188 if let Some(ref user_agent) = configuration.user_agent {
2190 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2191 }
2192
2193 for (header_name, header_value) in header_params {
2195 req_builder = req_builder.header(&header_name, &header_value);
2196 }
2197
2198 let mut multipart_form_params = std::collections::HashMap::new();
2199 if let Some(param_value) = params.recv_window {
2200 multipart_form_params.insert("recvWindow", param_value.to_string());
2201 }
2202 multipart_form_params.insert("subAccountString", params.sub_account_string.to_string());
2203 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2204 req_builder = req_builder.form(&multipart_form_params);
2205
2206 let req = req_builder.build()?;
2207 let resp = configuration.client.execute(req).await?;
2208
2209 let status = resp.status();
2210 let content_type = resp
2211 .headers()
2212 .get("content-type")
2213 .and_then(|v| v.to_str().ok())
2214 .unwrap_or("application/octet-stream");
2215 let content_type = super::ContentType::from(content_type);
2216
2217 if !status.is_client_error() && !status.is_server_error() {
2218 let content = resp.text().await?;
2219 match content_type {
2220 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2221 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSubAccountVirtualSubAccountV1Resp`"))),
2222 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::CreateSubAccountVirtualSubAccountV1Resp`")))),
2223 }
2224 } else {
2225 let content = resp.text().await?;
2226 let entity: Option<CreateSubAccountVirtualSubAccountV1Error> = serde_json::from_str(&content).ok();
2227 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2228 }
2229}
2230
2231pub async fn delete_sub_account_sub_account_api_ip_restriction_ip_list_v1(configuration: &configuration::Configuration, params: DeleteSubAccountSubAccountApiIpRestrictionIpListV1Params) -> Result<models::DeleteSubAccountSubAccountApiIpRestrictionIpListV1Resp, Error<DeleteSubAccountSubAccountApiIpRestrictionIpListV1Error>> {
2233
2234 let uri_str = format!("{}/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList", configuration.base_path);
2235 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2236
2237 let mut query_params: Vec<(String, String)> = Vec::new();
2239
2240 query_params.push(("email".to_string(), params.email.to_string()));
2241 query_params.push(("subAccountApiKey".to_string(), params.sub_account_api_key.to_string()));
2242 if let Some(ref param_value) = params.ip_address {
2243 query_params.push(("ipAddress".to_string(), param_value.to_string()));
2244 }
2245 if let Some(ref param_value) = params.recv_window {
2246 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2247 }
2248 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2249
2250 let mut header_params = std::collections::HashMap::new();
2252
2253 if let Some(ref binance_auth) = configuration.binance_auth {
2255 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2257
2258 let body_string: Option<Vec<u8>> = None;
2260
2261 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2263 Ok(sig) => sig,
2264 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2265 };
2266
2267 query_params.push(("signature".to_string(), signature));
2269 }
2270
2271 if !query_params.is_empty() {
2273 req_builder = req_builder.query(&query_params);
2274 }
2275
2276
2277 if let Some(ref user_agent) = configuration.user_agent {
2279 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2280 }
2281
2282 for (header_name, header_value) in header_params {
2284 req_builder = req_builder.header(&header_name, &header_value);
2285 }
2286
2287
2288 let req = req_builder.build()?;
2289 let resp = configuration.client.execute(req).await?;
2290
2291 let status = resp.status();
2292 let content_type = resp
2293 .headers()
2294 .get("content-type")
2295 .and_then(|v| v.to_str().ok())
2296 .unwrap_or("application/octet-stream");
2297 let content_type = super::ContentType::from(content_type);
2298
2299 if !status.is_client_error() && !status.is_server_error() {
2300 let content = resp.text().await?;
2301 match content_type {
2302 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2303 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteSubAccountSubAccountApiIpRestrictionIpListV1Resp`"))),
2304 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::DeleteSubAccountSubAccountApiIpRestrictionIpListV1Resp`")))),
2305 }
2306 } else {
2307 let content = resp.text().await?;
2308 let entity: Option<DeleteSubAccountSubAccountApiIpRestrictionIpListV1Error> = serde_json::from_str(&content).ok();
2309 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2310 }
2311}
2312
2313pub async fn get_capital_deposit_sub_address_v1(configuration: &configuration::Configuration, params: GetCapitalDepositSubAddressV1Params) -> Result<models::GetCapitalDepositSubAddressV1Resp, Error<GetCapitalDepositSubAddressV1Error>> {
2315
2316 let uri_str = format!("{}/sapi/v1/capital/deposit/subAddress", configuration.base_path);
2317 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2318
2319 let mut query_params: Vec<(String, String)> = Vec::new();
2321
2322 query_params.push(("email".to_string(), params.email.to_string()));
2323 query_params.push(("coin".to_string(), params.coin.to_string()));
2324 if let Some(ref param_value) = params.network {
2325 query_params.push(("network".to_string(), param_value.to_string()));
2326 }
2327 if let Some(ref param_value) = params.amount {
2328 query_params.push(("amount".to_string(), param_value.to_string()));
2329 }
2330 if let Some(ref param_value) = params.recv_window {
2331 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2332 }
2333 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2334
2335 let mut header_params = std::collections::HashMap::new();
2337
2338 if let Some(ref binance_auth) = configuration.binance_auth {
2340 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2342
2343 let body_string: Option<Vec<u8>> = None;
2345
2346 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2348 Ok(sig) => sig,
2349 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2350 };
2351
2352 query_params.push(("signature".to_string(), signature));
2354 }
2355
2356 if !query_params.is_empty() {
2358 req_builder = req_builder.query(&query_params);
2359 }
2360
2361
2362 if let Some(ref user_agent) = configuration.user_agent {
2364 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2365 }
2366
2367 for (header_name, header_value) in header_params {
2369 req_builder = req_builder.header(&header_name, &header_value);
2370 }
2371
2372
2373 let req = req_builder.build()?;
2374 let resp = configuration.client.execute(req).await?;
2375
2376 let status = resp.status();
2377 let content_type = resp
2378 .headers()
2379 .get("content-type")
2380 .and_then(|v| v.to_str().ok())
2381 .unwrap_or("application/octet-stream");
2382 let content_type = super::ContentType::from(content_type);
2383
2384 if !status.is_client_error() && !status.is_server_error() {
2385 let content = resp.text().await?;
2386 match content_type {
2387 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2388 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCapitalDepositSubAddressV1Resp`"))),
2389 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::GetCapitalDepositSubAddressV1Resp`")))),
2390 }
2391 } else {
2392 let content = resp.text().await?;
2393 let entity: Option<GetCapitalDepositSubAddressV1Error> = serde_json::from_str(&content).ok();
2394 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2395 }
2396}
2397
2398pub async fn get_capital_deposit_sub_hisrec_v1(configuration: &configuration::Configuration, params: GetCapitalDepositSubHisrecV1Params) -> Result<Vec<models::GetCapitalDepositSubHisrecV1RespItem>, Error<GetCapitalDepositSubHisrecV1Error>> {
2400
2401 let uri_str = format!("{}/sapi/v1/capital/deposit/subHisrec", configuration.base_path);
2402 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2403
2404 let mut query_params: Vec<(String, String)> = Vec::new();
2406
2407 query_params.push(("email".to_string(), params.email.to_string()));
2408 if let Some(ref param_value) = params.coin {
2409 query_params.push(("coin".to_string(), param_value.to_string()));
2410 }
2411 if let Some(ref param_value) = params.status {
2412 query_params.push(("status".to_string(), param_value.to_string()));
2413 }
2414 if let Some(ref param_value) = params.start_time {
2415 query_params.push(("startTime".to_string(), param_value.to_string()));
2416 }
2417 if let Some(ref param_value) = params.end_time {
2418 query_params.push(("endTime".to_string(), param_value.to_string()));
2419 }
2420 if let Some(ref param_value) = params.limit {
2421 query_params.push(("limit".to_string(), param_value.to_string()));
2422 }
2423 if let Some(ref param_value) = params.offset {
2424 query_params.push(("offset".to_string(), param_value.to_string()));
2425 }
2426 if let Some(ref param_value) = params.recv_window {
2427 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2428 }
2429 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2430 if let Some(ref param_value) = params.tx_id {
2431 query_params.push(("txId".to_string(), param_value.to_string()));
2432 }
2433
2434 let mut header_params = std::collections::HashMap::new();
2436
2437 if let Some(ref binance_auth) = configuration.binance_auth {
2439 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2441
2442 let body_string: Option<Vec<u8>> = None;
2444
2445 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2447 Ok(sig) => sig,
2448 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2449 };
2450
2451 query_params.push(("signature".to_string(), signature));
2453 }
2454
2455 if !query_params.is_empty() {
2457 req_builder = req_builder.query(&query_params);
2458 }
2459
2460
2461 if let Some(ref user_agent) = configuration.user_agent {
2463 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2464 }
2465
2466 for (header_name, header_value) in header_params {
2468 req_builder = req_builder.header(&header_name, &header_value);
2469 }
2470
2471
2472 let req = req_builder.build()?;
2473 let resp = configuration.client.execute(req).await?;
2474
2475 let status = resp.status();
2476 let content_type = resp
2477 .headers()
2478 .get("content-type")
2479 .and_then(|v| v.to_str().ok())
2480 .unwrap_or("application/octet-stream");
2481 let content_type = super::ContentType::from(content_type);
2482
2483 if !status.is_client_error() && !status.is_server_error() {
2484 let content = resp.text().await?;
2485 match content_type {
2486 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2487 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCapitalDepositSubHisrecV1RespItem>`"))),
2488 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::GetCapitalDepositSubHisrecV1RespItem>`")))),
2489 }
2490 } else {
2491 let content = resp.text().await?;
2492 let entity: Option<GetCapitalDepositSubHisrecV1Error> = serde_json::from_str(&content).ok();
2493 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2494 }
2495}
2496
2497pub async fn get_managed_subaccount_account_snapshot_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountAccountSnapshotV1Params) -> Result<models::GetManagedSubaccountAccountSnapshotV1Resp, Error<GetManagedSubaccountAccountSnapshotV1Error>> {
2499
2500 let uri_str = format!("{}/sapi/v1/managed-subaccount/accountSnapshot", configuration.base_path);
2501 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2502
2503 let mut query_params: Vec<(String, String)> = Vec::new();
2505
2506 query_params.push(("email".to_string(), params.email.to_string()));
2507 query_params.push(("type".to_string(), params.r#type.to_string()));
2508 if let Some(ref param_value) = params.start_time {
2509 query_params.push(("startTime".to_string(), param_value.to_string()));
2510 }
2511 if let Some(ref param_value) = params.end_time {
2512 query_params.push(("endTime".to_string(), param_value.to_string()));
2513 }
2514 if let Some(ref param_value) = params.limit {
2515 query_params.push(("limit".to_string(), param_value.to_string()));
2516 }
2517 if let Some(ref param_value) = params.recv_window {
2518 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2519 }
2520 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2521
2522 let mut header_params = std::collections::HashMap::new();
2524
2525 if let Some(ref binance_auth) = configuration.binance_auth {
2527 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2529
2530 let body_string: Option<Vec<u8>> = None;
2532
2533 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2535 Ok(sig) => sig,
2536 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2537 };
2538
2539 query_params.push(("signature".to_string(), signature));
2541 }
2542
2543 if !query_params.is_empty() {
2545 req_builder = req_builder.query(&query_params);
2546 }
2547
2548
2549 if let Some(ref user_agent) = configuration.user_agent {
2551 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2552 }
2553
2554 for (header_name, header_value) in header_params {
2556 req_builder = req_builder.header(&header_name, &header_value);
2557 }
2558
2559
2560 let req = req_builder.build()?;
2561 let resp = configuration.client.execute(req).await?;
2562
2563 let status = resp.status();
2564 let content_type = resp
2565 .headers()
2566 .get("content-type")
2567 .and_then(|v| v.to_str().ok())
2568 .unwrap_or("application/octet-stream");
2569 let content_type = super::ContentType::from(content_type);
2570
2571 if !status.is_client_error() && !status.is_server_error() {
2572 let content = resp.text().await?;
2573 match content_type {
2574 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2575 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetManagedSubaccountAccountSnapshotV1Resp`"))),
2576 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::GetManagedSubaccountAccountSnapshotV1Resp`")))),
2577 }
2578 } else {
2579 let content = resp.text().await?;
2580 let entity: Option<GetManagedSubaccountAccountSnapshotV1Error> = serde_json::from_str(&content).ok();
2581 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2582 }
2583}
2584
2585pub async fn get_managed_subaccount_asset_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountAssetV1Params) -> Result<Vec<models::GetManagedSubaccountAssetV1RespItem>, Error<GetManagedSubaccountAssetV1Error>> {
2587
2588 let uri_str = format!("{}/sapi/v1/managed-subaccount/asset", configuration.base_path);
2589 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2590
2591 let mut query_params: Vec<(String, String)> = Vec::new();
2593
2594 query_params.push(("email".to_string(), params.email.to_string()));
2595 if let Some(ref param_value) = params.recv_window {
2596 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2597 }
2598 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2599
2600 let mut header_params = std::collections::HashMap::new();
2602
2603 if let Some(ref binance_auth) = configuration.binance_auth {
2605 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2607
2608 let body_string: Option<Vec<u8>> = None;
2610
2611 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2613 Ok(sig) => sig,
2614 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2615 };
2616
2617 query_params.push(("signature".to_string(), signature));
2619 }
2620
2621 if !query_params.is_empty() {
2623 req_builder = req_builder.query(&query_params);
2624 }
2625
2626
2627 if let Some(ref user_agent) = configuration.user_agent {
2629 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2630 }
2631
2632 for (header_name, header_value) in header_params {
2634 req_builder = req_builder.header(&header_name, &header_value);
2635 }
2636
2637
2638 let req = req_builder.build()?;
2639 let resp = configuration.client.execute(req).await?;
2640
2641 let status = resp.status();
2642 let content_type = resp
2643 .headers()
2644 .get("content-type")
2645 .and_then(|v| v.to_str().ok())
2646 .unwrap_or("application/octet-stream");
2647 let content_type = super::ContentType::from(content_type);
2648
2649 if !status.is_client_error() && !status.is_server_error() {
2650 let content = resp.text().await?;
2651 match content_type {
2652 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2653 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetManagedSubaccountAssetV1RespItem>`"))),
2654 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::GetManagedSubaccountAssetV1RespItem>`")))),
2655 }
2656 } else {
2657 let content = resp.text().await?;
2658 let entity: Option<GetManagedSubaccountAssetV1Error> = serde_json::from_str(&content).ok();
2659 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2660 }
2661}
2662
2663pub async fn get_managed_subaccount_deposit_address_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountDepositAddressV1Params) -> Result<models::GetManagedSubaccountDepositAddressV1Resp, Error<GetManagedSubaccountDepositAddressV1Error>> {
2665
2666 let uri_str = format!("{}/sapi/v1/managed-subaccount/deposit/address", configuration.base_path);
2667 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2668
2669 let mut query_params: Vec<(String, String)> = Vec::new();
2671
2672 query_params.push(("email".to_string(), params.email.to_string()));
2673 query_params.push(("coin".to_string(), params.coin.to_string()));
2674 if let Some(ref param_value) = params.network {
2675 query_params.push(("network".to_string(), param_value.to_string()));
2676 }
2677 if let Some(ref param_value) = params.amount {
2678 query_params.push(("amount".to_string(), param_value.to_string()));
2679 }
2680 if let Some(ref param_value) = params.recv_window {
2681 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2682 }
2683 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2684
2685 let mut header_params = std::collections::HashMap::new();
2687
2688 if let Some(ref binance_auth) = configuration.binance_auth {
2690 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2692
2693 let body_string: Option<Vec<u8>> = None;
2695
2696 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2698 Ok(sig) => sig,
2699 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2700 };
2701
2702 query_params.push(("signature".to_string(), signature));
2704 }
2705
2706 if !query_params.is_empty() {
2708 req_builder = req_builder.query(&query_params);
2709 }
2710
2711
2712 if let Some(ref user_agent) = configuration.user_agent {
2714 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2715 }
2716
2717 for (header_name, header_value) in header_params {
2719 req_builder = req_builder.header(&header_name, &header_value);
2720 }
2721
2722
2723 let req = req_builder.build()?;
2724 let resp = configuration.client.execute(req).await?;
2725
2726 let status = resp.status();
2727 let content_type = resp
2728 .headers()
2729 .get("content-type")
2730 .and_then(|v| v.to_str().ok())
2731 .unwrap_or("application/octet-stream");
2732 let content_type = super::ContentType::from(content_type);
2733
2734 if !status.is_client_error() && !status.is_server_error() {
2735 let content = resp.text().await?;
2736 match content_type {
2737 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2738 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetManagedSubaccountDepositAddressV1Resp`"))),
2739 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::GetManagedSubaccountDepositAddressV1Resp`")))),
2740 }
2741 } else {
2742 let content = resp.text().await?;
2743 let entity: Option<GetManagedSubaccountDepositAddressV1Error> = serde_json::from_str(&content).ok();
2744 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2745 }
2746}
2747
2748pub async fn get_managed_subaccount_fetch_future_asset_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountFetchFutureAssetV1Params) -> Result<models::GetManagedSubaccountFetchFutureAssetV1Resp, Error<GetManagedSubaccountFetchFutureAssetV1Error>> {
2750
2751 let uri_str = format!("{}/sapi/v1/managed-subaccount/fetch-future-asset", configuration.base_path);
2752 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2753
2754 let mut query_params: Vec<(String, String)> = Vec::new();
2756
2757 query_params.push(("email".to_string(), params.email.to_string()));
2758 if let Some(ref param_value) = params.account_type {
2759 query_params.push(("accountType".to_string(), param_value.to_string()));
2760 }
2761
2762 let mut header_params = std::collections::HashMap::new();
2764
2765 if let Some(ref binance_auth) = configuration.binance_auth {
2767 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2769
2770 let body_string: Option<Vec<u8>> = None;
2772
2773 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2775 Ok(sig) => sig,
2776 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2777 };
2778
2779 query_params.push(("signature".to_string(), signature));
2781 }
2782
2783 if !query_params.is_empty() {
2785 req_builder = req_builder.query(&query_params);
2786 }
2787
2788
2789 if let Some(ref user_agent) = configuration.user_agent {
2791 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2792 }
2793
2794 for (header_name, header_value) in header_params {
2796 req_builder = req_builder.header(&header_name, &header_value);
2797 }
2798
2799
2800 let req = req_builder.build()?;
2801 let resp = configuration.client.execute(req).await?;
2802
2803 let status = resp.status();
2804 let content_type = resp
2805 .headers()
2806 .get("content-type")
2807 .and_then(|v| v.to_str().ok())
2808 .unwrap_or("application/octet-stream");
2809 let content_type = super::ContentType::from(content_type);
2810
2811 if !status.is_client_error() && !status.is_server_error() {
2812 let content = resp.text().await?;
2813 match content_type {
2814 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2815 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetManagedSubaccountFetchFutureAssetV1Resp`"))),
2816 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::GetManagedSubaccountFetchFutureAssetV1Resp`")))),
2817 }
2818 } else {
2819 let content = resp.text().await?;
2820 let entity: Option<GetManagedSubaccountFetchFutureAssetV1Error> = serde_json::from_str(&content).ok();
2821 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2822 }
2823}
2824
2825pub async fn get_managed_subaccount_info_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountInfoV1Params) -> Result<models::GetManagedSubaccountInfoV1Resp, Error<GetManagedSubaccountInfoV1Error>> {
2827
2828 let uri_str = format!("{}/sapi/v1/managed-subaccount/info", configuration.base_path);
2829 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2830
2831 let mut query_params: Vec<(String, String)> = Vec::new();
2833
2834 if let Some(ref param_value) = params.email {
2835 query_params.push(("email".to_string(), param_value.to_string()));
2836 }
2837 if let Some(ref param_value) = params.page {
2838 query_params.push(("page".to_string(), param_value.to_string()));
2839 }
2840 if let Some(ref param_value) = params.limit {
2841 query_params.push(("limit".to_string(), param_value.to_string()));
2842 }
2843 if let Some(ref param_value) = params.recv_window {
2844 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2845 }
2846 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2847
2848 let mut header_params = std::collections::HashMap::new();
2850
2851 if let Some(ref binance_auth) = configuration.binance_auth {
2853 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2855
2856 let body_string: Option<Vec<u8>> = None;
2858
2859 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2861 Ok(sig) => sig,
2862 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2863 };
2864
2865 query_params.push(("signature".to_string(), signature));
2867 }
2868
2869 if !query_params.is_empty() {
2871 req_builder = req_builder.query(&query_params);
2872 }
2873
2874
2875 if let Some(ref user_agent) = configuration.user_agent {
2877 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2878 }
2879
2880 for (header_name, header_value) in header_params {
2882 req_builder = req_builder.header(&header_name, &header_value);
2883 }
2884
2885
2886 let req = req_builder.build()?;
2887 let resp = configuration.client.execute(req).await?;
2888
2889 let status = resp.status();
2890 let content_type = resp
2891 .headers()
2892 .get("content-type")
2893 .and_then(|v| v.to_str().ok())
2894 .unwrap_or("application/octet-stream");
2895 let content_type = super::ContentType::from(content_type);
2896
2897 if !status.is_client_error() && !status.is_server_error() {
2898 let content = resp.text().await?;
2899 match content_type {
2900 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2901 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetManagedSubaccountInfoV1Resp`"))),
2902 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::GetManagedSubaccountInfoV1Resp`")))),
2903 }
2904 } else {
2905 let content = resp.text().await?;
2906 let entity: Option<GetManagedSubaccountInfoV1Error> = serde_json::from_str(&content).ok();
2907 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2908 }
2909}
2910
2911pub async fn get_managed_subaccount_margin_asset_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountMarginAssetV1Params) -> Result<models::GetManagedSubaccountMarginAssetV1Resp, Error<GetManagedSubaccountMarginAssetV1Error>> {
2913
2914 let uri_str = format!("{}/sapi/v1/managed-subaccount/marginAsset", configuration.base_path);
2915 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2916
2917 let mut query_params: Vec<(String, String)> = Vec::new();
2919
2920 query_params.push(("email".to_string(), params.email.to_string()));
2921 if let Some(ref param_value) = params.account_type {
2922 query_params.push(("accountType".to_string(), param_value.to_string()));
2923 }
2924
2925 let mut header_params = std::collections::HashMap::new();
2927
2928 if let Some(ref binance_auth) = configuration.binance_auth {
2930 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2932
2933 let body_string: Option<Vec<u8>> = None;
2935
2936 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2938 Ok(sig) => sig,
2939 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2940 };
2941
2942 query_params.push(("signature".to_string(), signature));
2944 }
2945
2946 if !query_params.is_empty() {
2948 req_builder = req_builder.query(&query_params);
2949 }
2950
2951
2952 if let Some(ref user_agent) = configuration.user_agent {
2954 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2955 }
2956
2957 for (header_name, header_value) in header_params {
2959 req_builder = req_builder.header(&header_name, &header_value);
2960 }
2961
2962
2963 let req = req_builder.build()?;
2964 let resp = configuration.client.execute(req).await?;
2965
2966 let status = resp.status();
2967 let content_type = resp
2968 .headers()
2969 .get("content-type")
2970 .and_then(|v| v.to_str().ok())
2971 .unwrap_or("application/octet-stream");
2972 let content_type = super::ContentType::from(content_type);
2973
2974 if !status.is_client_error() && !status.is_server_error() {
2975 let content = resp.text().await?;
2976 match content_type {
2977 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2978 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetManagedSubaccountMarginAssetV1Resp`"))),
2979 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::GetManagedSubaccountMarginAssetV1Resp`")))),
2980 }
2981 } else {
2982 let content = resp.text().await?;
2983 let entity: Option<GetManagedSubaccountMarginAssetV1Error> = serde_json::from_str(&content).ok();
2984 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2985 }
2986}
2987
2988pub async fn get_managed_subaccount_query_trans_log_for_investor_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountQueryTransLogForInvestorV1Params) -> Result<models::GetManagedSubaccountQueryTransLogForInvestorV1Resp, Error<GetManagedSubaccountQueryTransLogForInvestorV1Error>> {
2990
2991 let uri_str = format!("{}/sapi/v1/managed-subaccount/queryTransLogForInvestor", configuration.base_path);
2992 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2993
2994 let mut query_params: Vec<(String, String)> = Vec::new();
2996
2997 query_params.push(("email".to_string(), params.email.to_string()));
2998 query_params.push(("startTime".to_string(), params.start_time.to_string()));
2999 query_params.push(("endTime".to_string(), params.end_time.to_string()));
3000 query_params.push(("page".to_string(), params.page.to_string()));
3001 query_params.push(("limit".to_string(), params.limit.to_string()));
3002 if let Some(ref param_value) = params.transfers {
3003 query_params.push(("transfers".to_string(), param_value.to_string()));
3004 }
3005 if let Some(ref param_value) = params.transfer_function_account_type {
3006 query_params.push(("transferFunctionAccountType".to_string(), param_value.to_string()));
3007 }
3008
3009 let mut header_params = std::collections::HashMap::new();
3011
3012 if let Some(ref binance_auth) = configuration.binance_auth {
3014 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3016
3017 let body_string: Option<Vec<u8>> = None;
3019
3020 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3022 Ok(sig) => sig,
3023 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3024 };
3025
3026 query_params.push(("signature".to_string(), signature));
3028 }
3029
3030 if !query_params.is_empty() {
3032 req_builder = req_builder.query(&query_params);
3033 }
3034
3035
3036 if let Some(ref user_agent) = configuration.user_agent {
3038 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3039 }
3040
3041 for (header_name, header_value) in header_params {
3043 req_builder = req_builder.header(&header_name, &header_value);
3044 }
3045
3046
3047 let req = req_builder.build()?;
3048 let resp = configuration.client.execute(req).await?;
3049
3050 let status = resp.status();
3051 let content_type = resp
3052 .headers()
3053 .get("content-type")
3054 .and_then(|v| v.to_str().ok())
3055 .unwrap_or("application/octet-stream");
3056 let content_type = super::ContentType::from(content_type);
3057
3058 if !status.is_client_error() && !status.is_server_error() {
3059 let content = resp.text().await?;
3060 match content_type {
3061 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3062 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetManagedSubaccountQueryTransLogForInvestorV1Resp`"))),
3063 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::GetManagedSubaccountQueryTransLogForInvestorV1Resp`")))),
3064 }
3065 } else {
3066 let content = resp.text().await?;
3067 let entity: Option<GetManagedSubaccountQueryTransLogForInvestorV1Error> = serde_json::from_str(&content).ok();
3068 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3069 }
3070}
3071
3072pub async fn get_managed_subaccount_query_trans_log_for_trade_parent_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountQueryTransLogForTradeParentV1Params) -> Result<models::GetManagedSubaccountQueryTransLogForTradeParentV1Resp, Error<GetManagedSubaccountQueryTransLogForTradeParentV1Error>> {
3074
3075 let uri_str = format!("{}/sapi/v1/managed-subaccount/queryTransLogForTradeParent", configuration.base_path);
3076 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3077
3078 let mut query_params: Vec<(String, String)> = Vec::new();
3080
3081 query_params.push(("email".to_string(), params.email.to_string()));
3082 query_params.push(("startTime".to_string(), params.start_time.to_string()));
3083 query_params.push(("endTime".to_string(), params.end_time.to_string()));
3084 query_params.push(("page".to_string(), params.page.to_string()));
3085 query_params.push(("limit".to_string(), params.limit.to_string()));
3086 if let Some(ref param_value) = params.transfers {
3087 query_params.push(("transfers".to_string(), param_value.to_string()));
3088 }
3089 if let Some(ref param_value) = params.transfer_function_account_type {
3090 query_params.push(("transferFunctionAccountType".to_string(), param_value.to_string()));
3091 }
3092
3093 let mut header_params = std::collections::HashMap::new();
3095
3096 if let Some(ref binance_auth) = configuration.binance_auth {
3098 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3100
3101 let body_string: Option<Vec<u8>> = None;
3103
3104 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3106 Ok(sig) => sig,
3107 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3108 };
3109
3110 query_params.push(("signature".to_string(), signature));
3112 }
3113
3114 if !query_params.is_empty() {
3116 req_builder = req_builder.query(&query_params);
3117 }
3118
3119
3120 if let Some(ref user_agent) = configuration.user_agent {
3122 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3123 }
3124
3125 for (header_name, header_value) in header_params {
3127 req_builder = req_builder.header(&header_name, &header_value);
3128 }
3129
3130
3131 let req = req_builder.build()?;
3132 let resp = configuration.client.execute(req).await?;
3133
3134 let status = resp.status();
3135 let content_type = resp
3136 .headers()
3137 .get("content-type")
3138 .and_then(|v| v.to_str().ok())
3139 .unwrap_or("application/octet-stream");
3140 let content_type = super::ContentType::from(content_type);
3141
3142 if !status.is_client_error() && !status.is_server_error() {
3143 let content = resp.text().await?;
3144 match content_type {
3145 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3146 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetManagedSubaccountQueryTransLogForTradeParentV1Resp`"))),
3147 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::GetManagedSubaccountQueryTransLogForTradeParentV1Resp`")))),
3148 }
3149 } else {
3150 let content = resp.text().await?;
3151 let entity: Option<GetManagedSubaccountQueryTransLogForTradeParentV1Error> = serde_json::from_str(&content).ok();
3152 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3153 }
3154}
3155
3156pub async fn get_managed_subaccount_query_trans_log_v1(configuration: &configuration::Configuration, params: GetManagedSubaccountQueryTransLogV1Params) -> Result<models::GetManagedSubaccountQueryTransLogV1Resp, Error<GetManagedSubaccountQueryTransLogV1Error>> {
3158
3159 let uri_str = format!("{}/sapi/v1/managed-subaccount/query-trans-log", configuration.base_path);
3160 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3161
3162 let mut query_params: Vec<(String, String)> = Vec::new();
3164
3165 query_params.push(("startTime".to_string(), params.start_time.to_string()));
3166 query_params.push(("endTime".to_string(), params.end_time.to_string()));
3167 query_params.push(("page".to_string(), params.page.to_string()));
3168 query_params.push(("limit".to_string(), params.limit.to_string()));
3169 if let Some(ref param_value) = params.transfers {
3170 query_params.push(("transfers".to_string(), param_value.to_string()));
3171 }
3172 if let Some(ref param_value) = params.transfer_function_account_type {
3173 query_params.push(("transferFunctionAccountType".to_string(), param_value.to_string()));
3174 }
3175 if let Some(ref param_value) = params.recv_window {
3176 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3177 }
3178 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3179
3180 let mut header_params = std::collections::HashMap::new();
3182
3183 if let Some(ref binance_auth) = configuration.binance_auth {
3185 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3187
3188 let body_string: Option<Vec<u8>> = None;
3190
3191 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3193 Ok(sig) => sig,
3194 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3195 };
3196
3197 query_params.push(("signature".to_string(), signature));
3199 }
3200
3201 if !query_params.is_empty() {
3203 req_builder = req_builder.query(&query_params);
3204 }
3205
3206
3207 if let Some(ref user_agent) = configuration.user_agent {
3209 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3210 }
3211
3212 for (header_name, header_value) in header_params {
3214 req_builder = req_builder.header(&header_name, &header_value);
3215 }
3216
3217
3218 let req = req_builder.build()?;
3219 let resp = configuration.client.execute(req).await?;
3220
3221 let status = resp.status();
3222 let content_type = resp
3223 .headers()
3224 .get("content-type")
3225 .and_then(|v| v.to_str().ok())
3226 .unwrap_or("application/octet-stream");
3227 let content_type = super::ContentType::from(content_type);
3228
3229 if !status.is_client_error() && !status.is_server_error() {
3230 let content = resp.text().await?;
3231 match content_type {
3232 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3233 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetManagedSubaccountQueryTransLogV1Resp`"))),
3234 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::GetManagedSubaccountQueryTransLogV1Resp`")))),
3235 }
3236 } else {
3237 let content = resp.text().await?;
3238 let entity: Option<GetManagedSubaccountQueryTransLogV1Error> = serde_json::from_str(&content).ok();
3239 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3240 }
3241}
3242
3243pub async fn get_sub_account_assets_v3(configuration: &configuration::Configuration, params: GetSubAccountAssetsV3Params) -> Result<models::GetSubAccountAssetsV3Resp, Error<GetSubAccountAssetsV3Error>> {
3245
3246 let uri_str = format!("{}/sapi/v3/sub-account/assets", configuration.base_path);
3247 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3248
3249 let mut query_params: Vec<(String, String)> = Vec::new();
3251
3252 query_params.push(("email".to_string(), params.email.to_string()));
3253 if let Some(ref param_value) = params.recv_window {
3254 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3255 }
3256 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3257
3258 let mut header_params = std::collections::HashMap::new();
3260
3261 if let Some(ref binance_auth) = configuration.binance_auth {
3263 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3265
3266 let body_string: Option<Vec<u8>> = None;
3268
3269 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3271 Ok(sig) => sig,
3272 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3273 };
3274
3275 query_params.push(("signature".to_string(), signature));
3277 }
3278
3279 if !query_params.is_empty() {
3281 req_builder = req_builder.query(&query_params);
3282 }
3283
3284
3285 if let Some(ref user_agent) = configuration.user_agent {
3287 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3288 }
3289
3290 for (header_name, header_value) in header_params {
3292 req_builder = req_builder.header(&header_name, &header_value);
3293 }
3294
3295
3296 let req = req_builder.build()?;
3297 let resp = configuration.client.execute(req).await?;
3298
3299 let status = resp.status();
3300 let content_type = resp
3301 .headers()
3302 .get("content-type")
3303 .and_then(|v| v.to_str().ok())
3304 .unwrap_or("application/octet-stream");
3305 let content_type = super::ContentType::from(content_type);
3306
3307 if !status.is_client_error() && !status.is_server_error() {
3308 let content = resp.text().await?;
3309 match content_type {
3310 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3311 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountAssetsV3Resp`"))),
3312 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::GetSubAccountAssetsV3Resp`")))),
3313 }
3314 } else {
3315 let content = resp.text().await?;
3316 let entity: Option<GetSubAccountAssetsV3Error> = serde_json::from_str(&content).ok();
3317 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3318 }
3319}
3320
3321pub async fn get_sub_account_assets_v4(configuration: &configuration::Configuration, params: GetSubAccountAssetsV4Params) -> Result<models::GetSubAccountAssetsV4Resp, Error<GetSubAccountAssetsV4Error>> {
3323
3324 let uri_str = format!("{}/sapi/v4/sub-account/assets", configuration.base_path);
3325 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3326
3327 let mut query_params: Vec<(String, String)> = Vec::new();
3329
3330 query_params.push(("email".to_string(), params.email.to_string()));
3331 if let Some(ref param_value) = params.recv_window {
3332 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3333 }
3334 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3335
3336 let mut header_params = std::collections::HashMap::new();
3338
3339 if let Some(ref binance_auth) = configuration.binance_auth {
3341 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3343
3344 let body_string: Option<Vec<u8>> = None;
3346
3347 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3349 Ok(sig) => sig,
3350 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3351 };
3352
3353 query_params.push(("signature".to_string(), signature));
3355 }
3356
3357 if !query_params.is_empty() {
3359 req_builder = req_builder.query(&query_params);
3360 }
3361
3362
3363 if let Some(ref user_agent) = configuration.user_agent {
3365 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3366 }
3367
3368 for (header_name, header_value) in header_params {
3370 req_builder = req_builder.header(&header_name, &header_value);
3371 }
3372
3373
3374 let req = req_builder.build()?;
3375 let resp = configuration.client.execute(req).await?;
3376
3377 let status = resp.status();
3378 let content_type = resp
3379 .headers()
3380 .get("content-type")
3381 .and_then(|v| v.to_str().ok())
3382 .unwrap_or("application/octet-stream");
3383 let content_type = super::ContentType::from(content_type);
3384
3385 if !status.is_client_error() && !status.is_server_error() {
3386 let content = resp.text().await?;
3387 match content_type {
3388 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3389 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountAssetsV4Resp`"))),
3390 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::GetSubAccountAssetsV4Resp`")))),
3391 }
3392 } else {
3393 let content = resp.text().await?;
3394 let entity: Option<GetSubAccountAssetsV4Error> = serde_json::from_str(&content).ok();
3395 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3396 }
3397}
3398
3399pub async fn get_sub_account_futures_account_summary_v1(configuration: &configuration::Configuration, params: GetSubAccountFuturesAccountSummaryV1Params) -> Result<models::GetSubAccountFuturesAccountSummaryV1Resp, Error<GetSubAccountFuturesAccountSummaryV1Error>> {
3401
3402 let uri_str = format!("{}/sapi/v1/sub-account/futures/accountSummary", configuration.base_path);
3403 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3404
3405 let mut query_params: Vec<(String, String)> = Vec::new();
3407
3408 if let Some(ref param_value) = params.recv_window {
3409 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3410 }
3411 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3412
3413 let mut header_params = std::collections::HashMap::new();
3415
3416 if let Some(ref binance_auth) = configuration.binance_auth {
3418 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3420
3421 let body_string: Option<Vec<u8>> = None;
3423
3424 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3426 Ok(sig) => sig,
3427 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3428 };
3429
3430 query_params.push(("signature".to_string(), signature));
3432 }
3433
3434 if !query_params.is_empty() {
3436 req_builder = req_builder.query(&query_params);
3437 }
3438
3439
3440 if let Some(ref user_agent) = configuration.user_agent {
3442 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3443 }
3444
3445 for (header_name, header_value) in header_params {
3447 req_builder = req_builder.header(&header_name, &header_value);
3448 }
3449
3450
3451 let req = req_builder.build()?;
3452 let resp = configuration.client.execute(req).await?;
3453
3454 let status = resp.status();
3455 let content_type = resp
3456 .headers()
3457 .get("content-type")
3458 .and_then(|v| v.to_str().ok())
3459 .unwrap_or("application/octet-stream");
3460 let content_type = super::ContentType::from(content_type);
3461
3462 if !status.is_client_error() && !status.is_server_error() {
3463 let content = resp.text().await?;
3464 match content_type {
3465 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3466 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountFuturesAccountSummaryV1Resp`"))),
3467 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::GetSubAccountFuturesAccountSummaryV1Resp`")))),
3468 }
3469 } else {
3470 let content = resp.text().await?;
3471 let entity: Option<GetSubAccountFuturesAccountSummaryV1Error> = serde_json::from_str(&content).ok();
3472 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3473 }
3474}
3475
3476pub async fn get_sub_account_futures_account_summary_v2(configuration: &configuration::Configuration, params: GetSubAccountFuturesAccountSummaryV2Params) -> Result<models::GetSubAccountFuturesAccountSummaryV2Resp, Error<GetSubAccountFuturesAccountSummaryV2Error>> {
3478
3479 let uri_str = format!("{}/sapi/v2/sub-account/futures/accountSummary", configuration.base_path);
3480 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3481
3482 let mut query_params: Vec<(String, String)> = Vec::new();
3484
3485 query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
3486 if let Some(ref param_value) = params.page {
3487 query_params.push(("page".to_string(), param_value.to_string()));
3488 }
3489 if let Some(ref param_value) = params.limit {
3490 query_params.push(("limit".to_string(), param_value.to_string()));
3491 }
3492 if let Some(ref param_value) = params.recv_window {
3493 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3494 }
3495 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3496
3497 let mut header_params = std::collections::HashMap::new();
3499
3500 if let Some(ref binance_auth) = configuration.binance_auth {
3502 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3504
3505 let body_string: Option<Vec<u8>> = None;
3507
3508 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3510 Ok(sig) => sig,
3511 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3512 };
3513
3514 query_params.push(("signature".to_string(), signature));
3516 }
3517
3518 if !query_params.is_empty() {
3520 req_builder = req_builder.query(&query_params);
3521 }
3522
3523
3524 if let Some(ref user_agent) = configuration.user_agent {
3526 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3527 }
3528
3529 for (header_name, header_value) in header_params {
3531 req_builder = req_builder.header(&header_name, &header_value);
3532 }
3533
3534
3535 let req = req_builder.build()?;
3536 let resp = configuration.client.execute(req).await?;
3537
3538 let status = resp.status();
3539 let content_type = resp
3540 .headers()
3541 .get("content-type")
3542 .and_then(|v| v.to_str().ok())
3543 .unwrap_or("application/octet-stream");
3544 let content_type = super::ContentType::from(content_type);
3545
3546 if !status.is_client_error() && !status.is_server_error() {
3547 let content = resp.text().await?;
3548 match content_type {
3549 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3550 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountFuturesAccountSummaryV2Resp`"))),
3551 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::GetSubAccountFuturesAccountSummaryV2Resp`")))),
3552 }
3553 } else {
3554 let content = resp.text().await?;
3555 let entity: Option<GetSubAccountFuturesAccountSummaryV2Error> = serde_json::from_str(&content).ok();
3556 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3557 }
3558}
3559
3560pub async fn get_sub_account_futures_account_v1(configuration: &configuration::Configuration, params: GetSubAccountFuturesAccountV1Params) -> Result<models::GetSubAccountFuturesAccountV1Resp, Error<GetSubAccountFuturesAccountV1Error>> {
3562
3563 let uri_str = format!("{}/sapi/v1/sub-account/futures/account", configuration.base_path);
3564 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3565
3566 let mut query_params: Vec<(String, String)> = Vec::new();
3568
3569 query_params.push(("email".to_string(), params.email.to_string()));
3570 if let Some(ref param_value) = params.recv_window {
3571 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3572 }
3573 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3574
3575 let mut header_params = std::collections::HashMap::new();
3577
3578 if let Some(ref binance_auth) = configuration.binance_auth {
3580 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3582
3583 let body_string: Option<Vec<u8>> = None;
3585
3586 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3588 Ok(sig) => sig,
3589 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3590 };
3591
3592 query_params.push(("signature".to_string(), signature));
3594 }
3595
3596 if !query_params.is_empty() {
3598 req_builder = req_builder.query(&query_params);
3599 }
3600
3601
3602 if let Some(ref user_agent) = configuration.user_agent {
3604 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3605 }
3606
3607 for (header_name, header_value) in header_params {
3609 req_builder = req_builder.header(&header_name, &header_value);
3610 }
3611
3612
3613 let req = req_builder.build()?;
3614 let resp = configuration.client.execute(req).await?;
3615
3616 let status = resp.status();
3617 let content_type = resp
3618 .headers()
3619 .get("content-type")
3620 .and_then(|v| v.to_str().ok())
3621 .unwrap_or("application/octet-stream");
3622 let content_type = super::ContentType::from(content_type);
3623
3624 if !status.is_client_error() && !status.is_server_error() {
3625 let content = resp.text().await?;
3626 match content_type {
3627 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3628 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountFuturesAccountV1Resp`"))),
3629 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::GetSubAccountFuturesAccountV1Resp`")))),
3630 }
3631 } else {
3632 let content = resp.text().await?;
3633 let entity: Option<GetSubAccountFuturesAccountV1Error> = serde_json::from_str(&content).ok();
3634 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3635 }
3636}
3637
3638pub async fn get_sub_account_futures_account_v2(configuration: &configuration::Configuration, params: GetSubAccountFuturesAccountV2Params) -> Result<models::GetSubAccountFuturesAccountV2Resp, Error<GetSubAccountFuturesAccountV2Error>> {
3640
3641 let uri_str = format!("{}/sapi/v2/sub-account/futures/account", configuration.base_path);
3642 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3643
3644 let mut query_params: Vec<(String, String)> = Vec::new();
3646
3647 query_params.push(("email".to_string(), params.email.to_string()));
3648 query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
3649 if let Some(ref param_value) = params.recv_window {
3650 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3651 }
3652 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3653
3654 let mut header_params = std::collections::HashMap::new();
3656
3657 if let Some(ref binance_auth) = configuration.binance_auth {
3659 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3661
3662 let body_string: Option<Vec<u8>> = None;
3664
3665 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3667 Ok(sig) => sig,
3668 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3669 };
3670
3671 query_params.push(("signature".to_string(), signature));
3673 }
3674
3675 if !query_params.is_empty() {
3677 req_builder = req_builder.query(&query_params);
3678 }
3679
3680
3681 if let Some(ref user_agent) = configuration.user_agent {
3683 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3684 }
3685
3686 for (header_name, header_value) in header_params {
3688 req_builder = req_builder.header(&header_name, &header_value);
3689 }
3690
3691
3692 let req = req_builder.build()?;
3693 let resp = configuration.client.execute(req).await?;
3694
3695 let status = resp.status();
3696 let content_type = resp
3697 .headers()
3698 .get("content-type")
3699 .and_then(|v| v.to_str().ok())
3700 .unwrap_or("application/octet-stream");
3701 let content_type = super::ContentType::from(content_type);
3702
3703 if !status.is_client_error() && !status.is_server_error() {
3704 let content = resp.text().await?;
3705 match content_type {
3706 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3707 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountFuturesAccountV2Resp`"))),
3708 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::GetSubAccountFuturesAccountV2Resp`")))),
3709 }
3710 } else {
3711 let content = resp.text().await?;
3712 let entity: Option<GetSubAccountFuturesAccountV2Error> = serde_json::from_str(&content).ok();
3713 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3714 }
3715}
3716
3717pub async fn get_sub_account_futures_internal_transfer_v1(configuration: &configuration::Configuration, params: GetSubAccountFuturesInternalTransferV1Params) -> Result<models::GetSubAccountFuturesInternalTransferV1Resp, Error<GetSubAccountFuturesInternalTransferV1Error>> {
3719
3720 let uri_str = format!("{}/sapi/v1/sub-account/futures/internalTransfer", configuration.base_path);
3721 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3722
3723 let mut query_params: Vec<(String, String)> = Vec::new();
3725
3726 query_params.push(("email".to_string(), params.email.to_string()));
3727 query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
3728 if let Some(ref param_value) = params.start_time {
3729 query_params.push(("startTime".to_string(), param_value.to_string()));
3730 }
3731 if let Some(ref param_value) = params.end_time {
3732 query_params.push(("endTime".to_string(), param_value.to_string()));
3733 }
3734 if let Some(ref param_value) = params.page {
3735 query_params.push(("page".to_string(), param_value.to_string()));
3736 }
3737 if let Some(ref param_value) = params.limit {
3738 query_params.push(("limit".to_string(), param_value.to_string()));
3739 }
3740 if let Some(ref param_value) = params.recv_window {
3741 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3742 }
3743 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3744
3745 let mut header_params = std::collections::HashMap::new();
3747
3748 if let Some(ref binance_auth) = configuration.binance_auth {
3750 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3752
3753 let body_string: Option<Vec<u8>> = None;
3755
3756 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3758 Ok(sig) => sig,
3759 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3760 };
3761
3762 query_params.push(("signature".to_string(), signature));
3764 }
3765
3766 if !query_params.is_empty() {
3768 req_builder = req_builder.query(&query_params);
3769 }
3770
3771
3772 if let Some(ref user_agent) = configuration.user_agent {
3774 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3775 }
3776
3777 for (header_name, header_value) in header_params {
3779 req_builder = req_builder.header(&header_name, &header_value);
3780 }
3781
3782
3783 let req = req_builder.build()?;
3784 let resp = configuration.client.execute(req).await?;
3785
3786 let status = resp.status();
3787 let content_type = resp
3788 .headers()
3789 .get("content-type")
3790 .and_then(|v| v.to_str().ok())
3791 .unwrap_or("application/octet-stream");
3792 let content_type = super::ContentType::from(content_type);
3793
3794 if !status.is_client_error() && !status.is_server_error() {
3795 let content = resp.text().await?;
3796 match content_type {
3797 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3798 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountFuturesInternalTransferV1Resp`"))),
3799 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::GetSubAccountFuturesInternalTransferV1Resp`")))),
3800 }
3801 } else {
3802 let content = resp.text().await?;
3803 let entity: Option<GetSubAccountFuturesInternalTransferV1Error> = serde_json::from_str(&content).ok();
3804 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3805 }
3806}
3807
3808pub async fn get_sub_account_futures_move_position_v1(configuration: &configuration::Configuration, params: GetSubAccountFuturesMovePositionV1Params) -> Result<models::GetSubAccountFuturesMovePositionV1Resp, Error<GetSubAccountFuturesMovePositionV1Error>> {
3810
3811 let uri_str = format!("{}/sapi/v1/sub-account/futures/move-position", configuration.base_path);
3812 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3813
3814 let mut query_params: Vec<(String, String)> = Vec::new();
3816
3817 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3818 if let Some(ref param_value) = params.start_time {
3819 query_params.push(("startTime".to_string(), param_value.to_string()));
3820 }
3821 if let Some(ref param_value) = params.end_time {
3822 query_params.push(("endTime".to_string(), param_value.to_string()));
3823 }
3824 query_params.push(("page".to_string(), params.page.to_string()));
3825 query_params.push(("row".to_string(), params.row.to_string()));
3826 if let Some(ref param_value) = params.recv_window {
3827 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3828 }
3829 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3830
3831 let mut header_params = std::collections::HashMap::new();
3833
3834 if let Some(ref binance_auth) = configuration.binance_auth {
3836 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3838
3839 let body_string: Option<Vec<u8>> = None;
3841
3842 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3844 Ok(sig) => sig,
3845 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3846 };
3847
3848 query_params.push(("signature".to_string(), signature));
3850 }
3851
3852 if !query_params.is_empty() {
3854 req_builder = req_builder.query(&query_params);
3855 }
3856
3857
3858 if let Some(ref user_agent) = configuration.user_agent {
3860 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3861 }
3862
3863 for (header_name, header_value) in header_params {
3865 req_builder = req_builder.header(&header_name, &header_value);
3866 }
3867
3868
3869 let req = req_builder.build()?;
3870 let resp = configuration.client.execute(req).await?;
3871
3872 let status = resp.status();
3873 let content_type = resp
3874 .headers()
3875 .get("content-type")
3876 .and_then(|v| v.to_str().ok())
3877 .unwrap_or("application/octet-stream");
3878 let content_type = super::ContentType::from(content_type);
3879
3880 if !status.is_client_error() && !status.is_server_error() {
3881 let content = resp.text().await?;
3882 match content_type {
3883 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3884 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountFuturesMovePositionV1Resp`"))),
3885 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::GetSubAccountFuturesMovePositionV1Resp`")))),
3886 }
3887 } else {
3888 let content = resp.text().await?;
3889 let entity: Option<GetSubAccountFuturesMovePositionV1Error> = serde_json::from_str(&content).ok();
3890 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3891 }
3892}
3893
3894pub async fn get_sub_account_futures_position_risk_v1(configuration: &configuration::Configuration, params: GetSubAccountFuturesPositionRiskV1Params) -> Result<Vec<models::GetSubAccountFuturesPositionRiskV1RespItem>, Error<GetSubAccountFuturesPositionRiskV1Error>> {
3896
3897 let uri_str = format!("{}/sapi/v1/sub-account/futures/positionRisk", configuration.base_path);
3898 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3899
3900 let mut query_params: Vec<(String, String)> = Vec::new();
3902
3903 query_params.push(("email".to_string(), params.email.to_string()));
3904 if let Some(ref param_value) = params.recv_window {
3905 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3906 }
3907 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3908
3909 let mut header_params = std::collections::HashMap::new();
3911
3912 if let Some(ref binance_auth) = configuration.binance_auth {
3914 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3916
3917 let body_string: Option<Vec<u8>> = None;
3919
3920 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3922 Ok(sig) => sig,
3923 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3924 };
3925
3926 query_params.push(("signature".to_string(), signature));
3928 }
3929
3930 if !query_params.is_empty() {
3932 req_builder = req_builder.query(&query_params);
3933 }
3934
3935
3936 if let Some(ref user_agent) = configuration.user_agent {
3938 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3939 }
3940
3941 for (header_name, header_value) in header_params {
3943 req_builder = req_builder.header(&header_name, &header_value);
3944 }
3945
3946
3947 let req = req_builder.build()?;
3948 let resp = configuration.client.execute(req).await?;
3949
3950 let status = resp.status();
3951 let content_type = resp
3952 .headers()
3953 .get("content-type")
3954 .and_then(|v| v.to_str().ok())
3955 .unwrap_or("application/octet-stream");
3956 let content_type = super::ContentType::from(content_type);
3957
3958 if !status.is_client_error() && !status.is_server_error() {
3959 let content = resp.text().await?;
3960 match content_type {
3961 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3962 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetSubAccountFuturesPositionRiskV1RespItem>`"))),
3963 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::GetSubAccountFuturesPositionRiskV1RespItem>`")))),
3964 }
3965 } else {
3966 let content = resp.text().await?;
3967 let entity: Option<GetSubAccountFuturesPositionRiskV1Error> = serde_json::from_str(&content).ok();
3968 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3969 }
3970}
3971
3972pub async fn get_sub_account_futures_position_risk_v2(configuration: &configuration::Configuration, params: GetSubAccountFuturesPositionRiskV2Params) -> Result<models::GetSubAccountFuturesPositionRiskV2Resp, Error<GetSubAccountFuturesPositionRiskV2Error>> {
3974
3975 let uri_str = format!("{}/sapi/v2/sub-account/futures/positionRisk", configuration.base_path);
3976 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3977
3978 let mut query_params: Vec<(String, String)> = Vec::new();
3980
3981 query_params.push(("email".to_string(), params.email.to_string()));
3982 query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
3983 if let Some(ref param_value) = params.recv_window {
3984 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3985 }
3986 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3987
3988 let mut header_params = std::collections::HashMap::new();
3990
3991 if let Some(ref binance_auth) = configuration.binance_auth {
3993 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3995
3996 let body_string: Option<Vec<u8>> = None;
3998
3999 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4001 Ok(sig) => sig,
4002 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4003 };
4004
4005 query_params.push(("signature".to_string(), signature));
4007 }
4008
4009 if !query_params.is_empty() {
4011 req_builder = req_builder.query(&query_params);
4012 }
4013
4014
4015 if let Some(ref user_agent) = configuration.user_agent {
4017 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4018 }
4019
4020 for (header_name, header_value) in header_params {
4022 req_builder = req_builder.header(&header_name, &header_value);
4023 }
4024
4025
4026 let req = req_builder.build()?;
4027 let resp = configuration.client.execute(req).await?;
4028
4029 let status = resp.status();
4030 let content_type = resp
4031 .headers()
4032 .get("content-type")
4033 .and_then(|v| v.to_str().ok())
4034 .unwrap_or("application/octet-stream");
4035 let content_type = super::ContentType::from(content_type);
4036
4037 if !status.is_client_error() && !status.is_server_error() {
4038 let content = resp.text().await?;
4039 match content_type {
4040 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4041 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountFuturesPositionRiskV2Resp`"))),
4042 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::GetSubAccountFuturesPositionRiskV2Resp`")))),
4043 }
4044 } else {
4045 let content = resp.text().await?;
4046 let entity: Option<GetSubAccountFuturesPositionRiskV2Error> = serde_json::from_str(&content).ok();
4047 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4048 }
4049}
4050
4051pub async fn get_sub_account_list_v1(configuration: &configuration::Configuration, params: GetSubAccountListV1Params) -> Result<models::GetSubAccountListV1Resp, Error<GetSubAccountListV1Error>> {
4053
4054 let uri_str = format!("{}/sapi/v1/sub-account/list", configuration.base_path);
4055 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4056
4057 let mut query_params: Vec<(String, String)> = Vec::new();
4059
4060 if let Some(ref param_value) = params.email {
4061 query_params.push(("email".to_string(), param_value.to_string()));
4062 }
4063 if let Some(ref param_value) = params.is_freeze {
4064 query_params.push(("isFreeze".to_string(), param_value.to_string()));
4065 }
4066 if let Some(ref param_value) = params.page {
4067 query_params.push(("page".to_string(), param_value.to_string()));
4068 }
4069 if let Some(ref param_value) = params.limit {
4070 query_params.push(("limit".to_string(), param_value.to_string()));
4071 }
4072 if let Some(ref param_value) = params.recv_window {
4073 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4074 }
4075 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4076
4077 let mut header_params = std::collections::HashMap::new();
4079
4080 if let Some(ref binance_auth) = configuration.binance_auth {
4082 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4084
4085 let body_string: Option<Vec<u8>> = None;
4087
4088 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4090 Ok(sig) => sig,
4091 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4092 };
4093
4094 query_params.push(("signature".to_string(), signature));
4096 }
4097
4098 if !query_params.is_empty() {
4100 req_builder = req_builder.query(&query_params);
4101 }
4102
4103
4104 if let Some(ref user_agent) = configuration.user_agent {
4106 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4107 }
4108
4109 for (header_name, header_value) in header_params {
4111 req_builder = req_builder.header(&header_name, &header_value);
4112 }
4113
4114
4115 let req = req_builder.build()?;
4116 let resp = configuration.client.execute(req).await?;
4117
4118 let status = resp.status();
4119 let content_type = resp
4120 .headers()
4121 .get("content-type")
4122 .and_then(|v| v.to_str().ok())
4123 .unwrap_or("application/octet-stream");
4124 let content_type = super::ContentType::from(content_type);
4125
4126 if !status.is_client_error() && !status.is_server_error() {
4127 let content = resp.text().await?;
4128 match content_type {
4129 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4130 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountListV1Resp`"))),
4131 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::GetSubAccountListV1Resp`")))),
4132 }
4133 } else {
4134 let content = resp.text().await?;
4135 let entity: Option<GetSubAccountListV1Error> = serde_json::from_str(&content).ok();
4136 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4137 }
4138}
4139
4140pub async fn get_sub_account_margin_account_summary_v1(configuration: &configuration::Configuration, params: GetSubAccountMarginAccountSummaryV1Params) -> Result<models::GetSubAccountMarginAccountSummaryV1Resp, Error<GetSubAccountMarginAccountSummaryV1Error>> {
4142
4143 let uri_str = format!("{}/sapi/v1/sub-account/margin/accountSummary", configuration.base_path);
4144 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4145
4146 let mut query_params: Vec<(String, String)> = Vec::new();
4148
4149 if let Some(ref param_value) = params.recv_window {
4150 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4151 }
4152 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4153
4154 let mut header_params = std::collections::HashMap::new();
4156
4157 if let Some(ref binance_auth) = configuration.binance_auth {
4159 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4161
4162 let body_string: Option<Vec<u8>> = None;
4164
4165 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4167 Ok(sig) => sig,
4168 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4169 };
4170
4171 query_params.push(("signature".to_string(), signature));
4173 }
4174
4175 if !query_params.is_empty() {
4177 req_builder = req_builder.query(&query_params);
4178 }
4179
4180
4181 if let Some(ref user_agent) = configuration.user_agent {
4183 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4184 }
4185
4186 for (header_name, header_value) in header_params {
4188 req_builder = req_builder.header(&header_name, &header_value);
4189 }
4190
4191
4192 let req = req_builder.build()?;
4193 let resp = configuration.client.execute(req).await?;
4194
4195 let status = resp.status();
4196 let content_type = resp
4197 .headers()
4198 .get("content-type")
4199 .and_then(|v| v.to_str().ok())
4200 .unwrap_or("application/octet-stream");
4201 let content_type = super::ContentType::from(content_type);
4202
4203 if !status.is_client_error() && !status.is_server_error() {
4204 let content = resp.text().await?;
4205 match content_type {
4206 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4207 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountMarginAccountSummaryV1Resp`"))),
4208 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::GetSubAccountMarginAccountSummaryV1Resp`")))),
4209 }
4210 } else {
4211 let content = resp.text().await?;
4212 let entity: Option<GetSubAccountMarginAccountSummaryV1Error> = serde_json::from_str(&content).ok();
4213 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4214 }
4215}
4216
4217pub async fn get_sub_account_margin_account_v1(configuration: &configuration::Configuration, params: GetSubAccountMarginAccountV1Params) -> Result<models::GetSubAccountMarginAccountV1Resp, Error<GetSubAccountMarginAccountV1Error>> {
4219
4220 let uri_str = format!("{}/sapi/v1/sub-account/margin/account", configuration.base_path);
4221 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4222
4223 let mut query_params: Vec<(String, String)> = Vec::new();
4225
4226 query_params.push(("email".to_string(), params.email.to_string()));
4227 if let Some(ref param_value) = params.recv_window {
4228 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4229 }
4230 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4231
4232 let mut header_params = std::collections::HashMap::new();
4234
4235 if let Some(ref binance_auth) = configuration.binance_auth {
4237 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4239
4240 let body_string: Option<Vec<u8>> = None;
4242
4243 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4245 Ok(sig) => sig,
4246 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4247 };
4248
4249 query_params.push(("signature".to_string(), signature));
4251 }
4252
4253 if !query_params.is_empty() {
4255 req_builder = req_builder.query(&query_params);
4256 }
4257
4258
4259 if let Some(ref user_agent) = configuration.user_agent {
4261 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4262 }
4263
4264 for (header_name, header_value) in header_params {
4266 req_builder = req_builder.header(&header_name, &header_value);
4267 }
4268
4269
4270 let req = req_builder.build()?;
4271 let resp = configuration.client.execute(req).await?;
4272
4273 let status = resp.status();
4274 let content_type = resp
4275 .headers()
4276 .get("content-type")
4277 .and_then(|v| v.to_str().ok())
4278 .unwrap_or("application/octet-stream");
4279 let content_type = super::ContentType::from(content_type);
4280
4281 if !status.is_client_error() && !status.is_server_error() {
4282 let content = resp.text().await?;
4283 match content_type {
4284 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4285 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountMarginAccountV1Resp`"))),
4286 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::GetSubAccountMarginAccountV1Resp`")))),
4287 }
4288 } else {
4289 let content = resp.text().await?;
4290 let entity: Option<GetSubAccountMarginAccountV1Error> = serde_json::from_str(&content).ok();
4291 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4292 }
4293}
4294
4295pub async fn get_sub_account_spot_summary_v1(configuration: &configuration::Configuration, params: GetSubAccountSpotSummaryV1Params) -> Result<models::GetSubAccountSpotSummaryV1Resp, Error<GetSubAccountSpotSummaryV1Error>> {
4297
4298 let uri_str = format!("{}/sapi/v1/sub-account/spotSummary", configuration.base_path);
4299 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4300
4301 let mut query_params: Vec<(String, String)> = Vec::new();
4303
4304 if let Some(ref param_value) = params.email {
4305 query_params.push(("email".to_string(), param_value.to_string()));
4306 }
4307 if let Some(ref param_value) = params.page {
4308 query_params.push(("page".to_string(), param_value.to_string()));
4309 }
4310 if let Some(ref param_value) = params.size {
4311 query_params.push(("size".to_string(), param_value.to_string()));
4312 }
4313 if let Some(ref param_value) = params.recv_window {
4314 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4315 }
4316 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4317
4318 let mut header_params = std::collections::HashMap::new();
4320
4321 if let Some(ref binance_auth) = configuration.binance_auth {
4323 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4325
4326 let body_string: Option<Vec<u8>> = None;
4328
4329 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4331 Ok(sig) => sig,
4332 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4333 };
4334
4335 query_params.push(("signature".to_string(), signature));
4337 }
4338
4339 if !query_params.is_empty() {
4341 req_builder = req_builder.query(&query_params);
4342 }
4343
4344
4345 if let Some(ref user_agent) = configuration.user_agent {
4347 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4348 }
4349
4350 for (header_name, header_value) in header_params {
4352 req_builder = req_builder.header(&header_name, &header_value);
4353 }
4354
4355
4356 let req = req_builder.build()?;
4357 let resp = configuration.client.execute(req).await?;
4358
4359 let status = resp.status();
4360 let content_type = resp
4361 .headers()
4362 .get("content-type")
4363 .and_then(|v| v.to_str().ok())
4364 .unwrap_or("application/octet-stream");
4365 let content_type = super::ContentType::from(content_type);
4366
4367 if !status.is_client_error() && !status.is_server_error() {
4368 let content = resp.text().await?;
4369 match content_type {
4370 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4371 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountSpotSummaryV1Resp`"))),
4372 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::GetSubAccountSpotSummaryV1Resp`")))),
4373 }
4374 } else {
4375 let content = resp.text().await?;
4376 let entity: Option<GetSubAccountSpotSummaryV1Error> = serde_json::from_str(&content).ok();
4377 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4378 }
4379}
4380
4381pub async fn get_sub_account_status_v1(configuration: &configuration::Configuration, params: GetSubAccountStatusV1Params) -> Result<Vec<models::GetSubAccountStatusV1RespItem>, Error<GetSubAccountStatusV1Error>> {
4383
4384 let uri_str = format!("{}/sapi/v1/sub-account/status", configuration.base_path);
4385 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4386
4387 let mut query_params: Vec<(String, String)> = Vec::new();
4389
4390 if let Some(ref param_value) = params.email {
4391 query_params.push(("email".to_string(), param_value.to_string()));
4392 }
4393 if let Some(ref param_value) = params.recv_window {
4394 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4395 }
4396 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4397
4398 let mut header_params = std::collections::HashMap::new();
4400
4401 if let Some(ref binance_auth) = configuration.binance_auth {
4403 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4405
4406 let body_string: Option<Vec<u8>> = None;
4408
4409 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4411 Ok(sig) => sig,
4412 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4413 };
4414
4415 query_params.push(("signature".to_string(), signature));
4417 }
4418
4419 if !query_params.is_empty() {
4421 req_builder = req_builder.query(&query_params);
4422 }
4423
4424
4425 if let Some(ref user_agent) = configuration.user_agent {
4427 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4428 }
4429
4430 for (header_name, header_value) in header_params {
4432 req_builder = req_builder.header(&header_name, &header_value);
4433 }
4434
4435
4436 let req = req_builder.build()?;
4437 let resp = configuration.client.execute(req).await?;
4438
4439 let status = resp.status();
4440 let content_type = resp
4441 .headers()
4442 .get("content-type")
4443 .and_then(|v| v.to_str().ok())
4444 .unwrap_or("application/octet-stream");
4445 let content_type = super::ContentType::from(content_type);
4446
4447 if !status.is_client_error() && !status.is_server_error() {
4448 let content = resp.text().await?;
4449 match content_type {
4450 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4451 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetSubAccountStatusV1RespItem>`"))),
4452 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::GetSubAccountStatusV1RespItem>`")))),
4453 }
4454 } else {
4455 let content = resp.text().await?;
4456 let entity: Option<GetSubAccountStatusV1Error> = serde_json::from_str(&content).ok();
4457 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4458 }
4459}
4460
4461pub async fn get_sub_account_sub_account_api_ip_restriction_v1(configuration: &configuration::Configuration, params: GetSubAccountSubAccountApiIpRestrictionV1Params) -> Result<models::GetSubAccountSubAccountApiIpRestrictionV1Resp, Error<GetSubAccountSubAccountApiIpRestrictionV1Error>> {
4463
4464 let uri_str = format!("{}/sapi/v1/sub-account/subAccountApi/ipRestriction", configuration.base_path);
4465 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4466
4467 let mut query_params: Vec<(String, String)> = Vec::new();
4469
4470 query_params.push(("email".to_string(), params.email.to_string()));
4471 query_params.push(("subAccountApiKey".to_string(), params.sub_account_api_key.to_string()));
4472 if let Some(ref param_value) = params.recv_window {
4473 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4474 }
4475 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4476
4477 let mut header_params = std::collections::HashMap::new();
4479
4480 if let Some(ref binance_auth) = configuration.binance_auth {
4482 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4484
4485 let body_string: Option<Vec<u8>> = None;
4487
4488 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4490 Ok(sig) => sig,
4491 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4492 };
4493
4494 query_params.push(("signature".to_string(), signature));
4496 }
4497
4498 if !query_params.is_empty() {
4500 req_builder = req_builder.query(&query_params);
4501 }
4502
4503
4504 if let Some(ref user_agent) = configuration.user_agent {
4506 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4507 }
4508
4509 for (header_name, header_value) in header_params {
4511 req_builder = req_builder.header(&header_name, &header_value);
4512 }
4513
4514
4515 let req = req_builder.build()?;
4516 let resp = configuration.client.execute(req).await?;
4517
4518 let status = resp.status();
4519 let content_type = resp
4520 .headers()
4521 .get("content-type")
4522 .and_then(|v| v.to_str().ok())
4523 .unwrap_or("application/octet-stream");
4524 let content_type = super::ContentType::from(content_type);
4525
4526 if !status.is_client_error() && !status.is_server_error() {
4527 let content = resp.text().await?;
4528 match content_type {
4529 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4530 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountSubAccountApiIpRestrictionV1Resp`"))),
4531 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::GetSubAccountSubAccountApiIpRestrictionV1Resp`")))),
4532 }
4533 } else {
4534 let content = resp.text().await?;
4535 let entity: Option<GetSubAccountSubAccountApiIpRestrictionV1Error> = serde_json::from_str(&content).ok();
4536 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4537 }
4538}
4539
4540pub async fn get_sub_account_sub_transfer_history_v1(configuration: &configuration::Configuration, params: GetSubAccountSubTransferHistoryV1Params) -> Result<Vec<models::GetSubAccountSubTransferHistoryV1RespItem>, Error<GetSubAccountSubTransferHistoryV1Error>> {
4542
4543 let uri_str = format!("{}/sapi/v1/sub-account/sub/transfer/history", configuration.base_path);
4544 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4545
4546 let mut query_params: Vec<(String, String)> = Vec::new();
4548
4549 if let Some(ref param_value) = params.from_email {
4550 query_params.push(("fromEmail".to_string(), param_value.to_string()));
4551 }
4552 if let Some(ref param_value) = params.to_email {
4553 query_params.push(("toEmail".to_string(), param_value.to_string()));
4554 }
4555 if let Some(ref param_value) = params.start_time {
4556 query_params.push(("startTime".to_string(), param_value.to_string()));
4557 }
4558 if let Some(ref param_value) = params.end_time {
4559 query_params.push(("endTime".to_string(), param_value.to_string()));
4560 }
4561 if let Some(ref param_value) = params.page {
4562 query_params.push(("page".to_string(), param_value.to_string()));
4563 }
4564 if let Some(ref param_value) = params.limit {
4565 query_params.push(("limit".to_string(), param_value.to_string()));
4566 }
4567 if let Some(ref param_value) = params.recv_window {
4568 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4569 }
4570 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4571
4572 let mut header_params = std::collections::HashMap::new();
4574
4575 if let Some(ref binance_auth) = configuration.binance_auth {
4577 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4579
4580 let body_string: Option<Vec<u8>> = None;
4582
4583 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4585 Ok(sig) => sig,
4586 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4587 };
4588
4589 query_params.push(("signature".to_string(), signature));
4591 }
4592
4593 if !query_params.is_empty() {
4595 req_builder = req_builder.query(&query_params);
4596 }
4597
4598
4599 if let Some(ref user_agent) = configuration.user_agent {
4601 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4602 }
4603
4604 for (header_name, header_value) in header_params {
4606 req_builder = req_builder.header(&header_name, &header_value);
4607 }
4608
4609
4610 let req = req_builder.build()?;
4611 let resp = configuration.client.execute(req).await?;
4612
4613 let status = resp.status();
4614 let content_type = resp
4615 .headers()
4616 .get("content-type")
4617 .and_then(|v| v.to_str().ok())
4618 .unwrap_or("application/octet-stream");
4619 let content_type = super::ContentType::from(content_type);
4620
4621 if !status.is_client_error() && !status.is_server_error() {
4622 let content = resp.text().await?;
4623 match content_type {
4624 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4625 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetSubAccountSubTransferHistoryV1RespItem>`"))),
4626 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::GetSubAccountSubTransferHistoryV1RespItem>`")))),
4627 }
4628 } else {
4629 let content = resp.text().await?;
4630 let entity: Option<GetSubAccountSubTransferHistoryV1Error> = serde_json::from_str(&content).ok();
4631 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4632 }
4633}
4634
4635pub async fn get_sub_account_transaction_statistics_v1(configuration: &configuration::Configuration, params: GetSubAccountTransactionStatisticsV1Params) -> Result<models::SubaccountGetSubAccountTransactionStatisticsV1Resp, Error<GetSubAccountTransactionStatisticsV1Error>> {
4637
4638 let uri_str = format!("{}/sapi/v1/sub-account/transaction-statistics", configuration.base_path);
4639 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4640
4641 let mut query_params: Vec<(String, String)> = Vec::new();
4643
4644 query_params.push(("email".to_string(), params.email.to_string()));
4645 if let Some(ref param_value) = params.recv_window {
4646 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4647 }
4648 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4649
4650 let mut header_params = std::collections::HashMap::new();
4652
4653 if let Some(ref binance_auth) = configuration.binance_auth {
4655 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4657
4658 let body_string: Option<Vec<u8>> = None;
4660
4661 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4663 Ok(sig) => sig,
4664 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4665 };
4666
4667 query_params.push(("signature".to_string(), signature));
4669 }
4670
4671 if !query_params.is_empty() {
4673 req_builder = req_builder.query(&query_params);
4674 }
4675
4676
4677 if let Some(ref user_agent) = configuration.user_agent {
4679 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4680 }
4681
4682 for (header_name, header_value) in header_params {
4684 req_builder = req_builder.header(&header_name, &header_value);
4685 }
4686
4687
4688 let req = req_builder.build()?;
4689 let resp = configuration.client.execute(req).await?;
4690
4691 let status = resp.status();
4692 let content_type = resp
4693 .headers()
4694 .get("content-type")
4695 .and_then(|v| v.to_str().ok())
4696 .unwrap_or("application/octet-stream");
4697 let content_type = super::ContentType::from(content_type);
4698
4699 if !status.is_client_error() && !status.is_server_error() {
4700 let content = resp.text().await?;
4701 match content_type {
4702 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4703 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SubaccountGetSubAccountTransactionStatisticsV1Resp`"))),
4704 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::SubaccountGetSubAccountTransactionStatisticsV1Resp`")))),
4705 }
4706 } else {
4707 let content = resp.text().await?;
4708 let entity: Option<GetSubAccountTransactionStatisticsV1Error> = serde_json::from_str(&content).ok();
4709 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4710 }
4711}
4712
4713pub async fn get_sub_account_transfer_sub_user_history_v1(configuration: &configuration::Configuration, params: GetSubAccountTransferSubUserHistoryV1Params) -> Result<Vec<models::GetSubAccountTransferSubUserHistoryV1RespItem>, Error<GetSubAccountTransferSubUserHistoryV1Error>> {
4715
4716 let uri_str = format!("{}/sapi/v1/sub-account/transfer/subUserHistory", configuration.base_path);
4717 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4718
4719 let mut query_params: Vec<(String, String)> = Vec::new();
4721
4722 if let Some(ref param_value) = params.asset {
4723 query_params.push(("asset".to_string(), param_value.to_string()));
4724 }
4725 if let Some(ref param_value) = params.r#type {
4726 query_params.push(("type".to_string(), param_value.to_string()));
4727 }
4728 if let Some(ref param_value) = params.start_time {
4729 query_params.push(("startTime".to_string(), param_value.to_string()));
4730 }
4731 if let Some(ref param_value) = params.end_time {
4732 query_params.push(("endTime".to_string(), param_value.to_string()));
4733 }
4734 if let Some(ref param_value) = params.limit {
4735 query_params.push(("limit".to_string(), param_value.to_string()));
4736 }
4737 if let Some(ref param_value) = params.return_fail_history {
4738 query_params.push(("returnFailHistory".to_string(), param_value.to_string()));
4739 }
4740 if let Some(ref param_value) = params.recv_window {
4741 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4742 }
4743 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4744
4745 let mut header_params = std::collections::HashMap::new();
4747
4748 if let Some(ref binance_auth) = configuration.binance_auth {
4750 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4752
4753 let body_string: Option<Vec<u8>> = None;
4755
4756 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4758 Ok(sig) => sig,
4759 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4760 };
4761
4762 query_params.push(("signature".to_string(), signature));
4764 }
4765
4766 if !query_params.is_empty() {
4768 req_builder = req_builder.query(&query_params);
4769 }
4770
4771
4772 if let Some(ref user_agent) = configuration.user_agent {
4774 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4775 }
4776
4777 for (header_name, header_value) in header_params {
4779 req_builder = req_builder.header(&header_name, &header_value);
4780 }
4781
4782
4783 let req = req_builder.build()?;
4784 let resp = configuration.client.execute(req).await?;
4785
4786 let status = resp.status();
4787 let content_type = resp
4788 .headers()
4789 .get("content-type")
4790 .and_then(|v| v.to_str().ok())
4791 .unwrap_or("application/octet-stream");
4792 let content_type = super::ContentType::from(content_type);
4793
4794 if !status.is_client_error() && !status.is_server_error() {
4795 let content = resp.text().await?;
4796 match content_type {
4797 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4798 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetSubAccountTransferSubUserHistoryV1RespItem>`"))),
4799 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::GetSubAccountTransferSubUserHistoryV1RespItem>`")))),
4800 }
4801 } else {
4802 let content = resp.text().await?;
4803 let entity: Option<GetSubAccountTransferSubUserHistoryV1Error> = serde_json::from_str(&content).ok();
4804 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4805 }
4806}
4807
4808pub async fn get_sub_account_universal_transfer_v1(configuration: &configuration::Configuration, params: GetSubAccountUniversalTransferV1Params) -> Result<models::GetSubAccountUniversalTransferV1Resp, Error<GetSubAccountUniversalTransferV1Error>> {
4810
4811 let uri_str = format!("{}/sapi/v1/sub-account/universalTransfer", configuration.base_path);
4812 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4813
4814 let mut query_params: Vec<(String, String)> = Vec::new();
4816
4817 if let Some(ref param_value) = params.from_email {
4818 query_params.push(("fromEmail".to_string(), param_value.to_string()));
4819 }
4820 if let Some(ref param_value) = params.to_email {
4821 query_params.push(("toEmail".to_string(), param_value.to_string()));
4822 }
4823 if let Some(ref param_value) = params.client_tran_id {
4824 query_params.push(("clientTranId".to_string(), param_value.to_string()));
4825 }
4826 if let Some(ref param_value) = params.start_time {
4827 query_params.push(("startTime".to_string(), param_value.to_string()));
4828 }
4829 if let Some(ref param_value) = params.end_time {
4830 query_params.push(("endTime".to_string(), param_value.to_string()));
4831 }
4832 if let Some(ref param_value) = params.page {
4833 query_params.push(("page".to_string(), param_value.to_string()));
4834 }
4835 if let Some(ref param_value) = params.limit {
4836 query_params.push(("limit".to_string(), param_value.to_string()));
4837 }
4838 if let Some(ref param_value) = params.recv_window {
4839 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4840 }
4841 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4842
4843 let mut header_params = std::collections::HashMap::new();
4845
4846 if let Some(ref binance_auth) = configuration.binance_auth {
4848 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4850
4851 let body_string: Option<Vec<u8>> = None;
4853
4854 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4856 Ok(sig) => sig,
4857 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4858 };
4859
4860 query_params.push(("signature".to_string(), signature));
4862 }
4863
4864 if !query_params.is_empty() {
4866 req_builder = req_builder.query(&query_params);
4867 }
4868
4869
4870 if let Some(ref user_agent) = configuration.user_agent {
4872 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4873 }
4874
4875 for (header_name, header_value) in header_params {
4877 req_builder = req_builder.header(&header_name, &header_value);
4878 }
4879
4880
4881 let req = req_builder.build()?;
4882 let resp = configuration.client.execute(req).await?;
4883
4884 let status = resp.status();
4885 let content_type = resp
4886 .headers()
4887 .get("content-type")
4888 .and_then(|v| v.to_str().ok())
4889 .unwrap_or("application/octet-stream");
4890 let content_type = super::ContentType::from(content_type);
4891
4892 if !status.is_client_error() && !status.is_server_error() {
4893 let content = resp.text().await?;
4894 match content_type {
4895 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4896 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSubAccountUniversalTransferV1Resp`"))),
4897 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::GetSubAccountUniversalTransferV1Resp`")))),
4898 }
4899 } else {
4900 let content = resp.text().await?;
4901 let entity: Option<GetSubAccountUniversalTransferV1Error> = serde_json::from_str(&content).ok();
4902 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4903 }
4904}
4905