1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::umfutures::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug, Default)]
19pub struct CreateBatchOrdersV1Params {
20 pub batch_orders: Vec<models::UmfuturesCreateBatchOrdersV1ReqBatchOrdersItem>,
21 pub timestamp: i64,
22 pub recv_window: Option<i64>
23}
24
25#[derive(Clone, Debug, Default)]
27pub struct CreateConvertAcceptQuoteV1Params {
28 pub quote_id: String,
29 pub timestamp: i64,
30 pub recv_window: Option<i64>
31}
32
33#[derive(Clone, Debug, Default)]
35pub struct CreateConvertGetQuoteV1Params {
36 pub from_asset: String,
37 pub timestamp: i64,
38 pub to_asset: String,
39 pub from_amount: Option<String>,
40 pub recv_window: Option<i64>,
41 pub to_amount: Option<String>,
42 pub valid_time: Option<String>
43}
44
45#[derive(Clone, Debug, Default)]
47pub struct CreateCountdownCancelAllV1Params {
48 pub umfutures_create_countdown_cancel_all_v1_req: Option<models::UmfuturesCreateCountdownCancelAllV1Req>
49}
50
51#[derive(Clone, Debug, Default)]
53pub struct CreateFeeBurnV1Params {
54 pub fee_burn: String,
55 pub timestamp: i64,
56 pub recv_window: Option<i64>
57}
58
59#[derive(Clone, Debug, Default)]
61pub struct CreateLeverageV1Params {
62 pub leverage: i32,
63 pub symbol: String,
64 pub timestamp: i64,
65 pub recv_window: Option<i64>
66}
67
68#[derive(Clone, Debug, Default)]
70pub struct CreateMarginTypeV1Params {
71 pub margin_type: String,
72 pub symbol: String,
73 pub timestamp: i64,
74 pub recv_window: Option<i64>
75}
76
77#[derive(Clone, Debug, Default)]
79pub struct CreateMultiAssetsMarginV1Params {
80 pub multi_assets_margin: String,
81 pub timestamp: i64,
82 pub recv_window: Option<i64>
83}
84
85#[derive(Clone, Debug, Default)]
87pub struct CreateOrderTestV1Params {
88 pub side: String,
89 pub symbol: String,
90 pub timestamp: i64,
91 pub r#type: String,
92 pub activation_price: Option<String>,
93 pub callback_rate: Option<String>,
94 pub close_position: Option<String>,
95 pub good_till_date: Option<i64>,
96 pub new_client_order_id: Option<String>,
97 pub new_order_resp_type: Option<String>,
98 pub position_side: Option<String>,
99 pub price: Option<String>,
100 pub price_match: Option<String>,
101 pub price_protect: Option<String>,
102 pub quantity: Option<String>,
103 pub recv_window: Option<i64>,
104 pub reduce_only: Option<String>,
105 pub self_trade_prevention_mode: Option<String>,
106 pub stop_price: Option<String>,
107 pub time_in_force: Option<String>,
108 pub working_type: Option<String>
109}
110
111#[derive(Clone, Debug, Default)]
113pub struct CreateOrderV1Params {
114 pub side: String,
115 pub symbol: String,
116 pub timestamp: i64,
117 pub r#type: String,
118 pub activation_price: Option<String>,
119 pub callback_rate: Option<String>,
120 pub close_position: Option<String>,
121 pub good_till_date: Option<i64>,
122 pub new_client_order_id: Option<String>,
123 pub new_order_resp_type: Option<String>,
124 pub position_side: Option<String>,
125 pub price: Option<String>,
126 pub price_match: Option<String>,
127 pub price_protect: Option<String>,
128 pub quantity: Option<String>,
129 pub recv_window: Option<i64>,
130 pub reduce_only: Option<String>,
131 pub self_trade_prevention_mode: Option<String>,
132 pub stop_price: Option<String>,
133 pub time_in_force: Option<String>,
134 pub working_type: Option<String>
135}
136
137#[derive(Clone, Debug, Default)]
139pub struct CreatePositionMarginV1Params {
140 pub amount: String,
141 pub symbol: String,
142 pub timestamp: i64,
143 pub r#type: i32,
144 pub position_side: Option<String>,
145 pub recv_window: Option<i64>
146}
147
148#[derive(Clone, Debug, Default)]
150pub struct CreatePositionSideDualV1Params {
151 pub dual_side_position: String,
152 pub timestamp: i64,
153 pub recv_window: Option<i64>
154}
155
156#[derive(Clone, Debug, Default)]
158pub struct DeleteAllOpenOrdersV1Params {
159 pub symbol: String,
160 pub timestamp: i64,
161 pub recv_window: Option<i64>
162}
163
164#[derive(Clone, Debug, Default)]
166pub struct DeleteBatchOrdersV1Params {
167 pub symbol: String,
168 pub timestamp: i64,
169 pub order_id_list: Option<Vec<i64>>,
171 pub orig_client_order_id_list: Option<Vec<String>>,
173 pub recv_window: Option<i64>
174}
175
176#[derive(Clone, Debug, Default)]
178pub struct DeleteOrderV1Params {
179 pub symbol: String,
180 pub timestamp: i64,
181 pub order_id: Option<i64>,
182 pub orig_client_order_id: Option<String>,
183 pub recv_window: Option<i64>
184}
185
186#[derive(Clone, Debug, Default)]
188pub struct GetAccountConfigV1Params {
189 pub timestamp: i64,
190 pub recv_window: Option<i64>
191}
192
193#[derive(Clone, Debug, Default)]
195pub struct GetAccountV2Params {
196 pub timestamp: i64,
197 pub recv_window: Option<i64>
198}
199
200#[derive(Clone, Debug, Default)]
202pub struct GetAccountV3Params {
203 pub timestamp: i64,
204 pub recv_window: Option<i64>
205}
206
207#[derive(Clone, Debug, Default)]
209pub struct GetAdlQuantileV1Params {
210 pub timestamp: i64,
211 pub symbol: Option<String>,
212 pub recv_window: Option<i64>
213}
214
215#[derive(Clone, Debug, Default)]
217pub struct GetAggTradesV1Params {
218 pub symbol: String,
219 pub from_id: Option<i64>,
221 pub start_time: Option<i64>,
223 pub end_time: Option<i64>,
225 pub limit: Option<i32>
227}
228
229#[derive(Clone, Debug, Default)]
231pub struct GetAllOrdersV1Params {
232 pub symbol: String,
233 pub timestamp: i64,
234 pub order_id: Option<i64>,
235 pub start_time: Option<i64>,
236 pub end_time: Option<i64>,
237 pub limit: Option<i32>,
239 pub recv_window: Option<i64>
240}
241
242#[derive(Clone, Debug, Default)]
244pub struct GetApiTradingStatusV1Params {
245 pub timestamp: i64,
246 pub symbol: Option<String>,
247 pub recv_window: Option<i64>
248}
249
250#[derive(Clone, Debug, Default)]
252pub struct GetAssetIndexV1Params {
253 pub symbol: Option<String>
255}
256
257#[derive(Clone, Debug, Default)]
259pub struct GetBalanceV2Params {
260 pub timestamp: i64,
261 pub recv_window: Option<i64>
262}
263
264#[derive(Clone, Debug, Default)]
266pub struct GetBalanceV3Params {
267 pub timestamp: i64,
268 pub recv_window: Option<i64>
269}
270
271#[derive(Clone, Debug, Default)]
273pub struct GetCommissionRateV1Params {
274 pub symbol: String,
275 pub timestamp: i64,
276 pub recv_window: Option<i64>
277}
278
279#[derive(Clone, Debug, Default)]
281pub struct GetConstituentsV1Params {
282 pub symbol: String
283}
284
285#[derive(Clone, Debug, Default)]
287pub struct GetContinuousKlinesV1Params {
288 pub pair: String,
289 pub contract_type: String,
290 pub interval: String,
291 pub start_time: Option<i64>,
292 pub end_time: Option<i64>,
293 pub limit: Option<i32>
295}
296
297#[derive(Clone, Debug, Default)]
299pub struct GetConvertExchangeInfoV1Params {
300 pub from_asset: Option<String>,
302 pub to_asset: Option<String>
304}
305
306#[derive(Clone, Debug, Default)]
308pub struct GetConvertOrderStatusV1Params {
309 pub order_id: Option<String>,
311 pub quote_id: Option<String>
313}
314
315#[derive(Clone, Debug, Default)]
317pub struct GetDepthV1Params {
318 pub symbol: String,
319 pub limit: Option<i32>
321}
322
323#[derive(Clone, Debug, Default)]
325pub struct GetFeeBurnV1Params {
326 pub timestamp: i64,
327 pub recv_window: Option<i64>
328}
329
330#[derive(Clone, Debug, Default)]
332pub struct GetForceOrdersV1Params {
333 pub timestamp: i64,
334 pub symbol: Option<String>,
335 pub auto_close_type: Option<String>,
337 pub start_time: Option<i64>,
338 pub end_time: Option<i64>,
339 pub limit: Option<i32>,
341 pub recv_window: Option<i64>
342}
343
344#[derive(Clone, Debug, Default)]
346pub struct GetFundingRateV1Params {
347 pub symbol: Option<String>,
348 pub start_time: Option<i64>,
350 pub end_time: Option<i64>,
352 pub limit: Option<i32>
354}
355
356#[derive(Clone, Debug, Default)]
358pub struct GetFuturesDataBasisParams {
359 pub pair: String,
361 pub contract_type: String,
363 pub period: String,
365 pub limit: i64,
367 pub start_time: Option<i64>,
368 pub end_time: Option<i64>
369}
370
371#[derive(Clone, Debug, Default)]
373pub struct GetFuturesDataDeliveryPriceParams {
374 pub pair: String
376}
377
378#[derive(Clone, Debug, Default)]
380pub struct GetFuturesDataGlobalLongShortAccountRatioParams {
381 pub symbol: String,
382 pub period: String,
384 pub limit: Option<i64>,
386 pub start_time: Option<i64>,
387 pub end_time: Option<i64>
388}
389
390#[derive(Clone, Debug, Default)]
392pub struct GetFuturesDataOpenInterestHistParams {
393 pub symbol: String,
394 pub period: String,
396 pub limit: Option<i64>,
398 pub start_time: Option<i64>,
399 pub end_time: Option<i64>
400}
401
402#[derive(Clone, Debug, Default)]
404pub struct GetFuturesDataTakerlongshortRatioParams {
405 pub symbol: String,
406 pub period: String,
408 pub limit: Option<i64>,
410 pub start_time: Option<i64>,
411 pub end_time: Option<i64>
412}
413
414#[derive(Clone, Debug, Default)]
416pub struct GetFuturesDataTopLongShortAccountRatioParams {
417 pub symbol: String,
418 pub period: String,
420 pub limit: Option<i64>,
422 pub start_time: Option<i64>,
423 pub end_time: Option<i64>
424}
425
426#[derive(Clone, Debug, Default)]
428pub struct GetFuturesDataTopLongShortPositionRatioParams {
429 pub symbol: String,
430 pub period: String,
432 pub limit: Option<i64>,
434 pub start_time: Option<i64>,
435 pub end_time: Option<i64>
436}
437
438#[derive(Clone, Debug, Default)]
440pub struct GetHistoricalTradesV1Params {
441 pub symbol: String,
442 pub limit: Option<i32>,
444 pub from_id: Option<i64>
446}
447
448#[derive(Clone, Debug, Default)]
450pub struct GetIncomeAsynIdV1Params {
451 pub download_id: String,
453 pub timestamp: i64,
454 pub recv_window: Option<i64>
455}
456
457#[derive(Clone, Debug, Default)]
459pub struct GetIncomeAsynV1Params {
460 pub start_time: i64,
462 pub end_time: i64,
464 pub timestamp: i64,
465 pub recv_window: Option<i64>
466}
467
468#[derive(Clone, Debug, Default)]
470pub struct GetIndexInfoV1Params {
471 pub symbol: Option<String>
472}
473
474#[derive(Clone, Debug, Default)]
476pub struct GetIndexPriceKlinesV1Params {
477 pub pair: String,
478 pub interval: String,
479 pub start_time: Option<i64>,
480 pub end_time: Option<i64>,
481 pub limit: Option<i32>
483}
484
485#[derive(Clone, Debug, Default)]
487pub struct GetKlinesV1Params {
488 pub symbol: String,
489 pub interval: String,
490 pub start_time: Option<i64>,
491 pub end_time: Option<i64>,
492 pub limit: Option<i32>
494}
495
496#[derive(Clone, Debug, Default)]
498pub struct GetLeverageBracketV1Params {
499 pub timestamp: i64,
500 pub symbol: Option<String>,
501 pub recv_window: Option<i64>
502}
503
504#[derive(Clone, Debug, Default)]
506pub struct GetMarkPriceKlinesV1Params {
507 pub symbol: String,
508 pub interval: String,
509 pub start_time: Option<i64>,
510 pub end_time: Option<i64>,
511 pub limit: Option<i32>
513}
514
515#[derive(Clone, Debug, Default)]
517pub struct GetMultiAssetsMarginV1Params {
518 pub timestamp: i64,
519 pub recv_window: Option<i64>
520}
521
522#[derive(Clone, Debug, Default)]
524pub struct GetOpenInterestV1Params {
525 pub symbol: String
526}
527
528#[derive(Clone, Debug, Default)]
530pub struct GetOpenOrderV1Params {
531 pub symbol: String,
532 pub timestamp: i64,
533 pub order_id: Option<i64>,
534 pub orig_client_order_id: Option<String>,
535 pub recv_window: Option<i64>
536}
537
538#[derive(Clone, Debug, Default)]
540pub struct GetOpenOrdersV1Params {
541 pub timestamp: i64,
542 pub symbol: Option<String>,
543 pub recv_window: Option<i64>
544}
545
546#[derive(Clone, Debug, Default)]
548pub struct GetOrderAmendmentV1Params {
549 pub symbol: String,
550 pub timestamp: i64,
551 pub order_id: Option<i64>,
552 pub orig_client_order_id: Option<String>,
553 pub start_time: Option<i64>,
555 pub end_time: Option<i64>,
557 pub limit: Option<i32>,
559 pub recv_window: Option<i64>
560}
561
562#[derive(Clone, Debug, Default)]
564pub struct GetOrderAsynIdV1Params {
565 pub download_id: String,
567 pub timestamp: i64,
568 pub recv_window: Option<i64>
569}
570
571#[derive(Clone, Debug, Default)]
573pub struct GetOrderAsynV1Params {
574 pub start_time: i64,
576 pub end_time: i64,
578 pub timestamp: i64,
579 pub recv_window: Option<i64>
580}
581
582#[derive(Clone, Debug, Default)]
584pub struct GetOrderV1Params {
585 pub symbol: String,
586 pub timestamp: i64,
587 pub order_id: Option<i64>,
588 pub orig_client_order_id: Option<String>,
589 pub recv_window: Option<i64>
590}
591
592#[derive(Clone, Debug, Default)]
594pub struct GetPmAccountInfoV1Params {
595 pub asset: String,
596 pub timestamp: i64,
597 pub recv_window: Option<i64>
598}
599
600#[derive(Clone, Debug, Default)]
602pub struct GetPositionMarginHistoryV1Params {
603 pub symbol: String,
604 pub timestamp: i64,
605 pub r#type: Option<i32>,
607 pub start_time: Option<i64>,
608 pub end_time: Option<i64>,
610 pub limit: Option<i32>,
612 pub recv_window: Option<i64>
613}
614
615#[derive(Clone, Debug, Default)]
617pub struct GetPositionRiskV2Params {
618 pub timestamp: i64,
619 pub symbol: Option<String>,
620 pub recv_window: Option<i64>
621}
622
623#[derive(Clone, Debug, Default)]
625pub struct GetPositionRiskV3Params {
626 pub timestamp: i64,
627 pub symbol: Option<String>,
628 pub recv_window: Option<i64>
629}
630
631#[derive(Clone, Debug, Default)]
633pub struct GetPositionSideDualV1Params {
634 pub timestamp: i64,
635 pub recv_window: Option<i64>
636}
637
638#[derive(Clone, Debug, Default)]
640pub struct GetPremiumIndexKlinesV1Params {
641 pub symbol: String,
642 pub interval: String,
643 pub start_time: Option<i64>,
644 pub end_time: Option<i64>,
645 pub limit: Option<i32>
647}
648
649#[derive(Clone, Debug, Default)]
651pub struct GetPremiumIndexV1Params {
652 pub symbol: Option<String>
653}
654
655#[derive(Clone, Debug, Default)]
657pub struct GetRateLimitOrderV1Params {
658 pub timestamp: i64,
659 pub recv_window: Option<i64>
660}
661
662#[derive(Clone, Debug, Default)]
664pub struct GetSymbolConfigV1Params {
665 pub timestamp: i64,
666 pub symbol: Option<String>,
667 pub recv_window: Option<i64>
668}
669
670#[derive(Clone, Debug, Default)]
672pub struct GetTicker24hrV1Params {
673 pub symbol: Option<String>
674}
675
676#[derive(Clone, Debug, Default)]
678pub struct GetTickerBookTickerV1Params {
679 pub symbol: Option<String>
680}
681
682#[derive(Clone, Debug, Default)]
684pub struct GetTickerPriceV1Params {
685 pub symbol: Option<String>
686}
687
688#[derive(Clone, Debug, Default)]
690pub struct GetTickerPriceV2Params {
691 pub symbol: Option<String>
692}
693
694#[derive(Clone, Debug, Default)]
696pub struct GetTradeAsynIdV1Params {
697 pub download_id: String,
699 pub timestamp: i64,
700 pub recv_window: Option<i64>
701}
702
703#[derive(Clone, Debug, Default)]
705pub struct GetTradeAsynV1Params {
706 pub start_time: i64,
708 pub end_time: i64,
710 pub timestamp: i64,
711 pub recv_window: Option<i64>
712}
713
714#[derive(Clone, Debug, Default)]
716pub struct GetTradesV1Params {
717 pub symbol: String,
718 pub limit: Option<i32>
720}
721
722#[derive(Clone, Debug, Default)]
724pub struct GetUserTradesV1Params {
725 pub symbol: String,
726 pub timestamp: i64,
727 pub order_id: Option<i64>,
729 pub start_time: Option<i64>,
730 pub end_time: Option<i64>,
731 pub from_id: Option<i64>,
733 pub limit: Option<i32>,
735 pub recv_window: Option<i64>
736}
737
738#[derive(Clone, Debug, Default)]
740pub struct UpdateBatchOrdersV1Params {
741 pub batch_orders: Vec<models::UmfuturesUpdateBatchOrdersV1ReqBatchOrdersItem>,
742 pub timestamp: i64,
743 pub recv_window: Option<i64>
744}
745
746#[derive(Clone, Debug, Default)]
748pub struct UpdateOrderV1Params {
749 pub price: String,
750 pub quantity: String,
751 pub side: String,
752 pub symbol: String,
753 pub timestamp: i64,
754 pub order_id: Option<i64>,
755 pub orig_client_order_id: Option<String>,
756 pub price_match: Option<String>,
757 pub recv_window: Option<i64>
758}
759
760
761#[derive(Debug, Clone, Serialize, Deserialize)]
763#[serde(untagged)]
764pub enum CreateBatchOrdersV1Error {
765 Status4XX(models::ApiError),
766 Status5XX(models::ApiError),
767 UnknownValue(serde_json::Value),
768}
769
770#[derive(Debug, Clone, Serialize, Deserialize)]
772#[serde(untagged)]
773pub enum CreateConvertAcceptQuoteV1Error {
774 Status4XX(models::ApiError),
775 Status5XX(models::ApiError),
776 UnknownValue(serde_json::Value),
777}
778
779#[derive(Debug, Clone, Serialize, Deserialize)]
781#[serde(untagged)]
782pub enum CreateConvertGetQuoteV1Error {
783 Status4XX(models::ApiError),
784 Status5XX(models::ApiError),
785 UnknownValue(serde_json::Value),
786}
787
788#[derive(Debug, Clone, Serialize, Deserialize)]
790#[serde(untagged)]
791pub enum CreateCountdownCancelAllV1Error {
792 Status4XX(models::ApiError),
793 Status5XX(models::ApiError),
794 UnknownValue(serde_json::Value),
795}
796
797#[derive(Debug, Clone, Serialize, Deserialize)]
799#[serde(untagged)]
800pub enum CreateFeeBurnV1Error {
801 Status4XX(models::ApiError),
802 Status5XX(models::ApiError),
803 UnknownValue(serde_json::Value),
804}
805
806#[derive(Debug, Clone, Serialize, Deserialize)]
808#[serde(untagged)]
809pub enum CreateLeverageV1Error {
810 Status4XX(models::ApiError),
811 Status5XX(models::ApiError),
812 UnknownValue(serde_json::Value),
813}
814
815#[derive(Debug, Clone, Serialize, Deserialize)]
817#[serde(untagged)]
818pub enum CreateListenKeyV1Error {
819 Status4XX(models::ApiError),
820 Status5XX(models::ApiError),
821 UnknownValue(serde_json::Value),
822}
823
824#[derive(Debug, Clone, Serialize, Deserialize)]
826#[serde(untagged)]
827pub enum CreateMarginTypeV1Error {
828 Status4XX(models::ApiError),
829 Status5XX(models::ApiError),
830 UnknownValue(serde_json::Value),
831}
832
833#[derive(Debug, Clone, Serialize, Deserialize)]
835#[serde(untagged)]
836pub enum CreateMultiAssetsMarginV1Error {
837 Status4XX(models::ApiError),
838 Status5XX(models::ApiError),
839 UnknownValue(serde_json::Value),
840}
841
842#[derive(Debug, Clone, Serialize, Deserialize)]
844#[serde(untagged)]
845pub enum CreateOrderTestV1Error {
846 Status4XX(models::ApiError),
847 Status5XX(models::ApiError),
848 UnknownValue(serde_json::Value),
849}
850
851#[derive(Debug, Clone, Serialize, Deserialize)]
853#[serde(untagged)]
854pub enum CreateOrderV1Error {
855 Status4XX(models::ApiError),
856 Status5XX(models::ApiError),
857 UnknownValue(serde_json::Value),
858}
859
860#[derive(Debug, Clone, Serialize, Deserialize)]
862#[serde(untagged)]
863pub enum CreatePositionMarginV1Error {
864 Status4XX(models::ApiError),
865 Status5XX(models::ApiError),
866 UnknownValue(serde_json::Value),
867}
868
869#[derive(Debug, Clone, Serialize, Deserialize)]
871#[serde(untagged)]
872pub enum CreatePositionSideDualV1Error {
873 Status4XX(models::ApiError),
874 Status5XX(models::ApiError),
875 UnknownValue(serde_json::Value),
876}
877
878#[derive(Debug, Clone, Serialize, Deserialize)]
880#[serde(untagged)]
881pub enum DeleteAllOpenOrdersV1Error {
882 Status4XX(models::ApiError),
883 Status5XX(models::ApiError),
884 UnknownValue(serde_json::Value),
885}
886
887#[derive(Debug, Clone, Serialize, Deserialize)]
889#[serde(untagged)]
890pub enum DeleteBatchOrdersV1Error {
891 Status4XX(models::ApiError),
892 Status5XX(models::ApiError),
893 UnknownValue(serde_json::Value),
894}
895
896#[derive(Debug, Clone, Serialize, Deserialize)]
898#[serde(untagged)]
899pub enum DeleteListenKeyV1Error {
900 Status4XX(models::ApiError),
901 Status5XX(models::ApiError),
902 UnknownValue(serde_json::Value),
903}
904
905#[derive(Debug, Clone, Serialize, Deserialize)]
907#[serde(untagged)]
908pub enum DeleteOrderV1Error {
909 Status4XX(models::ApiError),
910 Status5XX(models::ApiError),
911 UnknownValue(serde_json::Value),
912}
913
914#[derive(Debug, Clone, Serialize, Deserialize)]
916#[serde(untagged)]
917pub enum GetAccountConfigV1Error {
918 Status4XX(models::ApiError),
919 Status5XX(models::ApiError),
920 UnknownValue(serde_json::Value),
921}
922
923#[derive(Debug, Clone, Serialize, Deserialize)]
925#[serde(untagged)]
926pub enum GetAccountV2Error {
927 Status4XX(models::ApiError),
928 Status5XX(models::ApiError),
929 UnknownValue(serde_json::Value),
930}
931
932#[derive(Debug, Clone, Serialize, Deserialize)]
934#[serde(untagged)]
935pub enum GetAccountV3Error {
936 Status4XX(models::ApiError),
937 Status5XX(models::ApiError),
938 UnknownValue(serde_json::Value),
939}
940
941#[derive(Debug, Clone, Serialize, Deserialize)]
943#[serde(untagged)]
944pub enum GetAdlQuantileV1Error {
945 Status4XX(models::ApiError),
946 Status5XX(models::ApiError),
947 UnknownValue(serde_json::Value),
948}
949
950#[derive(Debug, Clone, Serialize, Deserialize)]
952#[serde(untagged)]
953pub enum GetAggTradesV1Error {
954 Status4XX(models::ApiError),
955 Status5XX(models::ApiError),
956 UnknownValue(serde_json::Value),
957}
958
959#[derive(Debug, Clone, Serialize, Deserialize)]
961#[serde(untagged)]
962pub enum GetAllOrdersV1Error {
963 Status4XX(models::ApiError),
964 Status5XX(models::ApiError),
965 UnknownValue(serde_json::Value),
966}
967
968#[derive(Debug, Clone, Serialize, Deserialize)]
970#[serde(untagged)]
971pub enum GetApiTradingStatusV1Error {
972 Status4XX(models::ApiError),
973 Status5XX(models::ApiError),
974 UnknownValue(serde_json::Value),
975}
976
977#[derive(Debug, Clone, Serialize, Deserialize)]
979#[serde(untagged)]
980pub enum GetAssetIndexV1Error {
981 Status4XX(models::ApiError),
982 Status5XX(models::ApiError),
983 UnknownValue(serde_json::Value),
984}
985
986#[derive(Debug, Clone, Serialize, Deserialize)]
988#[serde(untagged)]
989pub enum GetBalanceV2Error {
990 Status4XX(models::ApiError),
991 Status5XX(models::ApiError),
992 UnknownValue(serde_json::Value),
993}
994
995#[derive(Debug, Clone, Serialize, Deserialize)]
997#[serde(untagged)]
998pub enum GetBalanceV3Error {
999 Status4XX(models::ApiError),
1000 Status5XX(models::ApiError),
1001 UnknownValue(serde_json::Value),
1002}
1003
1004#[derive(Debug, Clone, Serialize, Deserialize)]
1006#[serde(untagged)]
1007pub enum GetCommissionRateV1Error {
1008 Status4XX(models::ApiError),
1009 Status5XX(models::ApiError),
1010 UnknownValue(serde_json::Value),
1011}
1012
1013#[derive(Debug, Clone, Serialize, Deserialize)]
1015#[serde(untagged)]
1016pub enum GetConstituentsV1Error {
1017 Status4XX(models::ApiError),
1018 Status5XX(models::ApiError),
1019 UnknownValue(serde_json::Value),
1020}
1021
1022#[derive(Debug, Clone, Serialize, Deserialize)]
1024#[serde(untagged)]
1025pub enum GetContinuousKlinesV1Error {
1026 Status4XX(models::ApiError),
1027 Status5XX(models::ApiError),
1028 UnknownValue(serde_json::Value),
1029}
1030
1031#[derive(Debug, Clone, Serialize, Deserialize)]
1033#[serde(untagged)]
1034pub enum GetConvertExchangeInfoV1Error {
1035 Status4XX(models::ApiError),
1036 Status5XX(models::ApiError),
1037 UnknownValue(serde_json::Value),
1038}
1039
1040#[derive(Debug, Clone, Serialize, Deserialize)]
1042#[serde(untagged)]
1043pub enum GetConvertOrderStatusV1Error {
1044 Status4XX(models::ApiError),
1045 Status5XX(models::ApiError),
1046 UnknownValue(serde_json::Value),
1047}
1048
1049#[derive(Debug, Clone, Serialize, Deserialize)]
1051#[serde(untagged)]
1052pub enum GetDepthV1Error {
1053 Status4XX(models::ApiError),
1054 Status5XX(models::ApiError),
1055 UnknownValue(serde_json::Value),
1056}
1057
1058#[derive(Debug, Clone, Serialize, Deserialize)]
1060#[serde(untagged)]
1061pub enum GetExchangeInfoV1Error {
1062 Status4XX(models::ApiError),
1063 Status5XX(models::ApiError),
1064 UnknownValue(serde_json::Value),
1065}
1066
1067#[derive(Debug, Clone, Serialize, Deserialize)]
1069#[serde(untagged)]
1070pub enum GetFeeBurnV1Error {
1071 Status4XX(models::ApiError),
1072 Status5XX(models::ApiError),
1073 UnknownValue(serde_json::Value),
1074}
1075
1076#[derive(Debug, Clone, Serialize, Deserialize)]
1078#[serde(untagged)]
1079pub enum GetForceOrdersV1Error {
1080 Status4XX(models::ApiError),
1081 Status5XX(models::ApiError),
1082 UnknownValue(serde_json::Value),
1083}
1084
1085#[derive(Debug, Clone, Serialize, Deserialize)]
1087#[serde(untagged)]
1088pub enum GetFundingInfoV1Error {
1089 Status4XX(models::ApiError),
1090 Status5XX(models::ApiError),
1091 UnknownValue(serde_json::Value),
1092}
1093
1094#[derive(Debug, Clone, Serialize, Deserialize)]
1096#[serde(untagged)]
1097pub enum GetFundingRateV1Error {
1098 Status4XX(models::ApiError),
1099 Status5XX(models::ApiError),
1100 UnknownValue(serde_json::Value),
1101}
1102
1103#[derive(Debug, Clone, Serialize, Deserialize)]
1105#[serde(untagged)]
1106pub enum GetFuturesDataBasisError {
1107 Status4XX(models::ApiError),
1108 Status5XX(models::ApiError),
1109 UnknownValue(serde_json::Value),
1110}
1111
1112#[derive(Debug, Clone, Serialize, Deserialize)]
1114#[serde(untagged)]
1115pub enum GetFuturesDataDeliveryPriceError {
1116 Status4XX(models::ApiError),
1117 Status5XX(models::ApiError),
1118 UnknownValue(serde_json::Value),
1119}
1120
1121#[derive(Debug, Clone, Serialize, Deserialize)]
1123#[serde(untagged)]
1124pub enum GetFuturesDataGlobalLongShortAccountRatioError {
1125 Status4XX(models::ApiError),
1126 Status5XX(models::ApiError),
1127 UnknownValue(serde_json::Value),
1128}
1129
1130#[derive(Debug, Clone, Serialize, Deserialize)]
1132#[serde(untagged)]
1133pub enum GetFuturesDataOpenInterestHistError {
1134 Status4XX(models::ApiError),
1135 Status5XX(models::ApiError),
1136 UnknownValue(serde_json::Value),
1137}
1138
1139#[derive(Debug, Clone, Serialize, Deserialize)]
1141#[serde(untagged)]
1142pub enum GetFuturesDataTakerlongshortRatioError {
1143 Status4XX(models::ApiError),
1144 Status5XX(models::ApiError),
1145 UnknownValue(serde_json::Value),
1146}
1147
1148#[derive(Debug, Clone, Serialize, Deserialize)]
1150#[serde(untagged)]
1151pub enum GetFuturesDataTopLongShortAccountRatioError {
1152 Status4XX(models::ApiError),
1153 Status5XX(models::ApiError),
1154 UnknownValue(serde_json::Value),
1155}
1156
1157#[derive(Debug, Clone, Serialize, Deserialize)]
1159#[serde(untagged)]
1160pub enum GetFuturesDataTopLongShortPositionRatioError {
1161 Status4XX(models::ApiError),
1162 Status5XX(models::ApiError),
1163 UnknownValue(serde_json::Value),
1164}
1165
1166#[derive(Debug, Clone, Serialize, Deserialize)]
1168#[serde(untagged)]
1169pub enum GetHistoricalTradesV1Error {
1170 Status4XX(models::ApiError),
1171 Status5XX(models::ApiError),
1172 UnknownValue(serde_json::Value),
1173}
1174
1175#[derive(Debug, Clone, Serialize, Deserialize)]
1177#[serde(untagged)]
1178pub enum GetIncomeAsynIdV1Error {
1179 Status4XX(models::ApiError),
1180 Status5XX(models::ApiError),
1181 UnknownValue(serde_json::Value),
1182}
1183
1184#[derive(Debug, Clone, Serialize, Deserialize)]
1186#[serde(untagged)]
1187pub enum GetIncomeAsynV1Error {
1188 Status4XX(models::ApiError),
1189 Status5XX(models::ApiError),
1190 UnknownValue(serde_json::Value),
1191}
1192
1193#[derive(Debug, Clone, Serialize, Deserialize)]
1195#[serde(untagged)]
1196pub enum GetIndexInfoV1Error {
1197 Status4XX(models::ApiError),
1198 Status5XX(models::ApiError),
1199 UnknownValue(serde_json::Value),
1200}
1201
1202#[derive(Debug, Clone, Serialize, Deserialize)]
1204#[serde(untagged)]
1205pub enum GetIndexPriceKlinesV1Error {
1206 Status4XX(models::ApiError),
1207 Status5XX(models::ApiError),
1208 UnknownValue(serde_json::Value),
1209}
1210
1211#[derive(Debug, Clone, Serialize, Deserialize)]
1213#[serde(untagged)]
1214pub enum GetKlinesV1Error {
1215 Status4XX(models::ApiError),
1216 Status5XX(models::ApiError),
1217 UnknownValue(serde_json::Value),
1218}
1219
1220#[derive(Debug, Clone, Serialize, Deserialize)]
1222#[serde(untagged)]
1223pub enum GetLeverageBracketV1Error {
1224 Status4XX(models::ApiError),
1225 Status5XX(models::ApiError),
1226 UnknownValue(serde_json::Value),
1227}
1228
1229#[derive(Debug, Clone, Serialize, Deserialize)]
1231#[serde(untagged)]
1232pub enum GetMarkPriceKlinesV1Error {
1233 Status4XX(models::ApiError),
1234 Status5XX(models::ApiError),
1235 UnknownValue(serde_json::Value),
1236}
1237
1238#[derive(Debug, Clone, Serialize, Deserialize)]
1240#[serde(untagged)]
1241pub enum GetMultiAssetsMarginV1Error {
1242 Status4XX(models::ApiError),
1243 Status5XX(models::ApiError),
1244 UnknownValue(serde_json::Value),
1245}
1246
1247#[derive(Debug, Clone, Serialize, Deserialize)]
1249#[serde(untagged)]
1250pub enum GetOpenInterestV1Error {
1251 Status4XX(models::ApiError),
1252 Status5XX(models::ApiError),
1253 UnknownValue(serde_json::Value),
1254}
1255
1256#[derive(Debug, Clone, Serialize, Deserialize)]
1258#[serde(untagged)]
1259pub enum GetOpenOrderV1Error {
1260 Status4XX(models::ApiError),
1261 Status5XX(models::ApiError),
1262 UnknownValue(serde_json::Value),
1263}
1264
1265#[derive(Debug, Clone, Serialize, Deserialize)]
1267#[serde(untagged)]
1268pub enum GetOpenOrdersV1Error {
1269 Status4XX(models::ApiError),
1270 Status5XX(models::ApiError),
1271 UnknownValue(serde_json::Value),
1272}
1273
1274#[derive(Debug, Clone, Serialize, Deserialize)]
1276#[serde(untagged)]
1277pub enum GetOrderAmendmentV1Error {
1278 Status4XX(models::ApiError),
1279 Status5XX(models::ApiError),
1280 UnknownValue(serde_json::Value),
1281}
1282
1283#[derive(Debug, Clone, Serialize, Deserialize)]
1285#[serde(untagged)]
1286pub enum GetOrderAsynIdV1Error {
1287 Status4XX(models::ApiError),
1288 Status5XX(models::ApiError),
1289 UnknownValue(serde_json::Value),
1290}
1291
1292#[derive(Debug, Clone, Serialize, Deserialize)]
1294#[serde(untagged)]
1295pub enum GetOrderAsynV1Error {
1296 Status4XX(models::ApiError),
1297 Status5XX(models::ApiError),
1298 UnknownValue(serde_json::Value),
1299}
1300
1301#[derive(Debug, Clone, Serialize, Deserialize)]
1303#[serde(untagged)]
1304pub enum GetOrderV1Error {
1305 Status4XX(models::ApiError),
1306 Status5XX(models::ApiError),
1307 UnknownValue(serde_json::Value),
1308}
1309
1310#[derive(Debug, Clone, Serialize, Deserialize)]
1312#[serde(untagged)]
1313pub enum GetPingV1Error {
1314 Status4XX(models::ApiError),
1315 Status5XX(models::ApiError),
1316 UnknownValue(serde_json::Value),
1317}
1318
1319#[derive(Debug, Clone, Serialize, Deserialize)]
1321#[serde(untagged)]
1322pub enum GetPmAccountInfoV1Error {
1323 Status4XX(models::ApiError),
1324 Status5XX(models::ApiError),
1325 UnknownValue(serde_json::Value),
1326}
1327
1328#[derive(Debug, Clone, Serialize, Deserialize)]
1330#[serde(untagged)]
1331pub enum GetPositionMarginHistoryV1Error {
1332 Status4XX(models::ApiError),
1333 Status5XX(models::ApiError),
1334 UnknownValue(serde_json::Value),
1335}
1336
1337#[derive(Debug, Clone, Serialize, Deserialize)]
1339#[serde(untagged)]
1340pub enum GetPositionRiskV2Error {
1341 Status4XX(models::ApiError),
1342 Status5XX(models::ApiError),
1343 UnknownValue(serde_json::Value),
1344}
1345
1346#[derive(Debug, Clone, Serialize, Deserialize)]
1348#[serde(untagged)]
1349pub enum GetPositionRiskV3Error {
1350 Status4XX(models::ApiError),
1351 Status5XX(models::ApiError),
1352 UnknownValue(serde_json::Value),
1353}
1354
1355#[derive(Debug, Clone, Serialize, Deserialize)]
1357#[serde(untagged)]
1358pub enum GetPositionSideDualV1Error {
1359 Status4XX(models::ApiError),
1360 Status5XX(models::ApiError),
1361 UnknownValue(serde_json::Value),
1362}
1363
1364#[derive(Debug, Clone, Serialize, Deserialize)]
1366#[serde(untagged)]
1367pub enum GetPremiumIndexKlinesV1Error {
1368 Status4XX(models::ApiError),
1369 Status5XX(models::ApiError),
1370 UnknownValue(serde_json::Value),
1371}
1372
1373#[derive(Debug, Clone, Serialize, Deserialize)]
1375#[serde(untagged)]
1376pub enum GetPremiumIndexV1Error {
1377 Status4XX(models::ApiError),
1378 Status5XX(models::ApiError),
1379 UnknownValue(serde_json::Value),
1380}
1381
1382#[derive(Debug, Clone, Serialize, Deserialize)]
1384#[serde(untagged)]
1385pub enum GetRateLimitOrderV1Error {
1386 Status4XX(models::ApiError),
1387 Status5XX(models::ApiError),
1388 UnknownValue(serde_json::Value),
1389}
1390
1391#[derive(Debug, Clone, Serialize, Deserialize)]
1393#[serde(untagged)]
1394pub enum GetSymbolConfigV1Error {
1395 Status4XX(models::ApiError),
1396 Status5XX(models::ApiError),
1397 UnknownValue(serde_json::Value),
1398}
1399
1400#[derive(Debug, Clone, Serialize, Deserialize)]
1402#[serde(untagged)]
1403pub enum GetTicker24hrV1Error {
1404 Status4XX(models::ApiError),
1405 Status5XX(models::ApiError),
1406 UnknownValue(serde_json::Value),
1407}
1408
1409#[derive(Debug, Clone, Serialize, Deserialize)]
1411#[serde(untagged)]
1412pub enum GetTickerBookTickerV1Error {
1413 Status4XX(models::ApiError),
1414 Status5XX(models::ApiError),
1415 UnknownValue(serde_json::Value),
1416}
1417
1418#[derive(Debug, Clone, Serialize, Deserialize)]
1420#[serde(untagged)]
1421pub enum GetTickerPriceV1Error {
1422 Status4XX(models::ApiError),
1423 Status5XX(models::ApiError),
1424 UnknownValue(serde_json::Value),
1425}
1426
1427#[derive(Debug, Clone, Serialize, Deserialize)]
1429#[serde(untagged)]
1430pub enum GetTickerPriceV2Error {
1431 Status4XX(models::ApiError),
1432 Status5XX(models::ApiError),
1433 UnknownValue(serde_json::Value),
1434}
1435
1436#[derive(Debug, Clone, Serialize, Deserialize)]
1438#[serde(untagged)]
1439pub enum GetTimeV1Error {
1440 Status4XX(models::ApiError),
1441 Status5XX(models::ApiError),
1442 UnknownValue(serde_json::Value),
1443}
1444
1445#[derive(Debug, Clone, Serialize, Deserialize)]
1447#[serde(untagged)]
1448pub enum GetTradeAsynIdV1Error {
1449 Status4XX(models::ApiError),
1450 Status5XX(models::ApiError),
1451 UnknownValue(serde_json::Value),
1452}
1453
1454#[derive(Debug, Clone, Serialize, Deserialize)]
1456#[serde(untagged)]
1457pub enum GetTradeAsynV1Error {
1458 Status4XX(models::ApiError),
1459 Status5XX(models::ApiError),
1460 UnknownValue(serde_json::Value),
1461}
1462
1463#[derive(Debug, Clone, Serialize, Deserialize)]
1465#[serde(untagged)]
1466pub enum GetTradesV1Error {
1467 Status4XX(models::ApiError),
1468 Status5XX(models::ApiError),
1469 UnknownValue(serde_json::Value),
1470}
1471
1472#[derive(Debug, Clone, Serialize, Deserialize)]
1474#[serde(untagged)]
1475pub enum GetUserTradesV1Error {
1476 Status4XX(models::ApiError),
1477 Status5XX(models::ApiError),
1478 UnknownValue(serde_json::Value),
1479}
1480
1481#[derive(Debug, Clone, Serialize, Deserialize)]
1483#[serde(untagged)]
1484pub enum UpdateBatchOrdersV1Error {
1485 Status4XX(models::ApiError),
1486 Status5XX(models::ApiError),
1487 UnknownValue(serde_json::Value),
1488}
1489
1490#[derive(Debug, Clone, Serialize, Deserialize)]
1492#[serde(untagged)]
1493pub enum UpdateListenKeyV1Error {
1494 Status4XX(models::ApiError),
1495 Status5XX(models::ApiError),
1496 UnknownValue(serde_json::Value),
1497}
1498
1499#[derive(Debug, Clone, Serialize, Deserialize)]
1501#[serde(untagged)]
1502pub enum UpdateOrderV1Error {
1503 Status4XX(models::ApiError),
1504 Status5XX(models::ApiError),
1505 UnknownValue(serde_json::Value),
1506}
1507
1508
1509pub async fn create_batch_orders_v1(configuration: &configuration::Configuration, params: CreateBatchOrdersV1Params) -> Result<Vec<models::UmfuturesCreateBatchOrdersV1RespInner>, Error<CreateBatchOrdersV1Error>> {
1511
1512 let uri_str = format!("{}/fapi/v1/batchOrders", configuration.base_path);
1513 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1514
1515 let mut query_params: Vec<(String, String)> = Vec::new();
1517
1518
1519 let mut header_params = std::collections::HashMap::new();
1521
1522 if let Some(ref binance_auth) = configuration.binance_auth {
1524 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1526
1527 let body_string: Option<Vec<u8>> = None;
1529
1530 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1532 Ok(sig) => sig,
1533 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1534 };
1535
1536 query_params.push(("signature".to_string(), signature));
1538 }
1539
1540 if !query_params.is_empty() {
1542 req_builder = req_builder.query(&query_params);
1543 }
1544
1545
1546 if let Some(ref user_agent) = configuration.user_agent {
1548 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1549 }
1550
1551 for (header_name, header_value) in header_params {
1553 req_builder = req_builder.header(&header_name, &header_value);
1554 }
1555
1556 let mut multipart_form_params = std::collections::HashMap::new();
1557 multipart_form_params.insert("batchOrders", params.batch_orders.into_iter().map(|p| serde_json::to_string(&p).unwrap_or_default()).collect::<Vec<String>>().join(",").to_string());
1558 if let Some(param_value) = params.recv_window {
1559 multipart_form_params.insert("recvWindow", param_value.to_string());
1560 }
1561 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1562 req_builder = req_builder.form(&multipart_form_params);
1563
1564 let req = req_builder.build()?;
1565 let resp = configuration.client.execute(req).await?;
1566
1567 let status = resp.status();
1568 let content_type = resp
1569 .headers()
1570 .get("content-type")
1571 .and_then(|v| v.to_str().ok())
1572 .unwrap_or("application/octet-stream");
1573 let content_type = super::ContentType::from(content_type);
1574
1575 if !status.is_client_error() && !status.is_server_error() {
1576 let content = resp.text().await?;
1577 match content_type {
1578 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1579 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UmfuturesCreateBatchOrdersV1RespInner>`"))),
1580 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::UmfuturesCreateBatchOrdersV1RespInner>`")))),
1581 }
1582 } else {
1583 let content = resp.text().await?;
1584 let entity: Option<CreateBatchOrdersV1Error> = serde_json::from_str(&content).ok();
1585 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1586 }
1587}
1588
1589pub async fn create_convert_accept_quote_v1(configuration: &configuration::Configuration, params: CreateConvertAcceptQuoteV1Params) -> Result<models::CreateConvertAcceptQuoteV1Resp, Error<CreateConvertAcceptQuoteV1Error>> {
1591
1592 let uri_str = format!("{}/fapi/v1/convert/acceptQuote", configuration.base_path);
1593 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1594
1595 let mut query_params: Vec<(String, String)> = Vec::new();
1597
1598
1599 let mut header_params = std::collections::HashMap::new();
1601
1602 if let Some(ref binance_auth) = configuration.binance_auth {
1604 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1606
1607 let body_string: Option<Vec<u8>> = None;
1609
1610 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1612 Ok(sig) => sig,
1613 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1614 };
1615
1616 query_params.push(("signature".to_string(), signature));
1618 }
1619
1620 if !query_params.is_empty() {
1622 req_builder = req_builder.query(&query_params);
1623 }
1624
1625
1626 if let Some(ref user_agent) = configuration.user_agent {
1628 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1629 }
1630
1631 for (header_name, header_value) in header_params {
1633 req_builder = req_builder.header(&header_name, &header_value);
1634 }
1635
1636 let mut multipart_form_params = std::collections::HashMap::new();
1637 multipart_form_params.insert("quoteId", params.quote_id.to_string());
1638 if let Some(param_value) = params.recv_window {
1639 multipart_form_params.insert("recvWindow", param_value.to_string());
1640 }
1641 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1642 req_builder = req_builder.form(&multipart_form_params);
1643
1644 let req = req_builder.build()?;
1645 let resp = configuration.client.execute(req).await?;
1646
1647 let status = resp.status();
1648 let content_type = resp
1649 .headers()
1650 .get("content-type")
1651 .and_then(|v| v.to_str().ok())
1652 .unwrap_or("application/octet-stream");
1653 let content_type = super::ContentType::from(content_type);
1654
1655 if !status.is_client_error() && !status.is_server_error() {
1656 let content = resp.text().await?;
1657 match content_type {
1658 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1659 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateConvertAcceptQuoteV1Resp`"))),
1660 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::CreateConvertAcceptQuoteV1Resp`")))),
1661 }
1662 } else {
1663 let content = resp.text().await?;
1664 let entity: Option<CreateConvertAcceptQuoteV1Error> = serde_json::from_str(&content).ok();
1665 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1666 }
1667}
1668
1669pub async fn create_convert_get_quote_v1(configuration: &configuration::Configuration, params: CreateConvertGetQuoteV1Params) -> Result<models::CreateConvertGetQuoteV1Resp, Error<CreateConvertGetQuoteV1Error>> {
1671
1672 let uri_str = format!("{}/fapi/v1/convert/getQuote", configuration.base_path);
1673 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1674
1675 let mut query_params: Vec<(String, String)> = Vec::new();
1677
1678
1679 let mut header_params = std::collections::HashMap::new();
1681
1682 if let Some(ref binance_auth) = configuration.binance_auth {
1684 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1686
1687 let body_string: Option<Vec<u8>> = None;
1689
1690 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1692 Ok(sig) => sig,
1693 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1694 };
1695
1696 query_params.push(("signature".to_string(), signature));
1698 }
1699
1700 if !query_params.is_empty() {
1702 req_builder = req_builder.query(&query_params);
1703 }
1704
1705
1706 if let Some(ref user_agent) = configuration.user_agent {
1708 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1709 }
1710
1711 for (header_name, header_value) in header_params {
1713 req_builder = req_builder.header(&header_name, &header_value);
1714 }
1715
1716 let mut multipart_form_params = std::collections::HashMap::new();
1717 if let Some(param_value) = params.from_amount {
1718 multipart_form_params.insert("fromAmount", param_value.to_string());
1719 }
1720 multipart_form_params.insert("fromAsset", params.from_asset.to_string());
1721 if let Some(param_value) = params.recv_window {
1722 multipart_form_params.insert("recvWindow", param_value.to_string());
1723 }
1724 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1725 if let Some(param_value) = params.to_amount {
1726 multipart_form_params.insert("toAmount", param_value.to_string());
1727 }
1728 multipart_form_params.insert("toAsset", params.to_asset.to_string());
1729 if let Some(param_value) = params.valid_time {
1730 multipart_form_params.insert("validTime", param_value.to_string());
1731 }
1732 req_builder = req_builder.form(&multipart_form_params);
1733
1734 let req = req_builder.build()?;
1735 let resp = configuration.client.execute(req).await?;
1736
1737 let status = resp.status();
1738 let content_type = resp
1739 .headers()
1740 .get("content-type")
1741 .and_then(|v| v.to_str().ok())
1742 .unwrap_or("application/octet-stream");
1743 let content_type = super::ContentType::from(content_type);
1744
1745 if !status.is_client_error() && !status.is_server_error() {
1746 let content = resp.text().await?;
1747 match content_type {
1748 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1749 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateConvertGetQuoteV1Resp`"))),
1750 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::CreateConvertGetQuoteV1Resp`")))),
1751 }
1752 } else {
1753 let content = resp.text().await?;
1754 let entity: Option<CreateConvertGetQuoteV1Error> = serde_json::from_str(&content).ok();
1755 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1756 }
1757}
1758
1759pub async fn create_countdown_cancel_all_v1(configuration: &configuration::Configuration, params: CreateCountdownCancelAllV1Params) -> Result<models::UmfuturesCreateCountdownCancelAllV1Resp, Error<CreateCountdownCancelAllV1Error>> {
1761
1762 let uri_str = format!("{}/fapi/v1/countdownCancelAll", configuration.base_path);
1763 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1764
1765 let mut query_params: Vec<(String, String)> = Vec::new();
1767
1768
1769 let mut header_params = std::collections::HashMap::new();
1771
1772 if let Some(ref binance_auth) = configuration.binance_auth {
1774 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1776
1777 let body_string = match serde_json::to_string(¶ms.umfutures_create_countdown_cancel_all_v1_req) {
1779 Ok(json) => Some(json.into_bytes()),
1780 Err(e) => return Err(Error::Serde(e)),
1781 };
1782
1783 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1785 Ok(sig) => sig,
1786 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1787 };
1788
1789 query_params.push(("signature".to_string(), signature));
1791 }
1792
1793 if !query_params.is_empty() {
1795 req_builder = req_builder.query(&query_params);
1796 }
1797
1798
1799 if let Some(ref user_agent) = configuration.user_agent {
1801 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1802 }
1803
1804 for (header_name, header_value) in header_params {
1806 req_builder = req_builder.header(&header_name, &header_value);
1807 }
1808
1809 req_builder = req_builder.json(¶ms.umfutures_create_countdown_cancel_all_v1_req);
1810
1811 let req = req_builder.build()?;
1812 let resp = configuration.client.execute(req).await?;
1813
1814 let status = resp.status();
1815 let content_type = resp
1816 .headers()
1817 .get("content-type")
1818 .and_then(|v| v.to_str().ok())
1819 .unwrap_or("application/octet-stream");
1820 let content_type = super::ContentType::from(content_type);
1821
1822 if !status.is_client_error() && !status.is_server_error() {
1823 let content = resp.text().await?;
1824 match content_type {
1825 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1826 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesCreateCountdownCancelAllV1Resp`"))),
1827 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::UmfuturesCreateCountdownCancelAllV1Resp`")))),
1828 }
1829 } else {
1830 let content = resp.text().await?;
1831 let entity: Option<CreateCountdownCancelAllV1Error> = serde_json::from_str(&content).ok();
1832 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1833 }
1834}
1835
1836pub async fn create_fee_burn_v1(configuration: &configuration::Configuration, params: CreateFeeBurnV1Params) -> Result<models::CreateFeeBurnV1Resp, Error<CreateFeeBurnV1Error>> {
1838
1839 let uri_str = format!("{}/fapi/v1/feeBurn", configuration.base_path);
1840 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1841
1842 let mut query_params: Vec<(String, String)> = Vec::new();
1844
1845
1846 let mut header_params = std::collections::HashMap::new();
1848
1849 if let Some(ref binance_auth) = configuration.binance_auth {
1851 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1853
1854 let body_string: Option<Vec<u8>> = None;
1856
1857 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1859 Ok(sig) => sig,
1860 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1861 };
1862
1863 query_params.push(("signature".to_string(), signature));
1865 }
1866
1867 if !query_params.is_empty() {
1869 req_builder = req_builder.query(&query_params);
1870 }
1871
1872
1873 if let Some(ref user_agent) = configuration.user_agent {
1875 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1876 }
1877
1878 for (header_name, header_value) in header_params {
1880 req_builder = req_builder.header(&header_name, &header_value);
1881 }
1882
1883 let mut multipart_form_params = std::collections::HashMap::new();
1884 multipart_form_params.insert("feeBurn", params.fee_burn.to_string());
1885 if let Some(param_value) = params.recv_window {
1886 multipart_form_params.insert("recvWindow", param_value.to_string());
1887 }
1888 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1889 req_builder = req_builder.form(&multipart_form_params);
1890
1891 let req = req_builder.build()?;
1892 let resp = configuration.client.execute(req).await?;
1893
1894 let status = resp.status();
1895 let content_type = resp
1896 .headers()
1897 .get("content-type")
1898 .and_then(|v| v.to_str().ok())
1899 .unwrap_or("application/octet-stream");
1900 let content_type = super::ContentType::from(content_type);
1901
1902 if !status.is_client_error() && !status.is_server_error() {
1903 let content = resp.text().await?;
1904 match content_type {
1905 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1906 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateFeeBurnV1Resp`"))),
1907 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::CreateFeeBurnV1Resp`")))),
1908 }
1909 } else {
1910 let content = resp.text().await?;
1911 let entity: Option<CreateFeeBurnV1Error> = serde_json::from_str(&content).ok();
1912 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1913 }
1914}
1915
1916pub async fn create_leverage_v1(configuration: &configuration::Configuration, params: CreateLeverageV1Params) -> Result<models::CreateLeverageV1Resp, Error<CreateLeverageV1Error>> {
1918
1919 let uri_str = format!("{}/fapi/v1/leverage", configuration.base_path);
1920 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1921
1922 let mut query_params: Vec<(String, String)> = Vec::new();
1924
1925
1926 let mut header_params = std::collections::HashMap::new();
1928
1929 if let Some(ref binance_auth) = configuration.binance_auth {
1931 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1933
1934 let body_string: Option<Vec<u8>> = None;
1936
1937 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1939 Ok(sig) => sig,
1940 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1941 };
1942
1943 query_params.push(("signature".to_string(), signature));
1945 }
1946
1947 if !query_params.is_empty() {
1949 req_builder = req_builder.query(&query_params);
1950 }
1951
1952
1953 if let Some(ref user_agent) = configuration.user_agent {
1955 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1956 }
1957
1958 for (header_name, header_value) in header_params {
1960 req_builder = req_builder.header(&header_name, &header_value);
1961 }
1962
1963 let mut multipart_form_params = std::collections::HashMap::new();
1964 multipart_form_params.insert("leverage", params.leverage.to_string());
1965 if let Some(param_value) = params.recv_window {
1966 multipart_form_params.insert("recvWindow", param_value.to_string());
1967 }
1968 multipart_form_params.insert("symbol", params.symbol.to_string());
1969 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1970 req_builder = req_builder.form(&multipart_form_params);
1971
1972 let req = req_builder.build()?;
1973 let resp = configuration.client.execute(req).await?;
1974
1975 let status = resp.status();
1976 let content_type = resp
1977 .headers()
1978 .get("content-type")
1979 .and_then(|v| v.to_str().ok())
1980 .unwrap_or("application/octet-stream");
1981 let content_type = super::ContentType::from(content_type);
1982
1983 if !status.is_client_error() && !status.is_server_error() {
1984 let content = resp.text().await?;
1985 match content_type {
1986 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1987 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateLeverageV1Resp`"))),
1988 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::CreateLeverageV1Resp`")))),
1989 }
1990 } else {
1991 let content = resp.text().await?;
1992 let entity: Option<CreateLeverageV1Error> = serde_json::from_str(&content).ok();
1993 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1994 }
1995}
1996
1997pub async fn create_listen_key_v1(configuration: &configuration::Configuration) -> Result<models::CreateListenKeyV1Resp, Error<CreateListenKeyV1Error>> {
1999
2000 let uri_str = format!("{}/fapi/v1/listenKey", configuration.base_path);
2001 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2002
2003 let mut query_params: Vec<(String, String)> = Vec::new();
2005
2006
2007 let mut header_params = std::collections::HashMap::new();
2009
2010 if let Some(ref binance_auth) = configuration.binance_auth {
2012 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2014
2015 let body_string: Option<Vec<u8>> = None;
2017
2018 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2020 Ok(sig) => sig,
2021 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2022 };
2023
2024 query_params.push(("signature".to_string(), signature));
2026 }
2027
2028 if !query_params.is_empty() {
2030 req_builder = req_builder.query(&query_params);
2031 }
2032
2033
2034 if let Some(ref user_agent) = configuration.user_agent {
2036 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2037 }
2038
2039 for (header_name, header_value) in header_params {
2041 req_builder = req_builder.header(&header_name, &header_value);
2042 }
2043
2044
2045 let req = req_builder.build()?;
2046 let resp = configuration.client.execute(req).await?;
2047
2048 let status = resp.status();
2049 let content_type = resp
2050 .headers()
2051 .get("content-type")
2052 .and_then(|v| v.to_str().ok())
2053 .unwrap_or("application/octet-stream");
2054 let content_type = super::ContentType::from(content_type);
2055
2056 if !status.is_client_error() && !status.is_server_error() {
2057 let content = resp.text().await?;
2058 match content_type {
2059 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2060 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateListenKeyV1Resp`"))),
2061 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`")))),
2062 }
2063 } else {
2064 let content = resp.text().await?;
2065 let entity: Option<CreateListenKeyV1Error> = serde_json::from_str(&content).ok();
2066 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2067 }
2068}
2069
2070pub async fn create_margin_type_v1(configuration: &configuration::Configuration, params: CreateMarginTypeV1Params) -> Result<models::CreateMarginTypeV1Resp, Error<CreateMarginTypeV1Error>> {
2072
2073 let uri_str = format!("{}/fapi/v1/marginType", configuration.base_path);
2074 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2075
2076 let mut query_params: Vec<(String, String)> = Vec::new();
2078
2079
2080 let mut header_params = std::collections::HashMap::new();
2082
2083 if let Some(ref binance_auth) = configuration.binance_auth {
2085 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2087
2088 let body_string: Option<Vec<u8>> = None;
2090
2091 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2093 Ok(sig) => sig,
2094 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2095 };
2096
2097 query_params.push(("signature".to_string(), signature));
2099 }
2100
2101 if !query_params.is_empty() {
2103 req_builder = req_builder.query(&query_params);
2104 }
2105
2106
2107 if let Some(ref user_agent) = configuration.user_agent {
2109 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2110 }
2111
2112 for (header_name, header_value) in header_params {
2114 req_builder = req_builder.header(&header_name, &header_value);
2115 }
2116
2117 let mut multipart_form_params = std::collections::HashMap::new();
2118 multipart_form_params.insert("marginType", params.margin_type.to_string());
2119 if let Some(param_value) = params.recv_window {
2120 multipart_form_params.insert("recvWindow", param_value.to_string());
2121 }
2122 multipart_form_params.insert("symbol", params.symbol.to_string());
2123 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2124 req_builder = req_builder.form(&multipart_form_params);
2125
2126 let req = req_builder.build()?;
2127 let resp = configuration.client.execute(req).await?;
2128
2129 let status = resp.status();
2130 let content_type = resp
2131 .headers()
2132 .get("content-type")
2133 .and_then(|v| v.to_str().ok())
2134 .unwrap_or("application/octet-stream");
2135 let content_type = super::ContentType::from(content_type);
2136
2137 if !status.is_client_error() && !status.is_server_error() {
2138 let content = resp.text().await?;
2139 match content_type {
2140 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2141 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateMarginTypeV1Resp`"))),
2142 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateMarginTypeV1Resp`")))),
2143 }
2144 } else {
2145 let content = resp.text().await?;
2146 let entity: Option<CreateMarginTypeV1Error> = serde_json::from_str(&content).ok();
2147 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2148 }
2149}
2150
2151pub async fn create_multi_assets_margin_v1(configuration: &configuration::Configuration, params: CreateMultiAssetsMarginV1Params) -> Result<models::CreateMultiAssetsMarginV1Resp, Error<CreateMultiAssetsMarginV1Error>> {
2153
2154 let uri_str = format!("{}/fapi/v1/multiAssetsMargin", configuration.base_path);
2155 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2156
2157 let mut query_params: Vec<(String, String)> = Vec::new();
2159
2160
2161 let mut header_params = std::collections::HashMap::new();
2163
2164 if let Some(ref binance_auth) = configuration.binance_auth {
2166 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2168
2169 let body_string: Option<Vec<u8>> = None;
2171
2172 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2174 Ok(sig) => sig,
2175 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2176 };
2177
2178 query_params.push(("signature".to_string(), signature));
2180 }
2181
2182 if !query_params.is_empty() {
2184 req_builder = req_builder.query(&query_params);
2185 }
2186
2187
2188 if let Some(ref user_agent) = configuration.user_agent {
2190 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2191 }
2192
2193 for (header_name, header_value) in header_params {
2195 req_builder = req_builder.header(&header_name, &header_value);
2196 }
2197
2198 let mut multipart_form_params = std::collections::HashMap::new();
2199 multipart_form_params.insert("multiAssetsMargin", params.multi_assets_margin.to_string());
2200 if let Some(param_value) = params.recv_window {
2201 multipart_form_params.insert("recvWindow", param_value.to_string());
2202 }
2203 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2204 req_builder = req_builder.form(&multipart_form_params);
2205
2206 let req = req_builder.build()?;
2207 let resp = configuration.client.execute(req).await?;
2208
2209 let status = resp.status();
2210 let content_type = resp
2211 .headers()
2212 .get("content-type")
2213 .and_then(|v| v.to_str().ok())
2214 .unwrap_or("application/octet-stream");
2215 let content_type = super::ContentType::from(content_type);
2216
2217 if !status.is_client_error() && !status.is_server_error() {
2218 let content = resp.text().await?;
2219 match content_type {
2220 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2221 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateMultiAssetsMarginV1Resp`"))),
2222 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateMultiAssetsMarginV1Resp`")))),
2223 }
2224 } else {
2225 let content = resp.text().await?;
2226 let entity: Option<CreateMultiAssetsMarginV1Error> = serde_json::from_str(&content).ok();
2227 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2228 }
2229}
2230
2231pub async fn create_order_test_v1(configuration: &configuration::Configuration, params: CreateOrderTestV1Params) -> Result<models::CreateOrderTestV1Resp, Error<CreateOrderTestV1Error>> {
2233
2234 let uri_str = format!("{}/fapi/v1/order/test", configuration.base_path);
2235 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2236
2237 let mut query_params: Vec<(String, String)> = Vec::new();
2239
2240
2241 let mut header_params = std::collections::HashMap::new();
2243
2244 if let Some(ref binance_auth) = configuration.binance_auth {
2246 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2248
2249 let body_string: Option<Vec<u8>> = None;
2251
2252 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2254 Ok(sig) => sig,
2255 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2256 };
2257
2258 query_params.push(("signature".to_string(), signature));
2260 }
2261
2262 if !query_params.is_empty() {
2264 req_builder = req_builder.query(&query_params);
2265 }
2266
2267
2268 if let Some(ref user_agent) = configuration.user_agent {
2270 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2271 }
2272
2273 for (header_name, header_value) in header_params {
2275 req_builder = req_builder.header(&header_name, &header_value);
2276 }
2277
2278 let mut multipart_form_params = std::collections::HashMap::new();
2279 if let Some(param_value) = params.activation_price {
2280 multipart_form_params.insert("activationPrice", param_value.to_string());
2281 }
2282 if let Some(param_value) = params.callback_rate {
2283 multipart_form_params.insert("callbackRate", param_value.to_string());
2284 }
2285 if let Some(param_value) = params.close_position {
2286 multipart_form_params.insert("closePosition", param_value.to_string());
2287 }
2288 if let Some(param_value) = params.good_till_date {
2289 multipart_form_params.insert("goodTillDate", param_value.to_string());
2290 }
2291 if let Some(param_value) = params.new_client_order_id {
2292 multipart_form_params.insert("newClientOrderId", param_value.to_string());
2293 }
2294 if let Some(param_value) = params.new_order_resp_type {
2295 multipart_form_params.insert("newOrderRespType", param_value.to_string());
2296 }
2297 if let Some(param_value) = params.position_side {
2298 multipart_form_params.insert("positionSide", param_value.to_string());
2299 }
2300 if let Some(param_value) = params.price {
2301 multipart_form_params.insert("price", param_value.to_string());
2302 }
2303 if let Some(param_value) = params.price_match {
2304 multipart_form_params.insert("priceMatch", param_value.to_string());
2305 }
2306 if let Some(param_value) = params.price_protect {
2307 multipart_form_params.insert("priceProtect", param_value.to_string());
2308 }
2309 if let Some(param_value) = params.quantity {
2310 multipart_form_params.insert("quantity", param_value.to_string());
2311 }
2312 if let Some(param_value) = params.recv_window {
2313 multipart_form_params.insert("recvWindow", param_value.to_string());
2314 }
2315 if let Some(param_value) = params.reduce_only {
2316 multipart_form_params.insert("reduceOnly", param_value.to_string());
2317 }
2318 if let Some(param_value) = params.self_trade_prevention_mode {
2319 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
2320 }
2321 multipart_form_params.insert("side", params.side.to_string());
2322 if let Some(param_value) = params.stop_price {
2323 multipart_form_params.insert("stopPrice", param_value.to_string());
2324 }
2325 multipart_form_params.insert("symbol", params.symbol.to_string());
2326 if let Some(param_value) = params.time_in_force {
2327 multipart_form_params.insert("timeInForce", param_value.to_string());
2328 }
2329 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2330 multipart_form_params.insert("type", params.r#type.to_string());
2331 if let Some(param_value) = params.working_type {
2332 multipart_form_params.insert("workingType", param_value.to_string());
2333 }
2334 req_builder = req_builder.form(&multipart_form_params);
2335
2336 let req = req_builder.build()?;
2337 let resp = configuration.client.execute(req).await?;
2338
2339 let status = resp.status();
2340 let content_type = resp
2341 .headers()
2342 .get("content-type")
2343 .and_then(|v| v.to_str().ok())
2344 .unwrap_or("application/octet-stream");
2345 let content_type = super::ContentType::from(content_type);
2346
2347 if !status.is_client_error() && !status.is_server_error() {
2348 let content = resp.text().await?;
2349 match content_type {
2350 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2351 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateOrderTestV1Resp`"))),
2352 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::CreateOrderTestV1Resp`")))),
2353 }
2354 } else {
2355 let content = resp.text().await?;
2356 let entity: Option<CreateOrderTestV1Error> = serde_json::from_str(&content).ok();
2357 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2358 }
2359}
2360
2361pub async fn create_order_v1(configuration: &configuration::Configuration, params: CreateOrderV1Params) -> Result<models::CreateOrderV1Resp, Error<CreateOrderV1Error>> {
2363
2364 let uri_str = format!("{}/fapi/v1/order", configuration.base_path);
2365 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2366
2367 let mut query_params: Vec<(String, String)> = Vec::new();
2369
2370
2371 let mut header_params = std::collections::HashMap::new();
2373
2374 if let Some(ref binance_auth) = configuration.binance_auth {
2376 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2378
2379 let body_string: Option<Vec<u8>> = None;
2381
2382 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2384 Ok(sig) => sig,
2385 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2386 };
2387
2388 query_params.push(("signature".to_string(), signature));
2390 }
2391
2392 if !query_params.is_empty() {
2394 req_builder = req_builder.query(&query_params);
2395 }
2396
2397
2398 if let Some(ref user_agent) = configuration.user_agent {
2400 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2401 }
2402
2403 for (header_name, header_value) in header_params {
2405 req_builder = req_builder.header(&header_name, &header_value);
2406 }
2407
2408 let mut multipart_form_params = std::collections::HashMap::new();
2409 if let Some(param_value) = params.activation_price {
2410 multipart_form_params.insert("activationPrice", param_value.to_string());
2411 }
2412 if let Some(param_value) = params.callback_rate {
2413 multipart_form_params.insert("callbackRate", param_value.to_string());
2414 }
2415 if let Some(param_value) = params.close_position {
2416 multipart_form_params.insert("closePosition", param_value.to_string());
2417 }
2418 if let Some(param_value) = params.good_till_date {
2419 multipart_form_params.insert("goodTillDate", param_value.to_string());
2420 }
2421 if let Some(param_value) = params.new_client_order_id {
2422 multipart_form_params.insert("newClientOrderId", param_value.to_string());
2423 }
2424 if let Some(param_value) = params.new_order_resp_type {
2425 multipart_form_params.insert("newOrderRespType", param_value.to_string());
2426 }
2427 if let Some(param_value) = params.position_side {
2428 multipart_form_params.insert("positionSide", param_value.to_string());
2429 }
2430 if let Some(param_value) = params.price {
2431 multipart_form_params.insert("price", param_value.to_string());
2432 }
2433 if let Some(param_value) = params.price_match {
2434 multipart_form_params.insert("priceMatch", param_value.to_string());
2435 }
2436 if let Some(param_value) = params.price_protect {
2437 multipart_form_params.insert("priceProtect", param_value.to_string());
2438 }
2439 if let Some(param_value) = params.quantity {
2440 multipart_form_params.insert("quantity", param_value.to_string());
2441 }
2442 if let Some(param_value) = params.recv_window {
2443 multipart_form_params.insert("recvWindow", param_value.to_string());
2444 }
2445 if let Some(param_value) = params.reduce_only {
2446 multipart_form_params.insert("reduceOnly", param_value.to_string());
2447 }
2448 if let Some(param_value) = params.self_trade_prevention_mode {
2449 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
2450 }
2451 multipart_form_params.insert("side", params.side.to_string());
2452 if let Some(param_value) = params.stop_price {
2453 multipart_form_params.insert("stopPrice", param_value.to_string());
2454 }
2455 multipart_form_params.insert("symbol", params.symbol.to_string());
2456 if let Some(param_value) = params.time_in_force {
2457 multipart_form_params.insert("timeInForce", param_value.to_string());
2458 }
2459 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2460 multipart_form_params.insert("type", params.r#type.to_string());
2461 if let Some(param_value) = params.working_type {
2462 multipart_form_params.insert("workingType", param_value.to_string());
2463 }
2464 req_builder = req_builder.form(&multipart_form_params);
2465
2466 let req = req_builder.build()?;
2467 let resp = configuration.client.execute(req).await?;
2468
2469 let status = resp.status();
2470 let content_type = resp
2471 .headers()
2472 .get("content-type")
2473 .and_then(|v| v.to_str().ok())
2474 .unwrap_or("application/octet-stream");
2475 let content_type = super::ContentType::from(content_type);
2476
2477 if !status.is_client_error() && !status.is_server_error() {
2478 let content = resp.text().await?;
2479 match content_type {
2480 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2481 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateOrderV1Resp`"))),
2482 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::CreateOrderV1Resp`")))),
2483 }
2484 } else {
2485 let content = resp.text().await?;
2486 let entity: Option<CreateOrderV1Error> = serde_json::from_str(&content).ok();
2487 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2488 }
2489}
2490
2491pub async fn create_position_margin_v1(configuration: &configuration::Configuration, params: CreatePositionMarginV1Params) -> Result<models::CreatePositionMarginV1Resp, Error<CreatePositionMarginV1Error>> {
2493
2494 let uri_str = format!("{}/fapi/v1/positionMargin", configuration.base_path);
2495 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2496
2497 let mut query_params: Vec<(String, String)> = Vec::new();
2499
2500
2501 let mut header_params = std::collections::HashMap::new();
2503
2504 if let Some(ref binance_auth) = configuration.binance_auth {
2506 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2508
2509 let body_string: Option<Vec<u8>> = None;
2511
2512 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2514 Ok(sig) => sig,
2515 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2516 };
2517
2518 query_params.push(("signature".to_string(), signature));
2520 }
2521
2522 if !query_params.is_empty() {
2524 req_builder = req_builder.query(&query_params);
2525 }
2526
2527
2528 if let Some(ref user_agent) = configuration.user_agent {
2530 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2531 }
2532
2533 for (header_name, header_value) in header_params {
2535 req_builder = req_builder.header(&header_name, &header_value);
2536 }
2537
2538 let mut multipart_form_params = std::collections::HashMap::new();
2539 multipart_form_params.insert("amount", params.amount.to_string());
2540 if let Some(param_value) = params.position_side {
2541 multipart_form_params.insert("positionSide", param_value.to_string());
2542 }
2543 if let Some(param_value) = params.recv_window {
2544 multipart_form_params.insert("recvWindow", param_value.to_string());
2545 }
2546 multipart_form_params.insert("symbol", params.symbol.to_string());
2547 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2548 multipart_form_params.insert("type", params.r#type.to_string());
2549 req_builder = req_builder.form(&multipart_form_params);
2550
2551 let req = req_builder.build()?;
2552 let resp = configuration.client.execute(req).await?;
2553
2554 let status = resp.status();
2555 let content_type = resp
2556 .headers()
2557 .get("content-type")
2558 .and_then(|v| v.to_str().ok())
2559 .unwrap_or("application/octet-stream");
2560 let content_type = super::ContentType::from(content_type);
2561
2562 if !status.is_client_error() && !status.is_server_error() {
2563 let content = resp.text().await?;
2564 match content_type {
2565 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2566 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreatePositionMarginV1Resp`"))),
2567 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::CreatePositionMarginV1Resp`")))),
2568 }
2569 } else {
2570 let content = resp.text().await?;
2571 let entity: Option<CreatePositionMarginV1Error> = serde_json::from_str(&content).ok();
2572 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2573 }
2574}
2575
2576pub async fn create_position_side_dual_v1(configuration: &configuration::Configuration, params: CreatePositionSideDualV1Params) -> Result<models::CreatePositionSideDualV1Resp, Error<CreatePositionSideDualV1Error>> {
2578
2579 let uri_str = format!("{}/fapi/v1/positionSide/dual", configuration.base_path);
2580 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2581
2582 let mut query_params: Vec<(String, String)> = Vec::new();
2584
2585
2586 let mut header_params = std::collections::HashMap::new();
2588
2589 if let Some(ref binance_auth) = configuration.binance_auth {
2591 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2593
2594 let body_string: Option<Vec<u8>> = None;
2596
2597 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2599 Ok(sig) => sig,
2600 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2601 };
2602
2603 query_params.push(("signature".to_string(), signature));
2605 }
2606
2607 if !query_params.is_empty() {
2609 req_builder = req_builder.query(&query_params);
2610 }
2611
2612
2613 if let Some(ref user_agent) = configuration.user_agent {
2615 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2616 }
2617
2618 for (header_name, header_value) in header_params {
2620 req_builder = req_builder.header(&header_name, &header_value);
2621 }
2622
2623 let mut multipart_form_params = std::collections::HashMap::new();
2624 multipart_form_params.insert("dualSidePosition", params.dual_side_position.to_string());
2625 if let Some(param_value) = params.recv_window {
2626 multipart_form_params.insert("recvWindow", param_value.to_string());
2627 }
2628 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2629 req_builder = req_builder.form(&multipart_form_params);
2630
2631 let req = req_builder.build()?;
2632 let resp = configuration.client.execute(req).await?;
2633
2634 let status = resp.status();
2635 let content_type = resp
2636 .headers()
2637 .get("content-type")
2638 .and_then(|v| v.to_str().ok())
2639 .unwrap_or("application/octet-stream");
2640 let content_type = super::ContentType::from(content_type);
2641
2642 if !status.is_client_error() && !status.is_server_error() {
2643 let content = resp.text().await?;
2644 match content_type {
2645 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2646 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreatePositionSideDualV1Resp`"))),
2647 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::CreatePositionSideDualV1Resp`")))),
2648 }
2649 } else {
2650 let content = resp.text().await?;
2651 let entity: Option<CreatePositionSideDualV1Error> = serde_json::from_str(&content).ok();
2652 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2653 }
2654}
2655
2656pub async fn delete_all_open_orders_v1(configuration: &configuration::Configuration, params: DeleteAllOpenOrdersV1Params) -> Result<models::DeleteAllOpenOrdersV1Resp, Error<DeleteAllOpenOrdersV1Error>> {
2658
2659 let uri_str = format!("{}/fapi/v1/allOpenOrders", configuration.base_path);
2660 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2661
2662 let mut query_params: Vec<(String, String)> = Vec::new();
2664
2665 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2666 if let Some(ref param_value) = params.recv_window {
2667 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2668 }
2669 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2670
2671 let mut header_params = std::collections::HashMap::new();
2673
2674 if let Some(ref binance_auth) = configuration.binance_auth {
2676 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2678
2679 let body_string: Option<Vec<u8>> = None;
2681
2682 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2684 Ok(sig) => sig,
2685 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2686 };
2687
2688 query_params.push(("signature".to_string(), signature));
2690 }
2691
2692 if !query_params.is_empty() {
2694 req_builder = req_builder.query(&query_params);
2695 }
2696
2697
2698 if let Some(ref user_agent) = configuration.user_agent {
2700 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2701 }
2702
2703 for (header_name, header_value) in header_params {
2705 req_builder = req_builder.header(&header_name, &header_value);
2706 }
2707
2708
2709 let req = req_builder.build()?;
2710 let resp = configuration.client.execute(req).await?;
2711
2712 let status = resp.status();
2713 let content_type = resp
2714 .headers()
2715 .get("content-type")
2716 .and_then(|v| v.to_str().ok())
2717 .unwrap_or("application/octet-stream");
2718 let content_type = super::ContentType::from(content_type);
2719
2720 if !status.is_client_error() && !status.is_server_error() {
2721 let content = resp.text().await?;
2722 match content_type {
2723 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2724 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAllOpenOrdersV1Resp`"))),
2725 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::DeleteAllOpenOrdersV1Resp`")))),
2726 }
2727 } else {
2728 let content = resp.text().await?;
2729 let entity: Option<DeleteAllOpenOrdersV1Error> = serde_json::from_str(&content).ok();
2730 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2731 }
2732}
2733
2734pub async fn delete_batch_orders_v1(configuration: &configuration::Configuration, params: DeleteBatchOrdersV1Params) -> Result<Vec<models::UmfuturesDeleteBatchOrdersV1RespInner>, Error<DeleteBatchOrdersV1Error>> {
2736
2737 let uri_str = format!("{}/fapi/v1/batchOrders", configuration.base_path);
2738 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2739
2740 let mut query_params: Vec<(String, String)> = Vec::new();
2742
2743 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2744 if let Some(ref param_value) = params.order_id_list {
2745 match "multi" {
2746 "multi" => {
2747 for p in param_value {
2748 query_params.push(("orderIdList".to_string(), p.to_string()));
2749 }
2750 },
2751 _ => {
2752 let joined = param_value.iter()
2753 .map(|p| p.to_string())
2754 .collect::<Vec<String>>()
2755 .join(",");
2756 query_params.push(("orderIdList".to_string(), joined));
2757 }
2758 };
2759 }
2760 if let Some(ref param_value) = params.orig_client_order_id_list {
2761 match "multi" {
2762 "multi" => {
2763 for p in param_value {
2764 query_params.push(("origClientOrderIdList".to_string(), p.to_string()));
2765 }
2766 },
2767 _ => {
2768 let joined = param_value.iter()
2769 .map(|p| p.to_string())
2770 .collect::<Vec<String>>()
2771 .join(",");
2772 query_params.push(("origClientOrderIdList".to_string(), joined));
2773 }
2774 };
2775 }
2776 if let Some(ref param_value) = params.recv_window {
2777 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2778 }
2779 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2780
2781 let mut header_params = std::collections::HashMap::new();
2783
2784 if let Some(ref binance_auth) = configuration.binance_auth {
2786 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2788
2789 let body_string: Option<Vec<u8>> = None;
2791
2792 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2794 Ok(sig) => sig,
2795 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2796 };
2797
2798 query_params.push(("signature".to_string(), signature));
2800 }
2801
2802 if !query_params.is_empty() {
2804 req_builder = req_builder.query(&query_params);
2805 }
2806
2807
2808 if let Some(ref user_agent) = configuration.user_agent {
2810 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2811 }
2812
2813 for (header_name, header_value) in header_params {
2815 req_builder = req_builder.header(&header_name, &header_value);
2816 }
2817
2818
2819 let req = req_builder.build()?;
2820 let resp = configuration.client.execute(req).await?;
2821
2822 let status = resp.status();
2823 let content_type = resp
2824 .headers()
2825 .get("content-type")
2826 .and_then(|v| v.to_str().ok())
2827 .unwrap_or("application/octet-stream");
2828 let content_type = super::ContentType::from(content_type);
2829
2830 if !status.is_client_error() && !status.is_server_error() {
2831 let content = resp.text().await?;
2832 match content_type {
2833 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2834 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UmfuturesDeleteBatchOrdersV1RespInner>`"))),
2835 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::UmfuturesDeleteBatchOrdersV1RespInner>`")))),
2836 }
2837 } else {
2838 let content = resp.text().await?;
2839 let entity: Option<DeleteBatchOrdersV1Error> = serde_json::from_str(&content).ok();
2840 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2841 }
2842}
2843
2844pub async fn delete_listen_key_v1(configuration: &configuration::Configuration) -> Result<serde_json::Value, Error<DeleteListenKeyV1Error>> {
2846
2847 let uri_str = format!("{}/fapi/v1/listenKey", configuration.base_path);
2848 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2849
2850 let mut query_params: Vec<(String, String)> = Vec::new();
2852
2853
2854 let mut header_params = std::collections::HashMap::new();
2856
2857 if let Some(ref binance_auth) = configuration.binance_auth {
2859 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2861
2862 let body_string: Option<Vec<u8>> = None;
2864
2865 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2867 Ok(sig) => sig,
2868 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2869 };
2870
2871 query_params.push(("signature".to_string(), signature));
2873 }
2874
2875 if !query_params.is_empty() {
2877 req_builder = req_builder.query(&query_params);
2878 }
2879
2880
2881 if let Some(ref user_agent) = configuration.user_agent {
2883 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2884 }
2885
2886 for (header_name, header_value) in header_params {
2888 req_builder = req_builder.header(&header_name, &header_value);
2889 }
2890
2891
2892 let req = req_builder.build()?;
2893 let resp = configuration.client.execute(req).await?;
2894
2895 let status = resp.status();
2896 let content_type = resp
2897 .headers()
2898 .get("content-type")
2899 .and_then(|v| v.to_str().ok())
2900 .unwrap_or("application/octet-stream");
2901 let content_type = super::ContentType::from(content_type);
2902
2903 if !status.is_client_error() && !status.is_server_error() {
2904 let content = resp.text().await?;
2905 match content_type {
2906 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2907 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2908 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`")))),
2909 }
2910 } else {
2911 let content = resp.text().await?;
2912 let entity: Option<DeleteListenKeyV1Error> = serde_json::from_str(&content).ok();
2913 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2914 }
2915}
2916
2917pub async fn delete_order_v1(configuration: &configuration::Configuration, params: DeleteOrderV1Params) -> Result<models::DeleteOrderV1Resp, Error<DeleteOrderV1Error>> {
2919
2920 let uri_str = format!("{}/fapi/v1/order", configuration.base_path);
2921 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2922
2923 let mut query_params: Vec<(String, String)> = Vec::new();
2925
2926 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2927 if let Some(ref param_value) = params.order_id {
2928 query_params.push(("orderId".to_string(), param_value.to_string()));
2929 }
2930 if let Some(ref param_value) = params.orig_client_order_id {
2931 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
2932 }
2933 if let Some(ref param_value) = params.recv_window {
2934 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2935 }
2936 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2937
2938 let mut header_params = std::collections::HashMap::new();
2940
2941 if let Some(ref binance_auth) = configuration.binance_auth {
2943 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2945
2946 let body_string: Option<Vec<u8>> = None;
2948
2949 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2951 Ok(sig) => sig,
2952 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2953 };
2954
2955 query_params.push(("signature".to_string(), signature));
2957 }
2958
2959 if !query_params.is_empty() {
2961 req_builder = req_builder.query(&query_params);
2962 }
2963
2964
2965 if let Some(ref user_agent) = configuration.user_agent {
2967 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2968 }
2969
2970 for (header_name, header_value) in header_params {
2972 req_builder = req_builder.header(&header_name, &header_value);
2973 }
2974
2975
2976 let req = req_builder.build()?;
2977 let resp = configuration.client.execute(req).await?;
2978
2979 let status = resp.status();
2980 let content_type = resp
2981 .headers()
2982 .get("content-type")
2983 .and_then(|v| v.to_str().ok())
2984 .unwrap_or("application/octet-stream");
2985 let content_type = super::ContentType::from(content_type);
2986
2987 if !status.is_client_error() && !status.is_server_error() {
2988 let content = resp.text().await?;
2989 match content_type {
2990 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2991 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteOrderV1Resp`"))),
2992 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::DeleteOrderV1Resp`")))),
2993 }
2994 } else {
2995 let content = resp.text().await?;
2996 let entity: Option<DeleteOrderV1Error> = serde_json::from_str(&content).ok();
2997 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2998 }
2999}
3000
3001pub async fn get_account_config_v1(configuration: &configuration::Configuration, params: GetAccountConfigV1Params) -> Result<models::GetAccountConfigV1Resp, Error<GetAccountConfigV1Error>> {
3003
3004 let uri_str = format!("{}/fapi/v1/accountConfig", configuration.base_path);
3005 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3006
3007 let mut query_params: Vec<(String, String)> = Vec::new();
3009
3010 if let Some(ref param_value) = params.recv_window {
3011 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3012 }
3013 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3014
3015 let mut header_params = std::collections::HashMap::new();
3017
3018 if let Some(ref binance_auth) = configuration.binance_auth {
3020 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3022
3023 let body_string: Option<Vec<u8>> = None;
3025
3026 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3028 Ok(sig) => sig,
3029 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3030 };
3031
3032 query_params.push(("signature".to_string(), signature));
3034 }
3035
3036 if !query_params.is_empty() {
3038 req_builder = req_builder.query(&query_params);
3039 }
3040
3041
3042 if let Some(ref user_agent) = configuration.user_agent {
3044 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3045 }
3046
3047 for (header_name, header_value) in header_params {
3049 req_builder = req_builder.header(&header_name, &header_value);
3050 }
3051
3052
3053 let req = req_builder.build()?;
3054 let resp = configuration.client.execute(req).await?;
3055
3056 let status = resp.status();
3057 let content_type = resp
3058 .headers()
3059 .get("content-type")
3060 .and_then(|v| v.to_str().ok())
3061 .unwrap_or("application/octet-stream");
3062 let content_type = super::ContentType::from(content_type);
3063
3064 if !status.is_client_error() && !status.is_server_error() {
3065 let content = resp.text().await?;
3066 match content_type {
3067 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3068 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAccountConfigV1Resp`"))),
3069 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::GetAccountConfigV1Resp`")))),
3070 }
3071 } else {
3072 let content = resp.text().await?;
3073 let entity: Option<GetAccountConfigV1Error> = serde_json::from_str(&content).ok();
3074 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3075 }
3076}
3077
3078pub async fn get_account_v2(configuration: &configuration::Configuration, params: GetAccountV2Params) -> Result<models::GetAccountV2Resp, Error<GetAccountV2Error>> {
3080
3081 let uri_str = format!("{}/fapi/v2/account", configuration.base_path);
3082 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3083
3084 let mut query_params: Vec<(String, String)> = Vec::new();
3086
3087 if let Some(ref param_value) = params.recv_window {
3088 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3089 }
3090 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3091
3092 let mut header_params = std::collections::HashMap::new();
3094
3095 if let Some(ref binance_auth) = configuration.binance_auth {
3097 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3099
3100 let body_string: Option<Vec<u8>> = None;
3102
3103 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3105 Ok(sig) => sig,
3106 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3107 };
3108
3109 query_params.push(("signature".to_string(), signature));
3111 }
3112
3113 if !query_params.is_empty() {
3115 req_builder = req_builder.query(&query_params);
3116 }
3117
3118
3119 if let Some(ref user_agent) = configuration.user_agent {
3121 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3122 }
3123
3124 for (header_name, header_value) in header_params {
3126 req_builder = req_builder.header(&header_name, &header_value);
3127 }
3128
3129
3130 let req = req_builder.build()?;
3131 let resp = configuration.client.execute(req).await?;
3132
3133 let status = resp.status();
3134 let content_type = resp
3135 .headers()
3136 .get("content-type")
3137 .and_then(|v| v.to_str().ok())
3138 .unwrap_or("application/octet-stream");
3139 let content_type = super::ContentType::from(content_type);
3140
3141 if !status.is_client_error() && !status.is_server_error() {
3142 let content = resp.text().await?;
3143 match content_type {
3144 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3145 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAccountV2Resp`"))),
3146 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::GetAccountV2Resp`")))),
3147 }
3148 } else {
3149 let content = resp.text().await?;
3150 let entity: Option<GetAccountV2Error> = serde_json::from_str(&content).ok();
3151 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3152 }
3153}
3154
3155pub async fn get_account_v3(configuration: &configuration::Configuration, params: GetAccountV3Params) -> Result<models::GetAccountV3Resp, Error<GetAccountV3Error>> {
3157
3158 let uri_str = format!("{}/fapi/v3/account", configuration.base_path);
3159 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3160
3161 let mut query_params: Vec<(String, String)> = Vec::new();
3163
3164 if let Some(ref param_value) = params.recv_window {
3165 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3166 }
3167 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3168
3169 let mut header_params = std::collections::HashMap::new();
3171
3172 if let Some(ref binance_auth) = configuration.binance_auth {
3174 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3176
3177 let body_string: Option<Vec<u8>> = None;
3179
3180 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3182 Ok(sig) => sig,
3183 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3184 };
3185
3186 query_params.push(("signature".to_string(), signature));
3188 }
3189
3190 if !query_params.is_empty() {
3192 req_builder = req_builder.query(&query_params);
3193 }
3194
3195
3196 if let Some(ref user_agent) = configuration.user_agent {
3198 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3199 }
3200
3201 for (header_name, header_value) in header_params {
3203 req_builder = req_builder.header(&header_name, &header_value);
3204 }
3205
3206
3207 let req = req_builder.build()?;
3208 let resp = configuration.client.execute(req).await?;
3209
3210 let status = resp.status();
3211 let content_type = resp
3212 .headers()
3213 .get("content-type")
3214 .and_then(|v| v.to_str().ok())
3215 .unwrap_or("application/octet-stream");
3216 let content_type = super::ContentType::from(content_type);
3217
3218 if !status.is_client_error() && !status.is_server_error() {
3219 let content = resp.text().await?;
3220 match content_type {
3221 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3222 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAccountV3Resp`"))),
3223 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::GetAccountV3Resp`")))),
3224 }
3225 } else {
3226 let content = resp.text().await?;
3227 let entity: Option<GetAccountV3Error> = serde_json::from_str(&content).ok();
3228 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3229 }
3230}
3231
3232pub async fn get_adl_quantile_v1(configuration: &configuration::Configuration, params: GetAdlQuantileV1Params) -> Result<Vec<models::GetAdlQuantileV1RespItem>, Error<GetAdlQuantileV1Error>> {
3234
3235 let uri_str = format!("{}/fapi/v1/adlQuantile", configuration.base_path);
3236 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3237
3238 let mut query_params: Vec<(String, String)> = Vec::new();
3240
3241 if let Some(ref param_value) = params.symbol {
3242 query_params.push(("symbol".to_string(), param_value.to_string()));
3243 }
3244 if let Some(ref param_value) = params.recv_window {
3245 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3246 }
3247 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3248
3249 let mut header_params = std::collections::HashMap::new();
3251
3252 if let Some(ref binance_auth) = configuration.binance_auth {
3254 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3256
3257 let body_string: Option<Vec<u8>> = None;
3259
3260 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3262 Ok(sig) => sig,
3263 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3264 };
3265
3266 query_params.push(("signature".to_string(), signature));
3268 }
3269
3270 if !query_params.is_empty() {
3272 req_builder = req_builder.query(&query_params);
3273 }
3274
3275
3276 if let Some(ref user_agent) = configuration.user_agent {
3278 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3279 }
3280
3281 for (header_name, header_value) in header_params {
3283 req_builder = req_builder.header(&header_name, &header_value);
3284 }
3285
3286
3287 let req = req_builder.build()?;
3288 let resp = configuration.client.execute(req).await?;
3289
3290 let status = resp.status();
3291 let content_type = resp
3292 .headers()
3293 .get("content-type")
3294 .and_then(|v| v.to_str().ok())
3295 .unwrap_or("application/octet-stream");
3296 let content_type = super::ContentType::from(content_type);
3297
3298 if !status.is_client_error() && !status.is_server_error() {
3299 let content = resp.text().await?;
3300 match content_type {
3301 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3302 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetAdlQuantileV1RespItem>`"))),
3303 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::GetAdlQuantileV1RespItem>`")))),
3304 }
3305 } else {
3306 let content = resp.text().await?;
3307 let entity: Option<GetAdlQuantileV1Error> = serde_json::from_str(&content).ok();
3308 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3309 }
3310}
3311
3312pub async fn get_agg_trades_v1(configuration: &configuration::Configuration, params: GetAggTradesV1Params) -> Result<Vec<models::UmfuturesGetAggTradesV1RespItem>, Error<GetAggTradesV1Error>> {
3314
3315 let uri_str = format!("{}/fapi/v1/aggTrades", configuration.base_path);
3316 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3317
3318 let mut query_params: Vec<(String, String)> = Vec::new();
3320
3321 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3322 if let Some(ref param_value) = params.from_id {
3323 query_params.push(("fromId".to_string(), param_value.to_string()));
3324 }
3325 if let Some(ref param_value) = params.start_time {
3326 query_params.push(("startTime".to_string(), param_value.to_string()));
3327 }
3328 if let Some(ref param_value) = params.end_time {
3329 query_params.push(("endTime".to_string(), param_value.to_string()));
3330 }
3331 if let Some(ref param_value) = params.limit {
3332 query_params.push(("limit".to_string(), param_value.to_string()));
3333 }
3334
3335 let mut header_params = std::collections::HashMap::new();
3337
3338 if let Some(ref binance_auth) = configuration.binance_auth {
3340 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3342
3343 let body_string: Option<Vec<u8>> = None;
3345
3346 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3348 Ok(sig) => sig,
3349 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3350 };
3351
3352 query_params.push(("signature".to_string(), signature));
3354 }
3355
3356 if !query_params.is_empty() {
3358 req_builder = req_builder.query(&query_params);
3359 }
3360
3361
3362 if let Some(ref user_agent) = configuration.user_agent {
3364 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3365 }
3366
3367 for (header_name, header_value) in header_params {
3369 req_builder = req_builder.header(&header_name, &header_value);
3370 }
3371
3372
3373 let req = req_builder.build()?;
3374 let resp = configuration.client.execute(req).await?;
3375
3376 let status = resp.status();
3377 let content_type = resp
3378 .headers()
3379 .get("content-type")
3380 .and_then(|v| v.to_str().ok())
3381 .unwrap_or("application/octet-stream");
3382 let content_type = super::ContentType::from(content_type);
3383
3384 if !status.is_client_error() && !status.is_server_error() {
3385 let content = resp.text().await?;
3386 match content_type {
3387 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3388 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UmfuturesGetAggTradesV1RespItem>`"))),
3389 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::UmfuturesGetAggTradesV1RespItem>`")))),
3390 }
3391 } else {
3392 let content = resp.text().await?;
3393 let entity: Option<GetAggTradesV1Error> = serde_json::from_str(&content).ok();
3394 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3395 }
3396}
3397
3398pub async fn get_all_orders_v1(configuration: &configuration::Configuration, params: GetAllOrdersV1Params) -> Result<Vec<models::GetAllOrdersV1RespItem>, Error<GetAllOrdersV1Error>> {
3400
3401 let uri_str = format!("{}/fapi/v1/allOrders", configuration.base_path);
3402 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3403
3404 let mut query_params: Vec<(String, String)> = Vec::new();
3406
3407 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3408 if let Some(ref param_value) = params.order_id {
3409 query_params.push(("orderId".to_string(), param_value.to_string()));
3410 }
3411 if let Some(ref param_value) = params.start_time {
3412 query_params.push(("startTime".to_string(), param_value.to_string()));
3413 }
3414 if let Some(ref param_value) = params.end_time {
3415 query_params.push(("endTime".to_string(), param_value.to_string()));
3416 }
3417 if let Some(ref param_value) = params.limit {
3418 query_params.push(("limit".to_string(), param_value.to_string()));
3419 }
3420 if let Some(ref param_value) = params.recv_window {
3421 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3422 }
3423 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3424
3425 let mut header_params = std::collections::HashMap::new();
3427
3428 if let Some(ref binance_auth) = configuration.binance_auth {
3430 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3432
3433 let body_string: Option<Vec<u8>> = None;
3435
3436 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3438 Ok(sig) => sig,
3439 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3440 };
3441
3442 query_params.push(("signature".to_string(), signature));
3444 }
3445
3446 if !query_params.is_empty() {
3448 req_builder = req_builder.query(&query_params);
3449 }
3450
3451
3452 if let Some(ref user_agent) = configuration.user_agent {
3454 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3455 }
3456
3457 for (header_name, header_value) in header_params {
3459 req_builder = req_builder.header(&header_name, &header_value);
3460 }
3461
3462
3463 let req = req_builder.build()?;
3464 let resp = configuration.client.execute(req).await?;
3465
3466 let status = resp.status();
3467 let content_type = resp
3468 .headers()
3469 .get("content-type")
3470 .and_then(|v| v.to_str().ok())
3471 .unwrap_or("application/octet-stream");
3472 let content_type = super::ContentType::from(content_type);
3473
3474 if !status.is_client_error() && !status.is_server_error() {
3475 let content = resp.text().await?;
3476 match content_type {
3477 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3478 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetAllOrdersV1RespItem>`"))),
3479 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::GetAllOrdersV1RespItem>`")))),
3480 }
3481 } else {
3482 let content = resp.text().await?;
3483 let entity: Option<GetAllOrdersV1Error> = serde_json::from_str(&content).ok();
3484 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3485 }
3486}
3487
3488pub async fn get_api_trading_status_v1(configuration: &configuration::Configuration, params: GetApiTradingStatusV1Params) -> Result<models::UmfuturesGetApiTradingStatusV1Resp, Error<GetApiTradingStatusV1Error>> {
3490
3491 let uri_str = format!("{}/fapi/v1/apiTradingStatus", configuration.base_path);
3492 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3493
3494 let mut query_params: Vec<(String, String)> = Vec::new();
3496
3497 if let Some(ref param_value) = params.symbol {
3498 query_params.push(("symbol".to_string(), param_value.to_string()));
3499 }
3500 if let Some(ref param_value) = params.recv_window {
3501 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3502 }
3503 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3504
3505 let mut header_params = std::collections::HashMap::new();
3507
3508 if let Some(ref binance_auth) = configuration.binance_auth {
3510 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3512
3513 let body_string: Option<Vec<u8>> = None;
3515
3516 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3518 Ok(sig) => sig,
3519 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3520 };
3521
3522 query_params.push(("signature".to_string(), signature));
3524 }
3525
3526 if !query_params.is_empty() {
3528 req_builder = req_builder.query(&query_params);
3529 }
3530
3531
3532 if let Some(ref user_agent) = configuration.user_agent {
3534 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3535 }
3536
3537 for (header_name, header_value) in header_params {
3539 req_builder = req_builder.header(&header_name, &header_value);
3540 }
3541
3542
3543 let req = req_builder.build()?;
3544 let resp = configuration.client.execute(req).await?;
3545
3546 let status = resp.status();
3547 let content_type = resp
3548 .headers()
3549 .get("content-type")
3550 .and_then(|v| v.to_str().ok())
3551 .unwrap_or("application/octet-stream");
3552 let content_type = super::ContentType::from(content_type);
3553
3554 if !status.is_client_error() && !status.is_server_error() {
3555 let content = resp.text().await?;
3556 match content_type {
3557 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3558 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetApiTradingStatusV1Resp`"))),
3559 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::UmfuturesGetApiTradingStatusV1Resp`")))),
3560 }
3561 } else {
3562 let content = resp.text().await?;
3563 let entity: Option<GetApiTradingStatusV1Error> = serde_json::from_str(&content).ok();
3564 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3565 }
3566}
3567
3568pub async fn get_asset_index_v1(configuration: &configuration::Configuration, params: GetAssetIndexV1Params) -> Result<models::UmfuturesGetAssetIndexV1Resp, Error<GetAssetIndexV1Error>> {
3570
3571 let uri_str = format!("{}/fapi/v1/assetIndex", configuration.base_path);
3572 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3573
3574 let mut query_params: Vec<(String, String)> = Vec::new();
3576
3577 if let Some(ref param_value) = params.symbol {
3578 query_params.push(("symbol".to_string(), param_value.to_string()));
3579 }
3580
3581 let mut header_params = std::collections::HashMap::new();
3583
3584 if let Some(ref binance_auth) = configuration.binance_auth {
3586 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3588
3589 let body_string: Option<Vec<u8>> = None;
3591
3592 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3594 Ok(sig) => sig,
3595 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3596 };
3597
3598 query_params.push(("signature".to_string(), signature));
3600 }
3601
3602 if !query_params.is_empty() {
3604 req_builder = req_builder.query(&query_params);
3605 }
3606
3607
3608 if let Some(ref user_agent) = configuration.user_agent {
3610 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3611 }
3612
3613 for (header_name, header_value) in header_params {
3615 req_builder = req_builder.header(&header_name, &header_value);
3616 }
3617
3618
3619 let req = req_builder.build()?;
3620 let resp = configuration.client.execute(req).await?;
3621
3622 let status = resp.status();
3623 let content_type = resp
3624 .headers()
3625 .get("content-type")
3626 .and_then(|v| v.to_str().ok())
3627 .unwrap_or("application/octet-stream");
3628 let content_type = super::ContentType::from(content_type);
3629
3630 if !status.is_client_error() && !status.is_server_error() {
3631 let content = resp.text().await?;
3632 match content_type {
3633 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3634 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetAssetIndexV1Resp`"))),
3635 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::UmfuturesGetAssetIndexV1Resp`")))),
3636 }
3637 } else {
3638 let content = resp.text().await?;
3639 let entity: Option<GetAssetIndexV1Error> = serde_json::from_str(&content).ok();
3640 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3641 }
3642}
3643
3644pub async fn get_balance_v2(configuration: &configuration::Configuration, params: GetBalanceV2Params) -> Result<Vec<models::GetBalanceV2RespItem>, Error<GetBalanceV2Error>> {
3646
3647 let uri_str = format!("{}/fapi/v2/balance", configuration.base_path);
3648 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3649
3650 let mut query_params: Vec<(String, String)> = Vec::new();
3652
3653 if let Some(ref param_value) = params.recv_window {
3654 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3655 }
3656 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3657
3658 let mut header_params = std::collections::HashMap::new();
3660
3661 if let Some(ref binance_auth) = configuration.binance_auth {
3663 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3665
3666 let body_string: Option<Vec<u8>> = None;
3668
3669 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3671 Ok(sig) => sig,
3672 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3673 };
3674
3675 query_params.push(("signature".to_string(), signature));
3677 }
3678
3679 if !query_params.is_empty() {
3681 req_builder = req_builder.query(&query_params);
3682 }
3683
3684
3685 if let Some(ref user_agent) = configuration.user_agent {
3687 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3688 }
3689
3690 for (header_name, header_value) in header_params {
3692 req_builder = req_builder.header(&header_name, &header_value);
3693 }
3694
3695
3696 let req = req_builder.build()?;
3697 let resp = configuration.client.execute(req).await?;
3698
3699 let status = resp.status();
3700 let content_type = resp
3701 .headers()
3702 .get("content-type")
3703 .and_then(|v| v.to_str().ok())
3704 .unwrap_or("application/octet-stream");
3705 let content_type = super::ContentType::from(content_type);
3706
3707 if !status.is_client_error() && !status.is_server_error() {
3708 let content = resp.text().await?;
3709 match content_type {
3710 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3711 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBalanceV2RespItem>`"))),
3712 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::GetBalanceV2RespItem>`")))),
3713 }
3714 } else {
3715 let content = resp.text().await?;
3716 let entity: Option<GetBalanceV2Error> = serde_json::from_str(&content).ok();
3717 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3718 }
3719}
3720
3721pub async fn get_balance_v3(configuration: &configuration::Configuration, params: GetBalanceV3Params) -> Result<Vec<models::GetBalanceV3RespItem>, Error<GetBalanceV3Error>> {
3723
3724 let uri_str = format!("{}/fapi/v3/balance", configuration.base_path);
3725 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3726
3727 let mut query_params: Vec<(String, String)> = Vec::new();
3729
3730 if let Some(ref param_value) = params.recv_window {
3731 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3732 }
3733 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3734
3735 let mut header_params = std::collections::HashMap::new();
3737
3738 if let Some(ref binance_auth) = configuration.binance_auth {
3740 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3742
3743 let body_string: Option<Vec<u8>> = None;
3745
3746 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3748 Ok(sig) => sig,
3749 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3750 };
3751
3752 query_params.push(("signature".to_string(), signature));
3754 }
3755
3756 if !query_params.is_empty() {
3758 req_builder = req_builder.query(&query_params);
3759 }
3760
3761
3762 if let Some(ref user_agent) = configuration.user_agent {
3764 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3765 }
3766
3767 for (header_name, header_value) in header_params {
3769 req_builder = req_builder.header(&header_name, &header_value);
3770 }
3771
3772
3773 let req = req_builder.build()?;
3774 let resp = configuration.client.execute(req).await?;
3775
3776 let status = resp.status();
3777 let content_type = resp
3778 .headers()
3779 .get("content-type")
3780 .and_then(|v| v.to_str().ok())
3781 .unwrap_or("application/octet-stream");
3782 let content_type = super::ContentType::from(content_type);
3783
3784 if !status.is_client_error() && !status.is_server_error() {
3785 let content = resp.text().await?;
3786 match content_type {
3787 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3788 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBalanceV3RespItem>`"))),
3789 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::GetBalanceV3RespItem>`")))),
3790 }
3791 } else {
3792 let content = resp.text().await?;
3793 let entity: Option<GetBalanceV3Error> = serde_json::from_str(&content).ok();
3794 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3795 }
3796}
3797
3798pub async fn get_commission_rate_v1(configuration: &configuration::Configuration, params: GetCommissionRateV1Params) -> Result<models::GetCommissionRateV1Resp, Error<GetCommissionRateV1Error>> {
3800
3801 let uri_str = format!("{}/fapi/v1/commissionRate", configuration.base_path);
3802 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3803
3804 let mut query_params: Vec<(String, String)> = Vec::new();
3806
3807 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3808 if let Some(ref param_value) = params.recv_window {
3809 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3810 }
3811 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3812
3813 let mut header_params = std::collections::HashMap::new();
3815
3816 if let Some(ref binance_auth) = configuration.binance_auth {
3818 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3820
3821 let body_string: Option<Vec<u8>> = None;
3823
3824 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3826 Ok(sig) => sig,
3827 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3828 };
3829
3830 query_params.push(("signature".to_string(), signature));
3832 }
3833
3834 if !query_params.is_empty() {
3836 req_builder = req_builder.query(&query_params);
3837 }
3838
3839
3840 if let Some(ref user_agent) = configuration.user_agent {
3842 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3843 }
3844
3845 for (header_name, header_value) in header_params {
3847 req_builder = req_builder.header(&header_name, &header_value);
3848 }
3849
3850
3851 let req = req_builder.build()?;
3852 let resp = configuration.client.execute(req).await?;
3853
3854 let status = resp.status();
3855 let content_type = resp
3856 .headers()
3857 .get("content-type")
3858 .and_then(|v| v.to_str().ok())
3859 .unwrap_or("application/octet-stream");
3860 let content_type = super::ContentType::from(content_type);
3861
3862 if !status.is_client_error() && !status.is_server_error() {
3863 let content = resp.text().await?;
3864 match content_type {
3865 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3866 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCommissionRateV1Resp`"))),
3867 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::GetCommissionRateV1Resp`")))),
3868 }
3869 } else {
3870 let content = resp.text().await?;
3871 let entity: Option<GetCommissionRateV1Error> = serde_json::from_str(&content).ok();
3872 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3873 }
3874}
3875
3876pub async fn get_constituents_v1(configuration: &configuration::Configuration, params: GetConstituentsV1Params) -> Result<models::GetConstituentsV1Resp, Error<GetConstituentsV1Error>> {
3878
3879 let uri_str = format!("{}/fapi/v1/constituents", configuration.base_path);
3880 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3881
3882 let mut query_params: Vec<(String, String)> = Vec::new();
3884
3885 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3886
3887 let mut header_params = std::collections::HashMap::new();
3889
3890 if let Some(ref binance_auth) = configuration.binance_auth {
3892 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3894
3895 let body_string: Option<Vec<u8>> = None;
3897
3898 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3900 Ok(sig) => sig,
3901 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3902 };
3903
3904 query_params.push(("signature".to_string(), signature));
3906 }
3907
3908 if !query_params.is_empty() {
3910 req_builder = req_builder.query(&query_params);
3911 }
3912
3913
3914 if let Some(ref user_agent) = configuration.user_agent {
3916 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3917 }
3918
3919 for (header_name, header_value) in header_params {
3921 req_builder = req_builder.header(&header_name, &header_value);
3922 }
3923
3924
3925 let req = req_builder.build()?;
3926 let resp = configuration.client.execute(req).await?;
3927
3928 let status = resp.status();
3929 let content_type = resp
3930 .headers()
3931 .get("content-type")
3932 .and_then(|v| v.to_str().ok())
3933 .unwrap_or("application/octet-stream");
3934 let content_type = super::ContentType::from(content_type);
3935
3936 if !status.is_client_error() && !status.is_server_error() {
3937 let content = resp.text().await?;
3938 match content_type {
3939 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3940 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetConstituentsV1Resp`"))),
3941 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::GetConstituentsV1Resp`")))),
3942 }
3943 } else {
3944 let content = resp.text().await?;
3945 let entity: Option<GetConstituentsV1Error> = serde_json::from_str(&content).ok();
3946 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3947 }
3948}
3949
3950pub async fn get_continuous_klines_v1(configuration: &configuration::Configuration, params: GetContinuousKlinesV1Params) -> Result<Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>, Error<GetContinuousKlinesV1Error>> {
3952
3953 let uri_str = format!("{}/fapi/v1/continuousKlines", configuration.base_path);
3954 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3955
3956 let mut query_params: Vec<(String, String)> = Vec::new();
3958
3959 query_params.push(("pair".to_string(), params.pair.to_string()));
3960 query_params.push(("contractType".to_string(), params.contract_type.to_string()));
3961 query_params.push(("interval".to_string(), params.interval.to_string()));
3962 if let Some(ref param_value) = params.start_time {
3963 query_params.push(("startTime".to_string(), param_value.to_string()));
3964 }
3965 if let Some(ref param_value) = params.end_time {
3966 query_params.push(("endTime".to_string(), param_value.to_string()));
3967 }
3968 if let Some(ref param_value) = params.limit {
3969 query_params.push(("limit".to_string(), param_value.to_string()));
3970 }
3971
3972 let mut header_params = std::collections::HashMap::new();
3974
3975 if let Some(ref binance_auth) = configuration.binance_auth {
3977 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3979
3980 let body_string: Option<Vec<u8>> = None;
3982
3983 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3985 Ok(sig) => sig,
3986 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3987 };
3988
3989 query_params.push(("signature".to_string(), signature));
3991 }
3992
3993 if !query_params.is_empty() {
3995 req_builder = req_builder.query(&query_params);
3996 }
3997
3998
3999 if let Some(ref user_agent) = configuration.user_agent {
4001 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4002 }
4003
4004 for (header_name, header_value) in header_params {
4006 req_builder = req_builder.header(&header_name, &header_value);
4007 }
4008
4009
4010 let req = req_builder.build()?;
4011 let resp = configuration.client.execute(req).await?;
4012
4013 let status = resp.status();
4014 let content_type = resp
4015 .headers()
4016 .get("content-type")
4017 .and_then(|v| v.to_str().ok())
4018 .unwrap_or("application/octet-stream");
4019 let content_type = super::ContentType::from(content_type);
4020
4021 if !status.is_client_error() && !status.is_server_error() {
4022 let content = resp.text().await?;
4023 match content_type {
4024 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4025 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`"))),
4026 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<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`")))),
4027 }
4028 } else {
4029 let content = resp.text().await?;
4030 let entity: Option<GetContinuousKlinesV1Error> = serde_json::from_str(&content).ok();
4031 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4032 }
4033}
4034
4035pub async fn get_convert_exchange_info_v1(configuration: &configuration::Configuration, params: GetConvertExchangeInfoV1Params) -> Result<Vec<models::GetConvertExchangeInfoV1RespItem>, Error<GetConvertExchangeInfoV1Error>> {
4037
4038 let uri_str = format!("{}/fapi/v1/convert/exchangeInfo", configuration.base_path);
4039 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4040
4041 let mut query_params: Vec<(String, String)> = Vec::new();
4043
4044 if let Some(ref param_value) = params.from_asset {
4045 query_params.push(("fromAsset".to_string(), param_value.to_string()));
4046 }
4047 if let Some(ref param_value) = params.to_asset {
4048 query_params.push(("toAsset".to_string(), param_value.to_string()));
4049 }
4050
4051 let mut header_params = std::collections::HashMap::new();
4053
4054 if let Some(ref binance_auth) = configuration.binance_auth {
4056 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4058
4059 let body_string: Option<Vec<u8>> = None;
4061
4062 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4064 Ok(sig) => sig,
4065 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4066 };
4067
4068 query_params.push(("signature".to_string(), signature));
4070 }
4071
4072 if !query_params.is_empty() {
4074 req_builder = req_builder.query(&query_params);
4075 }
4076
4077
4078 if let Some(ref user_agent) = configuration.user_agent {
4080 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4081 }
4082
4083 for (header_name, header_value) in header_params {
4085 req_builder = req_builder.header(&header_name, &header_value);
4086 }
4087
4088
4089 let req = req_builder.build()?;
4090 let resp = configuration.client.execute(req).await?;
4091
4092 let status = resp.status();
4093 let content_type = resp
4094 .headers()
4095 .get("content-type")
4096 .and_then(|v| v.to_str().ok())
4097 .unwrap_or("application/octet-stream");
4098 let content_type = super::ContentType::from(content_type);
4099
4100 if !status.is_client_error() && !status.is_server_error() {
4101 let content = resp.text().await?;
4102 match content_type {
4103 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4104 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetConvertExchangeInfoV1RespItem>`"))),
4105 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::GetConvertExchangeInfoV1RespItem>`")))),
4106 }
4107 } else {
4108 let content = resp.text().await?;
4109 let entity: Option<GetConvertExchangeInfoV1Error> = serde_json::from_str(&content).ok();
4110 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4111 }
4112}
4113
4114pub async fn get_convert_order_status_v1(configuration: &configuration::Configuration, params: GetConvertOrderStatusV1Params) -> Result<models::GetConvertOrderStatusV1Resp, Error<GetConvertOrderStatusV1Error>> {
4116
4117 let uri_str = format!("{}/fapi/v1/convert/orderStatus", configuration.base_path);
4118 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4119
4120 let mut query_params: Vec<(String, String)> = Vec::new();
4122
4123 if let Some(ref param_value) = params.order_id {
4124 query_params.push(("orderId".to_string(), param_value.to_string()));
4125 }
4126 if let Some(ref param_value) = params.quote_id {
4127 query_params.push(("quoteId".to_string(), param_value.to_string()));
4128 }
4129
4130 let mut header_params = std::collections::HashMap::new();
4132
4133 if let Some(ref binance_auth) = configuration.binance_auth {
4135 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4137
4138 let body_string: Option<Vec<u8>> = None;
4140
4141 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4143 Ok(sig) => sig,
4144 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4145 };
4146
4147 query_params.push(("signature".to_string(), signature));
4149 }
4150
4151 if !query_params.is_empty() {
4153 req_builder = req_builder.query(&query_params);
4154 }
4155
4156
4157 if let Some(ref user_agent) = configuration.user_agent {
4159 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4160 }
4161
4162 for (header_name, header_value) in header_params {
4164 req_builder = req_builder.header(&header_name, &header_value);
4165 }
4166
4167
4168 let req = req_builder.build()?;
4169 let resp = configuration.client.execute(req).await?;
4170
4171 let status = resp.status();
4172 let content_type = resp
4173 .headers()
4174 .get("content-type")
4175 .and_then(|v| v.to_str().ok())
4176 .unwrap_or("application/octet-stream");
4177 let content_type = super::ContentType::from(content_type);
4178
4179 if !status.is_client_error() && !status.is_server_error() {
4180 let content = resp.text().await?;
4181 match content_type {
4182 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4183 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetConvertOrderStatusV1Resp`"))),
4184 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::GetConvertOrderStatusV1Resp`")))),
4185 }
4186 } else {
4187 let content = resp.text().await?;
4188 let entity: Option<GetConvertOrderStatusV1Error> = serde_json::from_str(&content).ok();
4189 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4190 }
4191}
4192
4193pub async fn get_depth_v1(configuration: &configuration::Configuration, params: GetDepthV1Params) -> Result<models::GetDepthV1Resp, Error<GetDepthV1Error>> {
4195
4196 let uri_str = format!("{}/fapi/v1/depth", configuration.base_path);
4197 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4198
4199 let mut query_params: Vec<(String, String)> = Vec::new();
4201
4202 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4203 if let Some(ref param_value) = params.limit {
4204 query_params.push(("limit".to_string(), param_value.to_string()));
4205 }
4206
4207 let mut header_params = std::collections::HashMap::new();
4209
4210 if let Some(ref binance_auth) = configuration.binance_auth {
4212 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4214
4215 let body_string: Option<Vec<u8>> = None;
4217
4218 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4220 Ok(sig) => sig,
4221 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4222 };
4223
4224 query_params.push(("signature".to_string(), signature));
4226 }
4227
4228 if !query_params.is_empty() {
4230 req_builder = req_builder.query(&query_params);
4231 }
4232
4233
4234 if let Some(ref user_agent) = configuration.user_agent {
4236 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4237 }
4238
4239 for (header_name, header_value) in header_params {
4241 req_builder = req_builder.header(&header_name, &header_value);
4242 }
4243
4244
4245 let req = req_builder.build()?;
4246 let resp = configuration.client.execute(req).await?;
4247
4248 let status = resp.status();
4249 let content_type = resp
4250 .headers()
4251 .get("content-type")
4252 .and_then(|v| v.to_str().ok())
4253 .unwrap_or("application/octet-stream");
4254 let content_type = super::ContentType::from(content_type);
4255
4256 if !status.is_client_error() && !status.is_server_error() {
4257 let content = resp.text().await?;
4258 match content_type {
4259 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4260 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetDepthV1Resp`"))),
4261 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::GetDepthV1Resp`")))),
4262 }
4263 } else {
4264 let content = resp.text().await?;
4265 let entity: Option<GetDepthV1Error> = serde_json::from_str(&content).ok();
4266 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4267 }
4268}
4269
4270pub async fn get_exchange_info_v1(configuration: &configuration::Configuration) -> Result<models::UmfuturesGetExchangeInfoV1Resp, Error<GetExchangeInfoV1Error>> {
4272
4273 let uri_str = format!("{}/fapi/v1/exchangeInfo", configuration.base_path);
4274 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4275
4276 let mut query_params: Vec<(String, String)> = Vec::new();
4278
4279
4280 let mut header_params = std::collections::HashMap::new();
4282
4283 if let Some(ref binance_auth) = configuration.binance_auth {
4285 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4287
4288 let body_string: Option<Vec<u8>> = None;
4290
4291 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4293 Ok(sig) => sig,
4294 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4295 };
4296
4297 query_params.push(("signature".to_string(), signature));
4299 }
4300
4301 if !query_params.is_empty() {
4303 req_builder = req_builder.query(&query_params);
4304 }
4305
4306
4307 if let Some(ref user_agent) = configuration.user_agent {
4309 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4310 }
4311
4312 for (header_name, header_value) in header_params {
4314 req_builder = req_builder.header(&header_name, &header_value);
4315 }
4316
4317
4318 let req = req_builder.build()?;
4319 let resp = configuration.client.execute(req).await?;
4320
4321 let status = resp.status();
4322 let content_type = resp
4323 .headers()
4324 .get("content-type")
4325 .and_then(|v| v.to_str().ok())
4326 .unwrap_or("application/octet-stream");
4327 let content_type = super::ContentType::from(content_type);
4328
4329 if !status.is_client_error() && !status.is_server_error() {
4330 let content = resp.text().await?;
4331 match content_type {
4332 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4333 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetExchangeInfoV1Resp`"))),
4334 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::UmfuturesGetExchangeInfoV1Resp`")))),
4335 }
4336 } else {
4337 let content = resp.text().await?;
4338 let entity: Option<GetExchangeInfoV1Error> = serde_json::from_str(&content).ok();
4339 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4340 }
4341}
4342
4343pub async fn get_fee_burn_v1(configuration: &configuration::Configuration, params: GetFeeBurnV1Params) -> Result<models::GetFeeBurnV1Resp, Error<GetFeeBurnV1Error>> {
4345
4346 let uri_str = format!("{}/fapi/v1/feeBurn", configuration.base_path);
4347 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4348
4349 let mut query_params: Vec<(String, String)> = Vec::new();
4351
4352 if let Some(ref param_value) = params.recv_window {
4353 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4354 }
4355 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4356
4357 let mut header_params = std::collections::HashMap::new();
4359
4360 if let Some(ref binance_auth) = configuration.binance_auth {
4362 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4364
4365 let body_string: Option<Vec<u8>> = None;
4367
4368 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4370 Ok(sig) => sig,
4371 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4372 };
4373
4374 query_params.push(("signature".to_string(), signature));
4376 }
4377
4378 if !query_params.is_empty() {
4380 req_builder = req_builder.query(&query_params);
4381 }
4382
4383
4384 if let Some(ref user_agent) = configuration.user_agent {
4386 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4387 }
4388
4389 for (header_name, header_value) in header_params {
4391 req_builder = req_builder.header(&header_name, &header_value);
4392 }
4393
4394
4395 let req = req_builder.build()?;
4396 let resp = configuration.client.execute(req).await?;
4397
4398 let status = resp.status();
4399 let content_type = resp
4400 .headers()
4401 .get("content-type")
4402 .and_then(|v| v.to_str().ok())
4403 .unwrap_or("application/octet-stream");
4404 let content_type = super::ContentType::from(content_type);
4405
4406 if !status.is_client_error() && !status.is_server_error() {
4407 let content = resp.text().await?;
4408 match content_type {
4409 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4410 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetFeeBurnV1Resp`"))),
4411 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::GetFeeBurnV1Resp`")))),
4412 }
4413 } else {
4414 let content = resp.text().await?;
4415 let entity: Option<GetFeeBurnV1Error> = serde_json::from_str(&content).ok();
4416 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4417 }
4418}
4419
4420pub async fn get_force_orders_v1(configuration: &configuration::Configuration, params: GetForceOrdersV1Params) -> Result<Vec<models::GetForceOrdersV1RespItem>, Error<GetForceOrdersV1Error>> {
4422
4423 let uri_str = format!("{}/fapi/v1/forceOrders", configuration.base_path);
4424 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4425
4426 let mut query_params: Vec<(String, String)> = Vec::new();
4428
4429 if let Some(ref param_value) = params.symbol {
4430 query_params.push(("symbol".to_string(), param_value.to_string()));
4431 }
4432 if let Some(ref param_value) = params.auto_close_type {
4433 query_params.push(("autoCloseType".to_string(), param_value.to_string()));
4434 }
4435 if let Some(ref param_value) = params.start_time {
4436 query_params.push(("startTime".to_string(), param_value.to_string()));
4437 }
4438 if let Some(ref param_value) = params.end_time {
4439 query_params.push(("endTime".to_string(), param_value.to_string()));
4440 }
4441 if let Some(ref param_value) = params.limit {
4442 query_params.push(("limit".to_string(), param_value.to_string()));
4443 }
4444 if let Some(ref param_value) = params.recv_window {
4445 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4446 }
4447 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4448
4449 let mut header_params = std::collections::HashMap::new();
4451
4452 if let Some(ref binance_auth) = configuration.binance_auth {
4454 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4456
4457 let body_string: Option<Vec<u8>> = None;
4459
4460 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4462 Ok(sig) => sig,
4463 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4464 };
4465
4466 query_params.push(("signature".to_string(), signature));
4468 }
4469
4470 if !query_params.is_empty() {
4472 req_builder = req_builder.query(&query_params);
4473 }
4474
4475
4476 if let Some(ref user_agent) = configuration.user_agent {
4478 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4479 }
4480
4481 for (header_name, header_value) in header_params {
4483 req_builder = req_builder.header(&header_name, &header_value);
4484 }
4485
4486
4487 let req = req_builder.build()?;
4488 let resp = configuration.client.execute(req).await?;
4489
4490 let status = resp.status();
4491 let content_type = resp
4492 .headers()
4493 .get("content-type")
4494 .and_then(|v| v.to_str().ok())
4495 .unwrap_or("application/octet-stream");
4496 let content_type = super::ContentType::from(content_type);
4497
4498 if !status.is_client_error() && !status.is_server_error() {
4499 let content = resp.text().await?;
4500 match content_type {
4501 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4502 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetForceOrdersV1RespItem>`"))),
4503 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::GetForceOrdersV1RespItem>`")))),
4504 }
4505 } else {
4506 let content = resp.text().await?;
4507 let entity: Option<GetForceOrdersV1Error> = serde_json::from_str(&content).ok();
4508 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4509 }
4510}
4511
4512pub async fn get_funding_info_v1(configuration: &configuration::Configuration) -> Result<Vec<models::GetFundingInfoV1RespItem>, Error<GetFundingInfoV1Error>> {
4514
4515 let uri_str = format!("{}/fapi/v1/fundingInfo", configuration.base_path);
4516 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4517
4518 let mut query_params: Vec<(String, String)> = Vec::new();
4520
4521
4522 let mut header_params = std::collections::HashMap::new();
4524
4525 if let Some(ref binance_auth) = configuration.binance_auth {
4527 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4529
4530 let body_string: Option<Vec<u8>> = None;
4532
4533 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4535 Ok(sig) => sig,
4536 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4537 };
4538
4539 query_params.push(("signature".to_string(), signature));
4541 }
4542
4543 if !query_params.is_empty() {
4545 req_builder = req_builder.query(&query_params);
4546 }
4547
4548
4549 if let Some(ref user_agent) = configuration.user_agent {
4551 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4552 }
4553
4554 for (header_name, header_value) in header_params {
4556 req_builder = req_builder.header(&header_name, &header_value);
4557 }
4558
4559
4560 let req = req_builder.build()?;
4561 let resp = configuration.client.execute(req).await?;
4562
4563 let status = resp.status();
4564 let content_type = resp
4565 .headers()
4566 .get("content-type")
4567 .and_then(|v| v.to_str().ok())
4568 .unwrap_or("application/octet-stream");
4569 let content_type = super::ContentType::from(content_type);
4570
4571 if !status.is_client_error() && !status.is_server_error() {
4572 let content = resp.text().await?;
4573 match content_type {
4574 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4575 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetFundingInfoV1RespItem>`"))),
4576 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::GetFundingInfoV1RespItem>`")))),
4577 }
4578 } else {
4579 let content = resp.text().await?;
4580 let entity: Option<GetFundingInfoV1Error> = serde_json::from_str(&content).ok();
4581 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4582 }
4583}
4584
4585pub async fn get_funding_rate_v1(configuration: &configuration::Configuration, params: GetFundingRateV1Params) -> Result<Vec<models::GetFundingRateV1RespItem>, Error<GetFundingRateV1Error>> {
4587
4588 let uri_str = format!("{}/fapi/v1/fundingRate", configuration.base_path);
4589 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4590
4591 let mut query_params: Vec<(String, String)> = Vec::new();
4593
4594 if let Some(ref param_value) = params.symbol {
4595 query_params.push(("symbol".to_string(), param_value.to_string()));
4596 }
4597 if let Some(ref param_value) = params.start_time {
4598 query_params.push(("startTime".to_string(), param_value.to_string()));
4599 }
4600 if let Some(ref param_value) = params.end_time {
4601 query_params.push(("endTime".to_string(), param_value.to_string()));
4602 }
4603 if let Some(ref param_value) = params.limit {
4604 query_params.push(("limit".to_string(), param_value.to_string()));
4605 }
4606
4607 let mut header_params = std::collections::HashMap::new();
4609
4610 if let Some(ref binance_auth) = configuration.binance_auth {
4612 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4614
4615 let body_string: Option<Vec<u8>> = None;
4617
4618 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4620 Ok(sig) => sig,
4621 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4622 };
4623
4624 query_params.push(("signature".to_string(), signature));
4626 }
4627
4628 if !query_params.is_empty() {
4630 req_builder = req_builder.query(&query_params);
4631 }
4632
4633
4634 if let Some(ref user_agent) = configuration.user_agent {
4636 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4637 }
4638
4639 for (header_name, header_value) in header_params {
4641 req_builder = req_builder.header(&header_name, &header_value);
4642 }
4643
4644
4645 let req = req_builder.build()?;
4646 let resp = configuration.client.execute(req).await?;
4647
4648 let status = resp.status();
4649 let content_type = resp
4650 .headers()
4651 .get("content-type")
4652 .and_then(|v| v.to_str().ok())
4653 .unwrap_or("application/octet-stream");
4654 let content_type = super::ContentType::from(content_type);
4655
4656 if !status.is_client_error() && !status.is_server_error() {
4657 let content = resp.text().await?;
4658 match content_type {
4659 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4660 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetFundingRateV1RespItem>`"))),
4661 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::GetFundingRateV1RespItem>`")))),
4662 }
4663 } else {
4664 let content = resp.text().await?;
4665 let entity: Option<GetFundingRateV1Error> = serde_json::from_str(&content).ok();
4666 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4667 }
4668}
4669
4670pub async fn get_futures_data_basis(configuration: &configuration::Configuration, params: GetFuturesDataBasisParams) -> Result<Vec<models::GetFuturesDataBasisRespItem>, Error<GetFuturesDataBasisError>> {
4672
4673 let uri_str = format!("{}/futures/data/basis", configuration.base_path);
4674 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4675
4676 let mut query_params: Vec<(String, String)> = Vec::new();
4678
4679 query_params.push(("pair".to_string(), params.pair.to_string()));
4680 query_params.push(("contractType".to_string(), params.contract_type.to_string()));
4681 query_params.push(("period".to_string(), params.period.to_string()));
4682 query_params.push(("limit".to_string(), params.limit.to_string()));
4683 if let Some(ref param_value) = params.start_time {
4684 query_params.push(("startTime".to_string(), param_value.to_string()));
4685 }
4686 if let Some(ref param_value) = params.end_time {
4687 query_params.push(("endTime".to_string(), param_value.to_string()));
4688 }
4689
4690 let mut header_params = std::collections::HashMap::new();
4692
4693 if let Some(ref binance_auth) = configuration.binance_auth {
4695 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4697
4698 let body_string: Option<Vec<u8>> = None;
4700
4701 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4703 Ok(sig) => sig,
4704 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4705 };
4706
4707 query_params.push(("signature".to_string(), signature));
4709 }
4710
4711 if !query_params.is_empty() {
4713 req_builder = req_builder.query(&query_params);
4714 }
4715
4716
4717 if let Some(ref user_agent) = configuration.user_agent {
4719 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4720 }
4721
4722 for (header_name, header_value) in header_params {
4724 req_builder = req_builder.header(&header_name, &header_value);
4725 }
4726
4727
4728 let req = req_builder.build()?;
4729 let resp = configuration.client.execute(req).await?;
4730
4731 let status = resp.status();
4732 let content_type = resp
4733 .headers()
4734 .get("content-type")
4735 .and_then(|v| v.to_str().ok())
4736 .unwrap_or("application/octet-stream");
4737 let content_type = super::ContentType::from(content_type);
4738
4739 if !status.is_client_error() && !status.is_server_error() {
4740 let content = resp.text().await?;
4741 match content_type {
4742 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4743 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetFuturesDataBasisRespItem>`"))),
4744 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::GetFuturesDataBasisRespItem>`")))),
4745 }
4746 } else {
4747 let content = resp.text().await?;
4748 let entity: Option<GetFuturesDataBasisError> = serde_json::from_str(&content).ok();
4749 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4750 }
4751}
4752
4753pub async fn get_futures_data_delivery_price(configuration: &configuration::Configuration, params: GetFuturesDataDeliveryPriceParams) -> Result<Vec<models::UmfuturesGetFuturesDataDeliveryPriceRespItem>, Error<GetFuturesDataDeliveryPriceError>> {
4755
4756 let uri_str = format!("{}/futures/data/delivery-price", configuration.base_path);
4757 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4758
4759 let mut query_params: Vec<(String, String)> = Vec::new();
4761
4762 query_params.push(("pair".to_string(), params.pair.to_string()));
4763
4764 let mut header_params = std::collections::HashMap::new();
4766
4767 if let Some(ref binance_auth) = configuration.binance_auth {
4769 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4771
4772 let body_string: Option<Vec<u8>> = None;
4774
4775 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4777 Ok(sig) => sig,
4778 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4779 };
4780
4781 query_params.push(("signature".to_string(), signature));
4783 }
4784
4785 if !query_params.is_empty() {
4787 req_builder = req_builder.query(&query_params);
4788 }
4789
4790
4791 if let Some(ref user_agent) = configuration.user_agent {
4793 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4794 }
4795
4796 for (header_name, header_value) in header_params {
4798 req_builder = req_builder.header(&header_name, &header_value);
4799 }
4800
4801
4802 let req = req_builder.build()?;
4803 let resp = configuration.client.execute(req).await?;
4804
4805 let status = resp.status();
4806 let content_type = resp
4807 .headers()
4808 .get("content-type")
4809 .and_then(|v| v.to_str().ok())
4810 .unwrap_or("application/octet-stream");
4811 let content_type = super::ContentType::from(content_type);
4812
4813 if !status.is_client_error() && !status.is_server_error() {
4814 let content = resp.text().await?;
4815 match content_type {
4816 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4817 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UmfuturesGetFuturesDataDeliveryPriceRespItem>`"))),
4818 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::UmfuturesGetFuturesDataDeliveryPriceRespItem>`")))),
4819 }
4820 } else {
4821 let content = resp.text().await?;
4822 let entity: Option<GetFuturesDataDeliveryPriceError> = serde_json::from_str(&content).ok();
4823 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4824 }
4825}
4826
4827pub async fn get_futures_data_global_long_short_account_ratio(configuration: &configuration::Configuration, params: GetFuturesDataGlobalLongShortAccountRatioParams) -> Result<Vec<models::GetFuturesDataGlobalLongShortAccountRatioRespItem>, Error<GetFuturesDataGlobalLongShortAccountRatioError>> {
4829
4830 let uri_str = format!("{}/futures/data/globalLongShortAccountRatio", configuration.base_path);
4831 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4832
4833 let mut query_params: Vec<(String, String)> = Vec::new();
4835
4836 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4837 query_params.push(("period".to_string(), params.period.to_string()));
4838 if let Some(ref param_value) = params.limit {
4839 query_params.push(("limit".to_string(), param_value.to_string()));
4840 }
4841 if let Some(ref param_value) = params.start_time {
4842 query_params.push(("startTime".to_string(), param_value.to_string()));
4843 }
4844 if let Some(ref param_value) = params.end_time {
4845 query_params.push(("endTime".to_string(), param_value.to_string()));
4846 }
4847
4848 let mut header_params = std::collections::HashMap::new();
4850
4851 if let Some(ref binance_auth) = configuration.binance_auth {
4853 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4855
4856 let body_string: Option<Vec<u8>> = None;
4858
4859 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4861 Ok(sig) => sig,
4862 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4863 };
4864
4865 query_params.push(("signature".to_string(), signature));
4867 }
4868
4869 if !query_params.is_empty() {
4871 req_builder = req_builder.query(&query_params);
4872 }
4873
4874
4875 if let Some(ref user_agent) = configuration.user_agent {
4877 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4878 }
4879
4880 for (header_name, header_value) in header_params {
4882 req_builder = req_builder.header(&header_name, &header_value);
4883 }
4884
4885
4886 let req = req_builder.build()?;
4887 let resp = configuration.client.execute(req).await?;
4888
4889 let status = resp.status();
4890 let content_type = resp
4891 .headers()
4892 .get("content-type")
4893 .and_then(|v| v.to_str().ok())
4894 .unwrap_or("application/octet-stream");
4895 let content_type = super::ContentType::from(content_type);
4896
4897 if !status.is_client_error() && !status.is_server_error() {
4898 let content = resp.text().await?;
4899 match content_type {
4900 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4901 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetFuturesDataGlobalLongShortAccountRatioRespItem>`"))),
4902 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::GetFuturesDataGlobalLongShortAccountRatioRespItem>`")))),
4903 }
4904 } else {
4905 let content = resp.text().await?;
4906 let entity: Option<GetFuturesDataGlobalLongShortAccountRatioError> = serde_json::from_str(&content).ok();
4907 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4908 }
4909}
4910
4911pub async fn get_futures_data_open_interest_hist(configuration: &configuration::Configuration, params: GetFuturesDataOpenInterestHistParams) -> Result<Vec<models::GetFuturesDataOpenInterestHistRespItem>, Error<GetFuturesDataOpenInterestHistError>> {
4913
4914 let uri_str = format!("{}/futures/data/openInterestHist", configuration.base_path);
4915 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4916
4917 let mut query_params: Vec<(String, String)> = Vec::new();
4919
4920 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4921 query_params.push(("period".to_string(), params.period.to_string()));
4922 if let Some(ref param_value) = params.limit {
4923 query_params.push(("limit".to_string(), param_value.to_string()));
4924 }
4925 if let Some(ref param_value) = params.start_time {
4926 query_params.push(("startTime".to_string(), param_value.to_string()));
4927 }
4928 if let Some(ref param_value) = params.end_time {
4929 query_params.push(("endTime".to_string(), param_value.to_string()));
4930 }
4931
4932 let mut header_params = std::collections::HashMap::new();
4934
4935 if let Some(ref binance_auth) = configuration.binance_auth {
4937 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4939
4940 let body_string: Option<Vec<u8>> = None;
4942
4943 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4945 Ok(sig) => sig,
4946 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4947 };
4948
4949 query_params.push(("signature".to_string(), signature));
4951 }
4952
4953 if !query_params.is_empty() {
4955 req_builder = req_builder.query(&query_params);
4956 }
4957
4958
4959 if let Some(ref user_agent) = configuration.user_agent {
4961 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4962 }
4963
4964 for (header_name, header_value) in header_params {
4966 req_builder = req_builder.header(&header_name, &header_value);
4967 }
4968
4969
4970 let req = req_builder.build()?;
4971 let resp = configuration.client.execute(req).await?;
4972
4973 let status = resp.status();
4974 let content_type = resp
4975 .headers()
4976 .get("content-type")
4977 .and_then(|v| v.to_str().ok())
4978 .unwrap_or("application/octet-stream");
4979 let content_type = super::ContentType::from(content_type);
4980
4981 if !status.is_client_error() && !status.is_server_error() {
4982 let content = resp.text().await?;
4983 match content_type {
4984 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4985 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetFuturesDataOpenInterestHistRespItem>`"))),
4986 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::GetFuturesDataOpenInterestHistRespItem>`")))),
4987 }
4988 } else {
4989 let content = resp.text().await?;
4990 let entity: Option<GetFuturesDataOpenInterestHistError> = serde_json::from_str(&content).ok();
4991 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4992 }
4993}
4994
4995pub async fn get_futures_data_takerlongshort_ratio(configuration: &configuration::Configuration, params: GetFuturesDataTakerlongshortRatioParams) -> Result<Vec<models::GetFuturesDataTakerlongshortRatioRespItem>, Error<GetFuturesDataTakerlongshortRatioError>> {
4997
4998 let uri_str = format!("{}/futures/data/takerlongshortRatio", configuration.base_path);
4999 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5000
5001 let mut query_params: Vec<(String, String)> = Vec::new();
5003
5004 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5005 query_params.push(("period".to_string(), params.period.to_string()));
5006 if let Some(ref param_value) = params.limit {
5007 query_params.push(("limit".to_string(), param_value.to_string()));
5008 }
5009 if let Some(ref param_value) = params.start_time {
5010 query_params.push(("startTime".to_string(), param_value.to_string()));
5011 }
5012 if let Some(ref param_value) = params.end_time {
5013 query_params.push(("endTime".to_string(), param_value.to_string()));
5014 }
5015
5016 let mut header_params = std::collections::HashMap::new();
5018
5019 if let Some(ref binance_auth) = configuration.binance_auth {
5021 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5023
5024 let body_string: Option<Vec<u8>> = None;
5026
5027 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5029 Ok(sig) => sig,
5030 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5031 };
5032
5033 query_params.push(("signature".to_string(), signature));
5035 }
5036
5037 if !query_params.is_empty() {
5039 req_builder = req_builder.query(&query_params);
5040 }
5041
5042
5043 if let Some(ref user_agent) = configuration.user_agent {
5045 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5046 }
5047
5048 for (header_name, header_value) in header_params {
5050 req_builder = req_builder.header(&header_name, &header_value);
5051 }
5052
5053
5054 let req = req_builder.build()?;
5055 let resp = configuration.client.execute(req).await?;
5056
5057 let status = resp.status();
5058 let content_type = resp
5059 .headers()
5060 .get("content-type")
5061 .and_then(|v| v.to_str().ok())
5062 .unwrap_or("application/octet-stream");
5063 let content_type = super::ContentType::from(content_type);
5064
5065 if !status.is_client_error() && !status.is_server_error() {
5066 let content = resp.text().await?;
5067 match content_type {
5068 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5069 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetFuturesDataTakerlongshortRatioRespItem>`"))),
5070 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::GetFuturesDataTakerlongshortRatioRespItem>`")))),
5071 }
5072 } else {
5073 let content = resp.text().await?;
5074 let entity: Option<GetFuturesDataTakerlongshortRatioError> = serde_json::from_str(&content).ok();
5075 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5076 }
5077}
5078
5079pub async fn get_futures_data_top_long_short_account_ratio(configuration: &configuration::Configuration, params: GetFuturesDataTopLongShortAccountRatioParams) -> Result<Vec<models::GetFuturesDataTopLongShortAccountRatioRespItem>, Error<GetFuturesDataTopLongShortAccountRatioError>> {
5081
5082 let uri_str = format!("{}/futures/data/topLongShortAccountRatio", configuration.base_path);
5083 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5084
5085 let mut query_params: Vec<(String, String)> = Vec::new();
5087
5088 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5089 query_params.push(("period".to_string(), params.period.to_string()));
5090 if let Some(ref param_value) = params.limit {
5091 query_params.push(("limit".to_string(), param_value.to_string()));
5092 }
5093 if let Some(ref param_value) = params.start_time {
5094 query_params.push(("startTime".to_string(), param_value.to_string()));
5095 }
5096 if let Some(ref param_value) = params.end_time {
5097 query_params.push(("endTime".to_string(), param_value.to_string()));
5098 }
5099
5100 let mut header_params = std::collections::HashMap::new();
5102
5103 if let Some(ref binance_auth) = configuration.binance_auth {
5105 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5107
5108 let body_string: Option<Vec<u8>> = None;
5110
5111 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5113 Ok(sig) => sig,
5114 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5115 };
5116
5117 query_params.push(("signature".to_string(), signature));
5119 }
5120
5121 if !query_params.is_empty() {
5123 req_builder = req_builder.query(&query_params);
5124 }
5125
5126
5127 if let Some(ref user_agent) = configuration.user_agent {
5129 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5130 }
5131
5132 for (header_name, header_value) in header_params {
5134 req_builder = req_builder.header(&header_name, &header_value);
5135 }
5136
5137
5138 let req = req_builder.build()?;
5139 let resp = configuration.client.execute(req).await?;
5140
5141 let status = resp.status();
5142 let content_type = resp
5143 .headers()
5144 .get("content-type")
5145 .and_then(|v| v.to_str().ok())
5146 .unwrap_or("application/octet-stream");
5147 let content_type = super::ContentType::from(content_type);
5148
5149 if !status.is_client_error() && !status.is_server_error() {
5150 let content = resp.text().await?;
5151 match content_type {
5152 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5153 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetFuturesDataTopLongShortAccountRatioRespItem>`"))),
5154 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::GetFuturesDataTopLongShortAccountRatioRespItem>`")))),
5155 }
5156 } else {
5157 let content = resp.text().await?;
5158 let entity: Option<GetFuturesDataTopLongShortAccountRatioError> = serde_json::from_str(&content).ok();
5159 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5160 }
5161}
5162
5163pub async fn get_futures_data_top_long_short_position_ratio(configuration: &configuration::Configuration, params: GetFuturesDataTopLongShortPositionRatioParams) -> Result<Vec<models::GetFuturesDataTopLongShortPositionRatioRespItem>, Error<GetFuturesDataTopLongShortPositionRatioError>> {
5165
5166 let uri_str = format!("{}/futures/data/topLongShortPositionRatio", configuration.base_path);
5167 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5168
5169 let mut query_params: Vec<(String, String)> = Vec::new();
5171
5172 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5173 query_params.push(("period".to_string(), params.period.to_string()));
5174 if let Some(ref param_value) = params.limit {
5175 query_params.push(("limit".to_string(), param_value.to_string()));
5176 }
5177 if let Some(ref param_value) = params.start_time {
5178 query_params.push(("startTime".to_string(), param_value.to_string()));
5179 }
5180 if let Some(ref param_value) = params.end_time {
5181 query_params.push(("endTime".to_string(), param_value.to_string()));
5182 }
5183
5184 let mut header_params = std::collections::HashMap::new();
5186
5187 if let Some(ref binance_auth) = configuration.binance_auth {
5189 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5191
5192 let body_string: Option<Vec<u8>> = None;
5194
5195 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5197 Ok(sig) => sig,
5198 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5199 };
5200
5201 query_params.push(("signature".to_string(), signature));
5203 }
5204
5205 if !query_params.is_empty() {
5207 req_builder = req_builder.query(&query_params);
5208 }
5209
5210
5211 if let Some(ref user_agent) = configuration.user_agent {
5213 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5214 }
5215
5216 for (header_name, header_value) in header_params {
5218 req_builder = req_builder.header(&header_name, &header_value);
5219 }
5220
5221
5222 let req = req_builder.build()?;
5223 let resp = configuration.client.execute(req).await?;
5224
5225 let status = resp.status();
5226 let content_type = resp
5227 .headers()
5228 .get("content-type")
5229 .and_then(|v| v.to_str().ok())
5230 .unwrap_or("application/octet-stream");
5231 let content_type = super::ContentType::from(content_type);
5232
5233 if !status.is_client_error() && !status.is_server_error() {
5234 let content = resp.text().await?;
5235 match content_type {
5236 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5237 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetFuturesDataTopLongShortPositionRatioRespItem>`"))),
5238 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::GetFuturesDataTopLongShortPositionRatioRespItem>`")))),
5239 }
5240 } else {
5241 let content = resp.text().await?;
5242 let entity: Option<GetFuturesDataTopLongShortPositionRatioError> = serde_json::from_str(&content).ok();
5243 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5244 }
5245}
5246
5247pub async fn get_historical_trades_v1(configuration: &configuration::Configuration, params: GetHistoricalTradesV1Params) -> Result<Vec<models::GetHistoricalTradesV1RespItem>, Error<GetHistoricalTradesV1Error>> {
5249
5250 let uri_str = format!("{}/fapi/v1/historicalTrades", configuration.base_path);
5251 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5252
5253 let mut query_params: Vec<(String, String)> = Vec::new();
5255
5256 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5257 if let Some(ref param_value) = params.limit {
5258 query_params.push(("limit".to_string(), param_value.to_string()));
5259 }
5260 if let Some(ref param_value) = params.from_id {
5261 query_params.push(("fromId".to_string(), param_value.to_string()));
5262 }
5263
5264 let mut header_params = std::collections::HashMap::new();
5266
5267 if let Some(ref binance_auth) = configuration.binance_auth {
5269 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5271
5272 let body_string: Option<Vec<u8>> = None;
5274
5275 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5277 Ok(sig) => sig,
5278 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5279 };
5280
5281 query_params.push(("signature".to_string(), signature));
5283 }
5284
5285 if !query_params.is_empty() {
5287 req_builder = req_builder.query(&query_params);
5288 }
5289
5290
5291 if let Some(ref user_agent) = configuration.user_agent {
5293 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5294 }
5295
5296 for (header_name, header_value) in header_params {
5298 req_builder = req_builder.header(&header_name, &header_value);
5299 }
5300
5301
5302 let req = req_builder.build()?;
5303 let resp = configuration.client.execute(req).await?;
5304
5305 let status = resp.status();
5306 let content_type = resp
5307 .headers()
5308 .get("content-type")
5309 .and_then(|v| v.to_str().ok())
5310 .unwrap_or("application/octet-stream");
5311 let content_type = super::ContentType::from(content_type);
5312
5313 if !status.is_client_error() && !status.is_server_error() {
5314 let content = resp.text().await?;
5315 match content_type {
5316 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5317 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetHistoricalTradesV1RespItem>`"))),
5318 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::GetHistoricalTradesV1RespItem>`")))),
5319 }
5320 } else {
5321 let content = resp.text().await?;
5322 let entity: Option<GetHistoricalTradesV1Error> = serde_json::from_str(&content).ok();
5323 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5324 }
5325}
5326
5327pub async fn get_income_asyn_id_v1(configuration: &configuration::Configuration, params: GetIncomeAsynIdV1Params) -> Result<models::GetIncomeAsynIdV1Resp, Error<GetIncomeAsynIdV1Error>> {
5329
5330 let uri_str = format!("{}/fapi/v1/income/asyn/id", configuration.base_path);
5331 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5332
5333 let mut query_params: Vec<(String, String)> = Vec::new();
5335
5336 query_params.push(("downloadId".to_string(), params.download_id.to_string()));
5337 if let Some(ref param_value) = params.recv_window {
5338 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5339 }
5340 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5341
5342 let mut header_params = std::collections::HashMap::new();
5344
5345 if let Some(ref binance_auth) = configuration.binance_auth {
5347 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5349
5350 let body_string: Option<Vec<u8>> = None;
5352
5353 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5355 Ok(sig) => sig,
5356 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5357 };
5358
5359 query_params.push(("signature".to_string(), signature));
5361 }
5362
5363 if !query_params.is_empty() {
5365 req_builder = req_builder.query(&query_params);
5366 }
5367
5368
5369 if let Some(ref user_agent) = configuration.user_agent {
5371 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5372 }
5373
5374 for (header_name, header_value) in header_params {
5376 req_builder = req_builder.header(&header_name, &header_value);
5377 }
5378
5379
5380 let req = req_builder.build()?;
5381 let resp = configuration.client.execute(req).await?;
5382
5383 let status = resp.status();
5384 let content_type = resp
5385 .headers()
5386 .get("content-type")
5387 .and_then(|v| v.to_str().ok())
5388 .unwrap_or("application/octet-stream");
5389 let content_type = super::ContentType::from(content_type);
5390
5391 if !status.is_client_error() && !status.is_server_error() {
5392 let content = resp.text().await?;
5393 match content_type {
5394 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5395 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetIncomeAsynIdV1Resp`"))),
5396 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::GetIncomeAsynIdV1Resp`")))),
5397 }
5398 } else {
5399 let content = resp.text().await?;
5400 let entity: Option<GetIncomeAsynIdV1Error> = serde_json::from_str(&content).ok();
5401 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5402 }
5403}
5404
5405pub async fn get_income_asyn_v1(configuration: &configuration::Configuration, params: GetIncomeAsynV1Params) -> Result<models::GetIncomeAsynV1Resp, Error<GetIncomeAsynV1Error>> {
5407
5408 let uri_str = format!("{}/fapi/v1/income/asyn", configuration.base_path);
5409 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5410
5411 let mut query_params: Vec<(String, String)> = Vec::new();
5413
5414 query_params.push(("startTime".to_string(), params.start_time.to_string()));
5415 query_params.push(("endTime".to_string(), params.end_time.to_string()));
5416 if let Some(ref param_value) = params.recv_window {
5417 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5418 }
5419 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5420
5421 let mut header_params = std::collections::HashMap::new();
5423
5424 if let Some(ref binance_auth) = configuration.binance_auth {
5426 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5428
5429 let body_string: Option<Vec<u8>> = None;
5431
5432 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5434 Ok(sig) => sig,
5435 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5436 };
5437
5438 query_params.push(("signature".to_string(), signature));
5440 }
5441
5442 if !query_params.is_empty() {
5444 req_builder = req_builder.query(&query_params);
5445 }
5446
5447
5448 if let Some(ref user_agent) = configuration.user_agent {
5450 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5451 }
5452
5453 for (header_name, header_value) in header_params {
5455 req_builder = req_builder.header(&header_name, &header_value);
5456 }
5457
5458
5459 let req = req_builder.build()?;
5460 let resp = configuration.client.execute(req).await?;
5461
5462 let status = resp.status();
5463 let content_type = resp
5464 .headers()
5465 .get("content-type")
5466 .and_then(|v| v.to_str().ok())
5467 .unwrap_or("application/octet-stream");
5468 let content_type = super::ContentType::from(content_type);
5469
5470 if !status.is_client_error() && !status.is_server_error() {
5471 let content = resp.text().await?;
5472 match content_type {
5473 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5474 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetIncomeAsynV1Resp`"))),
5475 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::GetIncomeAsynV1Resp`")))),
5476 }
5477 } else {
5478 let content = resp.text().await?;
5479 let entity: Option<GetIncomeAsynV1Error> = serde_json::from_str(&content).ok();
5480 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5481 }
5482}
5483
5484pub async fn get_index_info_v1(configuration: &configuration::Configuration, params: GetIndexInfoV1Params) -> Result<Vec<models::GetIndexInfoV1RespItem>, Error<GetIndexInfoV1Error>> {
5486
5487 let uri_str = format!("{}/fapi/v1/indexInfo", configuration.base_path);
5488 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5489
5490 let mut query_params: Vec<(String, String)> = Vec::new();
5492
5493 if let Some(ref param_value) = params.symbol {
5494 query_params.push(("symbol".to_string(), param_value.to_string()));
5495 }
5496
5497 let mut header_params = std::collections::HashMap::new();
5499
5500 if let Some(ref binance_auth) = configuration.binance_auth {
5502 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5504
5505 let body_string: Option<Vec<u8>> = None;
5507
5508 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5510 Ok(sig) => sig,
5511 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5512 };
5513
5514 query_params.push(("signature".to_string(), signature));
5516 }
5517
5518 if !query_params.is_empty() {
5520 req_builder = req_builder.query(&query_params);
5521 }
5522
5523
5524 if let Some(ref user_agent) = configuration.user_agent {
5526 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5527 }
5528
5529 for (header_name, header_value) in header_params {
5531 req_builder = req_builder.header(&header_name, &header_value);
5532 }
5533
5534
5535 let req = req_builder.build()?;
5536 let resp = configuration.client.execute(req).await?;
5537
5538 let status = resp.status();
5539 let content_type = resp
5540 .headers()
5541 .get("content-type")
5542 .and_then(|v| v.to_str().ok())
5543 .unwrap_or("application/octet-stream");
5544 let content_type = super::ContentType::from(content_type);
5545
5546 if !status.is_client_error() && !status.is_server_error() {
5547 let content = resp.text().await?;
5548 match content_type {
5549 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5550 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetIndexInfoV1RespItem>`"))),
5551 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::GetIndexInfoV1RespItem>`")))),
5552 }
5553 } else {
5554 let content = resp.text().await?;
5555 let entity: Option<GetIndexInfoV1Error> = serde_json::from_str(&content).ok();
5556 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5557 }
5558}
5559
5560pub async fn get_index_price_klines_v1(configuration: &configuration::Configuration, params: GetIndexPriceKlinesV1Params) -> Result<Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>, Error<GetIndexPriceKlinesV1Error>> {
5562
5563 let uri_str = format!("{}/fapi/v1/indexPriceKlines", configuration.base_path);
5564 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5565
5566 let mut query_params: Vec<(String, String)> = Vec::new();
5568
5569 query_params.push(("pair".to_string(), params.pair.to_string()));
5570 query_params.push(("interval".to_string(), params.interval.to_string()));
5571 if let Some(ref param_value) = params.start_time {
5572 query_params.push(("startTime".to_string(), param_value.to_string()));
5573 }
5574 if let Some(ref param_value) = params.end_time {
5575 query_params.push(("endTime".to_string(), param_value.to_string()));
5576 }
5577 if let Some(ref param_value) = params.limit {
5578 query_params.push(("limit".to_string(), param_value.to_string()));
5579 }
5580
5581 let mut header_params = std::collections::HashMap::new();
5583
5584 if let Some(ref binance_auth) = configuration.binance_auth {
5586 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5588
5589 let body_string: Option<Vec<u8>> = None;
5591
5592 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5594 Ok(sig) => sig,
5595 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5596 };
5597
5598 query_params.push(("signature".to_string(), signature));
5600 }
5601
5602 if !query_params.is_empty() {
5604 req_builder = req_builder.query(&query_params);
5605 }
5606
5607
5608 if let Some(ref user_agent) = configuration.user_agent {
5610 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5611 }
5612
5613 for (header_name, header_value) in header_params {
5615 req_builder = req_builder.header(&header_name, &header_value);
5616 }
5617
5618
5619 let req = req_builder.build()?;
5620 let resp = configuration.client.execute(req).await?;
5621
5622 let status = resp.status();
5623 let content_type = resp
5624 .headers()
5625 .get("content-type")
5626 .and_then(|v| v.to_str().ok())
5627 .unwrap_or("application/octet-stream");
5628 let content_type = super::ContentType::from(content_type);
5629
5630 if !status.is_client_error() && !status.is_server_error() {
5631 let content = resp.text().await?;
5632 match content_type {
5633 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5634 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`"))),
5635 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<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`")))),
5636 }
5637 } else {
5638 let content = resp.text().await?;
5639 let entity: Option<GetIndexPriceKlinesV1Error> = serde_json::from_str(&content).ok();
5640 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5641 }
5642}
5643
5644pub async fn get_klines_v1(configuration: &configuration::Configuration, params: GetKlinesV1Params) -> Result<Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>, Error<GetKlinesV1Error>> {
5646
5647 let uri_str = format!("{}/fapi/v1/klines", configuration.base_path);
5648 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5649
5650 let mut query_params: Vec<(String, String)> = Vec::new();
5652
5653 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5654 query_params.push(("interval".to_string(), params.interval.to_string()));
5655 if let Some(ref param_value) = params.start_time {
5656 query_params.push(("startTime".to_string(), param_value.to_string()));
5657 }
5658 if let Some(ref param_value) = params.end_time {
5659 query_params.push(("endTime".to_string(), param_value.to_string()));
5660 }
5661 if let Some(ref param_value) = params.limit {
5662 query_params.push(("limit".to_string(), param_value.to_string()));
5663 }
5664
5665 let mut header_params = std::collections::HashMap::new();
5667
5668 if let Some(ref binance_auth) = configuration.binance_auth {
5670 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5672
5673 let body_string: Option<Vec<u8>> = None;
5675
5676 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5678 Ok(sig) => sig,
5679 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5680 };
5681
5682 query_params.push(("signature".to_string(), signature));
5684 }
5685
5686 if !query_params.is_empty() {
5688 req_builder = req_builder.query(&query_params);
5689 }
5690
5691
5692 if let Some(ref user_agent) = configuration.user_agent {
5694 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5695 }
5696
5697 for (header_name, header_value) in header_params {
5699 req_builder = req_builder.header(&header_name, &header_value);
5700 }
5701
5702
5703 let req = req_builder.build()?;
5704 let resp = configuration.client.execute(req).await?;
5705
5706 let status = resp.status();
5707 let content_type = resp
5708 .headers()
5709 .get("content-type")
5710 .and_then(|v| v.to_str().ok())
5711 .unwrap_or("application/octet-stream");
5712 let content_type = super::ContentType::from(content_type);
5713
5714 if !status.is_client_error() && !status.is_server_error() {
5715 let content = resp.text().await?;
5716 match content_type {
5717 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5718 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`"))),
5719 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<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`")))),
5720 }
5721 } else {
5722 let content = resp.text().await?;
5723 let entity: Option<GetKlinesV1Error> = serde_json::from_str(&content).ok();
5724 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5725 }
5726}
5727
5728pub async fn get_leverage_bracket_v1(configuration: &configuration::Configuration, params: GetLeverageBracketV1Params) -> Result<models::UmfuturesGetLeverageBracketV1Resp, Error<GetLeverageBracketV1Error>> {
5730
5731 let uri_str = format!("{}/fapi/v1/leverageBracket", configuration.base_path);
5732 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5733
5734 let mut query_params: Vec<(String, String)> = Vec::new();
5736
5737 if let Some(ref param_value) = params.symbol {
5738 query_params.push(("symbol".to_string(), param_value.to_string()));
5739 }
5740 if let Some(ref param_value) = params.recv_window {
5741 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5742 }
5743 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5744
5745 let mut header_params = std::collections::HashMap::new();
5747
5748 if let Some(ref binance_auth) = configuration.binance_auth {
5750 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5752
5753 let body_string: Option<Vec<u8>> = None;
5755
5756 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5758 Ok(sig) => sig,
5759 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5760 };
5761
5762 query_params.push(("signature".to_string(), signature));
5764 }
5765
5766 if !query_params.is_empty() {
5768 req_builder = req_builder.query(&query_params);
5769 }
5770
5771
5772 if let Some(ref user_agent) = configuration.user_agent {
5774 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5775 }
5776
5777 for (header_name, header_value) in header_params {
5779 req_builder = req_builder.header(&header_name, &header_value);
5780 }
5781
5782
5783 let req = req_builder.build()?;
5784 let resp = configuration.client.execute(req).await?;
5785
5786 let status = resp.status();
5787 let content_type = resp
5788 .headers()
5789 .get("content-type")
5790 .and_then(|v| v.to_str().ok())
5791 .unwrap_or("application/octet-stream");
5792 let content_type = super::ContentType::from(content_type);
5793
5794 if !status.is_client_error() && !status.is_server_error() {
5795 let content = resp.text().await?;
5796 match content_type {
5797 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5798 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetLeverageBracketV1Resp`"))),
5799 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::UmfuturesGetLeverageBracketV1Resp`")))),
5800 }
5801 } else {
5802 let content = resp.text().await?;
5803 let entity: Option<GetLeverageBracketV1Error> = serde_json::from_str(&content).ok();
5804 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5805 }
5806}
5807
5808pub async fn get_mark_price_klines_v1(configuration: &configuration::Configuration, params: GetMarkPriceKlinesV1Params) -> Result<Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>, Error<GetMarkPriceKlinesV1Error>> {
5810
5811 let uri_str = format!("{}/fapi/v1/markPriceKlines", configuration.base_path);
5812 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5813
5814 let mut query_params: Vec<(String, String)> = Vec::new();
5816
5817 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5818 query_params.push(("interval".to_string(), params.interval.to_string()));
5819 if let Some(ref param_value) = params.start_time {
5820 query_params.push(("startTime".to_string(), param_value.to_string()));
5821 }
5822 if let Some(ref param_value) = params.end_time {
5823 query_params.push(("endTime".to_string(), param_value.to_string()));
5824 }
5825 if let Some(ref param_value) = params.limit {
5826 query_params.push(("limit".to_string(), param_value.to_string()));
5827 }
5828
5829 let mut header_params = std::collections::HashMap::new();
5831
5832 if let Some(ref binance_auth) = configuration.binance_auth {
5834 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5836
5837 let body_string: Option<Vec<u8>> = None;
5839
5840 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5842 Ok(sig) => sig,
5843 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5844 };
5845
5846 query_params.push(("signature".to_string(), signature));
5848 }
5849
5850 if !query_params.is_empty() {
5852 req_builder = req_builder.query(&query_params);
5853 }
5854
5855
5856 if let Some(ref user_agent) = configuration.user_agent {
5858 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5859 }
5860
5861 for (header_name, header_value) in header_params {
5863 req_builder = req_builder.header(&header_name, &header_value);
5864 }
5865
5866
5867 let req = req_builder.build()?;
5868 let resp = configuration.client.execute(req).await?;
5869
5870 let status = resp.status();
5871 let content_type = resp
5872 .headers()
5873 .get("content-type")
5874 .and_then(|v| v.to_str().ok())
5875 .unwrap_or("application/octet-stream");
5876 let content_type = super::ContentType::from(content_type);
5877
5878 if !status.is_client_error() && !status.is_server_error() {
5879 let content = resp.text().await?;
5880 match content_type {
5881 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5882 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`"))),
5883 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<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`")))),
5884 }
5885 } else {
5886 let content = resp.text().await?;
5887 let entity: Option<GetMarkPriceKlinesV1Error> = serde_json::from_str(&content).ok();
5888 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5889 }
5890}
5891
5892pub async fn get_multi_assets_margin_v1(configuration: &configuration::Configuration, params: GetMultiAssetsMarginV1Params) -> Result<models::GetMultiAssetsMarginV1Resp, Error<GetMultiAssetsMarginV1Error>> {
5894
5895 let uri_str = format!("{}/fapi/v1/multiAssetsMargin", configuration.base_path);
5896 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5897
5898 let mut query_params: Vec<(String, String)> = Vec::new();
5900
5901 if let Some(ref param_value) = params.recv_window {
5902 query_params.push(("recvWindow".to_string(), param_value.to_string()));
5903 }
5904 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
5905
5906 let mut header_params = std::collections::HashMap::new();
5908
5909 if let Some(ref binance_auth) = configuration.binance_auth {
5911 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5913
5914 let body_string: Option<Vec<u8>> = None;
5916
5917 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5919 Ok(sig) => sig,
5920 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5921 };
5922
5923 query_params.push(("signature".to_string(), signature));
5925 }
5926
5927 if !query_params.is_empty() {
5929 req_builder = req_builder.query(&query_params);
5930 }
5931
5932
5933 if let Some(ref user_agent) = configuration.user_agent {
5935 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5936 }
5937
5938 for (header_name, header_value) in header_params {
5940 req_builder = req_builder.header(&header_name, &header_value);
5941 }
5942
5943
5944 let req = req_builder.build()?;
5945 let resp = configuration.client.execute(req).await?;
5946
5947 let status = resp.status();
5948 let content_type = resp
5949 .headers()
5950 .get("content-type")
5951 .and_then(|v| v.to_str().ok())
5952 .unwrap_or("application/octet-stream");
5953 let content_type = super::ContentType::from(content_type);
5954
5955 if !status.is_client_error() && !status.is_server_error() {
5956 let content = resp.text().await?;
5957 match content_type {
5958 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5959 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMultiAssetsMarginV1Resp`"))),
5960 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::GetMultiAssetsMarginV1Resp`")))),
5961 }
5962 } else {
5963 let content = resp.text().await?;
5964 let entity: Option<GetMultiAssetsMarginV1Error> = serde_json::from_str(&content).ok();
5965 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5966 }
5967}
5968
5969pub async fn get_open_interest_v1(configuration: &configuration::Configuration, params: GetOpenInterestV1Params) -> Result<models::GetOpenInterestV1Resp, Error<GetOpenInterestV1Error>> {
5971
5972 let uri_str = format!("{}/fapi/v1/openInterest", configuration.base_path);
5973 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5974
5975 let mut query_params: Vec<(String, String)> = Vec::new();
5977
5978 query_params.push(("symbol".to_string(), params.symbol.to_string()));
5979
5980 let mut header_params = std::collections::HashMap::new();
5982
5983 if let Some(ref binance_auth) = configuration.binance_auth {
5985 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5987
5988 let body_string: Option<Vec<u8>> = None;
5990
5991 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
5993 Ok(sig) => sig,
5994 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
5995 };
5996
5997 query_params.push(("signature".to_string(), signature));
5999 }
6000
6001 if !query_params.is_empty() {
6003 req_builder = req_builder.query(&query_params);
6004 }
6005
6006
6007 if let Some(ref user_agent) = configuration.user_agent {
6009 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6010 }
6011
6012 for (header_name, header_value) in header_params {
6014 req_builder = req_builder.header(&header_name, &header_value);
6015 }
6016
6017
6018 let req = req_builder.build()?;
6019 let resp = configuration.client.execute(req).await?;
6020
6021 let status = resp.status();
6022 let content_type = resp
6023 .headers()
6024 .get("content-type")
6025 .and_then(|v| v.to_str().ok())
6026 .unwrap_or("application/octet-stream");
6027 let content_type = super::ContentType::from(content_type);
6028
6029 if !status.is_client_error() && !status.is_server_error() {
6030 let content = resp.text().await?;
6031 match content_type {
6032 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6033 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOpenInterestV1Resp`"))),
6034 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::GetOpenInterestV1Resp`")))),
6035 }
6036 } else {
6037 let content = resp.text().await?;
6038 let entity: Option<GetOpenInterestV1Error> = serde_json::from_str(&content).ok();
6039 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6040 }
6041}
6042
6043pub async fn get_open_order_v1(configuration: &configuration::Configuration, params: GetOpenOrderV1Params) -> Result<models::GetOpenOrderV1Resp, Error<GetOpenOrderV1Error>> {
6045
6046 let uri_str = format!("{}/fapi/v1/openOrder", configuration.base_path);
6047 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6048
6049 let mut query_params: Vec<(String, String)> = Vec::new();
6051
6052 query_params.push(("symbol".to_string(), params.symbol.to_string()));
6053 if let Some(ref param_value) = params.order_id {
6054 query_params.push(("orderId".to_string(), param_value.to_string()));
6055 }
6056 if let Some(ref param_value) = params.orig_client_order_id {
6057 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
6058 }
6059 if let Some(ref param_value) = params.recv_window {
6060 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6061 }
6062 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6063
6064 let mut header_params = std::collections::HashMap::new();
6066
6067 if let Some(ref binance_auth) = configuration.binance_auth {
6069 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6071
6072 let body_string: Option<Vec<u8>> = None;
6074
6075 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6077 Ok(sig) => sig,
6078 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6079 };
6080
6081 query_params.push(("signature".to_string(), signature));
6083 }
6084
6085 if !query_params.is_empty() {
6087 req_builder = req_builder.query(&query_params);
6088 }
6089
6090
6091 if let Some(ref user_agent) = configuration.user_agent {
6093 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6094 }
6095
6096 for (header_name, header_value) in header_params {
6098 req_builder = req_builder.header(&header_name, &header_value);
6099 }
6100
6101
6102 let req = req_builder.build()?;
6103 let resp = configuration.client.execute(req).await?;
6104
6105 let status = resp.status();
6106 let content_type = resp
6107 .headers()
6108 .get("content-type")
6109 .and_then(|v| v.to_str().ok())
6110 .unwrap_or("application/octet-stream");
6111 let content_type = super::ContentType::from(content_type);
6112
6113 if !status.is_client_error() && !status.is_server_error() {
6114 let content = resp.text().await?;
6115 match content_type {
6116 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6117 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOpenOrderV1Resp`"))),
6118 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::GetOpenOrderV1Resp`")))),
6119 }
6120 } else {
6121 let content = resp.text().await?;
6122 let entity: Option<GetOpenOrderV1Error> = serde_json::from_str(&content).ok();
6123 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6124 }
6125}
6126
6127pub async fn get_open_orders_v1(configuration: &configuration::Configuration, params: GetOpenOrdersV1Params) -> Result<Vec<models::GetOpenOrdersV1RespItem>, Error<GetOpenOrdersV1Error>> {
6129
6130 let uri_str = format!("{}/fapi/v1/openOrders", configuration.base_path);
6131 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6132
6133 let mut query_params: Vec<(String, String)> = Vec::new();
6135
6136 if let Some(ref param_value) = params.symbol {
6137 query_params.push(("symbol".to_string(), param_value.to_string()));
6138 }
6139 if let Some(ref param_value) = params.recv_window {
6140 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6141 }
6142 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6143
6144 let mut header_params = std::collections::HashMap::new();
6146
6147 if let Some(ref binance_auth) = configuration.binance_auth {
6149 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6151
6152 let body_string: Option<Vec<u8>> = None;
6154
6155 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6157 Ok(sig) => sig,
6158 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6159 };
6160
6161 query_params.push(("signature".to_string(), signature));
6163 }
6164
6165 if !query_params.is_empty() {
6167 req_builder = req_builder.query(&query_params);
6168 }
6169
6170
6171 if let Some(ref user_agent) = configuration.user_agent {
6173 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6174 }
6175
6176 for (header_name, header_value) in header_params {
6178 req_builder = req_builder.header(&header_name, &header_value);
6179 }
6180
6181
6182 let req = req_builder.build()?;
6183 let resp = configuration.client.execute(req).await?;
6184
6185 let status = resp.status();
6186 let content_type = resp
6187 .headers()
6188 .get("content-type")
6189 .and_then(|v| v.to_str().ok())
6190 .unwrap_or("application/octet-stream");
6191 let content_type = super::ContentType::from(content_type);
6192
6193 if !status.is_client_error() && !status.is_server_error() {
6194 let content = resp.text().await?;
6195 match content_type {
6196 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6197 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetOpenOrdersV1RespItem>`"))),
6198 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::GetOpenOrdersV1RespItem>`")))),
6199 }
6200 } else {
6201 let content = resp.text().await?;
6202 let entity: Option<GetOpenOrdersV1Error> = serde_json::from_str(&content).ok();
6203 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6204 }
6205}
6206
6207pub async fn get_order_amendment_v1(configuration: &configuration::Configuration, params: GetOrderAmendmentV1Params) -> Result<Vec<models::GetOrderAmendmentV1RespItem>, Error<GetOrderAmendmentV1Error>> {
6209
6210 let uri_str = format!("{}/fapi/v1/orderAmendment", configuration.base_path);
6211 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6212
6213 let mut query_params: Vec<(String, String)> = Vec::new();
6215
6216 query_params.push(("symbol".to_string(), params.symbol.to_string()));
6217 if let Some(ref param_value) = params.order_id {
6218 query_params.push(("orderId".to_string(), param_value.to_string()));
6219 }
6220 if let Some(ref param_value) = params.orig_client_order_id {
6221 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
6222 }
6223 if let Some(ref param_value) = params.start_time {
6224 query_params.push(("startTime".to_string(), param_value.to_string()));
6225 }
6226 if let Some(ref param_value) = params.end_time {
6227 query_params.push(("endTime".to_string(), param_value.to_string()));
6228 }
6229 if let Some(ref param_value) = params.limit {
6230 query_params.push(("limit".to_string(), param_value.to_string()));
6231 }
6232 if let Some(ref param_value) = params.recv_window {
6233 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6234 }
6235 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6236
6237 let mut header_params = std::collections::HashMap::new();
6239
6240 if let Some(ref binance_auth) = configuration.binance_auth {
6242 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6244
6245 let body_string: Option<Vec<u8>> = None;
6247
6248 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6250 Ok(sig) => sig,
6251 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6252 };
6253
6254 query_params.push(("signature".to_string(), signature));
6256 }
6257
6258 if !query_params.is_empty() {
6260 req_builder = req_builder.query(&query_params);
6261 }
6262
6263
6264 if let Some(ref user_agent) = configuration.user_agent {
6266 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6267 }
6268
6269 for (header_name, header_value) in header_params {
6271 req_builder = req_builder.header(&header_name, &header_value);
6272 }
6273
6274
6275 let req = req_builder.build()?;
6276 let resp = configuration.client.execute(req).await?;
6277
6278 let status = resp.status();
6279 let content_type = resp
6280 .headers()
6281 .get("content-type")
6282 .and_then(|v| v.to_str().ok())
6283 .unwrap_or("application/octet-stream");
6284 let content_type = super::ContentType::from(content_type);
6285
6286 if !status.is_client_error() && !status.is_server_error() {
6287 let content = resp.text().await?;
6288 match content_type {
6289 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6290 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetOrderAmendmentV1RespItem>`"))),
6291 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::GetOrderAmendmentV1RespItem>`")))),
6292 }
6293 } else {
6294 let content = resp.text().await?;
6295 let entity: Option<GetOrderAmendmentV1Error> = serde_json::from_str(&content).ok();
6296 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6297 }
6298}
6299
6300pub async fn get_order_asyn_id_v1(configuration: &configuration::Configuration, params: GetOrderAsynIdV1Params) -> Result<models::GetOrderAsynIdV1Resp, Error<GetOrderAsynIdV1Error>> {
6302
6303 let uri_str = format!("{}/fapi/v1/order/asyn/id", configuration.base_path);
6304 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6305
6306 let mut query_params: Vec<(String, String)> = Vec::new();
6308
6309 query_params.push(("downloadId".to_string(), params.download_id.to_string()));
6310 if let Some(ref param_value) = params.recv_window {
6311 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6312 }
6313 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6314
6315 let mut header_params = std::collections::HashMap::new();
6317
6318 if let Some(ref binance_auth) = configuration.binance_auth {
6320 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6322
6323 let body_string: Option<Vec<u8>> = None;
6325
6326 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6328 Ok(sig) => sig,
6329 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6330 };
6331
6332 query_params.push(("signature".to_string(), signature));
6334 }
6335
6336 if !query_params.is_empty() {
6338 req_builder = req_builder.query(&query_params);
6339 }
6340
6341
6342 if let Some(ref user_agent) = configuration.user_agent {
6344 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6345 }
6346
6347 for (header_name, header_value) in header_params {
6349 req_builder = req_builder.header(&header_name, &header_value);
6350 }
6351
6352
6353 let req = req_builder.build()?;
6354 let resp = configuration.client.execute(req).await?;
6355
6356 let status = resp.status();
6357 let content_type = resp
6358 .headers()
6359 .get("content-type")
6360 .and_then(|v| v.to_str().ok())
6361 .unwrap_or("application/octet-stream");
6362 let content_type = super::ContentType::from(content_type);
6363
6364 if !status.is_client_error() && !status.is_server_error() {
6365 let content = resp.text().await?;
6366 match content_type {
6367 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6368 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOrderAsynIdV1Resp`"))),
6369 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::GetOrderAsynIdV1Resp`")))),
6370 }
6371 } else {
6372 let content = resp.text().await?;
6373 let entity: Option<GetOrderAsynIdV1Error> = serde_json::from_str(&content).ok();
6374 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6375 }
6376}
6377
6378pub async fn get_order_asyn_v1(configuration: &configuration::Configuration, params: GetOrderAsynV1Params) -> Result<models::UmfuturesGetOrderAsynV1Resp, Error<GetOrderAsynV1Error>> {
6380
6381 let uri_str = format!("{}/fapi/v1/order/asyn", configuration.base_path);
6382 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6383
6384 let mut query_params: Vec<(String, String)> = Vec::new();
6386
6387 query_params.push(("startTime".to_string(), params.start_time.to_string()));
6388 query_params.push(("endTime".to_string(), params.end_time.to_string()));
6389 if let Some(ref param_value) = params.recv_window {
6390 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6391 }
6392 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6393
6394 let mut header_params = std::collections::HashMap::new();
6396
6397 if let Some(ref binance_auth) = configuration.binance_auth {
6399 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6401
6402 let body_string: Option<Vec<u8>> = None;
6404
6405 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6407 Ok(sig) => sig,
6408 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6409 };
6410
6411 query_params.push(("signature".to_string(), signature));
6413 }
6414
6415 if !query_params.is_empty() {
6417 req_builder = req_builder.query(&query_params);
6418 }
6419
6420
6421 if let Some(ref user_agent) = configuration.user_agent {
6423 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6424 }
6425
6426 for (header_name, header_value) in header_params {
6428 req_builder = req_builder.header(&header_name, &header_value);
6429 }
6430
6431
6432 let req = req_builder.build()?;
6433 let resp = configuration.client.execute(req).await?;
6434
6435 let status = resp.status();
6436 let content_type = resp
6437 .headers()
6438 .get("content-type")
6439 .and_then(|v| v.to_str().ok())
6440 .unwrap_or("application/octet-stream");
6441 let content_type = super::ContentType::from(content_type);
6442
6443 if !status.is_client_error() && !status.is_server_error() {
6444 let content = resp.text().await?;
6445 match content_type {
6446 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6447 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetOrderAsynV1Resp`"))),
6448 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::UmfuturesGetOrderAsynV1Resp`")))),
6449 }
6450 } else {
6451 let content = resp.text().await?;
6452 let entity: Option<GetOrderAsynV1Error> = serde_json::from_str(&content).ok();
6453 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6454 }
6455}
6456
6457pub async fn get_order_v1(configuration: &configuration::Configuration, params: GetOrderV1Params) -> Result<models::GetOrderV1Resp, Error<GetOrderV1Error>> {
6459
6460 let uri_str = format!("{}/fapi/v1/order", configuration.base_path);
6461 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6462
6463 let mut query_params: Vec<(String, String)> = Vec::new();
6465
6466 query_params.push(("symbol".to_string(), params.symbol.to_string()));
6467 if let Some(ref param_value) = params.order_id {
6468 query_params.push(("orderId".to_string(), param_value.to_string()));
6469 }
6470 if let Some(ref param_value) = params.orig_client_order_id {
6471 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
6472 }
6473 if let Some(ref param_value) = params.recv_window {
6474 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6475 }
6476 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6477
6478 let mut header_params = std::collections::HashMap::new();
6480
6481 if let Some(ref binance_auth) = configuration.binance_auth {
6483 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6485
6486 let body_string: Option<Vec<u8>> = None;
6488
6489 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6491 Ok(sig) => sig,
6492 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6493 };
6494
6495 query_params.push(("signature".to_string(), signature));
6497 }
6498
6499 if !query_params.is_empty() {
6501 req_builder = req_builder.query(&query_params);
6502 }
6503
6504
6505 if let Some(ref user_agent) = configuration.user_agent {
6507 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6508 }
6509
6510 for (header_name, header_value) in header_params {
6512 req_builder = req_builder.header(&header_name, &header_value);
6513 }
6514
6515
6516 let req = req_builder.build()?;
6517 let resp = configuration.client.execute(req).await?;
6518
6519 let status = resp.status();
6520 let content_type = resp
6521 .headers()
6522 .get("content-type")
6523 .and_then(|v| v.to_str().ok())
6524 .unwrap_or("application/octet-stream");
6525 let content_type = super::ContentType::from(content_type);
6526
6527 if !status.is_client_error() && !status.is_server_error() {
6528 let content = resp.text().await?;
6529 match content_type {
6530 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6531 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOrderV1Resp`"))),
6532 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::GetOrderV1Resp`")))),
6533 }
6534 } else {
6535 let content = resp.text().await?;
6536 let entity: Option<GetOrderV1Error> = serde_json::from_str(&content).ok();
6537 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6538 }
6539}
6540
6541pub async fn get_ping_v1(configuration: &configuration::Configuration) -> Result<serde_json::Value, Error<GetPingV1Error>> {
6543
6544 let uri_str = format!("{}/fapi/v1/ping", configuration.base_path);
6545 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6546
6547 let mut query_params: Vec<(String, String)> = Vec::new();
6549
6550
6551 let mut header_params = std::collections::HashMap::new();
6553
6554 if let Some(ref binance_auth) = configuration.binance_auth {
6556 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6558
6559 let body_string: Option<Vec<u8>> = None;
6561
6562 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6564 Ok(sig) => sig,
6565 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6566 };
6567
6568 query_params.push(("signature".to_string(), signature));
6570 }
6571
6572 if !query_params.is_empty() {
6574 req_builder = req_builder.query(&query_params);
6575 }
6576
6577
6578 if let Some(ref user_agent) = configuration.user_agent {
6580 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6581 }
6582
6583 for (header_name, header_value) in header_params {
6585 req_builder = req_builder.header(&header_name, &header_value);
6586 }
6587
6588
6589 let req = req_builder.build()?;
6590 let resp = configuration.client.execute(req).await?;
6591
6592 let status = resp.status();
6593 let content_type = resp
6594 .headers()
6595 .get("content-type")
6596 .and_then(|v| v.to_str().ok())
6597 .unwrap_or("application/octet-stream");
6598 let content_type = super::ContentType::from(content_type);
6599
6600 if !status.is_client_error() && !status.is_server_error() {
6601 let content = resp.text().await?;
6602 match content_type {
6603 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6604 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
6605 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`")))),
6606 }
6607 } else {
6608 let content = resp.text().await?;
6609 let entity: Option<GetPingV1Error> = serde_json::from_str(&content).ok();
6610 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6611 }
6612}
6613
6614pub async fn get_pm_account_info_v1(configuration: &configuration::Configuration, params: GetPmAccountInfoV1Params) -> Result<models::GetPmAccountInfoV1Resp, Error<GetPmAccountInfoV1Error>> {
6616
6617 let uri_str = format!("{}/fapi/v1/pmAccountInfo", configuration.base_path);
6618 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6619
6620 let mut query_params: Vec<(String, String)> = Vec::new();
6622
6623 query_params.push(("asset".to_string(), params.asset.to_string()));
6624 if let Some(ref param_value) = params.recv_window {
6625 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6626 }
6627 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6628
6629 let mut header_params = std::collections::HashMap::new();
6631
6632 if let Some(ref binance_auth) = configuration.binance_auth {
6634 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6636
6637 let body_string: Option<Vec<u8>> = None;
6639
6640 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6642 Ok(sig) => sig,
6643 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6644 };
6645
6646 query_params.push(("signature".to_string(), signature));
6648 }
6649
6650 if !query_params.is_empty() {
6652 req_builder = req_builder.query(&query_params);
6653 }
6654
6655
6656 if let Some(ref user_agent) = configuration.user_agent {
6658 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6659 }
6660
6661 for (header_name, header_value) in header_params {
6663 req_builder = req_builder.header(&header_name, &header_value);
6664 }
6665
6666
6667 let req = req_builder.build()?;
6668 let resp = configuration.client.execute(req).await?;
6669
6670 let status = resp.status();
6671 let content_type = resp
6672 .headers()
6673 .get("content-type")
6674 .and_then(|v| v.to_str().ok())
6675 .unwrap_or("application/octet-stream");
6676 let content_type = super::ContentType::from(content_type);
6677
6678 if !status.is_client_error() && !status.is_server_error() {
6679 let content = resp.text().await?;
6680 match content_type {
6681 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6682 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetPmAccountInfoV1Resp`"))),
6683 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::GetPmAccountInfoV1Resp`")))),
6684 }
6685 } else {
6686 let content = resp.text().await?;
6687 let entity: Option<GetPmAccountInfoV1Error> = serde_json::from_str(&content).ok();
6688 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6689 }
6690}
6691
6692pub async fn get_position_margin_history_v1(configuration: &configuration::Configuration, params: GetPositionMarginHistoryV1Params) -> Result<Vec<models::GetPositionMarginHistoryV1RespItem>, Error<GetPositionMarginHistoryV1Error>> {
6694
6695 let uri_str = format!("{}/fapi/v1/positionMargin/history", configuration.base_path);
6696 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6697
6698 let mut query_params: Vec<(String, String)> = Vec::new();
6700
6701 query_params.push(("symbol".to_string(), params.symbol.to_string()));
6702 if let Some(ref param_value) = params.r#type {
6703 query_params.push(("type".to_string(), param_value.to_string()));
6704 }
6705 if let Some(ref param_value) = params.start_time {
6706 query_params.push(("startTime".to_string(), param_value.to_string()));
6707 }
6708 if let Some(ref param_value) = params.end_time {
6709 query_params.push(("endTime".to_string(), param_value.to_string()));
6710 }
6711 if let Some(ref param_value) = params.limit {
6712 query_params.push(("limit".to_string(), param_value.to_string()));
6713 }
6714 if let Some(ref param_value) = params.recv_window {
6715 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6716 }
6717 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6718
6719 let mut header_params = std::collections::HashMap::new();
6721
6722 if let Some(ref binance_auth) = configuration.binance_auth {
6724 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6726
6727 let body_string: Option<Vec<u8>> = None;
6729
6730 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6732 Ok(sig) => sig,
6733 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6734 };
6735
6736 query_params.push(("signature".to_string(), signature));
6738 }
6739
6740 if !query_params.is_empty() {
6742 req_builder = req_builder.query(&query_params);
6743 }
6744
6745
6746 if let Some(ref user_agent) = configuration.user_agent {
6748 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6749 }
6750
6751 for (header_name, header_value) in header_params {
6753 req_builder = req_builder.header(&header_name, &header_value);
6754 }
6755
6756
6757 let req = req_builder.build()?;
6758 let resp = configuration.client.execute(req).await?;
6759
6760 let status = resp.status();
6761 let content_type = resp
6762 .headers()
6763 .get("content-type")
6764 .and_then(|v| v.to_str().ok())
6765 .unwrap_or("application/octet-stream");
6766 let content_type = super::ContentType::from(content_type);
6767
6768 if !status.is_client_error() && !status.is_server_error() {
6769 let content = resp.text().await?;
6770 match content_type {
6771 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6772 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetPositionMarginHistoryV1RespItem>`"))),
6773 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::GetPositionMarginHistoryV1RespItem>`")))),
6774 }
6775 } else {
6776 let content = resp.text().await?;
6777 let entity: Option<GetPositionMarginHistoryV1Error> = serde_json::from_str(&content).ok();
6778 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6779 }
6780}
6781
6782pub async fn get_position_risk_v2(configuration: &configuration::Configuration, params: GetPositionRiskV2Params) -> Result<Vec<models::GetPositionRiskV2RespItem>, Error<GetPositionRiskV2Error>> {
6784
6785 let uri_str = format!("{}/fapi/v2/positionRisk", configuration.base_path);
6786 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6787
6788 let mut query_params: Vec<(String, String)> = Vec::new();
6790
6791 if let Some(ref param_value) = params.symbol {
6792 query_params.push(("symbol".to_string(), param_value.to_string()));
6793 }
6794 if let Some(ref param_value) = params.recv_window {
6795 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6796 }
6797 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6798
6799 let mut header_params = std::collections::HashMap::new();
6801
6802 if let Some(ref binance_auth) = configuration.binance_auth {
6804 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6806
6807 let body_string: Option<Vec<u8>> = None;
6809
6810 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6812 Ok(sig) => sig,
6813 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6814 };
6815
6816 query_params.push(("signature".to_string(), signature));
6818 }
6819
6820 if !query_params.is_empty() {
6822 req_builder = req_builder.query(&query_params);
6823 }
6824
6825
6826 if let Some(ref user_agent) = configuration.user_agent {
6828 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6829 }
6830
6831 for (header_name, header_value) in header_params {
6833 req_builder = req_builder.header(&header_name, &header_value);
6834 }
6835
6836
6837 let req = req_builder.build()?;
6838 let resp = configuration.client.execute(req).await?;
6839
6840 let status = resp.status();
6841 let content_type = resp
6842 .headers()
6843 .get("content-type")
6844 .and_then(|v| v.to_str().ok())
6845 .unwrap_or("application/octet-stream");
6846 let content_type = super::ContentType::from(content_type);
6847
6848 if !status.is_client_error() && !status.is_server_error() {
6849 let content = resp.text().await?;
6850 match content_type {
6851 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6852 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetPositionRiskV2RespItem>`"))),
6853 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::GetPositionRiskV2RespItem>`")))),
6854 }
6855 } else {
6856 let content = resp.text().await?;
6857 let entity: Option<GetPositionRiskV2Error> = serde_json::from_str(&content).ok();
6858 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6859 }
6860}
6861
6862pub async fn get_position_risk_v3(configuration: &configuration::Configuration, params: GetPositionRiskV3Params) -> Result<Vec<models::GetPositionRiskV3RespItem>, Error<GetPositionRiskV3Error>> {
6864
6865 let uri_str = format!("{}/fapi/v3/positionRisk", configuration.base_path);
6866 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6867
6868 let mut query_params: Vec<(String, String)> = Vec::new();
6870
6871 if let Some(ref param_value) = params.symbol {
6872 query_params.push(("symbol".to_string(), param_value.to_string()));
6873 }
6874 if let Some(ref param_value) = params.recv_window {
6875 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6876 }
6877 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6878
6879 let mut header_params = std::collections::HashMap::new();
6881
6882 if let Some(ref binance_auth) = configuration.binance_auth {
6884 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6886
6887 let body_string: Option<Vec<u8>> = None;
6889
6890 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6892 Ok(sig) => sig,
6893 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6894 };
6895
6896 query_params.push(("signature".to_string(), signature));
6898 }
6899
6900 if !query_params.is_empty() {
6902 req_builder = req_builder.query(&query_params);
6903 }
6904
6905
6906 if let Some(ref user_agent) = configuration.user_agent {
6908 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6909 }
6910
6911 for (header_name, header_value) in header_params {
6913 req_builder = req_builder.header(&header_name, &header_value);
6914 }
6915
6916
6917 let req = req_builder.build()?;
6918 let resp = configuration.client.execute(req).await?;
6919
6920 let status = resp.status();
6921 let content_type = resp
6922 .headers()
6923 .get("content-type")
6924 .and_then(|v| v.to_str().ok())
6925 .unwrap_or("application/octet-stream");
6926 let content_type = super::ContentType::from(content_type);
6927
6928 if !status.is_client_error() && !status.is_server_error() {
6929 let content = resp.text().await?;
6930 match content_type {
6931 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6932 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetPositionRiskV3RespItem>`"))),
6933 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::GetPositionRiskV3RespItem>`")))),
6934 }
6935 } else {
6936 let content = resp.text().await?;
6937 let entity: Option<GetPositionRiskV3Error> = serde_json::from_str(&content).ok();
6938 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6939 }
6940}
6941
6942pub async fn get_position_side_dual_v1(configuration: &configuration::Configuration, params: GetPositionSideDualV1Params) -> Result<models::GetPositionSideDualV1Resp, Error<GetPositionSideDualV1Error>> {
6944
6945 let uri_str = format!("{}/fapi/v1/positionSide/dual", configuration.base_path);
6946 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6947
6948 let mut query_params: Vec<(String, String)> = Vec::new();
6950
6951 if let Some(ref param_value) = params.recv_window {
6952 query_params.push(("recvWindow".to_string(), param_value.to_string()));
6953 }
6954 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
6955
6956 let mut header_params = std::collections::HashMap::new();
6958
6959 if let Some(ref binance_auth) = configuration.binance_auth {
6961 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6963
6964 let body_string: Option<Vec<u8>> = None;
6966
6967 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
6969 Ok(sig) => sig,
6970 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
6971 };
6972
6973 query_params.push(("signature".to_string(), signature));
6975 }
6976
6977 if !query_params.is_empty() {
6979 req_builder = req_builder.query(&query_params);
6980 }
6981
6982
6983 if let Some(ref user_agent) = configuration.user_agent {
6985 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6986 }
6987
6988 for (header_name, header_value) in header_params {
6990 req_builder = req_builder.header(&header_name, &header_value);
6991 }
6992
6993
6994 let req = req_builder.build()?;
6995 let resp = configuration.client.execute(req).await?;
6996
6997 let status = resp.status();
6998 let content_type = resp
6999 .headers()
7000 .get("content-type")
7001 .and_then(|v| v.to_str().ok())
7002 .unwrap_or("application/octet-stream");
7003 let content_type = super::ContentType::from(content_type);
7004
7005 if !status.is_client_error() && !status.is_server_error() {
7006 let content = resp.text().await?;
7007 match content_type {
7008 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7009 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetPositionSideDualV1Resp`"))),
7010 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::GetPositionSideDualV1Resp`")))),
7011 }
7012 } else {
7013 let content = resp.text().await?;
7014 let entity: Option<GetPositionSideDualV1Error> = serde_json::from_str(&content).ok();
7015 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7016 }
7017}
7018
7019pub async fn get_premium_index_klines_v1(configuration: &configuration::Configuration, params: GetPremiumIndexKlinesV1Params) -> Result<Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>, Error<GetPremiumIndexKlinesV1Error>> {
7021
7022 let uri_str = format!("{}/fapi/v1/premiumIndexKlines", configuration.base_path);
7023 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7024
7025 let mut query_params: Vec<(String, String)> = Vec::new();
7027
7028 query_params.push(("symbol".to_string(), params.symbol.to_string()));
7029 query_params.push(("interval".to_string(), params.interval.to_string()));
7030 if let Some(ref param_value) = params.start_time {
7031 query_params.push(("startTime".to_string(), param_value.to_string()));
7032 }
7033 if let Some(ref param_value) = params.end_time {
7034 query_params.push(("endTime".to_string(), param_value.to_string()));
7035 }
7036 if let Some(ref param_value) = params.limit {
7037 query_params.push(("limit".to_string(), param_value.to_string()));
7038 }
7039
7040 let mut header_params = std::collections::HashMap::new();
7042
7043 if let Some(ref binance_auth) = configuration.binance_auth {
7045 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7047
7048 let body_string: Option<Vec<u8>> = None;
7050
7051 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7053 Ok(sig) => sig,
7054 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7055 };
7056
7057 query_params.push(("signature".to_string(), signature));
7059 }
7060
7061 if !query_params.is_empty() {
7063 req_builder = req_builder.query(&query_params);
7064 }
7065
7066
7067 if let Some(ref user_agent) = configuration.user_agent {
7069 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7070 }
7071
7072 for (header_name, header_value) in header_params {
7074 req_builder = req_builder.header(&header_name, &header_value);
7075 }
7076
7077
7078 let req = req_builder.build()?;
7079 let resp = configuration.client.execute(req).await?;
7080
7081 let status = resp.status();
7082 let content_type = resp
7083 .headers()
7084 .get("content-type")
7085 .and_then(|v| v.to_str().ok())
7086 .unwrap_or("application/octet-stream");
7087 let content_type = super::ContentType::from(content_type);
7088
7089 if !status.is_client_error() && !status.is_server_error() {
7090 let content = resp.text().await?;
7091 match content_type {
7092 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7093 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`"))),
7094 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<Vec<models::UmfuturesGetContinuousKlinesV1RespInnerInner>>`")))),
7095 }
7096 } else {
7097 let content = resp.text().await?;
7098 let entity: Option<GetPremiumIndexKlinesV1Error> = serde_json::from_str(&content).ok();
7099 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7100 }
7101}
7102
7103pub async fn get_premium_index_v1(configuration: &configuration::Configuration, params: GetPremiumIndexV1Params) -> Result<models::UmfuturesGetPremiumIndexV1Resp, Error<GetPremiumIndexV1Error>> {
7105
7106 let uri_str = format!("{}/fapi/v1/premiumIndex", configuration.base_path);
7107 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7108
7109 let mut query_params: Vec<(String, String)> = Vec::new();
7111
7112 if let Some(ref param_value) = params.symbol {
7113 query_params.push(("symbol".to_string(), param_value.to_string()));
7114 }
7115
7116 let mut header_params = std::collections::HashMap::new();
7118
7119 if let Some(ref binance_auth) = configuration.binance_auth {
7121 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7123
7124 let body_string: Option<Vec<u8>> = None;
7126
7127 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7129 Ok(sig) => sig,
7130 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7131 };
7132
7133 query_params.push(("signature".to_string(), signature));
7135 }
7136
7137 if !query_params.is_empty() {
7139 req_builder = req_builder.query(&query_params);
7140 }
7141
7142
7143 if let Some(ref user_agent) = configuration.user_agent {
7145 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7146 }
7147
7148 for (header_name, header_value) in header_params {
7150 req_builder = req_builder.header(&header_name, &header_value);
7151 }
7152
7153
7154 let req = req_builder.build()?;
7155 let resp = configuration.client.execute(req).await?;
7156
7157 let status = resp.status();
7158 let content_type = resp
7159 .headers()
7160 .get("content-type")
7161 .and_then(|v| v.to_str().ok())
7162 .unwrap_or("application/octet-stream");
7163 let content_type = super::ContentType::from(content_type);
7164
7165 if !status.is_client_error() && !status.is_server_error() {
7166 let content = resp.text().await?;
7167 match content_type {
7168 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7169 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetPremiumIndexV1Resp`"))),
7170 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::UmfuturesGetPremiumIndexV1Resp`")))),
7171 }
7172 } else {
7173 let content = resp.text().await?;
7174 let entity: Option<GetPremiumIndexV1Error> = serde_json::from_str(&content).ok();
7175 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7176 }
7177}
7178
7179pub async fn get_rate_limit_order_v1(configuration: &configuration::Configuration, params: GetRateLimitOrderV1Params) -> Result<Vec<models::GetRateLimitOrderV1RespItem>, Error<GetRateLimitOrderV1Error>> {
7181
7182 let uri_str = format!("{}/fapi/v1/rateLimit/order", configuration.base_path);
7183 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7184
7185 let mut query_params: Vec<(String, String)> = Vec::new();
7187
7188 if let Some(ref param_value) = params.recv_window {
7189 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7190 }
7191 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7192
7193 let mut header_params = std::collections::HashMap::new();
7195
7196 if let Some(ref binance_auth) = configuration.binance_auth {
7198 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7200
7201 let body_string: Option<Vec<u8>> = None;
7203
7204 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7206 Ok(sig) => sig,
7207 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7208 };
7209
7210 query_params.push(("signature".to_string(), signature));
7212 }
7213
7214 if !query_params.is_empty() {
7216 req_builder = req_builder.query(&query_params);
7217 }
7218
7219
7220 if let Some(ref user_agent) = configuration.user_agent {
7222 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7223 }
7224
7225 for (header_name, header_value) in header_params {
7227 req_builder = req_builder.header(&header_name, &header_value);
7228 }
7229
7230
7231 let req = req_builder.build()?;
7232 let resp = configuration.client.execute(req).await?;
7233
7234 let status = resp.status();
7235 let content_type = resp
7236 .headers()
7237 .get("content-type")
7238 .and_then(|v| v.to_str().ok())
7239 .unwrap_or("application/octet-stream");
7240 let content_type = super::ContentType::from(content_type);
7241
7242 if !status.is_client_error() && !status.is_server_error() {
7243 let content = resp.text().await?;
7244 match content_type {
7245 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7246 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetRateLimitOrderV1RespItem>`"))),
7247 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>`")))),
7248 }
7249 } else {
7250 let content = resp.text().await?;
7251 let entity: Option<GetRateLimitOrderV1Error> = serde_json::from_str(&content).ok();
7252 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7253 }
7254}
7255
7256pub async fn get_symbol_config_v1(configuration: &configuration::Configuration, params: GetSymbolConfigV1Params) -> Result<Vec<models::GetSymbolConfigV1RespItem>, Error<GetSymbolConfigV1Error>> {
7258
7259 let uri_str = format!("{}/fapi/v1/symbolConfig", configuration.base_path);
7260 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7261
7262 let mut query_params: Vec<(String, String)> = Vec::new();
7264
7265 if let Some(ref param_value) = params.symbol {
7266 query_params.push(("symbol".to_string(), param_value.to_string()));
7267 }
7268 if let Some(ref param_value) = params.recv_window {
7269 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7270 }
7271 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7272
7273 let mut header_params = std::collections::HashMap::new();
7275
7276 if let Some(ref binance_auth) = configuration.binance_auth {
7278 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7280
7281 let body_string: Option<Vec<u8>> = None;
7283
7284 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7286 Ok(sig) => sig,
7287 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7288 };
7289
7290 query_params.push(("signature".to_string(), signature));
7292 }
7293
7294 if !query_params.is_empty() {
7296 req_builder = req_builder.query(&query_params);
7297 }
7298
7299
7300 if let Some(ref user_agent) = configuration.user_agent {
7302 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7303 }
7304
7305 for (header_name, header_value) in header_params {
7307 req_builder = req_builder.header(&header_name, &header_value);
7308 }
7309
7310
7311 let req = req_builder.build()?;
7312 let resp = configuration.client.execute(req).await?;
7313
7314 let status = resp.status();
7315 let content_type = resp
7316 .headers()
7317 .get("content-type")
7318 .and_then(|v| v.to_str().ok())
7319 .unwrap_or("application/octet-stream");
7320 let content_type = super::ContentType::from(content_type);
7321
7322 if !status.is_client_error() && !status.is_server_error() {
7323 let content = resp.text().await?;
7324 match content_type {
7325 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7326 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetSymbolConfigV1RespItem>`"))),
7327 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::GetSymbolConfigV1RespItem>`")))),
7328 }
7329 } else {
7330 let content = resp.text().await?;
7331 let entity: Option<GetSymbolConfigV1Error> = serde_json::from_str(&content).ok();
7332 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7333 }
7334}
7335
7336pub async fn get_ticker24hr_v1(configuration: &configuration::Configuration, params: GetTicker24hrV1Params) -> Result<models::UmfuturesGetTicker24hrV1Resp, Error<GetTicker24hrV1Error>> {
7338
7339 let uri_str = format!("{}/fapi/v1/ticker/24hr", configuration.base_path);
7340 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7341
7342 let mut query_params: Vec<(String, String)> = Vec::new();
7344
7345 if let Some(ref param_value) = params.symbol {
7346 query_params.push(("symbol".to_string(), param_value.to_string()));
7347 }
7348
7349 let mut header_params = std::collections::HashMap::new();
7351
7352 if let Some(ref binance_auth) = configuration.binance_auth {
7354 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7356
7357 let body_string: Option<Vec<u8>> = None;
7359
7360 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7362 Ok(sig) => sig,
7363 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7364 };
7365
7366 query_params.push(("signature".to_string(), signature));
7368 }
7369
7370 if !query_params.is_empty() {
7372 req_builder = req_builder.query(&query_params);
7373 }
7374
7375
7376 if let Some(ref user_agent) = configuration.user_agent {
7378 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7379 }
7380
7381 for (header_name, header_value) in header_params {
7383 req_builder = req_builder.header(&header_name, &header_value);
7384 }
7385
7386
7387 let req = req_builder.build()?;
7388 let resp = configuration.client.execute(req).await?;
7389
7390 let status = resp.status();
7391 let content_type = resp
7392 .headers()
7393 .get("content-type")
7394 .and_then(|v| v.to_str().ok())
7395 .unwrap_or("application/octet-stream");
7396 let content_type = super::ContentType::from(content_type);
7397
7398 if !status.is_client_error() && !status.is_server_error() {
7399 let content = resp.text().await?;
7400 match content_type {
7401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetTicker24hrV1Resp`"))),
7403 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::UmfuturesGetTicker24hrV1Resp`")))),
7404 }
7405 } else {
7406 let content = resp.text().await?;
7407 let entity: Option<GetTicker24hrV1Error> = serde_json::from_str(&content).ok();
7408 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7409 }
7410}
7411
7412pub async fn get_ticker_book_ticker_v1(configuration: &configuration::Configuration, params: GetTickerBookTickerV1Params) -> Result<models::UmfuturesGetTickerBookTickerV1Resp, Error<GetTickerBookTickerV1Error>> {
7414
7415 let uri_str = format!("{}/fapi/v1/ticker/bookTicker", configuration.base_path);
7416 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7417
7418 let mut query_params: Vec<(String, String)> = Vec::new();
7420
7421 if let Some(ref param_value) = params.symbol {
7422 query_params.push(("symbol".to_string(), param_value.to_string()));
7423 }
7424
7425 let mut header_params = std::collections::HashMap::new();
7427
7428 if let Some(ref binance_auth) = configuration.binance_auth {
7430 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7432
7433 let body_string: Option<Vec<u8>> = None;
7435
7436 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7438 Ok(sig) => sig,
7439 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7440 };
7441
7442 query_params.push(("signature".to_string(), signature));
7444 }
7445
7446 if !query_params.is_empty() {
7448 req_builder = req_builder.query(&query_params);
7449 }
7450
7451
7452 if let Some(ref user_agent) = configuration.user_agent {
7454 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7455 }
7456
7457 for (header_name, header_value) in header_params {
7459 req_builder = req_builder.header(&header_name, &header_value);
7460 }
7461
7462
7463 let req = req_builder.build()?;
7464 let resp = configuration.client.execute(req).await?;
7465
7466 let status = resp.status();
7467 let content_type = resp
7468 .headers()
7469 .get("content-type")
7470 .and_then(|v| v.to_str().ok())
7471 .unwrap_or("application/octet-stream");
7472 let content_type = super::ContentType::from(content_type);
7473
7474 if !status.is_client_error() && !status.is_server_error() {
7475 let content = resp.text().await?;
7476 match content_type {
7477 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7478 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetTickerBookTickerV1Resp`"))),
7479 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::UmfuturesGetTickerBookTickerV1Resp`")))),
7480 }
7481 } else {
7482 let content = resp.text().await?;
7483 let entity: Option<GetTickerBookTickerV1Error> = serde_json::from_str(&content).ok();
7484 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7485 }
7486}
7487
7488pub async fn get_ticker_price_v1(configuration: &configuration::Configuration, params: GetTickerPriceV1Params) -> Result<models::UmfuturesGetTickerPriceV1Resp, Error<GetTickerPriceV1Error>> {
7490
7491 let uri_str = format!("{}/fapi/v1/ticker/price", configuration.base_path);
7492 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7493
7494 let mut query_params: Vec<(String, String)> = Vec::new();
7496
7497 if let Some(ref param_value) = params.symbol {
7498 query_params.push(("symbol".to_string(), param_value.to_string()));
7499 }
7500
7501 let mut header_params = std::collections::HashMap::new();
7503
7504 if let Some(ref binance_auth) = configuration.binance_auth {
7506 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7508
7509 let body_string: Option<Vec<u8>> = None;
7511
7512 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7514 Ok(sig) => sig,
7515 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7516 };
7517
7518 query_params.push(("signature".to_string(), signature));
7520 }
7521
7522 if !query_params.is_empty() {
7524 req_builder = req_builder.query(&query_params);
7525 }
7526
7527
7528 if let Some(ref user_agent) = configuration.user_agent {
7530 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7531 }
7532
7533 for (header_name, header_value) in header_params {
7535 req_builder = req_builder.header(&header_name, &header_value);
7536 }
7537
7538
7539 let req = req_builder.build()?;
7540 let resp = configuration.client.execute(req).await?;
7541
7542 let status = resp.status();
7543 let content_type = resp
7544 .headers()
7545 .get("content-type")
7546 .and_then(|v| v.to_str().ok())
7547 .unwrap_or("application/octet-stream");
7548 let content_type = super::ContentType::from(content_type);
7549
7550 if !status.is_client_error() && !status.is_server_error() {
7551 let content = resp.text().await?;
7552 match content_type {
7553 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7554 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetTickerPriceV1Resp`"))),
7555 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::UmfuturesGetTickerPriceV1Resp`")))),
7556 }
7557 } else {
7558 let content = resp.text().await?;
7559 let entity: Option<GetTickerPriceV1Error> = serde_json::from_str(&content).ok();
7560 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7561 }
7562}
7563
7564pub async fn get_ticker_price_v2(configuration: &configuration::Configuration, params: GetTickerPriceV2Params) -> Result<models::UmfuturesGetTickerPriceV2Resp, Error<GetTickerPriceV2Error>> {
7566
7567 let uri_str = format!("{}/fapi/v2/ticker/price", configuration.base_path);
7568 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7569
7570 let mut query_params: Vec<(String, String)> = Vec::new();
7572
7573 if let Some(ref param_value) = params.symbol {
7574 query_params.push(("symbol".to_string(), param_value.to_string()));
7575 }
7576
7577 let mut header_params = std::collections::HashMap::new();
7579
7580 if let Some(ref binance_auth) = configuration.binance_auth {
7582 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7584
7585 let body_string: Option<Vec<u8>> = None;
7587
7588 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7590 Ok(sig) => sig,
7591 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7592 };
7593
7594 query_params.push(("signature".to_string(), signature));
7596 }
7597
7598 if !query_params.is_empty() {
7600 req_builder = req_builder.query(&query_params);
7601 }
7602
7603
7604 if let Some(ref user_agent) = configuration.user_agent {
7606 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7607 }
7608
7609 for (header_name, header_value) in header_params {
7611 req_builder = req_builder.header(&header_name, &header_value);
7612 }
7613
7614
7615 let req = req_builder.build()?;
7616 let resp = configuration.client.execute(req).await?;
7617
7618 let status = resp.status();
7619 let content_type = resp
7620 .headers()
7621 .get("content-type")
7622 .and_then(|v| v.to_str().ok())
7623 .unwrap_or("application/octet-stream");
7624 let content_type = super::ContentType::from(content_type);
7625
7626 if !status.is_client_error() && !status.is_server_error() {
7627 let content = resp.text().await?;
7628 match content_type {
7629 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7630 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UmfuturesGetTickerPriceV2Resp`"))),
7631 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::UmfuturesGetTickerPriceV2Resp`")))),
7632 }
7633 } else {
7634 let content = resp.text().await?;
7635 let entity: Option<GetTickerPriceV2Error> = serde_json::from_str(&content).ok();
7636 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7637 }
7638}
7639
7640pub async fn get_time_v1(configuration: &configuration::Configuration) -> Result<models::GetTimeV1Resp, Error<GetTimeV1Error>> {
7642
7643 let uri_str = format!("{}/fapi/v1/time", configuration.base_path);
7644 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7645
7646 let mut query_params: Vec<(String, String)> = Vec::new();
7648
7649
7650 let mut header_params = std::collections::HashMap::new();
7652
7653 if let Some(ref binance_auth) = configuration.binance_auth {
7655 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7657
7658 let body_string: Option<Vec<u8>> = None;
7660
7661 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7663 Ok(sig) => sig,
7664 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7665 };
7666
7667 query_params.push(("signature".to_string(), signature));
7669 }
7670
7671 if !query_params.is_empty() {
7673 req_builder = req_builder.query(&query_params);
7674 }
7675
7676
7677 if let Some(ref user_agent) = configuration.user_agent {
7679 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7680 }
7681
7682 for (header_name, header_value) in header_params {
7684 req_builder = req_builder.header(&header_name, &header_value);
7685 }
7686
7687
7688 let req = req_builder.build()?;
7689 let resp = configuration.client.execute(req).await?;
7690
7691 let status = resp.status();
7692 let content_type = resp
7693 .headers()
7694 .get("content-type")
7695 .and_then(|v| v.to_str().ok())
7696 .unwrap_or("application/octet-stream");
7697 let content_type = super::ContentType::from(content_type);
7698
7699 if !status.is_client_error() && !status.is_server_error() {
7700 let content = resp.text().await?;
7701 match content_type {
7702 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7703 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTimeV1Resp`"))),
7704 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::GetTimeV1Resp`")))),
7705 }
7706 } else {
7707 let content = resp.text().await?;
7708 let entity: Option<GetTimeV1Error> = serde_json::from_str(&content).ok();
7709 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7710 }
7711}
7712
7713pub async fn get_trade_asyn_id_v1(configuration: &configuration::Configuration, params: GetTradeAsynIdV1Params) -> Result<models::GetTradeAsynIdV1Resp, Error<GetTradeAsynIdV1Error>> {
7715
7716 let uri_str = format!("{}/fapi/v1/trade/asyn/id", configuration.base_path);
7717 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7718
7719 let mut query_params: Vec<(String, String)> = Vec::new();
7721
7722 query_params.push(("downloadId".to_string(), params.download_id.to_string()));
7723 if let Some(ref param_value) = params.recv_window {
7724 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7725 }
7726 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7727
7728 let mut header_params = std::collections::HashMap::new();
7730
7731 if let Some(ref binance_auth) = configuration.binance_auth {
7733 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7735
7736 let body_string: Option<Vec<u8>> = None;
7738
7739 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7741 Ok(sig) => sig,
7742 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7743 };
7744
7745 query_params.push(("signature".to_string(), signature));
7747 }
7748
7749 if !query_params.is_empty() {
7751 req_builder = req_builder.query(&query_params);
7752 }
7753
7754
7755 if let Some(ref user_agent) = configuration.user_agent {
7757 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7758 }
7759
7760 for (header_name, header_value) in header_params {
7762 req_builder = req_builder.header(&header_name, &header_value);
7763 }
7764
7765
7766 let req = req_builder.build()?;
7767 let resp = configuration.client.execute(req).await?;
7768
7769 let status = resp.status();
7770 let content_type = resp
7771 .headers()
7772 .get("content-type")
7773 .and_then(|v| v.to_str().ok())
7774 .unwrap_or("application/octet-stream");
7775 let content_type = super::ContentType::from(content_type);
7776
7777 if !status.is_client_error() && !status.is_server_error() {
7778 let content = resp.text().await?;
7779 match content_type {
7780 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7781 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTradeAsynIdV1Resp`"))),
7782 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::GetTradeAsynIdV1Resp`")))),
7783 }
7784 } else {
7785 let content = resp.text().await?;
7786 let entity: Option<GetTradeAsynIdV1Error> = serde_json::from_str(&content).ok();
7787 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7788 }
7789}
7790
7791pub async fn get_trade_asyn_v1(configuration: &configuration::Configuration, params: GetTradeAsynV1Params) -> Result<models::GetTradeAsynV1Resp, Error<GetTradeAsynV1Error>> {
7793
7794 let uri_str = format!("{}/fapi/v1/trade/asyn", configuration.base_path);
7795 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7796
7797 let mut query_params: Vec<(String, String)> = Vec::new();
7799
7800 query_params.push(("startTime".to_string(), params.start_time.to_string()));
7801 query_params.push(("endTime".to_string(), params.end_time.to_string()));
7802 if let Some(ref param_value) = params.recv_window {
7803 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7804 }
7805 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7806
7807 let mut header_params = std::collections::HashMap::new();
7809
7810 if let Some(ref binance_auth) = configuration.binance_auth {
7812 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7814
7815 let body_string: Option<Vec<u8>> = None;
7817
7818 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7820 Ok(sig) => sig,
7821 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7822 };
7823
7824 query_params.push(("signature".to_string(), signature));
7826 }
7827
7828 if !query_params.is_empty() {
7830 req_builder = req_builder.query(&query_params);
7831 }
7832
7833
7834 if let Some(ref user_agent) = configuration.user_agent {
7836 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7837 }
7838
7839 for (header_name, header_value) in header_params {
7841 req_builder = req_builder.header(&header_name, &header_value);
7842 }
7843
7844
7845 let req = req_builder.build()?;
7846 let resp = configuration.client.execute(req).await?;
7847
7848 let status = resp.status();
7849 let content_type = resp
7850 .headers()
7851 .get("content-type")
7852 .and_then(|v| v.to_str().ok())
7853 .unwrap_or("application/octet-stream");
7854 let content_type = super::ContentType::from(content_type);
7855
7856 if !status.is_client_error() && !status.is_server_error() {
7857 let content = resp.text().await?;
7858 match content_type {
7859 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7860 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTradeAsynV1Resp`"))),
7861 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::GetTradeAsynV1Resp`")))),
7862 }
7863 } else {
7864 let content = resp.text().await?;
7865 let entity: Option<GetTradeAsynV1Error> = serde_json::from_str(&content).ok();
7866 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7867 }
7868}
7869
7870pub async fn get_trades_v1(configuration: &configuration::Configuration, params: GetTradesV1Params) -> Result<Vec<models::GetTradesV1RespItem>, Error<GetTradesV1Error>> {
7872
7873 let uri_str = format!("{}/fapi/v1/trades", configuration.base_path);
7874 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7875
7876 let mut query_params: Vec<(String, String)> = Vec::new();
7878
7879 query_params.push(("symbol".to_string(), params.symbol.to_string()));
7880 if let Some(ref param_value) = params.limit {
7881 query_params.push(("limit".to_string(), param_value.to_string()));
7882 }
7883
7884 let mut header_params = std::collections::HashMap::new();
7886
7887 if let Some(ref binance_auth) = configuration.binance_auth {
7889 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7891
7892 let body_string: Option<Vec<u8>> = None;
7894
7895 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7897 Ok(sig) => sig,
7898 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7899 };
7900
7901 query_params.push(("signature".to_string(), signature));
7903 }
7904
7905 if !query_params.is_empty() {
7907 req_builder = req_builder.query(&query_params);
7908 }
7909
7910
7911 if let Some(ref user_agent) = configuration.user_agent {
7913 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7914 }
7915
7916 for (header_name, header_value) in header_params {
7918 req_builder = req_builder.header(&header_name, &header_value);
7919 }
7920
7921
7922 let req = req_builder.build()?;
7923 let resp = configuration.client.execute(req).await?;
7924
7925 let status = resp.status();
7926 let content_type = resp
7927 .headers()
7928 .get("content-type")
7929 .and_then(|v| v.to_str().ok())
7930 .unwrap_or("application/octet-stream");
7931 let content_type = super::ContentType::from(content_type);
7932
7933 if !status.is_client_error() && !status.is_server_error() {
7934 let content = resp.text().await?;
7935 match content_type {
7936 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7937 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetTradesV1RespItem>`"))),
7938 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::GetTradesV1RespItem>`")))),
7939 }
7940 } else {
7941 let content = resp.text().await?;
7942 let entity: Option<GetTradesV1Error> = serde_json::from_str(&content).ok();
7943 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7944 }
7945}
7946
7947pub async fn get_user_trades_v1(configuration: &configuration::Configuration, params: GetUserTradesV1Params) -> Result<Vec<models::GetUserTradesV1RespItem>, Error<GetUserTradesV1Error>> {
7949
7950 let uri_str = format!("{}/fapi/v1/userTrades", configuration.base_path);
7951 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
7952
7953 let mut query_params: Vec<(String, String)> = Vec::new();
7955
7956 query_params.push(("symbol".to_string(), params.symbol.to_string()));
7957 if let Some(ref param_value) = params.order_id {
7958 query_params.push(("orderId".to_string(), param_value.to_string()));
7959 }
7960 if let Some(ref param_value) = params.start_time {
7961 query_params.push(("startTime".to_string(), param_value.to_string()));
7962 }
7963 if let Some(ref param_value) = params.end_time {
7964 query_params.push(("endTime".to_string(), param_value.to_string()));
7965 }
7966 if let Some(ref param_value) = params.from_id {
7967 query_params.push(("fromId".to_string(), param_value.to_string()));
7968 }
7969 if let Some(ref param_value) = params.limit {
7970 query_params.push(("limit".to_string(), param_value.to_string()));
7971 }
7972 if let Some(ref param_value) = params.recv_window {
7973 query_params.push(("recvWindow".to_string(), param_value.to_string()));
7974 }
7975 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
7976
7977 let mut header_params = std::collections::HashMap::new();
7979
7980 if let Some(ref binance_auth) = configuration.binance_auth {
7982 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7984
7985 let body_string: Option<Vec<u8>> = None;
7987
7988 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
7990 Ok(sig) => sig,
7991 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
7992 };
7993
7994 query_params.push(("signature".to_string(), signature));
7996 }
7997
7998 if !query_params.is_empty() {
8000 req_builder = req_builder.query(&query_params);
8001 }
8002
8003
8004 if let Some(ref user_agent) = configuration.user_agent {
8006 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8007 }
8008
8009 for (header_name, header_value) in header_params {
8011 req_builder = req_builder.header(&header_name, &header_value);
8012 }
8013
8014
8015 let req = req_builder.build()?;
8016 let resp = configuration.client.execute(req).await?;
8017
8018 let status = resp.status();
8019 let content_type = resp
8020 .headers()
8021 .get("content-type")
8022 .and_then(|v| v.to_str().ok())
8023 .unwrap_or("application/octet-stream");
8024 let content_type = super::ContentType::from(content_type);
8025
8026 if !status.is_client_error() && !status.is_server_error() {
8027 let content = resp.text().await?;
8028 match content_type {
8029 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8030 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetUserTradesV1RespItem>`"))),
8031 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::GetUserTradesV1RespItem>`")))),
8032 }
8033 } else {
8034 let content = resp.text().await?;
8035 let entity: Option<GetUserTradesV1Error> = serde_json::from_str(&content).ok();
8036 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8037 }
8038}
8039
8040pub async fn update_batch_orders_v1(configuration: &configuration::Configuration, params: UpdateBatchOrdersV1Params) -> Result<Vec<models::UmfuturesUpdateBatchOrdersV1RespItem>, Error<UpdateBatchOrdersV1Error>> {
8042
8043 let uri_str = format!("{}/fapi/v1/batchOrders", configuration.base_path);
8044 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
8045
8046 let mut query_params: Vec<(String, String)> = Vec::new();
8048
8049
8050 let mut header_params = std::collections::HashMap::new();
8052
8053 if let Some(ref binance_auth) = configuration.binance_auth {
8055 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8057
8058 let body_string: Option<Vec<u8>> = None;
8060
8061 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8063 Ok(sig) => sig,
8064 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8065 };
8066
8067 query_params.push(("signature".to_string(), signature));
8069 }
8070
8071 if !query_params.is_empty() {
8073 req_builder = req_builder.query(&query_params);
8074 }
8075
8076
8077 if let Some(ref user_agent) = configuration.user_agent {
8079 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8080 }
8081
8082 for (header_name, header_value) in header_params {
8084 req_builder = req_builder.header(&header_name, &header_value);
8085 }
8086
8087 let mut multipart_form_params = std::collections::HashMap::new();
8088 multipart_form_params.insert("batchOrders", params.batch_orders.into_iter().map(|p| serde_json::to_string(&p).unwrap_or_default()).collect::<Vec<String>>().join(",").to_string());
8089 if let Some(param_value) = params.recv_window {
8090 multipart_form_params.insert("recvWindow", param_value.to_string());
8091 }
8092 multipart_form_params.insert("timestamp", params.timestamp.to_string());
8093 req_builder = req_builder.form(&multipart_form_params);
8094
8095 let req = req_builder.build()?;
8096 let resp = configuration.client.execute(req).await?;
8097
8098 let status = resp.status();
8099 let content_type = resp
8100 .headers()
8101 .get("content-type")
8102 .and_then(|v| v.to_str().ok())
8103 .unwrap_or("application/octet-stream");
8104 let content_type = super::ContentType::from(content_type);
8105
8106 if !status.is_client_error() && !status.is_server_error() {
8107 let content = resp.text().await?;
8108 match content_type {
8109 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8110 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UmfuturesUpdateBatchOrdersV1RespItem>`"))),
8111 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::UmfuturesUpdateBatchOrdersV1RespItem>`")))),
8112 }
8113 } else {
8114 let content = resp.text().await?;
8115 let entity: Option<UpdateBatchOrdersV1Error> = serde_json::from_str(&content).ok();
8116 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8117 }
8118}
8119
8120pub async fn update_listen_key_v1(configuration: &configuration::Configuration) -> Result<models::UpdateListenKeyV1Resp, Error<UpdateListenKeyV1Error>> {
8122
8123 let uri_str = format!("{}/fapi/v1/listenKey", configuration.base_path);
8124 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
8125
8126 let mut query_params: Vec<(String, String)> = Vec::new();
8128
8129
8130 let mut header_params = std::collections::HashMap::new();
8132
8133 if let Some(ref binance_auth) = configuration.binance_auth {
8135 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8137
8138 let body_string: Option<Vec<u8>> = None;
8140
8141 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8143 Ok(sig) => sig,
8144 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8145 };
8146
8147 query_params.push(("signature".to_string(), signature));
8149 }
8150
8151 if !query_params.is_empty() {
8153 req_builder = req_builder.query(&query_params);
8154 }
8155
8156
8157 if let Some(ref user_agent) = configuration.user_agent {
8159 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8160 }
8161
8162 for (header_name, header_value) in header_params {
8164 req_builder = req_builder.header(&header_name, &header_value);
8165 }
8166
8167
8168 let req = req_builder.build()?;
8169 let resp = configuration.client.execute(req).await?;
8170
8171 let status = resp.status();
8172 let content_type = resp
8173 .headers()
8174 .get("content-type")
8175 .and_then(|v| v.to_str().ok())
8176 .unwrap_or("application/octet-stream");
8177 let content_type = super::ContentType::from(content_type);
8178
8179 if !status.is_client_error() && !status.is_server_error() {
8180 let content = resp.text().await?;
8181 match content_type {
8182 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8183 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateListenKeyV1Resp`"))),
8184 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::UpdateListenKeyV1Resp`")))),
8185 }
8186 } else {
8187 let content = resp.text().await?;
8188 let entity: Option<UpdateListenKeyV1Error> = serde_json::from_str(&content).ok();
8189 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8190 }
8191}
8192
8193pub async fn update_order_v1(configuration: &configuration::Configuration, params: UpdateOrderV1Params) -> Result<models::UpdateOrderV1Resp, Error<UpdateOrderV1Error>> {
8195
8196 let uri_str = format!("{}/fapi/v1/order", configuration.base_path);
8197 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
8198
8199 let mut query_params: Vec<(String, String)> = Vec::new();
8201
8202
8203 let mut header_params = std::collections::HashMap::new();
8205
8206 if let Some(ref binance_auth) = configuration.binance_auth {
8208 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8210
8211 let body_string: Option<Vec<u8>> = None;
8213
8214 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
8216 Ok(sig) => sig,
8217 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
8218 };
8219
8220 query_params.push(("signature".to_string(), signature));
8222 }
8223
8224 if !query_params.is_empty() {
8226 req_builder = req_builder.query(&query_params);
8227 }
8228
8229
8230 if let Some(ref user_agent) = configuration.user_agent {
8232 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8233 }
8234
8235 for (header_name, header_value) in header_params {
8237 req_builder = req_builder.header(&header_name, &header_value);
8238 }
8239
8240 let mut multipart_form_params = std::collections::HashMap::new();
8241 if let Some(param_value) = params.order_id {
8242 multipart_form_params.insert("orderId", param_value.to_string());
8243 }
8244 if let Some(param_value) = params.orig_client_order_id {
8245 multipart_form_params.insert("origClientOrderId", param_value.to_string());
8246 }
8247 multipart_form_params.insert("price", params.price.to_string());
8248 if let Some(param_value) = params.price_match {
8249 multipart_form_params.insert("priceMatch", param_value.to_string());
8250 }
8251 multipart_form_params.insert("quantity", params.quantity.to_string());
8252 if let Some(param_value) = params.recv_window {
8253 multipart_form_params.insert("recvWindow", param_value.to_string());
8254 }
8255 multipart_form_params.insert("side", params.side.to_string());
8256 multipart_form_params.insert("symbol", params.symbol.to_string());
8257 multipart_form_params.insert("timestamp", params.timestamp.to_string());
8258 req_builder = req_builder.form(&multipart_form_params);
8259
8260 let req = req_builder.build()?;
8261 let resp = configuration.client.execute(req).await?;
8262
8263 let status = resp.status();
8264 let content_type = resp
8265 .headers()
8266 .get("content-type")
8267 .and_then(|v| v.to_str().ok())
8268 .unwrap_or("application/octet-stream");
8269 let content_type = super::ContentType::from(content_type);
8270
8271 if !status.is_client_error() && !status.is_server_error() {
8272 let content = resp.text().await?;
8273 match content_type {
8274 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8275 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateOrderV1Resp`"))),
8276 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::UpdateOrderV1Resp`")))),
8277 }
8278 } else {
8279 let content = resp.text().await?;
8280 let entity: Option<UpdateOrderV1Error> = serde_json::from_str(&content).ok();
8281 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8282 }
8283}
8284