1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::umfutures::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug, Default)]
19pub struct CreateApiReferralCustomizationV1Params {
20 pub customer_id: String,
21 pub email: String,
22 pub timestamp: i64,
23 pub recv_window: Option<i64>
24}
25
26#[derive(Clone, Debug, Default)]
28pub struct CreateApiReferralUserCustomizationPapiv1Params {
29 pub broker_id: String,
30 pub customer_id: String,
31 pub timestamp: i64,
32 pub recv_window: Option<i64>
33}
34
35#[derive(Clone, Debug, Default)]
37pub struct CreateApiReferralUserCustomizationV1Params {
38 pub broker_id: String,
39 pub customer_id: String,
40 pub timestamp: i64,
41 pub recv_window: Option<i64>
42}
43
44#[derive(Clone, Debug, Default)]
46pub struct GetApiReferralCustomizationV1Params {
47 pub timestamp: i64,
48 pub customer_id: Option<String>,
49 pub email: Option<String>,
50 pub page: Option<i64>,
52 pub limit: Option<i64>,
54 pub recv_window: Option<i64>
55}
56
57#[derive(Clone, Debug, Default)]
59pub struct GetApiReferralIfNewUserPapiv1Params {
60 pub broker_id: String,
61 pub timestamp: i64,
62 pub r#type: Option<i32>,
64 pub recv_window: Option<i64>
65}
66
67#[derive(Clone, Debug, Default)]
69pub struct GetApiReferralIfNewUserV1Params {
70 pub broker_id: String,
71 pub timestamp: i64,
72 pub r#type: Option<i32>,
74 pub recv_window: Option<i64>
75}
76
77#[derive(Clone, Debug, Default)]
79pub struct GetApiReferralOverviewV1Params {
80 pub timestamp: i64,
81 pub r#type: Option<i32>,
83 pub recv_window: Option<i64>
84}
85
86#[derive(Clone, Debug, Default)]
88pub struct GetApiReferralRebateVolV1Params {
89 pub timestamp: i64,
90 pub r#type: Option<i32>,
92 pub start_time: Option<i64>,
93 pub end_time: Option<i64>,
94 pub limit: Option<i32>,
96 pub recv_window: Option<i64>
97}
98
99#[derive(Clone, Debug, Default)]
101pub struct GetApiReferralTradeVolV1Params {
102 pub timestamp: i64,
103 pub r#type: Option<i32>,
105 pub start_time: Option<i64>,
106 pub end_time: Option<i64>,
107 pub limit: Option<i32>,
109 pub recv_window: Option<i64>
110}
111
112#[derive(Clone, Debug, Default)]
114pub struct GetApiReferralTraderNumV1Params {
115 pub timestamp: i64,
116 pub r#type: Option<i32>,
118 pub start_time: Option<i64>,
119 pub end_time: Option<i64>,
120 pub limit: Option<i32>,
122 pub recv_window: Option<i64>
123}
124
125#[derive(Clone, Debug, Default)]
127pub struct GetApiReferralTraderSummaryV1Params {
128 pub timestamp: i64,
129 pub customer_id: Option<String>,
130 pub r#type: Option<i32>,
132 pub start_time: Option<i64>,
133 pub end_time: Option<i64>,
134 pub limit: Option<i32>,
136 pub recv_window: Option<i64>
137}
138
139#[derive(Clone, Debug, Default)]
141pub struct GetApiReferralUserCustomizationPapiv1Params {
142 pub broker_id: String,
143 pub timestamp: i64,
144 pub recv_window: Option<i64>
145}
146
147#[derive(Clone, Debug, Default)]
149pub struct GetApiReferralUserCustomizationV1Params {
150 pub broker_id: String,
151 pub timestamp: i64,
152 pub recv_window: Option<i64>
153}
154
155#[derive(Clone, Debug, Default)]
157pub struct GetIncomeV1Params {
158 pub timestamp: i64,
159 pub symbol: Option<String>,
160 pub income_type: Option<String>,
162 pub start_time: Option<i64>,
164 pub end_time: Option<i64>,
166 pub limit: Option<i32>,
168 pub recv_window: Option<i64>
169}
170
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum CreateApiReferralCustomizationV1Error {
176 Status4XX(models::ApiError),
177 Status5XX(models::ApiError),
178 UnknownValue(serde_json::Value),
179}
180
181#[derive(Debug, Clone, Serialize, Deserialize)]
183#[serde(untagged)]
184pub enum CreateApiReferralUserCustomizationPapiv1Error {
185 Status4XX(models::ApiError),
186 Status5XX(models::ApiError),
187 UnknownValue(serde_json::Value),
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum CreateApiReferralUserCustomizationV1Error {
194 Status4XX(models::ApiError),
195 Status5XX(models::ApiError),
196 UnknownValue(serde_json::Value),
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum GetApiReferralCustomizationV1Error {
203 Status4XX(models::ApiError),
204 Status5XX(models::ApiError),
205 UnknownValue(serde_json::Value),
206}
207
208#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum GetApiReferralIfNewUserPapiv1Error {
212 Status4XX(models::ApiError),
213 Status5XX(models::ApiError),
214 UnknownValue(serde_json::Value),
215}
216
217#[derive(Debug, Clone, Serialize, Deserialize)]
219#[serde(untagged)]
220pub enum GetApiReferralIfNewUserV1Error {
221 Status4XX(models::ApiError),
222 Status5XX(models::ApiError),
223 UnknownValue(serde_json::Value),
224}
225
226#[derive(Debug, Clone, Serialize, Deserialize)]
228#[serde(untagged)]
229pub enum GetApiReferralOverviewV1Error {
230 Status4XX(models::ApiError),
231 Status5XX(models::ApiError),
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum GetApiReferralRebateVolV1Error {
239 Status4XX(models::ApiError),
240 Status5XX(models::ApiError),
241 UnknownValue(serde_json::Value),
242}
243
244#[derive(Debug, Clone, Serialize, Deserialize)]
246#[serde(untagged)]
247pub enum GetApiReferralTradeVolV1Error {
248 Status4XX(models::ApiError),
249 Status5XX(models::ApiError),
250 UnknownValue(serde_json::Value),
251}
252
253#[derive(Debug, Clone, Serialize, Deserialize)]
255#[serde(untagged)]
256pub enum GetApiReferralTraderNumV1Error {
257 Status4XX(models::ApiError),
258 Status5XX(models::ApiError),
259 UnknownValue(serde_json::Value),
260}
261
262#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum GetApiReferralTraderSummaryV1Error {
266 Status4XX(models::ApiError),
267 Status5XX(models::ApiError),
268 UnknownValue(serde_json::Value),
269}
270
271#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum GetApiReferralUserCustomizationPapiv1Error {
275 Status4XX(models::ApiError),
276 Status5XX(models::ApiError),
277 UnknownValue(serde_json::Value),
278}
279
280#[derive(Debug, Clone, Serialize, Deserialize)]
282#[serde(untagged)]
283pub enum GetApiReferralUserCustomizationV1Error {
284 Status4XX(models::ApiError),
285 Status5XX(models::ApiError),
286 UnknownValue(serde_json::Value),
287}
288
289#[derive(Debug, Clone, Serialize, Deserialize)]
291#[serde(untagged)]
292pub enum GetIncomeV1Error {
293 Status4XX(models::ApiError),
294 Status5XX(models::ApiError),
295 UnknownValue(serde_json::Value),
296}
297
298
299pub async fn create_api_referral_customization_v1(configuration: &configuration::Configuration, params: CreateApiReferralCustomizationV1Params) -> Result<models::CreateApiReferralCustomizationV1Resp, Error<CreateApiReferralCustomizationV1Error>> {
301
302 let uri_str = format!("{}/fapi/v1/apiReferral/customization", configuration.base_path);
303 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
304
305 let mut query_params: Vec<(String, String)> = Vec::new();
307
308
309 let mut header_params = std::collections::HashMap::new();
311
312 if let Some(ref binance_auth) = configuration.binance_auth {
314 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
316
317 let body_string: Option<Vec<u8>> = None;
319
320 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
322 Ok(sig) => sig,
323 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
324 };
325
326 query_params.push(("signature".to_string(), signature));
328 }
329
330 if !query_params.is_empty() {
332 req_builder = req_builder.query(&query_params);
333 }
334
335
336 if let Some(ref user_agent) = configuration.user_agent {
338 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
339 }
340
341 for (header_name, header_value) in header_params {
343 req_builder = req_builder.header(&header_name, &header_value);
344 }
345
346 let mut multipart_form_params = std::collections::HashMap::new();
347 multipart_form_params.insert("customerId", params.customer_id.to_string());
348 multipart_form_params.insert("email", params.email.to_string());
349 if let Some(param_value) = params.recv_window {
350 multipart_form_params.insert("recvWindow", param_value.to_string());
351 }
352 multipart_form_params.insert("timestamp", params.timestamp.to_string());
353 req_builder = req_builder.form(&multipart_form_params);
354
355 let req = req_builder.build()?;
356 let resp = configuration.client.execute(req).await?;
357
358 let status = resp.status();
359 let content_type = resp
360 .headers()
361 .get("content-type")
362 .and_then(|v| v.to_str().ok())
363 .unwrap_or("application/octet-stream");
364 let content_type = super::ContentType::from(content_type);
365
366 if !status.is_client_error() && !status.is_server_error() {
367 let content = resp.text().await?;
368 match content_type {
369 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
370 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateApiReferralCustomizationV1Resp`"))),
371 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateApiReferralCustomizationV1Resp`")))),
372 }
373 } else {
374 let content = resp.text().await?;
375 let entity: Option<CreateApiReferralCustomizationV1Error> = serde_json::from_str(&content).ok();
376 Err(Error::ResponseError(ResponseContent { status, content, entity }))
377 }
378}
379
380pub async fn create_api_referral_user_customization_papiv1(configuration: &configuration::Configuration, params: CreateApiReferralUserCustomizationPapiv1Params) -> Result<models::CreateApiReferralUserCustomizationV1Resp, Error<CreateApiReferralUserCustomizationPapiv1Error>> {
382
383 let uri_str = format!("{}/papi/v1/apiReferral/userCustomization", configuration.base_path);
384 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
385
386 let mut query_params: Vec<(String, String)> = Vec::new();
388
389
390 let mut header_params = std::collections::HashMap::new();
392
393 if let Some(ref binance_auth) = configuration.binance_auth {
395 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
397
398 let body_string: Option<Vec<u8>> = None;
400
401 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
403 Ok(sig) => sig,
404 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
405 };
406
407 query_params.push(("signature".to_string(), signature));
409 }
410
411 if !query_params.is_empty() {
413 req_builder = req_builder.query(&query_params);
414 }
415
416
417 if let Some(ref user_agent) = configuration.user_agent {
419 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
420 }
421
422 for (header_name, header_value) in header_params {
424 req_builder = req_builder.header(&header_name, &header_value);
425 }
426
427 let mut multipart_form_params = std::collections::HashMap::new();
428 multipart_form_params.insert("brokerId", params.broker_id.to_string());
429 multipart_form_params.insert("customerId", params.customer_id.to_string());
430 if let Some(param_value) = params.recv_window {
431 multipart_form_params.insert("recvWindow", param_value.to_string());
432 }
433 multipart_form_params.insert("timestamp", params.timestamp.to_string());
434 req_builder = req_builder.form(&multipart_form_params);
435
436 let req = req_builder.build()?;
437 let resp = configuration.client.execute(req).await?;
438
439 let status = resp.status();
440 let content_type = resp
441 .headers()
442 .get("content-type")
443 .and_then(|v| v.to_str().ok())
444 .unwrap_or("application/octet-stream");
445 let content_type = super::ContentType::from(content_type);
446
447 if !status.is_client_error() && !status.is_server_error() {
448 let content = resp.text().await?;
449 match content_type {
450 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
451 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateApiReferralUserCustomizationV1Resp`"))),
452 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateApiReferralUserCustomizationV1Resp`")))),
453 }
454 } else {
455 let content = resp.text().await?;
456 let entity: Option<CreateApiReferralUserCustomizationPapiv1Error> = serde_json::from_str(&content).ok();
457 Err(Error::ResponseError(ResponseContent { status, content, entity }))
458 }
459}
460
461pub async fn create_api_referral_user_customization_v1(configuration: &configuration::Configuration, params: CreateApiReferralUserCustomizationV1Params) -> Result<models::CreateApiReferralUserCustomizationV1Resp, Error<CreateApiReferralUserCustomizationV1Error>> {
463
464 let uri_str = format!("{}/fapi/v1/apiReferral/userCustomization", configuration.base_path);
465 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
466
467 let mut query_params: Vec<(String, String)> = Vec::new();
469
470
471 let mut header_params = std::collections::HashMap::new();
473
474 if let Some(ref binance_auth) = configuration.binance_auth {
476 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
478
479 let body_string: Option<Vec<u8>> = None;
481
482 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
484 Ok(sig) => sig,
485 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
486 };
487
488 query_params.push(("signature".to_string(), signature));
490 }
491
492 if !query_params.is_empty() {
494 req_builder = req_builder.query(&query_params);
495 }
496
497
498 if let Some(ref user_agent) = configuration.user_agent {
500 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
501 }
502
503 for (header_name, header_value) in header_params {
505 req_builder = req_builder.header(&header_name, &header_value);
506 }
507
508 let mut multipart_form_params = std::collections::HashMap::new();
509 multipart_form_params.insert("brokerId", params.broker_id.to_string());
510 multipart_form_params.insert("customerId", params.customer_id.to_string());
511 if let Some(param_value) = params.recv_window {
512 multipart_form_params.insert("recvWindow", param_value.to_string());
513 }
514 multipart_form_params.insert("timestamp", params.timestamp.to_string());
515 req_builder = req_builder.form(&multipart_form_params);
516
517 let req = req_builder.build()?;
518 let resp = configuration.client.execute(req).await?;
519
520 let status = resp.status();
521 let content_type = resp
522 .headers()
523 .get("content-type")
524 .and_then(|v| v.to_str().ok())
525 .unwrap_or("application/octet-stream");
526 let content_type = super::ContentType::from(content_type);
527
528 if !status.is_client_error() && !status.is_server_error() {
529 let content = resp.text().await?;
530 match content_type {
531 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
532 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateApiReferralUserCustomizationV1Resp`"))),
533 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateApiReferralUserCustomizationV1Resp`")))),
534 }
535 } else {
536 let content = resp.text().await?;
537 let entity: Option<CreateApiReferralUserCustomizationV1Error> = serde_json::from_str(&content).ok();
538 Err(Error::ResponseError(ResponseContent { status, content, entity }))
539 }
540}
541
542pub async fn get_api_referral_customization_v1(configuration: &configuration::Configuration, params: GetApiReferralCustomizationV1Params) -> Result<Vec<models::GetApiReferralCustomizationV1RespItem>, Error<GetApiReferralCustomizationV1Error>> {
544
545 let uri_str = format!("{}/fapi/v1/apiReferral/customization", configuration.base_path);
546 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
547
548 let mut query_params: Vec<(String, String)> = Vec::new();
550
551 if let Some(ref param_value) = params.customer_id {
552 query_params.push(("customerId".to_string(), param_value.to_string()));
553 }
554 if let Some(ref param_value) = params.email {
555 query_params.push(("email".to_string(), param_value.to_string()));
556 }
557 if let Some(ref param_value) = params.page {
558 query_params.push(("page".to_string(), param_value.to_string()));
559 }
560 if let Some(ref param_value) = params.limit {
561 query_params.push(("limit".to_string(), param_value.to_string()));
562 }
563 if let Some(ref param_value) = params.recv_window {
564 query_params.push(("recvWindow".to_string(), param_value.to_string()));
565 }
566 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
567
568 let mut header_params = std::collections::HashMap::new();
570
571 if let Some(ref binance_auth) = configuration.binance_auth {
573 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
575
576 let body_string: Option<Vec<u8>> = None;
578
579 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
581 Ok(sig) => sig,
582 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
583 };
584
585 query_params.push(("signature".to_string(), signature));
587 }
588
589 if !query_params.is_empty() {
591 req_builder = req_builder.query(&query_params);
592 }
593
594
595 if let Some(ref user_agent) = configuration.user_agent {
597 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
598 }
599
600 for (header_name, header_value) in header_params {
602 req_builder = req_builder.header(&header_name, &header_value);
603 }
604
605
606 let req = req_builder.build()?;
607 let resp = configuration.client.execute(req).await?;
608
609 let status = resp.status();
610 let content_type = resp
611 .headers()
612 .get("content-type")
613 .and_then(|v| v.to_str().ok())
614 .unwrap_or("application/octet-stream");
615 let content_type = super::ContentType::from(content_type);
616
617 if !status.is_client_error() && !status.is_server_error() {
618 let content = resp.text().await?;
619 match content_type {
620 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
621 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralCustomizationV1RespItem>`"))),
622 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetApiReferralCustomizationV1RespItem>`")))),
623 }
624 } else {
625 let content = resp.text().await?;
626 let entity: Option<GetApiReferralCustomizationV1Error> = serde_json::from_str(&content).ok();
627 Err(Error::ResponseError(ResponseContent { status, content, entity }))
628 }
629}
630
631pub async fn get_api_referral_if_new_user_papiv1(configuration: &configuration::Configuration, params: GetApiReferralIfNewUserPapiv1Params) -> Result<models::GetApiReferralIfNewUserV1Resp, Error<GetApiReferralIfNewUserPapiv1Error>> {
632
633 let uri_str = format!("{}/papi/v1/apiReferral/ifNewUser", configuration.base_path);
634 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
635
636 let mut query_params: Vec<(String, String)> = Vec::new();
638
639 query_params.push(("brokerId".to_string(), params.broker_id.to_string()));
640 if let Some(ref param_value) = params.r#type {
641 query_params.push(("type".to_string(), param_value.to_string()));
642 }
643 if let Some(ref param_value) = params.recv_window {
644 query_params.push(("recvWindow".to_string(), param_value.to_string()));
645 }
646 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
647
648 let mut header_params = std::collections::HashMap::new();
650
651 if let Some(ref binance_auth) = configuration.binance_auth {
653 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
655
656 let body_string: Option<Vec<u8>> = None;
658
659 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
661 Ok(sig) => sig,
662 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
663 };
664
665 query_params.push(("signature".to_string(), signature));
667 }
668
669 if !query_params.is_empty() {
671 req_builder = req_builder.query(&query_params);
672 }
673
674
675 if let Some(ref user_agent) = configuration.user_agent {
677 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
678 }
679
680 for (header_name, header_value) in header_params {
682 req_builder = req_builder.header(&header_name, &header_value);
683 }
684
685
686 let req = req_builder.build()?;
687 let resp = configuration.client.execute(req).await?;
688
689 let status = resp.status();
690 let content_type = resp
691 .headers()
692 .get("content-type")
693 .and_then(|v| v.to_str().ok())
694 .unwrap_or("application/octet-stream");
695 let content_type = super::ContentType::from(content_type);
696
697 if !status.is_client_error() && !status.is_server_error() {
698 let content = resp.text().await?;
699 match content_type {
700 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
701 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralIfNewUserV1Resp`"))),
702 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetApiReferralIfNewUserV1Resp`")))),
703 }
704 } else {
705 let content = resp.text().await?;
706 let entity: Option<GetApiReferralIfNewUserPapiv1Error> = serde_json::from_str(&content).ok();
707 Err(Error::ResponseError(ResponseContent { status, content, entity }))
708 }
709}
710
711pub async fn get_api_referral_if_new_user_v1(configuration: &configuration::Configuration, params: GetApiReferralIfNewUserV1Params) -> Result<models::GetApiReferralIfNewUserV1Resp, Error<GetApiReferralIfNewUserV1Error>> {
713
714 let uri_str = format!("{}/fapi/v1/apiReferral/ifNewUser", configuration.base_path);
715 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
716
717 let mut query_params: Vec<(String, String)> = Vec::new();
719
720 query_params.push(("brokerId".to_string(), params.broker_id.to_string()));
721 if let Some(ref param_value) = params.r#type {
722 query_params.push(("type".to_string(), param_value.to_string()));
723 }
724 if let Some(ref param_value) = params.recv_window {
725 query_params.push(("recvWindow".to_string(), param_value.to_string()));
726 }
727 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
728
729 let mut header_params = std::collections::HashMap::new();
731
732 if let Some(ref binance_auth) = configuration.binance_auth {
734 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
736
737 let body_string: Option<Vec<u8>> = None;
739
740 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
742 Ok(sig) => sig,
743 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
744 };
745
746 query_params.push(("signature".to_string(), signature));
748 }
749
750 if !query_params.is_empty() {
752 req_builder = req_builder.query(&query_params);
753 }
754
755
756 if let Some(ref user_agent) = configuration.user_agent {
758 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
759 }
760
761 for (header_name, header_value) in header_params {
763 req_builder = req_builder.header(&header_name, &header_value);
764 }
765
766
767 let req = req_builder.build()?;
768 let resp = configuration.client.execute(req).await?;
769
770 let status = resp.status();
771 let content_type = resp
772 .headers()
773 .get("content-type")
774 .and_then(|v| v.to_str().ok())
775 .unwrap_or("application/octet-stream");
776 let content_type = super::ContentType::from(content_type);
777
778 if !status.is_client_error() && !status.is_server_error() {
779 let content = resp.text().await?;
780 match content_type {
781 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
782 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralIfNewUserV1Resp`"))),
783 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetApiReferralIfNewUserV1Resp`")))),
784 }
785 } else {
786 let content = resp.text().await?;
787 let entity: Option<GetApiReferralIfNewUserV1Error> = serde_json::from_str(&content).ok();
788 Err(Error::ResponseError(ResponseContent { status, content, entity }))
789 }
790}
791
792pub async fn get_api_referral_overview_v1(configuration: &configuration::Configuration, params: GetApiReferralOverviewV1Params) -> Result<models::GetApiReferralOverviewV1Resp, Error<GetApiReferralOverviewV1Error>> {
793
794 let uri_str = format!("{}/fapi/v1/apiReferral/overview", configuration.base_path);
795 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
796
797 let mut query_params: Vec<(String, String)> = Vec::new();
799
800 if let Some(ref param_value) = params.r#type {
801 query_params.push(("type".to_string(), param_value.to_string()));
802 }
803 if let Some(ref param_value) = params.recv_window {
804 query_params.push(("recvWindow".to_string(), param_value.to_string()));
805 }
806 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
807
808 let mut header_params = std::collections::HashMap::new();
810
811 if let Some(ref binance_auth) = configuration.binance_auth {
813 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
815
816 let body_string: Option<Vec<u8>> = None;
818
819 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
821 Ok(sig) => sig,
822 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
823 };
824
825 query_params.push(("signature".to_string(), signature));
827 }
828
829 if !query_params.is_empty() {
831 req_builder = req_builder.query(&query_params);
832 }
833
834
835 if let Some(ref user_agent) = configuration.user_agent {
837 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
838 }
839
840 for (header_name, header_value) in header_params {
842 req_builder = req_builder.header(&header_name, &header_value);
843 }
844
845
846 let req = req_builder.build()?;
847 let resp = configuration.client.execute(req).await?;
848
849 let status = resp.status();
850 let content_type = resp
851 .headers()
852 .get("content-type")
853 .and_then(|v| v.to_str().ok())
854 .unwrap_or("application/octet-stream");
855 let content_type = super::ContentType::from(content_type);
856
857 if !status.is_client_error() && !status.is_server_error() {
858 let content = resp.text().await?;
859 match content_type {
860 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
861 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralOverviewV1Resp`"))),
862 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::GetApiReferralOverviewV1Resp`")))),
863 }
864 } else {
865 let content = resp.text().await?;
866 let entity: Option<GetApiReferralOverviewV1Error> = serde_json::from_str(&content).ok();
867 Err(Error::ResponseError(ResponseContent { status, content, entity }))
868 }
869}
870
871pub async fn get_api_referral_rebate_vol_v1(configuration: &configuration::Configuration, params: GetApiReferralRebateVolV1Params) -> Result<Vec<models::GetApiReferralRebateVolV1RespItem>, Error<GetApiReferralRebateVolV1Error>> {
872
873 let uri_str = format!("{}/fapi/v1/apiReferral/rebateVol", configuration.base_path);
874 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
875
876 let mut query_params: Vec<(String, String)> = Vec::new();
878
879 if let Some(ref param_value) = params.r#type {
880 query_params.push(("type".to_string(), param_value.to_string()));
881 }
882 if let Some(ref param_value) = params.start_time {
883 query_params.push(("startTime".to_string(), param_value.to_string()));
884 }
885 if let Some(ref param_value) = params.end_time {
886 query_params.push(("endTime".to_string(), param_value.to_string()));
887 }
888 if let Some(ref param_value) = params.limit {
889 query_params.push(("limit".to_string(), param_value.to_string()));
890 }
891 if let Some(ref param_value) = params.recv_window {
892 query_params.push(("recvWindow".to_string(), param_value.to_string()));
893 }
894 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
895
896 let mut header_params = std::collections::HashMap::new();
898
899 if let Some(ref binance_auth) = configuration.binance_auth {
901 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
903
904 let body_string: Option<Vec<u8>> = None;
906
907 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
909 Ok(sig) => sig,
910 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
911 };
912
913 query_params.push(("signature".to_string(), signature));
915 }
916
917 if !query_params.is_empty() {
919 req_builder = req_builder.query(&query_params);
920 }
921
922
923 if let Some(ref user_agent) = configuration.user_agent {
925 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
926 }
927
928 for (header_name, header_value) in header_params {
930 req_builder = req_builder.header(&header_name, &header_value);
931 }
932
933
934 let req = req_builder.build()?;
935 let resp = configuration.client.execute(req).await?;
936
937 let status = resp.status();
938 let content_type = resp
939 .headers()
940 .get("content-type")
941 .and_then(|v| v.to_str().ok())
942 .unwrap_or("application/octet-stream");
943 let content_type = super::ContentType::from(content_type);
944
945 if !status.is_client_error() && !status.is_server_error() {
946 let content = resp.text().await?;
947 match content_type {
948 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
949 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralRebateVolV1RespItem>`"))),
950 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetApiReferralRebateVolV1RespItem>`")))),
951 }
952 } else {
953 let content = resp.text().await?;
954 let entity: Option<GetApiReferralRebateVolV1Error> = serde_json::from_str(&content).ok();
955 Err(Error::ResponseError(ResponseContent { status, content, entity }))
956 }
957}
958
959pub async fn get_api_referral_trade_vol_v1(configuration: &configuration::Configuration, params: GetApiReferralTradeVolV1Params) -> Result<Vec<models::GetApiReferralTradeVolV1RespItem>, Error<GetApiReferralTradeVolV1Error>> {
960
961 let uri_str = format!("{}/fapi/v1/apiReferral/tradeVol", configuration.base_path);
962 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
963
964 let mut query_params: Vec<(String, String)> = Vec::new();
966
967 if let Some(ref param_value) = params.r#type {
968 query_params.push(("type".to_string(), param_value.to_string()));
969 }
970 if let Some(ref param_value) = params.start_time {
971 query_params.push(("startTime".to_string(), param_value.to_string()));
972 }
973 if let Some(ref param_value) = params.end_time {
974 query_params.push(("endTime".to_string(), param_value.to_string()));
975 }
976 if let Some(ref param_value) = params.limit {
977 query_params.push(("limit".to_string(), param_value.to_string()));
978 }
979 if let Some(ref param_value) = params.recv_window {
980 query_params.push(("recvWindow".to_string(), param_value.to_string()));
981 }
982 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
983
984 let mut header_params = std::collections::HashMap::new();
986
987 if let Some(ref binance_auth) = configuration.binance_auth {
989 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
991
992 let body_string: Option<Vec<u8>> = None;
994
995 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
997 Ok(sig) => sig,
998 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
999 };
1000
1001 query_params.push(("signature".to_string(), signature));
1003 }
1004
1005 if !query_params.is_empty() {
1007 req_builder = req_builder.query(&query_params);
1008 }
1009
1010
1011 if let Some(ref user_agent) = configuration.user_agent {
1013 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1014 }
1015
1016 for (header_name, header_value) in header_params {
1018 req_builder = req_builder.header(&header_name, &header_value);
1019 }
1020
1021
1022 let req = req_builder.build()?;
1023 let resp = configuration.client.execute(req).await?;
1024
1025 let status = resp.status();
1026 let content_type = resp
1027 .headers()
1028 .get("content-type")
1029 .and_then(|v| v.to_str().ok())
1030 .unwrap_or("application/octet-stream");
1031 let content_type = super::ContentType::from(content_type);
1032
1033 if !status.is_client_error() && !status.is_server_error() {
1034 let content = resp.text().await?;
1035 match content_type {
1036 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1037 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralTradeVolV1RespItem>`"))),
1038 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetApiReferralTradeVolV1RespItem>`")))),
1039 }
1040 } else {
1041 let content = resp.text().await?;
1042 let entity: Option<GetApiReferralTradeVolV1Error> = serde_json::from_str(&content).ok();
1043 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1044 }
1045}
1046
1047pub async fn get_api_referral_trader_num_v1(configuration: &configuration::Configuration, params: GetApiReferralTraderNumV1Params) -> Result<Vec<models::GetApiReferralTraderNumV1RespItem>, Error<GetApiReferralTraderNumV1Error>> {
1048
1049 let uri_str = format!("{}/fapi/v1/apiReferral/traderNum", configuration.base_path);
1050 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1051
1052 let mut query_params: Vec<(String, String)> = Vec::new();
1054
1055 if let Some(ref param_value) = params.r#type {
1056 query_params.push(("type".to_string(), param_value.to_string()));
1057 }
1058 if let Some(ref param_value) = params.start_time {
1059 query_params.push(("startTime".to_string(), param_value.to_string()));
1060 }
1061 if let Some(ref param_value) = params.end_time {
1062 query_params.push(("endTime".to_string(), param_value.to_string()));
1063 }
1064 if let Some(ref param_value) = params.limit {
1065 query_params.push(("limit".to_string(), param_value.to_string()));
1066 }
1067 if let Some(ref param_value) = params.recv_window {
1068 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1069 }
1070 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1071
1072 let mut header_params = std::collections::HashMap::new();
1074
1075 if let Some(ref binance_auth) = configuration.binance_auth {
1077 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1079
1080 let body_string: Option<Vec<u8>> = None;
1082
1083 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1085 Ok(sig) => sig,
1086 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1087 };
1088
1089 query_params.push(("signature".to_string(), signature));
1091 }
1092
1093 if !query_params.is_empty() {
1095 req_builder = req_builder.query(&query_params);
1096 }
1097
1098
1099 if let Some(ref user_agent) = configuration.user_agent {
1101 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1102 }
1103
1104 for (header_name, header_value) in header_params {
1106 req_builder = req_builder.header(&header_name, &header_value);
1107 }
1108
1109
1110 let req = req_builder.build()?;
1111 let resp = configuration.client.execute(req).await?;
1112
1113 let status = resp.status();
1114 let content_type = resp
1115 .headers()
1116 .get("content-type")
1117 .and_then(|v| v.to_str().ok())
1118 .unwrap_or("application/octet-stream");
1119 let content_type = super::ContentType::from(content_type);
1120
1121 if !status.is_client_error() && !status.is_server_error() {
1122 let content = resp.text().await?;
1123 match content_type {
1124 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1125 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralTraderNumV1RespItem>`"))),
1126 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetApiReferralTraderNumV1RespItem>`")))),
1127 }
1128 } else {
1129 let content = resp.text().await?;
1130 let entity: Option<GetApiReferralTraderNumV1Error> = serde_json::from_str(&content).ok();
1131 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1132 }
1133}
1134
1135pub async fn get_api_referral_trader_summary_v1(configuration: &configuration::Configuration, params: GetApiReferralTraderSummaryV1Params) -> Result<Vec<models::GetApiReferralTraderSummaryV1RespItem>, Error<GetApiReferralTraderSummaryV1Error>> {
1136
1137 let uri_str = format!("{}/fapi/v1/apiReferral/traderSummary", configuration.base_path);
1138 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1139
1140 let mut query_params: Vec<(String, String)> = Vec::new();
1142
1143 if let Some(ref param_value) = params.customer_id {
1144 query_params.push(("customerId".to_string(), param_value.to_string()));
1145 }
1146 if let Some(ref param_value) = params.r#type {
1147 query_params.push(("type".to_string(), param_value.to_string()));
1148 }
1149 if let Some(ref param_value) = params.start_time {
1150 query_params.push(("startTime".to_string(), param_value.to_string()));
1151 }
1152 if let Some(ref param_value) = params.end_time {
1153 query_params.push(("endTime".to_string(), param_value.to_string()));
1154 }
1155 if let Some(ref param_value) = params.limit {
1156 query_params.push(("limit".to_string(), param_value.to_string()));
1157 }
1158 if let Some(ref param_value) = params.recv_window {
1159 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1160 }
1161 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1162
1163 let mut header_params = std::collections::HashMap::new();
1165
1166 if let Some(ref binance_auth) = configuration.binance_auth {
1168 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1170
1171 let body_string: Option<Vec<u8>> = None;
1173
1174 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1176 Ok(sig) => sig,
1177 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1178 };
1179
1180 query_params.push(("signature".to_string(), signature));
1182 }
1183
1184 if !query_params.is_empty() {
1186 req_builder = req_builder.query(&query_params);
1187 }
1188
1189
1190 if let Some(ref user_agent) = configuration.user_agent {
1192 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1193 }
1194
1195 for (header_name, header_value) in header_params {
1197 req_builder = req_builder.header(&header_name, &header_value);
1198 }
1199
1200
1201 let req = req_builder.build()?;
1202 let resp = configuration.client.execute(req).await?;
1203
1204 let status = resp.status();
1205 let content_type = resp
1206 .headers()
1207 .get("content-type")
1208 .and_then(|v| v.to_str().ok())
1209 .unwrap_or("application/octet-stream");
1210 let content_type = super::ContentType::from(content_type);
1211
1212 if !status.is_client_error() && !status.is_server_error() {
1213 let content = resp.text().await?;
1214 match content_type {
1215 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1216 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralTraderSummaryV1RespItem>`"))),
1217 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetApiReferralTraderSummaryV1RespItem>`")))),
1218 }
1219 } else {
1220 let content = resp.text().await?;
1221 let entity: Option<GetApiReferralTraderSummaryV1Error> = serde_json::from_str(&content).ok();
1222 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1223 }
1224}
1225
1226pub async fn get_api_referral_user_customization_papiv1(configuration: &configuration::Configuration, params: GetApiReferralUserCustomizationPapiv1Params) -> Result<models::GetApiReferralUserCustomizationV1Resp, Error<GetApiReferralUserCustomizationPapiv1Error>> {
1227
1228 let uri_str = format!("{}/papi/v1/apiReferral/userCustomization", configuration.base_path);
1229 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1230
1231 let mut query_params: Vec<(String, String)> = Vec::new();
1233
1234 query_params.push(("brokerId".to_string(), params.broker_id.to_string()));
1235 if let Some(ref param_value) = params.recv_window {
1236 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1237 }
1238 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1239
1240 let mut header_params = std::collections::HashMap::new();
1242
1243 if let Some(ref binance_auth) = configuration.binance_auth {
1245 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1247
1248 let body_string: Option<Vec<u8>> = None;
1250
1251 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1253 Ok(sig) => sig,
1254 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1255 };
1256
1257 query_params.push(("signature".to_string(), signature));
1259 }
1260
1261 if !query_params.is_empty() {
1263 req_builder = req_builder.query(&query_params);
1264 }
1265
1266
1267 if let Some(ref user_agent) = configuration.user_agent {
1269 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1270 }
1271
1272 for (header_name, header_value) in header_params {
1274 req_builder = req_builder.header(&header_name, &header_value);
1275 }
1276
1277
1278 let req = req_builder.build()?;
1279 let resp = configuration.client.execute(req).await?;
1280
1281 let status = resp.status();
1282 let content_type = resp
1283 .headers()
1284 .get("content-type")
1285 .and_then(|v| v.to_str().ok())
1286 .unwrap_or("application/octet-stream");
1287 let content_type = super::ContentType::from(content_type);
1288
1289 if !status.is_client_error() && !status.is_server_error() {
1290 let content = resp.text().await?;
1291 match content_type {
1292 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1293 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralUserCustomizationV1Resp`"))),
1294 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetApiReferralUserCustomizationV1Resp`")))),
1295 }
1296 } else {
1297 let content = resp.text().await?;
1298 let entity: Option<GetApiReferralUserCustomizationPapiv1Error> = serde_json::from_str(&content).ok();
1299 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1300 }
1301}
1302
1303pub async fn get_api_referral_user_customization_v1(configuration: &configuration::Configuration, params: GetApiReferralUserCustomizationV1Params) -> Result<models::GetApiReferralUserCustomizationV1Resp, Error<GetApiReferralUserCustomizationV1Error>> {
1305
1306 let uri_str = format!("{}/fapi/v1/apiReferral/userCustomization", configuration.base_path);
1307 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1308
1309 let mut query_params: Vec<(String, String)> = Vec::new();
1311
1312 query_params.push(("brokerId".to_string(), params.broker_id.to_string()));
1313 if let Some(ref param_value) = params.recv_window {
1314 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1315 }
1316 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1317
1318 let mut header_params = std::collections::HashMap::new();
1320
1321 if let Some(ref binance_auth) = configuration.binance_auth {
1323 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1325
1326 let body_string: Option<Vec<u8>> = None;
1328
1329 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1331 Ok(sig) => sig,
1332 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1333 };
1334
1335 query_params.push(("signature".to_string(), signature));
1337 }
1338
1339 if !query_params.is_empty() {
1341 req_builder = req_builder.query(&query_params);
1342 }
1343
1344
1345 if let Some(ref user_agent) = configuration.user_agent {
1347 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1348 }
1349
1350 for (header_name, header_value) in header_params {
1352 req_builder = req_builder.header(&header_name, &header_value);
1353 }
1354
1355
1356 let req = req_builder.build()?;
1357 let resp = configuration.client.execute(req).await?;
1358
1359 let status = resp.status();
1360 let content_type = resp
1361 .headers()
1362 .get("content-type")
1363 .and_then(|v| v.to_str().ok())
1364 .unwrap_or("application/octet-stream");
1365 let content_type = super::ContentType::from(content_type);
1366
1367 if !status.is_client_error() && !status.is_server_error() {
1368 let content = resp.text().await?;
1369 match content_type {
1370 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1371 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralUserCustomizationV1Resp`"))),
1372 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetApiReferralUserCustomizationV1Resp`")))),
1373 }
1374 } else {
1375 let content = resp.text().await?;
1376 let entity: Option<GetApiReferralUserCustomizationV1Error> = serde_json::from_str(&content).ok();
1377 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1378 }
1379}
1380
1381pub async fn get_income_v1(configuration: &configuration::Configuration, params: GetIncomeV1Params) -> Result<Vec<models::GetIncomeV1RespItem>, Error<GetIncomeV1Error>> {
1383
1384 let uri_str = format!("{}/fapi/v1/income", configuration.base_path);
1385 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1386
1387 let mut query_params: Vec<(String, String)> = Vec::new();
1389
1390 if let Some(ref param_value) = params.symbol {
1391 query_params.push(("symbol".to_string(), param_value.to_string()));
1392 }
1393 if let Some(ref param_value) = params.income_type {
1394 query_params.push(("incomeType".to_string(), param_value.to_string()));
1395 }
1396 if let Some(ref param_value) = params.start_time {
1397 query_params.push(("startTime".to_string(), param_value.to_string()));
1398 }
1399 if let Some(ref param_value) = params.end_time {
1400 query_params.push(("endTime".to_string(), param_value.to_string()));
1401 }
1402 if let Some(ref param_value) = params.limit {
1403 query_params.push(("limit".to_string(), param_value.to_string()));
1404 }
1405 if let Some(ref param_value) = params.recv_window {
1406 query_params.push(("recvWindow".to_string(), param_value.to_string()));
1407 }
1408 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
1409
1410 let mut header_params = std::collections::HashMap::new();
1412
1413 if let Some(ref binance_auth) = configuration.binance_auth {
1415 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1417
1418 let body_string: Option<Vec<u8>> = None;
1420
1421 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1423 Ok(sig) => sig,
1424 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1425 };
1426
1427 query_params.push(("signature".to_string(), signature));
1429 }
1430
1431 if !query_params.is_empty() {
1433 req_builder = req_builder.query(&query_params);
1434 }
1435
1436
1437 if let Some(ref user_agent) = configuration.user_agent {
1439 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1440 }
1441
1442 for (header_name, header_value) in header_params {
1444 req_builder = req_builder.header(&header_name, &header_value);
1445 }
1446
1447
1448 let req = req_builder.build()?;
1449 let resp = configuration.client.execute(req).await?;
1450
1451 let status = resp.status();
1452 let content_type = resp
1453 .headers()
1454 .get("content-type")
1455 .and_then(|v| v.to_str().ok())
1456 .unwrap_or("application/octet-stream");
1457 let content_type = super::ContentType::from(content_type);
1458
1459 if !status.is_client_error() && !status.is_server_error() {
1460 let content = resp.text().await?;
1461 match content_type {
1462 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1463 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetIncomeV1RespItem>`"))),
1464 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetIncomeV1RespItem>`")))),
1465 }
1466 } else {
1467 let content = resp.text().await?;
1468 let entity: Option<GetIncomeV1Error> = serde_json::from_str(&content).ok();
1469 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1470 }
1471}
1472