1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::pmargin::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug, Default)]
19pub struct CreateAssetCollectionV1Params {
20 pub asset: String,
21 pub timestamp: i64,
22 pub recv_window: Option<i64>
23}
24
25#[derive(Clone, Debug, Default)]
27pub struct CreateAutoCollectionV1Params {
28 pub timestamp: i64,
29 pub recv_window: Option<i64>
30}
31
32#[derive(Clone, Debug, Default)]
34pub struct CreateBnbTransferV1Params {
35 pub amount: String,
36 pub timestamp: i64,
37 pub transfer_side: String,
38 pub recv_window: Option<i64>
39}
40
41#[derive(Clone, Debug, Default)]
43pub struct CreateCmConditionalOrderV1Params {
44 pub side: String,
45 pub strategy_type: String,
46 pub symbol: String,
47 pub timestamp: i64,
48 pub activation_price: Option<String>,
49 pub callback_rate: Option<String>,
50 pub new_client_strategy_id: Option<String>,
51 pub position_side: Option<String>,
52 pub price: Option<String>,
53 pub price_protect: Option<String>,
54 pub quantity: Option<String>,
55 pub recv_window: Option<i64>,
56 pub reduce_only: Option<String>,
57 pub stop_price: Option<String>,
58 pub time_in_force: Option<String>,
59 pub working_type: Option<String>
60}
61
62#[derive(Clone, Debug, Default)]
64pub struct CreateCmLeverageV1Params {
65 pub leverage: i32,
66 pub symbol: String,
67 pub timestamp: i64,
68 pub recv_window: Option<i64>
69}
70
71#[derive(Clone, Debug, Default)]
73pub struct CreateCmOrderV1Params {
74 pub side: String,
75 pub symbol: String,
76 pub timestamp: i64,
77 pub r#type: String,
78 pub new_client_order_id: Option<String>,
79 pub new_order_resp_type: Option<String>,
80 pub position_side: Option<String>,
81 pub price: Option<String>,
82 pub price_match: Option<String>,
83 pub quantity: Option<String>,
84 pub recv_window: Option<i64>,
85 pub reduce_only: Option<String>,
86 pub time_in_force: Option<String>
87}
88
89#[derive(Clone, Debug, Default)]
91pub struct CreateCmPositionSideDualV1Params {
92 pub dual_side_position: String,
93 pub timestamp: i64,
94 pub recv_window: Option<i64>
95}
96
97#[derive(Clone, Debug, Default)]
99pub struct CreateMarginLoanV1Params {
100 pub amount: String,
101 pub asset: String,
102 pub timestamp: i64,
103 pub recv_window: Option<i64>
104}
105
106#[derive(Clone, Debug, Default)]
108pub struct CreateMarginOrderOcoV1Params {
109 pub price: String,
110 pub quantity: String,
111 pub side: String,
112 pub stop_price: String,
113 pub symbol: String,
114 pub timestamp: i64,
115 pub limit_client_order_id: Option<String>,
116 pub limit_iceberg_qty: Option<String>,
117 pub list_client_order_id: Option<String>,
118 pub new_order_resp_type: Option<String>,
119 pub recv_window: Option<i64>,
120 pub side_effect_type: Option<String>,
121 pub stop_client_order_id: Option<String>,
122 pub stop_iceberg_qty: Option<String>,
123 pub stop_limit_price: Option<String>,
124 pub stop_limit_time_in_force: Option<String>
125}
126
127#[derive(Clone, Debug, Default)]
129pub struct CreateMarginOrderV1Params {
130 pub side: String,
131 pub symbol: String,
132 pub timestamp: i64,
133 pub r#type: String,
134 pub auto_repay_at_cancel: Option<bool>,
135 pub iceberg_qty: Option<String>,
136 pub new_client_order_id: Option<String>,
137 pub new_order_resp_type: Option<String>,
138 pub price: Option<String>,
139 pub quantity: Option<String>,
140 pub quote_order_qty: Option<String>,
141 pub recv_window: Option<i64>,
142 pub self_trade_prevention_mode: Option<String>,
143 pub side_effect_type: Option<String>,
144 pub stop_price: Option<String>,
145 pub time_in_force: Option<String>
146}
147
148#[derive(Clone, Debug, Default)]
150pub struct CreateMarginRepayDebtV1Params {
151 pub asset: String,
152 pub timestamp: i64,
153 pub amount: Option<String>,
154 pub recv_window: Option<i64>,
155 pub specify_repay_assets: Option<String>
156}
157
158#[derive(Clone, Debug, Default)]
160pub struct CreateRepayFuturesNegativeBalanceV1Params {
161 pub timestamp: i64,
162 pub recv_window: Option<i64>
163}
164
165#[derive(Clone, Debug, Default)]
167pub struct CreateRepayFuturesSwitchV1Params {
168 pub auto_repay: String,
169 pub timestamp: i64,
170 pub recv_window: Option<i64>
171}
172
173#[derive(Clone, Debug, Default)]
175pub struct CreateRepayLoanV1Params {
176 pub amount: String,
177 pub asset: String,
178 pub timestamp: i64,
179 pub recv_window: Option<i64>
180}
181
182#[derive(Clone, Debug, Default)]
184pub struct CreateUmConditionalOrderV1Params {
185 pub side: String,
186 pub strategy_type: String,
187 pub symbol: String,
188 pub timestamp: i64,
189 pub activation_price: Option<String>,
190 pub callback_rate: Option<String>,
191 pub good_till_date: Option<i64>,
192 pub new_client_strategy_id: Option<String>,
193 pub position_side: Option<String>,
194 pub price: Option<String>,
195 pub price_match: Option<String>,
196 pub price_protect: Option<String>,
197 pub quantity: Option<String>,
198 pub recv_window: Option<i64>,
199 pub reduce_only: Option<String>,
200 pub self_trade_prevention_mode: Option<String>,
201 pub stop_price: Option<String>,
202 pub time_in_force: Option<String>,
203 pub working_type: Option<String>
204}
205
206#[derive(Clone, Debug, Default)]
208pub struct CreateUmFeeBurnV1Params {
209 pub fee_burn: String,
210 pub timestamp: i64,
211 pub recv_window: Option<i64>
212}
213
214#[derive(Clone, Debug, Default)]
216pub struct CreateUmLeverageV1Params {
217 pub leverage: i32,
218 pub symbol: String,
219 pub timestamp: i64,
220 pub recv_window: Option<i64>
221}
222
223#[derive(Clone, Debug, Default)]
225pub struct CreateUmOrderV1Params {
226 pub side: String,
227 pub symbol: String,
228 pub timestamp: i64,
229 pub r#type: String,
230 pub good_till_date: Option<i64>,
231 pub new_client_order_id: Option<String>,
232 pub new_order_resp_type: Option<String>,
233 pub position_side: Option<String>,
234 pub price: Option<String>,
235 pub price_match: Option<String>,
236 pub quantity: Option<String>,
237 pub recv_window: Option<i64>,
238 pub reduce_only: Option<String>,
239 pub self_trade_prevention_mode: Option<String>,
240 pub time_in_force: Option<String>
241}
242
243#[derive(Clone, Debug, Default)]
245pub struct CreateUmPositionSideDualV1Params {
246 pub dual_side_position: String,
247 pub timestamp: i64,
248 pub recv_window: Option<i64>
249}
250
251#[derive(Clone, Debug, Default)]
253pub struct DeleteCmAllOpenOrdersV1Params {
254 pub symbol: String,
255 pub timestamp: i64,
256 pub recv_window: Option<i64>
257}
258
259#[derive(Clone, Debug, Default)]
261pub struct DeleteCmConditionalAllOpenOrdersV1Params {
262 pub symbol: String,
263 pub timestamp: i64,
264 pub recv_window: Option<i64>
265}
266
267#[derive(Clone, Debug, Default)]
269pub struct DeleteCmConditionalOrderV1Params {
270 pub symbol: String,
271 pub timestamp: i64,
272 pub strategy_id: Option<i64>,
273 pub new_client_strategy_id: Option<String>,
274 pub recv_window: Option<i64>
275}
276
277#[derive(Clone, Debug, Default)]
279pub struct DeleteCmOrderV1Params {
280 pub symbol: String,
281 pub timestamp: i64,
282 pub order_id: Option<i64>,
283 pub orig_client_order_id: Option<String>,
284 pub recv_window: Option<i64>
285}
286
287#[derive(Clone, Debug, Default)]
289pub struct DeleteMarginAllOpenOrdersV1Params {
290 pub symbol: String,
291 pub timestamp: i64,
292 pub recv_window: Option<i64>
294}
295
296#[derive(Clone, Debug, Default)]
298pub struct DeleteMarginOrderListV1Params {
299 pub symbol: String,
300 pub timestamp: i64,
301 pub order_list_id: Option<i64>,
303 pub list_client_order_id: Option<String>,
305 pub new_client_order_id: Option<String>,
307 pub recv_window: Option<i64>
309}
310
311#[derive(Clone, Debug, Default)]
313pub struct DeleteMarginOrderV1Params {
314 pub symbol: String,
315 pub timestamp: i64,
316 pub order_id: Option<i64>,
317 pub orig_client_order_id: Option<String>,
318 pub new_client_order_id: Option<String>,
320 pub recv_window: Option<i64>
322}
323
324#[derive(Clone, Debug, Default)]
326pub struct DeleteUmAllOpenOrdersV1Params {
327 pub symbol: String,
328 pub timestamp: i64,
329 pub recv_window: Option<i64>
330}
331
332#[derive(Clone, Debug, Default)]
334pub struct DeleteUmConditionalAllOpenOrdersV1Params {
335 pub symbol: String,
336 pub timestamp: i64,
337 pub recv_window: Option<i64>
338}
339
340#[derive(Clone, Debug, Default)]
342pub struct DeleteUmConditionalOrderV1Params {
343 pub symbol: String,
344 pub timestamp: i64,
345 pub strategy_id: Option<i64>,
346 pub new_client_strategy_id: Option<String>,
347 pub recv_window: Option<i64>
348}
349
350#[derive(Clone, Debug, Default)]
352pub struct DeleteUmOrderV1Params {
353 pub symbol: String,
354 pub timestamp: i64,
355 pub order_id: Option<i64>,
356 pub orig_client_order_id: Option<String>,
357 pub recv_window: Option<i64>
358}
359
360#[derive(Clone, Debug, Default)]
362pub struct GetAccountV1Params {
363 pub timestamp: i64,
364 pub recv_window: Option<i64>
365}
366
367#[derive(Clone, Debug, Default)]
369pub struct GetBalanceV1Params {
370 pub timestamp: i64,
371 pub asset: Option<String>,
372 pub recv_window: Option<i64>
373}
374
375#[derive(Clone, Debug, Default)]
377pub struct GetCmAccountV1Params {
378 pub timestamp: i64,
379 pub recv_window: Option<i64>
380}
381
382#[derive(Clone, Debug, Default)]
384pub struct GetCmAllOrdersV1Params {
385 pub symbol: String,
386 pub timestamp: i64,
387 pub pair: Option<String>,
388 pub order_id: Option<i64>,
389 pub start_time: Option<i64>,
390 pub end_time: Option<i64>,
391 pub limit: Option<i32>,
393 pub recv_window: Option<i64>
394}
395
396#[derive(Clone, Debug, Default)]
398pub struct GetCmCommissionRateV1Params {
399 pub symbol: String,
400 pub timestamp: i64,
401 pub recv_window: Option<i64>
402}
403
404#[derive(Clone, Debug, Default)]
406pub struct GetCmConditionalAllOrdersV1Params {
407 pub timestamp: i64,
408 pub symbol: Option<String>,
409 pub strategy_id: Option<i64>,
410 pub start_time: Option<i64>,
411 pub end_time: Option<i64>,
412 pub limit: Option<i32>,
414 pub recv_window: Option<i64>
415}
416
417#[derive(Clone, Debug, Default)]
419pub struct GetCmConditionalOpenOrderV1Params {
420 pub symbol: String,
421 pub timestamp: i64,
422 pub strategy_id: Option<i64>,
423 pub new_client_strategy_id: Option<String>,
424 pub recv_window: Option<i64>
425}
426
427#[derive(Clone, Debug, Default)]
429pub struct GetCmConditionalOpenOrdersV1Params {
430 pub timestamp: i64,
431 pub symbol: Option<String>,
432 pub recv_window: Option<i64>
433}
434
435#[derive(Clone, Debug, Default)]
437pub struct GetCmConditionalOrderHistoryV1Params {
438 pub symbol: String,
439 pub timestamp: i64,
440 pub strategy_id: Option<i64>,
441 pub new_client_strategy_id: Option<String>,
442 pub recv_window: Option<i64>
443}
444
445#[derive(Clone, Debug, Default)]
447pub struct GetCmForceOrdersV1Params {
448 pub timestamp: i64,
449 pub symbol: Option<String>,
450 pub auto_close_type: Option<String>,
452 pub start_time: Option<i64>,
453 pub end_time: Option<i64>,
454 pub limit: Option<i32>,
456 pub recv_window: Option<i64>
458}
459
460#[derive(Clone, Debug, Default)]
462pub struct GetCmIncomeV1Params {
463 pub timestamp: i64,
464 pub symbol: Option<String>,
465 pub income_type: Option<String>,
467 pub start_time: Option<i64>,
469 pub end_time: Option<i64>,
471 pub page: Option<i32>,
472 pub limit: Option<i32>,
474 pub recv_window: Option<i64>
475}
476
477#[derive(Clone, Debug, Default)]
479pub struct GetCmLeverageBracketV1Params {
480 pub timestamp: i64,
481 pub symbol: Option<String>,
482 pub recv_window: Option<i64>
483}
484
485#[derive(Clone, Debug, Default)]
487pub struct GetCmOpenOrderV1Params {
488 pub symbol: String,
489 pub timestamp: i64,
490 pub order_id: Option<i64>,
491 pub orig_client_order_id: Option<String>,
492 pub recv_window: Option<i64>
493}
494
495#[derive(Clone, Debug, Default)]
497pub struct GetCmOpenOrdersV1Params {
498 pub timestamp: i64,
499 pub symbol: Option<String>,
500 pub pair: Option<String>,
501 pub recv_window: Option<i64>
502}
503
504#[derive(Clone, Debug, Default)]
506pub struct GetCmOrderAmendmentV1Params {
507 pub symbol: String,
508 pub timestamp: i64,
509 pub order_id: Option<i64>,
510 pub orig_client_order_id: Option<String>,
511 pub start_time: Option<i64>,
513 pub end_time: Option<i64>,
515 pub limit: Option<i32>,
517 pub recv_window: Option<i64>
518}
519
520#[derive(Clone, Debug, Default)]
522pub struct GetCmOrderV1Params {
523 pub symbol: String,
524 pub timestamp: i64,
525 pub order_id: Option<i64>,
526 pub orig_client_order_id: Option<String>,
527 pub recv_window: Option<i64>
528}
529
530#[derive(Clone, Debug, Default)]
532pub struct GetCmPositionRiskV1Params {
533 pub timestamp: i64,
534 pub margin_asset: Option<String>,
535 pub pair: Option<String>,
536 pub recv_window: Option<i64>
537}
538
539#[derive(Clone, Debug, Default)]
541pub struct GetCmPositionSideDualV1Params {
542 pub timestamp: i64,
543 pub recv_window: Option<i64>
544}
545
546#[derive(Clone, Debug, Default)]
548pub struct GetCmUserTradesV1Params {
549 pub timestamp: i64,
550 pub symbol: Option<String>,
551 pub pair: Option<String>,
552 pub start_time: Option<i64>,
553 pub end_time: Option<i64>,
554 pub from_id: Option<i64>,
556 pub limit: Option<i32>,
558 pub recv_window: Option<i64>
559}
560
561#[derive(Clone, Debug, Default)]
563pub struct GetMarginAllOrderListV1Params {
564 pub timestamp: i64,
565 pub from_id: Option<i64>,
567 pub start_time: Option<i64>,
568 pub end_time: Option<i64>,
569 pub limit: Option<i32>,
571 pub recv_window: Option<i64>
573}
574
575#[derive(Clone, Debug, Default)]
577pub struct GetMarginAllOrdersV1Params {
578 pub symbol: String,
579 pub timestamp: i64,
580 pub order_id: Option<i64>,
581 pub start_time: Option<i64>,
582 pub end_time: Option<i64>,
583 pub limit: Option<i32>,
585 pub recv_window: Option<i64>
587}
588
589#[derive(Clone, Debug, Default)]
591pub struct GetMarginForceOrdersV1Params {
592 pub timestamp: i64,
593 pub start_time: Option<i64>,
594 pub end_time: Option<i64>,
595 pub current: Option<i64>,
597 pub size: Option<i64>,
599 pub recv_window: Option<i64>
601}
602
603#[derive(Clone, Debug, Default)]
605pub struct GetMarginMarginInterestHistoryV1Params {
606 pub timestamp: i64,
607 pub asset: Option<String>,
608 pub start_time: Option<i64>,
609 pub end_time: Option<i64>,
610 pub current: Option<i64>,
612 pub size: Option<i64>,
614 pub archived: Option<String>,
616 pub recv_window: Option<i64>
618}
619
620#[derive(Clone, Debug, Default)]
622pub struct GetMarginMarginLoanV1Params {
623 pub asset: String,
624 pub timestamp: i64,
625 pub tx_id: Option<i64>,
627 pub start_time: Option<i64>,
628 pub end_time: Option<i64>,
629 pub current: Option<i64>,
631 pub size: Option<i64>,
633 pub archived: Option<String>,
635 pub recv_window: Option<i64>
637}
638
639#[derive(Clone, Debug, Default)]
641pub struct GetMarginMaxBorrowableV1Params {
642 pub asset: String,
643 pub timestamp: i64,
644 pub recv_window: Option<i64>
646}
647
648#[derive(Clone, Debug, Default)]
650pub struct GetMarginMaxWithdrawV1Params {
651 pub asset: String,
652 pub timestamp: i64,
653 pub recv_window: Option<i64>
655}
656
657#[derive(Clone, Debug, Default)]
659pub struct GetMarginMyTradesV1Params {
660 pub symbol: String,
661 pub timestamp: i64,
662 pub order_id: Option<i64>,
663 pub start_time: Option<i64>,
664 pub end_time: Option<i64>,
665 pub from_id: Option<i64>,
667 pub limit: Option<i32>,
669 pub recv_window: Option<i64>
671}
672
673#[derive(Clone, Debug, Default)]
675pub struct GetMarginOpenOrderListV1Params {
676 pub timestamp: i64,
677 pub recv_window: Option<i64>
679}
680
681#[derive(Clone, Debug, Default)]
683pub struct GetMarginOpenOrdersV1Params {
684 pub symbol: String,
685 pub timestamp: i64,
686 pub recv_window: Option<i64>
688}
689
690#[derive(Clone, Debug, Default)]
692pub struct GetMarginOrderListV1Params {
693 pub timestamp: i64,
694 pub order_list_id: Option<i64>,
696 pub orig_client_order_id: Option<String>,
698 pub recv_window: Option<i64>
700}
701
702#[derive(Clone, Debug, Default)]
704pub struct GetMarginOrderV1Params {
705 pub symbol: String,
706 pub timestamp: i64,
707 pub order_id: Option<i64>,
708 pub orig_client_order_id: Option<String>,
709 pub recv_window: Option<i64>
711}
712
713#[derive(Clone, Debug, Default)]
715pub struct GetMarginRepayLoanV1Params {
716 pub asset: String,
717 pub timestamp: i64,
718 pub tx_id: Option<i64>,
720 pub start_time: Option<i64>,
721 pub end_time: Option<i64>,
722 pub current: Option<i64>,
724 pub size: Option<i64>,
726 pub archived: Option<String>,
728 pub recv_window: Option<i64>
730}
731
732#[derive(Clone, Debug, Default)]
734pub struct GetPortfolioInterestHistoryV1Params {
735 pub timestamp: i64,
736 pub asset: Option<String>,
737 pub start_time: Option<i64>,
738 pub end_time: Option<i64>,
739 pub size: Option<i64>,
741 pub recv_window: Option<i64>
742}
743
744#[derive(Clone, Debug, Default)]
746pub struct GetPortfolioNegativeBalanceExchangeRecordV1Params {
747 pub start_time: i64,
748 pub end_time: i64,
749 pub timestamp: i64,
750 pub recv_window: Option<i64>
752}
753
754#[derive(Clone, Debug, Default)]
756pub struct GetRateLimitOrderV1Params {
757 pub timestamp: i64,
758 pub recv_window: Option<i64>
759}
760
761#[derive(Clone, Debug, Default)]
763pub struct GetRepayFuturesSwitchV1Params {
764 pub timestamp: i64,
765 pub recv_window: Option<i64>
766}
767
768#[derive(Clone, Debug, Default)]
770pub struct GetUmAccountConfigV1Params {
771 pub timestamp: i64,
772 pub recv_window: Option<i64>
773}
774
775#[derive(Clone, Debug, Default)]
777pub struct GetUmAccountV1Params {
778 pub timestamp: i64,
779 pub recv_window: Option<i64>
780}
781
782#[derive(Clone, Debug, Default)]
784pub struct GetUmAccountV2Params {
785 pub timestamp: i64,
786 pub recv_window: Option<i64>
787}
788
789#[derive(Clone, Debug, Default)]
791pub struct GetUmAdlQuantileV1Params {
792 pub timestamp: i64,
793 pub symbol: Option<String>,
794 pub recv_window: Option<i64>
795}
796
797#[derive(Clone, Debug, Default)]
799pub struct GetUmAllOrdersV1Params {
800 pub symbol: String,
801 pub timestamp: i64,
802 pub order_id: Option<i64>,
803 pub start_time: Option<i64>,
804 pub end_time: Option<i64>,
805 pub limit: Option<i32>,
807 pub recv_window: Option<i64>
808}
809
810#[derive(Clone, Debug, Default)]
812pub struct GetUmApiTradingStatusV1Params {
813 pub timestamp: i64,
814 pub symbol: Option<String>,
815 pub recv_window: Option<i64>
816}
817
818#[derive(Clone, Debug, Default)]
820pub struct GetUmCommissionRateV1Params {
821 pub symbol: String,
822 pub timestamp: i64,
823 pub recv_window: Option<i64>
824}
825
826#[derive(Clone, Debug, Default)]
828pub struct GetUmConditionalAllOrdersV1Params {
829 pub timestamp: i64,
830 pub symbol: Option<String>,
831 pub strategy_id: Option<i64>,
832 pub start_time: Option<i64>,
833 pub end_time: Option<i64>,
834 pub limit: Option<i32>,
836 pub recv_window: Option<i64>
837}
838
839#[derive(Clone, Debug, Default)]
841pub struct GetUmConditionalOpenOrderV1Params {
842 pub symbol: String,
843 pub timestamp: i64,
844 pub strategy_id: Option<i64>,
845 pub new_client_strategy_id: Option<String>,
846 pub recv_window: Option<i64>
847}
848
849#[derive(Clone, Debug, Default)]
851pub struct GetUmConditionalOrderHistoryV1Params {
852 pub symbol: String,
853 pub timestamp: i64,
854 pub strategy_id: Option<i64>,
855 pub new_client_strategy_id: Option<String>,
856 pub recv_window: Option<i64>
857}
858
859#[derive(Clone, Debug, Default)]
861pub struct GetUmFeeBurnV1Params {
862 pub timestamp: i64,
863 pub recv_window: Option<i64>
864}
865
866#[derive(Clone, Debug, Default)]
868pub struct GetUmForceOrdersV1Params {
869 pub timestamp: i64,
870 pub symbol: Option<String>,
871 pub auto_close_type: Option<String>,
873 pub start_time: Option<i64>,
874 pub end_time: Option<i64>,
875 pub limit: Option<i32>,
877 pub recv_window: Option<i64>
879}
880
881#[derive(Clone, Debug, Default)]
883pub struct GetUmIncomeAsynIdV1Params {
884 pub download_id: String,
886 pub timestamp: i64,
887 pub recv_window: Option<i64>
888}
889
890#[derive(Clone, Debug, Default)]
892pub struct GetUmIncomeAsynV1Params {
893 pub start_time: i64,
895 pub end_time: i64,
897 pub timestamp: i64,
898 pub recv_window: Option<i64>
899}
900
901#[derive(Clone, Debug, Default)]
903pub struct GetUmIncomeV1Params {
904 pub timestamp: i64,
905 pub symbol: Option<String>,
906 pub income_type: Option<String>,
908 pub start_time: Option<i64>,
910 pub end_time: Option<i64>,
912 pub page: Option<i32>,
913 pub limit: Option<i32>,
915 pub recv_window: Option<i64>
916}
917
918#[derive(Clone, Debug, Default)]
920pub struct GetUmLeverageBracketV1Params {
921 pub timestamp: i64,
922 pub symbol: Option<String>,
923 pub recv_window: Option<i64>
924}
925
926#[derive(Clone, Debug, Default)]
928pub struct GetUmOpenOrderV1Params {
929 pub symbol: String,
930 pub timestamp: i64,
931 pub order_id: Option<i64>,
932 pub orig_client_order_id: Option<String>,
933 pub recv_window: Option<i64>
934}
935
936#[derive(Clone, Debug, Default)]
938pub struct GetUmOpenOrdersV1Params {
939 pub timestamp: i64,
940 pub symbol: Option<String>,
941 pub recv_window: Option<i64>
942}
943
944#[derive(Clone, Debug, Default)]
946pub struct GetUmOrderAmendmentV1Params {
947 pub symbol: String,
948 pub timestamp: i64,
949 pub order_id: Option<i64>,
950 pub orig_client_order_id: Option<String>,
951 pub start_time: Option<i64>,
953 pub end_time: Option<i64>,
955 pub limit: Option<i32>,
957 pub recv_window: Option<i64>
958}
959
960#[derive(Clone, Debug, Default)]
962pub struct GetUmOrderAsynIdV1Params {
963 pub download_id: String,
965 pub timestamp: i64,
966 pub recv_window: Option<i64>
967}
968
969#[derive(Clone, Debug, Default)]
971pub struct GetUmOrderAsynV1Params {
972 pub start_time: i64,
974 pub end_time: i64,
976 pub timestamp: i64,
977 pub recv_window: Option<i64>
978}
979
980#[derive(Clone, Debug, Default)]
982pub struct GetUmOrderV1Params {
983 pub symbol: String,
984 pub timestamp: i64,
985 pub order_id: Option<i64>,
986 pub orig_client_order_id: Option<String>,
987 pub recv_window: Option<i64>
988}
989
990#[derive(Clone, Debug, Default)]
992pub struct GetUmPositionSideDualV1Params {
993 pub timestamp: i64,
994 pub recv_window: Option<i64>
995}
996
997#[derive(Clone, Debug, Default)]
999pub struct GetUmSymbolConfigV1Params {
1000 pub timestamp: i64,
1001 pub symbol: Option<String>,
1002 pub recv_window: Option<i64>
1003}
1004
1005#[derive(Clone, Debug, Default)]
1007pub struct GetUmTradeAsynIdV1Params {
1008 pub download_id: String,
1010 pub timestamp: i64,
1011 pub recv_window: Option<i64>
1012}
1013
1014#[derive(Clone, Debug, Default)]
1016pub struct GetUmTradeAsynV1Params {
1017 pub start_time: i64,
1019 pub end_time: i64,
1021 pub timestamp: i64,
1022 pub recv_window: Option<i64>
1023}
1024
1025#[derive(Clone, Debug, Default)]
1027pub struct GetUmUserTradesV1Params {
1028 pub symbol: String,
1029 pub timestamp: i64,
1030 pub start_time: Option<i64>,
1031 pub end_time: Option<i64>,
1032 pub from_id: Option<i64>,
1034 pub limit: Option<i32>,
1036 pub recv_window: Option<i64>
1037}
1038
1039#[derive(Clone, Debug, Default)]
1041pub struct UpdateCmOrderV1Params {
1042 pub price: String,
1043 pub quantity: String,
1044 pub side: String,
1045 pub symbol: String,
1046 pub timestamp: i64,
1047 pub order_id: Option<i64>,
1048 pub orig_client_order_id: Option<String>,
1049 pub price_match: Option<String>,
1050 pub recv_window: Option<i64>
1051}
1052
1053#[derive(Clone, Debug, Default)]
1055pub struct UpdateUmOrderV1Params {
1056 pub price: String,
1057 pub quantity: String,
1058 pub side: String,
1059 pub symbol: String,
1060 pub timestamp: i64,
1061 pub order_id: Option<i64>,
1062 pub orig_client_order_id: Option<String>,
1063 pub price_match: Option<String>,
1064 pub recv_window: Option<i64>
1065}
1066
1067
1068#[derive(Debug, Clone, Serialize, Deserialize)]
1070#[serde(untagged)]
1071pub enum CreateAssetCollectionV1Error {
1072 Status4XX(models::ApiError),
1073 Status5XX(models::ApiError),
1074 UnknownValue(serde_json::Value),
1075}
1076
1077#[derive(Debug, Clone, Serialize, Deserialize)]
1079#[serde(untagged)]
1080pub enum CreateAutoCollectionV1Error {
1081 Status4XX(models::ApiError),
1082 Status5XX(models::ApiError),
1083 UnknownValue(serde_json::Value),
1084}
1085
1086#[derive(Debug, Clone, Serialize, Deserialize)]
1088#[serde(untagged)]
1089pub enum CreateBnbTransferV1Error {
1090 Status4XX(models::ApiError),
1091 Status5XX(models::ApiError),
1092 UnknownValue(serde_json::Value),
1093}
1094
1095#[derive(Debug, Clone, Serialize, Deserialize)]
1097#[serde(untagged)]
1098pub enum CreateCmConditionalOrderV1Error {
1099 Status4XX(models::ApiError),
1100 Status5XX(models::ApiError),
1101 UnknownValue(serde_json::Value),
1102}
1103
1104#[derive(Debug, Clone, Serialize, Deserialize)]
1106#[serde(untagged)]
1107pub enum CreateCmLeverageV1Error {
1108 Status4XX(models::ApiError),
1109 Status5XX(models::ApiError),
1110 UnknownValue(serde_json::Value),
1111}
1112
1113#[derive(Debug, Clone, Serialize, Deserialize)]
1115#[serde(untagged)]
1116pub enum CreateCmOrderV1Error {
1117 Status4XX(models::ApiError),
1118 Status5XX(models::ApiError),
1119 UnknownValue(serde_json::Value),
1120}
1121
1122#[derive(Debug, Clone, Serialize, Deserialize)]
1124#[serde(untagged)]
1125pub enum CreateCmPositionSideDualV1Error {
1126 Status4XX(models::ApiError),
1127 Status5XX(models::ApiError),
1128 UnknownValue(serde_json::Value),
1129}
1130
1131#[derive(Debug, Clone, Serialize, Deserialize)]
1133#[serde(untagged)]
1134pub enum CreateListenKeyV1Error {
1135 Status4XX(models::ApiError),
1136 Status5XX(models::ApiError),
1137 UnknownValue(serde_json::Value),
1138}
1139
1140#[derive(Debug, Clone, Serialize, Deserialize)]
1142#[serde(untagged)]
1143pub enum CreateMarginLoanV1Error {
1144 Status4XX(models::ApiError),
1145 Status5XX(models::ApiError),
1146 UnknownValue(serde_json::Value),
1147}
1148
1149#[derive(Debug, Clone, Serialize, Deserialize)]
1151#[serde(untagged)]
1152pub enum CreateMarginOrderOcoV1Error {
1153 Status4XX(models::ApiError),
1154 Status5XX(models::ApiError),
1155 UnknownValue(serde_json::Value),
1156}
1157
1158#[derive(Debug, Clone, Serialize, Deserialize)]
1160#[serde(untagged)]
1161pub enum CreateMarginOrderV1Error {
1162 Status4XX(models::ApiError),
1163 Status5XX(models::ApiError),
1164 UnknownValue(serde_json::Value),
1165}
1166
1167#[derive(Debug, Clone, Serialize, Deserialize)]
1169#[serde(untagged)]
1170pub enum CreateMarginRepayDebtV1Error {
1171 Status4XX(models::ApiError),
1172 Status5XX(models::ApiError),
1173 UnknownValue(serde_json::Value),
1174}
1175
1176#[derive(Debug, Clone, Serialize, Deserialize)]
1178#[serde(untagged)]
1179pub enum CreateRepayFuturesNegativeBalanceV1Error {
1180 Status4XX(models::ApiError),
1181 Status5XX(models::ApiError),
1182 UnknownValue(serde_json::Value),
1183}
1184
1185#[derive(Debug, Clone, Serialize, Deserialize)]
1187#[serde(untagged)]
1188pub enum CreateRepayFuturesSwitchV1Error {
1189 Status4XX(models::ApiError),
1190 Status5XX(models::ApiError),
1191 UnknownValue(serde_json::Value),
1192}
1193
1194#[derive(Debug, Clone, Serialize, Deserialize)]
1196#[serde(untagged)]
1197pub enum CreateRepayLoanV1Error {
1198 Status4XX(models::ApiError),
1199 Status5XX(models::ApiError),
1200 UnknownValue(serde_json::Value),
1201}
1202
1203#[derive(Debug, Clone, Serialize, Deserialize)]
1205#[serde(untagged)]
1206pub enum CreateUmConditionalOrderV1Error {
1207 Status4XX(models::ApiError),
1208 Status5XX(models::ApiError),
1209 UnknownValue(serde_json::Value),
1210}
1211
1212#[derive(Debug, Clone, Serialize, Deserialize)]
1214#[serde(untagged)]
1215pub enum CreateUmFeeBurnV1Error {
1216 Status4XX(models::ApiError),
1217 Status5XX(models::ApiError),
1218 UnknownValue(serde_json::Value),
1219}
1220
1221#[derive(Debug, Clone, Serialize, Deserialize)]
1223#[serde(untagged)]
1224pub enum CreateUmLeverageV1Error {
1225 Status4XX(models::ApiError),
1226 Status5XX(models::ApiError),
1227 UnknownValue(serde_json::Value),
1228}
1229
1230#[derive(Debug, Clone, Serialize, Deserialize)]
1232#[serde(untagged)]
1233pub enum CreateUmOrderV1Error {
1234 Status4XX(models::ApiError),
1235 Status5XX(models::ApiError),
1236 UnknownValue(serde_json::Value),
1237}
1238
1239#[derive(Debug, Clone, Serialize, Deserialize)]
1241#[serde(untagged)]
1242pub enum CreateUmPositionSideDualV1Error {
1243 Status4XX(models::ApiError),
1244 Status5XX(models::ApiError),
1245 UnknownValue(serde_json::Value),
1246}
1247
1248#[derive(Debug, Clone, Serialize, Deserialize)]
1250#[serde(untagged)]
1251pub enum DeleteCmAllOpenOrdersV1Error {
1252 Status4XX(models::ApiError),
1253 Status5XX(models::ApiError),
1254 UnknownValue(serde_json::Value),
1255}
1256
1257#[derive(Debug, Clone, Serialize, Deserialize)]
1259#[serde(untagged)]
1260pub enum DeleteCmConditionalAllOpenOrdersV1Error {
1261 Status4XX(models::ApiError),
1262 Status5XX(models::ApiError),
1263 UnknownValue(serde_json::Value),
1264}
1265
1266#[derive(Debug, Clone, Serialize, Deserialize)]
1268#[serde(untagged)]
1269pub enum DeleteCmConditionalOrderV1Error {
1270 Status4XX(models::ApiError),
1271 Status5XX(models::ApiError),
1272 UnknownValue(serde_json::Value),
1273}
1274
1275#[derive(Debug, Clone, Serialize, Deserialize)]
1277#[serde(untagged)]
1278pub enum DeleteCmOrderV1Error {
1279 Status4XX(models::ApiError),
1280 Status5XX(models::ApiError),
1281 UnknownValue(serde_json::Value),
1282}
1283
1284#[derive(Debug, Clone, Serialize, Deserialize)]
1286#[serde(untagged)]
1287pub enum DeleteListenKeyV1Error {
1288 Status4XX(models::ApiError),
1289 Status5XX(models::ApiError),
1290 UnknownValue(serde_json::Value),
1291}
1292
1293#[derive(Debug, Clone, Serialize, Deserialize)]
1295#[serde(untagged)]
1296pub enum DeleteMarginAllOpenOrdersV1Error {
1297 Status4XX(models::ApiError),
1298 Status5XX(models::ApiError),
1299 UnknownValue(serde_json::Value),
1300}
1301
1302#[derive(Debug, Clone, Serialize, Deserialize)]
1304#[serde(untagged)]
1305pub enum DeleteMarginOrderListV1Error {
1306 Status4XX(models::ApiError),
1307 Status5XX(models::ApiError),
1308 UnknownValue(serde_json::Value),
1309}
1310
1311#[derive(Debug, Clone, Serialize, Deserialize)]
1313#[serde(untagged)]
1314pub enum DeleteMarginOrderV1Error {
1315 Status4XX(models::ApiError),
1316 Status5XX(models::ApiError),
1317 UnknownValue(serde_json::Value),
1318}
1319
1320#[derive(Debug, Clone, Serialize, Deserialize)]
1322#[serde(untagged)]
1323pub enum DeleteUmAllOpenOrdersV1Error {
1324 Status4XX(models::ApiError),
1325 Status5XX(models::ApiError),
1326 UnknownValue(serde_json::Value),
1327}
1328
1329#[derive(Debug, Clone, Serialize, Deserialize)]
1331#[serde(untagged)]
1332pub enum DeleteUmConditionalAllOpenOrdersV1Error {
1333 Status4XX(models::ApiError),
1334 Status5XX(models::ApiError),
1335 UnknownValue(serde_json::Value),
1336}
1337
1338#[derive(Debug, Clone, Serialize, Deserialize)]
1340#[serde(untagged)]
1341pub enum DeleteUmConditionalOrderV1Error {
1342 Status4XX(models::ApiError),
1343 Status5XX(models::ApiError),
1344 UnknownValue(serde_json::Value),
1345}
1346
1347#[derive(Debug, Clone, Serialize, Deserialize)]
1349#[serde(untagged)]
1350pub enum DeleteUmOrderV1Error {
1351 Status4XX(models::ApiError),
1352 Status5XX(models::ApiError),
1353 UnknownValue(serde_json::Value),
1354}
1355
1356#[derive(Debug, Clone, Serialize, Deserialize)]
1358#[serde(untagged)]
1359pub enum GetAccountV1Error {
1360 Status4XX(models::ApiError),
1361 Status5XX(models::ApiError),
1362 UnknownValue(serde_json::Value),
1363}
1364
1365#[derive(Debug, Clone, Serialize, Deserialize)]
1367#[serde(untagged)]
1368pub enum GetBalanceV1Error {
1369 Status4XX(models::ApiError),
1370 Status5XX(models::ApiError),
1371 UnknownValue(serde_json::Value),
1372}
1373
1374#[derive(Debug, Clone, Serialize, Deserialize)]
1376#[serde(untagged)]
1377pub enum GetCmAccountV1Error {
1378 Status4XX(models::ApiError),
1379 Status5XX(models::ApiError),
1380 UnknownValue(serde_json::Value),
1381}
1382
1383#[derive(Debug, Clone, Serialize, Deserialize)]
1385#[serde(untagged)]
1386pub enum GetCmAdlQuantileV1Error {
1387 Status4XX(models::ApiError),
1388 Status5XX(models::ApiError),
1389 UnknownValue(serde_json::Value),
1390}
1391
1392#[derive(Debug, Clone, Serialize, Deserialize)]
1394#[serde(untagged)]
1395pub enum GetCmAllOrdersV1Error {
1396 Status4XX(models::ApiError),
1397 Status5XX(models::ApiError),
1398 UnknownValue(serde_json::Value),
1399}
1400
1401#[derive(Debug, Clone, Serialize, Deserialize)]
1403#[serde(untagged)]
1404pub enum GetCmCommissionRateV1Error {
1405 Status4XX(models::ApiError),
1406 Status5XX(models::ApiError),
1407 UnknownValue(serde_json::Value),
1408}
1409
1410#[derive(Debug, Clone, Serialize, Deserialize)]
1412#[serde(untagged)]
1413pub enum GetCmConditionalAllOrdersV1Error {
1414 Status4XX(models::ApiError),
1415 Status5XX(models::ApiError),
1416 UnknownValue(serde_json::Value),
1417}
1418
1419#[derive(Debug, Clone, Serialize, Deserialize)]
1421#[serde(untagged)]
1422pub enum GetCmConditionalOpenOrderV1Error {
1423 Status4XX(models::ApiError),
1424 Status5XX(models::ApiError),
1425 UnknownValue(serde_json::Value),
1426}
1427
1428#[derive(Debug, Clone, Serialize, Deserialize)]
1430#[serde(untagged)]
1431pub enum GetCmConditionalOpenOrdersV1Error {
1432 Status4XX(models::ApiError),
1433 Status5XX(models::ApiError),
1434 UnknownValue(serde_json::Value),
1435}
1436
1437#[derive(Debug, Clone, Serialize, Deserialize)]
1439#[serde(untagged)]
1440pub enum GetCmConditionalOrderHistoryV1Error {
1441 Status4XX(models::ApiError),
1442 Status5XX(models::ApiError),
1443 UnknownValue(serde_json::Value),
1444}
1445
1446#[derive(Debug, Clone, Serialize, Deserialize)]
1448#[serde(untagged)]
1449pub enum GetCmForceOrdersV1Error {
1450 Status4XX(models::ApiError),
1451 Status5XX(models::ApiError),
1452 UnknownValue(serde_json::Value),
1453}
1454
1455#[derive(Debug, Clone, Serialize, Deserialize)]
1457#[serde(untagged)]
1458pub enum GetCmIncomeV1Error {
1459 Status4XX(models::ApiError),
1460 Status5XX(models::ApiError),
1461 UnknownValue(serde_json::Value),
1462}
1463
1464#[derive(Debug, Clone, Serialize, Deserialize)]
1466#[serde(untagged)]
1467pub enum GetCmLeverageBracketV1Error {
1468 Status4XX(models::ApiError),
1469 Status5XX(models::ApiError),
1470 UnknownValue(serde_json::Value),
1471}
1472
1473#[derive(Debug, Clone, Serialize, Deserialize)]
1475#[serde(untagged)]
1476pub enum GetCmOpenOrderV1Error {
1477 Status4XX(models::ApiError),
1478 Status5XX(models::ApiError),
1479 UnknownValue(serde_json::Value),
1480}
1481
1482#[derive(Debug, Clone, Serialize, Deserialize)]
1484#[serde(untagged)]
1485pub enum GetCmOpenOrdersV1Error {
1486 Status4XX(models::ApiError),
1487 Status5XX(models::ApiError),
1488 UnknownValue(serde_json::Value),
1489}
1490
1491#[derive(Debug, Clone, Serialize, Deserialize)]
1493#[serde(untagged)]
1494pub enum GetCmOrderAmendmentV1Error {
1495 Status4XX(models::ApiError),
1496 Status5XX(models::ApiError),
1497 UnknownValue(serde_json::Value),
1498}
1499
1500#[derive(Debug, Clone, Serialize, Deserialize)]
1502#[serde(untagged)]
1503pub enum GetCmOrderV1Error {
1504 Status4XX(models::ApiError),
1505 Status5XX(models::ApiError),
1506 UnknownValue(serde_json::Value),
1507}
1508
1509#[derive(Debug, Clone, Serialize, Deserialize)]
1511#[serde(untagged)]
1512pub enum GetCmPositionRiskV1Error {
1513 Status4XX(models::ApiError),
1514 Status5XX(models::ApiError),
1515 UnknownValue(serde_json::Value),
1516}
1517
1518#[derive(Debug, Clone, Serialize, Deserialize)]
1520#[serde(untagged)]
1521pub enum GetCmPositionSideDualV1Error {
1522 Status4XX(models::ApiError),
1523 Status5XX(models::ApiError),
1524 UnknownValue(serde_json::Value),
1525}
1526
1527#[derive(Debug, Clone, Serialize, Deserialize)]
1529#[serde(untagged)]
1530pub enum GetCmUserTradesV1Error {
1531 Status4XX(models::ApiError),
1532 Status5XX(models::ApiError),
1533 UnknownValue(serde_json::Value),
1534}
1535
1536#[derive(Debug, Clone, Serialize, Deserialize)]
1538#[serde(untagged)]
1539pub enum GetMarginAllOrderListV1Error {
1540 Status4XX(models::ApiError),
1541 Status5XX(models::ApiError),
1542 UnknownValue(serde_json::Value),
1543}
1544
1545#[derive(Debug, Clone, Serialize, Deserialize)]
1547#[serde(untagged)]
1548pub enum GetMarginAllOrdersV1Error {
1549 Status4XX(models::ApiError),
1550 Status5XX(models::ApiError),
1551 UnknownValue(serde_json::Value),
1552}
1553
1554#[derive(Debug, Clone, Serialize, Deserialize)]
1556#[serde(untagged)]
1557pub enum GetMarginForceOrdersV1Error {
1558 Status4XX(models::ApiError),
1559 Status5XX(models::ApiError),
1560 UnknownValue(serde_json::Value),
1561}
1562
1563#[derive(Debug, Clone, Serialize, Deserialize)]
1565#[serde(untagged)]
1566pub enum GetMarginMarginInterestHistoryV1Error {
1567 Status4XX(models::ApiError),
1568 Status5XX(models::ApiError),
1569 UnknownValue(serde_json::Value),
1570}
1571
1572#[derive(Debug, Clone, Serialize, Deserialize)]
1574#[serde(untagged)]
1575pub enum GetMarginMarginLoanV1Error {
1576 Status4XX(models::ApiError),
1577 Status5XX(models::ApiError),
1578 UnknownValue(serde_json::Value),
1579}
1580
1581#[derive(Debug, Clone, Serialize, Deserialize)]
1583#[serde(untagged)]
1584pub enum GetMarginMaxBorrowableV1Error {
1585 Status4XX(models::ApiError),
1586 Status5XX(models::ApiError),
1587 UnknownValue(serde_json::Value),
1588}
1589
1590#[derive(Debug, Clone, Serialize, Deserialize)]
1592#[serde(untagged)]
1593pub enum GetMarginMaxWithdrawV1Error {
1594 Status4XX(models::ApiError),
1595 Status5XX(models::ApiError),
1596 UnknownValue(serde_json::Value),
1597}
1598
1599#[derive(Debug, Clone, Serialize, Deserialize)]
1601#[serde(untagged)]
1602pub enum GetMarginMyTradesV1Error {
1603 Status4XX(models::ApiError),
1604 Status5XX(models::ApiError),
1605 UnknownValue(serde_json::Value),
1606}
1607
1608#[derive(Debug, Clone, Serialize, Deserialize)]
1610#[serde(untagged)]
1611pub enum GetMarginOpenOrderListV1Error {
1612 Status4XX(models::ApiError),
1613 Status5XX(models::ApiError),
1614 UnknownValue(serde_json::Value),
1615}
1616
1617#[derive(Debug, Clone, Serialize, Deserialize)]
1619#[serde(untagged)]
1620pub enum GetMarginOpenOrdersV1Error {
1621 Status4XX(models::ApiError),
1622 Status5XX(models::ApiError),
1623 UnknownValue(serde_json::Value),
1624}
1625
1626#[derive(Debug, Clone, Serialize, Deserialize)]
1628#[serde(untagged)]
1629pub enum GetMarginOrderListV1Error {
1630 Status4XX(models::ApiError),
1631 Status5XX(models::ApiError),
1632 UnknownValue(serde_json::Value),
1633}
1634
1635#[derive(Debug, Clone, Serialize, Deserialize)]
1637#[serde(untagged)]
1638pub enum GetMarginOrderV1Error {
1639 Status4XX(models::ApiError),
1640 Status5XX(models::ApiError),
1641 UnknownValue(serde_json::Value),
1642}
1643
1644#[derive(Debug, Clone, Serialize, Deserialize)]
1646#[serde(untagged)]
1647pub enum GetMarginRepayLoanV1Error {
1648 Status4XX(models::ApiError),
1649 Status5XX(models::ApiError),
1650 UnknownValue(serde_json::Value),
1651}
1652
1653#[derive(Debug, Clone, Serialize, Deserialize)]
1655#[serde(untagged)]
1656pub enum GetPingV1Error {
1657 Status4XX(models::ApiError),
1658 Status5XX(models::ApiError),
1659 UnknownValue(serde_json::Value),
1660}
1661
1662#[derive(Debug, Clone, Serialize, Deserialize)]
1664#[serde(untagged)]
1665pub enum GetPortfolioInterestHistoryV1Error {
1666 Status4XX(models::ApiError),
1667 Status5XX(models::ApiError),
1668 UnknownValue(serde_json::Value),
1669}
1670
1671#[derive(Debug, Clone, Serialize, Deserialize)]
1673#[serde(untagged)]
1674pub enum GetPortfolioNegativeBalanceExchangeRecordV1Error {
1675 Status4XX(models::ApiError),
1676 Status5XX(models::ApiError),
1677 UnknownValue(serde_json::Value),
1678}
1679
1680#[derive(Debug, Clone, Serialize, Deserialize)]
1682#[serde(untagged)]
1683pub enum GetRateLimitOrderV1Error {
1684 Status4XX(models::ApiError),
1685 Status5XX(models::ApiError),
1686 UnknownValue(serde_json::Value),
1687}
1688
1689#[derive(Debug, Clone, Serialize, Deserialize)]
1691#[serde(untagged)]
1692pub enum GetRepayFuturesSwitchV1Error {
1693 Status4XX(models::ApiError),
1694 Status5XX(models::ApiError),
1695 UnknownValue(serde_json::Value),
1696}
1697
1698#[derive(Debug, Clone, Serialize, Deserialize)]
1700#[serde(untagged)]
1701pub enum GetUmAccountConfigV1Error {
1702 Status4XX(models::ApiError),
1703 Status5XX(models::ApiError),
1704 UnknownValue(serde_json::Value),
1705}
1706
1707#[derive(Debug, Clone, Serialize, Deserialize)]
1709#[serde(untagged)]
1710pub enum GetUmAccountV1Error {
1711 Status4XX(models::ApiError),
1712 Status5XX(models::ApiError),
1713 UnknownValue(serde_json::Value),
1714}
1715
1716#[derive(Debug, Clone, Serialize, Deserialize)]
1718#[serde(untagged)]
1719pub enum GetUmAccountV2Error {
1720 Status4XX(models::ApiError),
1721 Status5XX(models::ApiError),
1722 UnknownValue(serde_json::Value),
1723}
1724
1725#[derive(Debug, Clone, Serialize, Deserialize)]
1727#[serde(untagged)]
1728pub enum GetUmAdlQuantileV1Error {
1729 Status4XX(models::ApiError),
1730 Status5XX(models::ApiError),
1731 UnknownValue(serde_json::Value),
1732}
1733
1734#[derive(Debug, Clone, Serialize, Deserialize)]
1736#[serde(untagged)]
1737pub enum GetUmAllOrdersV1Error {
1738 Status4XX(models::ApiError),
1739 Status5XX(models::ApiError),
1740 UnknownValue(serde_json::Value),
1741}
1742
1743#[derive(Debug, Clone, Serialize, Deserialize)]
1745#[serde(untagged)]
1746pub enum GetUmApiTradingStatusV1Error {
1747 Status4XX(models::ApiError),
1748 Status5XX(models::ApiError),
1749 UnknownValue(serde_json::Value),
1750}
1751
1752#[derive(Debug, Clone, Serialize, Deserialize)]
1754#[serde(untagged)]
1755pub enum GetUmCommissionRateV1Error {
1756 Status4XX(models::ApiError),
1757 Status5XX(models::ApiError),
1758 UnknownValue(serde_json::Value),
1759}
1760
1761#[derive(Debug, Clone, Serialize, Deserialize)]
1763#[serde(untagged)]
1764pub enum GetUmConditionalAllOrdersV1Error {
1765 Status4XX(models::ApiError),
1766 Status5XX(models::ApiError),
1767 UnknownValue(serde_json::Value),
1768}
1769
1770#[derive(Debug, Clone, Serialize, Deserialize)]
1772#[serde(untagged)]
1773pub enum GetUmConditionalOpenOrderV1Error {
1774 Status4XX(models::ApiError),
1775 Status5XX(models::ApiError),
1776 UnknownValue(serde_json::Value),
1777}
1778
1779#[derive(Debug, Clone, Serialize, Deserialize)]
1781#[serde(untagged)]
1782pub enum GetUmConditionalOpenOrdersV1Error {
1783 Status4XX(models::ApiError),
1784 Status5XX(models::ApiError),
1785 UnknownValue(serde_json::Value),
1786}
1787
1788#[derive(Debug, Clone, Serialize, Deserialize)]
1790#[serde(untagged)]
1791pub enum GetUmConditionalOrderHistoryV1Error {
1792 Status4XX(models::ApiError),
1793 Status5XX(models::ApiError),
1794 UnknownValue(serde_json::Value),
1795}
1796
1797#[derive(Debug, Clone, Serialize, Deserialize)]
1799#[serde(untagged)]
1800pub enum GetUmFeeBurnV1Error {
1801 Status4XX(models::ApiError),
1802 Status5XX(models::ApiError),
1803 UnknownValue(serde_json::Value),
1804}
1805
1806#[derive(Debug, Clone, Serialize, Deserialize)]
1808#[serde(untagged)]
1809pub enum GetUmForceOrdersV1Error {
1810 Status4XX(models::ApiError),
1811 Status5XX(models::ApiError),
1812 UnknownValue(serde_json::Value),
1813}
1814
1815#[derive(Debug, Clone, Serialize, Deserialize)]
1817#[serde(untagged)]
1818pub enum GetUmIncomeAsynIdV1Error {
1819 Status4XX(models::ApiError),
1820 Status5XX(models::ApiError),
1821 UnknownValue(serde_json::Value),
1822}
1823
1824#[derive(Debug, Clone, Serialize, Deserialize)]
1826#[serde(untagged)]
1827pub enum GetUmIncomeAsynV1Error {
1828 Status4XX(models::ApiError),
1829 Status5XX(models::ApiError),
1830 UnknownValue(serde_json::Value),
1831}
1832
1833#[derive(Debug, Clone, Serialize, Deserialize)]
1835#[serde(untagged)]
1836pub enum GetUmIncomeV1Error {
1837 Status4XX(models::ApiError),
1838 Status5XX(models::ApiError),
1839 UnknownValue(serde_json::Value),
1840}
1841
1842#[derive(Debug, Clone, Serialize, Deserialize)]
1844#[serde(untagged)]
1845pub enum GetUmLeverageBracketV1Error {
1846 Status4XX(models::ApiError),
1847 Status5XX(models::ApiError),
1848 UnknownValue(serde_json::Value),
1849}
1850
1851#[derive(Debug, Clone, Serialize, Deserialize)]
1853#[serde(untagged)]
1854pub enum GetUmOpenOrderV1Error {
1855 Status4XX(models::ApiError),
1856 Status5XX(models::ApiError),
1857 UnknownValue(serde_json::Value),
1858}
1859
1860#[derive(Debug, Clone, Serialize, Deserialize)]
1862#[serde(untagged)]
1863pub enum GetUmOpenOrdersV1Error {
1864 Status4XX(models::ApiError),
1865 Status5XX(models::ApiError),
1866 UnknownValue(serde_json::Value),
1867}
1868
1869#[derive(Debug, Clone, Serialize, Deserialize)]
1871#[serde(untagged)]
1872pub enum GetUmOrderAmendmentV1Error {
1873 Status4XX(models::ApiError),
1874 Status5XX(models::ApiError),
1875 UnknownValue(serde_json::Value),
1876}
1877
1878#[derive(Debug, Clone, Serialize, Deserialize)]
1880#[serde(untagged)]
1881pub enum GetUmOrderAsynIdV1Error {
1882 Status4XX(models::ApiError),
1883 Status5XX(models::ApiError),
1884 UnknownValue(serde_json::Value),
1885}
1886
1887#[derive(Debug, Clone, Serialize, Deserialize)]
1889#[serde(untagged)]
1890pub enum GetUmOrderAsynV1Error {
1891 Status4XX(models::ApiError),
1892 Status5XX(models::ApiError),
1893 UnknownValue(serde_json::Value),
1894}
1895
1896#[derive(Debug, Clone, Serialize, Deserialize)]
1898#[serde(untagged)]
1899pub enum GetUmOrderV1Error {
1900 Status4XX(models::ApiError),
1901 Status5XX(models::ApiError),
1902 UnknownValue(serde_json::Value),
1903}
1904
1905#[derive(Debug, Clone, Serialize, Deserialize)]
1907#[serde(untagged)]
1908pub enum GetUmPositionRiskV1Error {
1909 Status4XX(models::ApiError),
1910 Status5XX(models::ApiError),
1911 UnknownValue(serde_json::Value),
1912}
1913
1914#[derive(Debug, Clone, Serialize, Deserialize)]
1916#[serde(untagged)]
1917pub enum GetUmPositionSideDualV1Error {
1918 Status4XX(models::ApiError),
1919 Status5XX(models::ApiError),
1920 UnknownValue(serde_json::Value),
1921}
1922
1923#[derive(Debug, Clone, Serialize, Deserialize)]
1925#[serde(untagged)]
1926pub enum GetUmSymbolConfigV1Error {
1927 Status4XX(models::ApiError),
1928 Status5XX(models::ApiError),
1929 UnknownValue(serde_json::Value),
1930}
1931
1932#[derive(Debug, Clone, Serialize, Deserialize)]
1934#[serde(untagged)]
1935pub enum GetUmTradeAsynIdV1Error {
1936 Status4XX(models::ApiError),
1937 Status5XX(models::ApiError),
1938 UnknownValue(serde_json::Value),
1939}
1940
1941#[derive(Debug, Clone, Serialize, Deserialize)]
1943#[serde(untagged)]
1944pub enum GetUmTradeAsynV1Error {
1945 Status4XX(models::ApiError),
1946 Status5XX(models::ApiError),
1947 UnknownValue(serde_json::Value),
1948}
1949
1950#[derive(Debug, Clone, Serialize, Deserialize)]
1952#[serde(untagged)]
1953pub enum GetUmUserTradesV1Error {
1954 Status4XX(models::ApiError),
1955 Status5XX(models::ApiError),
1956 UnknownValue(serde_json::Value),
1957}
1958
1959#[derive(Debug, Clone, Serialize, Deserialize)]
1961#[serde(untagged)]
1962pub enum UpdateCmOrderV1Error {
1963 Status4XX(models::ApiError),
1964 Status5XX(models::ApiError),
1965 UnknownValue(serde_json::Value),
1966}
1967
1968#[derive(Debug, Clone, Serialize, Deserialize)]
1970#[serde(untagged)]
1971pub enum UpdateListenKeyV1Error {
1972 Status4XX(models::ApiError),
1973 Status5XX(models::ApiError),
1974 UnknownValue(serde_json::Value),
1975}
1976
1977#[derive(Debug, Clone, Serialize, Deserialize)]
1979#[serde(untagged)]
1980pub enum UpdateUmOrderV1Error {
1981 Status4XX(models::ApiError),
1982 Status5XX(models::ApiError),
1983 UnknownValue(serde_json::Value),
1984}
1985
1986
1987pub async fn create_asset_collection_v1(configuration: &configuration::Configuration, params: CreateAssetCollectionV1Params) -> Result<models::CreateAssetCollectionV1Resp, Error<CreateAssetCollectionV1Error>> {
1989
1990 let uri_str = format!("{}/papi/v1/asset-collection", configuration.base_path);
1991 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1992
1993 let mut query_params: Vec<(String, String)> = Vec::new();
1995
1996
1997 let mut header_params = std::collections::HashMap::new();
1999
2000 if let Some(ref binance_auth) = configuration.binance_auth {
2002 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2004
2005 let body_string: Option<Vec<u8>> = None;
2007
2008 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2010 Ok(sig) => sig,
2011 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2012 };
2013
2014 query_params.push(("signature".to_string(), signature));
2016 }
2017
2018 if !query_params.is_empty() {
2020 req_builder = req_builder.query(&query_params);
2021 }
2022
2023
2024 if let Some(ref user_agent) = configuration.user_agent {
2026 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2027 }
2028
2029 for (header_name, header_value) in header_params {
2031 req_builder = req_builder.header(&header_name, &header_value);
2032 }
2033
2034 let mut multipart_form_params = std::collections::HashMap::new();
2035 multipart_form_params.insert("asset", params.asset.to_string());
2036 if let Some(param_value) = params.recv_window {
2037 multipart_form_params.insert("recvWindow", param_value.to_string());
2038 }
2039 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2040 req_builder = req_builder.form(&multipart_form_params);
2041
2042 let req = req_builder.build()?;
2043 let resp = configuration.client.execute(req).await?;
2044
2045 let status = resp.status();
2046 let content_type = resp
2047 .headers()
2048 .get("content-type")
2049 .and_then(|v| v.to_str().ok())
2050 .unwrap_or("application/octet-stream");
2051 let content_type = super::ContentType::from(content_type);
2052
2053 if !status.is_client_error() && !status.is_server_error() {
2054 let content = resp.text().await?;
2055 match content_type {
2056 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2057 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateAssetCollectionV1Resp`"))),
2058 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::CreateAssetCollectionV1Resp`")))),
2059 }
2060 } else {
2061 let content = resp.text().await?;
2062 let entity: Option<CreateAssetCollectionV1Error> = serde_json::from_str(&content).ok();
2063 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2064 }
2065}
2066
2067pub async fn create_auto_collection_v1(configuration: &configuration::Configuration, params: CreateAutoCollectionV1Params) -> Result<models::CreateAutoCollectionV1Resp, Error<CreateAutoCollectionV1Error>> {
2069
2070 let uri_str = format!("{}/papi/v1/auto-collection", configuration.base_path);
2071 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2072
2073 let mut query_params: Vec<(String, String)> = Vec::new();
2075
2076
2077 let mut header_params = std::collections::HashMap::new();
2079
2080 if let Some(ref binance_auth) = configuration.binance_auth {
2082 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2084
2085 let body_string: Option<Vec<u8>> = None;
2087
2088 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2090 Ok(sig) => sig,
2091 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2092 };
2093
2094 query_params.push(("signature".to_string(), signature));
2096 }
2097
2098 if !query_params.is_empty() {
2100 req_builder = req_builder.query(&query_params);
2101 }
2102
2103
2104 if let Some(ref user_agent) = configuration.user_agent {
2106 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2107 }
2108
2109 for (header_name, header_value) in header_params {
2111 req_builder = req_builder.header(&header_name, &header_value);
2112 }
2113
2114 let mut multipart_form_params = std::collections::HashMap::new();
2115 if let Some(param_value) = params.recv_window {
2116 multipart_form_params.insert("recvWindow", param_value.to_string());
2117 }
2118 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2119 req_builder = req_builder.form(&multipart_form_params);
2120
2121 let req = req_builder.build()?;
2122 let resp = configuration.client.execute(req).await?;
2123
2124 let status = resp.status();
2125 let content_type = resp
2126 .headers()
2127 .get("content-type")
2128 .and_then(|v| v.to_str().ok())
2129 .unwrap_or("application/octet-stream");
2130 let content_type = super::ContentType::from(content_type);
2131
2132 if !status.is_client_error() && !status.is_server_error() {
2133 let content = resp.text().await?;
2134 match content_type {
2135 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2136 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateAutoCollectionV1Resp`"))),
2137 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::CreateAutoCollectionV1Resp`")))),
2138 }
2139 } else {
2140 let content = resp.text().await?;
2141 let entity: Option<CreateAutoCollectionV1Error> = serde_json::from_str(&content).ok();
2142 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2143 }
2144}
2145
2146pub async fn create_bnb_transfer_v1(configuration: &configuration::Configuration, params: CreateBnbTransferV1Params) -> Result<models::CreateBnbTransferV1Resp, Error<CreateBnbTransferV1Error>> {
2148
2149 let uri_str = format!("{}/papi/v1/bnb-transfer", configuration.base_path);
2150 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2151
2152 let mut query_params: Vec<(String, String)> = Vec::new();
2154
2155
2156 let mut header_params = std::collections::HashMap::new();
2158
2159 if let Some(ref binance_auth) = configuration.binance_auth {
2161 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2163
2164 let body_string: Option<Vec<u8>> = None;
2166
2167 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2169 Ok(sig) => sig,
2170 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2171 };
2172
2173 query_params.push(("signature".to_string(), signature));
2175 }
2176
2177 if !query_params.is_empty() {
2179 req_builder = req_builder.query(&query_params);
2180 }
2181
2182
2183 if let Some(ref user_agent) = configuration.user_agent {
2185 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2186 }
2187
2188 for (header_name, header_value) in header_params {
2190 req_builder = req_builder.header(&header_name, &header_value);
2191 }
2192
2193 let mut multipart_form_params = std::collections::HashMap::new();
2194 multipart_form_params.insert("amount", params.amount.to_string());
2195 if let Some(param_value) = params.recv_window {
2196 multipart_form_params.insert("recvWindow", param_value.to_string());
2197 }
2198 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2199 multipart_form_params.insert("transferSide", params.transfer_side.to_string());
2200 req_builder = req_builder.form(&multipart_form_params);
2201
2202 let req = req_builder.build()?;
2203 let resp = configuration.client.execute(req).await?;
2204
2205 let status = resp.status();
2206 let content_type = resp
2207 .headers()
2208 .get("content-type")
2209 .and_then(|v| v.to_str().ok())
2210 .unwrap_or("application/octet-stream");
2211 let content_type = super::ContentType::from(content_type);
2212
2213 if !status.is_client_error() && !status.is_server_error() {
2214 let content = resp.text().await?;
2215 match content_type {
2216 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2217 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBnbTransferV1Resp`"))),
2218 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::CreateBnbTransferV1Resp`")))),
2219 }
2220 } else {
2221 let content = resp.text().await?;
2222 let entity: Option<CreateBnbTransferV1Error> = serde_json::from_str(&content).ok();
2223 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2224 }
2225}
2226
2227pub async fn create_cm_conditional_order_v1(configuration: &configuration::Configuration, params: CreateCmConditionalOrderV1Params) -> Result<models::CreateCmConditionalOrderV1Resp, Error<CreateCmConditionalOrderV1Error>> {
2229
2230 let uri_str = format!("{}/papi/v1/cm/conditional/order", configuration.base_path);
2231 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2232
2233 let mut query_params: Vec<(String, String)> = Vec::new();
2235
2236
2237 let mut header_params = std::collections::HashMap::new();
2239
2240 if let Some(ref binance_auth) = configuration.binance_auth {
2242 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2244
2245 let body_string: Option<Vec<u8>> = None;
2247
2248 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2250 Ok(sig) => sig,
2251 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2252 };
2253
2254 query_params.push(("signature".to_string(), signature));
2256 }
2257
2258 if !query_params.is_empty() {
2260 req_builder = req_builder.query(&query_params);
2261 }
2262
2263
2264 if let Some(ref user_agent) = configuration.user_agent {
2266 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2267 }
2268
2269 for (header_name, header_value) in header_params {
2271 req_builder = req_builder.header(&header_name, &header_value);
2272 }
2273
2274 let mut multipart_form_params = std::collections::HashMap::new();
2275 if let Some(param_value) = params.activation_price {
2276 multipart_form_params.insert("activationPrice", param_value.to_string());
2277 }
2278 if let Some(param_value) = params.callback_rate {
2279 multipart_form_params.insert("callbackRate", param_value.to_string());
2280 }
2281 if let Some(param_value) = params.new_client_strategy_id {
2282 multipart_form_params.insert("newClientStrategyId", param_value.to_string());
2283 }
2284 if let Some(param_value) = params.position_side {
2285 multipart_form_params.insert("positionSide", param_value.to_string());
2286 }
2287 if let Some(param_value) = params.price {
2288 multipart_form_params.insert("price", param_value.to_string());
2289 }
2290 if let Some(param_value) = params.price_protect {
2291 multipart_form_params.insert("priceProtect", param_value.to_string());
2292 }
2293 if let Some(param_value) = params.quantity {
2294 multipart_form_params.insert("quantity", param_value.to_string());
2295 }
2296 if let Some(param_value) = params.recv_window {
2297 multipart_form_params.insert("recvWindow", param_value.to_string());
2298 }
2299 if let Some(param_value) = params.reduce_only {
2300 multipart_form_params.insert("reduceOnly", param_value.to_string());
2301 }
2302 multipart_form_params.insert("side", params.side.to_string());
2303 if let Some(param_value) = params.stop_price {
2304 multipart_form_params.insert("stopPrice", param_value.to_string());
2305 }
2306 multipart_form_params.insert("strategyType", params.strategy_type.to_string());
2307 multipart_form_params.insert("symbol", params.symbol.to_string());
2308 if let Some(param_value) = params.time_in_force {
2309 multipart_form_params.insert("timeInForce", param_value.to_string());
2310 }
2311 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2312 if let Some(param_value) = params.working_type {
2313 multipart_form_params.insert("workingType", param_value.to_string());
2314 }
2315 req_builder = req_builder.form(&multipart_form_params);
2316
2317 let req = req_builder.build()?;
2318 let resp = configuration.client.execute(req).await?;
2319
2320 let status = resp.status();
2321 let content_type = resp
2322 .headers()
2323 .get("content-type")
2324 .and_then(|v| v.to_str().ok())
2325 .unwrap_or("application/octet-stream");
2326 let content_type = super::ContentType::from(content_type);
2327
2328 if !status.is_client_error() && !status.is_server_error() {
2329 let content = resp.text().await?;
2330 match content_type {
2331 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2332 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateCmConditionalOrderV1Resp`"))),
2333 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::CreateCmConditionalOrderV1Resp`")))),
2334 }
2335 } else {
2336 let content = resp.text().await?;
2337 let entity: Option<CreateCmConditionalOrderV1Error> = serde_json::from_str(&content).ok();
2338 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2339 }
2340}
2341
2342pub async fn create_cm_leverage_v1(configuration: &configuration::Configuration, params: CreateCmLeverageV1Params) -> Result<models::CreateCmLeverageV1Resp, Error<CreateCmLeverageV1Error>> {
2344
2345 let uri_str = format!("{}/papi/v1/cm/leverage", configuration.base_path);
2346 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2347
2348 let mut query_params: Vec<(String, String)> = Vec::new();
2350
2351
2352 let mut header_params = std::collections::HashMap::new();
2354
2355 if let Some(ref binance_auth) = configuration.binance_auth {
2357 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2359
2360 let body_string: Option<Vec<u8>> = None;
2362
2363 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2365 Ok(sig) => sig,
2366 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2367 };
2368
2369 query_params.push(("signature".to_string(), signature));
2371 }
2372
2373 if !query_params.is_empty() {
2375 req_builder = req_builder.query(&query_params);
2376 }
2377
2378
2379 if let Some(ref user_agent) = configuration.user_agent {
2381 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2382 }
2383
2384 for (header_name, header_value) in header_params {
2386 req_builder = req_builder.header(&header_name, &header_value);
2387 }
2388
2389 let mut multipart_form_params = std::collections::HashMap::new();
2390 multipart_form_params.insert("leverage", params.leverage.to_string());
2391 if let Some(param_value) = params.recv_window {
2392 multipart_form_params.insert("recvWindow", param_value.to_string());
2393 }
2394 multipart_form_params.insert("symbol", params.symbol.to_string());
2395 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2396 req_builder = req_builder.form(&multipart_form_params);
2397
2398 let req = req_builder.build()?;
2399 let resp = configuration.client.execute(req).await?;
2400
2401 let status = resp.status();
2402 let content_type = resp
2403 .headers()
2404 .get("content-type")
2405 .and_then(|v| v.to_str().ok())
2406 .unwrap_or("application/octet-stream");
2407 let content_type = super::ContentType::from(content_type);
2408
2409 if !status.is_client_error() && !status.is_server_error() {
2410 let content = resp.text().await?;
2411 match content_type {
2412 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2413 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateCmLeverageV1Resp`"))),
2414 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::CreateCmLeverageV1Resp`")))),
2415 }
2416 } else {
2417 let content = resp.text().await?;
2418 let entity: Option<CreateCmLeverageV1Error> = serde_json::from_str(&content).ok();
2419 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2420 }
2421}
2422
2423pub async fn create_cm_order_v1(configuration: &configuration::Configuration, params: CreateCmOrderV1Params) -> Result<models::CreateCmOrderV1Resp, Error<CreateCmOrderV1Error>> {
2425
2426 let uri_str = format!("{}/papi/v1/cm/order", configuration.base_path);
2427 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2428
2429 let mut query_params: Vec<(String, String)> = Vec::new();
2431
2432
2433 let mut header_params = std::collections::HashMap::new();
2435
2436 if let Some(ref binance_auth) = configuration.binance_auth {
2438 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2440
2441 let body_string: Option<Vec<u8>> = None;
2443
2444 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2446 Ok(sig) => sig,
2447 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2448 };
2449
2450 query_params.push(("signature".to_string(), signature));
2452 }
2453
2454 if !query_params.is_empty() {
2456 req_builder = req_builder.query(&query_params);
2457 }
2458
2459
2460 if let Some(ref user_agent) = configuration.user_agent {
2462 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2463 }
2464
2465 for (header_name, header_value) in header_params {
2467 req_builder = req_builder.header(&header_name, &header_value);
2468 }
2469
2470 let mut multipart_form_params = std::collections::HashMap::new();
2471 if let Some(param_value) = params.new_client_order_id {
2472 multipart_form_params.insert("newClientOrderId", param_value.to_string());
2473 }
2474 if let Some(param_value) = params.new_order_resp_type {
2475 multipart_form_params.insert("newOrderRespType", param_value.to_string());
2476 }
2477 if let Some(param_value) = params.position_side {
2478 multipart_form_params.insert("positionSide", param_value.to_string());
2479 }
2480 if let Some(param_value) = params.price {
2481 multipart_form_params.insert("price", param_value.to_string());
2482 }
2483 if let Some(param_value) = params.price_match {
2484 multipart_form_params.insert("priceMatch", param_value.to_string());
2485 }
2486 if let Some(param_value) = params.quantity {
2487 multipart_form_params.insert("quantity", param_value.to_string());
2488 }
2489 if let Some(param_value) = params.recv_window {
2490 multipart_form_params.insert("recvWindow", param_value.to_string());
2491 }
2492 if let Some(param_value) = params.reduce_only {
2493 multipart_form_params.insert("reduceOnly", param_value.to_string());
2494 }
2495 multipart_form_params.insert("side", params.side.to_string());
2496 multipart_form_params.insert("symbol", params.symbol.to_string());
2497 if let Some(param_value) = params.time_in_force {
2498 multipart_form_params.insert("timeInForce", param_value.to_string());
2499 }
2500 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2501 multipart_form_params.insert("type", params.r#type.to_string());
2502 req_builder = req_builder.form(&multipart_form_params);
2503
2504 let req = req_builder.build()?;
2505 let resp = configuration.client.execute(req).await?;
2506
2507 let status = resp.status();
2508 let content_type = resp
2509 .headers()
2510 .get("content-type")
2511 .and_then(|v| v.to_str().ok())
2512 .unwrap_or("application/octet-stream");
2513 let content_type = super::ContentType::from(content_type);
2514
2515 if !status.is_client_error() && !status.is_server_error() {
2516 let content = resp.text().await?;
2517 match content_type {
2518 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2519 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateCmOrderV1Resp`"))),
2520 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::CreateCmOrderV1Resp`")))),
2521 }
2522 } else {
2523 let content = resp.text().await?;
2524 let entity: Option<CreateCmOrderV1Error> = serde_json::from_str(&content).ok();
2525 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2526 }
2527}
2528
2529pub async fn create_cm_position_side_dual_v1(configuration: &configuration::Configuration, params: CreateCmPositionSideDualV1Params) -> Result<models::CreateCmPositionSideDualV1Resp, Error<CreateCmPositionSideDualV1Error>> {
2531
2532 let uri_str = format!("{}/papi/v1/cm/positionSide/dual", configuration.base_path);
2533 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2534
2535 let mut query_params: Vec<(String, String)> = Vec::new();
2537
2538
2539 let mut header_params = std::collections::HashMap::new();
2541
2542 if let Some(ref binance_auth) = configuration.binance_auth {
2544 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2546
2547 let body_string: Option<Vec<u8>> = None;
2549
2550 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2552 Ok(sig) => sig,
2553 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2554 };
2555
2556 query_params.push(("signature".to_string(), signature));
2558 }
2559
2560 if !query_params.is_empty() {
2562 req_builder = req_builder.query(&query_params);
2563 }
2564
2565
2566 if let Some(ref user_agent) = configuration.user_agent {
2568 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2569 }
2570
2571 for (header_name, header_value) in header_params {
2573 req_builder = req_builder.header(&header_name, &header_value);
2574 }
2575
2576 let mut multipart_form_params = std::collections::HashMap::new();
2577 multipart_form_params.insert("dualSidePosition", params.dual_side_position.to_string());
2578 if let Some(param_value) = params.recv_window {
2579 multipart_form_params.insert("recvWindow", param_value.to_string());
2580 }
2581 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2582 req_builder = req_builder.form(&multipart_form_params);
2583
2584 let req = req_builder.build()?;
2585 let resp = configuration.client.execute(req).await?;
2586
2587 let status = resp.status();
2588 let content_type = resp
2589 .headers()
2590 .get("content-type")
2591 .and_then(|v| v.to_str().ok())
2592 .unwrap_or("application/octet-stream");
2593 let content_type = super::ContentType::from(content_type);
2594
2595 if !status.is_client_error() && !status.is_server_error() {
2596 let content = resp.text().await?;
2597 match content_type {
2598 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2599 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateCmPositionSideDualV1Resp`"))),
2600 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::CreateCmPositionSideDualV1Resp`")))),
2601 }
2602 } else {
2603 let content = resp.text().await?;
2604 let entity: Option<CreateCmPositionSideDualV1Error> = serde_json::from_str(&content).ok();
2605 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2606 }
2607}
2608
2609pub async fn create_listen_key_v1(configuration: &configuration::Configuration) -> Result<models::CreateListenKeyV1Resp, Error<CreateListenKeyV1Error>> {
2611
2612 let uri_str = format!("{}/papi/v1/listenKey", configuration.base_path);
2613 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2614
2615 let mut query_params: Vec<(String, String)> = Vec::new();
2617
2618
2619 let mut header_params = std::collections::HashMap::new();
2621
2622 if let Some(ref binance_auth) = configuration.binance_auth {
2624 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2626
2627 let body_string: Option<Vec<u8>> = None;
2629
2630 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2632 Ok(sig) => sig,
2633 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2634 };
2635
2636 query_params.push(("signature".to_string(), signature));
2638 }
2639
2640 if !query_params.is_empty() {
2642 req_builder = req_builder.query(&query_params);
2643 }
2644
2645
2646 if let Some(ref user_agent) = configuration.user_agent {
2648 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2649 }
2650
2651 for (header_name, header_value) in header_params {
2653 req_builder = req_builder.header(&header_name, &header_value);
2654 }
2655
2656
2657 let req = req_builder.build()?;
2658 let resp = configuration.client.execute(req).await?;
2659
2660 let status = resp.status();
2661 let content_type = resp
2662 .headers()
2663 .get("content-type")
2664 .and_then(|v| v.to_str().ok())
2665 .unwrap_or("application/octet-stream");
2666 let content_type = super::ContentType::from(content_type);
2667
2668 if !status.is_client_error() && !status.is_server_error() {
2669 let content = resp.text().await?;
2670 match content_type {
2671 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2672 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateListenKeyV1Resp`"))),
2673 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::CreateListenKeyV1Resp`")))),
2674 }
2675 } else {
2676 let content = resp.text().await?;
2677 let entity: Option<CreateListenKeyV1Error> = serde_json::from_str(&content).ok();
2678 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2679 }
2680}
2681
2682pub async fn create_margin_loan_v1(configuration: &configuration::Configuration, params: CreateMarginLoanV1Params) -> Result<models::CreateMarginLoanV1Resp, Error<CreateMarginLoanV1Error>> {
2684
2685 let uri_str = format!("{}/papi/v1/marginLoan", configuration.base_path);
2686 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2687
2688 let mut query_params: Vec<(String, String)> = Vec::new();
2690
2691
2692 let mut header_params = std::collections::HashMap::new();
2694
2695 if let Some(ref binance_auth) = configuration.binance_auth {
2697 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2699
2700 let body_string: Option<Vec<u8>> = None;
2702
2703 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2705 Ok(sig) => sig,
2706 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2707 };
2708
2709 query_params.push(("signature".to_string(), signature));
2711 }
2712
2713 if !query_params.is_empty() {
2715 req_builder = req_builder.query(&query_params);
2716 }
2717
2718
2719 if let Some(ref user_agent) = configuration.user_agent {
2721 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2722 }
2723
2724 for (header_name, header_value) in header_params {
2726 req_builder = req_builder.header(&header_name, &header_value);
2727 }
2728
2729 let mut multipart_form_params = std::collections::HashMap::new();
2730 multipart_form_params.insert("amount", params.amount.to_string());
2731 multipart_form_params.insert("asset", params.asset.to_string());
2732 if let Some(param_value) = params.recv_window {
2733 multipart_form_params.insert("recvWindow", param_value.to_string());
2734 }
2735 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2736 req_builder = req_builder.form(&multipart_form_params);
2737
2738 let req = req_builder.build()?;
2739 let resp = configuration.client.execute(req).await?;
2740
2741 let status = resp.status();
2742 let content_type = resp
2743 .headers()
2744 .get("content-type")
2745 .and_then(|v| v.to_str().ok())
2746 .unwrap_or("application/octet-stream");
2747 let content_type = super::ContentType::from(content_type);
2748
2749 if !status.is_client_error() && !status.is_server_error() {
2750 let content = resp.text().await?;
2751 match content_type {
2752 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2753 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateMarginLoanV1Resp`"))),
2754 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::CreateMarginLoanV1Resp`")))),
2755 }
2756 } else {
2757 let content = resp.text().await?;
2758 let entity: Option<CreateMarginLoanV1Error> = serde_json::from_str(&content).ok();
2759 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2760 }
2761}
2762
2763pub async fn create_margin_order_oco_v1(configuration: &configuration::Configuration, params: CreateMarginOrderOcoV1Params) -> Result<models::CreateMarginOrderOcoV1Resp, Error<CreateMarginOrderOcoV1Error>> {
2765
2766 let uri_str = format!("{}/papi/v1/margin/order/oco", configuration.base_path);
2767 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2768
2769 let mut query_params: Vec<(String, String)> = Vec::new();
2771
2772
2773 let mut header_params = std::collections::HashMap::new();
2775
2776 if let Some(ref binance_auth) = configuration.binance_auth {
2778 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2780
2781 let body_string: Option<Vec<u8>> = None;
2783
2784 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2786 Ok(sig) => sig,
2787 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2788 };
2789
2790 query_params.push(("signature".to_string(), signature));
2792 }
2793
2794 if !query_params.is_empty() {
2796 req_builder = req_builder.query(&query_params);
2797 }
2798
2799
2800 if let Some(ref user_agent) = configuration.user_agent {
2802 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2803 }
2804
2805 for (header_name, header_value) in header_params {
2807 req_builder = req_builder.header(&header_name, &header_value);
2808 }
2809
2810 let mut multipart_form_params = std::collections::HashMap::new();
2811 if let Some(param_value) = params.limit_client_order_id {
2812 multipart_form_params.insert("limitClientOrderId", param_value.to_string());
2813 }
2814 if let Some(param_value) = params.limit_iceberg_qty {
2815 multipart_form_params.insert("limitIcebergQty", param_value.to_string());
2816 }
2817 if let Some(param_value) = params.list_client_order_id {
2818 multipart_form_params.insert("listClientOrderId", param_value.to_string());
2819 }
2820 if let Some(param_value) = params.new_order_resp_type {
2821 multipart_form_params.insert("newOrderRespType", param_value.to_string());
2822 }
2823 multipart_form_params.insert("price", params.price.to_string());
2824 multipart_form_params.insert("quantity", params.quantity.to_string());
2825 if let Some(param_value) = params.recv_window {
2826 multipart_form_params.insert("recvWindow", param_value.to_string());
2827 }
2828 multipart_form_params.insert("side", params.side.to_string());
2829 if let Some(param_value) = params.side_effect_type {
2830 multipart_form_params.insert("sideEffectType", param_value.to_string());
2831 }
2832 if let Some(param_value) = params.stop_client_order_id {
2833 multipart_form_params.insert("stopClientOrderId", param_value.to_string());
2834 }
2835 if let Some(param_value) = params.stop_iceberg_qty {
2836 multipart_form_params.insert("stopIcebergQty", param_value.to_string());
2837 }
2838 if let Some(param_value) = params.stop_limit_price {
2839 multipart_form_params.insert("stopLimitPrice", param_value.to_string());
2840 }
2841 if let Some(param_value) = params.stop_limit_time_in_force {
2842 multipart_form_params.insert("stopLimitTimeInForce", param_value.to_string());
2843 }
2844 multipart_form_params.insert("stopPrice", params.stop_price.to_string());
2845 multipart_form_params.insert("symbol", params.symbol.to_string());
2846 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2847 req_builder = req_builder.form(&multipart_form_params);
2848
2849 let req = req_builder.build()?;
2850 let resp = configuration.client.execute(req).await?;
2851
2852 let status = resp.status();
2853 let content_type = resp
2854 .headers()
2855 .get("content-type")
2856 .and_then(|v| v.to_str().ok())
2857 .unwrap_or("application/octet-stream");
2858 let content_type = super::ContentType::from(content_type);
2859
2860 if !status.is_client_error() && !status.is_server_error() {
2861 let content = resp.text().await?;
2862 match content_type {
2863 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2864 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateMarginOrderOcoV1Resp`"))),
2865 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::CreateMarginOrderOcoV1Resp`")))),
2866 }
2867 } else {
2868 let content = resp.text().await?;
2869 let entity: Option<CreateMarginOrderOcoV1Error> = serde_json::from_str(&content).ok();
2870 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2871 }
2872}
2873
2874pub async fn create_margin_order_v1(configuration: &configuration::Configuration, params: CreateMarginOrderV1Params) -> Result<models::CreateMarginOrderV1Resp, Error<CreateMarginOrderV1Error>> {
2876
2877 let uri_str = format!("{}/papi/v1/margin/order", configuration.base_path);
2878 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2879
2880 let mut query_params: Vec<(String, String)> = Vec::new();
2882
2883
2884 let mut header_params = std::collections::HashMap::new();
2886
2887 if let Some(ref binance_auth) = configuration.binance_auth {
2889 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2891
2892 let body_string: Option<Vec<u8>> = None;
2894
2895 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2897 Ok(sig) => sig,
2898 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2899 };
2900
2901 query_params.push(("signature".to_string(), signature));
2903 }
2904
2905 if !query_params.is_empty() {
2907 req_builder = req_builder.query(&query_params);
2908 }
2909
2910
2911 if let Some(ref user_agent) = configuration.user_agent {
2913 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2914 }
2915
2916 for (header_name, header_value) in header_params {
2918 req_builder = req_builder.header(&header_name, &header_value);
2919 }
2920
2921 let mut multipart_form_params = std::collections::HashMap::new();
2922 if let Some(param_value) = params.auto_repay_at_cancel {
2923 multipart_form_params.insert("autoRepayAtCancel", param_value.to_string());
2924 }
2925 if let Some(param_value) = params.iceberg_qty {
2926 multipart_form_params.insert("icebergQty", param_value.to_string());
2927 }
2928 if let Some(param_value) = params.new_client_order_id {
2929 multipart_form_params.insert("newClientOrderId", param_value.to_string());
2930 }
2931 if let Some(param_value) = params.new_order_resp_type {
2932 multipart_form_params.insert("newOrderRespType", param_value.to_string());
2933 }
2934 if let Some(param_value) = params.price {
2935 multipart_form_params.insert("price", param_value.to_string());
2936 }
2937 if let Some(param_value) = params.quantity {
2938 multipart_form_params.insert("quantity", param_value.to_string());
2939 }
2940 if let Some(param_value) = params.quote_order_qty {
2941 multipart_form_params.insert("quoteOrderQty", param_value.to_string());
2942 }
2943 if let Some(param_value) = params.recv_window {
2944 multipart_form_params.insert("recvWindow", param_value.to_string());
2945 }
2946 if let Some(param_value) = params.self_trade_prevention_mode {
2947 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
2948 }
2949 multipart_form_params.insert("side", params.side.to_string());
2950 if let Some(param_value) = params.side_effect_type {
2951 multipart_form_params.insert("sideEffectType", param_value.to_string());
2952 }
2953 if let Some(param_value) = params.stop_price {
2954 multipart_form_params.insert("stopPrice", param_value.to_string());
2955 }
2956 multipart_form_params.insert("symbol", params.symbol.to_string());
2957 if let Some(param_value) = params.time_in_force {
2958 multipart_form_params.insert("timeInForce", param_value.to_string());
2959 }
2960 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2961 multipart_form_params.insert("type", params.r#type.to_string());
2962 req_builder = req_builder.form(&multipart_form_params);
2963
2964 let req = req_builder.build()?;
2965 let resp = configuration.client.execute(req).await?;
2966
2967 let status = resp.status();
2968 let content_type = resp
2969 .headers()
2970 .get("content-type")
2971 .and_then(|v| v.to_str().ok())
2972 .unwrap_or("application/octet-stream");
2973 let content_type = super::ContentType::from(content_type);
2974
2975 if !status.is_client_error() && !status.is_server_error() {
2976 let content = resp.text().await?;
2977 match content_type {
2978 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2979 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateMarginOrderV1Resp`"))),
2980 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::CreateMarginOrderV1Resp`")))),
2981 }
2982 } else {
2983 let content = resp.text().await?;
2984 let entity: Option<CreateMarginOrderV1Error> = serde_json::from_str(&content).ok();
2985 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2986 }
2987}
2988
2989pub async fn create_margin_repay_debt_v1(configuration: &configuration::Configuration, params: CreateMarginRepayDebtV1Params) -> Result<models::CreateMarginRepayDebtV1Resp, Error<CreateMarginRepayDebtV1Error>> {
2991
2992 let uri_str = format!("{}/papi/v1/margin/repay-debt", configuration.base_path);
2993 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2994
2995 let mut query_params: Vec<(String, String)> = Vec::new();
2997
2998
2999 let mut header_params = std::collections::HashMap::new();
3001
3002 if let Some(ref binance_auth) = configuration.binance_auth {
3004 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3006
3007 let body_string: Option<Vec<u8>> = None;
3009
3010 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3012 Ok(sig) => sig,
3013 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3014 };
3015
3016 query_params.push(("signature".to_string(), signature));
3018 }
3019
3020 if !query_params.is_empty() {
3022 req_builder = req_builder.query(&query_params);
3023 }
3024
3025
3026 if let Some(ref user_agent) = configuration.user_agent {
3028 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3029 }
3030
3031 for (header_name, header_value) in header_params {
3033 req_builder = req_builder.header(&header_name, &header_value);
3034 }
3035
3036 let mut multipart_form_params = std::collections::HashMap::new();
3037 if let Some(param_value) = params.amount {
3038 multipart_form_params.insert("amount", param_value.to_string());
3039 }
3040 multipart_form_params.insert("asset", params.asset.to_string());
3041 if let Some(param_value) = params.recv_window {
3042 multipart_form_params.insert("recvWindow", param_value.to_string());
3043 }
3044 if let Some(param_value) = params.specify_repay_assets {
3045 multipart_form_params.insert("specifyRepayAssets", param_value.to_string());
3046 }
3047 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3048 req_builder = req_builder.form(&multipart_form_params);
3049
3050 let req = req_builder.build()?;
3051 let resp = configuration.client.execute(req).await?;
3052
3053 let status = resp.status();
3054 let content_type = resp
3055 .headers()
3056 .get("content-type")
3057 .and_then(|v| v.to_str().ok())
3058 .unwrap_or("application/octet-stream");
3059 let content_type = super::ContentType::from(content_type);
3060
3061 if !status.is_client_error() && !status.is_server_error() {
3062 let content = resp.text().await?;
3063 match content_type {
3064 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3065 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateMarginRepayDebtV1Resp`"))),
3066 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::CreateMarginRepayDebtV1Resp`")))),
3067 }
3068 } else {
3069 let content = resp.text().await?;
3070 let entity: Option<CreateMarginRepayDebtV1Error> = serde_json::from_str(&content).ok();
3071 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3072 }
3073}
3074
3075pub async fn create_repay_futures_negative_balance_v1(configuration: &configuration::Configuration, params: CreateRepayFuturesNegativeBalanceV1Params) -> Result<models::CreateRepayFuturesNegativeBalanceV1Resp, Error<CreateRepayFuturesNegativeBalanceV1Error>> {
3077
3078 let uri_str = format!("{}/papi/v1/repay-futures-negative-balance", configuration.base_path);
3079 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3080
3081 let mut query_params: Vec<(String, String)> = Vec::new();
3083
3084
3085 let mut header_params = std::collections::HashMap::new();
3087
3088 if let Some(ref binance_auth) = configuration.binance_auth {
3090 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3092
3093 let body_string: Option<Vec<u8>> = None;
3095
3096 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3098 Ok(sig) => sig,
3099 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3100 };
3101
3102 query_params.push(("signature".to_string(), signature));
3104 }
3105
3106 if !query_params.is_empty() {
3108 req_builder = req_builder.query(&query_params);
3109 }
3110
3111
3112 if let Some(ref user_agent) = configuration.user_agent {
3114 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3115 }
3116
3117 for (header_name, header_value) in header_params {
3119 req_builder = req_builder.header(&header_name, &header_value);
3120 }
3121
3122 let mut multipart_form_params = std::collections::HashMap::new();
3123 if let Some(param_value) = params.recv_window {
3124 multipart_form_params.insert("recvWindow", param_value.to_string());
3125 }
3126 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3127 req_builder = req_builder.form(&multipart_form_params);
3128
3129 let req = req_builder.build()?;
3130 let resp = configuration.client.execute(req).await?;
3131
3132 let status = resp.status();
3133 let content_type = resp
3134 .headers()
3135 .get("content-type")
3136 .and_then(|v| v.to_str().ok())
3137 .unwrap_or("application/octet-stream");
3138 let content_type = super::ContentType::from(content_type);
3139
3140 if !status.is_client_error() && !status.is_server_error() {
3141 let content = resp.text().await?;
3142 match content_type {
3143 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3144 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateRepayFuturesNegativeBalanceV1Resp`"))),
3145 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::CreateRepayFuturesNegativeBalanceV1Resp`")))),
3146 }
3147 } else {
3148 let content = resp.text().await?;
3149 let entity: Option<CreateRepayFuturesNegativeBalanceV1Error> = serde_json::from_str(&content).ok();
3150 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3151 }
3152}
3153
3154pub async fn create_repay_futures_switch_v1(configuration: &configuration::Configuration, params: CreateRepayFuturesSwitchV1Params) -> Result<models::CreateRepayFuturesSwitchV1Resp, Error<CreateRepayFuturesSwitchV1Error>> {
3156
3157 let uri_str = format!("{}/papi/v1/repay-futures-switch", configuration.base_path);
3158 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3159
3160 let mut query_params: Vec<(String, String)> = Vec::new();
3162
3163
3164 let mut header_params = std::collections::HashMap::new();
3166
3167 if let Some(ref binance_auth) = configuration.binance_auth {
3169 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3171
3172 let body_string: Option<Vec<u8>> = None;
3174
3175 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3177 Ok(sig) => sig,
3178 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3179 };
3180
3181 query_params.push(("signature".to_string(), signature));
3183 }
3184
3185 if !query_params.is_empty() {
3187 req_builder = req_builder.query(&query_params);
3188 }
3189
3190
3191 if let Some(ref user_agent) = configuration.user_agent {
3193 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3194 }
3195
3196 for (header_name, header_value) in header_params {
3198 req_builder = req_builder.header(&header_name, &header_value);
3199 }
3200
3201 let mut multipart_form_params = std::collections::HashMap::new();
3202 multipart_form_params.insert("autoRepay", params.auto_repay.to_string());
3203 if let Some(param_value) = params.recv_window {
3204 multipart_form_params.insert("recvWindow", param_value.to_string());
3205 }
3206 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3207 req_builder = req_builder.form(&multipart_form_params);
3208
3209 let req = req_builder.build()?;
3210 let resp = configuration.client.execute(req).await?;
3211
3212 let status = resp.status();
3213 let content_type = resp
3214 .headers()
3215 .get("content-type")
3216 .and_then(|v| v.to_str().ok())
3217 .unwrap_or("application/octet-stream");
3218 let content_type = super::ContentType::from(content_type);
3219
3220 if !status.is_client_error() && !status.is_server_error() {
3221 let content = resp.text().await?;
3222 match content_type {
3223 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3224 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateRepayFuturesSwitchV1Resp`"))),
3225 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::CreateRepayFuturesSwitchV1Resp`")))),
3226 }
3227 } else {
3228 let content = resp.text().await?;
3229 let entity: Option<CreateRepayFuturesSwitchV1Error> = serde_json::from_str(&content).ok();
3230 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3231 }
3232}
3233
3234pub async fn create_repay_loan_v1(configuration: &configuration::Configuration, params: CreateRepayLoanV1Params) -> Result<models::CreateRepayLoanV1Resp, Error<CreateRepayLoanV1Error>> {
3236
3237 let uri_str = format!("{}/papi/v1/repayLoan", configuration.base_path);
3238 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3239
3240 let mut query_params: Vec<(String, String)> = Vec::new();
3242
3243
3244 let mut header_params = std::collections::HashMap::new();
3246
3247 if let Some(ref binance_auth) = configuration.binance_auth {
3249 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3251
3252 let body_string: Option<Vec<u8>> = None;
3254
3255 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3257 Ok(sig) => sig,
3258 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3259 };
3260
3261 query_params.push(("signature".to_string(), signature));
3263 }
3264
3265 if !query_params.is_empty() {
3267 req_builder = req_builder.query(&query_params);
3268 }
3269
3270
3271 if let Some(ref user_agent) = configuration.user_agent {
3273 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3274 }
3275
3276 for (header_name, header_value) in header_params {
3278 req_builder = req_builder.header(&header_name, &header_value);
3279 }
3280
3281 let mut multipart_form_params = std::collections::HashMap::new();
3282 multipart_form_params.insert("amount", params.amount.to_string());
3283 multipart_form_params.insert("asset", params.asset.to_string());
3284 if let Some(param_value) = params.recv_window {
3285 multipart_form_params.insert("recvWindow", param_value.to_string());
3286 }
3287 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3288 req_builder = req_builder.form(&multipart_form_params);
3289
3290 let req = req_builder.build()?;
3291 let resp = configuration.client.execute(req).await?;
3292
3293 let status = resp.status();
3294 let content_type = resp
3295 .headers()
3296 .get("content-type")
3297 .and_then(|v| v.to_str().ok())
3298 .unwrap_or("application/octet-stream");
3299 let content_type = super::ContentType::from(content_type);
3300
3301 if !status.is_client_error() && !status.is_server_error() {
3302 let content = resp.text().await?;
3303 match content_type {
3304 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3305 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateRepayLoanV1Resp`"))),
3306 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::CreateRepayLoanV1Resp`")))),
3307 }
3308 } else {
3309 let content = resp.text().await?;
3310 let entity: Option<CreateRepayLoanV1Error> = serde_json::from_str(&content).ok();
3311 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3312 }
3313}
3314
3315pub async fn create_um_conditional_order_v1(configuration: &configuration::Configuration, params: CreateUmConditionalOrderV1Params) -> Result<models::CreateUmConditionalOrderV1Resp, Error<CreateUmConditionalOrderV1Error>> {
3317
3318 let uri_str = format!("{}/papi/v1/um/conditional/order", configuration.base_path);
3319 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3320
3321 let mut query_params: Vec<(String, String)> = Vec::new();
3323
3324
3325 let mut header_params = std::collections::HashMap::new();
3327
3328 if let Some(ref binance_auth) = configuration.binance_auth {
3330 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3332
3333 let body_string: Option<Vec<u8>> = None;
3335
3336 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3338 Ok(sig) => sig,
3339 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3340 };
3341
3342 query_params.push(("signature".to_string(), signature));
3344 }
3345
3346 if !query_params.is_empty() {
3348 req_builder = req_builder.query(&query_params);
3349 }
3350
3351
3352 if let Some(ref user_agent) = configuration.user_agent {
3354 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3355 }
3356
3357 for (header_name, header_value) in header_params {
3359 req_builder = req_builder.header(&header_name, &header_value);
3360 }
3361
3362 let mut multipart_form_params = std::collections::HashMap::new();
3363 if let Some(param_value) = params.activation_price {
3364 multipart_form_params.insert("activationPrice", param_value.to_string());
3365 }
3366 if let Some(param_value) = params.callback_rate {
3367 multipart_form_params.insert("callbackRate", param_value.to_string());
3368 }
3369 if let Some(param_value) = params.good_till_date {
3370 multipart_form_params.insert("goodTillDate", param_value.to_string());
3371 }
3372 if let Some(param_value) = params.new_client_strategy_id {
3373 multipart_form_params.insert("newClientStrategyId", param_value.to_string());
3374 }
3375 if let Some(param_value) = params.position_side {
3376 multipart_form_params.insert("positionSide", param_value.to_string());
3377 }
3378 if let Some(param_value) = params.price {
3379 multipart_form_params.insert("price", param_value.to_string());
3380 }
3381 if let Some(param_value) = params.price_match {
3382 multipart_form_params.insert("priceMatch", param_value.to_string());
3383 }
3384 if let Some(param_value) = params.price_protect {
3385 multipart_form_params.insert("priceProtect", param_value.to_string());
3386 }
3387 if let Some(param_value) = params.quantity {
3388 multipart_form_params.insert("quantity", param_value.to_string());
3389 }
3390 if let Some(param_value) = params.recv_window {
3391 multipart_form_params.insert("recvWindow", param_value.to_string());
3392 }
3393 if let Some(param_value) = params.reduce_only {
3394 multipart_form_params.insert("reduceOnly", param_value.to_string());
3395 }
3396 if let Some(param_value) = params.self_trade_prevention_mode {
3397 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
3398 }
3399 multipart_form_params.insert("side", params.side.to_string());
3400 if let Some(param_value) = params.stop_price {
3401 multipart_form_params.insert("stopPrice", param_value.to_string());
3402 }
3403 multipart_form_params.insert("strategyType", params.strategy_type.to_string());
3404 multipart_form_params.insert("symbol", params.symbol.to_string());
3405 if let Some(param_value) = params.time_in_force {
3406 multipart_form_params.insert("timeInForce", param_value.to_string());
3407 }
3408 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3409 if let Some(param_value) = params.working_type {
3410 multipart_form_params.insert("workingType", param_value.to_string());
3411 }
3412 req_builder = req_builder.form(&multipart_form_params);
3413
3414 let req = req_builder.build()?;
3415 let resp = configuration.client.execute(req).await?;
3416
3417 let status = resp.status();
3418 let content_type = resp
3419 .headers()
3420 .get("content-type")
3421 .and_then(|v| v.to_str().ok())
3422 .unwrap_or("application/octet-stream");
3423 let content_type = super::ContentType::from(content_type);
3424
3425 if !status.is_client_error() && !status.is_server_error() {
3426 let content = resp.text().await?;
3427 match content_type {
3428 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3429 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateUmConditionalOrderV1Resp`"))),
3430 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::CreateUmConditionalOrderV1Resp`")))),
3431 }
3432 } else {
3433 let content = resp.text().await?;
3434 let entity: Option<CreateUmConditionalOrderV1Error> = serde_json::from_str(&content).ok();
3435 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3436 }
3437}
3438
3439pub async fn create_um_fee_burn_v1(configuration: &configuration::Configuration, params: CreateUmFeeBurnV1Params) -> Result<models::CreateUmFeeBurnV1Resp, Error<CreateUmFeeBurnV1Error>> {
3441
3442 let uri_str = format!("{}/papi/v1/um/feeBurn", configuration.base_path);
3443 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3444
3445 let mut query_params: Vec<(String, String)> = Vec::new();
3447
3448
3449 let mut header_params = std::collections::HashMap::new();
3451
3452 if let Some(ref binance_auth) = configuration.binance_auth {
3454 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3456
3457 let body_string: Option<Vec<u8>> = None;
3459
3460 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3462 Ok(sig) => sig,
3463 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3464 };
3465
3466 query_params.push(("signature".to_string(), signature));
3468 }
3469
3470 if !query_params.is_empty() {
3472 req_builder = req_builder.query(&query_params);
3473 }
3474
3475
3476 if let Some(ref user_agent) = configuration.user_agent {
3478 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3479 }
3480
3481 for (header_name, header_value) in header_params {
3483 req_builder = req_builder.header(&header_name, &header_value);
3484 }
3485
3486 let mut multipart_form_params = std::collections::HashMap::new();
3487 multipart_form_params.insert("feeBurn", params.fee_burn.to_string());
3488 if let Some(param_value) = params.recv_window {
3489 multipart_form_params.insert("recvWindow", param_value.to_string());
3490 }
3491 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3492 req_builder = req_builder.form(&multipart_form_params);
3493
3494 let req = req_builder.build()?;
3495 let resp = configuration.client.execute(req).await?;
3496
3497 let status = resp.status();
3498 let content_type = resp
3499 .headers()
3500 .get("content-type")
3501 .and_then(|v| v.to_str().ok())
3502 .unwrap_or("application/octet-stream");
3503 let content_type = super::ContentType::from(content_type);
3504
3505 if !status.is_client_error() && !status.is_server_error() {
3506 let content = resp.text().await?;
3507 match content_type {
3508 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3509 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateUmFeeBurnV1Resp`"))),
3510 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::CreateUmFeeBurnV1Resp`")))),
3511 }
3512 } else {
3513 let content = resp.text().await?;
3514 let entity: Option<CreateUmFeeBurnV1Error> = serde_json::from_str(&content).ok();
3515 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3516 }
3517}
3518
3519pub async fn create_um_leverage_v1(configuration: &configuration::Configuration, params: CreateUmLeverageV1Params) -> Result<models::CreateUmLeverageV1Resp, Error<CreateUmLeverageV1Error>> {
3521
3522 let uri_str = format!("{}/papi/v1/um/leverage", configuration.base_path);
3523 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3524
3525 let mut query_params: Vec<(String, String)> = Vec::new();
3527
3528
3529 let mut header_params = std::collections::HashMap::new();
3531
3532 if let Some(ref binance_auth) = configuration.binance_auth {
3534 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3536
3537 let body_string: Option<Vec<u8>> = None;
3539
3540 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3542 Ok(sig) => sig,
3543 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3544 };
3545
3546 query_params.push(("signature".to_string(), signature));
3548 }
3549
3550 if !query_params.is_empty() {
3552 req_builder = req_builder.query(&query_params);
3553 }
3554
3555
3556 if let Some(ref user_agent) = configuration.user_agent {
3558 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3559 }
3560
3561 for (header_name, header_value) in header_params {
3563 req_builder = req_builder.header(&header_name, &header_value);
3564 }
3565
3566 let mut multipart_form_params = std::collections::HashMap::new();
3567 multipart_form_params.insert("leverage", params.leverage.to_string());
3568 if let Some(param_value) = params.recv_window {
3569 multipart_form_params.insert("recvWindow", param_value.to_string());
3570 }
3571 multipart_form_params.insert("symbol", params.symbol.to_string());
3572 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3573 req_builder = req_builder.form(&multipart_form_params);
3574
3575 let req = req_builder.build()?;
3576 let resp = configuration.client.execute(req).await?;
3577
3578 let status = resp.status();
3579 let content_type = resp
3580 .headers()
3581 .get("content-type")
3582 .and_then(|v| v.to_str().ok())
3583 .unwrap_or("application/octet-stream");
3584 let content_type = super::ContentType::from(content_type);
3585
3586 if !status.is_client_error() && !status.is_server_error() {
3587 let content = resp.text().await?;
3588 match content_type {
3589 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3590 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateUmLeverageV1Resp`"))),
3591 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::CreateUmLeverageV1Resp`")))),
3592 }
3593 } else {
3594 let content = resp.text().await?;
3595 let entity: Option<CreateUmLeverageV1Error> = serde_json::from_str(&content).ok();
3596 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3597 }
3598}
3599
3600pub async fn create_um_order_v1(configuration: &configuration::Configuration, params: CreateUmOrderV1Params) -> Result<models::CreateUmOrderV1Resp, Error<CreateUmOrderV1Error>> {
3602
3603 let uri_str = format!("{}/papi/v1/um/order", configuration.base_path);
3604 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3605
3606 let mut query_params: Vec<(String, String)> = Vec::new();
3608
3609
3610 let mut header_params = std::collections::HashMap::new();
3612
3613 if let Some(ref binance_auth) = configuration.binance_auth {
3615 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3617
3618 let body_string: Option<Vec<u8>> = None;
3620
3621 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3623 Ok(sig) => sig,
3624 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3625 };
3626
3627 query_params.push(("signature".to_string(), signature));
3629 }
3630
3631 if !query_params.is_empty() {
3633 req_builder = req_builder.query(&query_params);
3634 }
3635
3636
3637 if let Some(ref user_agent) = configuration.user_agent {
3639 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3640 }
3641
3642 for (header_name, header_value) in header_params {
3644 req_builder = req_builder.header(&header_name, &header_value);
3645 }
3646
3647 let mut multipart_form_params = std::collections::HashMap::new();
3648 if let Some(param_value) = params.good_till_date {
3649 multipart_form_params.insert("goodTillDate", param_value.to_string());
3650 }
3651 if let Some(param_value) = params.new_client_order_id {
3652 multipart_form_params.insert("newClientOrderId", param_value.to_string());
3653 }
3654 if let Some(param_value) = params.new_order_resp_type {
3655 multipart_form_params.insert("newOrderRespType", param_value.to_string());
3656 }
3657 if let Some(param_value) = params.position_side {
3658 multipart_form_params.insert("positionSide", param_value.to_string());
3659 }
3660 if let Some(param_value) = params.price {
3661 multipart_form_params.insert("price", param_value.to_string());
3662 }
3663 if let Some(param_value) = params.price_match {
3664 multipart_form_params.insert("priceMatch", param_value.to_string());
3665 }
3666 if let Some(param_value) = params.quantity {
3667 multipart_form_params.insert("quantity", param_value.to_string());
3668 }
3669 if let Some(param_value) = params.recv_window {
3670 multipart_form_params.insert("recvWindow", param_value.to_string());
3671 }
3672 if let Some(param_value) = params.reduce_only {
3673 multipart_form_params.insert("reduceOnly", param_value.to_string());
3674 }
3675 if let Some(param_value) = params.self_trade_prevention_mode {
3676 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
3677 }
3678 multipart_form_params.insert("side", params.side.to_string());
3679 multipart_form_params.insert("symbol", params.symbol.to_string());
3680 if let Some(param_value) = params.time_in_force {
3681 multipart_form_params.insert("timeInForce", param_value.to_string());
3682 }
3683 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3684 multipart_form_params.insert("type", params.r#type.to_string());
3685 req_builder = req_builder.form(&multipart_form_params);
3686
3687 let req = req_builder.build()?;
3688 let resp = configuration.client.execute(req).await?;
3689
3690 let status = resp.status();
3691 let content_type = resp
3692 .headers()
3693 .get("content-type")
3694 .and_then(|v| v.to_str().ok())
3695 .unwrap_or("application/octet-stream");
3696 let content_type = super::ContentType::from(content_type);
3697
3698 if !status.is_client_error() && !status.is_server_error() {
3699 let content = resp.text().await?;
3700 match content_type {
3701 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3702 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateUmOrderV1Resp`"))),
3703 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::CreateUmOrderV1Resp`")))),
3704 }
3705 } else {
3706 let content = resp.text().await?;
3707 let entity: Option<CreateUmOrderV1Error> = serde_json::from_str(&content).ok();
3708 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3709 }
3710}
3711
3712pub async fn create_um_position_side_dual_v1(configuration: &configuration::Configuration, params: CreateUmPositionSideDualV1Params) -> Result<models::CreateUmPositionSideDualV1Resp, Error<CreateUmPositionSideDualV1Error>> {
3714
3715 let uri_str = format!("{}/papi/v1/um/positionSide/dual", configuration.base_path);
3716 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3717
3718 let mut query_params: Vec<(String, String)> = Vec::new();
3720
3721
3722 let mut header_params = std::collections::HashMap::new();
3724
3725 if let Some(ref binance_auth) = configuration.binance_auth {
3727 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3729
3730 let body_string: Option<Vec<u8>> = None;
3732
3733 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3735 Ok(sig) => sig,
3736 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3737 };
3738
3739 query_params.push(("signature".to_string(), signature));
3741 }
3742
3743 if !query_params.is_empty() {
3745 req_builder = req_builder.query(&query_params);
3746 }
3747
3748
3749 if let Some(ref user_agent) = configuration.user_agent {
3751 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3752 }
3753
3754 for (header_name, header_value) in header_params {
3756 req_builder = req_builder.header(&header_name, &header_value);
3757 }
3758
3759 let mut multipart_form_params = std::collections::HashMap::new();
3760 multipart_form_params.insert("dualSidePosition", params.dual_side_position.to_string());
3761 if let Some(param_value) = params.recv_window {
3762 multipart_form_params.insert("recvWindow", param_value.to_string());
3763 }
3764 multipart_form_params.insert("timestamp", params.timestamp.to_string());
3765 req_builder = req_builder.form(&multipart_form_params);
3766
3767 let req = req_builder.build()?;
3768 let resp = configuration.client.execute(req).await?;
3769
3770 let status = resp.status();
3771 let content_type = resp
3772 .headers()
3773 .get("content-type")
3774 .and_then(|v| v.to_str().ok())
3775 .unwrap_or("application/octet-stream");
3776 let content_type = super::ContentType::from(content_type);
3777
3778 if !status.is_client_error() && !status.is_server_error() {
3779 let content = resp.text().await?;
3780 match content_type {
3781 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3782 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateUmPositionSideDualV1Resp`"))),
3783 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::CreateUmPositionSideDualV1Resp`")))),
3784 }
3785 } else {
3786 let content = resp.text().await?;
3787 let entity: Option<CreateUmPositionSideDualV1Error> = serde_json::from_str(&content).ok();
3788 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3789 }
3790}
3791
3792pub async fn delete_cm_all_open_orders_v1(configuration: &configuration::Configuration, params: DeleteCmAllOpenOrdersV1Params) -> Result<models::DeleteCmAllOpenOrdersV1Resp, Error<DeleteCmAllOpenOrdersV1Error>> {
3794
3795 let uri_str = format!("{}/papi/v1/cm/allOpenOrders", configuration.base_path);
3796 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3797
3798 let mut query_params: Vec<(String, String)> = Vec::new();
3800
3801 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3802 if let Some(ref param_value) = params.recv_window {
3803 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3804 }
3805 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3806
3807 let mut header_params = std::collections::HashMap::new();
3809
3810 if let Some(ref binance_auth) = configuration.binance_auth {
3812 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3814
3815 let body_string: Option<Vec<u8>> = None;
3817
3818 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3820 Ok(sig) => sig,
3821 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3822 };
3823
3824 query_params.push(("signature".to_string(), signature));
3826 }
3827
3828 if !query_params.is_empty() {
3830 req_builder = req_builder.query(&query_params);
3831 }
3832
3833
3834 if let Some(ref user_agent) = configuration.user_agent {
3836 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3837 }
3838
3839 for (header_name, header_value) in header_params {
3841 req_builder = req_builder.header(&header_name, &header_value);
3842 }
3843
3844
3845 let req = req_builder.build()?;
3846 let resp = configuration.client.execute(req).await?;
3847
3848 let status = resp.status();
3849 let content_type = resp
3850 .headers()
3851 .get("content-type")
3852 .and_then(|v| v.to_str().ok())
3853 .unwrap_or("application/octet-stream");
3854 let content_type = super::ContentType::from(content_type);
3855
3856 if !status.is_client_error() && !status.is_server_error() {
3857 let content = resp.text().await?;
3858 match content_type {
3859 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3860 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteCmAllOpenOrdersV1Resp`"))),
3861 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::DeleteCmAllOpenOrdersV1Resp`")))),
3862 }
3863 } else {
3864 let content = resp.text().await?;
3865 let entity: Option<DeleteCmAllOpenOrdersV1Error> = serde_json::from_str(&content).ok();
3866 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3867 }
3868}
3869
3870pub async fn delete_cm_conditional_all_open_orders_v1(configuration: &configuration::Configuration, params: DeleteCmConditionalAllOpenOrdersV1Params) -> Result<models::DeleteCmConditionalAllOpenOrdersV1Resp, Error<DeleteCmConditionalAllOpenOrdersV1Error>> {
3872
3873 let uri_str = format!("{}/papi/v1/cm/conditional/allOpenOrders", configuration.base_path);
3874 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3875
3876 let mut query_params: Vec<(String, String)> = Vec::new();
3878
3879 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3880 if let Some(ref param_value) = params.recv_window {
3881 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3882 }
3883 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3884
3885 let mut header_params = std::collections::HashMap::new();
3887
3888 if let Some(ref binance_auth) = configuration.binance_auth {
3890 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3892
3893 let body_string: Option<Vec<u8>> = None;
3895
3896 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3898 Ok(sig) => sig,
3899 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3900 };
3901
3902 query_params.push(("signature".to_string(), signature));
3904 }
3905
3906 if !query_params.is_empty() {
3908 req_builder = req_builder.query(&query_params);
3909 }
3910
3911
3912 if let Some(ref user_agent) = configuration.user_agent {
3914 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3915 }
3916
3917 for (header_name, header_value) in header_params {
3919 req_builder = req_builder.header(&header_name, &header_value);
3920 }
3921
3922
3923 let req = req_builder.build()?;
3924 let resp = configuration.client.execute(req).await?;
3925
3926 let status = resp.status();
3927 let content_type = resp
3928 .headers()
3929 .get("content-type")
3930 .and_then(|v| v.to_str().ok())
3931 .unwrap_or("application/octet-stream");
3932 let content_type = super::ContentType::from(content_type);
3933
3934 if !status.is_client_error() && !status.is_server_error() {
3935 let content = resp.text().await?;
3936 match content_type {
3937 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3938 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteCmConditionalAllOpenOrdersV1Resp`"))),
3939 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::DeleteCmConditionalAllOpenOrdersV1Resp`")))),
3940 }
3941 } else {
3942 let content = resp.text().await?;
3943 let entity: Option<DeleteCmConditionalAllOpenOrdersV1Error> = serde_json::from_str(&content).ok();
3944 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3945 }
3946}
3947
3948pub async fn delete_cm_conditional_order_v1(configuration: &configuration::Configuration, params: DeleteCmConditionalOrderV1Params) -> Result<models::DeleteCmConditionalOrderV1Resp, Error<DeleteCmConditionalOrderV1Error>> {
3950
3951 let uri_str = format!("{}/papi/v1/cm/conditional/order", configuration.base_path);
3952 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3953
3954 let mut query_params: Vec<(String, String)> = Vec::new();
3956
3957 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3958 if let Some(ref param_value) = params.strategy_id {
3959 query_params.push(("strategyId".to_string(), param_value.to_string()));
3960 }
3961 if let Some(ref param_value) = params.new_client_strategy_id {
3962 query_params.push(("newClientStrategyId".to_string(), param_value.to_string()));
3963 }
3964 if let Some(ref param_value) = params.recv_window {
3965 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3966 }
3967 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3968
3969 let mut header_params = std::collections::HashMap::new();
3971
3972 if let Some(ref binance_auth) = configuration.binance_auth {
3974 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3976
3977 let body_string: Option<Vec<u8>> = None;
3979
3980 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3982 Ok(sig) => sig,
3983 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3984 };
3985
3986 query_params.push(("signature".to_string(), signature));
3988 }
3989
3990 if !query_params.is_empty() {
3992 req_builder = req_builder.query(&query_params);
3993 }
3994
3995
3996 if let Some(ref user_agent) = configuration.user_agent {
3998 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3999 }
4000
4001 for (header_name, header_value) in header_params {
4003 req_builder = req_builder.header(&header_name, &header_value);
4004 }
4005
4006
4007 let req = req_builder.build()?;
4008 let resp = configuration.client.execute(req).await?;
4009
4010 let status = resp.status();
4011 let content_type = resp
4012 .headers()
4013 .get("content-type")
4014 .and_then(|v| v.to_str().ok())
4015 .unwrap_or("application/octet-stream");
4016 let content_type = super::ContentType::from(content_type);
4017
4018 if !status.is_client_error() && !status.is_server_error() {
4019 let content = resp.text().await?;
4020 match content_type {
4021 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4022 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteCmConditionalOrderV1Resp`"))),
4023 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::DeleteCmConditionalOrderV1Resp`")))),
4024 }
4025 } else {
4026 let content = resp.text().await?;
4027 let entity: Option<DeleteCmConditionalOrderV1Error> = serde_json::from_str(&content).ok();
4028 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4029 }
4030}
4031
4032pub async fn delete_cm_order_v1(configuration: &configuration::Configuration, params: DeleteCmOrderV1Params) -> Result<models::DeleteCmOrderV1Resp, Error<DeleteCmOrderV1Error>> {
4034
4035 let uri_str = format!("{}/papi/v1/cm/order", configuration.base_path);
4036 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4037
4038 let mut query_params: Vec<(String, String)> = Vec::new();
4040
4041 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4042 if let Some(ref param_value) = params.order_id {
4043 query_params.push(("orderId".to_string(), param_value.to_string()));
4044 }
4045 if let Some(ref param_value) = params.orig_client_order_id {
4046 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
4047 }
4048 if let Some(ref param_value) = params.recv_window {
4049 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4050 }
4051 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4052
4053 let mut header_params = std::collections::HashMap::new();
4055
4056 if let Some(ref binance_auth) = configuration.binance_auth {
4058 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4060
4061 let body_string: Option<Vec<u8>> = None;
4063
4064 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4066 Ok(sig) => sig,
4067 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4068 };
4069
4070 query_params.push(("signature".to_string(), signature));
4072 }
4073
4074 if !query_params.is_empty() {
4076 req_builder = req_builder.query(&query_params);
4077 }
4078
4079
4080 if let Some(ref user_agent) = configuration.user_agent {
4082 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4083 }
4084
4085 for (header_name, header_value) in header_params {
4087 req_builder = req_builder.header(&header_name, &header_value);
4088 }
4089
4090
4091 let req = req_builder.build()?;
4092 let resp = configuration.client.execute(req).await?;
4093
4094 let status = resp.status();
4095 let content_type = resp
4096 .headers()
4097 .get("content-type")
4098 .and_then(|v| v.to_str().ok())
4099 .unwrap_or("application/octet-stream");
4100 let content_type = super::ContentType::from(content_type);
4101
4102 if !status.is_client_error() && !status.is_server_error() {
4103 let content = resp.text().await?;
4104 match content_type {
4105 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4106 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteCmOrderV1Resp`"))),
4107 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::DeleteCmOrderV1Resp`")))),
4108 }
4109 } else {
4110 let content = resp.text().await?;
4111 let entity: Option<DeleteCmOrderV1Error> = serde_json::from_str(&content).ok();
4112 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4113 }
4114}
4115
4116pub async fn delete_listen_key_v1(configuration: &configuration::Configuration) -> Result<serde_json::Value, Error<DeleteListenKeyV1Error>> {
4118
4119 let uri_str = format!("{}/papi/v1/listenKey", configuration.base_path);
4120 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4121
4122 let mut query_params: Vec<(String, String)> = Vec::new();
4124
4125
4126 let mut header_params = std::collections::HashMap::new();
4128
4129 if let Some(ref binance_auth) = configuration.binance_auth {
4131 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4133
4134 let body_string: Option<Vec<u8>> = None;
4136
4137 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4139 Ok(sig) => sig,
4140 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4141 };
4142
4143 query_params.push(("signature".to_string(), signature));
4145 }
4146
4147 if !query_params.is_empty() {
4149 req_builder = req_builder.query(&query_params);
4150 }
4151
4152
4153 if let Some(ref user_agent) = configuration.user_agent {
4155 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4156 }
4157
4158 for (header_name, header_value) in header_params {
4160 req_builder = req_builder.header(&header_name, &header_value);
4161 }
4162
4163
4164 let req = req_builder.build()?;
4165 let resp = configuration.client.execute(req).await?;
4166
4167 let status = resp.status();
4168 let content_type = resp
4169 .headers()
4170 .get("content-type")
4171 .and_then(|v| v.to_str().ok())
4172 .unwrap_or("application/octet-stream");
4173 let content_type = super::ContentType::from(content_type);
4174
4175 if !status.is_client_error() && !status.is_server_error() {
4176 let content = resp.text().await?;
4177 match content_type {
4178 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4179 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
4180 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
4181 }
4182 } else {
4183 let content = resp.text().await?;
4184 let entity: Option<DeleteListenKeyV1Error> = serde_json::from_str(&content).ok();
4185 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4186 }
4187}
4188
4189pub async fn delete_margin_all_open_orders_v1(configuration: &configuration::Configuration, params: DeleteMarginAllOpenOrdersV1Params) -> Result<Vec<models::PmarginDeleteMarginAllOpenOrdersV1RespInner>, Error<DeleteMarginAllOpenOrdersV1Error>> {
4191
4192 let uri_str = format!("{}/papi/v1/margin/allOpenOrders", configuration.base_path);
4193 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4194
4195 let mut query_params: Vec<(String, String)> = Vec::new();
4197
4198 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4199 if let Some(ref param_value) = params.recv_window {
4200 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4201 }
4202 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4203
4204 let mut header_params = std::collections::HashMap::new();
4206
4207 if let Some(ref binance_auth) = configuration.binance_auth {
4209 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4211
4212 let body_string: Option<Vec<u8>> = None;
4214
4215 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4217 Ok(sig) => sig,
4218 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4219 };
4220
4221 query_params.push(("signature".to_string(), signature));
4223 }
4224
4225 if !query_params.is_empty() {
4227 req_builder = req_builder.query(&query_params);
4228 }
4229
4230
4231 if let Some(ref user_agent) = configuration.user_agent {
4233 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4234 }
4235
4236 for (header_name, header_value) in header_params {
4238 req_builder = req_builder.header(&header_name, &header_value);
4239 }
4240
4241
4242 let req = req_builder.build()?;
4243 let resp = configuration.client.execute(req).await?;
4244
4245 let status = resp.status();
4246 let content_type = resp
4247 .headers()
4248 .get("content-type")
4249 .and_then(|v| v.to_str().ok())
4250 .unwrap_or("application/octet-stream");
4251 let content_type = super::ContentType::from(content_type);
4252
4253 if !status.is_client_error() && !status.is_server_error() {
4254 let content = resp.text().await?;
4255 match content_type {
4256 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4257 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PmarginDeleteMarginAllOpenOrdersV1RespInner>`"))),
4258 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::PmarginDeleteMarginAllOpenOrdersV1RespInner>`")))),
4259 }
4260 } else {
4261 let content = resp.text().await?;
4262 let entity: Option<DeleteMarginAllOpenOrdersV1Error> = serde_json::from_str(&content).ok();
4263 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4264 }
4265}
4266
4267pub async fn delete_margin_order_list_v1(configuration: &configuration::Configuration, params: DeleteMarginOrderListV1Params) -> Result<models::DeleteMarginOrderListV1Resp, Error<DeleteMarginOrderListV1Error>> {
4269
4270 let uri_str = format!("{}/papi/v1/margin/orderList", configuration.base_path);
4271 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4272
4273 let mut query_params: Vec<(String, String)> = Vec::new();
4275
4276 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4277 if let Some(ref param_value) = params.order_list_id {
4278 query_params.push(("orderListId".to_string(), param_value.to_string()));
4279 }
4280 if let Some(ref param_value) = params.list_client_order_id {
4281 query_params.push(("listClientOrderId".to_string(), param_value.to_string()));
4282 }
4283 if let Some(ref param_value) = params.new_client_order_id {
4284 query_params.push(("newClientOrderId".to_string(), param_value.to_string()));
4285 }
4286 if let Some(ref param_value) = params.recv_window {
4287 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4288 }
4289 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4290
4291 let mut header_params = std::collections::HashMap::new();
4293
4294 if let Some(ref binance_auth) = configuration.binance_auth {
4296 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4298
4299 let body_string: Option<Vec<u8>> = None;
4301
4302 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4304 Ok(sig) => sig,
4305 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4306 };
4307
4308 query_params.push(("signature".to_string(), signature));
4310 }
4311
4312 if !query_params.is_empty() {
4314 req_builder = req_builder.query(&query_params);
4315 }
4316
4317
4318 if let Some(ref user_agent) = configuration.user_agent {
4320 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4321 }
4322
4323 for (header_name, header_value) in header_params {
4325 req_builder = req_builder.header(&header_name, &header_value);
4326 }
4327
4328
4329 let req = req_builder.build()?;
4330 let resp = configuration.client.execute(req).await?;
4331
4332 let status = resp.status();
4333 let content_type = resp
4334 .headers()
4335 .get("content-type")
4336 .and_then(|v| v.to_str().ok())
4337 .unwrap_or("application/octet-stream");
4338 let content_type = super::ContentType::from(content_type);
4339
4340 if !status.is_client_error() && !status.is_server_error() {
4341 let content = resp.text().await?;
4342 match content_type {
4343 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4344 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteMarginOrderListV1Resp`"))),
4345 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::DeleteMarginOrderListV1Resp`")))),
4346 }
4347 } else {
4348 let content = resp.text().await?;
4349 let entity: Option<DeleteMarginOrderListV1Error> = serde_json::from_str(&content).ok();
4350 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4351 }
4352}
4353
4354pub async fn delete_margin_order_v1(configuration: &configuration::Configuration, params: DeleteMarginOrderV1Params) -> Result<models::DeleteMarginOrderV1Resp, Error<DeleteMarginOrderV1Error>> {
4356
4357 let uri_str = format!("{}/papi/v1/margin/order", configuration.base_path);
4358 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4359
4360 let mut query_params: Vec<(String, String)> = Vec::new();
4362
4363 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4364 if let Some(ref param_value) = params.order_id {
4365 query_params.push(("orderId".to_string(), param_value.to_string()));
4366 }
4367 if let Some(ref param_value) = params.orig_client_order_id {
4368 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
4369 }
4370 if let Some(ref param_value) = params.new_client_order_id {
4371 query_params.push(("newClientOrderId".to_string(), param_value.to_string()));
4372 }
4373 if let Some(ref param_value) = params.recv_window {
4374 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4375 }
4376 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4377
4378 let mut header_params = std::collections::HashMap::new();
4380
4381 if let Some(ref binance_auth) = configuration.binance_auth {
4383 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4385
4386 let body_string: Option<Vec<u8>> = None;
4388
4389 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4391 Ok(sig) => sig,
4392 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4393 };
4394
4395 query_params.push(("signature".to_string(), signature));
4397 }
4398
4399 if !query_params.is_empty() {
4401 req_builder = req_builder.query(&query_params);
4402 }
4403
4404
4405 if let Some(ref user_agent) = configuration.user_agent {
4407 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4408 }
4409
4410 for (header_name, header_value) in header_params {
4412 req_builder = req_builder.header(&header_name, &header_value);
4413 }
4414
4415
4416 let req = req_builder.build()?;
4417 let resp = configuration.client.execute(req).await?;
4418
4419 let status = resp.status();
4420 let content_type = resp
4421 .headers()
4422 .get("content-type")
4423 .and_then(|v| v.to_str().ok())
4424 .unwrap_or("application/octet-stream");
4425 let content_type = super::ContentType::from(content_type);
4426
4427 if !status.is_client_error() && !status.is_server_error() {
4428 let content = resp.text().await?;
4429 match content_type {
4430 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4431 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteMarginOrderV1Resp`"))),
4432 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::DeleteMarginOrderV1Resp`")))),
4433 }
4434 } else {
4435 let content = resp.text().await?;
4436 let entity: Option<DeleteMarginOrderV1Error> = serde_json::from_str(&content).ok();
4437 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4438 }
4439}
4440
4441pub async fn delete_um_all_open_orders_v1(configuration: &configuration::Configuration, params: DeleteUmAllOpenOrdersV1Params) -> Result<models::DeleteUmAllOpenOrdersV1Resp, Error<DeleteUmAllOpenOrdersV1Error>> {
4443
4444 let uri_str = format!("{}/papi/v1/um/allOpenOrders", configuration.base_path);
4445 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4446
4447 let mut query_params: Vec<(String, String)> = Vec::new();
4449
4450 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4451 if let Some(ref param_value) = params.recv_window {
4452 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4453 }
4454 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4455
4456 let mut header_params = std::collections::HashMap::new();
4458
4459 if let Some(ref binance_auth) = configuration.binance_auth {
4461 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4463
4464 let body_string: Option<Vec<u8>> = None;
4466
4467 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4469 Ok(sig) => sig,
4470 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4471 };
4472
4473 query_params.push(("signature".to_string(), signature));
4475 }
4476
4477 if !query_params.is_empty() {
4479 req_builder = req_builder.query(&query_params);
4480 }
4481
4482
4483 if let Some(ref user_agent) = configuration.user_agent {
4485 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4486 }
4487
4488 for (header_name, header_value) in header_params {
4490 req_builder = req_builder.header(&header_name, &header_value);
4491 }
4492
4493
4494 let req = req_builder.build()?;
4495 let resp = configuration.client.execute(req).await?;
4496
4497 let status = resp.status();
4498 let content_type = resp
4499 .headers()
4500 .get("content-type")
4501 .and_then(|v| v.to_str().ok())
4502 .unwrap_or("application/octet-stream");
4503 let content_type = super::ContentType::from(content_type);
4504
4505 if !status.is_client_error() && !status.is_server_error() {
4506 let content = resp.text().await?;
4507 match content_type {
4508 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4509 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteUmAllOpenOrdersV1Resp`"))),
4510 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::DeleteUmAllOpenOrdersV1Resp`")))),
4511 }
4512 } else {
4513 let content = resp.text().await?;
4514 let entity: Option<DeleteUmAllOpenOrdersV1Error> = serde_json::from_str(&content).ok();
4515 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4516 }
4517}
4518
4519pub async fn delete_um_conditional_all_open_orders_v1(configuration: &configuration::Configuration, params: DeleteUmConditionalAllOpenOrdersV1Params) -> Result<models::DeleteUmConditionalAllOpenOrdersV1Resp, Error<DeleteUmConditionalAllOpenOrdersV1Error>> {
4521
4522 let uri_str = format!("{}/papi/v1/um/conditional/allOpenOrders", configuration.base_path);
4523 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4524
4525 let mut query_params: Vec<(String, String)> = Vec::new();
4527
4528 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4529 if let Some(ref param_value) = params.recv_window {
4530 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4531 }
4532 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4533
4534 let mut header_params = std::collections::HashMap::new();
4536
4537 if let Some(ref binance_auth) = configuration.binance_auth {
4539 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4541
4542 let body_string: Option<Vec<u8>> = None;
4544
4545 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4547 Ok(sig) => sig,
4548 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4549 };
4550
4551 query_params.push(("signature".to_string(), signature));
4553 }
4554
4555 if !query_params.is_empty() {
4557 req_builder = req_builder.query(&query_params);
4558 }
4559
4560
4561 if let Some(ref user_agent) = configuration.user_agent {
4563 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4564 }
4565
4566 for (header_name, header_value) in header_params {
4568 req_builder = req_builder.header(&header_name, &header_value);
4569 }
4570
4571
4572 let req = req_builder.build()?;
4573 let resp = configuration.client.execute(req).await?;
4574
4575 let status = resp.status();
4576 let content_type = resp
4577 .headers()
4578 .get("content-type")
4579 .and_then(|v| v.to_str().ok())
4580 .unwrap_or("application/octet-stream");
4581 let content_type = super::ContentType::from(content_type);
4582
4583 if !status.is_client_error() && !status.is_server_error() {
4584 let content = resp.text().await?;
4585 match content_type {
4586 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4587 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteUmConditionalAllOpenOrdersV1Resp`"))),
4588 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::DeleteUmConditionalAllOpenOrdersV1Resp`")))),
4589 }
4590 } else {
4591 let content = resp.text().await?;
4592 let entity: Option<DeleteUmConditionalAllOpenOrdersV1Error> = serde_json::from_str(&content).ok();
4593 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4594 }
4595}
4596
4597pub async fn delete_um_conditional_order_v1(configuration: &configuration::Configuration, params: DeleteUmConditionalOrderV1Params) -> Result<models::DeleteUmConditionalOrderV1Resp, Error<DeleteUmConditionalOrderV1Error>> {
4599
4600 let uri_str = format!("{}/papi/v1/um/conditional/order", configuration.base_path);
4601 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4602
4603 let mut query_params: Vec<(String, String)> = Vec::new();
4605
4606 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4607 if let Some(ref param_value) = params.strategy_id {
4608 query_params.push(("strategyId".to_string(), param_value.to_string()));
4609 }
4610 if let Some(ref param_value) = params.new_client_strategy_id {
4611 query_params.push(("newClientStrategyId".to_string(), param_value.to_string()));
4612 }
4613 if let Some(ref param_value) = params.recv_window {
4614 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4615 }
4616 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4617
4618 let mut header_params = std::collections::HashMap::new();
4620
4621 if let Some(ref binance_auth) = configuration.binance_auth {
4623 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4625
4626 let body_string: Option<Vec<u8>> = None;
4628
4629 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4631 Ok(sig) => sig,
4632 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4633 };
4634
4635 query_params.push(("signature".to_string(), signature));
4637 }
4638
4639 if !query_params.is_empty() {
4641 req_builder = req_builder.query(&query_params);
4642 }
4643
4644
4645 if let Some(ref user_agent) = configuration.user_agent {
4647 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4648 }
4649
4650 for (header_name, header_value) in header_params {
4652 req_builder = req_builder.header(&header_name, &header_value);
4653 }
4654
4655
4656 let req = req_builder.build()?;
4657 let resp = configuration.client.execute(req).await?;
4658
4659 let status = resp.status();
4660 let content_type = resp
4661 .headers()
4662 .get("content-type")
4663 .and_then(|v| v.to_str().ok())
4664 .unwrap_or("application/octet-stream");
4665 let content_type = super::ContentType::from(content_type);
4666
4667 if !status.is_client_error() && !status.is_server_error() {
4668 let content = resp.text().await?;
4669 match content_type {
4670 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4671 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteUmConditionalOrderV1Resp`"))),
4672 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::DeleteUmConditionalOrderV1Resp`")))),
4673 }
4674 } else {
4675 let content = resp.text().await?;
4676 let entity: Option<DeleteUmConditionalOrderV1Error> = serde_json::from_str(&content).ok();
4677 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4678 }
4679}
4680
4681pub async fn delete_um_order_v1(configuration: &configuration::Configuration, params: DeleteUmOrderV1Params) -> Result<models::DeleteUmOrderV1Resp, Error<DeleteUmOrderV1Error>> {
4683
4684 let uri_str = format!("{}/papi/v1/um/order", configuration.base_path);
4685 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4686
4687 let mut query_params: Vec<(String, String)> = Vec::new();
4689
4690 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4691 if let Some(ref param_value) = params.order_id {
4692 query_params.push(("orderId".to_string(), param_value.to_string()));
4693 }
4694 if let Some(ref param_value) = params.orig_client_order_id {
4695 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
4696 }
4697 if let Some(ref param_value) = params.recv_window {
4698 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4699 }
4700 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4701
4702 let mut header_params = std::collections::HashMap::new();
4704
4705 if let Some(ref binance_auth) = configuration.binance_auth {
4707 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4709
4710 let body_string: Option<Vec<u8>> = None;
4712
4713 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4715 Ok(sig) => sig,
4716 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4717 };
4718
4719 query_params.push(("signature".to_string(), signature));
4721 }
4722
4723 if !query_params.is_empty() {
4725 req_builder = req_builder.query(&query_params);
4726 }
4727
4728
4729 if let Some(ref user_agent) = configuration.user_agent {
4731 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4732 }
4733
4734 for (header_name, header_value) in header_params {
4736 req_builder = req_builder.header(&header_name, &header_value);
4737 }
4738
4739
4740 let req = req_builder.build()?;
4741 let resp = configuration.client.execute(req).await?;
4742
4743 let status = resp.status();
4744 let content_type = resp
4745 .headers()
4746 .get("content-type")
4747 .and_then(|v| v.to_str().ok())
4748 .unwrap_or("application/octet-stream");
4749 let content_type = super::ContentType::from(content_type);
4750
4751 if !status.is_client_error() && !status.is_server_error() {
4752 let content = resp.text().await?;
4753 match content_type {
4754 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4755 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteUmOrderV1Resp`"))),
4756 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::DeleteUmOrderV1Resp`")))),
4757 }
4758 } else {
4759 let content = resp.text().await?;
4760 let entity: Option<DeleteUmOrderV1Error> = serde_json::from_str(&content).ok();
4761 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4762 }
4763}
4764
4765pub async fn get_account_v1(configuration: &configuration::Configuration, params: GetAccountV1Params) -> Result<models::GetAccountV1Resp, Error<GetAccountV1Error>> {
4767
4768 let uri_str = format!("{}/papi/v1/account", configuration.base_path);
4769 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4770
4771 let mut query_params: Vec<(String, String)> = Vec::new();
4773
4774 if let Some(ref param_value) = params.recv_window {
4775 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4776 }
4777 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4778
4779 let mut header_params = std::collections::HashMap::new();
4781
4782 if let Some(ref binance_auth) = configuration.binance_auth {
4784 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4786
4787 let body_string: Option<Vec<u8>> = None;
4789
4790 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4792 Ok(sig) => sig,
4793 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4794 };
4795
4796 query_params.push(("signature".to_string(), signature));
4798 }
4799
4800 if !query_params.is_empty() {
4802 req_builder = req_builder.query(&query_params);
4803 }
4804
4805
4806 if let Some(ref user_agent) = configuration.user_agent {
4808 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4809 }
4810
4811 for (header_name, header_value) in header_params {
4813 req_builder = req_builder.header(&header_name, &header_value);
4814 }
4815
4816
4817 let req = req_builder.build()?;
4818 let resp = configuration.client.execute(req).await?;
4819
4820 let status = resp.status();
4821 let content_type = resp
4822 .headers()
4823 .get("content-type")
4824 .and_then(|v| v.to_str().ok())
4825 .unwrap_or("application/octet-stream");
4826 let content_type = super::ContentType::from(content_type);
4827
4828 if !status.is_client_error() && !status.is_server_error() {
4829 let content = resp.text().await?;
4830 match content_type {
4831 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4832 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAccountV1Resp`"))),
4833 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::GetAccountV1Resp`")))),
4834 }
4835 } else {
4836 let content = resp.text().await?;
4837 let entity: Option<GetAccountV1Error> = serde_json::from_str(&content).ok();
4838 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4839 }
4840}
4841
4842pub async fn get_balance_v1(configuration: &configuration::Configuration, params: GetBalanceV1Params) -> Result<models::PmarginGetBalanceV1Resp, Error<GetBalanceV1Error>> {
4844
4845 let uri_str = format!("{}/papi/v1/balance", configuration.base_path);
4846 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4847
4848 let mut query_params: Vec<(String, String)> = Vec::new();
4850
4851 if let Some(ref param_value) = params.asset {
4852 query_params.push(("asset".to_string(), param_value.to_string()));
4853 }
4854 if let Some(ref param_value) = params.recv_window {
4855 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4856 }
4857 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4858
4859 let mut header_params = std::collections::HashMap::new();
4861
4862 if let Some(ref binance_auth) = configuration.binance_auth {
4864 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4866
4867 let body_string: Option<Vec<u8>> = None;
4869
4870 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4872 Ok(sig) => sig,
4873 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4874 };
4875
4876 query_params.push(("signature".to_string(), signature));
4878 }
4879
4880 if !query_params.is_empty() {
4882 req_builder = req_builder.query(&query_params);
4883 }
4884
4885
4886 if let Some(ref user_agent) = configuration.user_agent {
4888 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4889 }
4890
4891 for (header_name, header_value) in header_params {
4893 req_builder = req_builder.header(&header_name, &header_value);
4894 }
4895
4896
4897 let req = req_builder.build()?;
4898 let resp = configuration.client.execute(req).await?;
4899
4900 let status = resp.status();
4901 let content_type = resp
4902 .headers()
4903 .get("content-type")
4904 .and_then(|v| v.to_str().ok())
4905 .unwrap_or("application/octet-stream");
4906 let content_type = super::ContentType::from(content_type);
4907
4908 if !status.is_client_error() && !status.is_server_error() {
4909 let content = resp.text().await?;
4910 match content_type {
4911 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4912 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PmarginGetBalanceV1Resp`"))),
4913 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::PmarginGetBalanceV1Resp`")))),
4914 }
4915 } else {
4916 let content = resp.text().await?;
4917 let entity: Option<GetBalanceV1Error> = serde_json::from_str(&content).ok();
4918 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4919 }
4920}
4921
4922pub async fn get_cm_account_v1(configuration: &configuration::Configuration, params: GetCmAccountV1Params) -> Result<models::GetCmAccountV1Resp, Error<GetCmAccountV1Error>> {
4924
4925 let uri_str = format!("{}/papi/v1/cm/account", configuration.base_path);
4926 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4927
4928 let mut query_params: Vec<(String, String)> = Vec::new();
4930
4931 if let Some(ref param_value) = params.recv_window {
4932 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4933 }
4934 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4935
4936 let mut header_params = std::collections::HashMap::new();
4938
4939 if let Some(ref binance_auth) = configuration.binance_auth {
4941 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4943
4944 let body_string: Option<Vec<u8>> = None;
4946
4947 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4949 Ok(sig) => sig,
4950 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4951 };
4952
4953 query_params.push(("signature".to_string(), signature));
4955 }
4956
4957 if !query_params.is_empty() {
4959 req_builder = req_builder.query(&query_params);
4960 }
4961
4962
4963 if let Some(ref user_agent) = configuration.user_agent {
4965 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4966 }
4967
4968 for (header_name, header_value) in header_params {
4970 req_builder = req_builder.header(&header_name, &header_value);
4971 }
4972
4973
4974 let req = req_builder.build()?;
4975 let resp = configuration.client.execute(req).await?;
4976
4977 let status = resp.status();
4978 let content_type = resp
4979 .headers()
4980 .get("content-type")
4981 .and_then(|v| v.to_str().ok())
4982 .unwrap_or("application/octet-stream");
4983 let content_type = super::ContentType::from(content_type);
4984
4985 if !status.is_client_error() && !status.is_server_error() {
4986 let content = resp.text().await?;
4987 match content_type {
4988 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4989 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCmAccountV1Resp`"))),
4990 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::GetCmAccountV1Resp`")))),
4991 }
4992 } else {
4993 let content = resp.text().await?;
4994 let entity: Option<GetCmAccountV1Error> = serde_json::from_str(&content).ok();
4995 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4996 }
4997}
4998
4999pub async fn get_cm_adl_quantile_v1(configuration: &configuration::Configuration) -> Result<Vec<models::GetCmAdlQuantileV1RespItem>, Error<GetCmAdlQuantileV1Error>> {
5001
5002 let uri_str = format!("{}/papi/v1/cm/adlQuantile", configuration.base_path);
5003 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5004
5005 let mut query_params: Vec<(String, String)> = Vec::new();
5007
5008
5009 let mut header_params = std::collections::HashMap::new();
5011
5012 if let Some(ref binance_auth) = configuration.binance_auth {
5014 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5016
5017 let body_string: Option<Vec<u8>> = None;
5019
5020 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5022 Ok(sig) => sig,
5023 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5024 };
5025
5026 query_params.push(("signature".to_string(), signature));
5028 }
5029
5030 if !query_params.is_empty() {
5032 req_builder = req_builder.query(&query_params);
5033 }
5034
5035
5036 if let Some(ref user_agent) = configuration.user_agent {
5038 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5039 }
5040
5041 for (header_name, header_value) in header_params {
5043 req_builder = req_builder.header(&header_name, &header_value);
5044 }
5045
5046
5047 let req = req_builder.build()?;
5048 let resp = configuration.client.execute(req).await?;
5049
5050 let status = resp.status();
5051 let content_type = resp
5052 .headers()
5053 .get("content-type")
5054 .and_then(|v| v.to_str().ok())
5055 .unwrap_or("application/octet-stream");
5056 let content_type = super::ContentType::from(content_type);
5057
5058 if !status.is_client_error() && !status.is_server_error() {
5059 let content = resp.text().await?;
5060 match content_type {
5061 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5062 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmAdlQuantileV1RespItem>`"))),
5063 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::GetCmAdlQuantileV1RespItem>`")))),
5064 }
5065 } else {
5066 let content = resp.text().await?;
5067 let entity: Option<GetCmAdlQuantileV1Error> = serde_json::from_str(&content).ok();
5068 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5069 }
5070}
5071
5072pub async fn get_cm_all_orders_v1(configuration: &configuration::Configuration, params: GetCmAllOrdersV1Params) -> Result<Vec<models::GetCmAllOrdersV1RespItem>, Error<GetCmAllOrdersV1Error>> {
5074
5075 let uri_str = format!("{}/papi/v1/cm/allOrders", configuration.base_path);
5076 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5077
5078 let mut query_params: Vec<(String, String)> = Vec::new();
5080
5081 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5082 if let Some(ref param_value) = params.pair {
5083 query_params.push(("pair".to_string(), param_value.to_string()));
5084 }
5085 if let Some(ref param_value) = params.order_id {
5086 query_params.push(("orderId".to_string(), param_value.to_string()));
5087 }
5088 if let Some(ref param_value) = params.start_time {
5089 query_params.push(("startTime".to_string(), param_value.to_string()));
5090 }
5091 if let Some(ref param_value) = params.end_time {
5092 query_params.push(("endTime".to_string(), param_value.to_string()));
5093 }
5094 if let Some(ref param_value) = params.limit {
5095 query_params.push(("limit".to_string(), param_value.to_string()));
5096 }
5097 if let Some(ref param_value) = params.recv_window {
5098 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5099 }
5100 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5101
5102 let mut header_params = std::collections::HashMap::new();
5104
5105 if let Some(ref binance_auth) = configuration.binance_auth {
5107 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5109
5110 let body_string: Option<Vec<u8>> = None;
5112
5113 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5115 Ok(sig) => sig,
5116 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5117 };
5118
5119 query_params.push(("signature".to_string(), signature));
5121 }
5122
5123 if !query_params.is_empty() {
5125 req_builder = req_builder.query(&query_params);
5126 }
5127
5128
5129 if let Some(ref user_agent) = configuration.user_agent {
5131 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5132 }
5133
5134 for (header_name, header_value) in header_params {
5136 req_builder = req_builder.header(&header_name, &header_value);
5137 }
5138
5139
5140 let req = req_builder.build()?;
5141 let resp = configuration.client.execute(req).await?;
5142
5143 let status = resp.status();
5144 let content_type = resp
5145 .headers()
5146 .get("content-type")
5147 .and_then(|v| v.to_str().ok())
5148 .unwrap_or("application/octet-stream");
5149 let content_type = super::ContentType::from(content_type);
5150
5151 if !status.is_client_error() && !status.is_server_error() {
5152 let content = resp.text().await?;
5153 match content_type {
5154 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5155 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmAllOrdersV1RespItem>`"))),
5156 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::GetCmAllOrdersV1RespItem>`")))),
5157 }
5158 } else {
5159 let content = resp.text().await?;
5160 let entity: Option<GetCmAllOrdersV1Error> = serde_json::from_str(&content).ok();
5161 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5162 }
5163}
5164
5165pub async fn get_cm_commission_rate_v1(configuration: &configuration::Configuration, params: GetCmCommissionRateV1Params) -> Result<models::GetCmCommissionRateV1Resp, Error<GetCmCommissionRateV1Error>> {
5167
5168 let uri_str = format!("{}/papi/v1/cm/commissionRate", configuration.base_path);
5169 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5170
5171 let mut query_params: Vec<(String, String)> = Vec::new();
5173
5174 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5175 if let Some(ref param_value) = params.recv_window {
5176 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5177 }
5178 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5179
5180 let mut header_params = std::collections::HashMap::new();
5182
5183 if let Some(ref binance_auth) = configuration.binance_auth {
5185 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5187
5188 let body_string: Option<Vec<u8>> = None;
5190
5191 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5193 Ok(sig) => sig,
5194 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5195 };
5196
5197 query_params.push(("signature".to_string(), signature));
5199 }
5200
5201 if !query_params.is_empty() {
5203 req_builder = req_builder.query(&query_params);
5204 }
5205
5206
5207 if let Some(ref user_agent) = configuration.user_agent {
5209 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5210 }
5211
5212 for (header_name, header_value) in header_params {
5214 req_builder = req_builder.header(&header_name, &header_value);
5215 }
5216
5217
5218 let req = req_builder.build()?;
5219 let resp = configuration.client.execute(req).await?;
5220
5221 let status = resp.status();
5222 let content_type = resp
5223 .headers()
5224 .get("content-type")
5225 .and_then(|v| v.to_str().ok())
5226 .unwrap_or("application/octet-stream");
5227 let content_type = super::ContentType::from(content_type);
5228
5229 if !status.is_client_error() && !status.is_server_error() {
5230 let content = resp.text().await?;
5231 match content_type {
5232 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5233 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCmCommissionRateV1Resp`"))),
5234 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::GetCmCommissionRateV1Resp`")))),
5235 }
5236 } else {
5237 let content = resp.text().await?;
5238 let entity: Option<GetCmCommissionRateV1Error> = serde_json::from_str(&content).ok();
5239 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5240 }
5241}
5242
5243pub async fn get_cm_conditional_all_orders_v1(configuration: &configuration::Configuration, params: GetCmConditionalAllOrdersV1Params) -> Result<Vec<models::GetCmConditionalAllOrdersV1RespItem>, Error<GetCmConditionalAllOrdersV1Error>> {
5245
5246 let uri_str = format!("{}/papi/v1/cm/conditional/allOrders", configuration.base_path);
5247 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5248
5249 let mut query_params: Vec<(String, String)> = Vec::new();
5251
5252 if let Some(ref param_value) = params.symbol {
5253 query_params.push(("symbol".to_string(), param_value.to_string()));
5254 }
5255 if let Some(ref param_value) = params.strategy_id {
5256 query_params.push(("strategyId".to_string(), param_value.to_string()));
5257 }
5258 if let Some(ref param_value) = params.start_time {
5259 query_params.push(("startTime".to_string(), param_value.to_string()));
5260 }
5261 if let Some(ref param_value) = params.end_time {
5262 query_params.push(("endTime".to_string(), param_value.to_string()));
5263 }
5264 if let Some(ref param_value) = params.limit {
5265 query_params.push(("limit".to_string(), param_value.to_string()));
5266 }
5267 if let Some(ref param_value) = params.recv_window {
5268 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5269 }
5270 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5271
5272 let mut header_params = std::collections::HashMap::new();
5274
5275 if let Some(ref binance_auth) = configuration.binance_auth {
5277 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5279
5280 let body_string: Option<Vec<u8>> = None;
5282
5283 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5285 Ok(sig) => sig,
5286 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5287 };
5288
5289 query_params.push(("signature".to_string(), signature));
5291 }
5292
5293 if !query_params.is_empty() {
5295 req_builder = req_builder.query(&query_params);
5296 }
5297
5298
5299 if let Some(ref user_agent) = configuration.user_agent {
5301 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5302 }
5303
5304 for (header_name, header_value) in header_params {
5306 req_builder = req_builder.header(&header_name, &header_value);
5307 }
5308
5309
5310 let req = req_builder.build()?;
5311 let resp = configuration.client.execute(req).await?;
5312
5313 let status = resp.status();
5314 let content_type = resp
5315 .headers()
5316 .get("content-type")
5317 .and_then(|v| v.to_str().ok())
5318 .unwrap_or("application/octet-stream");
5319 let content_type = super::ContentType::from(content_type);
5320
5321 if !status.is_client_error() && !status.is_server_error() {
5322 let content = resp.text().await?;
5323 match content_type {
5324 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5325 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmConditionalAllOrdersV1RespItem>`"))),
5326 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::GetCmConditionalAllOrdersV1RespItem>`")))),
5327 }
5328 } else {
5329 let content = resp.text().await?;
5330 let entity: Option<GetCmConditionalAllOrdersV1Error> = serde_json::from_str(&content).ok();
5331 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5332 }
5333}
5334
5335pub async fn get_cm_conditional_open_order_v1(configuration: &configuration::Configuration, params: GetCmConditionalOpenOrderV1Params) -> Result<models::GetCmConditionalOpenOrderV1Resp, Error<GetCmConditionalOpenOrderV1Error>> {
5337
5338 let uri_str = format!("{}/papi/v1/cm/conditional/openOrder", configuration.base_path);
5339 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5340
5341 let mut query_params: Vec<(String, String)> = Vec::new();
5343
5344 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5345 if let Some(ref param_value) = params.strategy_id {
5346 query_params.push(("strategyId".to_string(), param_value.to_string()));
5347 }
5348 if let Some(ref param_value) = params.new_client_strategy_id {
5349 query_params.push(("newClientStrategyId".to_string(), param_value.to_string()));
5350 }
5351 if let Some(ref param_value) = params.recv_window {
5352 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5353 }
5354 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5355
5356 let mut header_params = std::collections::HashMap::new();
5358
5359 if let Some(ref binance_auth) = configuration.binance_auth {
5361 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5363
5364 let body_string: Option<Vec<u8>> = None;
5366
5367 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5369 Ok(sig) => sig,
5370 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5371 };
5372
5373 query_params.push(("signature".to_string(), signature));
5375 }
5376
5377 if !query_params.is_empty() {
5379 req_builder = req_builder.query(&query_params);
5380 }
5381
5382
5383 if let Some(ref user_agent) = configuration.user_agent {
5385 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5386 }
5387
5388 for (header_name, header_value) in header_params {
5390 req_builder = req_builder.header(&header_name, &header_value);
5391 }
5392
5393
5394 let req = req_builder.build()?;
5395 let resp = configuration.client.execute(req).await?;
5396
5397 let status = resp.status();
5398 let content_type = resp
5399 .headers()
5400 .get("content-type")
5401 .and_then(|v| v.to_str().ok())
5402 .unwrap_or("application/octet-stream");
5403 let content_type = super::ContentType::from(content_type);
5404
5405 if !status.is_client_error() && !status.is_server_error() {
5406 let content = resp.text().await?;
5407 match content_type {
5408 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5409 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCmConditionalOpenOrderV1Resp`"))),
5410 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::GetCmConditionalOpenOrderV1Resp`")))),
5411 }
5412 } else {
5413 let content = resp.text().await?;
5414 let entity: Option<GetCmConditionalOpenOrderV1Error> = serde_json::from_str(&content).ok();
5415 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5416 }
5417}
5418
5419pub async fn get_cm_conditional_open_orders_v1(configuration: &configuration::Configuration, params: GetCmConditionalOpenOrdersV1Params) -> Result<Vec<models::GetCmConditionalOpenOrdersV1RespItem>, Error<GetCmConditionalOpenOrdersV1Error>> {
5421
5422 let uri_str = format!("{}/papi/v1/cm/conditional/openOrders", configuration.base_path);
5423 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5424
5425 let mut query_params: Vec<(String, String)> = Vec::new();
5427
5428 if let Some(ref param_value) = params.symbol {
5429 query_params.push(("symbol".to_string(), param_value.to_string()));
5430 }
5431 if let Some(ref param_value) = params.recv_window {
5432 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5433 }
5434 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5435
5436 let mut header_params = std::collections::HashMap::new();
5438
5439 if let Some(ref binance_auth) = configuration.binance_auth {
5441 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5443
5444 let body_string: Option<Vec<u8>> = None;
5446
5447 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5449 Ok(sig) => sig,
5450 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5451 };
5452
5453 query_params.push(("signature".to_string(), signature));
5455 }
5456
5457 if !query_params.is_empty() {
5459 req_builder = req_builder.query(&query_params);
5460 }
5461
5462
5463 if let Some(ref user_agent) = configuration.user_agent {
5465 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5466 }
5467
5468 for (header_name, header_value) in header_params {
5470 req_builder = req_builder.header(&header_name, &header_value);
5471 }
5472
5473
5474 let req = req_builder.build()?;
5475 let resp = configuration.client.execute(req).await?;
5476
5477 let status = resp.status();
5478 let content_type = resp
5479 .headers()
5480 .get("content-type")
5481 .and_then(|v| v.to_str().ok())
5482 .unwrap_or("application/octet-stream");
5483 let content_type = super::ContentType::from(content_type);
5484
5485 if !status.is_client_error() && !status.is_server_error() {
5486 let content = resp.text().await?;
5487 match content_type {
5488 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5489 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmConditionalOpenOrdersV1RespItem>`"))),
5490 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::GetCmConditionalOpenOrdersV1RespItem>`")))),
5491 }
5492 } else {
5493 let content = resp.text().await?;
5494 let entity: Option<GetCmConditionalOpenOrdersV1Error> = serde_json::from_str(&content).ok();
5495 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5496 }
5497}
5498
5499pub async fn get_cm_conditional_order_history_v1(configuration: &configuration::Configuration, params: GetCmConditionalOrderHistoryV1Params) -> Result<models::GetCmConditionalOrderHistoryV1Resp, Error<GetCmConditionalOrderHistoryV1Error>> {
5501
5502 let uri_str = format!("{}/papi/v1/cm/conditional/orderHistory", configuration.base_path);
5503 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5504
5505 let mut query_params: Vec<(String, String)> = Vec::new();
5507
5508 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5509 if let Some(ref param_value) = params.strategy_id {
5510 query_params.push(("strategyId".to_string(), param_value.to_string()));
5511 }
5512 if let Some(ref param_value) = params.new_client_strategy_id {
5513 query_params.push(("newClientStrategyId".to_string(), param_value.to_string()));
5514 }
5515 if let Some(ref param_value) = params.recv_window {
5516 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5517 }
5518 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5519
5520 let mut header_params = std::collections::HashMap::new();
5522
5523 if let Some(ref binance_auth) = configuration.binance_auth {
5525 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5527
5528 let body_string: Option<Vec<u8>> = None;
5530
5531 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5533 Ok(sig) => sig,
5534 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5535 };
5536
5537 query_params.push(("signature".to_string(), signature));
5539 }
5540
5541 if !query_params.is_empty() {
5543 req_builder = req_builder.query(&query_params);
5544 }
5545
5546
5547 if let Some(ref user_agent) = configuration.user_agent {
5549 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5550 }
5551
5552 for (header_name, header_value) in header_params {
5554 req_builder = req_builder.header(&header_name, &header_value);
5555 }
5556
5557
5558 let req = req_builder.build()?;
5559 let resp = configuration.client.execute(req).await?;
5560
5561 let status = resp.status();
5562 let content_type = resp
5563 .headers()
5564 .get("content-type")
5565 .and_then(|v| v.to_str().ok())
5566 .unwrap_or("application/octet-stream");
5567 let content_type = super::ContentType::from(content_type);
5568
5569 if !status.is_client_error() && !status.is_server_error() {
5570 let content = resp.text().await?;
5571 match content_type {
5572 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5573 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCmConditionalOrderHistoryV1Resp`"))),
5574 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::GetCmConditionalOrderHistoryV1Resp`")))),
5575 }
5576 } else {
5577 let content = resp.text().await?;
5578 let entity: Option<GetCmConditionalOrderHistoryV1Error> = serde_json::from_str(&content).ok();
5579 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5580 }
5581}
5582
5583pub async fn get_cm_force_orders_v1(configuration: &configuration::Configuration, params: GetCmForceOrdersV1Params) -> Result<Vec<models::GetCmForceOrdersV1RespItem>, Error<GetCmForceOrdersV1Error>> {
5585
5586 let uri_str = format!("{}/papi/v1/cm/forceOrders", configuration.base_path);
5587 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5588
5589 let mut query_params: Vec<(String, String)> = Vec::new();
5591
5592 if let Some(ref param_value) = params.symbol {
5593 query_params.push(("symbol".to_string(), param_value.to_string()));
5594 }
5595 if let Some(ref param_value) = params.auto_close_type {
5596 query_params.push(("autoCloseType".to_string(), param_value.to_string()));
5597 }
5598 if let Some(ref param_value) = params.start_time {
5599 query_params.push(("startTime".to_string(), param_value.to_string()));
5600 }
5601 if let Some(ref param_value) = params.end_time {
5602 query_params.push(("endTime".to_string(), param_value.to_string()));
5603 }
5604 if let Some(ref param_value) = params.limit {
5605 query_params.push(("limit".to_string(), param_value.to_string()));
5606 }
5607 if let Some(ref param_value) = params.recv_window {
5608 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5609 }
5610 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5611
5612 let mut header_params = std::collections::HashMap::new();
5614
5615 if let Some(ref binance_auth) = configuration.binance_auth {
5617 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5619
5620 let body_string: Option<Vec<u8>> = None;
5622
5623 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5625 Ok(sig) => sig,
5626 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5627 };
5628
5629 query_params.push(("signature".to_string(), signature));
5631 }
5632
5633 if !query_params.is_empty() {
5635 req_builder = req_builder.query(&query_params);
5636 }
5637
5638
5639 if let Some(ref user_agent) = configuration.user_agent {
5641 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5642 }
5643
5644 for (header_name, header_value) in header_params {
5646 req_builder = req_builder.header(&header_name, &header_value);
5647 }
5648
5649
5650 let req = req_builder.build()?;
5651 let resp = configuration.client.execute(req).await?;
5652
5653 let status = resp.status();
5654 let content_type = resp
5655 .headers()
5656 .get("content-type")
5657 .and_then(|v| v.to_str().ok())
5658 .unwrap_or("application/octet-stream");
5659 let content_type = super::ContentType::from(content_type);
5660
5661 if !status.is_client_error() && !status.is_server_error() {
5662 let content = resp.text().await?;
5663 match content_type {
5664 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5665 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmForceOrdersV1RespItem>`"))),
5666 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::GetCmForceOrdersV1RespItem>`")))),
5667 }
5668 } else {
5669 let content = resp.text().await?;
5670 let entity: Option<GetCmForceOrdersV1Error> = serde_json::from_str(&content).ok();
5671 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5672 }
5673}
5674
5675pub async fn get_cm_income_v1(configuration: &configuration::Configuration, params: GetCmIncomeV1Params) -> Result<Vec<models::GetCmIncomeV1RespItem>, Error<GetCmIncomeV1Error>> {
5677
5678 let uri_str = format!("{}/papi/v1/cm/income", configuration.base_path);
5679 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5680
5681 let mut query_params: Vec<(String, String)> = Vec::new();
5683
5684 if let Some(ref param_value) = params.symbol {
5685 query_params.push(("symbol".to_string(), param_value.to_string()));
5686 }
5687 if let Some(ref param_value) = params.income_type {
5688 query_params.push(("incomeType".to_string(), param_value.to_string()));
5689 }
5690 if let Some(ref param_value) = params.start_time {
5691 query_params.push(("startTime".to_string(), param_value.to_string()));
5692 }
5693 if let Some(ref param_value) = params.end_time {
5694 query_params.push(("endTime".to_string(), param_value.to_string()));
5695 }
5696 if let Some(ref param_value) = params.page {
5697 query_params.push(("page".to_string(), param_value.to_string()));
5698 }
5699 if let Some(ref param_value) = params.limit {
5700 query_params.push(("limit".to_string(), param_value.to_string()));
5701 }
5702 if let Some(ref param_value) = params.recv_window {
5703 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5704 }
5705 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5706
5707 let mut header_params = std::collections::HashMap::new();
5709
5710 if let Some(ref binance_auth) = configuration.binance_auth {
5712 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5714
5715 let body_string: Option<Vec<u8>> = None;
5717
5718 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5720 Ok(sig) => sig,
5721 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5722 };
5723
5724 query_params.push(("signature".to_string(), signature));
5726 }
5727
5728 if !query_params.is_empty() {
5730 req_builder = req_builder.query(&query_params);
5731 }
5732
5733
5734 if let Some(ref user_agent) = configuration.user_agent {
5736 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5737 }
5738
5739 for (header_name, header_value) in header_params {
5741 req_builder = req_builder.header(&header_name, &header_value);
5742 }
5743
5744
5745 let req = req_builder.build()?;
5746 let resp = configuration.client.execute(req).await?;
5747
5748 let status = resp.status();
5749 let content_type = resp
5750 .headers()
5751 .get("content-type")
5752 .and_then(|v| v.to_str().ok())
5753 .unwrap_or("application/octet-stream");
5754 let content_type = super::ContentType::from(content_type);
5755
5756 if !status.is_client_error() && !status.is_server_error() {
5757 let content = resp.text().await?;
5758 match content_type {
5759 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5760 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmIncomeV1RespItem>`"))),
5761 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::GetCmIncomeV1RespItem>`")))),
5762 }
5763 } else {
5764 let content = resp.text().await?;
5765 let entity: Option<GetCmIncomeV1Error> = serde_json::from_str(&content).ok();
5766 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5767 }
5768}
5769
5770pub async fn get_cm_leverage_bracket_v1(configuration: &configuration::Configuration, params: GetCmLeverageBracketV1Params) -> Result<Vec<models::GetCmLeverageBracketV1RespItem>, Error<GetCmLeverageBracketV1Error>> {
5772
5773 let uri_str = format!("{}/papi/v1/cm/leverageBracket", configuration.base_path);
5774 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5775
5776 let mut query_params: Vec<(String, String)> = Vec::new();
5778
5779 if let Some(ref param_value) = params.symbol {
5780 query_params.push(("symbol".to_string(), param_value.to_string()));
5781 }
5782 if let Some(ref param_value) = params.recv_window {
5783 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5784 }
5785 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5786
5787 let mut header_params = std::collections::HashMap::new();
5789
5790 if let Some(ref binance_auth) = configuration.binance_auth {
5792 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5794
5795 let body_string: Option<Vec<u8>> = None;
5797
5798 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5800 Ok(sig) => sig,
5801 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5802 };
5803
5804 query_params.push(("signature".to_string(), signature));
5806 }
5807
5808 if !query_params.is_empty() {
5810 req_builder = req_builder.query(&query_params);
5811 }
5812
5813
5814 if let Some(ref user_agent) = configuration.user_agent {
5816 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5817 }
5818
5819 for (header_name, header_value) in header_params {
5821 req_builder = req_builder.header(&header_name, &header_value);
5822 }
5823
5824
5825 let req = req_builder.build()?;
5826 let resp = configuration.client.execute(req).await?;
5827
5828 let status = resp.status();
5829 let content_type = resp
5830 .headers()
5831 .get("content-type")
5832 .and_then(|v| v.to_str().ok())
5833 .unwrap_or("application/octet-stream");
5834 let content_type = super::ContentType::from(content_type);
5835
5836 if !status.is_client_error() && !status.is_server_error() {
5837 let content = resp.text().await?;
5838 match content_type {
5839 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5840 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmLeverageBracketV1RespItem>`"))),
5841 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::GetCmLeverageBracketV1RespItem>`")))),
5842 }
5843 } else {
5844 let content = resp.text().await?;
5845 let entity: Option<GetCmLeverageBracketV1Error> = serde_json::from_str(&content).ok();
5846 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5847 }
5848}
5849
5850pub async fn get_cm_open_order_v1(configuration: &configuration::Configuration, params: GetCmOpenOrderV1Params) -> Result<models::GetCmOpenOrderV1Resp, Error<GetCmOpenOrderV1Error>> {
5852
5853 let uri_str = format!("{}/papi/v1/cm/openOrder", configuration.base_path);
5854 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5855
5856 let mut query_params: Vec<(String, String)> = Vec::new();
5858
5859 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5860 if let Some(ref param_value) = params.order_id {
5861 query_params.push(("orderId".to_string(), param_value.to_string()));
5862 }
5863 if let Some(ref param_value) = params.orig_client_order_id {
5864 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
5865 }
5866 if let Some(ref param_value) = params.recv_window {
5867 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5868 }
5869 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5870
5871 let mut header_params = std::collections::HashMap::new();
5873
5874 if let Some(ref binance_auth) = configuration.binance_auth {
5876 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5878
5879 let body_string: Option<Vec<u8>> = None;
5881
5882 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5884 Ok(sig) => sig,
5885 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5886 };
5887
5888 query_params.push(("signature".to_string(), signature));
5890 }
5891
5892 if !query_params.is_empty() {
5894 req_builder = req_builder.query(&query_params);
5895 }
5896
5897
5898 if let Some(ref user_agent) = configuration.user_agent {
5900 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5901 }
5902
5903 for (header_name, header_value) in header_params {
5905 req_builder = req_builder.header(&header_name, &header_value);
5906 }
5907
5908
5909 let req = req_builder.build()?;
5910 let resp = configuration.client.execute(req).await?;
5911
5912 let status = resp.status();
5913 let content_type = resp
5914 .headers()
5915 .get("content-type")
5916 .and_then(|v| v.to_str().ok())
5917 .unwrap_or("application/octet-stream");
5918 let content_type = super::ContentType::from(content_type);
5919
5920 if !status.is_client_error() && !status.is_server_error() {
5921 let content = resp.text().await?;
5922 match content_type {
5923 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5924 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCmOpenOrderV1Resp`"))),
5925 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::GetCmOpenOrderV1Resp`")))),
5926 }
5927 } else {
5928 let content = resp.text().await?;
5929 let entity: Option<GetCmOpenOrderV1Error> = serde_json::from_str(&content).ok();
5930 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5931 }
5932}
5933
5934pub async fn get_cm_open_orders_v1(configuration: &configuration::Configuration, params: GetCmOpenOrdersV1Params) -> Result<Vec<models::GetCmOpenOrdersV1RespItem>, Error<GetCmOpenOrdersV1Error>> {
5936
5937 let uri_str = format!("{}/papi/v1/cm/openOrders", configuration.base_path);
5938 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5939
5940 let mut query_params: Vec<(String, String)> = Vec::new();
5942
5943 if let Some(ref param_value) = params.symbol {
5944 query_params.push(("symbol".to_string(), param_value.to_string()));
5945 }
5946 if let Some(ref param_value) = params.pair {
5947 query_params.push(("pair".to_string(), param_value.to_string()));
5948 }
5949 if let Some(ref param_value) = params.recv_window {
5950 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5951 }
5952 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5953
5954 let mut header_params = std::collections::HashMap::new();
5956
5957 if let Some(ref binance_auth) = configuration.binance_auth {
5959 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5961
5962 let body_string: Option<Vec<u8>> = None;
5964
5965 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5967 Ok(sig) => sig,
5968 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5969 };
5970
5971 query_params.push(("signature".to_string(), signature));
5973 }
5974
5975 if !query_params.is_empty() {
5977 req_builder = req_builder.query(&query_params);
5978 }
5979
5980
5981 if let Some(ref user_agent) = configuration.user_agent {
5983 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5984 }
5985
5986 for (header_name, header_value) in header_params {
5988 req_builder = req_builder.header(&header_name, &header_value);
5989 }
5990
5991
5992 let req = req_builder.build()?;
5993 let resp = configuration.client.execute(req).await?;
5994
5995 let status = resp.status();
5996 let content_type = resp
5997 .headers()
5998 .get("content-type")
5999 .and_then(|v| v.to_str().ok())
6000 .unwrap_or("application/octet-stream");
6001 let content_type = super::ContentType::from(content_type);
6002
6003 if !status.is_client_error() && !status.is_server_error() {
6004 let content = resp.text().await?;
6005 match content_type {
6006 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6007 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmOpenOrdersV1RespItem>`"))),
6008 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::GetCmOpenOrdersV1RespItem>`")))),
6009 }
6010 } else {
6011 let content = resp.text().await?;
6012 let entity: Option<GetCmOpenOrdersV1Error> = serde_json::from_str(&content).ok();
6013 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6014 }
6015}
6016
6017pub async fn get_cm_order_amendment_v1(configuration: &configuration::Configuration, params: GetCmOrderAmendmentV1Params) -> Result<Vec<models::GetCmOrderAmendmentV1RespItem>, Error<GetCmOrderAmendmentV1Error>> {
6019
6020 let uri_str = format!("{}/papi/v1/cm/orderAmendment", configuration.base_path);
6021 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6022
6023 let mut query_params: Vec<(String, String)> = Vec::new();
6025
6026 query_params.push(("symbol".to_string(), params.symbol.to_string()));
6027 if let Some(ref param_value) = params.order_id {
6028 query_params.push(("orderId".to_string(), param_value.to_string()));
6029 }
6030 if let Some(ref param_value) = params.orig_client_order_id {
6031 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
6032 }
6033 if let Some(ref param_value) = params.start_time {
6034 query_params.push(("startTime".to_string(), param_value.to_string()));
6035 }
6036 if let Some(ref param_value) = params.end_time {
6037 query_params.push(("endTime".to_string(), param_value.to_string()));
6038 }
6039 if let Some(ref param_value) = params.limit {
6040 query_params.push(("limit".to_string(), param_value.to_string()));
6041 }
6042 if let Some(ref param_value) = params.recv_window {
6043 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6044 }
6045 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6046
6047 let mut header_params = std::collections::HashMap::new();
6049
6050 if let Some(ref binance_auth) = configuration.binance_auth {
6052 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6054
6055 let body_string: Option<Vec<u8>> = None;
6057
6058 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6060 Ok(sig) => sig,
6061 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6062 };
6063
6064 query_params.push(("signature".to_string(), signature));
6066 }
6067
6068 if !query_params.is_empty() {
6070 req_builder = req_builder.query(&query_params);
6071 }
6072
6073
6074 if let Some(ref user_agent) = configuration.user_agent {
6076 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6077 }
6078
6079 for (header_name, header_value) in header_params {
6081 req_builder = req_builder.header(&header_name, &header_value);
6082 }
6083
6084
6085 let req = req_builder.build()?;
6086 let resp = configuration.client.execute(req).await?;
6087
6088 let status = resp.status();
6089 let content_type = resp
6090 .headers()
6091 .get("content-type")
6092 .and_then(|v| v.to_str().ok())
6093 .unwrap_or("application/octet-stream");
6094 let content_type = super::ContentType::from(content_type);
6095
6096 if !status.is_client_error() && !status.is_server_error() {
6097 let content = resp.text().await?;
6098 match content_type {
6099 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6100 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmOrderAmendmentV1RespItem>`"))),
6101 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::GetCmOrderAmendmentV1RespItem>`")))),
6102 }
6103 } else {
6104 let content = resp.text().await?;
6105 let entity: Option<GetCmOrderAmendmentV1Error> = serde_json::from_str(&content).ok();
6106 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6107 }
6108}
6109
6110pub async fn get_cm_order_v1(configuration: &configuration::Configuration, params: GetCmOrderV1Params) -> Result<models::GetCmOrderV1Resp, Error<GetCmOrderV1Error>> {
6112
6113 let uri_str = format!("{}/papi/v1/cm/order", configuration.base_path);
6114 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6115
6116 let mut query_params: Vec<(String, String)> = Vec::new();
6118
6119 query_params.push(("symbol".to_string(), params.symbol.to_string()));
6120 if let Some(ref param_value) = params.order_id {
6121 query_params.push(("orderId".to_string(), param_value.to_string()));
6122 }
6123 if let Some(ref param_value) = params.orig_client_order_id {
6124 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
6125 }
6126 if let Some(ref param_value) = params.recv_window {
6127 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6128 }
6129 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6130
6131 let mut header_params = std::collections::HashMap::new();
6133
6134 if let Some(ref binance_auth) = configuration.binance_auth {
6136 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6138
6139 let body_string: Option<Vec<u8>> = None;
6141
6142 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6144 Ok(sig) => sig,
6145 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6146 };
6147
6148 query_params.push(("signature".to_string(), signature));
6150 }
6151
6152 if !query_params.is_empty() {
6154 req_builder = req_builder.query(&query_params);
6155 }
6156
6157
6158 if let Some(ref user_agent) = configuration.user_agent {
6160 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6161 }
6162
6163 for (header_name, header_value) in header_params {
6165 req_builder = req_builder.header(&header_name, &header_value);
6166 }
6167
6168
6169 let req = req_builder.build()?;
6170 let resp = configuration.client.execute(req).await?;
6171
6172 let status = resp.status();
6173 let content_type = resp
6174 .headers()
6175 .get("content-type")
6176 .and_then(|v| v.to_str().ok())
6177 .unwrap_or("application/octet-stream");
6178 let content_type = super::ContentType::from(content_type);
6179
6180 if !status.is_client_error() && !status.is_server_error() {
6181 let content = resp.text().await?;
6182 match content_type {
6183 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6184 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCmOrderV1Resp`"))),
6185 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::GetCmOrderV1Resp`")))),
6186 }
6187 } else {
6188 let content = resp.text().await?;
6189 let entity: Option<GetCmOrderV1Error> = serde_json::from_str(&content).ok();
6190 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6191 }
6192}
6193
6194pub async fn get_cm_position_risk_v1(configuration: &configuration::Configuration, params: GetCmPositionRiskV1Params) -> Result<Vec<models::GetCmPositionRiskV1RespItem>, Error<GetCmPositionRiskV1Error>> {
6196
6197 let uri_str = format!("{}/papi/v1/cm/positionRisk", configuration.base_path);
6198 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6199
6200 let mut query_params: Vec<(String, String)> = Vec::new();
6202
6203 if let Some(ref param_value) = params.margin_asset {
6204 query_params.push(("marginAsset".to_string(), param_value.to_string()));
6205 }
6206 if let Some(ref param_value) = params.pair {
6207 query_params.push(("pair".to_string(), param_value.to_string()));
6208 }
6209 if let Some(ref param_value) = params.recv_window {
6210 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6211 }
6212 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6213
6214 let mut header_params = std::collections::HashMap::new();
6216
6217 if let Some(ref binance_auth) = configuration.binance_auth {
6219 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6221
6222 let body_string: Option<Vec<u8>> = None;
6224
6225 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6227 Ok(sig) => sig,
6228 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6229 };
6230
6231 query_params.push(("signature".to_string(), signature));
6233 }
6234
6235 if !query_params.is_empty() {
6237 req_builder = req_builder.query(&query_params);
6238 }
6239
6240
6241 if let Some(ref user_agent) = configuration.user_agent {
6243 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6244 }
6245
6246 for (header_name, header_value) in header_params {
6248 req_builder = req_builder.header(&header_name, &header_value);
6249 }
6250
6251
6252 let req = req_builder.build()?;
6253 let resp = configuration.client.execute(req).await?;
6254
6255 let status = resp.status();
6256 let content_type = resp
6257 .headers()
6258 .get("content-type")
6259 .and_then(|v| v.to_str().ok())
6260 .unwrap_or("application/octet-stream");
6261 let content_type = super::ContentType::from(content_type);
6262
6263 if !status.is_client_error() && !status.is_server_error() {
6264 let content = resp.text().await?;
6265 match content_type {
6266 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6267 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmPositionRiskV1RespItem>`"))),
6268 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::GetCmPositionRiskV1RespItem>`")))),
6269 }
6270 } else {
6271 let content = resp.text().await?;
6272 let entity: Option<GetCmPositionRiskV1Error> = serde_json::from_str(&content).ok();
6273 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6274 }
6275}
6276
6277pub async fn get_cm_position_side_dual_v1(configuration: &configuration::Configuration, params: GetCmPositionSideDualV1Params) -> Result<models::GetCmPositionSideDualV1Resp, Error<GetCmPositionSideDualV1Error>> {
6279
6280 let uri_str = format!("{}/papi/v1/cm/positionSide/dual", configuration.base_path);
6281 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6282
6283 let mut query_params: Vec<(String, String)> = Vec::new();
6285
6286 if let Some(ref param_value) = params.recv_window {
6287 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6288 }
6289 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6290
6291 let mut header_params = std::collections::HashMap::new();
6293
6294 if let Some(ref binance_auth) = configuration.binance_auth {
6296 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6298
6299 let body_string: Option<Vec<u8>> = None;
6301
6302 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6304 Ok(sig) => sig,
6305 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6306 };
6307
6308 query_params.push(("signature".to_string(), signature));
6310 }
6311
6312 if !query_params.is_empty() {
6314 req_builder = req_builder.query(&query_params);
6315 }
6316
6317
6318 if let Some(ref user_agent) = configuration.user_agent {
6320 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6321 }
6322
6323 for (header_name, header_value) in header_params {
6325 req_builder = req_builder.header(&header_name, &header_value);
6326 }
6327
6328
6329 let req = req_builder.build()?;
6330 let resp = configuration.client.execute(req).await?;
6331
6332 let status = resp.status();
6333 let content_type = resp
6334 .headers()
6335 .get("content-type")
6336 .and_then(|v| v.to_str().ok())
6337 .unwrap_or("application/octet-stream");
6338 let content_type = super::ContentType::from(content_type);
6339
6340 if !status.is_client_error() && !status.is_server_error() {
6341 let content = resp.text().await?;
6342 match content_type {
6343 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6344 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCmPositionSideDualV1Resp`"))),
6345 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::GetCmPositionSideDualV1Resp`")))),
6346 }
6347 } else {
6348 let content = resp.text().await?;
6349 let entity: Option<GetCmPositionSideDualV1Error> = serde_json::from_str(&content).ok();
6350 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6351 }
6352}
6353
6354pub async fn get_cm_user_trades_v1(configuration: &configuration::Configuration, params: GetCmUserTradesV1Params) -> Result<Vec<models::GetCmUserTradesV1RespItem>, Error<GetCmUserTradesV1Error>> {
6356
6357 let uri_str = format!("{}/papi/v1/cm/userTrades", configuration.base_path);
6358 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6359
6360 let mut query_params: Vec<(String, String)> = Vec::new();
6362
6363 if let Some(ref param_value) = params.symbol {
6364 query_params.push(("symbol".to_string(), param_value.to_string()));
6365 }
6366 if let Some(ref param_value) = params.pair {
6367 query_params.push(("pair".to_string(), param_value.to_string()));
6368 }
6369 if let Some(ref param_value) = params.start_time {
6370 query_params.push(("startTime".to_string(), param_value.to_string()));
6371 }
6372 if let Some(ref param_value) = params.end_time {
6373 query_params.push(("endTime".to_string(), param_value.to_string()));
6374 }
6375 if let Some(ref param_value) = params.from_id {
6376 query_params.push(("fromId".to_string(), param_value.to_string()));
6377 }
6378 if let Some(ref param_value) = params.limit {
6379 query_params.push(("limit".to_string(), param_value.to_string()));
6380 }
6381 if let Some(ref param_value) = params.recv_window {
6382 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6383 }
6384 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6385
6386 let mut header_params = std::collections::HashMap::new();
6388
6389 if let Some(ref binance_auth) = configuration.binance_auth {
6391 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6393
6394 let body_string: Option<Vec<u8>> = None;
6396
6397 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6399 Ok(sig) => sig,
6400 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6401 };
6402
6403 query_params.push(("signature".to_string(), signature));
6405 }
6406
6407 if !query_params.is_empty() {
6409 req_builder = req_builder.query(&query_params);
6410 }
6411
6412
6413 if let Some(ref user_agent) = configuration.user_agent {
6415 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6416 }
6417
6418 for (header_name, header_value) in header_params {
6420 req_builder = req_builder.header(&header_name, &header_value);
6421 }
6422
6423
6424 let req = req_builder.build()?;
6425 let resp = configuration.client.execute(req).await?;
6426
6427 let status = resp.status();
6428 let content_type = resp
6429 .headers()
6430 .get("content-type")
6431 .and_then(|v| v.to_str().ok())
6432 .unwrap_or("application/octet-stream");
6433 let content_type = super::ContentType::from(content_type);
6434
6435 if !status.is_client_error() && !status.is_server_error() {
6436 let content = resp.text().await?;
6437 match content_type {
6438 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6439 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetCmUserTradesV1RespItem>`"))),
6440 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::GetCmUserTradesV1RespItem>`")))),
6441 }
6442 } else {
6443 let content = resp.text().await?;
6444 let entity: Option<GetCmUserTradesV1Error> = serde_json::from_str(&content).ok();
6445 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6446 }
6447}
6448
6449pub async fn get_margin_all_order_list_v1(configuration: &configuration::Configuration, params: GetMarginAllOrderListV1Params) -> Result<Vec<models::GetMarginAllOrderListV1RespItem>, Error<GetMarginAllOrderListV1Error>> {
6451
6452 let uri_str = format!("{}/papi/v1/margin/allOrderList", configuration.base_path);
6453 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6454
6455 let mut query_params: Vec<(String, String)> = Vec::new();
6457
6458 if let Some(ref param_value) = params.from_id {
6459 query_params.push(("fromId".to_string(), param_value.to_string()));
6460 }
6461 if let Some(ref param_value) = params.start_time {
6462 query_params.push(("startTime".to_string(), param_value.to_string()));
6463 }
6464 if let Some(ref param_value) = params.end_time {
6465 query_params.push(("endTime".to_string(), param_value.to_string()));
6466 }
6467 if let Some(ref param_value) = params.limit {
6468 query_params.push(("limit".to_string(), param_value.to_string()));
6469 }
6470 if let Some(ref param_value) = params.recv_window {
6471 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6472 }
6473 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6474
6475 let mut header_params = std::collections::HashMap::new();
6477
6478 if let Some(ref binance_auth) = configuration.binance_auth {
6480 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6482
6483 let body_string: Option<Vec<u8>> = None;
6485
6486 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6488 Ok(sig) => sig,
6489 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6490 };
6491
6492 query_params.push(("signature".to_string(), signature));
6494 }
6495
6496 if !query_params.is_empty() {
6498 req_builder = req_builder.query(&query_params);
6499 }
6500
6501
6502 if let Some(ref user_agent) = configuration.user_agent {
6504 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6505 }
6506
6507 for (header_name, header_value) in header_params {
6509 req_builder = req_builder.header(&header_name, &header_value);
6510 }
6511
6512
6513 let req = req_builder.build()?;
6514 let resp = configuration.client.execute(req).await?;
6515
6516 let status = resp.status();
6517 let content_type = resp
6518 .headers()
6519 .get("content-type")
6520 .and_then(|v| v.to_str().ok())
6521 .unwrap_or("application/octet-stream");
6522 let content_type = super::ContentType::from(content_type);
6523
6524 if !status.is_client_error() && !status.is_server_error() {
6525 let content = resp.text().await?;
6526 match content_type {
6527 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6528 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetMarginAllOrderListV1RespItem>`"))),
6529 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::GetMarginAllOrderListV1RespItem>`")))),
6530 }
6531 } else {
6532 let content = resp.text().await?;
6533 let entity: Option<GetMarginAllOrderListV1Error> = serde_json::from_str(&content).ok();
6534 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6535 }
6536}
6537
6538pub async fn get_margin_all_orders_v1(configuration: &configuration::Configuration, params: GetMarginAllOrdersV1Params) -> Result<Vec<models::GetMarginAllOrdersV1RespItem>, Error<GetMarginAllOrdersV1Error>> {
6540
6541 let uri_str = format!("{}/papi/v1/margin/allOrders", configuration.base_path);
6542 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6543
6544 let mut query_params: Vec<(String, String)> = Vec::new();
6546
6547 query_params.push(("symbol".to_string(), params.symbol.to_string()));
6548 if let Some(ref param_value) = params.order_id {
6549 query_params.push(("orderId".to_string(), param_value.to_string()));
6550 }
6551 if let Some(ref param_value) = params.start_time {
6552 query_params.push(("startTime".to_string(), param_value.to_string()));
6553 }
6554 if let Some(ref param_value) = params.end_time {
6555 query_params.push(("endTime".to_string(), param_value.to_string()));
6556 }
6557 if let Some(ref param_value) = params.limit {
6558 query_params.push(("limit".to_string(), param_value.to_string()));
6559 }
6560 if let Some(ref param_value) = params.recv_window {
6561 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6562 }
6563 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6564
6565 let mut header_params = std::collections::HashMap::new();
6567
6568 if let Some(ref binance_auth) = configuration.binance_auth {
6570 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6572
6573 let body_string: Option<Vec<u8>> = None;
6575
6576 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6578 Ok(sig) => sig,
6579 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6580 };
6581
6582 query_params.push(("signature".to_string(), signature));
6584 }
6585
6586 if !query_params.is_empty() {
6588 req_builder = req_builder.query(&query_params);
6589 }
6590
6591
6592 if let Some(ref user_agent) = configuration.user_agent {
6594 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6595 }
6596
6597 for (header_name, header_value) in header_params {
6599 req_builder = req_builder.header(&header_name, &header_value);
6600 }
6601
6602
6603 let req = req_builder.build()?;
6604 let resp = configuration.client.execute(req).await?;
6605
6606 let status = resp.status();
6607 let content_type = resp
6608 .headers()
6609 .get("content-type")
6610 .and_then(|v| v.to_str().ok())
6611 .unwrap_or("application/octet-stream");
6612 let content_type = super::ContentType::from(content_type);
6613
6614 if !status.is_client_error() && !status.is_server_error() {
6615 let content = resp.text().await?;
6616 match content_type {
6617 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6618 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetMarginAllOrdersV1RespItem>`"))),
6619 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::GetMarginAllOrdersV1RespItem>`")))),
6620 }
6621 } else {
6622 let content = resp.text().await?;
6623 let entity: Option<GetMarginAllOrdersV1Error> = serde_json::from_str(&content).ok();
6624 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6625 }
6626}
6627
6628pub async fn get_margin_force_orders_v1(configuration: &configuration::Configuration, params: GetMarginForceOrdersV1Params) -> Result<models::GetMarginForceOrdersV1Resp, Error<GetMarginForceOrdersV1Error>> {
6630
6631 let uri_str = format!("{}/papi/v1/margin/forceOrders", configuration.base_path);
6632 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6633
6634 let mut query_params: Vec<(String, String)> = Vec::new();
6636
6637 if let Some(ref param_value) = params.start_time {
6638 query_params.push(("startTime".to_string(), param_value.to_string()));
6639 }
6640 if let Some(ref param_value) = params.end_time {
6641 query_params.push(("endTime".to_string(), param_value.to_string()));
6642 }
6643 if let Some(ref param_value) = params.current {
6644 query_params.push(("current".to_string(), param_value.to_string()));
6645 }
6646 if let Some(ref param_value) = params.size {
6647 query_params.push(("size".to_string(), param_value.to_string()));
6648 }
6649 if let Some(ref param_value) = params.recv_window {
6650 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6651 }
6652 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6653
6654 let mut header_params = std::collections::HashMap::new();
6656
6657 if let Some(ref binance_auth) = configuration.binance_auth {
6659 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6661
6662 let body_string: Option<Vec<u8>> = None;
6664
6665 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6667 Ok(sig) => sig,
6668 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6669 };
6670
6671 query_params.push(("signature".to_string(), signature));
6673 }
6674
6675 if !query_params.is_empty() {
6677 req_builder = req_builder.query(&query_params);
6678 }
6679
6680
6681 if let Some(ref user_agent) = configuration.user_agent {
6683 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6684 }
6685
6686 for (header_name, header_value) in header_params {
6688 req_builder = req_builder.header(&header_name, &header_value);
6689 }
6690
6691
6692 let req = req_builder.build()?;
6693 let resp = configuration.client.execute(req).await?;
6694
6695 let status = resp.status();
6696 let content_type = resp
6697 .headers()
6698 .get("content-type")
6699 .and_then(|v| v.to_str().ok())
6700 .unwrap_or("application/octet-stream");
6701 let content_type = super::ContentType::from(content_type);
6702
6703 if !status.is_client_error() && !status.is_server_error() {
6704 let content = resp.text().await?;
6705 match content_type {
6706 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6707 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMarginForceOrdersV1Resp`"))),
6708 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::GetMarginForceOrdersV1Resp`")))),
6709 }
6710 } else {
6711 let content = resp.text().await?;
6712 let entity: Option<GetMarginForceOrdersV1Error> = serde_json::from_str(&content).ok();
6713 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6714 }
6715}
6716
6717pub async fn get_margin_margin_interest_history_v1(configuration: &configuration::Configuration, params: GetMarginMarginInterestHistoryV1Params) -> Result<models::GetMarginMarginInterestHistoryV1Resp, Error<GetMarginMarginInterestHistoryV1Error>> {
6719
6720 let uri_str = format!("{}/papi/v1/margin/marginInterestHistory", configuration.base_path);
6721 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6722
6723 let mut query_params: Vec<(String, String)> = Vec::new();
6725
6726 if let Some(ref param_value) = params.asset {
6727 query_params.push(("asset".to_string(), param_value.to_string()));
6728 }
6729 if let Some(ref param_value) = params.start_time {
6730 query_params.push(("startTime".to_string(), param_value.to_string()));
6731 }
6732 if let Some(ref param_value) = params.end_time {
6733 query_params.push(("endTime".to_string(), param_value.to_string()));
6734 }
6735 if let Some(ref param_value) = params.current {
6736 query_params.push(("current".to_string(), param_value.to_string()));
6737 }
6738 if let Some(ref param_value) = params.size {
6739 query_params.push(("size".to_string(), param_value.to_string()));
6740 }
6741 if let Some(ref param_value) = params.archived {
6742 query_params.push(("archived".to_string(), param_value.to_string()));
6743 }
6744 if let Some(ref param_value) = params.recv_window {
6745 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6746 }
6747 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6748
6749 let mut header_params = std::collections::HashMap::new();
6751
6752 if let Some(ref binance_auth) = configuration.binance_auth {
6754 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6756
6757 let body_string: Option<Vec<u8>> = None;
6759
6760 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6762 Ok(sig) => sig,
6763 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6764 };
6765
6766 query_params.push(("signature".to_string(), signature));
6768 }
6769
6770 if !query_params.is_empty() {
6772 req_builder = req_builder.query(&query_params);
6773 }
6774
6775
6776 if let Some(ref user_agent) = configuration.user_agent {
6778 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6779 }
6780
6781 for (header_name, header_value) in header_params {
6783 req_builder = req_builder.header(&header_name, &header_value);
6784 }
6785
6786
6787 let req = req_builder.build()?;
6788 let resp = configuration.client.execute(req).await?;
6789
6790 let status = resp.status();
6791 let content_type = resp
6792 .headers()
6793 .get("content-type")
6794 .and_then(|v| v.to_str().ok())
6795 .unwrap_or("application/octet-stream");
6796 let content_type = super::ContentType::from(content_type);
6797
6798 if !status.is_client_error() && !status.is_server_error() {
6799 let content = resp.text().await?;
6800 match content_type {
6801 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6802 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMarginMarginInterestHistoryV1Resp`"))),
6803 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::GetMarginMarginInterestHistoryV1Resp`")))),
6804 }
6805 } else {
6806 let content = resp.text().await?;
6807 let entity: Option<GetMarginMarginInterestHistoryV1Error> = serde_json::from_str(&content).ok();
6808 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6809 }
6810}
6811
6812pub async fn get_margin_margin_loan_v1(configuration: &configuration::Configuration, params: GetMarginMarginLoanV1Params) -> Result<models::GetMarginMarginLoanV1Resp, Error<GetMarginMarginLoanV1Error>> {
6814
6815 let uri_str = format!("{}/papi/v1/margin/marginLoan", configuration.base_path);
6816 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6817
6818 let mut query_params: Vec<(String, String)> = Vec::new();
6820
6821 query_params.push(("asset".to_string(), params.asset.to_string()));
6822 if let Some(ref param_value) = params.tx_id {
6823 query_params.push(("txId".to_string(), param_value.to_string()));
6824 }
6825 if let Some(ref param_value) = params.start_time {
6826 query_params.push(("startTime".to_string(), param_value.to_string()));
6827 }
6828 if let Some(ref param_value) = params.end_time {
6829 query_params.push(("endTime".to_string(), param_value.to_string()));
6830 }
6831 if let Some(ref param_value) = params.current {
6832 query_params.push(("current".to_string(), param_value.to_string()));
6833 }
6834 if let Some(ref param_value) = params.size {
6835 query_params.push(("size".to_string(), param_value.to_string()));
6836 }
6837 if let Some(ref param_value) = params.archived {
6838 query_params.push(("archived".to_string(), param_value.to_string()));
6839 }
6840 if let Some(ref param_value) = params.recv_window {
6841 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6842 }
6843 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6844
6845 let mut header_params = std::collections::HashMap::new();
6847
6848 if let Some(ref binance_auth) = configuration.binance_auth {
6850 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6852
6853 let body_string: Option<Vec<u8>> = None;
6855
6856 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6858 Ok(sig) => sig,
6859 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6860 };
6861
6862 query_params.push(("signature".to_string(), signature));
6864 }
6865
6866 if !query_params.is_empty() {
6868 req_builder = req_builder.query(&query_params);
6869 }
6870
6871
6872 if let Some(ref user_agent) = configuration.user_agent {
6874 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6875 }
6876
6877 for (header_name, header_value) in header_params {
6879 req_builder = req_builder.header(&header_name, &header_value);
6880 }
6881
6882
6883 let req = req_builder.build()?;
6884 let resp = configuration.client.execute(req).await?;
6885
6886 let status = resp.status();
6887 let content_type = resp
6888 .headers()
6889 .get("content-type")
6890 .and_then(|v| v.to_str().ok())
6891 .unwrap_or("application/octet-stream");
6892 let content_type = super::ContentType::from(content_type);
6893
6894 if !status.is_client_error() && !status.is_server_error() {
6895 let content = resp.text().await?;
6896 match content_type {
6897 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6898 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMarginMarginLoanV1Resp`"))),
6899 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::GetMarginMarginLoanV1Resp`")))),
6900 }
6901 } else {
6902 let content = resp.text().await?;
6903 let entity: Option<GetMarginMarginLoanV1Error> = serde_json::from_str(&content).ok();
6904 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6905 }
6906}
6907
6908pub async fn get_margin_max_borrowable_v1(configuration: &configuration::Configuration, params: GetMarginMaxBorrowableV1Params) -> Result<models::GetMarginMaxBorrowableV1Resp, Error<GetMarginMaxBorrowableV1Error>> {
6910
6911 let uri_str = format!("{}/papi/v1/margin/maxBorrowable", configuration.base_path);
6912 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6913
6914 let mut query_params: Vec<(String, String)> = Vec::new();
6916
6917 query_params.push(("asset".to_string(), params.asset.to_string()));
6918 if let Some(ref param_value) = params.recv_window {
6919 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6920 }
6921 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6922
6923 let mut header_params = std::collections::HashMap::new();
6925
6926 if let Some(ref binance_auth) = configuration.binance_auth {
6928 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6930
6931 let body_string: Option<Vec<u8>> = None;
6933
6934 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6936 Ok(sig) => sig,
6937 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6938 };
6939
6940 query_params.push(("signature".to_string(), signature));
6942 }
6943
6944 if !query_params.is_empty() {
6946 req_builder = req_builder.query(&query_params);
6947 }
6948
6949
6950 if let Some(ref user_agent) = configuration.user_agent {
6952 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6953 }
6954
6955 for (header_name, header_value) in header_params {
6957 req_builder = req_builder.header(&header_name, &header_value);
6958 }
6959
6960
6961 let req = req_builder.build()?;
6962 let resp = configuration.client.execute(req).await?;
6963
6964 let status = resp.status();
6965 let content_type = resp
6966 .headers()
6967 .get("content-type")
6968 .and_then(|v| v.to_str().ok())
6969 .unwrap_or("application/octet-stream");
6970 let content_type = super::ContentType::from(content_type);
6971
6972 if !status.is_client_error() && !status.is_server_error() {
6973 let content = resp.text().await?;
6974 match content_type {
6975 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6976 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMarginMaxBorrowableV1Resp`"))),
6977 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::GetMarginMaxBorrowableV1Resp`")))),
6978 }
6979 } else {
6980 let content = resp.text().await?;
6981 let entity: Option<GetMarginMaxBorrowableV1Error> = serde_json::from_str(&content).ok();
6982 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6983 }
6984}
6985
6986pub async fn get_margin_max_withdraw_v1(configuration: &configuration::Configuration, params: GetMarginMaxWithdrawV1Params) -> Result<models::GetMarginMaxWithdrawV1Resp, Error<GetMarginMaxWithdrawV1Error>> {
6988
6989 let uri_str = format!("{}/papi/v1/margin/maxWithdraw", configuration.base_path);
6990 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6991
6992 let mut query_params: Vec<(String, String)> = Vec::new();
6994
6995 query_params.push(("asset".to_string(), params.asset.to_string()));
6996 if let Some(ref param_value) = params.recv_window {
6997 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6998 }
6999 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7000
7001 let mut header_params = std::collections::HashMap::new();
7003
7004 if let Some(ref binance_auth) = configuration.binance_auth {
7006 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7008
7009 let body_string: Option<Vec<u8>> = None;
7011
7012 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7014 Ok(sig) => sig,
7015 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7016 };
7017
7018 query_params.push(("signature".to_string(), signature));
7020 }
7021
7022 if !query_params.is_empty() {
7024 req_builder = req_builder.query(&query_params);
7025 }
7026
7027
7028 if let Some(ref user_agent) = configuration.user_agent {
7030 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7031 }
7032
7033 for (header_name, header_value) in header_params {
7035 req_builder = req_builder.header(&header_name, &header_value);
7036 }
7037
7038
7039 let req = req_builder.build()?;
7040 let resp = configuration.client.execute(req).await?;
7041
7042 let status = resp.status();
7043 let content_type = resp
7044 .headers()
7045 .get("content-type")
7046 .and_then(|v| v.to_str().ok())
7047 .unwrap_or("application/octet-stream");
7048 let content_type = super::ContentType::from(content_type);
7049
7050 if !status.is_client_error() && !status.is_server_error() {
7051 let content = resp.text().await?;
7052 match content_type {
7053 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7054 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMarginMaxWithdrawV1Resp`"))),
7055 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::GetMarginMaxWithdrawV1Resp`")))),
7056 }
7057 } else {
7058 let content = resp.text().await?;
7059 let entity: Option<GetMarginMaxWithdrawV1Error> = serde_json::from_str(&content).ok();
7060 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7061 }
7062}
7063
7064pub async fn get_margin_my_trades_v1(configuration: &configuration::Configuration, params: GetMarginMyTradesV1Params) -> Result<Vec<models::GetMarginMyTradesV1RespItem>, Error<GetMarginMyTradesV1Error>> {
7066
7067 let uri_str = format!("{}/papi/v1/margin/myTrades", configuration.base_path);
7068 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7069
7070 let mut query_params: Vec<(String, String)> = Vec::new();
7072
7073 query_params.push(("symbol".to_string(), params.symbol.to_string()));
7074 if let Some(ref param_value) = params.order_id {
7075 query_params.push(("orderId".to_string(), param_value.to_string()));
7076 }
7077 if let Some(ref param_value) = params.start_time {
7078 query_params.push(("startTime".to_string(), param_value.to_string()));
7079 }
7080 if let Some(ref param_value) = params.end_time {
7081 query_params.push(("endTime".to_string(), param_value.to_string()));
7082 }
7083 if let Some(ref param_value) = params.from_id {
7084 query_params.push(("fromId".to_string(), param_value.to_string()));
7085 }
7086 if let Some(ref param_value) = params.limit {
7087 query_params.push(("limit".to_string(), param_value.to_string()));
7088 }
7089 if let Some(ref param_value) = params.recv_window {
7090 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7091 }
7092 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7093
7094 let mut header_params = std::collections::HashMap::new();
7096
7097 if let Some(ref binance_auth) = configuration.binance_auth {
7099 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7101
7102 let body_string: Option<Vec<u8>> = None;
7104
7105 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7107 Ok(sig) => sig,
7108 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7109 };
7110
7111 query_params.push(("signature".to_string(), signature));
7113 }
7114
7115 if !query_params.is_empty() {
7117 req_builder = req_builder.query(&query_params);
7118 }
7119
7120
7121 if let Some(ref user_agent) = configuration.user_agent {
7123 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7124 }
7125
7126 for (header_name, header_value) in header_params {
7128 req_builder = req_builder.header(&header_name, &header_value);
7129 }
7130
7131
7132 let req = req_builder.build()?;
7133 let resp = configuration.client.execute(req).await?;
7134
7135 let status = resp.status();
7136 let content_type = resp
7137 .headers()
7138 .get("content-type")
7139 .and_then(|v| v.to_str().ok())
7140 .unwrap_or("application/octet-stream");
7141 let content_type = super::ContentType::from(content_type);
7142
7143 if !status.is_client_error() && !status.is_server_error() {
7144 let content = resp.text().await?;
7145 match content_type {
7146 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7147 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetMarginMyTradesV1RespItem>`"))),
7148 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::GetMarginMyTradesV1RespItem>`")))),
7149 }
7150 } else {
7151 let content = resp.text().await?;
7152 let entity: Option<GetMarginMyTradesV1Error> = serde_json::from_str(&content).ok();
7153 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7154 }
7155}
7156
7157pub async fn get_margin_open_order_list_v1(configuration: &configuration::Configuration, params: GetMarginOpenOrderListV1Params) -> Result<Vec<models::GetMarginOpenOrderListV1RespItem>, Error<GetMarginOpenOrderListV1Error>> {
7159
7160 let uri_str = format!("{}/papi/v1/margin/openOrderList", configuration.base_path);
7161 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7162
7163 let mut query_params: Vec<(String, String)> = Vec::new();
7165
7166 if let Some(ref param_value) = params.recv_window {
7167 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7168 }
7169 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7170
7171 let mut header_params = std::collections::HashMap::new();
7173
7174 if let Some(ref binance_auth) = configuration.binance_auth {
7176 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7178
7179 let body_string: Option<Vec<u8>> = None;
7181
7182 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7184 Ok(sig) => sig,
7185 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7186 };
7187
7188 query_params.push(("signature".to_string(), signature));
7190 }
7191
7192 if !query_params.is_empty() {
7194 req_builder = req_builder.query(&query_params);
7195 }
7196
7197
7198 if let Some(ref user_agent) = configuration.user_agent {
7200 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7201 }
7202
7203 for (header_name, header_value) in header_params {
7205 req_builder = req_builder.header(&header_name, &header_value);
7206 }
7207
7208
7209 let req = req_builder.build()?;
7210 let resp = configuration.client.execute(req).await?;
7211
7212 let status = resp.status();
7213 let content_type = resp
7214 .headers()
7215 .get("content-type")
7216 .and_then(|v| v.to_str().ok())
7217 .unwrap_or("application/octet-stream");
7218 let content_type = super::ContentType::from(content_type);
7219
7220 if !status.is_client_error() && !status.is_server_error() {
7221 let content = resp.text().await?;
7222 match content_type {
7223 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7224 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetMarginOpenOrderListV1RespItem>`"))),
7225 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::GetMarginOpenOrderListV1RespItem>`")))),
7226 }
7227 } else {
7228 let content = resp.text().await?;
7229 let entity: Option<GetMarginOpenOrderListV1Error> = serde_json::from_str(&content).ok();
7230 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7231 }
7232}
7233
7234pub async fn get_margin_open_orders_v1(configuration: &configuration::Configuration, params: GetMarginOpenOrdersV1Params) -> Result<Vec<models::GetMarginOpenOrdersV1RespItem>, Error<GetMarginOpenOrdersV1Error>> {
7236
7237 let uri_str = format!("{}/papi/v1/margin/openOrders", configuration.base_path);
7238 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7239
7240 let mut query_params: Vec<(String, String)> = Vec::new();
7242
7243 query_params.push(("symbol".to_string(), params.symbol.to_string()));
7244 if let Some(ref param_value) = params.recv_window {
7245 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7246 }
7247 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7248
7249 let mut header_params = std::collections::HashMap::new();
7251
7252 if let Some(ref binance_auth) = configuration.binance_auth {
7254 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7256
7257 let body_string: Option<Vec<u8>> = None;
7259
7260 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7262 Ok(sig) => sig,
7263 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7264 };
7265
7266 query_params.push(("signature".to_string(), signature));
7268 }
7269
7270 if !query_params.is_empty() {
7272 req_builder = req_builder.query(&query_params);
7273 }
7274
7275
7276 if let Some(ref user_agent) = configuration.user_agent {
7278 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7279 }
7280
7281 for (header_name, header_value) in header_params {
7283 req_builder = req_builder.header(&header_name, &header_value);
7284 }
7285
7286
7287 let req = req_builder.build()?;
7288 let resp = configuration.client.execute(req).await?;
7289
7290 let status = resp.status();
7291 let content_type = resp
7292 .headers()
7293 .get("content-type")
7294 .and_then(|v| v.to_str().ok())
7295 .unwrap_or("application/octet-stream");
7296 let content_type = super::ContentType::from(content_type);
7297
7298 if !status.is_client_error() && !status.is_server_error() {
7299 let content = resp.text().await?;
7300 match content_type {
7301 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7302 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetMarginOpenOrdersV1RespItem>`"))),
7303 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::GetMarginOpenOrdersV1RespItem>`")))),
7304 }
7305 } else {
7306 let content = resp.text().await?;
7307 let entity: Option<GetMarginOpenOrdersV1Error> = serde_json::from_str(&content).ok();
7308 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7309 }
7310}
7311
7312pub async fn get_margin_order_list_v1(configuration: &configuration::Configuration, params: GetMarginOrderListV1Params) -> Result<models::GetMarginOrderListV1Resp, Error<GetMarginOrderListV1Error>> {
7314
7315 let uri_str = format!("{}/papi/v1/margin/orderList", configuration.base_path);
7316 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7317
7318 let mut query_params: Vec<(String, String)> = Vec::new();
7320
7321 if let Some(ref param_value) = params.order_list_id {
7322 query_params.push(("orderListId".to_string(), param_value.to_string()));
7323 }
7324 if let Some(ref param_value) = params.orig_client_order_id {
7325 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
7326 }
7327 if let Some(ref param_value) = params.recv_window {
7328 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7329 }
7330 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7331
7332 let mut header_params = std::collections::HashMap::new();
7334
7335 if let Some(ref binance_auth) = configuration.binance_auth {
7337 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7339
7340 let body_string: Option<Vec<u8>> = None;
7342
7343 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7345 Ok(sig) => sig,
7346 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7347 };
7348
7349 query_params.push(("signature".to_string(), signature));
7351 }
7352
7353 if !query_params.is_empty() {
7355 req_builder = req_builder.query(&query_params);
7356 }
7357
7358
7359 if let Some(ref user_agent) = configuration.user_agent {
7361 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7362 }
7363
7364 for (header_name, header_value) in header_params {
7366 req_builder = req_builder.header(&header_name, &header_value);
7367 }
7368
7369
7370 let req = req_builder.build()?;
7371 let resp = configuration.client.execute(req).await?;
7372
7373 let status = resp.status();
7374 let content_type = resp
7375 .headers()
7376 .get("content-type")
7377 .and_then(|v| v.to_str().ok())
7378 .unwrap_or("application/octet-stream");
7379 let content_type = super::ContentType::from(content_type);
7380
7381 if !status.is_client_error() && !status.is_server_error() {
7382 let content = resp.text().await?;
7383 match content_type {
7384 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7385 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMarginOrderListV1Resp`"))),
7386 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::GetMarginOrderListV1Resp`")))),
7387 }
7388 } else {
7389 let content = resp.text().await?;
7390 let entity: Option<GetMarginOrderListV1Error> = serde_json::from_str(&content).ok();
7391 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7392 }
7393}
7394
7395pub async fn get_margin_order_v1(configuration: &configuration::Configuration, params: GetMarginOrderV1Params) -> Result<models::GetMarginOrderV1Resp, Error<GetMarginOrderV1Error>> {
7397
7398 let uri_str = format!("{}/papi/v1/margin/order", configuration.base_path);
7399 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7400
7401 let mut query_params: Vec<(String, String)> = Vec::new();
7403
7404 query_params.push(("symbol".to_string(), params.symbol.to_string()));
7405 if let Some(ref param_value) = params.order_id {
7406 query_params.push(("orderId".to_string(), param_value.to_string()));
7407 }
7408 if let Some(ref param_value) = params.orig_client_order_id {
7409 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
7410 }
7411 if let Some(ref param_value) = params.recv_window {
7412 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7413 }
7414 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7415
7416 let mut header_params = std::collections::HashMap::new();
7418
7419 if let Some(ref binance_auth) = configuration.binance_auth {
7421 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7423
7424 let body_string: Option<Vec<u8>> = None;
7426
7427 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7429 Ok(sig) => sig,
7430 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7431 };
7432
7433 query_params.push(("signature".to_string(), signature));
7435 }
7436
7437 if !query_params.is_empty() {
7439 req_builder = req_builder.query(&query_params);
7440 }
7441
7442
7443 if let Some(ref user_agent) = configuration.user_agent {
7445 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7446 }
7447
7448 for (header_name, header_value) in header_params {
7450 req_builder = req_builder.header(&header_name, &header_value);
7451 }
7452
7453
7454 let req = req_builder.build()?;
7455 let resp = configuration.client.execute(req).await?;
7456
7457 let status = resp.status();
7458 let content_type = resp
7459 .headers()
7460 .get("content-type")
7461 .and_then(|v| v.to_str().ok())
7462 .unwrap_or("application/octet-stream");
7463 let content_type = super::ContentType::from(content_type);
7464
7465 if !status.is_client_error() && !status.is_server_error() {
7466 let content = resp.text().await?;
7467 match content_type {
7468 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7469 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMarginOrderV1Resp`"))),
7470 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::GetMarginOrderV1Resp`")))),
7471 }
7472 } else {
7473 let content = resp.text().await?;
7474 let entity: Option<GetMarginOrderV1Error> = serde_json::from_str(&content).ok();
7475 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7476 }
7477}
7478
7479pub async fn get_margin_repay_loan_v1(configuration: &configuration::Configuration, params: GetMarginRepayLoanV1Params) -> Result<models::GetMarginRepayLoanV1Resp, Error<GetMarginRepayLoanV1Error>> {
7481
7482 let uri_str = format!("{}/papi/v1/margin/repayLoan", configuration.base_path);
7483 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7484
7485 let mut query_params: Vec<(String, String)> = Vec::new();
7487
7488 query_params.push(("asset".to_string(), params.asset.to_string()));
7489 if let Some(ref param_value) = params.tx_id {
7490 query_params.push(("txId".to_string(), param_value.to_string()));
7491 }
7492 if let Some(ref param_value) = params.start_time {
7493 query_params.push(("startTime".to_string(), param_value.to_string()));
7494 }
7495 if let Some(ref param_value) = params.end_time {
7496 query_params.push(("endTime".to_string(), param_value.to_string()));
7497 }
7498 if let Some(ref param_value) = params.current {
7499 query_params.push(("current".to_string(), param_value.to_string()));
7500 }
7501 if let Some(ref param_value) = params.size {
7502 query_params.push(("size".to_string(), param_value.to_string()));
7503 }
7504 if let Some(ref param_value) = params.archived {
7505 query_params.push(("archived".to_string(), param_value.to_string()));
7506 }
7507 if let Some(ref param_value) = params.recv_window {
7508 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7509 }
7510 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7511
7512 let mut header_params = std::collections::HashMap::new();
7514
7515 if let Some(ref binance_auth) = configuration.binance_auth {
7517 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7519
7520 let body_string: Option<Vec<u8>> = None;
7522
7523 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7525 Ok(sig) => sig,
7526 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7527 };
7528
7529 query_params.push(("signature".to_string(), signature));
7531 }
7532
7533 if !query_params.is_empty() {
7535 req_builder = req_builder.query(&query_params);
7536 }
7537
7538
7539 if let Some(ref user_agent) = configuration.user_agent {
7541 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7542 }
7543
7544 for (header_name, header_value) in header_params {
7546 req_builder = req_builder.header(&header_name, &header_value);
7547 }
7548
7549
7550 let req = req_builder.build()?;
7551 let resp = configuration.client.execute(req).await?;
7552
7553 let status = resp.status();
7554 let content_type = resp
7555 .headers()
7556 .get("content-type")
7557 .and_then(|v| v.to_str().ok())
7558 .unwrap_or("application/octet-stream");
7559 let content_type = super::ContentType::from(content_type);
7560
7561 if !status.is_client_error() && !status.is_server_error() {
7562 let content = resp.text().await?;
7563 match content_type {
7564 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7565 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMarginRepayLoanV1Resp`"))),
7566 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::GetMarginRepayLoanV1Resp`")))),
7567 }
7568 } else {
7569 let content = resp.text().await?;
7570 let entity: Option<GetMarginRepayLoanV1Error> = serde_json::from_str(&content).ok();
7571 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7572 }
7573}
7574
7575pub async fn get_ping_v1(configuration: &configuration::Configuration) -> Result<serde_json::Value, Error<GetPingV1Error>> {
7577
7578 let uri_str = format!("{}/papi/v1/ping", configuration.base_path);
7579 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7580
7581 let mut query_params: Vec<(String, String)> = Vec::new();
7583
7584
7585 let mut header_params = std::collections::HashMap::new();
7587
7588 if let Some(ref binance_auth) = configuration.binance_auth {
7590 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7592
7593 let body_string: Option<Vec<u8>> = None;
7595
7596 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7598 Ok(sig) => sig,
7599 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7600 };
7601
7602 query_params.push(("signature".to_string(), signature));
7604 }
7605
7606 if !query_params.is_empty() {
7608 req_builder = req_builder.query(&query_params);
7609 }
7610
7611
7612 if let Some(ref user_agent) = configuration.user_agent {
7614 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7615 }
7616
7617 for (header_name, header_value) in header_params {
7619 req_builder = req_builder.header(&header_name, &header_value);
7620 }
7621
7622
7623 let req = req_builder.build()?;
7624 let resp = configuration.client.execute(req).await?;
7625
7626 let status = resp.status();
7627 let content_type = resp
7628 .headers()
7629 .get("content-type")
7630 .and_then(|v| v.to_str().ok())
7631 .unwrap_or("application/octet-stream");
7632 let content_type = super::ContentType::from(content_type);
7633
7634 if !status.is_client_error() && !status.is_server_error() {
7635 let content = resp.text().await?;
7636 match content_type {
7637 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7638 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
7639 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
7640 }
7641 } else {
7642 let content = resp.text().await?;
7643 let entity: Option<GetPingV1Error> = serde_json::from_str(&content).ok();
7644 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7645 }
7646}
7647
7648pub async fn get_portfolio_interest_history_v1(configuration: &configuration::Configuration, params: GetPortfolioInterestHistoryV1Params) -> Result<Vec<models::GetPortfolioInterestHistoryV1RespItem>, Error<GetPortfolioInterestHistoryV1Error>> {
7650
7651 let uri_str = format!("{}/papi/v1/portfolio/interest-history", configuration.base_path);
7652 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7653
7654 let mut query_params: Vec<(String, String)> = Vec::new();
7656
7657 if let Some(ref param_value) = params.asset {
7658 query_params.push(("asset".to_string(), param_value.to_string()));
7659 }
7660 if let Some(ref param_value) = params.start_time {
7661 query_params.push(("startTime".to_string(), param_value.to_string()));
7662 }
7663 if let Some(ref param_value) = params.end_time {
7664 query_params.push(("endTime".to_string(), param_value.to_string()));
7665 }
7666 if let Some(ref param_value) = params.size {
7667 query_params.push(("size".to_string(), param_value.to_string()));
7668 }
7669 if let Some(ref param_value) = params.recv_window {
7670 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7671 }
7672 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7673
7674 let mut header_params = std::collections::HashMap::new();
7676
7677 if let Some(ref binance_auth) = configuration.binance_auth {
7679 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7681
7682 let body_string: Option<Vec<u8>> = None;
7684
7685 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7687 Ok(sig) => sig,
7688 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7689 };
7690
7691 query_params.push(("signature".to_string(), signature));
7693 }
7694
7695 if !query_params.is_empty() {
7697 req_builder = req_builder.query(&query_params);
7698 }
7699
7700
7701 if let Some(ref user_agent) = configuration.user_agent {
7703 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7704 }
7705
7706 for (header_name, header_value) in header_params {
7708 req_builder = req_builder.header(&header_name, &header_value);
7709 }
7710
7711
7712 let req = req_builder.build()?;
7713 let resp = configuration.client.execute(req).await?;
7714
7715 let status = resp.status();
7716 let content_type = resp
7717 .headers()
7718 .get("content-type")
7719 .and_then(|v| v.to_str().ok())
7720 .unwrap_or("application/octet-stream");
7721 let content_type = super::ContentType::from(content_type);
7722
7723 if !status.is_client_error() && !status.is_server_error() {
7724 let content = resp.text().await?;
7725 match content_type {
7726 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7727 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetPortfolioInterestHistoryV1RespItem>`"))),
7728 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::GetPortfolioInterestHistoryV1RespItem>`")))),
7729 }
7730 } else {
7731 let content = resp.text().await?;
7732 let entity: Option<GetPortfolioInterestHistoryV1Error> = serde_json::from_str(&content).ok();
7733 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7734 }
7735}
7736
7737pub async fn get_portfolio_negative_balance_exchange_record_v1(configuration: &configuration::Configuration, params: GetPortfolioNegativeBalanceExchangeRecordV1Params) -> Result<models::GetPortfolioNegativeBalanceExchangeRecordV1Resp, Error<GetPortfolioNegativeBalanceExchangeRecordV1Error>> {
7739
7740 let uri_str = format!("{}/papi/v1/portfolio/negative-balance-exchange-record", configuration.base_path);
7741 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7742
7743 let mut query_params: Vec<(String, String)> = Vec::new();
7745
7746 query_params.push(("startTime".to_string(), params.start_time.to_string()));
7747 query_params.push(("endTime".to_string(), params.end_time.to_string()));
7748 if let Some(ref param_value) = params.recv_window {
7749 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7750 }
7751 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7752
7753 let mut header_params = std::collections::HashMap::new();
7755
7756 if let Some(ref binance_auth) = configuration.binance_auth {
7758 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7760
7761 let body_string: Option<Vec<u8>> = None;
7763
7764 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7766 Ok(sig) => sig,
7767 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7768 };
7769
7770 query_params.push(("signature".to_string(), signature));
7772 }
7773
7774 if !query_params.is_empty() {
7776 req_builder = req_builder.query(&query_params);
7777 }
7778
7779
7780 if let Some(ref user_agent) = configuration.user_agent {
7782 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7783 }
7784
7785 for (header_name, header_value) in header_params {
7787 req_builder = req_builder.header(&header_name, &header_value);
7788 }
7789
7790
7791 let req = req_builder.build()?;
7792 let resp = configuration.client.execute(req).await?;
7793
7794 let status = resp.status();
7795 let content_type = resp
7796 .headers()
7797 .get("content-type")
7798 .and_then(|v| v.to_str().ok())
7799 .unwrap_or("application/octet-stream");
7800 let content_type = super::ContentType::from(content_type);
7801
7802 if !status.is_client_error() && !status.is_server_error() {
7803 let content = resp.text().await?;
7804 match content_type {
7805 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7806 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetPortfolioNegativeBalanceExchangeRecordV1Resp`"))),
7807 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::GetPortfolioNegativeBalanceExchangeRecordV1Resp`")))),
7808 }
7809 } else {
7810 let content = resp.text().await?;
7811 let entity: Option<GetPortfolioNegativeBalanceExchangeRecordV1Error> = serde_json::from_str(&content).ok();
7812 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7813 }
7814}
7815
7816pub async fn get_rate_limit_order_v1(configuration: &configuration::Configuration, params: GetRateLimitOrderV1Params) -> Result<Vec<models::GetRateLimitOrderV1RespItem>, Error<GetRateLimitOrderV1Error>> {
7818
7819 let uri_str = format!("{}/papi/v1/rateLimit/order", configuration.base_path);
7820 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7821
7822 let mut query_params: Vec<(String, String)> = Vec::new();
7824
7825 if let Some(ref param_value) = params.recv_window {
7826 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7827 }
7828 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7829
7830 let mut header_params = std::collections::HashMap::new();
7832
7833 if let Some(ref binance_auth) = configuration.binance_auth {
7835 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7837
7838 let body_string: Option<Vec<u8>> = None;
7840
7841 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7843 Ok(sig) => sig,
7844 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7845 };
7846
7847 query_params.push(("signature".to_string(), signature));
7849 }
7850
7851 if !query_params.is_empty() {
7853 req_builder = req_builder.query(&query_params);
7854 }
7855
7856
7857 if let Some(ref user_agent) = configuration.user_agent {
7859 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7860 }
7861
7862 for (header_name, header_value) in header_params {
7864 req_builder = req_builder.header(&header_name, &header_value);
7865 }
7866
7867
7868 let req = req_builder.build()?;
7869 let resp = configuration.client.execute(req).await?;
7870
7871 let status = resp.status();
7872 let content_type = resp
7873 .headers()
7874 .get("content-type")
7875 .and_then(|v| v.to_str().ok())
7876 .unwrap_or("application/octet-stream");
7877 let content_type = super::ContentType::from(content_type);
7878
7879 if !status.is_client_error() && !status.is_server_error() {
7880 let content = resp.text().await?;
7881 match content_type {
7882 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7883 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetRateLimitOrderV1RespItem>`"))),
7884 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::GetRateLimitOrderV1RespItem>`")))),
7885 }
7886 } else {
7887 let content = resp.text().await?;
7888 let entity: Option<GetRateLimitOrderV1Error> = serde_json::from_str(&content).ok();
7889 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7890 }
7891}
7892
7893pub async fn get_repay_futures_switch_v1(configuration: &configuration::Configuration, params: GetRepayFuturesSwitchV1Params) -> Result<models::GetRepayFuturesSwitchV1Resp, Error<GetRepayFuturesSwitchV1Error>> {
7895
7896 let uri_str = format!("{}/papi/v1/repay-futures-switch", configuration.base_path);
7897 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7898
7899 let mut query_params: Vec<(String, String)> = Vec::new();
7901
7902 if let Some(ref param_value) = params.recv_window {
7903 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7904 }
7905 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7906
7907 let mut header_params = std::collections::HashMap::new();
7909
7910 if let Some(ref binance_auth) = configuration.binance_auth {
7912 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7914
7915 let body_string: Option<Vec<u8>> = None;
7917
7918 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7920 Ok(sig) => sig,
7921 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7922 };
7923
7924 query_params.push(("signature".to_string(), signature));
7926 }
7927
7928 if !query_params.is_empty() {
7930 req_builder = req_builder.query(&query_params);
7931 }
7932
7933
7934 if let Some(ref user_agent) = configuration.user_agent {
7936 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7937 }
7938
7939 for (header_name, header_value) in header_params {
7941 req_builder = req_builder.header(&header_name, &header_value);
7942 }
7943
7944
7945 let req = req_builder.build()?;
7946 let resp = configuration.client.execute(req).await?;
7947
7948 let status = resp.status();
7949 let content_type = resp
7950 .headers()
7951 .get("content-type")
7952 .and_then(|v| v.to_str().ok())
7953 .unwrap_or("application/octet-stream");
7954 let content_type = super::ContentType::from(content_type);
7955
7956 if !status.is_client_error() && !status.is_server_error() {
7957 let content = resp.text().await?;
7958 match content_type {
7959 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7960 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetRepayFuturesSwitchV1Resp`"))),
7961 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::GetRepayFuturesSwitchV1Resp`")))),
7962 }
7963 } else {
7964 let content = resp.text().await?;
7965 let entity: Option<GetRepayFuturesSwitchV1Error> = serde_json::from_str(&content).ok();
7966 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7967 }
7968}
7969
7970pub async fn get_um_account_config_v1(configuration: &configuration::Configuration, params: GetUmAccountConfigV1Params) -> Result<models::GetUmAccountConfigV1Resp, Error<GetUmAccountConfigV1Error>> {
7972
7973 let uri_str = format!("{}/papi/v1/um/accountConfig", configuration.base_path);
7974 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7975
7976 let mut query_params: Vec<(String, String)> = Vec::new();
7978
7979 if let Some(ref param_value) = params.recv_window {
7980 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7981 }
7982 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7983
7984 let mut header_params = std::collections::HashMap::new();
7986
7987 if let Some(ref binance_auth) = configuration.binance_auth {
7989 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7991
7992 let body_string: Option<Vec<u8>> = None;
7994
7995 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7997 Ok(sig) => sig,
7998 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7999 };
8000
8001 query_params.push(("signature".to_string(), signature));
8003 }
8004
8005 if !query_params.is_empty() {
8007 req_builder = req_builder.query(&query_params);
8008 }
8009
8010
8011 if let Some(ref user_agent) = configuration.user_agent {
8013 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8014 }
8015
8016 for (header_name, header_value) in header_params {
8018 req_builder = req_builder.header(&header_name, &header_value);
8019 }
8020
8021
8022 let req = req_builder.build()?;
8023 let resp = configuration.client.execute(req).await?;
8024
8025 let status = resp.status();
8026 let content_type = resp
8027 .headers()
8028 .get("content-type")
8029 .and_then(|v| v.to_str().ok())
8030 .unwrap_or("application/octet-stream");
8031 let content_type = super::ContentType::from(content_type);
8032
8033 if !status.is_client_error() && !status.is_server_error() {
8034 let content = resp.text().await?;
8035 match content_type {
8036 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8037 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmAccountConfigV1Resp`"))),
8038 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::GetUmAccountConfigV1Resp`")))),
8039 }
8040 } else {
8041 let content = resp.text().await?;
8042 let entity: Option<GetUmAccountConfigV1Error> = serde_json::from_str(&content).ok();
8043 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8044 }
8045}
8046
8047pub async fn get_um_account_v1(configuration: &configuration::Configuration, params: GetUmAccountV1Params) -> Result<models::GetUmAccountV1Resp, Error<GetUmAccountV1Error>> {
8049
8050 let uri_str = format!("{}/papi/v1/um/account", configuration.base_path);
8051 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8052
8053 let mut query_params: Vec<(String, String)> = Vec::new();
8055
8056 if let Some(ref param_value) = params.recv_window {
8057 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8058 }
8059 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8060
8061 let mut header_params = std::collections::HashMap::new();
8063
8064 if let Some(ref binance_auth) = configuration.binance_auth {
8066 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8068
8069 let body_string: Option<Vec<u8>> = None;
8071
8072 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8074 Ok(sig) => sig,
8075 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8076 };
8077
8078 query_params.push(("signature".to_string(), signature));
8080 }
8081
8082 if !query_params.is_empty() {
8084 req_builder = req_builder.query(&query_params);
8085 }
8086
8087
8088 if let Some(ref user_agent) = configuration.user_agent {
8090 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8091 }
8092
8093 for (header_name, header_value) in header_params {
8095 req_builder = req_builder.header(&header_name, &header_value);
8096 }
8097
8098
8099 let req = req_builder.build()?;
8100 let resp = configuration.client.execute(req).await?;
8101
8102 let status = resp.status();
8103 let content_type = resp
8104 .headers()
8105 .get("content-type")
8106 .and_then(|v| v.to_str().ok())
8107 .unwrap_or("application/octet-stream");
8108 let content_type = super::ContentType::from(content_type);
8109
8110 if !status.is_client_error() && !status.is_server_error() {
8111 let content = resp.text().await?;
8112 match content_type {
8113 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8114 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmAccountV1Resp`"))),
8115 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::GetUmAccountV1Resp`")))),
8116 }
8117 } else {
8118 let content = resp.text().await?;
8119 let entity: Option<GetUmAccountV1Error> = serde_json::from_str(&content).ok();
8120 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8121 }
8122}
8123
8124pub async fn get_um_account_v2(configuration: &configuration::Configuration, params: GetUmAccountV2Params) -> Result<models::GetUmAccountV2Resp, Error<GetUmAccountV2Error>> {
8126
8127 let uri_str = format!("{}/papi/v2/um/account", configuration.base_path);
8128 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8129
8130 let mut query_params: Vec<(String, String)> = Vec::new();
8132
8133 if let Some(ref param_value) = params.recv_window {
8134 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8135 }
8136 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8137
8138 let mut header_params = std::collections::HashMap::new();
8140
8141 if let Some(ref binance_auth) = configuration.binance_auth {
8143 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8145
8146 let body_string: Option<Vec<u8>> = None;
8148
8149 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8151 Ok(sig) => sig,
8152 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8153 };
8154
8155 query_params.push(("signature".to_string(), signature));
8157 }
8158
8159 if !query_params.is_empty() {
8161 req_builder = req_builder.query(&query_params);
8162 }
8163
8164
8165 if let Some(ref user_agent) = configuration.user_agent {
8167 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8168 }
8169
8170 for (header_name, header_value) in header_params {
8172 req_builder = req_builder.header(&header_name, &header_value);
8173 }
8174
8175
8176 let req = req_builder.build()?;
8177 let resp = configuration.client.execute(req).await?;
8178
8179 let status = resp.status();
8180 let content_type = resp
8181 .headers()
8182 .get("content-type")
8183 .and_then(|v| v.to_str().ok())
8184 .unwrap_or("application/octet-stream");
8185 let content_type = super::ContentType::from(content_type);
8186
8187 if !status.is_client_error() && !status.is_server_error() {
8188 let content = resp.text().await?;
8189 match content_type {
8190 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8191 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmAccountV2Resp`"))),
8192 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::GetUmAccountV2Resp`")))),
8193 }
8194 } else {
8195 let content = resp.text().await?;
8196 let entity: Option<GetUmAccountV2Error> = serde_json::from_str(&content).ok();
8197 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8198 }
8199}
8200
8201pub async fn get_um_adl_quantile_v1(configuration: &configuration::Configuration, params: GetUmAdlQuantileV1Params) -> Result<Vec<models::GetUmAdlQuantileV1RespItem>, Error<GetUmAdlQuantileV1Error>> {
8203
8204 let uri_str = format!("{}/papi/v1/um/adlQuantile", configuration.base_path);
8205 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8206
8207 let mut query_params: Vec<(String, String)> = Vec::new();
8209
8210 if let Some(ref param_value) = params.symbol {
8211 query_params.push(("symbol".to_string(), param_value.to_string()));
8212 }
8213 if let Some(ref param_value) = params.recv_window {
8214 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8215 }
8216 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8217
8218 let mut header_params = std::collections::HashMap::new();
8220
8221 if let Some(ref binance_auth) = configuration.binance_auth {
8223 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8225
8226 let body_string: Option<Vec<u8>> = None;
8228
8229 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8231 Ok(sig) => sig,
8232 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8233 };
8234
8235 query_params.push(("signature".to_string(), signature));
8237 }
8238
8239 if !query_params.is_empty() {
8241 req_builder = req_builder.query(&query_params);
8242 }
8243
8244
8245 if let Some(ref user_agent) = configuration.user_agent {
8247 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8248 }
8249
8250 for (header_name, header_value) in header_params {
8252 req_builder = req_builder.header(&header_name, &header_value);
8253 }
8254
8255
8256 let req = req_builder.build()?;
8257 let resp = configuration.client.execute(req).await?;
8258
8259 let status = resp.status();
8260 let content_type = resp
8261 .headers()
8262 .get("content-type")
8263 .and_then(|v| v.to_str().ok())
8264 .unwrap_or("application/octet-stream");
8265 let content_type = super::ContentType::from(content_type);
8266
8267 if !status.is_client_error() && !status.is_server_error() {
8268 let content = resp.text().await?;
8269 match content_type {
8270 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8271 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmAdlQuantileV1RespItem>`"))),
8272 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::GetUmAdlQuantileV1RespItem>`")))),
8273 }
8274 } else {
8275 let content = resp.text().await?;
8276 let entity: Option<GetUmAdlQuantileV1Error> = serde_json::from_str(&content).ok();
8277 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8278 }
8279}
8280
8281pub async fn get_um_all_orders_v1(configuration: &configuration::Configuration, params: GetUmAllOrdersV1Params) -> Result<Vec<models::GetUmAllOrdersV1RespItem>, Error<GetUmAllOrdersV1Error>> {
8283
8284 let uri_str = format!("{}/papi/v1/um/allOrders", configuration.base_path);
8285 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8286
8287 let mut query_params: Vec<(String, String)> = Vec::new();
8289
8290 query_params.push(("symbol".to_string(), params.symbol.to_string()));
8291 if let Some(ref param_value) = params.order_id {
8292 query_params.push(("orderId".to_string(), param_value.to_string()));
8293 }
8294 if let Some(ref param_value) = params.start_time {
8295 query_params.push(("startTime".to_string(), param_value.to_string()));
8296 }
8297 if let Some(ref param_value) = params.end_time {
8298 query_params.push(("endTime".to_string(), param_value.to_string()));
8299 }
8300 if let Some(ref param_value) = params.limit {
8301 query_params.push(("limit".to_string(), param_value.to_string()));
8302 }
8303 if let Some(ref param_value) = params.recv_window {
8304 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8305 }
8306 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8307
8308 let mut header_params = std::collections::HashMap::new();
8310
8311 if let Some(ref binance_auth) = configuration.binance_auth {
8313 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8315
8316 let body_string: Option<Vec<u8>> = None;
8318
8319 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8321 Ok(sig) => sig,
8322 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8323 };
8324
8325 query_params.push(("signature".to_string(), signature));
8327 }
8328
8329 if !query_params.is_empty() {
8331 req_builder = req_builder.query(&query_params);
8332 }
8333
8334
8335 if let Some(ref user_agent) = configuration.user_agent {
8337 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8338 }
8339
8340 for (header_name, header_value) in header_params {
8342 req_builder = req_builder.header(&header_name, &header_value);
8343 }
8344
8345
8346 let req = req_builder.build()?;
8347 let resp = configuration.client.execute(req).await?;
8348
8349 let status = resp.status();
8350 let content_type = resp
8351 .headers()
8352 .get("content-type")
8353 .and_then(|v| v.to_str().ok())
8354 .unwrap_or("application/octet-stream");
8355 let content_type = super::ContentType::from(content_type);
8356
8357 if !status.is_client_error() && !status.is_server_error() {
8358 let content = resp.text().await?;
8359 match content_type {
8360 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8361 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmAllOrdersV1RespItem>`"))),
8362 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::GetUmAllOrdersV1RespItem>`")))),
8363 }
8364 } else {
8365 let content = resp.text().await?;
8366 let entity: Option<GetUmAllOrdersV1Error> = serde_json::from_str(&content).ok();
8367 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8368 }
8369}
8370
8371pub async fn get_um_api_trading_status_v1(configuration: &configuration::Configuration, params: GetUmApiTradingStatusV1Params) -> Result<models::GetUmApiTradingStatusV1Resp, Error<GetUmApiTradingStatusV1Error>> {
8373
8374 let uri_str = format!("{}/papi/v1/um/apiTradingStatus", configuration.base_path);
8375 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8376
8377 let mut query_params: Vec<(String, String)> = Vec::new();
8379
8380 if let Some(ref param_value) = params.symbol {
8381 query_params.push(("symbol".to_string(), param_value.to_string()));
8382 }
8383 if let Some(ref param_value) = params.recv_window {
8384 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8385 }
8386 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8387
8388 let mut header_params = std::collections::HashMap::new();
8390
8391 if let Some(ref binance_auth) = configuration.binance_auth {
8393 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8395
8396 let body_string: Option<Vec<u8>> = None;
8398
8399 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8401 Ok(sig) => sig,
8402 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8403 };
8404
8405 query_params.push(("signature".to_string(), signature));
8407 }
8408
8409 if !query_params.is_empty() {
8411 req_builder = req_builder.query(&query_params);
8412 }
8413
8414
8415 if let Some(ref user_agent) = configuration.user_agent {
8417 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8418 }
8419
8420 for (header_name, header_value) in header_params {
8422 req_builder = req_builder.header(&header_name, &header_value);
8423 }
8424
8425
8426 let req = req_builder.build()?;
8427 let resp = configuration.client.execute(req).await?;
8428
8429 let status = resp.status();
8430 let content_type = resp
8431 .headers()
8432 .get("content-type")
8433 .and_then(|v| v.to_str().ok())
8434 .unwrap_or("application/octet-stream");
8435 let content_type = super::ContentType::from(content_type);
8436
8437 if !status.is_client_error() && !status.is_server_error() {
8438 let content = resp.text().await?;
8439 match content_type {
8440 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8441 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmApiTradingStatusV1Resp`"))),
8442 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::GetUmApiTradingStatusV1Resp`")))),
8443 }
8444 } else {
8445 let content = resp.text().await?;
8446 let entity: Option<GetUmApiTradingStatusV1Error> = serde_json::from_str(&content).ok();
8447 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8448 }
8449}
8450
8451pub async fn get_um_commission_rate_v1(configuration: &configuration::Configuration, params: GetUmCommissionRateV1Params) -> Result<models::GetUmCommissionRateV1Resp, Error<GetUmCommissionRateV1Error>> {
8453
8454 let uri_str = format!("{}/papi/v1/um/commissionRate", configuration.base_path);
8455 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8456
8457 let mut query_params: Vec<(String, String)> = Vec::new();
8459
8460 query_params.push(("symbol".to_string(), params.symbol.to_string()));
8461 if let Some(ref param_value) = params.recv_window {
8462 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8463 }
8464 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8465
8466 let mut header_params = std::collections::HashMap::new();
8468
8469 if let Some(ref binance_auth) = configuration.binance_auth {
8471 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8473
8474 let body_string: Option<Vec<u8>> = None;
8476
8477 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8479 Ok(sig) => sig,
8480 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8481 };
8482
8483 query_params.push(("signature".to_string(), signature));
8485 }
8486
8487 if !query_params.is_empty() {
8489 req_builder = req_builder.query(&query_params);
8490 }
8491
8492
8493 if let Some(ref user_agent) = configuration.user_agent {
8495 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8496 }
8497
8498 for (header_name, header_value) in header_params {
8500 req_builder = req_builder.header(&header_name, &header_value);
8501 }
8502
8503
8504 let req = req_builder.build()?;
8505 let resp = configuration.client.execute(req).await?;
8506
8507 let status = resp.status();
8508 let content_type = resp
8509 .headers()
8510 .get("content-type")
8511 .and_then(|v| v.to_str().ok())
8512 .unwrap_or("application/octet-stream");
8513 let content_type = super::ContentType::from(content_type);
8514
8515 if !status.is_client_error() && !status.is_server_error() {
8516 let content = resp.text().await?;
8517 match content_type {
8518 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8519 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmCommissionRateV1Resp`"))),
8520 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::GetUmCommissionRateV1Resp`")))),
8521 }
8522 } else {
8523 let content = resp.text().await?;
8524 let entity: Option<GetUmCommissionRateV1Error> = serde_json::from_str(&content).ok();
8525 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8526 }
8527}
8528
8529pub async fn get_um_conditional_all_orders_v1(configuration: &configuration::Configuration, params: GetUmConditionalAllOrdersV1Params) -> Result<Vec<models::GetUmConditionalAllOrdersV1RespItem>, Error<GetUmConditionalAllOrdersV1Error>> {
8531
8532 let uri_str = format!("{}/papi/v1/um/conditional/allOrders", configuration.base_path);
8533 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8534
8535 let mut query_params: Vec<(String, String)> = Vec::new();
8537
8538 if let Some(ref param_value) = params.symbol {
8539 query_params.push(("symbol".to_string(), param_value.to_string()));
8540 }
8541 if let Some(ref param_value) = params.strategy_id {
8542 query_params.push(("strategyId".to_string(), param_value.to_string()));
8543 }
8544 if let Some(ref param_value) = params.start_time {
8545 query_params.push(("startTime".to_string(), param_value.to_string()));
8546 }
8547 if let Some(ref param_value) = params.end_time {
8548 query_params.push(("endTime".to_string(), param_value.to_string()));
8549 }
8550 if let Some(ref param_value) = params.limit {
8551 query_params.push(("limit".to_string(), param_value.to_string()));
8552 }
8553 if let Some(ref param_value) = params.recv_window {
8554 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8555 }
8556 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8557
8558 let mut header_params = std::collections::HashMap::new();
8560
8561 if let Some(ref binance_auth) = configuration.binance_auth {
8563 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8565
8566 let body_string: Option<Vec<u8>> = None;
8568
8569 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8571 Ok(sig) => sig,
8572 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8573 };
8574
8575 query_params.push(("signature".to_string(), signature));
8577 }
8578
8579 if !query_params.is_empty() {
8581 req_builder = req_builder.query(&query_params);
8582 }
8583
8584
8585 if let Some(ref user_agent) = configuration.user_agent {
8587 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8588 }
8589
8590 for (header_name, header_value) in header_params {
8592 req_builder = req_builder.header(&header_name, &header_value);
8593 }
8594
8595
8596 let req = req_builder.build()?;
8597 let resp = configuration.client.execute(req).await?;
8598
8599 let status = resp.status();
8600 let content_type = resp
8601 .headers()
8602 .get("content-type")
8603 .and_then(|v| v.to_str().ok())
8604 .unwrap_or("application/octet-stream");
8605 let content_type = super::ContentType::from(content_type);
8606
8607 if !status.is_client_error() && !status.is_server_error() {
8608 let content = resp.text().await?;
8609 match content_type {
8610 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8611 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmConditionalAllOrdersV1RespItem>`"))),
8612 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::GetUmConditionalAllOrdersV1RespItem>`")))),
8613 }
8614 } else {
8615 let content = resp.text().await?;
8616 let entity: Option<GetUmConditionalAllOrdersV1Error> = serde_json::from_str(&content).ok();
8617 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8618 }
8619}
8620
8621pub async fn get_um_conditional_open_order_v1(configuration: &configuration::Configuration, params: GetUmConditionalOpenOrderV1Params) -> Result<models::GetUmConditionalOpenOrderV1Resp, Error<GetUmConditionalOpenOrderV1Error>> {
8623
8624 let uri_str = format!("{}/papi/v1/um/conditional/openOrder", configuration.base_path);
8625 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8626
8627 let mut query_params: Vec<(String, String)> = Vec::new();
8629
8630 query_params.push(("symbol".to_string(), params.symbol.to_string()));
8631 if let Some(ref param_value) = params.strategy_id {
8632 query_params.push(("strategyId".to_string(), param_value.to_string()));
8633 }
8634 if let Some(ref param_value) = params.new_client_strategy_id {
8635 query_params.push(("newClientStrategyId".to_string(), param_value.to_string()));
8636 }
8637 if let Some(ref param_value) = params.recv_window {
8638 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8639 }
8640 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8641
8642 let mut header_params = std::collections::HashMap::new();
8644
8645 if let Some(ref binance_auth) = configuration.binance_auth {
8647 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8649
8650 let body_string: Option<Vec<u8>> = None;
8652
8653 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8655 Ok(sig) => sig,
8656 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8657 };
8658
8659 query_params.push(("signature".to_string(), signature));
8661 }
8662
8663 if !query_params.is_empty() {
8665 req_builder = req_builder.query(&query_params);
8666 }
8667
8668
8669 if let Some(ref user_agent) = configuration.user_agent {
8671 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8672 }
8673
8674 for (header_name, header_value) in header_params {
8676 req_builder = req_builder.header(&header_name, &header_value);
8677 }
8678
8679
8680 let req = req_builder.build()?;
8681 let resp = configuration.client.execute(req).await?;
8682
8683 let status = resp.status();
8684 let content_type = resp
8685 .headers()
8686 .get("content-type")
8687 .and_then(|v| v.to_str().ok())
8688 .unwrap_or("application/octet-stream");
8689 let content_type = super::ContentType::from(content_type);
8690
8691 if !status.is_client_error() && !status.is_server_error() {
8692 let content = resp.text().await?;
8693 match content_type {
8694 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8695 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmConditionalOpenOrderV1Resp`"))),
8696 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::GetUmConditionalOpenOrderV1Resp`")))),
8697 }
8698 } else {
8699 let content = resp.text().await?;
8700 let entity: Option<GetUmConditionalOpenOrderV1Error> = serde_json::from_str(&content).ok();
8701 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8702 }
8703}
8704
8705pub async fn get_um_conditional_open_orders_v1(configuration: &configuration::Configuration) -> Result<Vec<models::GetUmConditionalOpenOrdersV1RespItem>, Error<GetUmConditionalOpenOrdersV1Error>> {
8707
8708 let uri_str = format!("{}/papi/v1/um/conditional/openOrders", configuration.base_path);
8709 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8710
8711 let mut query_params: Vec<(String, String)> = Vec::new();
8713
8714
8715 let mut header_params = std::collections::HashMap::new();
8717
8718 if let Some(ref binance_auth) = configuration.binance_auth {
8720 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8722
8723 let body_string: Option<Vec<u8>> = None;
8725
8726 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8728 Ok(sig) => sig,
8729 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8730 };
8731
8732 query_params.push(("signature".to_string(), signature));
8734 }
8735
8736 if !query_params.is_empty() {
8738 req_builder = req_builder.query(&query_params);
8739 }
8740
8741
8742 if let Some(ref user_agent) = configuration.user_agent {
8744 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8745 }
8746
8747 for (header_name, header_value) in header_params {
8749 req_builder = req_builder.header(&header_name, &header_value);
8750 }
8751
8752
8753 let req = req_builder.build()?;
8754 let resp = configuration.client.execute(req).await?;
8755
8756 let status = resp.status();
8757 let content_type = resp
8758 .headers()
8759 .get("content-type")
8760 .and_then(|v| v.to_str().ok())
8761 .unwrap_or("application/octet-stream");
8762 let content_type = super::ContentType::from(content_type);
8763
8764 if !status.is_client_error() && !status.is_server_error() {
8765 let content = resp.text().await?;
8766 match content_type {
8767 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8768 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmConditionalOpenOrdersV1RespItem>`"))),
8769 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::GetUmConditionalOpenOrdersV1RespItem>`")))),
8770 }
8771 } else {
8772 let content = resp.text().await?;
8773 let entity: Option<GetUmConditionalOpenOrdersV1Error> = serde_json::from_str(&content).ok();
8774 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8775 }
8776}
8777
8778pub async fn get_um_conditional_order_history_v1(configuration: &configuration::Configuration, params: GetUmConditionalOrderHistoryV1Params) -> Result<models::GetUmConditionalOrderHistoryV1Resp, Error<GetUmConditionalOrderHistoryV1Error>> {
8780
8781 let uri_str = format!("{}/papi/v1/um/conditional/orderHistory", configuration.base_path);
8782 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8783
8784 let mut query_params: Vec<(String, String)> = Vec::new();
8786
8787 query_params.push(("symbol".to_string(), params.symbol.to_string()));
8788 if let Some(ref param_value) = params.strategy_id {
8789 query_params.push(("strategyId".to_string(), param_value.to_string()));
8790 }
8791 if let Some(ref param_value) = params.new_client_strategy_id {
8792 query_params.push(("newClientStrategyId".to_string(), param_value.to_string()));
8793 }
8794 if let Some(ref param_value) = params.recv_window {
8795 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8796 }
8797 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8798
8799 let mut header_params = std::collections::HashMap::new();
8801
8802 if let Some(ref binance_auth) = configuration.binance_auth {
8804 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8806
8807 let body_string: Option<Vec<u8>> = None;
8809
8810 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8812 Ok(sig) => sig,
8813 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8814 };
8815
8816 query_params.push(("signature".to_string(), signature));
8818 }
8819
8820 if !query_params.is_empty() {
8822 req_builder = req_builder.query(&query_params);
8823 }
8824
8825
8826 if let Some(ref user_agent) = configuration.user_agent {
8828 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8829 }
8830
8831 for (header_name, header_value) in header_params {
8833 req_builder = req_builder.header(&header_name, &header_value);
8834 }
8835
8836
8837 let req = req_builder.build()?;
8838 let resp = configuration.client.execute(req).await?;
8839
8840 let status = resp.status();
8841 let content_type = resp
8842 .headers()
8843 .get("content-type")
8844 .and_then(|v| v.to_str().ok())
8845 .unwrap_or("application/octet-stream");
8846 let content_type = super::ContentType::from(content_type);
8847
8848 if !status.is_client_error() && !status.is_server_error() {
8849 let content = resp.text().await?;
8850 match content_type {
8851 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8852 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmConditionalOrderHistoryV1Resp`"))),
8853 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::GetUmConditionalOrderHistoryV1Resp`")))),
8854 }
8855 } else {
8856 let content = resp.text().await?;
8857 let entity: Option<GetUmConditionalOrderHistoryV1Error> = serde_json::from_str(&content).ok();
8858 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8859 }
8860}
8861
8862pub async fn get_um_fee_burn_v1(configuration: &configuration::Configuration, params: GetUmFeeBurnV1Params) -> Result<models::GetUmFeeBurnV1Resp, Error<GetUmFeeBurnV1Error>> {
8864
8865 let uri_str = format!("{}/papi/v1/um/feeBurn", configuration.base_path);
8866 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8867
8868 let mut query_params: Vec<(String, String)> = Vec::new();
8870
8871 if let Some(ref param_value) = params.recv_window {
8872 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8873 }
8874 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8875
8876 let mut header_params = std::collections::HashMap::new();
8878
8879 if let Some(ref binance_auth) = configuration.binance_auth {
8881 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8883
8884 let body_string: Option<Vec<u8>> = None;
8886
8887 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8889 Ok(sig) => sig,
8890 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8891 };
8892
8893 query_params.push(("signature".to_string(), signature));
8895 }
8896
8897 if !query_params.is_empty() {
8899 req_builder = req_builder.query(&query_params);
8900 }
8901
8902
8903 if let Some(ref user_agent) = configuration.user_agent {
8905 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8906 }
8907
8908 for (header_name, header_value) in header_params {
8910 req_builder = req_builder.header(&header_name, &header_value);
8911 }
8912
8913
8914 let req = req_builder.build()?;
8915 let resp = configuration.client.execute(req).await?;
8916
8917 let status = resp.status();
8918 let content_type = resp
8919 .headers()
8920 .get("content-type")
8921 .and_then(|v| v.to_str().ok())
8922 .unwrap_or("application/octet-stream");
8923 let content_type = super::ContentType::from(content_type);
8924
8925 if !status.is_client_error() && !status.is_server_error() {
8926 let content = resp.text().await?;
8927 match content_type {
8928 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8929 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmFeeBurnV1Resp`"))),
8930 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::GetUmFeeBurnV1Resp`")))),
8931 }
8932 } else {
8933 let content = resp.text().await?;
8934 let entity: Option<GetUmFeeBurnV1Error> = serde_json::from_str(&content).ok();
8935 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8936 }
8937}
8938
8939pub async fn get_um_force_orders_v1(configuration: &configuration::Configuration, params: GetUmForceOrdersV1Params) -> Result<Vec<models::GetUmForceOrdersV1RespItem>, Error<GetUmForceOrdersV1Error>> {
8941
8942 let uri_str = format!("{}/papi/v1/um/forceOrders", configuration.base_path);
8943 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8944
8945 let mut query_params: Vec<(String, String)> = Vec::new();
8947
8948 if let Some(ref param_value) = params.symbol {
8949 query_params.push(("symbol".to_string(), param_value.to_string()));
8950 }
8951 if let Some(ref param_value) = params.auto_close_type {
8952 query_params.push(("autoCloseType".to_string(), param_value.to_string()));
8953 }
8954 if let Some(ref param_value) = params.start_time {
8955 query_params.push(("startTime".to_string(), param_value.to_string()));
8956 }
8957 if let Some(ref param_value) = params.end_time {
8958 query_params.push(("endTime".to_string(), param_value.to_string()));
8959 }
8960 if let Some(ref param_value) = params.limit {
8961 query_params.push(("limit".to_string(), param_value.to_string()));
8962 }
8963 if let Some(ref param_value) = params.recv_window {
8964 query_params.push(("recvWindow".to_string(), param_value.to_string()));
8965 }
8966 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
8967
8968 let mut header_params = std::collections::HashMap::new();
8970
8971 if let Some(ref binance_auth) = configuration.binance_auth {
8973 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8975
8976 let body_string: Option<Vec<u8>> = None;
8978
8979 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8981 Ok(sig) => sig,
8982 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8983 };
8984
8985 query_params.push(("signature".to_string(), signature));
8987 }
8988
8989 if !query_params.is_empty() {
8991 req_builder = req_builder.query(&query_params);
8992 }
8993
8994
8995 if let Some(ref user_agent) = configuration.user_agent {
8997 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8998 }
8999
9000 for (header_name, header_value) in header_params {
9002 req_builder = req_builder.header(&header_name, &header_value);
9003 }
9004
9005
9006 let req = req_builder.build()?;
9007 let resp = configuration.client.execute(req).await?;
9008
9009 let status = resp.status();
9010 let content_type = resp
9011 .headers()
9012 .get("content-type")
9013 .and_then(|v| v.to_str().ok())
9014 .unwrap_or("application/octet-stream");
9015 let content_type = super::ContentType::from(content_type);
9016
9017 if !status.is_client_error() && !status.is_server_error() {
9018 let content = resp.text().await?;
9019 match content_type {
9020 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9021 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmForceOrdersV1RespItem>`"))),
9022 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::GetUmForceOrdersV1RespItem>`")))),
9023 }
9024 } else {
9025 let content = resp.text().await?;
9026 let entity: Option<GetUmForceOrdersV1Error> = serde_json::from_str(&content).ok();
9027 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9028 }
9029}
9030
9031pub async fn get_um_income_asyn_id_v1(configuration: &configuration::Configuration, params: GetUmIncomeAsynIdV1Params) -> Result<models::GetUmIncomeAsynIdV1Resp, Error<GetUmIncomeAsynIdV1Error>> {
9033
9034 let uri_str = format!("{}/papi/v1/um/income/asyn/id", configuration.base_path);
9035 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9036
9037 let mut query_params: Vec<(String, String)> = Vec::new();
9039
9040 query_params.push(("downloadId".to_string(), params.download_id.to_string()));
9041 if let Some(ref param_value) = params.recv_window {
9042 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9043 }
9044 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9045
9046 let mut header_params = std::collections::HashMap::new();
9048
9049 if let Some(ref binance_auth) = configuration.binance_auth {
9051 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9053
9054 let body_string: Option<Vec<u8>> = None;
9056
9057 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9059 Ok(sig) => sig,
9060 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9061 };
9062
9063 query_params.push(("signature".to_string(), signature));
9065 }
9066
9067 if !query_params.is_empty() {
9069 req_builder = req_builder.query(&query_params);
9070 }
9071
9072
9073 if let Some(ref user_agent) = configuration.user_agent {
9075 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9076 }
9077
9078 for (header_name, header_value) in header_params {
9080 req_builder = req_builder.header(&header_name, &header_value);
9081 }
9082
9083
9084 let req = req_builder.build()?;
9085 let resp = configuration.client.execute(req).await?;
9086
9087 let status = resp.status();
9088 let content_type = resp
9089 .headers()
9090 .get("content-type")
9091 .and_then(|v| v.to_str().ok())
9092 .unwrap_or("application/octet-stream");
9093 let content_type = super::ContentType::from(content_type);
9094
9095 if !status.is_client_error() && !status.is_server_error() {
9096 let content = resp.text().await?;
9097 match content_type {
9098 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9099 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmIncomeAsynIdV1Resp`"))),
9100 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::GetUmIncomeAsynIdV1Resp`")))),
9101 }
9102 } else {
9103 let content = resp.text().await?;
9104 let entity: Option<GetUmIncomeAsynIdV1Error> = serde_json::from_str(&content).ok();
9105 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9106 }
9107}
9108
9109pub async fn get_um_income_asyn_v1(configuration: &configuration::Configuration, params: GetUmIncomeAsynV1Params) -> Result<models::GetUmIncomeAsynV1Resp, Error<GetUmIncomeAsynV1Error>> {
9111
9112 let uri_str = format!("{}/papi/v1/um/income/asyn", configuration.base_path);
9113 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9114
9115 let mut query_params: Vec<(String, String)> = Vec::new();
9117
9118 query_params.push(("startTime".to_string(), params.start_time.to_string()));
9119 query_params.push(("endTime".to_string(), params.end_time.to_string()));
9120 if let Some(ref param_value) = params.recv_window {
9121 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9122 }
9123 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9124
9125 let mut header_params = std::collections::HashMap::new();
9127
9128 if let Some(ref binance_auth) = configuration.binance_auth {
9130 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9132
9133 let body_string: Option<Vec<u8>> = None;
9135
9136 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9138 Ok(sig) => sig,
9139 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9140 };
9141
9142 query_params.push(("signature".to_string(), signature));
9144 }
9145
9146 if !query_params.is_empty() {
9148 req_builder = req_builder.query(&query_params);
9149 }
9150
9151
9152 if let Some(ref user_agent) = configuration.user_agent {
9154 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9155 }
9156
9157 for (header_name, header_value) in header_params {
9159 req_builder = req_builder.header(&header_name, &header_value);
9160 }
9161
9162
9163 let req = req_builder.build()?;
9164 let resp = configuration.client.execute(req).await?;
9165
9166 let status = resp.status();
9167 let content_type = resp
9168 .headers()
9169 .get("content-type")
9170 .and_then(|v| v.to_str().ok())
9171 .unwrap_or("application/octet-stream");
9172 let content_type = super::ContentType::from(content_type);
9173
9174 if !status.is_client_error() && !status.is_server_error() {
9175 let content = resp.text().await?;
9176 match content_type {
9177 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9178 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmIncomeAsynV1Resp`"))),
9179 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::GetUmIncomeAsynV1Resp`")))),
9180 }
9181 } else {
9182 let content = resp.text().await?;
9183 let entity: Option<GetUmIncomeAsynV1Error> = serde_json::from_str(&content).ok();
9184 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9185 }
9186}
9187
9188pub async fn get_um_income_v1(configuration: &configuration::Configuration, params: GetUmIncomeV1Params) -> Result<Vec<models::GetUmIncomeV1RespItem>, Error<GetUmIncomeV1Error>> {
9190
9191 let uri_str = format!("{}/papi/v1/um/income", configuration.base_path);
9192 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9193
9194 let mut query_params: Vec<(String, String)> = Vec::new();
9196
9197 if let Some(ref param_value) = params.symbol {
9198 query_params.push(("symbol".to_string(), param_value.to_string()));
9199 }
9200 if let Some(ref param_value) = params.income_type {
9201 query_params.push(("incomeType".to_string(), param_value.to_string()));
9202 }
9203 if let Some(ref param_value) = params.start_time {
9204 query_params.push(("startTime".to_string(), param_value.to_string()));
9205 }
9206 if let Some(ref param_value) = params.end_time {
9207 query_params.push(("endTime".to_string(), param_value.to_string()));
9208 }
9209 if let Some(ref param_value) = params.page {
9210 query_params.push(("page".to_string(), param_value.to_string()));
9211 }
9212 if let Some(ref param_value) = params.limit {
9213 query_params.push(("limit".to_string(), param_value.to_string()));
9214 }
9215 if let Some(ref param_value) = params.recv_window {
9216 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9217 }
9218 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9219
9220 let mut header_params = std::collections::HashMap::new();
9222
9223 if let Some(ref binance_auth) = configuration.binance_auth {
9225 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9227
9228 let body_string: Option<Vec<u8>> = None;
9230
9231 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9233 Ok(sig) => sig,
9234 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9235 };
9236
9237 query_params.push(("signature".to_string(), signature));
9239 }
9240
9241 if !query_params.is_empty() {
9243 req_builder = req_builder.query(&query_params);
9244 }
9245
9246
9247 if let Some(ref user_agent) = configuration.user_agent {
9249 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9250 }
9251
9252 for (header_name, header_value) in header_params {
9254 req_builder = req_builder.header(&header_name, &header_value);
9255 }
9256
9257
9258 let req = req_builder.build()?;
9259 let resp = configuration.client.execute(req).await?;
9260
9261 let status = resp.status();
9262 let content_type = resp
9263 .headers()
9264 .get("content-type")
9265 .and_then(|v| v.to_str().ok())
9266 .unwrap_or("application/octet-stream");
9267 let content_type = super::ContentType::from(content_type);
9268
9269 if !status.is_client_error() && !status.is_server_error() {
9270 let content = resp.text().await?;
9271 match content_type {
9272 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9273 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmIncomeV1RespItem>`"))),
9274 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::GetUmIncomeV1RespItem>`")))),
9275 }
9276 } else {
9277 let content = resp.text().await?;
9278 let entity: Option<GetUmIncomeV1Error> = serde_json::from_str(&content).ok();
9279 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9280 }
9281}
9282
9283pub async fn get_um_leverage_bracket_v1(configuration: &configuration::Configuration, params: GetUmLeverageBracketV1Params) -> Result<Vec<models::GetUmLeverageBracketV1RespItem>, Error<GetUmLeverageBracketV1Error>> {
9285
9286 let uri_str = format!("{}/papi/v1/um/leverageBracket", configuration.base_path);
9287 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9288
9289 let mut query_params: Vec<(String, String)> = Vec::new();
9291
9292 if let Some(ref param_value) = params.symbol {
9293 query_params.push(("symbol".to_string(), param_value.to_string()));
9294 }
9295 if let Some(ref param_value) = params.recv_window {
9296 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9297 }
9298 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9299
9300 let mut header_params = std::collections::HashMap::new();
9302
9303 if let Some(ref binance_auth) = configuration.binance_auth {
9305 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9307
9308 let body_string: Option<Vec<u8>> = None;
9310
9311 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9313 Ok(sig) => sig,
9314 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9315 };
9316
9317 query_params.push(("signature".to_string(), signature));
9319 }
9320
9321 if !query_params.is_empty() {
9323 req_builder = req_builder.query(&query_params);
9324 }
9325
9326
9327 if let Some(ref user_agent) = configuration.user_agent {
9329 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9330 }
9331
9332 for (header_name, header_value) in header_params {
9334 req_builder = req_builder.header(&header_name, &header_value);
9335 }
9336
9337
9338 let req = req_builder.build()?;
9339 let resp = configuration.client.execute(req).await?;
9340
9341 let status = resp.status();
9342 let content_type = resp
9343 .headers()
9344 .get("content-type")
9345 .and_then(|v| v.to_str().ok())
9346 .unwrap_or("application/octet-stream");
9347 let content_type = super::ContentType::from(content_type);
9348
9349 if !status.is_client_error() && !status.is_server_error() {
9350 let content = resp.text().await?;
9351 match content_type {
9352 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9353 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmLeverageBracketV1RespItem>`"))),
9354 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::GetUmLeverageBracketV1RespItem>`")))),
9355 }
9356 } else {
9357 let content = resp.text().await?;
9358 let entity: Option<GetUmLeverageBracketV1Error> = serde_json::from_str(&content).ok();
9359 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9360 }
9361}
9362
9363pub async fn get_um_open_order_v1(configuration: &configuration::Configuration, params: GetUmOpenOrderV1Params) -> Result<models::GetUmOpenOrderV1Resp, Error<GetUmOpenOrderV1Error>> {
9365
9366 let uri_str = format!("{}/papi/v1/um/openOrder", configuration.base_path);
9367 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9368
9369 let mut query_params: Vec<(String, String)> = Vec::new();
9371
9372 query_params.push(("symbol".to_string(), params.symbol.to_string()));
9373 if let Some(ref param_value) = params.order_id {
9374 query_params.push(("orderId".to_string(), param_value.to_string()));
9375 }
9376 if let Some(ref param_value) = params.orig_client_order_id {
9377 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
9378 }
9379 if let Some(ref param_value) = params.recv_window {
9380 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9381 }
9382 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9383
9384 let mut header_params = std::collections::HashMap::new();
9386
9387 if let Some(ref binance_auth) = configuration.binance_auth {
9389 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9391
9392 let body_string: Option<Vec<u8>> = None;
9394
9395 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9397 Ok(sig) => sig,
9398 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9399 };
9400
9401 query_params.push(("signature".to_string(), signature));
9403 }
9404
9405 if !query_params.is_empty() {
9407 req_builder = req_builder.query(&query_params);
9408 }
9409
9410
9411 if let Some(ref user_agent) = configuration.user_agent {
9413 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9414 }
9415
9416 for (header_name, header_value) in header_params {
9418 req_builder = req_builder.header(&header_name, &header_value);
9419 }
9420
9421
9422 let req = req_builder.build()?;
9423 let resp = configuration.client.execute(req).await?;
9424
9425 let status = resp.status();
9426 let content_type = resp
9427 .headers()
9428 .get("content-type")
9429 .and_then(|v| v.to_str().ok())
9430 .unwrap_or("application/octet-stream");
9431 let content_type = super::ContentType::from(content_type);
9432
9433 if !status.is_client_error() && !status.is_server_error() {
9434 let content = resp.text().await?;
9435 match content_type {
9436 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9437 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmOpenOrderV1Resp`"))),
9438 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::GetUmOpenOrderV1Resp`")))),
9439 }
9440 } else {
9441 let content = resp.text().await?;
9442 let entity: Option<GetUmOpenOrderV1Error> = serde_json::from_str(&content).ok();
9443 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9444 }
9445}
9446
9447pub async fn get_um_open_orders_v1(configuration: &configuration::Configuration, params: GetUmOpenOrdersV1Params) -> Result<Vec<models::GetUmOpenOrdersV1RespItem>, Error<GetUmOpenOrdersV1Error>> {
9449
9450 let uri_str = format!("{}/papi/v1/um/openOrders", configuration.base_path);
9451 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9452
9453 let mut query_params: Vec<(String, String)> = Vec::new();
9455
9456 if let Some(ref param_value) = params.symbol {
9457 query_params.push(("symbol".to_string(), param_value.to_string()));
9458 }
9459 if let Some(ref param_value) = params.recv_window {
9460 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9461 }
9462 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9463
9464 let mut header_params = std::collections::HashMap::new();
9466
9467 if let Some(ref binance_auth) = configuration.binance_auth {
9469 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9471
9472 let body_string: Option<Vec<u8>> = None;
9474
9475 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9477 Ok(sig) => sig,
9478 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9479 };
9480
9481 query_params.push(("signature".to_string(), signature));
9483 }
9484
9485 if !query_params.is_empty() {
9487 req_builder = req_builder.query(&query_params);
9488 }
9489
9490
9491 if let Some(ref user_agent) = configuration.user_agent {
9493 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9494 }
9495
9496 for (header_name, header_value) in header_params {
9498 req_builder = req_builder.header(&header_name, &header_value);
9499 }
9500
9501
9502 let req = req_builder.build()?;
9503 let resp = configuration.client.execute(req).await?;
9504
9505 let status = resp.status();
9506 let content_type = resp
9507 .headers()
9508 .get("content-type")
9509 .and_then(|v| v.to_str().ok())
9510 .unwrap_or("application/octet-stream");
9511 let content_type = super::ContentType::from(content_type);
9512
9513 if !status.is_client_error() && !status.is_server_error() {
9514 let content = resp.text().await?;
9515 match content_type {
9516 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9517 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmOpenOrdersV1RespItem>`"))),
9518 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::GetUmOpenOrdersV1RespItem>`")))),
9519 }
9520 } else {
9521 let content = resp.text().await?;
9522 let entity: Option<GetUmOpenOrdersV1Error> = serde_json::from_str(&content).ok();
9523 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9524 }
9525}
9526
9527pub async fn get_um_order_amendment_v1(configuration: &configuration::Configuration, params: GetUmOrderAmendmentV1Params) -> Result<Vec<models::GetUmOrderAmendmentV1RespItem>, Error<GetUmOrderAmendmentV1Error>> {
9529
9530 let uri_str = format!("{}/papi/v1/um/orderAmendment", configuration.base_path);
9531 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9532
9533 let mut query_params: Vec<(String, String)> = Vec::new();
9535
9536 query_params.push(("symbol".to_string(), params.symbol.to_string()));
9537 if let Some(ref param_value) = params.order_id {
9538 query_params.push(("orderId".to_string(), param_value.to_string()));
9539 }
9540 if let Some(ref param_value) = params.orig_client_order_id {
9541 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
9542 }
9543 if let Some(ref param_value) = params.start_time {
9544 query_params.push(("startTime".to_string(), param_value.to_string()));
9545 }
9546 if let Some(ref param_value) = params.end_time {
9547 query_params.push(("endTime".to_string(), param_value.to_string()));
9548 }
9549 if let Some(ref param_value) = params.limit {
9550 query_params.push(("limit".to_string(), param_value.to_string()));
9551 }
9552 if let Some(ref param_value) = params.recv_window {
9553 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9554 }
9555 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9556
9557 let mut header_params = std::collections::HashMap::new();
9559
9560 if let Some(ref binance_auth) = configuration.binance_auth {
9562 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9564
9565 let body_string: Option<Vec<u8>> = None;
9567
9568 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9570 Ok(sig) => sig,
9571 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9572 };
9573
9574 query_params.push(("signature".to_string(), signature));
9576 }
9577
9578 if !query_params.is_empty() {
9580 req_builder = req_builder.query(&query_params);
9581 }
9582
9583
9584 if let Some(ref user_agent) = configuration.user_agent {
9586 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9587 }
9588
9589 for (header_name, header_value) in header_params {
9591 req_builder = req_builder.header(&header_name, &header_value);
9592 }
9593
9594
9595 let req = req_builder.build()?;
9596 let resp = configuration.client.execute(req).await?;
9597
9598 let status = resp.status();
9599 let content_type = resp
9600 .headers()
9601 .get("content-type")
9602 .and_then(|v| v.to_str().ok())
9603 .unwrap_or("application/octet-stream");
9604 let content_type = super::ContentType::from(content_type);
9605
9606 if !status.is_client_error() && !status.is_server_error() {
9607 let content = resp.text().await?;
9608 match content_type {
9609 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9610 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmOrderAmendmentV1RespItem>`"))),
9611 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::GetUmOrderAmendmentV1RespItem>`")))),
9612 }
9613 } else {
9614 let content = resp.text().await?;
9615 let entity: Option<GetUmOrderAmendmentV1Error> = serde_json::from_str(&content).ok();
9616 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9617 }
9618}
9619
9620pub async fn get_um_order_asyn_id_v1(configuration: &configuration::Configuration, params: GetUmOrderAsynIdV1Params) -> Result<models::GetUmOrderAsynIdV1Resp, Error<GetUmOrderAsynIdV1Error>> {
9622
9623 let uri_str = format!("{}/papi/v1/um/order/asyn/id", configuration.base_path);
9624 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9625
9626 let mut query_params: Vec<(String, String)> = Vec::new();
9628
9629 query_params.push(("downloadId".to_string(), params.download_id.to_string()));
9630 if let Some(ref param_value) = params.recv_window {
9631 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9632 }
9633 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9634
9635 let mut header_params = std::collections::HashMap::new();
9637
9638 if let Some(ref binance_auth) = configuration.binance_auth {
9640 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9642
9643 let body_string: Option<Vec<u8>> = None;
9645
9646 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9648 Ok(sig) => sig,
9649 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9650 };
9651
9652 query_params.push(("signature".to_string(), signature));
9654 }
9655
9656 if !query_params.is_empty() {
9658 req_builder = req_builder.query(&query_params);
9659 }
9660
9661
9662 if let Some(ref user_agent) = configuration.user_agent {
9664 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9665 }
9666
9667 for (header_name, header_value) in header_params {
9669 req_builder = req_builder.header(&header_name, &header_value);
9670 }
9671
9672
9673 let req = req_builder.build()?;
9674 let resp = configuration.client.execute(req).await?;
9675
9676 let status = resp.status();
9677 let content_type = resp
9678 .headers()
9679 .get("content-type")
9680 .and_then(|v| v.to_str().ok())
9681 .unwrap_or("application/octet-stream");
9682 let content_type = super::ContentType::from(content_type);
9683
9684 if !status.is_client_error() && !status.is_server_error() {
9685 let content = resp.text().await?;
9686 match content_type {
9687 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9688 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmOrderAsynIdV1Resp`"))),
9689 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::GetUmOrderAsynIdV1Resp`")))),
9690 }
9691 } else {
9692 let content = resp.text().await?;
9693 let entity: Option<GetUmOrderAsynIdV1Error> = serde_json::from_str(&content).ok();
9694 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9695 }
9696}
9697
9698pub async fn get_um_order_asyn_v1(configuration: &configuration::Configuration, params: GetUmOrderAsynV1Params) -> Result<models::GetUmOrderAsynV1Resp, Error<GetUmOrderAsynV1Error>> {
9700
9701 let uri_str = format!("{}/papi/v1/um/order/asyn", configuration.base_path);
9702 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9703
9704 let mut query_params: Vec<(String, String)> = Vec::new();
9706
9707 query_params.push(("startTime".to_string(), params.start_time.to_string()));
9708 query_params.push(("endTime".to_string(), params.end_time.to_string()));
9709 if let Some(ref param_value) = params.recv_window {
9710 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9711 }
9712 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9713
9714 let mut header_params = std::collections::HashMap::new();
9716
9717 if let Some(ref binance_auth) = configuration.binance_auth {
9719 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9721
9722 let body_string: Option<Vec<u8>> = None;
9724
9725 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9727 Ok(sig) => sig,
9728 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9729 };
9730
9731 query_params.push(("signature".to_string(), signature));
9733 }
9734
9735 if !query_params.is_empty() {
9737 req_builder = req_builder.query(&query_params);
9738 }
9739
9740
9741 if let Some(ref user_agent) = configuration.user_agent {
9743 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9744 }
9745
9746 for (header_name, header_value) in header_params {
9748 req_builder = req_builder.header(&header_name, &header_value);
9749 }
9750
9751
9752 let req = req_builder.build()?;
9753 let resp = configuration.client.execute(req).await?;
9754
9755 let status = resp.status();
9756 let content_type = resp
9757 .headers()
9758 .get("content-type")
9759 .and_then(|v| v.to_str().ok())
9760 .unwrap_or("application/octet-stream");
9761 let content_type = super::ContentType::from(content_type);
9762
9763 if !status.is_client_error() && !status.is_server_error() {
9764 let content = resp.text().await?;
9765 match content_type {
9766 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9767 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmOrderAsynV1Resp`"))),
9768 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::GetUmOrderAsynV1Resp`")))),
9769 }
9770 } else {
9771 let content = resp.text().await?;
9772 let entity: Option<GetUmOrderAsynV1Error> = serde_json::from_str(&content).ok();
9773 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9774 }
9775}
9776
9777pub async fn get_um_order_v1(configuration: &configuration::Configuration, params: GetUmOrderV1Params) -> Result<models::GetUmOrderV1Resp, Error<GetUmOrderV1Error>> {
9779
9780 let uri_str = format!("{}/papi/v1/um/order", configuration.base_path);
9781 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9782
9783 let mut query_params: Vec<(String, String)> = Vec::new();
9785
9786 query_params.push(("symbol".to_string(), params.symbol.to_string()));
9787 if let Some(ref param_value) = params.order_id {
9788 query_params.push(("orderId".to_string(), param_value.to_string()));
9789 }
9790 if let Some(ref param_value) = params.orig_client_order_id {
9791 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
9792 }
9793 if let Some(ref param_value) = params.recv_window {
9794 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9795 }
9796 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9797
9798 let mut header_params = std::collections::HashMap::new();
9800
9801 if let Some(ref binance_auth) = configuration.binance_auth {
9803 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9805
9806 let body_string: Option<Vec<u8>> = None;
9808
9809 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9811 Ok(sig) => sig,
9812 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9813 };
9814
9815 query_params.push(("signature".to_string(), signature));
9817 }
9818
9819 if !query_params.is_empty() {
9821 req_builder = req_builder.query(&query_params);
9822 }
9823
9824
9825 if let Some(ref user_agent) = configuration.user_agent {
9827 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9828 }
9829
9830 for (header_name, header_value) in header_params {
9832 req_builder = req_builder.header(&header_name, &header_value);
9833 }
9834
9835
9836 let req = req_builder.build()?;
9837 let resp = configuration.client.execute(req).await?;
9838
9839 let status = resp.status();
9840 let content_type = resp
9841 .headers()
9842 .get("content-type")
9843 .and_then(|v| v.to_str().ok())
9844 .unwrap_or("application/octet-stream");
9845 let content_type = super::ContentType::from(content_type);
9846
9847 if !status.is_client_error() && !status.is_server_error() {
9848 let content = resp.text().await?;
9849 match content_type {
9850 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9851 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmOrderV1Resp`"))),
9852 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::GetUmOrderV1Resp`")))),
9853 }
9854 } else {
9855 let content = resp.text().await?;
9856 let entity: Option<GetUmOrderV1Error> = serde_json::from_str(&content).ok();
9857 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9858 }
9859}
9860
9861pub async fn get_um_position_risk_v1(configuration: &configuration::Configuration) -> Result<Vec<models::GetUmPositionRiskV1RespItem>, Error<GetUmPositionRiskV1Error>> {
9863
9864 let uri_str = format!("{}/papi/v1/um/positionRisk", configuration.base_path);
9865 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9866
9867 let mut query_params: Vec<(String, String)> = Vec::new();
9869
9870
9871 let mut header_params = std::collections::HashMap::new();
9873
9874 if let Some(ref binance_auth) = configuration.binance_auth {
9876 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9878
9879 let body_string: Option<Vec<u8>> = None;
9881
9882 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9884 Ok(sig) => sig,
9885 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9886 };
9887
9888 query_params.push(("signature".to_string(), signature));
9890 }
9891
9892 if !query_params.is_empty() {
9894 req_builder = req_builder.query(&query_params);
9895 }
9896
9897
9898 if let Some(ref user_agent) = configuration.user_agent {
9900 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9901 }
9902
9903 for (header_name, header_value) in header_params {
9905 req_builder = req_builder.header(&header_name, &header_value);
9906 }
9907
9908
9909 let req = req_builder.build()?;
9910 let resp = configuration.client.execute(req).await?;
9911
9912 let status = resp.status();
9913 let content_type = resp
9914 .headers()
9915 .get("content-type")
9916 .and_then(|v| v.to_str().ok())
9917 .unwrap_or("application/octet-stream");
9918 let content_type = super::ContentType::from(content_type);
9919
9920 if !status.is_client_error() && !status.is_server_error() {
9921 let content = resp.text().await?;
9922 match content_type {
9923 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9924 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmPositionRiskV1RespItem>`"))),
9925 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::GetUmPositionRiskV1RespItem>`")))),
9926 }
9927 } else {
9928 let content = resp.text().await?;
9929 let entity: Option<GetUmPositionRiskV1Error> = serde_json::from_str(&content).ok();
9930 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9931 }
9932}
9933
9934pub async fn get_um_position_side_dual_v1(configuration: &configuration::Configuration, params: GetUmPositionSideDualV1Params) -> Result<models::GetUmPositionSideDualV1Resp, Error<GetUmPositionSideDualV1Error>> {
9936
9937 let uri_str = format!("{}/papi/v1/um/positionSide/dual", configuration.base_path);
9938 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9939
9940 let mut query_params: Vec<(String, String)> = Vec::new();
9942
9943 if let Some(ref param_value) = params.recv_window {
9944 query_params.push(("recvWindow".to_string(), param_value.to_string()));
9945 }
9946 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
9947
9948 let mut header_params = std::collections::HashMap::new();
9950
9951 if let Some(ref binance_auth) = configuration.binance_auth {
9953 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
9955
9956 let body_string: Option<Vec<u8>> = None;
9958
9959 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
9961 Ok(sig) => sig,
9962 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
9963 };
9964
9965 query_params.push(("signature".to_string(), signature));
9967 }
9968
9969 if !query_params.is_empty() {
9971 req_builder = req_builder.query(&query_params);
9972 }
9973
9974
9975 if let Some(ref user_agent) = configuration.user_agent {
9977 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9978 }
9979
9980 for (header_name, header_value) in header_params {
9982 req_builder = req_builder.header(&header_name, &header_value);
9983 }
9984
9985
9986 let req = req_builder.build()?;
9987 let resp = configuration.client.execute(req).await?;
9988
9989 let status = resp.status();
9990 let content_type = resp
9991 .headers()
9992 .get("content-type")
9993 .and_then(|v| v.to_str().ok())
9994 .unwrap_or("application/octet-stream");
9995 let content_type = super::ContentType::from(content_type);
9996
9997 if !status.is_client_error() && !status.is_server_error() {
9998 let content = resp.text().await?;
9999 match content_type {
10000 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10001 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmPositionSideDualV1Resp`"))),
10002 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::GetUmPositionSideDualV1Resp`")))),
10003 }
10004 } else {
10005 let content = resp.text().await?;
10006 let entity: Option<GetUmPositionSideDualV1Error> = serde_json::from_str(&content).ok();
10007 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10008 }
10009}
10010
10011pub async fn get_um_symbol_config_v1(configuration: &configuration::Configuration, params: GetUmSymbolConfigV1Params) -> Result<Vec<models::GetUmSymbolConfigV1RespItem>, Error<GetUmSymbolConfigV1Error>> {
10013
10014 let uri_str = format!("{}/papi/v1/um/symbolConfig", configuration.base_path);
10015 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10016
10017 let mut query_params: Vec<(String, String)> = Vec::new();
10019
10020 if let Some(ref param_value) = params.symbol {
10021 query_params.push(("symbol".to_string(), param_value.to_string()));
10022 }
10023 if let Some(ref param_value) = params.recv_window {
10024 query_params.push(("recvWindow".to_string(), param_value.to_string()));
10025 }
10026 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
10027
10028 let mut header_params = std::collections::HashMap::new();
10030
10031 if let Some(ref binance_auth) = configuration.binance_auth {
10033 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
10035
10036 let body_string: Option<Vec<u8>> = None;
10038
10039 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
10041 Ok(sig) => sig,
10042 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
10043 };
10044
10045 query_params.push(("signature".to_string(), signature));
10047 }
10048
10049 if !query_params.is_empty() {
10051 req_builder = req_builder.query(&query_params);
10052 }
10053
10054
10055 if let Some(ref user_agent) = configuration.user_agent {
10057 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10058 }
10059
10060 for (header_name, header_value) in header_params {
10062 req_builder = req_builder.header(&header_name, &header_value);
10063 }
10064
10065
10066 let req = req_builder.build()?;
10067 let resp = configuration.client.execute(req).await?;
10068
10069 let status = resp.status();
10070 let content_type = resp
10071 .headers()
10072 .get("content-type")
10073 .and_then(|v| v.to_str().ok())
10074 .unwrap_or("application/octet-stream");
10075 let content_type = super::ContentType::from(content_type);
10076
10077 if !status.is_client_error() && !status.is_server_error() {
10078 let content = resp.text().await?;
10079 match content_type {
10080 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10081 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmSymbolConfigV1RespItem>`"))),
10082 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::GetUmSymbolConfigV1RespItem>`")))),
10083 }
10084 } else {
10085 let content = resp.text().await?;
10086 let entity: Option<GetUmSymbolConfigV1Error> = serde_json::from_str(&content).ok();
10087 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10088 }
10089}
10090
10091pub async fn get_um_trade_asyn_id_v1(configuration: &configuration::Configuration, params: GetUmTradeAsynIdV1Params) -> Result<models::GetUmTradeAsynIdV1Resp, Error<GetUmTradeAsynIdV1Error>> {
10093
10094 let uri_str = format!("{}/papi/v1/um/trade/asyn/id", configuration.base_path);
10095 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10096
10097 let mut query_params: Vec<(String, String)> = Vec::new();
10099
10100 query_params.push(("downloadId".to_string(), params.download_id.to_string()));
10101 if let Some(ref param_value) = params.recv_window {
10102 query_params.push(("recvWindow".to_string(), param_value.to_string()));
10103 }
10104 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
10105
10106 let mut header_params = std::collections::HashMap::new();
10108
10109 if let Some(ref binance_auth) = configuration.binance_auth {
10111 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
10113
10114 let body_string: Option<Vec<u8>> = None;
10116
10117 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
10119 Ok(sig) => sig,
10120 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
10121 };
10122
10123 query_params.push(("signature".to_string(), signature));
10125 }
10126
10127 if !query_params.is_empty() {
10129 req_builder = req_builder.query(&query_params);
10130 }
10131
10132
10133 if let Some(ref user_agent) = configuration.user_agent {
10135 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10136 }
10137
10138 for (header_name, header_value) in header_params {
10140 req_builder = req_builder.header(&header_name, &header_value);
10141 }
10142
10143
10144 let req = req_builder.build()?;
10145 let resp = configuration.client.execute(req).await?;
10146
10147 let status = resp.status();
10148 let content_type = resp
10149 .headers()
10150 .get("content-type")
10151 .and_then(|v| v.to_str().ok())
10152 .unwrap_or("application/octet-stream");
10153 let content_type = super::ContentType::from(content_type);
10154
10155 if !status.is_client_error() && !status.is_server_error() {
10156 let content = resp.text().await?;
10157 match content_type {
10158 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10159 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmTradeAsynIdV1Resp`"))),
10160 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::GetUmTradeAsynIdV1Resp`")))),
10161 }
10162 } else {
10163 let content = resp.text().await?;
10164 let entity: Option<GetUmTradeAsynIdV1Error> = serde_json::from_str(&content).ok();
10165 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10166 }
10167}
10168
10169pub async fn get_um_trade_asyn_v1(configuration: &configuration::Configuration, params: GetUmTradeAsynV1Params) -> Result<models::GetUmTradeAsynV1Resp, Error<GetUmTradeAsynV1Error>> {
10171
10172 let uri_str = format!("{}/papi/v1/um/trade/asyn", configuration.base_path);
10173 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10174
10175 let mut query_params: Vec<(String, String)> = Vec::new();
10177
10178 query_params.push(("startTime".to_string(), params.start_time.to_string()));
10179 query_params.push(("endTime".to_string(), params.end_time.to_string()));
10180 if let Some(ref param_value) = params.recv_window {
10181 query_params.push(("recvWindow".to_string(), param_value.to_string()));
10182 }
10183 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
10184
10185 let mut header_params = std::collections::HashMap::new();
10187
10188 if let Some(ref binance_auth) = configuration.binance_auth {
10190 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
10192
10193 let body_string: Option<Vec<u8>> = None;
10195
10196 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
10198 Ok(sig) => sig,
10199 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
10200 };
10201
10202 query_params.push(("signature".to_string(), signature));
10204 }
10205
10206 if !query_params.is_empty() {
10208 req_builder = req_builder.query(&query_params);
10209 }
10210
10211
10212 if let Some(ref user_agent) = configuration.user_agent {
10214 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10215 }
10216
10217 for (header_name, header_value) in header_params {
10219 req_builder = req_builder.header(&header_name, &header_value);
10220 }
10221
10222
10223 let req = req_builder.build()?;
10224 let resp = configuration.client.execute(req).await?;
10225
10226 let status = resp.status();
10227 let content_type = resp
10228 .headers()
10229 .get("content-type")
10230 .and_then(|v| v.to_str().ok())
10231 .unwrap_or("application/octet-stream");
10232 let content_type = super::ContentType::from(content_type);
10233
10234 if !status.is_client_error() && !status.is_server_error() {
10235 let content = resp.text().await?;
10236 match content_type {
10237 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10238 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUmTradeAsynV1Resp`"))),
10239 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::GetUmTradeAsynV1Resp`")))),
10240 }
10241 } else {
10242 let content = resp.text().await?;
10243 let entity: Option<GetUmTradeAsynV1Error> = serde_json::from_str(&content).ok();
10244 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10245 }
10246}
10247
10248pub async fn get_um_user_trades_v1(configuration: &configuration::Configuration, params: GetUmUserTradesV1Params) -> Result<Vec<models::GetUmUserTradesV1RespItem>, Error<GetUmUserTradesV1Error>> {
10250
10251 let uri_str = format!("{}/papi/v1/um/userTrades", configuration.base_path);
10252 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10253
10254 let mut query_params: Vec<(String, String)> = Vec::new();
10256
10257 query_params.push(("symbol".to_string(), params.symbol.to_string()));
10258 if let Some(ref param_value) = params.start_time {
10259 query_params.push(("startTime".to_string(), param_value.to_string()));
10260 }
10261 if let Some(ref param_value) = params.end_time {
10262 query_params.push(("endTime".to_string(), param_value.to_string()));
10263 }
10264 if let Some(ref param_value) = params.from_id {
10265 query_params.push(("fromId".to_string(), param_value.to_string()));
10266 }
10267 if let Some(ref param_value) = params.limit {
10268 query_params.push(("limit".to_string(), param_value.to_string()));
10269 }
10270 if let Some(ref param_value) = params.recv_window {
10271 query_params.push(("recvWindow".to_string(), param_value.to_string()));
10272 }
10273 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
10274
10275 let mut header_params = std::collections::HashMap::new();
10277
10278 if let Some(ref binance_auth) = configuration.binance_auth {
10280 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
10282
10283 let body_string: Option<Vec<u8>> = None;
10285
10286 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
10288 Ok(sig) => sig,
10289 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
10290 };
10291
10292 query_params.push(("signature".to_string(), signature));
10294 }
10295
10296 if !query_params.is_empty() {
10298 req_builder = req_builder.query(&query_params);
10299 }
10300
10301
10302 if let Some(ref user_agent) = configuration.user_agent {
10304 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10305 }
10306
10307 for (header_name, header_value) in header_params {
10309 req_builder = req_builder.header(&header_name, &header_value);
10310 }
10311
10312
10313 let req = req_builder.build()?;
10314 let resp = configuration.client.execute(req).await?;
10315
10316 let status = resp.status();
10317 let content_type = resp
10318 .headers()
10319 .get("content-type")
10320 .and_then(|v| v.to_str().ok())
10321 .unwrap_or("application/octet-stream");
10322 let content_type = super::ContentType::from(content_type);
10323
10324 if !status.is_client_error() && !status.is_server_error() {
10325 let content = resp.text().await?;
10326 match content_type {
10327 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10328 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUmUserTradesV1RespItem>`"))),
10329 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::GetUmUserTradesV1RespItem>`")))),
10330 }
10331 } else {
10332 let content = resp.text().await?;
10333 let entity: Option<GetUmUserTradesV1Error> = serde_json::from_str(&content).ok();
10334 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10335 }
10336}
10337
10338pub async fn update_cm_order_v1(configuration: &configuration::Configuration, params: UpdateCmOrderV1Params) -> Result<models::UpdateCmOrderV1Resp, Error<UpdateCmOrderV1Error>> {
10340
10341 let uri_str = format!("{}/papi/v1/cm/order", configuration.base_path);
10342 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
10343
10344 let mut query_params: Vec<(String, String)> = Vec::new();
10346
10347
10348 let mut header_params = std::collections::HashMap::new();
10350
10351 if let Some(ref binance_auth) = configuration.binance_auth {
10353 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
10355
10356 let body_string: Option<Vec<u8>> = None;
10358
10359 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
10361 Ok(sig) => sig,
10362 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
10363 };
10364
10365 query_params.push(("signature".to_string(), signature));
10367 }
10368
10369 if !query_params.is_empty() {
10371 req_builder = req_builder.query(&query_params);
10372 }
10373
10374
10375 if let Some(ref user_agent) = configuration.user_agent {
10377 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10378 }
10379
10380 for (header_name, header_value) in header_params {
10382 req_builder = req_builder.header(&header_name, &header_value);
10383 }
10384
10385 let mut multipart_form_params = std::collections::HashMap::new();
10386 if let Some(param_value) = params.order_id {
10387 multipart_form_params.insert("orderId", param_value.to_string());
10388 }
10389 if let Some(param_value) = params.orig_client_order_id {
10390 multipart_form_params.insert("origClientOrderId", param_value.to_string());
10391 }
10392 multipart_form_params.insert("price", params.price.to_string());
10393 if let Some(param_value) = params.price_match {
10394 multipart_form_params.insert("priceMatch", param_value.to_string());
10395 }
10396 multipart_form_params.insert("quantity", params.quantity.to_string());
10397 if let Some(param_value) = params.recv_window {
10398 multipart_form_params.insert("recvWindow", param_value.to_string());
10399 }
10400 multipart_form_params.insert("side", params.side.to_string());
10401 multipart_form_params.insert("symbol", params.symbol.to_string());
10402 multipart_form_params.insert("timestamp", params.timestamp.to_string());
10403 req_builder = req_builder.form(&multipart_form_params);
10404
10405 let req = req_builder.build()?;
10406 let resp = configuration.client.execute(req).await?;
10407
10408 let status = resp.status();
10409 let content_type = resp
10410 .headers()
10411 .get("content-type")
10412 .and_then(|v| v.to_str().ok())
10413 .unwrap_or("application/octet-stream");
10414 let content_type = super::ContentType::from(content_type);
10415
10416 if !status.is_client_error() && !status.is_server_error() {
10417 let content = resp.text().await?;
10418 match content_type {
10419 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10420 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateCmOrderV1Resp`"))),
10421 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::UpdateCmOrderV1Resp`")))),
10422 }
10423 } else {
10424 let content = resp.text().await?;
10425 let entity: Option<UpdateCmOrderV1Error> = serde_json::from_str(&content).ok();
10426 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10427 }
10428}
10429
10430pub async fn update_listen_key_v1(configuration: &configuration::Configuration) -> Result<serde_json::Value, Error<UpdateListenKeyV1Error>> {
10432
10433 let uri_str = format!("{}/papi/v1/listenKey", configuration.base_path);
10434 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
10435
10436 let mut query_params: Vec<(String, String)> = Vec::new();
10438
10439
10440 let mut header_params = std::collections::HashMap::new();
10442
10443 if let Some(ref binance_auth) = configuration.binance_auth {
10445 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
10447
10448 let body_string: Option<Vec<u8>> = None;
10450
10451 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
10453 Ok(sig) => sig,
10454 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
10455 };
10456
10457 query_params.push(("signature".to_string(), signature));
10459 }
10460
10461 if !query_params.is_empty() {
10463 req_builder = req_builder.query(&query_params);
10464 }
10465
10466
10467 if let Some(ref user_agent) = configuration.user_agent {
10469 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10470 }
10471
10472 for (header_name, header_value) in header_params {
10474 req_builder = req_builder.header(&header_name, &header_value);
10475 }
10476
10477
10478 let req = req_builder.build()?;
10479 let resp = configuration.client.execute(req).await?;
10480
10481 let status = resp.status();
10482 let content_type = resp
10483 .headers()
10484 .get("content-type")
10485 .and_then(|v| v.to_str().ok())
10486 .unwrap_or("application/octet-stream");
10487 let content_type = super::ContentType::from(content_type);
10488
10489 if !status.is_client_error() && !status.is_server_error() {
10490 let content = resp.text().await?;
10491 match content_type {
10492 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10493 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
10494 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
10495 }
10496 } else {
10497 let content = resp.text().await?;
10498 let entity: Option<UpdateListenKeyV1Error> = serde_json::from_str(&content).ok();
10499 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10500 }
10501}
10502
10503pub async fn update_um_order_v1(configuration: &configuration::Configuration, params: UpdateUmOrderV1Params) -> Result<models::UpdateUmOrderV1Resp, Error<UpdateUmOrderV1Error>> {
10505
10506 let uri_str = format!("{}/papi/v1/um/order", configuration.base_path);
10507 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
10508
10509 let mut query_params: Vec<(String, String)> = Vec::new();
10511
10512
10513 let mut header_params = std::collections::HashMap::new();
10515
10516 if let Some(ref binance_auth) = configuration.binance_auth {
10518 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
10520
10521 let body_string: Option<Vec<u8>> = None;
10523
10524 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
10526 Ok(sig) => sig,
10527 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
10528 };
10529
10530 query_params.push(("signature".to_string(), signature));
10532 }
10533
10534 if !query_params.is_empty() {
10536 req_builder = req_builder.query(&query_params);
10537 }
10538
10539
10540 if let Some(ref user_agent) = configuration.user_agent {
10542 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10543 }
10544
10545 for (header_name, header_value) in header_params {
10547 req_builder = req_builder.header(&header_name, &header_value);
10548 }
10549
10550 let mut multipart_form_params = std::collections::HashMap::new();
10551 if let Some(param_value) = params.order_id {
10552 multipart_form_params.insert("orderId", param_value.to_string());
10553 }
10554 if let Some(param_value) = params.orig_client_order_id {
10555 multipart_form_params.insert("origClientOrderId", param_value.to_string());
10556 }
10557 multipart_form_params.insert("price", params.price.to_string());
10558 if let Some(param_value) = params.price_match {
10559 multipart_form_params.insert("priceMatch", param_value.to_string());
10560 }
10561 multipart_form_params.insert("quantity", params.quantity.to_string());
10562 if let Some(param_value) = params.recv_window {
10563 multipart_form_params.insert("recvWindow", param_value.to_string());
10564 }
10565 multipart_form_params.insert("side", params.side.to_string());
10566 multipart_form_params.insert("symbol", params.symbol.to_string());
10567 multipart_form_params.insert("timestamp", params.timestamp.to_string());
10568 req_builder = req_builder.form(&multipart_form_params);
10569
10570 let req = req_builder.build()?;
10571 let resp = configuration.client.execute(req).await?;
10572
10573 let status = resp.status();
10574 let content_type = resp
10575 .headers()
10576 .get("content-type")
10577 .and_then(|v| v.to_str().ok())
10578 .unwrap_or("application/octet-stream");
10579 let content_type = super::ContentType::from(content_type);
10580
10581 if !status.is_client_error() && !status.is_server_error() {
10582 let content = resp.text().await?;
10583 match content_type {
10584 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10585 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateUmOrderV1Resp`"))),
10586 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::UpdateUmOrderV1Resp`")))),
10587 }
10588 } else {
10589 let content = resp.text().await?;
10590 let entity: Option<UpdateUmOrderV1Error> = serde_json::from_str(&content).ok();
10591 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10592 }
10593}
10594