1use crate::client::BybitClient;
4use crate::error::Result;
5use crate::models::broker::*;
6
7impl BybitClient {
8 pub async fn query_broker_account_info(&self) -> Result<QueryBrokerAccountInfoResponse> {
10 self.get("/v5/broker/account-info", &[]).await
11 }
12
13 pub async fn query_broker_all_uid_details(
15 &self,
16 uids: Option<&str>,
17 limit: Option<i64>,
18 cursor: Option<&str>,
19 ) -> Result<QueryBrokerAllUidDetailsResponse> {
20 let limit_str = limit.map(|v| v.to_string());
21 let mut params: Vec<(&str, &str)> = vec![];
22 if let Some(u) = uids {
23 params.push(("uids", u));
24 }
25 if let Some(ref l) = limit_str {
26 params.push(("limit", l.as_str()));
27 }
28 if let Some(c) = cursor {
29 params.push(("cursor", c));
30 }
31 self.get("/v5/broker/apilimit/query-all", ¶ms).await
32 }
33
34 pub async fn query_broker_cap(&self) -> Result<QueryBrokerCapResponse> {
36 self.get("/v5/broker/apilimit/query-cap", &[]).await
37 }
38
39 pub async fn query_broker_earning(
41 &self,
42 biz_type: Option<&str>,
43 begin: Option<&str>,
44 end: Option<&str>,
45 uid: Option<&str>,
46 limit: Option<i64>,
47 cursor: Option<&str>,
48 ) -> Result<QueryBrokerEarningResponse> {
49 let limit_str = limit.map(|v| v.to_string());
50 let mut params: Vec<(&str, &str)> = vec![];
51 if let Some(b) = biz_type {
52 params.push(("bizType", b));
53 }
54 if let Some(b) = begin {
55 params.push(("begin", b));
56 }
57 if let Some(e) = end {
58 params.push(("end", e));
59 }
60 if let Some(u) = uid {
61 params.push(("uid", u));
62 }
63 if let Some(ref l) = limit_str {
64 params.push(("limit", l.as_str()));
65 }
66 if let Some(c) = cursor {
67 params.push(("cursor", c));
68 }
69 self.get("/v5/broker/earnings-info", ¶ms).await
70 }
71
72 pub async fn set_broker_api_limit(
74 &self,
75 params: SetBrokerApiLimitParams,
76 ) -> Result<SetBrokerApiLimitResponse> {
77 self.post("/v5/broker/apilimit/set", ¶ms).await
78 }
79
80 pub async fn distribute_award(
85 &self,
86 params: DistributeAwardParams,
87 ) -> Result<serde_json::Value> {
88 self.post("/v5/broker/award/distribute-award", ¶ms)
89 .await
90 }
91
92 pub async fn get_award_info(&self, params: GetAwardInfoParams) -> Result<GetAwardInfoResponse> {
94 self.post("/v5/broker/award/info", ¶ms).await
95 }
96
97 pub async fn get_distribution_record(
99 &self,
100 params: GetDistributionRecordParams,
101 ) -> Result<GetDistributionRecordResponse> {
102 self.post("/v5/broker/award/distribution-record", ¶ms)
103 .await
104 }
105}