binance/umfutures/apis/
futures_api.rs

1/*
2 * Binance USD-M Futures API
3 *
4 * OpenAPI specification for Binance exchange - Umfutures API
5 *
6 * The version of the OpenAPI document: 0.2.2
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::umfutures::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`create_batch_orders_v1`]
18#[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/// struct for passing parameters to the method [`create_convert_accept_quote_v1`]
26#[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/// struct for passing parameters to the method [`create_convert_get_quote_v1`]
34#[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/// struct for passing parameters to the method [`create_countdown_cancel_all_v1`]
46#[derive(Clone, Debug, Default)]
47pub struct CreateCountdownCancelAllV1Params {
48    pub umfutures_create_countdown_cancel_all_v1_req: Option<models::UmfuturesCreateCountdownCancelAllV1Req>
49}
50
51/// struct for passing parameters to the method [`create_fee_burn_v1`]
52#[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/// struct for passing parameters to the method [`create_leverage_v1`]
60#[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/// struct for passing parameters to the method [`create_margin_type_v1`]
69#[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/// struct for passing parameters to the method [`create_multi_assets_margin_v1`]
78#[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/// struct for passing parameters to the method [`create_order_test_v1`]
86#[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/// struct for passing parameters to the method [`create_order_v1`]
112#[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/// struct for passing parameters to the method [`create_position_margin_v1`]
138#[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/// struct for passing parameters to the method [`create_position_side_dual_v1`]
149#[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/// struct for passing parameters to the method [`delete_all_open_orders_v1`]
157#[derive(Clone, Debug, Default)]
158pub struct DeleteAllOpenOrdersV1Params {
159    pub symbol: String,
160    pub timestamp: i64,
161    pub recv_window: Option<i64>
162}
163
164/// struct for passing parameters to the method [`delete_batch_orders_v1`]
165#[derive(Clone, Debug, Default)]
166pub struct DeleteBatchOrdersV1Params {
167    pub symbol: String,
168    pub timestamp: i64,
169    /// max length 10 <br/> e.g. [1234567,2345678]
170    pub order_id_list: Option<Vec<i64>>,
171    /// max length 10<br/> e.g. [&#34;my_id_1&#34;,&#34;my_id_2&#34;], encode the double quotes. No space after comma.
172    pub orig_client_order_id_list: Option<Vec<String>>,
173    pub recv_window: Option<i64>
174}
175
176/// struct for passing parameters to the method [`delete_order_v1`]
177#[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/// struct for passing parameters to the method [`get_account_config_v1`]
187#[derive(Clone, Debug, Default)]
188pub struct GetAccountConfigV1Params {
189    pub timestamp: i64,
190    pub recv_window: Option<i64>
191}
192
193/// struct for passing parameters to the method [`get_account_v2`]
194#[derive(Clone, Debug, Default)]
195pub struct GetAccountV2Params {
196    pub timestamp: i64,
197    pub recv_window: Option<i64>
198}
199
200/// struct for passing parameters to the method [`get_account_v3`]
201#[derive(Clone, Debug, Default)]
202pub struct GetAccountV3Params {
203    pub timestamp: i64,
204    pub recv_window: Option<i64>
205}
206
207/// struct for passing parameters to the method [`get_adl_quantile_v1`]
208#[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/// struct for passing parameters to the method [`get_agg_trades_v1`]
216#[derive(Clone, Debug, Default)]
217pub struct GetAggTradesV1Params {
218    pub symbol: String,
219    /// ID to get aggregate trades from INCLUSIVE.
220    pub from_id: Option<i64>,
221    /// Timestamp in ms to get aggregate trades from INCLUSIVE.
222    pub start_time: Option<i64>,
223    /// Timestamp in ms to get aggregate trades until INCLUSIVE.
224    pub end_time: Option<i64>,
225    /// Default 500; max 1000.
226    pub limit: Option<i32>
227}
228
229/// struct for passing parameters to the method [`get_all_orders_v1`]
230#[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    /// Default 500; max 1000.
238    pub limit: Option<i32>,
239    pub recv_window: Option<i64>
240}
241
242/// struct for passing parameters to the method [`get_api_trading_status_v1`]
243#[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/// struct for passing parameters to the method [`get_asset_index_v1`]
251#[derive(Clone, Debug, Default)]
252pub struct GetAssetIndexV1Params {
253    /// Asset pair
254    pub symbol: Option<String>
255}
256
257/// struct for passing parameters to the method [`get_balance_v2`]
258#[derive(Clone, Debug, Default)]
259pub struct GetBalanceV2Params {
260    pub timestamp: i64,
261    pub recv_window: Option<i64>
262}
263
264/// struct for passing parameters to the method [`get_balance_v3`]
265#[derive(Clone, Debug, Default)]
266pub struct GetBalanceV3Params {
267    pub timestamp: i64,
268    pub recv_window: Option<i64>
269}
270
271/// struct for passing parameters to the method [`get_commission_rate_v1`]
272#[derive(Clone, Debug, Default)]
273pub struct GetCommissionRateV1Params {
274    pub symbol: String,
275    pub timestamp: i64,
276    pub recv_window: Option<i64>
277}
278
279/// struct for passing parameters to the method [`get_constituents_v1`]
280#[derive(Clone, Debug, Default)]
281pub struct GetConstituentsV1Params {
282    pub symbol: String
283}
284
285/// struct for passing parameters to the method [`get_continuous_klines_v1`]
286#[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    /// Default 500; max 1500.
294    pub limit: Option<i32>
295}
296
297/// struct for passing parameters to the method [`get_convert_exchange_info_v1`]
298#[derive(Clone, Debug, Default)]
299pub struct GetConvertExchangeInfoV1Params {
300    /// User spends coin
301    pub from_asset: Option<String>,
302    /// User receives coin
303    pub to_asset: Option<String>
304}
305
306/// struct for passing parameters to the method [`get_convert_order_status_v1`]
307#[derive(Clone, Debug, Default)]
308pub struct GetConvertOrderStatusV1Params {
309    /// Either orderId or quoteId is required
310    pub order_id: Option<String>,
311    /// Either orderId or quoteId is required
312    pub quote_id: Option<String>
313}
314
315/// struct for passing parameters to the method [`get_depth_v1`]
316#[derive(Clone, Debug, Default)]
317pub struct GetDepthV1Params {
318    pub symbol: String,
319    /// Default 500; Valid limits:[5, 10, 20, 50, 100, 500, 1000]
320    pub limit: Option<i32>
321}
322
323/// struct for passing parameters to the method [`get_fee_burn_v1`]
324#[derive(Clone, Debug, Default)]
325pub struct GetFeeBurnV1Params {
326    pub timestamp: i64,
327    pub recv_window: Option<i64>
328}
329
330/// struct for passing parameters to the method [`get_force_orders_v1`]
331#[derive(Clone, Debug, Default)]
332pub struct GetForceOrdersV1Params {
333    pub timestamp: i64,
334    pub symbol: Option<String>,
335    /// &#34;LIQUIDATION&#34; for liquidation orders, &#34;ADL&#34; for ADL orders.
336    pub auto_close_type: Option<String>,
337    pub start_time: Option<i64>,
338    pub end_time: Option<i64>,
339    /// Default 50; max 100.
340    pub limit: Option<i32>,
341    pub recv_window: Option<i64>
342}
343
344/// struct for passing parameters to the method [`get_funding_rate_v1`]
345#[derive(Clone, Debug, Default)]
346pub struct GetFundingRateV1Params {
347    pub symbol: Option<String>,
348    /// Timestamp in ms to get funding rate from INCLUSIVE.
349    pub start_time: Option<i64>,
350    /// Timestamp in ms to get funding rate  until INCLUSIVE.
351    pub end_time: Option<i64>,
352    /// Default 100; max 1000
353    pub limit: Option<i32>
354}
355
356/// struct for passing parameters to the method [`get_futures_data_basis`]
357#[derive(Clone, Debug, Default)]
358pub struct GetFuturesDataBasisParams {
359    /// BTCUSDT
360    pub pair: String,
361    /// CURRENT_QUARTER, NEXT_QUARTER, PERPETUAL
362    pub contract_type: String,
363    /// &#34;5m&#34;,&#34;15m&#34;,&#34;30m&#34;,&#34;1h&#34;,&#34;2h&#34;,&#34;4h&#34;,&#34;6h&#34;,&#34;12h&#34;,&#34;1d&#34;
364    pub period: String,
365    /// Default 30,Max 500
366    pub limit: i64,
367    pub start_time: Option<i64>,
368    pub end_time: Option<i64>
369}
370
371/// struct for passing parameters to the method [`get_futures_data_delivery_price`]
372#[derive(Clone, Debug, Default)]
373pub struct GetFuturesDataDeliveryPriceParams {
374    /// e.g BTCUSDT
375    pub pair: String
376}
377
378/// struct for passing parameters to the method [`get_futures_data_global_long_short_account_ratio`]
379#[derive(Clone, Debug, Default)]
380pub struct GetFuturesDataGlobalLongShortAccountRatioParams {
381    pub symbol: String,
382    /// &#34;5m&#34;,&#34;15m&#34;,&#34;30m&#34;,&#34;1h&#34;,&#34;2h&#34;,&#34;4h&#34;,&#34;6h&#34;,&#34;12h&#34;,&#34;1d&#34;
383    pub period: String,
384    /// default 30, max 500
385    pub limit: Option<i64>,
386    pub start_time: Option<i64>,
387    pub end_time: Option<i64>
388}
389
390/// struct for passing parameters to the method [`get_futures_data_open_interest_hist`]
391#[derive(Clone, Debug, Default)]
392pub struct GetFuturesDataOpenInterestHistParams {
393    pub symbol: String,
394    /// &#34;5m&#34;,&#34;15m&#34;,&#34;30m&#34;,&#34;1h&#34;,&#34;2h&#34;,&#34;4h&#34;,&#34;6h&#34;,&#34;12h&#34;,&#34;1d&#34;
395    pub period: String,
396    /// default 30, max 500
397    pub limit: Option<i64>,
398    pub start_time: Option<i64>,
399    pub end_time: Option<i64>
400}
401
402/// struct for passing parameters to the method [`get_futures_data_takerlongshort_ratio`]
403#[derive(Clone, Debug, Default)]
404pub struct GetFuturesDataTakerlongshortRatioParams {
405    pub symbol: String,
406    /// &#34;5m&#34;,&#34;15m&#34;,&#34;30m&#34;,&#34;1h&#34;,&#34;2h&#34;,&#34;4h&#34;,&#34;6h&#34;,&#34;12h&#34;,&#34;1d&#34;
407    pub period: String,
408    /// default 30, max 500
409    pub limit: Option<i64>,
410    pub start_time: Option<i64>,
411    pub end_time: Option<i64>
412}
413
414/// struct for passing parameters to the method [`get_futures_data_top_long_short_account_ratio`]
415#[derive(Clone, Debug, Default)]
416pub struct GetFuturesDataTopLongShortAccountRatioParams {
417    pub symbol: String,
418    /// &#34;5m&#34;,&#34;15m&#34;,&#34;30m&#34;,&#34;1h&#34;,&#34;2h&#34;,&#34;4h&#34;,&#34;6h&#34;,&#34;12h&#34;,&#34;1d&#34;
419    pub period: String,
420    /// default 30, max 500
421    pub limit: Option<i64>,
422    pub start_time: Option<i64>,
423    pub end_time: Option<i64>
424}
425
426/// struct for passing parameters to the method [`get_futures_data_top_long_short_position_ratio`]
427#[derive(Clone, Debug, Default)]
428pub struct GetFuturesDataTopLongShortPositionRatioParams {
429    pub symbol: String,
430    /// &#34;5m&#34;,&#34;15m&#34;,&#34;30m&#34;,&#34;1h&#34;,&#34;2h&#34;,&#34;4h&#34;,&#34;6h&#34;,&#34;12h&#34;,&#34;1d&#34;
431    pub period: String,
432    /// default 30, max 500
433    pub limit: Option<i64>,
434    pub start_time: Option<i64>,
435    pub end_time: Option<i64>
436}
437
438/// struct for passing parameters to the method [`get_historical_trades_v1`]
439#[derive(Clone, Debug, Default)]
440pub struct GetHistoricalTradesV1Params {
441    pub symbol: String,
442    /// Default 100; max 500.
443    pub limit: Option<i32>,
444    /// TradeId to fetch from. Default gets most recent trades.
445    pub from_id: Option<i64>
446}
447
448/// struct for passing parameters to the method [`get_income_asyn_id_v1`]
449#[derive(Clone, Debug, Default)]
450pub struct GetIncomeAsynIdV1Params {
451    /// get by download id api
452    pub download_id: String,
453    pub timestamp: i64,
454    pub recv_window: Option<i64>
455}
456
457/// struct for passing parameters to the method [`get_income_asyn_v1`]
458#[derive(Clone, Debug, Default)]
459pub struct GetIncomeAsynV1Params {
460    /// Timestamp in ms
461    pub start_time: i64,
462    /// Timestamp in ms
463    pub end_time: i64,
464    pub timestamp: i64,
465    pub recv_window: Option<i64>
466}
467
468/// struct for passing parameters to the method [`get_index_info_v1`]
469#[derive(Clone, Debug, Default)]
470pub struct GetIndexInfoV1Params {
471    pub symbol: Option<String>
472}
473
474/// struct for passing parameters to the method [`get_index_price_klines_v1`]
475#[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    /// Default 500; max 1500.
482    pub limit: Option<i32>
483}
484
485/// struct for passing parameters to the method [`get_klines_v1`]
486#[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    /// Default 500; max 1500.
493    pub limit: Option<i32>
494}
495
496/// struct for passing parameters to the method [`get_leverage_bracket_v1`]
497#[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/// struct for passing parameters to the method [`get_mark_price_klines_v1`]
505#[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    /// Default 500; max 1500.
512    pub limit: Option<i32>
513}
514
515/// struct for passing parameters to the method [`get_multi_assets_margin_v1`]
516#[derive(Clone, Debug, Default)]
517pub struct GetMultiAssetsMarginV1Params {
518    pub timestamp: i64,
519    pub recv_window: Option<i64>
520}
521
522/// struct for passing parameters to the method [`get_open_interest_v1`]
523#[derive(Clone, Debug, Default)]
524pub struct GetOpenInterestV1Params {
525    pub symbol: String
526}
527
528/// struct for passing parameters to the method [`get_open_order_v1`]
529#[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/// struct for passing parameters to the method [`get_open_orders_v1`]
539#[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/// struct for passing parameters to the method [`get_order_amendment_v1`]
547#[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    /// Timestamp in ms to get modification history from INCLUSIVE
554    pub start_time: Option<i64>,
555    /// Timestamp in ms to get modification history until INCLUSIVE
556    pub end_time: Option<i64>,
557    /// Default 50; max 100
558    pub limit: Option<i32>,
559    pub recv_window: Option<i64>
560}
561
562/// struct for passing parameters to the method [`get_order_asyn_id_v1`]
563#[derive(Clone, Debug, Default)]
564pub struct GetOrderAsynIdV1Params {
565    /// get by download id api
566    pub download_id: String,
567    pub timestamp: i64,
568    pub recv_window: Option<i64>
569}
570
571/// struct for passing parameters to the method [`get_order_asyn_v1`]
572#[derive(Clone, Debug, Default)]
573pub struct GetOrderAsynV1Params {
574    /// Timestamp in ms
575    pub start_time: i64,
576    /// Timestamp in ms
577    pub end_time: i64,
578    pub timestamp: i64,
579    pub recv_window: Option<i64>
580}
581
582/// struct for passing parameters to the method [`get_order_v1`]
583#[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/// struct for passing parameters to the method [`get_pm_account_info_v1`]
593#[derive(Clone, Debug, Default)]
594pub struct GetPmAccountInfoV1Params {
595    pub asset: String,
596    pub timestamp: i64,
597    pub recv_window: Option<i64>
598}
599
600/// struct for passing parameters to the method [`get_position_margin_history_v1`]
601#[derive(Clone, Debug, Default)]
602pub struct GetPositionMarginHistoryV1Params {
603    pub symbol: String,
604    pub timestamp: i64,
605    /// 1: Add position margin,2: Reduce position margin
606    pub r#type: Option<i32>,
607    pub start_time: Option<i64>,
608    /// Default current time if not pass
609    pub end_time: Option<i64>,
610    /// Default: 500
611    pub limit: Option<i32>,
612    pub recv_window: Option<i64>
613}
614
615/// struct for passing parameters to the method [`get_position_risk_v2`]
616#[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/// struct for passing parameters to the method [`get_position_risk_v3`]
624#[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/// struct for passing parameters to the method [`get_position_side_dual_v1`]
632#[derive(Clone, Debug, Default)]
633pub struct GetPositionSideDualV1Params {
634    pub timestamp: i64,
635    pub recv_window: Option<i64>
636}
637
638/// struct for passing parameters to the method [`get_premium_index_klines_v1`]
639#[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    /// Default 500; max 1500.
646    pub limit: Option<i32>
647}
648
649/// struct for passing parameters to the method [`get_premium_index_v1`]
650#[derive(Clone, Debug, Default)]
651pub struct GetPremiumIndexV1Params {
652    pub symbol: Option<String>
653}
654
655/// struct for passing parameters to the method [`get_rate_limit_order_v1`]
656#[derive(Clone, Debug, Default)]
657pub struct GetRateLimitOrderV1Params {
658    pub timestamp: i64,
659    pub recv_window: Option<i64>
660}
661
662/// struct for passing parameters to the method [`get_symbol_config_v1`]
663#[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/// struct for passing parameters to the method [`get_ticker24hr_v1`]
671#[derive(Clone, Debug, Default)]
672pub struct GetTicker24hrV1Params {
673    pub symbol: Option<String>
674}
675
676/// struct for passing parameters to the method [`get_ticker_book_ticker_v1`]
677#[derive(Clone, Debug, Default)]
678pub struct GetTickerBookTickerV1Params {
679    pub symbol: Option<String>
680}
681
682/// struct for passing parameters to the method [`get_ticker_price_v1`]
683#[derive(Clone, Debug, Default)]
684pub struct GetTickerPriceV1Params {
685    pub symbol: Option<String>
686}
687
688/// struct for passing parameters to the method [`get_ticker_price_v2`]
689#[derive(Clone, Debug, Default)]
690pub struct GetTickerPriceV2Params {
691    pub symbol: Option<String>
692}
693
694/// struct for passing parameters to the method [`get_trade_asyn_id_v1`]
695#[derive(Clone, Debug, Default)]
696pub struct GetTradeAsynIdV1Params {
697    /// get by download id api
698    pub download_id: String,
699    pub timestamp: i64,
700    pub recv_window: Option<i64>
701}
702
703/// struct for passing parameters to the method [`get_trade_asyn_v1`]
704#[derive(Clone, Debug, Default)]
705pub struct GetTradeAsynV1Params {
706    /// Timestamp in ms
707    pub start_time: i64,
708    /// Timestamp in ms
709    pub end_time: i64,
710    pub timestamp: i64,
711    pub recv_window: Option<i64>
712}
713
714/// struct for passing parameters to the method [`get_trades_v1`]
715#[derive(Clone, Debug, Default)]
716pub struct GetTradesV1Params {
717    pub symbol: String,
718    /// Default 500; max 1000.
719    pub limit: Option<i32>
720}
721
722/// struct for passing parameters to the method [`get_user_trades_v1`]
723#[derive(Clone, Debug, Default)]
724pub struct GetUserTradesV1Params {
725    pub symbol: String,
726    pub timestamp: i64,
727    /// This can only be used in combination with `symbol`
728    pub order_id: Option<i64>,
729    pub start_time: Option<i64>,
730    pub end_time: Option<i64>,
731    /// Trade id to fetch from. Default gets most recent trades.
732    pub from_id: Option<i64>,
733    /// Default 500; max 1000.
734    pub limit: Option<i32>,
735    pub recv_window: Option<i64>
736}
737
738/// struct for passing parameters to the method [`update_batch_orders_v1`]
739#[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/// struct for passing parameters to the method [`update_order_v1`]
747#[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/// struct for typed errors of method [`create_batch_orders_v1`]
762#[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/// struct for typed errors of method [`create_convert_accept_quote_v1`]
771#[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/// struct for typed errors of method [`create_convert_get_quote_v1`]
780#[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/// struct for typed errors of method [`create_countdown_cancel_all_v1`]
789#[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/// struct for typed errors of method [`create_fee_burn_v1`]
798#[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/// struct for typed errors of method [`create_leverage_v1`]
807#[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/// struct for typed errors of method [`create_listen_key_v1`]
816#[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/// struct for typed errors of method [`create_margin_type_v1`]
825#[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/// struct for typed errors of method [`create_multi_assets_margin_v1`]
834#[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/// struct for typed errors of method [`create_order_test_v1`]
843#[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/// struct for typed errors of method [`create_order_v1`]
852#[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/// struct for typed errors of method [`create_position_margin_v1`]
861#[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/// struct for typed errors of method [`create_position_side_dual_v1`]
870#[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/// struct for typed errors of method [`delete_all_open_orders_v1`]
879#[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/// struct for typed errors of method [`delete_batch_orders_v1`]
888#[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/// struct for typed errors of method [`delete_listen_key_v1`]
897#[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/// struct for typed errors of method [`delete_order_v1`]
906#[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/// struct for typed errors of method [`get_account_config_v1`]
915#[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/// struct for typed errors of method [`get_account_v2`]
924#[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/// struct for typed errors of method [`get_account_v3`]
933#[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/// struct for typed errors of method [`get_adl_quantile_v1`]
942#[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/// struct for typed errors of method [`get_agg_trades_v1`]
951#[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/// struct for typed errors of method [`get_all_orders_v1`]
960#[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/// struct for typed errors of method [`get_api_trading_status_v1`]
969#[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/// struct for typed errors of method [`get_asset_index_v1`]
978#[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/// struct for typed errors of method [`get_balance_v2`]
987#[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/// struct for typed errors of method [`get_balance_v3`]
996#[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/// struct for typed errors of method [`get_commission_rate_v1`]
1005#[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/// struct for typed errors of method [`get_constituents_v1`]
1014#[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/// struct for typed errors of method [`get_continuous_klines_v1`]
1023#[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/// struct for typed errors of method [`get_convert_exchange_info_v1`]
1032#[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/// struct for typed errors of method [`get_convert_order_status_v1`]
1041#[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/// struct for typed errors of method [`get_depth_v1`]
1050#[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/// struct for typed errors of method [`get_exchange_info_v1`]
1059#[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/// struct for typed errors of method [`get_fee_burn_v1`]
1068#[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/// struct for typed errors of method [`get_force_orders_v1`]
1077#[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/// struct for typed errors of method [`get_funding_info_v1`]
1086#[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/// struct for typed errors of method [`get_funding_rate_v1`]
1095#[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/// struct for typed errors of method [`get_futures_data_basis`]
1104#[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/// struct for typed errors of method [`get_futures_data_delivery_price`]
1113#[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/// struct for typed errors of method [`get_futures_data_global_long_short_account_ratio`]
1122#[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/// struct for typed errors of method [`get_futures_data_open_interest_hist`]
1131#[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/// struct for typed errors of method [`get_futures_data_takerlongshort_ratio`]
1140#[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/// struct for typed errors of method [`get_futures_data_top_long_short_account_ratio`]
1149#[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/// struct for typed errors of method [`get_futures_data_top_long_short_position_ratio`]
1158#[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/// struct for typed errors of method [`get_historical_trades_v1`]
1167#[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/// struct for typed errors of method [`get_income_asyn_id_v1`]
1176#[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/// struct for typed errors of method [`get_income_asyn_v1`]
1185#[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/// struct for typed errors of method [`get_index_info_v1`]
1194#[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/// struct for typed errors of method [`get_index_price_klines_v1`]
1203#[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/// struct for typed errors of method [`get_klines_v1`]
1212#[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/// struct for typed errors of method [`get_leverage_bracket_v1`]
1221#[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/// struct for typed errors of method [`get_mark_price_klines_v1`]
1230#[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/// struct for typed errors of method [`get_multi_assets_margin_v1`]
1239#[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/// struct for typed errors of method [`get_open_interest_v1`]
1248#[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/// struct for typed errors of method [`get_open_order_v1`]
1257#[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/// struct for typed errors of method [`get_open_orders_v1`]
1266#[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/// struct for typed errors of method [`get_order_amendment_v1`]
1275#[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/// struct for typed errors of method [`get_order_asyn_id_v1`]
1284#[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/// struct for typed errors of method [`get_order_asyn_v1`]
1293#[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/// struct for typed errors of method [`get_order_v1`]
1302#[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/// struct for typed errors of method [`get_ping_v1`]
1311#[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/// struct for typed errors of method [`get_pm_account_info_v1`]
1320#[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/// struct for typed errors of method [`get_position_margin_history_v1`]
1329#[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/// struct for typed errors of method [`get_position_risk_v2`]
1338#[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/// struct for typed errors of method [`get_position_risk_v3`]
1347#[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/// struct for typed errors of method [`get_position_side_dual_v1`]
1356#[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/// struct for typed errors of method [`get_premium_index_klines_v1`]
1365#[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/// struct for typed errors of method [`get_premium_index_v1`]
1374#[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/// struct for typed errors of method [`get_rate_limit_order_v1`]
1383#[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/// struct for typed errors of method [`get_symbol_config_v1`]
1392#[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/// struct for typed errors of method [`get_ticker24hr_v1`]
1401#[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/// struct for typed errors of method [`get_ticker_book_ticker_v1`]
1410#[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/// struct for typed errors of method [`get_ticker_price_v1`]
1419#[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/// struct for typed errors of method [`get_ticker_price_v2`]
1428#[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/// struct for typed errors of method [`get_time_v1`]
1437#[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/// struct for typed errors of method [`get_trade_asyn_id_v1`]
1446#[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/// struct for typed errors of method [`get_trade_asyn_v1`]
1455#[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/// struct for typed errors of method [`get_trades_v1`]
1464#[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/// struct for typed errors of method [`get_user_trades_v1`]
1473#[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/// struct for typed errors of method [`update_batch_orders_v1`]
1482#[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/// struct for typed errors of method [`update_listen_key_v1`]
1491#[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/// struct for typed errors of method [`update_order_v1`]
1500#[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
1509/// Place Multiple Orders
1510pub 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    // Create a mutable vector for query parameters
1516    let mut query_params: Vec<(String, String)> = Vec::new();
1517
1518
1519    // Create header parameters collection
1520    let mut header_params = std::collections::HashMap::new();
1521
1522    // Handle Binance Auth first if configured
1523    if let Some(ref binance_auth) = configuration.binance_auth {
1524        // Add API key to headers
1525        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1526        
1527        // Generate request body for signing (if any)
1528        let body_string: Option<Vec<u8>> = None;
1529        
1530        // Sign the request
1531        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        // Add signature to query params
1537        query_params.push(("signature".to_string(), signature));
1538    }
1539
1540    // Apply all query parameters
1541    if !query_params.is_empty() {
1542        req_builder = req_builder.query(&query_params);
1543    }
1544
1545
1546    // Add user agent if configured
1547    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    // Apply all header parameters
1552    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&lt;models::UmfuturesCreateBatchOrdersV1RespInner&gt;`"))),
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&lt;models::UmfuturesCreateBatchOrdersV1RespInner&gt;`")))),
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
1589/// Accept the offered quote by quote ID.
1590pub 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    // Create a mutable vector for query parameters
1596    let mut query_params: Vec<(String, String)> = Vec::new();
1597
1598
1599    // Create header parameters collection
1600    let mut header_params = std::collections::HashMap::new();
1601
1602    // Handle Binance Auth first if configured
1603    if let Some(ref binance_auth) = configuration.binance_auth {
1604        // Add API key to headers
1605        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1606        
1607        // Generate request body for signing (if any)
1608        let body_string: Option<Vec<u8>> = None;
1609        
1610        // Sign the request
1611        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        // Add signature to query params
1617        query_params.push(("signature".to_string(), signature));
1618    }
1619
1620    // Apply all query parameters
1621    if !query_params.is_empty() {
1622        req_builder = req_builder.query(&query_params);
1623    }
1624
1625
1626    // Add user agent if configured
1627    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    // Apply all header parameters
1632    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
1669/// Request a quote for the requested token pairs
1670pub 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    // Create a mutable vector for query parameters
1676    let mut query_params: Vec<(String, String)> = Vec::new();
1677
1678
1679    // Create header parameters collection
1680    let mut header_params = std::collections::HashMap::new();
1681
1682    // Handle Binance Auth first if configured
1683    if let Some(ref binance_auth) = configuration.binance_auth {
1684        // Add API key to headers
1685        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1686        
1687        // Generate request body for signing (if any)
1688        let body_string: Option<Vec<u8>> = None;
1689        
1690        // Sign the request
1691        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        // Add signature to query params
1697        query_params.push(("signature".to_string(), signature));
1698    }
1699
1700    // Apply all query parameters
1701    if !query_params.is_empty() {
1702        req_builder = req_builder.query(&query_params);
1703    }
1704
1705
1706    // Add user agent if configured
1707    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    // Apply all header parameters
1712    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
1759/// Cancel all open orders of the specified symbol at the end of the specified countdown. The endpoint should be called repeatedly as heartbeats so that the existing countdown time can be canceled and replaced by a new one.
1760pub 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    // Create a mutable vector for query parameters
1766    let mut query_params: Vec<(String, String)> = Vec::new();
1767
1768
1769    // Create header parameters collection
1770    let mut header_params = std::collections::HashMap::new();
1771
1772    // Handle Binance Auth first if configured
1773    if let Some(ref binance_auth) = configuration.binance_auth {
1774        // Add API key to headers
1775        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1776        
1777        // Generate request body for signing (if any)
1778        let body_string = match serde_json::to_string(&params.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        // Sign the request
1784        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        // Add signature to query params
1790        query_params.push(("signature".to_string(), signature));
1791    }
1792
1793    // Apply all query parameters
1794    if !query_params.is_empty() {
1795        req_builder = req_builder.query(&query_params);
1796    }
1797
1798
1799    // Add user agent if configured
1800    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    // Apply all header parameters
1805    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(&params.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
1836/// Change user's BNB Fee Discount (Fee Discount On or Fee Discount Off ) on EVERY symbol
1837pub 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    // Create a mutable vector for query parameters
1843    let mut query_params: Vec<(String, String)> = Vec::new();
1844
1845
1846    // Create header parameters collection
1847    let mut header_params = std::collections::HashMap::new();
1848
1849    // Handle Binance Auth first if configured
1850    if let Some(ref binance_auth) = configuration.binance_auth {
1851        // Add API key to headers
1852        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1853        
1854        // Generate request body for signing (if any)
1855        let body_string: Option<Vec<u8>> = None;
1856        
1857        // Sign the request
1858        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        // Add signature to query params
1864        query_params.push(("signature".to_string(), signature));
1865    }
1866
1867    // Apply all query parameters
1868    if !query_params.is_empty() {
1869        req_builder = req_builder.query(&query_params);
1870    }
1871
1872
1873    // Add user agent if configured
1874    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    // Apply all header parameters
1879    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
1916/// Change user's initial leverage of specific symbol market.
1917pub 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    // Create a mutable vector for query parameters
1923    let mut query_params: Vec<(String, String)> = Vec::new();
1924
1925
1926    // Create header parameters collection
1927    let mut header_params = std::collections::HashMap::new();
1928
1929    // Handle Binance Auth first if configured
1930    if let Some(ref binance_auth) = configuration.binance_auth {
1931        // Add API key to headers
1932        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1933        
1934        // Generate request body for signing (if any)
1935        let body_string: Option<Vec<u8>> = None;
1936        
1937        // Sign the request
1938        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        // Add signature to query params
1944        query_params.push(("signature".to_string(), signature));
1945    }
1946
1947    // Apply all query parameters
1948    if !query_params.is_empty() {
1949        req_builder = req_builder.query(&query_params);
1950    }
1951
1952
1953    // Add user agent if configured
1954    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    // Apply all header parameters
1959    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
1997/// Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
1998pub 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    // Create a mutable vector for query parameters
2004    let mut query_params: Vec<(String, String)> = Vec::new();
2005
2006
2007    // Create header parameters collection
2008    let mut header_params = std::collections::HashMap::new();
2009
2010    // Handle Binance Auth first if configured
2011    if let Some(ref binance_auth) = configuration.binance_auth {
2012        // Add API key to headers
2013        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2014        
2015        // Generate request body for signing (if any)
2016        let body_string: Option<Vec<u8>> = None;
2017        
2018        // Sign the request
2019        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        // Add signature to query params
2025        query_params.push(("signature".to_string(), signature));
2026    }
2027
2028    // Apply all query parameters
2029    if !query_params.is_empty() {
2030        req_builder = req_builder.query(&query_params);
2031    }
2032
2033
2034    // Add user agent if configured
2035    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    // Apply all header parameters
2040    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
2070/// Change symbol level margin type
2071pub 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    // Create a mutable vector for query parameters
2077    let mut query_params: Vec<(String, String)> = Vec::new();
2078
2079
2080    // Create header parameters collection
2081    let mut header_params = std::collections::HashMap::new();
2082
2083    // Handle Binance Auth first if configured
2084    if let Some(ref binance_auth) = configuration.binance_auth {
2085        // Add API key to headers
2086        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2087        
2088        // Generate request body for signing (if any)
2089        let body_string: Option<Vec<u8>> = None;
2090        
2091        // Sign the request
2092        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        // Add signature to query params
2098        query_params.push(("signature".to_string(), signature));
2099    }
2100
2101    // Apply all query parameters
2102    if !query_params.is_empty() {
2103        req_builder = req_builder.query(&query_params);
2104    }
2105
2106
2107    // Add user agent if configured
2108    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    // Apply all header parameters
2113    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
2151/// Change user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on Every symbol
2152pub 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    // Create a mutable vector for query parameters
2158    let mut query_params: Vec<(String, String)> = Vec::new();
2159
2160
2161    // Create header parameters collection
2162    let mut header_params = std::collections::HashMap::new();
2163
2164    // Handle Binance Auth first if configured
2165    if let Some(ref binance_auth) = configuration.binance_auth {
2166        // Add API key to headers
2167        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2168        
2169        // Generate request body for signing (if any)
2170        let body_string: Option<Vec<u8>> = None;
2171        
2172        // Sign the request
2173        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        // Add signature to query params
2179        query_params.push(("signature".to_string(), signature));
2180    }
2181
2182    // Apply all query parameters
2183    if !query_params.is_empty() {
2184        req_builder = req_builder.query(&query_params);
2185    }
2186
2187
2188    // Add user agent if configured
2189    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    // Apply all header parameters
2194    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
2231/// Testing order request, this order will not be submitted to matching engine
2232pub 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    // Create a mutable vector for query parameters
2238    let mut query_params: Vec<(String, String)> = Vec::new();
2239
2240
2241    // Create header parameters collection
2242    let mut header_params = std::collections::HashMap::new();
2243
2244    // Handle Binance Auth first if configured
2245    if let Some(ref binance_auth) = configuration.binance_auth {
2246        // Add API key to headers
2247        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2248        
2249        // Generate request body for signing (if any)
2250        let body_string: Option<Vec<u8>> = None;
2251        
2252        // Sign the request
2253        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        // Add signature to query params
2259        query_params.push(("signature".to_string(), signature));
2260    }
2261
2262    // Apply all query parameters
2263    if !query_params.is_empty() {
2264        req_builder = req_builder.query(&query_params);
2265    }
2266
2267
2268    // Add user agent if configured
2269    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    // Apply all header parameters
2274    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
2361/// Send in a new order.
2362pub 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    // Create a mutable vector for query parameters
2368    let mut query_params: Vec<(String, String)> = Vec::new();
2369
2370
2371    // Create header parameters collection
2372    let mut header_params = std::collections::HashMap::new();
2373
2374    // Handle Binance Auth first if configured
2375    if let Some(ref binance_auth) = configuration.binance_auth {
2376        // Add API key to headers
2377        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2378        
2379        // Generate request body for signing (if any)
2380        let body_string: Option<Vec<u8>> = None;
2381        
2382        // Sign the request
2383        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        // Add signature to query params
2389        query_params.push(("signature".to_string(), signature));
2390    }
2391
2392    // Apply all query parameters
2393    if !query_params.is_empty() {
2394        req_builder = req_builder.query(&query_params);
2395    }
2396
2397
2398    // Add user agent if configured
2399    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    // Apply all header parameters
2404    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
2491/// Modify Isolated Position Margin
2492pub 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    // Create a mutable vector for query parameters
2498    let mut query_params: Vec<(String, String)> = Vec::new();
2499
2500
2501    // Create header parameters collection
2502    let mut header_params = std::collections::HashMap::new();
2503
2504    // Handle Binance Auth first if configured
2505    if let Some(ref binance_auth) = configuration.binance_auth {
2506        // Add API key to headers
2507        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2508        
2509        // Generate request body for signing (if any)
2510        let body_string: Option<Vec<u8>> = None;
2511        
2512        // Sign the request
2513        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        // Add signature to query params
2519        query_params.push(("signature".to_string(), signature));
2520    }
2521
2522    // Apply all query parameters
2523    if !query_params.is_empty() {
2524        req_builder = req_builder.query(&query_params);
2525    }
2526
2527
2528    // Add user agent if configured
2529    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    // Apply all header parameters
2534    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
2576/// Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol
2577pub 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    // Create a mutable vector for query parameters
2583    let mut query_params: Vec<(String, String)> = Vec::new();
2584
2585
2586    // Create header parameters collection
2587    let mut header_params = std::collections::HashMap::new();
2588
2589    // Handle Binance Auth first if configured
2590    if let Some(ref binance_auth) = configuration.binance_auth {
2591        // Add API key to headers
2592        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2593        
2594        // Generate request body for signing (if any)
2595        let body_string: Option<Vec<u8>> = None;
2596        
2597        // Sign the request
2598        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        // Add signature to query params
2604        query_params.push(("signature".to_string(), signature));
2605    }
2606
2607    // Apply all query parameters
2608    if !query_params.is_empty() {
2609        req_builder = req_builder.query(&query_params);
2610    }
2611
2612
2613    // Add user agent if configured
2614    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    // Apply all header parameters
2619    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
2656/// Cancel All Open Orders
2657pub 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    // Create a mutable vector for query parameters
2663    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    // Create header parameters collection
2672    let mut header_params = std::collections::HashMap::new();
2673
2674    // Handle Binance Auth first if configured
2675    if let Some(ref binance_auth) = configuration.binance_auth {
2676        // Add API key to headers
2677        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2678        
2679        // Generate request body for signing (if any)
2680        let body_string: Option<Vec<u8>> = None;
2681        
2682        // Sign the request
2683        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        // Add signature to query params
2689        query_params.push(("signature".to_string(), signature));
2690    }
2691
2692    // Apply all query parameters
2693    if !query_params.is_empty() {
2694        req_builder = req_builder.query(&query_params);
2695    }
2696
2697
2698    // Add user agent if configured
2699    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    // Apply all header parameters
2704    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
2734/// Cancel Multiple Orders
2735pub 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    // Create a mutable vector for query parameters
2741    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    // Create header parameters collection
2782    let mut header_params = std::collections::HashMap::new();
2783
2784    // Handle Binance Auth first if configured
2785    if let Some(ref binance_auth) = configuration.binance_auth {
2786        // Add API key to headers
2787        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2788        
2789        // Generate request body for signing (if any)
2790        let body_string: Option<Vec<u8>> = None;
2791        
2792        // Sign the request
2793        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        // Add signature to query params
2799        query_params.push(("signature".to_string(), signature));
2800    }
2801
2802    // Apply all query parameters
2803    if !query_params.is_empty() {
2804        req_builder = req_builder.query(&query_params);
2805    }
2806
2807
2808    // Add user agent if configured
2809    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    // Apply all header parameters
2814    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&lt;models::UmfuturesDeleteBatchOrdersV1RespInner&gt;`"))),
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&lt;models::UmfuturesDeleteBatchOrdersV1RespInner&gt;`")))),
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
2844/// Close out a user data stream.
2845pub 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    // Create a mutable vector for query parameters
2851    let mut query_params: Vec<(String, String)> = Vec::new();
2852
2853
2854    // Create header parameters collection
2855    let mut header_params = std::collections::HashMap::new();
2856
2857    // Handle Binance Auth first if configured
2858    if let Some(ref binance_auth) = configuration.binance_auth {
2859        // Add API key to headers
2860        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2861        
2862        // Generate request body for signing (if any)
2863        let body_string: Option<Vec<u8>> = None;
2864        
2865        // Sign the request
2866        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        // Add signature to query params
2872        query_params.push(("signature".to_string(), signature));
2873    }
2874
2875    // Apply all query parameters
2876    if !query_params.is_empty() {
2877        req_builder = req_builder.query(&query_params);
2878    }
2879
2880
2881    // Add user agent if configured
2882    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    // Apply all header parameters
2887    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
2917/// Cancel an active order.
2918pub 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    // Create a mutable vector for query parameters
2924    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    // Create header parameters collection
2939    let mut header_params = std::collections::HashMap::new();
2940
2941    // Handle Binance Auth first if configured
2942    if let Some(ref binance_auth) = configuration.binance_auth {
2943        // Add API key to headers
2944        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2945        
2946        // Generate request body for signing (if any)
2947        let body_string: Option<Vec<u8>> = None;
2948        
2949        // Sign the request
2950        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        // Add signature to query params
2956        query_params.push(("signature".to_string(), signature));
2957    }
2958
2959    // Apply all query parameters
2960    if !query_params.is_empty() {
2961        req_builder = req_builder.query(&query_params);
2962    }
2963
2964
2965    // Add user agent if configured
2966    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    // Apply all header parameters
2971    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
3001/// Query account configuration
3002pub 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    // Create a mutable vector for query parameters
3008    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    // Create header parameters collection
3016    let mut header_params = std::collections::HashMap::new();
3017
3018    // Handle Binance Auth first if configured
3019    if let Some(ref binance_auth) = configuration.binance_auth {
3020        // Add API key to headers
3021        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3022        
3023        // Generate request body for signing (if any)
3024        let body_string: Option<Vec<u8>> = None;
3025        
3026        // Sign the request
3027        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        // Add signature to query params
3033        query_params.push(("signature".to_string(), signature));
3034    }
3035
3036    // Apply all query parameters
3037    if !query_params.is_empty() {
3038        req_builder = req_builder.query(&query_params);
3039    }
3040
3041
3042    // Add user agent if configured
3043    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    // Apply all header parameters
3048    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
3078/// Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail.
3079pub 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    // Create a mutable vector for query parameters
3085    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    // Create header parameters collection
3093    let mut header_params = std::collections::HashMap::new();
3094
3095    // Handle Binance Auth first if configured
3096    if let Some(ref binance_auth) = configuration.binance_auth {
3097        // Add API key to headers
3098        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3099        
3100        // Generate request body for signing (if any)
3101        let body_string: Option<Vec<u8>> = None;
3102        
3103        // Sign the request
3104        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        // Add signature to query params
3110        query_params.push(("signature".to_string(), signature));
3111    }
3112
3113    // Apply all query parameters
3114    if !query_params.is_empty() {
3115        req_builder = req_builder.query(&query_params);
3116    }
3117
3118
3119    // Add user agent if configured
3120    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    // Apply all header parameters
3125    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
3155/// Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail.
3156pub 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    // Create a mutable vector for query parameters
3162    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    // Create header parameters collection
3170    let mut header_params = std::collections::HashMap::new();
3171
3172    // Handle Binance Auth first if configured
3173    if let Some(ref binance_auth) = configuration.binance_auth {
3174        // Add API key to headers
3175        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3176        
3177        // Generate request body for signing (if any)
3178        let body_string: Option<Vec<u8>> = None;
3179        
3180        // Sign the request
3181        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        // Add signature to query params
3187        query_params.push(("signature".to_string(), signature));
3188    }
3189
3190    // Apply all query parameters
3191    if !query_params.is_empty() {
3192        req_builder = req_builder.query(&query_params);
3193    }
3194
3195
3196    // Add user agent if configured
3197    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    // Apply all header parameters
3202    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
3232/// Position ADL Quantile Estimation
3233pub 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    // Create a mutable vector for query parameters
3239    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    // Create header parameters collection
3250    let mut header_params = std::collections::HashMap::new();
3251
3252    // Handle Binance Auth first if configured
3253    if let Some(ref binance_auth) = configuration.binance_auth {
3254        // Add API key to headers
3255        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3256        
3257        // Generate request body for signing (if any)
3258        let body_string: Option<Vec<u8>> = None;
3259        
3260        // Sign the request
3261        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        // Add signature to query params
3267        query_params.push(("signature".to_string(), signature));
3268    }
3269
3270    // Apply all query parameters
3271    if !query_params.is_empty() {
3272        req_builder = req_builder.query(&query_params);
3273    }
3274
3275
3276    // Add user agent if configured
3277    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    // Apply all header parameters
3282    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&lt;models::GetAdlQuantileV1RespItem&gt;`"))),
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&lt;models::GetAdlQuantileV1RespItem&gt;`")))),
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
3312/// Get compressed, aggregate market trades. Market trades that fill in 100ms with the same price and the same taking side will have the quantity aggregated.
3313pub 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    // Create a mutable vector for query parameters
3319    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    // Create header parameters collection
3336    let mut header_params = std::collections::HashMap::new();
3337
3338    // Handle Binance Auth first if configured
3339    if let Some(ref binance_auth) = configuration.binance_auth {
3340        // Add API key to headers
3341        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3342        
3343        // Generate request body for signing (if any)
3344        let body_string: Option<Vec<u8>> = None;
3345        
3346        // Sign the request
3347        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        // Add signature to query params
3353        query_params.push(("signature".to_string(), signature));
3354    }
3355
3356    // Apply all query parameters
3357    if !query_params.is_empty() {
3358        req_builder = req_builder.query(&query_params);
3359    }
3360
3361
3362    // Add user agent if configured
3363    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    // Apply all header parameters
3368    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&lt;models::UmfuturesGetAggTradesV1RespItem&gt;`"))),
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&lt;models::UmfuturesGetAggTradesV1RespItem&gt;`")))),
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
3398/// Get all account orders; active, canceled, or filled.
3399pub 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    // Create a mutable vector for query parameters
3405    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    // Create header parameters collection
3426    let mut header_params = std::collections::HashMap::new();
3427
3428    // Handle Binance Auth first if configured
3429    if let Some(ref binance_auth) = configuration.binance_auth {
3430        // Add API key to headers
3431        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3432        
3433        // Generate request body for signing (if any)
3434        let body_string: Option<Vec<u8>> = None;
3435        
3436        // Sign the request
3437        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        // Add signature to query params
3443        query_params.push(("signature".to_string(), signature));
3444    }
3445
3446    // Apply all query parameters
3447    if !query_params.is_empty() {
3448        req_builder = req_builder.query(&query_params);
3449    }
3450
3451
3452    // Add user agent if configured
3453    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    // Apply all header parameters
3458    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&lt;models::GetAllOrdersV1RespItem&gt;`"))),
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&lt;models::GetAllOrdersV1RespItem&gt;`")))),
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
3488/// Futures trading quantitative rules indicators, for more information on this, please refer to the Futures Trading Quantitative Rules
3489pub 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    // Create a mutable vector for query parameters
3495    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    // Create header parameters collection
3506    let mut header_params = std::collections::HashMap::new();
3507
3508    // Handle Binance Auth first if configured
3509    if let Some(ref binance_auth) = configuration.binance_auth {
3510        // Add API key to headers
3511        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3512        
3513        // Generate request body for signing (if any)
3514        let body_string: Option<Vec<u8>> = None;
3515        
3516        // Sign the request
3517        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        // Add signature to query params
3523        query_params.push(("signature".to_string(), signature));
3524    }
3525
3526    // Apply all query parameters
3527    if !query_params.is_empty() {
3528        req_builder = req_builder.query(&query_params);
3529    }
3530
3531
3532    // Add user agent if configured
3533    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    // Apply all header parameters
3538    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
3568/// asset index for Multi-Assets mode
3569pub 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    // Create a mutable vector for query parameters
3575    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    // Create header parameters collection
3582    let mut header_params = std::collections::HashMap::new();
3583
3584    // Handle Binance Auth first if configured
3585    if let Some(ref binance_auth) = configuration.binance_auth {
3586        // Add API key to headers
3587        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3588        
3589        // Generate request body for signing (if any)
3590        let body_string: Option<Vec<u8>> = None;
3591        
3592        // Sign the request
3593        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        // Add signature to query params
3599        query_params.push(("signature".to_string(), signature));
3600    }
3601
3602    // Apply all query parameters
3603    if !query_params.is_empty() {
3604        req_builder = req_builder.query(&query_params);
3605    }
3606
3607
3608    // Add user agent if configured
3609    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    // Apply all header parameters
3614    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
3644/// Query account balance info
3645pub 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    // Create a mutable vector for query parameters
3651    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    // Create header parameters collection
3659    let mut header_params = std::collections::HashMap::new();
3660
3661    // Handle Binance Auth first if configured
3662    if let Some(ref binance_auth) = configuration.binance_auth {
3663        // Add API key to headers
3664        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3665        
3666        // Generate request body for signing (if any)
3667        let body_string: Option<Vec<u8>> = None;
3668        
3669        // Sign the request
3670        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        // Add signature to query params
3676        query_params.push(("signature".to_string(), signature));
3677    }
3678
3679    // Apply all query parameters
3680    if !query_params.is_empty() {
3681        req_builder = req_builder.query(&query_params);
3682    }
3683
3684
3685    // Add user agent if configured
3686    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    // Apply all header parameters
3691    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&lt;models::GetBalanceV2RespItem&gt;`"))),
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&lt;models::GetBalanceV2RespItem&gt;`")))),
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
3721/// Query account balance info
3722pub 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    // Create a mutable vector for query parameters
3728    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    // Create header parameters collection
3736    let mut header_params = std::collections::HashMap::new();
3737
3738    // Handle Binance Auth first if configured
3739    if let Some(ref binance_auth) = configuration.binance_auth {
3740        // Add API key to headers
3741        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3742        
3743        // Generate request body for signing (if any)
3744        let body_string: Option<Vec<u8>> = None;
3745        
3746        // Sign the request
3747        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        // Add signature to query params
3753        query_params.push(("signature".to_string(), signature));
3754    }
3755
3756    // Apply all query parameters
3757    if !query_params.is_empty() {
3758        req_builder = req_builder.query(&query_params);
3759    }
3760
3761
3762    // Add user agent if configured
3763    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    // Apply all header parameters
3768    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&lt;models::GetBalanceV3RespItem&gt;`"))),
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&lt;models::GetBalanceV3RespItem&gt;`")))),
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
3798/// Get User Commission Rate
3799pub 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    // Create a mutable vector for query parameters
3805    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    // Create header parameters collection
3814    let mut header_params = std::collections::HashMap::new();
3815
3816    // Handle Binance Auth first if configured
3817    if let Some(ref binance_auth) = configuration.binance_auth {
3818        // Add API key to headers
3819        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3820        
3821        // Generate request body for signing (if any)
3822        let body_string: Option<Vec<u8>> = None;
3823        
3824        // Sign the request
3825        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        // Add signature to query params
3831        query_params.push(("signature".to_string(), signature));
3832    }
3833
3834    // Apply all query parameters
3835    if !query_params.is_empty() {
3836        req_builder = req_builder.query(&query_params);
3837    }
3838
3839
3840    // Add user agent if configured
3841    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    // Apply all header parameters
3846    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
3876/// Query index price constituents
3877pub 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    // Create a mutable vector for query parameters
3883    let mut query_params: Vec<(String, String)> = Vec::new();
3884
3885    query_params.push(("symbol".to_string(), params.symbol.to_string()));
3886
3887    // Create header parameters collection
3888    let mut header_params = std::collections::HashMap::new();
3889
3890    // Handle Binance Auth first if configured
3891    if let Some(ref binance_auth) = configuration.binance_auth {
3892        // Add API key to headers
3893        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3894        
3895        // Generate request body for signing (if any)
3896        let body_string: Option<Vec<u8>> = None;
3897        
3898        // Sign the request
3899        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        // Add signature to query params
3905        query_params.push(("signature".to_string(), signature));
3906    }
3907
3908    // Apply all query parameters
3909    if !query_params.is_empty() {
3910        req_builder = req_builder.query(&query_params);
3911    }
3912
3913
3914    // Add user agent if configured
3915    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    // Apply all header parameters
3920    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
3950/// Kline/candlestick bars for a specific contract type. Klines are uniquely identified by their open time.
3951pub 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    // Create a mutable vector for query parameters
3957    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    // Create header parameters collection
3973    let mut header_params = std::collections::HashMap::new();
3974
3975    // Handle Binance Auth first if configured
3976    if let Some(ref binance_auth) = configuration.binance_auth {
3977        // Add API key to headers
3978        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3979        
3980        // Generate request body for signing (if any)
3981        let body_string: Option<Vec<u8>> = None;
3982        
3983        // Sign the request
3984        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        // Add signature to query params
3990        query_params.push(("signature".to_string(), signature));
3991    }
3992
3993    // Apply all query parameters
3994    if !query_params.is_empty() {
3995        req_builder = req_builder.query(&query_params);
3996    }
3997
3998
3999    // Add user agent if configured
4000    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    // Apply all header parameters
4005    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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`"))),
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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`")))),
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
4035/// Query for all convertible token pairs and the tokens’ respective upper/lower limits
4036pub 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    // Create a mutable vector for query parameters
4042    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    // Create header parameters collection
4052    let mut header_params = std::collections::HashMap::new();
4053
4054    // Handle Binance Auth first if configured
4055    if let Some(ref binance_auth) = configuration.binance_auth {
4056        // Add API key to headers
4057        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4058        
4059        // Generate request body for signing (if any)
4060        let body_string: Option<Vec<u8>> = None;
4061        
4062        // Sign the request
4063        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        // Add signature to query params
4069        query_params.push(("signature".to_string(), signature));
4070    }
4071
4072    // Apply all query parameters
4073    if !query_params.is_empty() {
4074        req_builder = req_builder.query(&query_params);
4075    }
4076
4077
4078    // Add user agent if configured
4079    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    // Apply all header parameters
4084    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&lt;models::GetConvertExchangeInfoV1RespItem&gt;`"))),
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&lt;models::GetConvertExchangeInfoV1RespItem&gt;`")))),
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
4114/// Query order status by order ID.
4115pub 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    // Create a mutable vector for query parameters
4121    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    // Create header parameters collection
4131    let mut header_params = std::collections::HashMap::new();
4132
4133    // Handle Binance Auth first if configured
4134    if let Some(ref binance_auth) = configuration.binance_auth {
4135        // Add API key to headers
4136        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4137        
4138        // Generate request body for signing (if any)
4139        let body_string: Option<Vec<u8>> = None;
4140        
4141        // Sign the request
4142        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        // Add signature to query params
4148        query_params.push(("signature".to_string(), signature));
4149    }
4150
4151    // Apply all query parameters
4152    if !query_params.is_empty() {
4153        req_builder = req_builder.query(&query_params);
4154    }
4155
4156
4157    // Add user agent if configured
4158    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    // Apply all header parameters
4163    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
4193/// Query symbol orderbook
4194pub 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    // Create a mutable vector for query parameters
4200    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    // Create header parameters collection
4208    let mut header_params = std::collections::HashMap::new();
4209
4210    // Handle Binance Auth first if configured
4211    if let Some(ref binance_auth) = configuration.binance_auth {
4212        // Add API key to headers
4213        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4214        
4215        // Generate request body for signing (if any)
4216        let body_string: Option<Vec<u8>> = None;
4217        
4218        // Sign the request
4219        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        // Add signature to query params
4225        query_params.push(("signature".to_string(), signature));
4226    }
4227
4228    // Apply all query parameters
4229    if !query_params.is_empty() {
4230        req_builder = req_builder.query(&query_params);
4231    }
4232
4233
4234    // Add user agent if configured
4235    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    // Apply all header parameters
4240    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
4270/// Current exchange trading rules and symbol information
4271pub 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    // Create a mutable vector for query parameters
4277    let mut query_params: Vec<(String, String)> = Vec::new();
4278
4279
4280    // Create header parameters collection
4281    let mut header_params = std::collections::HashMap::new();
4282
4283    // Handle Binance Auth first if configured
4284    if let Some(ref binance_auth) = configuration.binance_auth {
4285        // Add API key to headers
4286        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4287        
4288        // Generate request body for signing (if any)
4289        let body_string: Option<Vec<u8>> = None;
4290        
4291        // Sign the request
4292        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        // Add signature to query params
4298        query_params.push(("signature".to_string(), signature));
4299    }
4300
4301    // Apply all query parameters
4302    if !query_params.is_empty() {
4303        req_builder = req_builder.query(&query_params);
4304    }
4305
4306
4307    // Add user agent if configured
4308    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    // Apply all header parameters
4313    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
4343/// Get user's BNB Fee Discount (Fee Discount On or Fee Discount Off )
4344pub 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    // Create a mutable vector for query parameters
4350    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    // Create header parameters collection
4358    let mut header_params = std::collections::HashMap::new();
4359
4360    // Handle Binance Auth first if configured
4361    if let Some(ref binance_auth) = configuration.binance_auth {
4362        // Add API key to headers
4363        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4364        
4365        // Generate request body for signing (if any)
4366        let body_string: Option<Vec<u8>> = None;
4367        
4368        // Sign the request
4369        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        // Add signature to query params
4375        query_params.push(("signature".to_string(), signature));
4376    }
4377
4378    // Apply all query parameters
4379    if !query_params.is_empty() {
4380        req_builder = req_builder.query(&query_params);
4381    }
4382
4383
4384    // Add user agent if configured
4385    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    // Apply all header parameters
4390    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
4420/// Query user's Force Orders
4421pub 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    // Create a mutable vector for query parameters
4427    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    // Create header parameters collection
4450    let mut header_params = std::collections::HashMap::new();
4451
4452    // Handle Binance Auth first if configured
4453    if let Some(ref binance_auth) = configuration.binance_auth {
4454        // Add API key to headers
4455        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4456        
4457        // Generate request body for signing (if any)
4458        let body_string: Option<Vec<u8>> = None;
4459        
4460        // Sign the request
4461        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        // Add signature to query params
4467        query_params.push(("signature".to_string(), signature));
4468    }
4469
4470    // Apply all query parameters
4471    if !query_params.is_empty() {
4472        req_builder = req_builder.query(&query_params);
4473    }
4474
4475
4476    // Add user agent if configured
4477    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    // Apply all header parameters
4482    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&lt;models::GetForceOrdersV1RespItem&gt;`"))),
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&lt;models::GetForceOrdersV1RespItem&gt;`")))),
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
4512/// Query funding rate info for symbols that had FundingRateCap/ FundingRateFloor / fundingIntervalHours adjustment
4513pub 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    // Create a mutable vector for query parameters
4519    let mut query_params: Vec<(String, String)> = Vec::new();
4520
4521
4522    // Create header parameters collection
4523    let mut header_params = std::collections::HashMap::new();
4524
4525    // Handle Binance Auth first if configured
4526    if let Some(ref binance_auth) = configuration.binance_auth {
4527        // Add API key to headers
4528        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4529        
4530        // Generate request body for signing (if any)
4531        let body_string: Option<Vec<u8>> = None;
4532        
4533        // Sign the request
4534        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        // Add signature to query params
4540        query_params.push(("signature".to_string(), signature));
4541    }
4542
4543    // Apply all query parameters
4544    if !query_params.is_empty() {
4545        req_builder = req_builder.query(&query_params);
4546    }
4547
4548
4549    // Add user agent if configured
4550    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    // Apply all header parameters
4555    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&lt;models::GetFundingInfoV1RespItem&gt;`"))),
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&lt;models::GetFundingInfoV1RespItem&gt;`")))),
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
4585/// Get Funding Rate History
4586pub 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    // Create a mutable vector for query parameters
4592    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    // Create header parameters collection
4608    let mut header_params = std::collections::HashMap::new();
4609
4610    // Handle Binance Auth first if configured
4611    if let Some(ref binance_auth) = configuration.binance_auth {
4612        // Add API key to headers
4613        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4614        
4615        // Generate request body for signing (if any)
4616        let body_string: Option<Vec<u8>> = None;
4617        
4618        // Sign the request
4619        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        // Add signature to query params
4625        query_params.push(("signature".to_string(), signature));
4626    }
4627
4628    // Apply all query parameters
4629    if !query_params.is_empty() {
4630        req_builder = req_builder.query(&query_params);
4631    }
4632
4633
4634    // Add user agent if configured
4635    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    // Apply all header parameters
4640    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&lt;models::GetFundingRateV1RespItem&gt;`"))),
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&lt;models::GetFundingRateV1RespItem&gt;`")))),
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
4670/// Query future basis
4671pub 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    // Create a mutable vector for query parameters
4677    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    // Create header parameters collection
4691    let mut header_params = std::collections::HashMap::new();
4692
4693    // Handle Binance Auth first if configured
4694    if let Some(ref binance_auth) = configuration.binance_auth {
4695        // Add API key to headers
4696        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4697        
4698        // Generate request body for signing (if any)
4699        let body_string: Option<Vec<u8>> = None;
4700        
4701        // Sign the request
4702        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        // Add signature to query params
4708        query_params.push(("signature".to_string(), signature));
4709    }
4710
4711    // Apply all query parameters
4712    if !query_params.is_empty() {
4713        req_builder = req_builder.query(&query_params);
4714    }
4715
4716
4717    // Add user agent if configured
4718    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    // Apply all header parameters
4723    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&lt;models::GetFuturesDataBasisRespItem&gt;`"))),
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&lt;models::GetFuturesDataBasisRespItem&gt;`")))),
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
4753/// Latest price for a symbol or symbols.
4754pub 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    // Create a mutable vector for query parameters
4760    let mut query_params: Vec<(String, String)> = Vec::new();
4761
4762    query_params.push(("pair".to_string(), params.pair.to_string()));
4763
4764    // Create header parameters collection
4765    let mut header_params = std::collections::HashMap::new();
4766
4767    // Handle Binance Auth first if configured
4768    if let Some(ref binance_auth) = configuration.binance_auth {
4769        // Add API key to headers
4770        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4771        
4772        // Generate request body for signing (if any)
4773        let body_string: Option<Vec<u8>> = None;
4774        
4775        // Sign the request
4776        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        // Add signature to query params
4782        query_params.push(("signature".to_string(), signature));
4783    }
4784
4785    // Apply all query parameters
4786    if !query_params.is_empty() {
4787        req_builder = req_builder.query(&query_params);
4788    }
4789
4790
4791    // Add user agent if configured
4792    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    // Apply all header parameters
4797    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&lt;models::UmfuturesGetFuturesDataDeliveryPriceRespItem&gt;`"))),
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&lt;models::UmfuturesGetFuturesDataDeliveryPriceRespItem&gt;`")))),
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
4827/// Query symbol Long/Short Ratio
4828pub 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    // Create a mutable vector for query parameters
4834    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    // Create header parameters collection
4849    let mut header_params = std::collections::HashMap::new();
4850
4851    // Handle Binance Auth first if configured
4852    if let Some(ref binance_auth) = configuration.binance_auth {
4853        // Add API key to headers
4854        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4855        
4856        // Generate request body for signing (if any)
4857        let body_string: Option<Vec<u8>> = None;
4858        
4859        // Sign the request
4860        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        // Add signature to query params
4866        query_params.push(("signature".to_string(), signature));
4867    }
4868
4869    // Apply all query parameters
4870    if !query_params.is_empty() {
4871        req_builder = req_builder.query(&query_params);
4872    }
4873
4874
4875    // Add user agent if configured
4876    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    // Apply all header parameters
4881    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&lt;models::GetFuturesDataGlobalLongShortAccountRatioRespItem&gt;`"))),
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&lt;models::GetFuturesDataGlobalLongShortAccountRatioRespItem&gt;`")))),
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
4911/// Open Interest Statistics
4912pub 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    // Create a mutable vector for query parameters
4918    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    // Create header parameters collection
4933    let mut header_params = std::collections::HashMap::new();
4934
4935    // Handle Binance Auth first if configured
4936    if let Some(ref binance_auth) = configuration.binance_auth {
4937        // Add API key to headers
4938        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4939        
4940        // Generate request body for signing (if any)
4941        let body_string: Option<Vec<u8>> = None;
4942        
4943        // Sign the request
4944        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        // Add signature to query params
4950        query_params.push(("signature".to_string(), signature));
4951    }
4952
4953    // Apply all query parameters
4954    if !query_params.is_empty() {
4955        req_builder = req_builder.query(&query_params);
4956    }
4957
4958
4959    // Add user agent if configured
4960    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    // Apply all header parameters
4965    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&lt;models::GetFuturesDataOpenInterestHistRespItem&gt;`"))),
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&lt;models::GetFuturesDataOpenInterestHistRespItem&gt;`")))),
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
4995/// Taker Buy/Sell Volume
4996pub 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    // Create a mutable vector for query parameters
5002    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    // Create header parameters collection
5017    let mut header_params = std::collections::HashMap::new();
5018
5019    // Handle Binance Auth first if configured
5020    if let Some(ref binance_auth) = configuration.binance_auth {
5021        // Add API key to headers
5022        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5023        
5024        // Generate request body for signing (if any)
5025        let body_string: Option<Vec<u8>> = None;
5026        
5027        // Sign the request
5028        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        // Add signature to query params
5034        query_params.push(("signature".to_string(), signature));
5035    }
5036
5037    // Apply all query parameters
5038    if !query_params.is_empty() {
5039        req_builder = req_builder.query(&query_params);
5040    }
5041
5042
5043    // Add user agent if configured
5044    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    // Apply all header parameters
5049    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&lt;models::GetFuturesDataTakerlongshortRatioRespItem&gt;`"))),
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&lt;models::GetFuturesDataTakerlongshortRatioRespItem&gt;`")))),
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
5079/// The proportion of net long and net short accounts to total accounts of the top 20% users with the highest margin balance. Each account is counted once only. Long Account % = Accounts of top traders with net long positions / Total accounts of top traders with open positions Short Account % = Accounts of top traders with net short positions / Total accounts of top traders with open positions Long/Short Ratio (Accounts) = Long Account % / Short Account %
5080pub 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    // Create a mutable vector for query parameters
5086    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    // Create header parameters collection
5101    let mut header_params = std::collections::HashMap::new();
5102
5103    // Handle Binance Auth first if configured
5104    if let Some(ref binance_auth) = configuration.binance_auth {
5105        // Add API key to headers
5106        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5107        
5108        // Generate request body for signing (if any)
5109        let body_string: Option<Vec<u8>> = None;
5110        
5111        // Sign the request
5112        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        // Add signature to query params
5118        query_params.push(("signature".to_string(), signature));
5119    }
5120
5121    // Apply all query parameters
5122    if !query_params.is_empty() {
5123        req_builder = req_builder.query(&query_params);
5124    }
5125
5126
5127    // Add user agent if configured
5128    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    // Apply all header parameters
5133    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&lt;models::GetFuturesDataTopLongShortAccountRatioRespItem&gt;`"))),
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&lt;models::GetFuturesDataTopLongShortAccountRatioRespItem&gt;`")))),
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
5163/// The proportion of net long and net short positions to total open positions of the top 20% users with the highest margin balance. Long Position % = Long positions of top traders / Total open positions of top traders Short Position % = Short positions of top traders / Total open positions of top traders Long/Short Ratio (Positions) = Long Position % / Short Position %
5164pub 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    // Create a mutable vector for query parameters
5170    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    // Create header parameters collection
5185    let mut header_params = std::collections::HashMap::new();
5186
5187    // Handle Binance Auth first if configured
5188    if let Some(ref binance_auth) = configuration.binance_auth {
5189        // Add API key to headers
5190        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5191        
5192        // Generate request body for signing (if any)
5193        let body_string: Option<Vec<u8>> = None;
5194        
5195        // Sign the request
5196        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        // Add signature to query params
5202        query_params.push(("signature".to_string(), signature));
5203    }
5204
5205    // Apply all query parameters
5206    if !query_params.is_empty() {
5207        req_builder = req_builder.query(&query_params);
5208    }
5209
5210
5211    // Add user agent if configured
5212    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    // Apply all header parameters
5217    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&lt;models::GetFuturesDataTopLongShortPositionRatioRespItem&gt;`"))),
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&lt;models::GetFuturesDataTopLongShortPositionRatioRespItem&gt;`")))),
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
5247/// Get older market historical trades.
5248pub 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    // Create a mutable vector for query parameters
5254    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    // Create header parameters collection
5265    let mut header_params = std::collections::HashMap::new();
5266
5267    // Handle Binance Auth first if configured
5268    if let Some(ref binance_auth) = configuration.binance_auth {
5269        // Add API key to headers
5270        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5271        
5272        // Generate request body for signing (if any)
5273        let body_string: Option<Vec<u8>> = None;
5274        
5275        // Sign the request
5276        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        // Add signature to query params
5282        query_params.push(("signature".to_string(), signature));
5283    }
5284
5285    // Apply all query parameters
5286    if !query_params.is_empty() {
5287        req_builder = req_builder.query(&query_params);
5288    }
5289
5290
5291    // Add user agent if configured
5292    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    // Apply all header parameters
5297    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&lt;models::GetHistoricalTradesV1RespItem&gt;`"))),
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&lt;models::GetHistoricalTradesV1RespItem&gt;`")))),
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
5327/// Get futures transaction history download link by Id
5328pub 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    // Create a mutable vector for query parameters
5334    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    // Create header parameters collection
5343    let mut header_params = std::collections::HashMap::new();
5344
5345    // Handle Binance Auth first if configured
5346    if let Some(ref binance_auth) = configuration.binance_auth {
5347        // Add API key to headers
5348        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5349        
5350        // Generate request body for signing (if any)
5351        let body_string: Option<Vec<u8>> = None;
5352        
5353        // Sign the request
5354        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        // Add signature to query params
5360        query_params.push(("signature".to_string(), signature));
5361    }
5362
5363    // Apply all query parameters
5364    if !query_params.is_empty() {
5365        req_builder = req_builder.query(&query_params);
5366    }
5367
5368
5369    // Add user agent if configured
5370    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    // Apply all header parameters
5375    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
5405/// Get download id for futures transaction history
5406pub 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    // Create a mutable vector for query parameters
5412    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    // Create header parameters collection
5422    let mut header_params = std::collections::HashMap::new();
5423
5424    // Handle Binance Auth first if configured
5425    if let Some(ref binance_auth) = configuration.binance_auth {
5426        // Add API key to headers
5427        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5428        
5429        // Generate request body for signing (if any)
5430        let body_string: Option<Vec<u8>> = None;
5431        
5432        // Sign the request
5433        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        // Add signature to query params
5439        query_params.push(("signature".to_string(), signature));
5440    }
5441
5442    // Apply all query parameters
5443    if !query_params.is_empty() {
5444        req_builder = req_builder.query(&query_params);
5445    }
5446
5447
5448    // Add user agent if configured
5449    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    // Apply all header parameters
5454    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
5484/// Query composite index symbol information
5485pub 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    // Create a mutable vector for query parameters
5491    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    // Create header parameters collection
5498    let mut header_params = std::collections::HashMap::new();
5499
5500    // Handle Binance Auth first if configured
5501    if let Some(ref binance_auth) = configuration.binance_auth {
5502        // Add API key to headers
5503        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5504        
5505        // Generate request body for signing (if any)
5506        let body_string: Option<Vec<u8>> = None;
5507        
5508        // Sign the request
5509        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        // Add signature to query params
5515        query_params.push(("signature".to_string(), signature));
5516    }
5517
5518    // Apply all query parameters
5519    if !query_params.is_empty() {
5520        req_builder = req_builder.query(&query_params);
5521    }
5522
5523
5524    // Add user agent if configured
5525    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    // Apply all header parameters
5530    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&lt;models::GetIndexInfoV1RespItem&gt;`"))),
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&lt;models::GetIndexInfoV1RespItem&gt;`")))),
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
5560/// Kline/candlestick bars for the index price of a pair. Klines are uniquely identified by their open time.
5561pub 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    // Create a mutable vector for query parameters
5567    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    // Create header parameters collection
5582    let mut header_params = std::collections::HashMap::new();
5583
5584    // Handle Binance Auth first if configured
5585    if let Some(ref binance_auth) = configuration.binance_auth {
5586        // Add API key to headers
5587        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5588        
5589        // Generate request body for signing (if any)
5590        let body_string: Option<Vec<u8>> = None;
5591        
5592        // Sign the request
5593        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        // Add signature to query params
5599        query_params.push(("signature".to_string(), signature));
5600    }
5601
5602    // Apply all query parameters
5603    if !query_params.is_empty() {
5604        req_builder = req_builder.query(&query_params);
5605    }
5606
5607
5608    // Add user agent if configured
5609    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    // Apply all header parameters
5614    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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`"))),
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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`")))),
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
5644/// Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
5645pub 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    // Create a mutable vector for query parameters
5651    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    // Create header parameters collection
5666    let mut header_params = std::collections::HashMap::new();
5667
5668    // Handle Binance Auth first if configured
5669    if let Some(ref binance_auth) = configuration.binance_auth {
5670        // Add API key to headers
5671        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5672        
5673        // Generate request body for signing (if any)
5674        let body_string: Option<Vec<u8>> = None;
5675        
5676        // Sign the request
5677        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        // Add signature to query params
5683        query_params.push(("signature".to_string(), signature));
5684    }
5685
5686    // Apply all query parameters
5687    if !query_params.is_empty() {
5688        req_builder = req_builder.query(&query_params);
5689    }
5690
5691
5692    // Add user agent if configured
5693    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    // Apply all header parameters
5698    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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`"))),
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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`")))),
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
5728/// Query user notional and leverage bracket on speicfic symbol
5729pub 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    // Create a mutable vector for query parameters
5735    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    // Create header parameters collection
5746    let mut header_params = std::collections::HashMap::new();
5747
5748    // Handle Binance Auth first if configured
5749    if let Some(ref binance_auth) = configuration.binance_auth {
5750        // Add API key to headers
5751        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5752        
5753        // Generate request body for signing (if any)
5754        let body_string: Option<Vec<u8>> = None;
5755        
5756        // Sign the request
5757        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        // Add signature to query params
5763        query_params.push(("signature".to_string(), signature));
5764    }
5765
5766    // Apply all query parameters
5767    if !query_params.is_empty() {
5768        req_builder = req_builder.query(&query_params);
5769    }
5770
5771
5772    // Add user agent if configured
5773    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    // Apply all header parameters
5778    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
5808/// Kline/candlestick bars for the mark price of a symbol. Klines are uniquely identified by their open time.
5809pub 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    // Create a mutable vector for query parameters
5815    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    // Create header parameters collection
5830    let mut header_params = std::collections::HashMap::new();
5831
5832    // Handle Binance Auth first if configured
5833    if let Some(ref binance_auth) = configuration.binance_auth {
5834        // Add API key to headers
5835        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5836        
5837        // Generate request body for signing (if any)
5838        let body_string: Option<Vec<u8>> = None;
5839        
5840        // Sign the request
5841        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        // Add signature to query params
5847        query_params.push(("signature".to_string(), signature));
5848    }
5849
5850    // Apply all query parameters
5851    if !query_params.is_empty() {
5852        req_builder = req_builder.query(&query_params);
5853    }
5854
5855
5856    // Add user agent if configured
5857    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    // Apply all header parameters
5862    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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`"))),
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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`")))),
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
5892/// Get user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on Every symbol
5893pub 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    // Create a mutable vector for query parameters
5899    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    // Create header parameters collection
5907    let mut header_params = std::collections::HashMap::new();
5908
5909    // Handle Binance Auth first if configured
5910    if let Some(ref binance_auth) = configuration.binance_auth {
5911        // Add API key to headers
5912        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5913        
5914        // Generate request body for signing (if any)
5915        let body_string: Option<Vec<u8>> = None;
5916        
5917        // Sign the request
5918        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        // Add signature to query params
5924        query_params.push(("signature".to_string(), signature));
5925    }
5926
5927    // Apply all query parameters
5928    if !query_params.is_empty() {
5929        req_builder = req_builder.query(&query_params);
5930    }
5931
5932
5933    // Add user agent if configured
5934    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    // Apply all header parameters
5939    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
5969/// Get present open interest of a specific symbol.
5970pub 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    // Create a mutable vector for query parameters
5976    let mut query_params: Vec<(String, String)> = Vec::new();
5977
5978    query_params.push(("symbol".to_string(), params.symbol.to_string()));
5979
5980    // Create header parameters collection
5981    let mut header_params = std::collections::HashMap::new();
5982
5983    // Handle Binance Auth first if configured
5984    if let Some(ref binance_auth) = configuration.binance_auth {
5985        // Add API key to headers
5986        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
5987        
5988        // Generate request body for signing (if any)
5989        let body_string: Option<Vec<u8>> = None;
5990        
5991        // Sign the request
5992        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        // Add signature to query params
5998        query_params.push(("signature".to_string(), signature));
5999    }
6000
6001    // Apply all query parameters
6002    if !query_params.is_empty() {
6003        req_builder = req_builder.query(&query_params);
6004    }
6005
6006
6007    // Add user agent if configured
6008    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    // Apply all header parameters
6013    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
6043/// Query open order
6044pub 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    // Create a mutable vector for query parameters
6050    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    // Create header parameters collection
6065    let mut header_params = std::collections::HashMap::new();
6066
6067    // Handle Binance Auth first if configured
6068    if let Some(ref binance_auth) = configuration.binance_auth {
6069        // Add API key to headers
6070        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6071        
6072        // Generate request body for signing (if any)
6073        let body_string: Option<Vec<u8>> = None;
6074        
6075        // Sign the request
6076        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        // Add signature to query params
6082        query_params.push(("signature".to_string(), signature));
6083    }
6084
6085    // Apply all query parameters
6086    if !query_params.is_empty() {
6087        req_builder = req_builder.query(&query_params);
6088    }
6089
6090
6091    // Add user agent if configured
6092    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    // Apply all header parameters
6097    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
6127/// Get all open orders on a symbol.
6128pub 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    // Create a mutable vector for query parameters
6134    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    // Create header parameters collection
6145    let mut header_params = std::collections::HashMap::new();
6146
6147    // Handle Binance Auth first if configured
6148    if let Some(ref binance_auth) = configuration.binance_auth {
6149        // Add API key to headers
6150        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6151        
6152        // Generate request body for signing (if any)
6153        let body_string: Option<Vec<u8>> = None;
6154        
6155        // Sign the request
6156        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        // Add signature to query params
6162        query_params.push(("signature".to_string(), signature));
6163    }
6164
6165    // Apply all query parameters
6166    if !query_params.is_empty() {
6167        req_builder = req_builder.query(&query_params);
6168    }
6169
6170
6171    // Add user agent if configured
6172    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    // Apply all header parameters
6177    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&lt;models::GetOpenOrdersV1RespItem&gt;`"))),
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&lt;models::GetOpenOrdersV1RespItem&gt;`")))),
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
6207/// Get order modification history
6208pub 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    // Create a mutable vector for query parameters
6214    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    // Create header parameters collection
6238    let mut header_params = std::collections::HashMap::new();
6239
6240    // Handle Binance Auth first if configured
6241    if let Some(ref binance_auth) = configuration.binance_auth {
6242        // Add API key to headers
6243        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6244        
6245        // Generate request body for signing (if any)
6246        let body_string: Option<Vec<u8>> = None;
6247        
6248        // Sign the request
6249        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        // Add signature to query params
6255        query_params.push(("signature".to_string(), signature));
6256    }
6257
6258    // Apply all query parameters
6259    if !query_params.is_empty() {
6260        req_builder = req_builder.query(&query_params);
6261    }
6262
6263
6264    // Add user agent if configured
6265    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    // Apply all header parameters
6270    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&lt;models::GetOrderAmendmentV1RespItem&gt;`"))),
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&lt;models::GetOrderAmendmentV1RespItem&gt;`")))),
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
6300/// Get futures order history download link by Id
6301pub 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    // Create a mutable vector for query parameters
6307    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    // Create header parameters collection
6316    let mut header_params = std::collections::HashMap::new();
6317
6318    // Handle Binance Auth first if configured
6319    if let Some(ref binance_auth) = configuration.binance_auth {
6320        // Add API key to headers
6321        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6322        
6323        // Generate request body for signing (if any)
6324        let body_string: Option<Vec<u8>> = None;
6325        
6326        // Sign the request
6327        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        // Add signature to query params
6333        query_params.push(("signature".to_string(), signature));
6334    }
6335
6336    // Apply all query parameters
6337    if !query_params.is_empty() {
6338        req_builder = req_builder.query(&query_params);
6339    }
6340
6341
6342    // Add user agent if configured
6343    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    // Apply all header parameters
6348    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
6378/// Get Download Id For Futures Order History
6379pub 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    // Create a mutable vector for query parameters
6385    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    // Create header parameters collection
6395    let mut header_params = std::collections::HashMap::new();
6396
6397    // Handle Binance Auth first if configured
6398    if let Some(ref binance_auth) = configuration.binance_auth {
6399        // Add API key to headers
6400        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6401        
6402        // Generate request body for signing (if any)
6403        let body_string: Option<Vec<u8>> = None;
6404        
6405        // Sign the request
6406        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        // Add signature to query params
6412        query_params.push(("signature".to_string(), signature));
6413    }
6414
6415    // Apply all query parameters
6416    if !query_params.is_empty() {
6417        req_builder = req_builder.query(&query_params);
6418    }
6419
6420
6421    // Add user agent if configured
6422    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    // Apply all header parameters
6427    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
6457/// Check an order's status.
6458pub 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    // Create a mutable vector for query parameters
6464    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    // Create header parameters collection
6479    let mut header_params = std::collections::HashMap::new();
6480
6481    // Handle Binance Auth first if configured
6482    if let Some(ref binance_auth) = configuration.binance_auth {
6483        // Add API key to headers
6484        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6485        
6486        // Generate request body for signing (if any)
6487        let body_string: Option<Vec<u8>> = None;
6488        
6489        // Sign the request
6490        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        // Add signature to query params
6496        query_params.push(("signature".to_string(), signature));
6497    }
6498
6499    // Apply all query parameters
6500    if !query_params.is_empty() {
6501        req_builder = req_builder.query(&query_params);
6502    }
6503
6504
6505    // Add user agent if configured
6506    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    // Apply all header parameters
6511    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
6541/// Test connectivity to the Rest API.
6542pub 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    // Create a mutable vector for query parameters
6548    let mut query_params: Vec<(String, String)> = Vec::new();
6549
6550
6551    // Create header parameters collection
6552    let mut header_params = std::collections::HashMap::new();
6553
6554    // Handle Binance Auth first if configured
6555    if let Some(ref binance_auth) = configuration.binance_auth {
6556        // Add API key to headers
6557        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6558        
6559        // Generate request body for signing (if any)
6560        let body_string: Option<Vec<u8>> = None;
6561        
6562        // Sign the request
6563        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        // Add signature to query params
6569        query_params.push(("signature".to_string(), signature));
6570    }
6571
6572    // Apply all query parameters
6573    if !query_params.is_empty() {
6574        req_builder = req_builder.query(&query_params);
6575    }
6576
6577
6578    // Add user agent if configured
6579    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    // Apply all header parameters
6584    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
6614/// Get Classic Portfolio Margin current account information.
6615pub 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    // Create a mutable vector for query parameters
6621    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    // Create header parameters collection
6630    let mut header_params = std::collections::HashMap::new();
6631
6632    // Handle Binance Auth first if configured
6633    if let Some(ref binance_auth) = configuration.binance_auth {
6634        // Add API key to headers
6635        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6636        
6637        // Generate request body for signing (if any)
6638        let body_string: Option<Vec<u8>> = None;
6639        
6640        // Sign the request
6641        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        // Add signature to query params
6647        query_params.push(("signature".to_string(), signature));
6648    }
6649
6650    // Apply all query parameters
6651    if !query_params.is_empty() {
6652        req_builder = req_builder.query(&query_params);
6653    }
6654
6655
6656    // Add user agent if configured
6657    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    // Apply all header parameters
6662    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
6692/// Get Position Margin Change History
6693pub 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    // Create a mutable vector for query parameters
6699    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    // Create header parameters collection
6720    let mut header_params = std::collections::HashMap::new();
6721
6722    // Handle Binance Auth first if configured
6723    if let Some(ref binance_auth) = configuration.binance_auth {
6724        // Add API key to headers
6725        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6726        
6727        // Generate request body for signing (if any)
6728        let body_string: Option<Vec<u8>> = None;
6729        
6730        // Sign the request
6731        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        // Add signature to query params
6737        query_params.push(("signature".to_string(), signature));
6738    }
6739
6740    // Apply all query parameters
6741    if !query_params.is_empty() {
6742        req_builder = req_builder.query(&query_params);
6743    }
6744
6745
6746    // Add user agent if configured
6747    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    // Apply all header parameters
6752    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&lt;models::GetPositionMarginHistoryV1RespItem&gt;`"))),
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&lt;models::GetPositionMarginHistoryV1RespItem&gt;`")))),
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
6782/// Get current position information.
6783pub 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    // Create a mutable vector for query parameters
6789    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    // Create header parameters collection
6800    let mut header_params = std::collections::HashMap::new();
6801
6802    // Handle Binance Auth first if configured
6803    if let Some(ref binance_auth) = configuration.binance_auth {
6804        // Add API key to headers
6805        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6806        
6807        // Generate request body for signing (if any)
6808        let body_string: Option<Vec<u8>> = None;
6809        
6810        // Sign the request
6811        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        // Add signature to query params
6817        query_params.push(("signature".to_string(), signature));
6818    }
6819
6820    // Apply all query parameters
6821    if !query_params.is_empty() {
6822        req_builder = req_builder.query(&query_params);
6823    }
6824
6825
6826    // Add user agent if configured
6827    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    // Apply all header parameters
6832    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&lt;models::GetPositionRiskV2RespItem&gt;`"))),
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&lt;models::GetPositionRiskV2RespItem&gt;`")))),
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
6862/// Get current position information(only symbol that has position or open orders will be returned).
6863pub 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    // Create a mutable vector for query parameters
6869    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    // Create header parameters collection
6880    let mut header_params = std::collections::HashMap::new();
6881
6882    // Handle Binance Auth first if configured
6883    if let Some(ref binance_auth) = configuration.binance_auth {
6884        // Add API key to headers
6885        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6886        
6887        // Generate request body for signing (if any)
6888        let body_string: Option<Vec<u8>> = None;
6889        
6890        // Sign the request
6891        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        // Add signature to query params
6897        query_params.push(("signature".to_string(), signature));
6898    }
6899
6900    // Apply all query parameters
6901    if !query_params.is_empty() {
6902        req_builder = req_builder.query(&query_params);
6903    }
6904
6905
6906    // Add user agent if configured
6907    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    // Apply all header parameters
6912    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&lt;models::GetPositionRiskV3RespItem&gt;`"))),
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&lt;models::GetPositionRiskV3RespItem&gt;`")))),
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
6942/// Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol
6943pub 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    // Create a mutable vector for query parameters
6949    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    // Create header parameters collection
6957    let mut header_params = std::collections::HashMap::new();
6958
6959    // Handle Binance Auth first if configured
6960    if let Some(ref binance_auth) = configuration.binance_auth {
6961        // Add API key to headers
6962        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
6963        
6964        // Generate request body for signing (if any)
6965        let body_string: Option<Vec<u8>> = None;
6966        
6967        // Sign the request
6968        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        // Add signature to query params
6974        query_params.push(("signature".to_string(), signature));
6975    }
6976
6977    // Apply all query parameters
6978    if !query_params.is_empty() {
6979        req_builder = req_builder.query(&query_params);
6980    }
6981
6982
6983    // Add user agent if configured
6984    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    // Apply all header parameters
6989    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
7019/// Premium index kline bars of a symbol. Klines are uniquely identified by their open time.
7020pub 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    // Create a mutable vector for query parameters
7026    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    // Create header parameters collection
7041    let mut header_params = std::collections::HashMap::new();
7042
7043    // Handle Binance Auth first if configured
7044    if let Some(ref binance_auth) = configuration.binance_auth {
7045        // Add API key to headers
7046        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7047        
7048        // Generate request body for signing (if any)
7049        let body_string: Option<Vec<u8>> = None;
7050        
7051        // Sign the request
7052        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        // Add signature to query params
7058        query_params.push(("signature".to_string(), signature));
7059    }
7060
7061    // Apply all query parameters
7062    if !query_params.is_empty() {
7063        req_builder = req_builder.query(&query_params);
7064    }
7065
7066
7067    // Add user agent if configured
7068    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    // Apply all header parameters
7073    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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`"))),
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&lt;Vec&lt;models::UmfuturesGetContinuousKlinesV1RespInnerInner&gt;&gt;`")))),
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
7103/// Mark Price and Funding Rate
7104pub 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    // Create a mutable vector for query parameters
7110    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    // Create header parameters collection
7117    let mut header_params = std::collections::HashMap::new();
7118
7119    // Handle Binance Auth first if configured
7120    if let Some(ref binance_auth) = configuration.binance_auth {
7121        // Add API key to headers
7122        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7123        
7124        // Generate request body for signing (if any)
7125        let body_string: Option<Vec<u8>> = None;
7126        
7127        // Sign the request
7128        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        // Add signature to query params
7134        query_params.push(("signature".to_string(), signature));
7135    }
7136
7137    // Apply all query parameters
7138    if !query_params.is_empty() {
7139        req_builder = req_builder.query(&query_params);
7140    }
7141
7142
7143    // Add user agent if configured
7144    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    // Apply all header parameters
7149    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
7179/// Query User Rate Limit
7180pub 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    // Create a mutable vector for query parameters
7186    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    // Create header parameters collection
7194    let mut header_params = std::collections::HashMap::new();
7195
7196    // Handle Binance Auth first if configured
7197    if let Some(ref binance_auth) = configuration.binance_auth {
7198        // Add API key to headers
7199        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7200        
7201        // Generate request body for signing (if any)
7202        let body_string: Option<Vec<u8>> = None;
7203        
7204        // Sign the request
7205        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        // Add signature to query params
7211        query_params.push(("signature".to_string(), signature));
7212    }
7213
7214    // Apply all query parameters
7215    if !query_params.is_empty() {
7216        req_builder = req_builder.query(&query_params);
7217    }
7218
7219
7220    // Add user agent if configured
7221    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    // Apply all header parameters
7226    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&lt;models::GetRateLimitOrderV1RespItem&gt;`"))),
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&lt;models::GetRateLimitOrderV1RespItem&gt;`")))),
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
7256/// Get current account symbol configuration.
7257pub 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    // Create a mutable vector for query parameters
7263    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    // Create header parameters collection
7274    let mut header_params = std::collections::HashMap::new();
7275
7276    // Handle Binance Auth first if configured
7277    if let Some(ref binance_auth) = configuration.binance_auth {
7278        // Add API key to headers
7279        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7280        
7281        // Generate request body for signing (if any)
7282        let body_string: Option<Vec<u8>> = None;
7283        
7284        // Sign the request
7285        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        // Add signature to query params
7291        query_params.push(("signature".to_string(), signature));
7292    }
7293
7294    // Apply all query parameters
7295    if !query_params.is_empty() {
7296        req_builder = req_builder.query(&query_params);
7297    }
7298
7299
7300    // Add user agent if configured
7301    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    // Apply all header parameters
7306    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&lt;models::GetSymbolConfigV1RespItem&gt;`"))),
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&lt;models::GetSymbolConfigV1RespItem&gt;`")))),
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
7336/// 24 hour rolling window price change statistics. Careful when accessing this with no symbol.
7337pub 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    // Create a mutable vector for query parameters
7343    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    // Create header parameters collection
7350    let mut header_params = std::collections::HashMap::new();
7351
7352    // Handle Binance Auth first if configured
7353    if let Some(ref binance_auth) = configuration.binance_auth {
7354        // Add API key to headers
7355        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7356        
7357        // Generate request body for signing (if any)
7358        let body_string: Option<Vec<u8>> = None;
7359        
7360        // Sign the request
7361        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        // Add signature to query params
7367        query_params.push(("signature".to_string(), signature));
7368    }
7369
7370    // Apply all query parameters
7371    if !query_params.is_empty() {
7372        req_builder = req_builder.query(&query_params);
7373    }
7374
7375
7376    // Add user agent if configured
7377    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    // Apply all header parameters
7382    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
7412/// Best price/qty on the order book for a symbol or symbols.
7413pub 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    // Create a mutable vector for query parameters
7419    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    // Create header parameters collection
7426    let mut header_params = std::collections::HashMap::new();
7427
7428    // Handle Binance Auth first if configured
7429    if let Some(ref binance_auth) = configuration.binance_auth {
7430        // Add API key to headers
7431        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7432        
7433        // Generate request body for signing (if any)
7434        let body_string: Option<Vec<u8>> = None;
7435        
7436        // Sign the request
7437        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        // Add signature to query params
7443        query_params.push(("signature".to_string(), signature));
7444    }
7445
7446    // Apply all query parameters
7447    if !query_params.is_empty() {
7448        req_builder = req_builder.query(&query_params);
7449    }
7450
7451
7452    // Add user agent if configured
7453    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    // Apply all header parameters
7458    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
7488/// Latest price for a symbol or symbols.
7489pub 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    // Create a mutable vector for query parameters
7495    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    // Create header parameters collection
7502    let mut header_params = std::collections::HashMap::new();
7503
7504    // Handle Binance Auth first if configured
7505    if let Some(ref binance_auth) = configuration.binance_auth {
7506        // Add API key to headers
7507        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7508        
7509        // Generate request body for signing (if any)
7510        let body_string: Option<Vec<u8>> = None;
7511        
7512        // Sign the request
7513        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        // Add signature to query params
7519        query_params.push(("signature".to_string(), signature));
7520    }
7521
7522    // Apply all query parameters
7523    if !query_params.is_empty() {
7524        req_builder = req_builder.query(&query_params);
7525    }
7526
7527
7528    // Add user agent if configured
7529    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    // Apply all header parameters
7534    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
7564/// Latest price for a symbol or symbols.
7565pub 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    // Create a mutable vector for query parameters
7571    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    // Create header parameters collection
7578    let mut header_params = std::collections::HashMap::new();
7579
7580    // Handle Binance Auth first if configured
7581    if let Some(ref binance_auth) = configuration.binance_auth {
7582        // Add API key to headers
7583        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7584        
7585        // Generate request body for signing (if any)
7586        let body_string: Option<Vec<u8>> = None;
7587        
7588        // Sign the request
7589        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        // Add signature to query params
7595        query_params.push(("signature".to_string(), signature));
7596    }
7597
7598    // Apply all query parameters
7599    if !query_params.is_empty() {
7600        req_builder = req_builder.query(&query_params);
7601    }
7602
7603
7604    // Add user agent if configured
7605    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    // Apply all header parameters
7610    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
7640/// Test connectivity to the Rest API and get the current server time.
7641pub 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    // Create a mutable vector for query parameters
7647    let mut query_params: Vec<(String, String)> = Vec::new();
7648
7649
7650    // Create header parameters collection
7651    let mut header_params = std::collections::HashMap::new();
7652
7653    // Handle Binance Auth first if configured
7654    if let Some(ref binance_auth) = configuration.binance_auth {
7655        // Add API key to headers
7656        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7657        
7658        // Generate request body for signing (if any)
7659        let body_string: Option<Vec<u8>> = None;
7660        
7661        // Sign the request
7662        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        // Add signature to query params
7668        query_params.push(("signature".to_string(), signature));
7669    }
7670
7671    // Apply all query parameters
7672    if !query_params.is_empty() {
7673        req_builder = req_builder.query(&query_params);
7674    }
7675
7676
7677    // Add user agent if configured
7678    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    // Apply all header parameters
7683    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
7713/// Get futures trade download link by Id
7714pub 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    // Create a mutable vector for query parameters
7720    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    // Create header parameters collection
7729    let mut header_params = std::collections::HashMap::new();
7730
7731    // Handle Binance Auth first if configured
7732    if let Some(ref binance_auth) = configuration.binance_auth {
7733        // Add API key to headers
7734        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7735        
7736        // Generate request body for signing (if any)
7737        let body_string: Option<Vec<u8>> = None;
7738        
7739        // Sign the request
7740        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        // Add signature to query params
7746        query_params.push(("signature".to_string(), signature));
7747    }
7748
7749    // Apply all query parameters
7750    if !query_params.is_empty() {
7751        req_builder = req_builder.query(&query_params);
7752    }
7753
7754
7755    // Add user agent if configured
7756    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    // Apply all header parameters
7761    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
7791/// Get download id for futures trade history
7792pub 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    // Create a mutable vector for query parameters
7798    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    // Create header parameters collection
7808    let mut header_params = std::collections::HashMap::new();
7809
7810    // Handle Binance Auth first if configured
7811    if let Some(ref binance_auth) = configuration.binance_auth {
7812        // Add API key to headers
7813        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7814        
7815        // Generate request body for signing (if any)
7816        let body_string: Option<Vec<u8>> = None;
7817        
7818        // Sign the request
7819        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        // Add signature to query params
7825        query_params.push(("signature".to_string(), signature));
7826    }
7827
7828    // Apply all query parameters
7829    if !query_params.is_empty() {
7830        req_builder = req_builder.query(&query_params);
7831    }
7832
7833
7834    // Add user agent if configured
7835    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    // Apply all header parameters
7840    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
7870/// Get recent market trades
7871pub 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    // Create a mutable vector for query parameters
7877    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    // Create header parameters collection
7885    let mut header_params = std::collections::HashMap::new();
7886
7887    // Handle Binance Auth first if configured
7888    if let Some(ref binance_auth) = configuration.binance_auth {
7889        // Add API key to headers
7890        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7891        
7892        // Generate request body for signing (if any)
7893        let body_string: Option<Vec<u8>> = None;
7894        
7895        // Sign the request
7896        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        // Add signature to query params
7902        query_params.push(("signature".to_string(), signature));
7903    }
7904
7905    // Apply all query parameters
7906    if !query_params.is_empty() {
7907        req_builder = req_builder.query(&query_params);
7908    }
7909
7910
7911    // Add user agent if configured
7912    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    // Apply all header parameters
7917    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&lt;models::GetTradesV1RespItem&gt;`"))),
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&lt;models::GetTradesV1RespItem&gt;`")))),
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
7947/// Get trades for a specific account and symbol.
7948pub 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    // Create a mutable vector for query parameters
7954    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    // Create header parameters collection
7978    let mut header_params = std::collections::HashMap::new();
7979
7980    // Handle Binance Auth first if configured
7981    if let Some(ref binance_auth) = configuration.binance_auth {
7982        // Add API key to headers
7983        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
7984        
7985        // Generate request body for signing (if any)
7986        let body_string: Option<Vec<u8>> = None;
7987        
7988        // Sign the request
7989        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        // Add signature to query params
7995        query_params.push(("signature".to_string(), signature));
7996    }
7997
7998    // Apply all query parameters
7999    if !query_params.is_empty() {
8000        req_builder = req_builder.query(&query_params);
8001    }
8002
8003
8004    // Add user agent if configured
8005    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    // Apply all header parameters
8010    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&lt;models::GetUserTradesV1RespItem&gt;`"))),
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&lt;models::GetUserTradesV1RespItem&gt;`")))),
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
8040/// Modify Multiple Orders (TRADE)
8041pub 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    // Create a mutable vector for query parameters
8047    let mut query_params: Vec<(String, String)> = Vec::new();
8048
8049
8050    // Create header parameters collection
8051    let mut header_params = std::collections::HashMap::new();
8052
8053    // Handle Binance Auth first if configured
8054    if let Some(ref binance_auth) = configuration.binance_auth {
8055        // Add API key to headers
8056        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8057        
8058        // Generate request body for signing (if any)
8059        let body_string: Option<Vec<u8>> = None;
8060        
8061        // Sign the request
8062        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        // Add signature to query params
8068        query_params.push(("signature".to_string(), signature));
8069    }
8070
8071    // Apply all query parameters
8072    if !query_params.is_empty() {
8073        req_builder = req_builder.query(&query_params);
8074    }
8075
8076
8077    // Add user agent if configured
8078    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    // Apply all header parameters
8083    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&lt;models::UmfuturesUpdateBatchOrdersV1RespItem&gt;`"))),
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&lt;models::UmfuturesUpdateBatchOrdersV1RespItem&gt;`")))),
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
8120/// Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes.
8121pub 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    // Create a mutable vector for query parameters
8127    let mut query_params: Vec<(String, String)> = Vec::new();
8128
8129
8130    // Create header parameters collection
8131    let mut header_params = std::collections::HashMap::new();
8132
8133    // Handle Binance Auth first if configured
8134    if let Some(ref binance_auth) = configuration.binance_auth {
8135        // Add API key to headers
8136        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8137        
8138        // Generate request body for signing (if any)
8139        let body_string: Option<Vec<u8>> = None;
8140        
8141        // Sign the request
8142        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        // Add signature to query params
8148        query_params.push(("signature".to_string(), signature));
8149    }
8150
8151    // Apply all query parameters
8152    if !query_params.is_empty() {
8153        req_builder = req_builder.query(&query_params);
8154    }
8155
8156
8157    // Add user agent if configured
8158    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    // Apply all header parameters
8163    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
8193/// Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue
8194pub 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    // Create a mutable vector for query parameters
8200    let mut query_params: Vec<(String, String)> = Vec::new();
8201
8202
8203    // Create header parameters collection
8204    let mut header_params = std::collections::HashMap::new();
8205
8206    // Handle Binance Auth first if configured
8207    if let Some(ref binance_auth) = configuration.binance_auth {
8208        // Add API key to headers
8209        header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
8210        
8211        // Generate request body for signing (if any)
8212        let body_string: Option<Vec<u8>> = None;
8213        
8214        // Sign the request
8215        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        // Add signature to query params
8221        query_params.push(("signature".to_string(), signature));
8222    }
8223
8224    // Apply all query parameters
8225    if !query_params.is_empty() {
8226        req_builder = req_builder.query(&query_params);
8227    }
8228
8229
8230    // Add user agent if configured
8231    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    // Apply all header parameters
8236    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