Skip to main content

bybit/http/
user.rs

1use serde::Deserialize;
2
3use crate::VipLevel;
4
5/// Result of `GET /v5/user/query-api` ([`Client::get_api_key_information`](crate::http::Client::get_api_key_information)).
6#[derive(Debug, Deserialize, PartialEq)]
7#[serde(rename_all = "camelCase")]
8pub struct APIKeyInformation {
9    /// Unique ID. Internal use
10    pub id: String,
11    /// The remark
12    pub note: String,
13    /// Api key
14    pub api_key: String,
15    /// 0:Read and Write. 1:Read only
16    pub read_only: i64,
17    /// Always ""
18    pub secret: String,
19    /// The types of permission
20    pub permissions: APIKeyPermissions,
21    /// IP bound
22    pub ips: Vec<String>,
23    /// The type of api key. 1:personal, 2:connected to the third-party app
24    #[serde(rename = "type")]
25    pub key_type: i64,
26    /// The remaining valid days of api key. Only for those api key with no IP bound or the password has been changed
27    pub deadline_day: u64,
28    /// The expiry day of the api key. Only for those api key with no IP bound or the password has been changed
29    pub expired_at: String,
30    /// The create day of the api key
31    pub created_at: String,
32    /// Whether the account to which the account upgrade to unified trade account. 0:regular account; 1:unified trade account
33    pub uta: i64,
34    /// User ID
35    #[serde(rename = "userID")]
36    pub user_id: i64,
37    /// Inviter ID (the UID of the account which invited this account to the platform)
38    #[serde(rename = "inviterID")]
39    pub inviter_id: i64,
40    /// VIP Level
41    pub vip_level: VipLevel,
42    /// Market maker level
43    pub mkt_maker_level: String,
44    /// Affiliate Id. 0 represents that there is no binding relationship.
45    #[serde(rename = "affiliateID")]
46    pub affiliate_id: i64,
47    /// Rsa public key
48    pub rsa_public_key: String,
49    /// If this api key belongs to master account or not
50    pub is_master: bool,
51    /// The main account uid. Returns "0" when the endpoint is called by main account
52    pub parent_uid: String,
53    /// Personal account kyc level. LEVEL_DEFAULT, LEVEL_1, LEVEL_2
54    pub kyc_level: String,
55    /// Personal account kyc region
56    pub kyc_region: String,
57}
58
59/// Part of the response of `/v5/user/query-api`.
60#[derive(Debug, Deserialize, PartialEq)]
61#[serde(rename_all = "PascalCase")]
62pub struct APIKeyPermissions {
63    /// Permission of contract trade Order, Position
64    pub contract_trade: Vec<String>,
65    /// Permission of spot SpotTrade
66    pub spot: Vec<String>,
67    /// Permission of wallet AccountTransfer, SubMemberTransfer(master account), SubMemberTransferList(sub account), Withdraw(master account)
68    pub wallet: Vec<String>,
69    /// Permission of USDC Contract. It supports trade option and USDC perpetual. OptionsTrade
70    pub options: Vec<String>,
71    /// Unified account has this permission by default DerivativesTrade
72    /// For classic account, it is always []
73    pub derivatives: Vec<String>,
74    /// Permission of convert ExchangeHistory
75    pub exchange: Vec<String>,
76    /// Permission of earn product Earn
77    #[serde(default)]
78    pub earn: Vec<String>,
79    /// Permission of blocktrade. Not applicable to subaccount, always []
80    pub block_trade: Vec<String>,
81    /// Permission of Affiliate. Only affiliate can have this permission, otherwise always []
82    pub affiliate: Vec<String>,
83    /// Always [] as Master Trader account just use ContractTrade to start CopyTrading
84    pub copy_trading: Vec<String>,
85}