/*
* Binance Spot API
*
* OpenAPI specification for Binance exchange - Spot API
*
* The version of the OpenAPI document: 0.2.2
*
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use crate::spot::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for passing parameters to the method [`create_api_referral_customization_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateApiReferralCustomizationV1Params {
pub customer_id: String,
pub email: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_api_referral_user_customization_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateApiReferralUserCustomizationV1Params {
pub api_agent_code: String,
pub customer_id: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_api_commission_coin_futures_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountApiCommissionCoinFuturesV1Params {
pub maker_adjustment: i32,
pub pair: String,
pub sub_account_id: String,
pub taker_adjustment: i32,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_api_commission_futures_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountApiCommissionFuturesV1Params {
pub maker_adjustment: i32,
pub sub_account_id: String,
pub symbol: String,
pub taker_adjustment: i32,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_api_commission_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountApiCommissionV1Params {
pub maker_commission: f64,
pub sub_account_id: String,
pub taker_commission: f64,
pub timestamp: i64,
pub margin_maker_commission: Option<f64>,
pub margin_taker_commission: Option<f64>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_api_ip_restriction_v2`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountApiIpRestrictionV2Params {
pub status: String,
pub sub_account_api_key: String,
pub sub_account_id: String,
pub timestamp: i64,
pub ip_address: Option<String>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_api_permission_universal_transfer_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountApiPermissionUniversalTransferV1Params {
pub can_universal_transfer: String,
pub sub_account_api_key: String,
pub sub_account_id: i64,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_api_permission_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountApiPermissionV1Params {
pub can_trade: String,
pub futures_trade: String,
pub margin_trade: String,
pub sub_account_api_key: String,
pub sub_account_id: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_api_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountApiV1Params {
pub can_trade: String,
pub sub_account_id: String,
pub timestamp: i64,
pub futures_trade: Option<String>,
pub margin_trade: Option<String>,
pub public_key: Option<String>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_bnb_burn_margin_interest_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountBnbBurnMarginInterestV1Params {
pub interest_bnb_burn: String,
pub sub_account_id: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_bnb_burn_spot_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountBnbBurnSpotV1Params {
pub spot_bnb_burn: String,
pub sub_account_id: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_futures_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountFuturesV1Params {
pub futures: String,
pub sub_account_id: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`create_broker_sub_account_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerSubAccountV1Params {
pub timestamp: i64,
pub recv_window: Option<i64>,
pub tag: Option<String>
}
/// struct for passing parameters to the method [`create_broker_transfer_futures_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerTransferFuturesV1Params {
pub amount: String,
pub asset: String,
pub futures_type: i64,
pub timestamp: i64,
pub client_tran_id: Option<String>,
pub from_id: Option<String>,
pub recv_window: Option<i64>,
pub to_id: Option<String>
}
/// struct for passing parameters to the method [`create_broker_transfer_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerTransferV1Params {
pub amount: String,
pub asset: String,
pub timestamp: i64,
pub client_tran_id: Option<String>,
pub from_id: Option<String>,
pub recv_window: Option<i64>,
pub to_id: Option<String>
}
/// struct for passing parameters to the method [`create_broker_universal_transfer_v1`]
#[derive(Clone, Debug, Default)]
pub struct CreateBrokerUniversalTransferV1Params {
pub amount: String,
pub asset: String,
pub from_account_type: String,
pub timestamp: i64,
pub to_account_type: String,
pub client_tran_id: Option<String>,
pub from_id: Option<String>,
pub recv_window: Option<i64>,
pub to_id: Option<String>
}
/// struct for passing parameters to the method [`delete_broker_sub_account_api_ip_restriction_ip_list_v1`]
#[derive(Clone, Debug, Default)]
pub struct DeleteBrokerSubAccountApiIpRestrictionIpListV1Params {
pub sub_account_id: String,
pub sub_account_api_key: String,
pub timestamp: i64,
pub ip_address: Option<String>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`delete_broker_sub_account_api_v1`]
#[derive(Clone, Debug, Default)]
pub struct DeleteBrokerSubAccountApiV1Params {
pub sub_account_id: String,
pub sub_account_api_key: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`delete_broker_sub_account_v1`]
#[derive(Clone, Debug, Default)]
pub struct DeleteBrokerSubAccountV1Params {
pub sub_account_id: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_api_referral_customization_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetApiReferralCustomizationV1Params {
pub timestamp: i64,
pub customer_id: Option<String>,
pub email: Option<String>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_api_referral_if_new_user_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetApiReferralIfNewUserV1Params {
/// brokerId
pub api_agent_code: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_api_referral_kickback_recent_record_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetApiReferralKickbackRecentRecordV1Params {
pub timestamp: i64,
pub start_time: Option<i64>,
pub end_time: Option<i64>,
/// Default 500, max 1000
pub limit: Option<i32>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_api_referral_rebate_recent_record_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetApiReferralRebateRecentRecordV1Params {
pub start_time: i64,
pub end_time: i64,
/// max 500
pub limit: i32,
pub timestamp: i64,
pub customer_id: Option<String>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_api_referral_user_customization_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetApiReferralUserCustomizationV1Params {
/// brokerId
pub api_agent_code: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_info_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerInfoV1Params {
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_rebate_futures_recent_record_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerRebateFuturesRecentRecordV1Params {
/// 1:USDT Futures, 2: Coin Futures
pub futures_type: i64,
pub start_time: i64,
pub end_time: i64,
pub timestamp: i64,
/// default 1
pub page: Option<i64>,
/// default 10, max 100
pub size: Option<i64>,
/// TRUE or FALSE. Default: FALSE
pub filter_result: Option<bool>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_rebate_recent_record_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerRebateRecentRecordV1Params {
pub timestamp: i64,
pub sub_account_id: Option<String>,
/// Default: 7 days from current timestamp
pub start_time: Option<i64>,
/// Default: present timestamp
pub end_time: Option<i64>,
/// default 1
pub page: Option<i64>,
/// default 500,max500
pub size: Option<i64>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_api_commission_coin_futures_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountApiCommissionCoinFuturesV1Params {
pub sub_account_id: String,
pub timestamp: i64,
/// BTCUSD
pub pair: Option<String>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_api_commission_futures_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountApiCommissionFuturesV1Params {
pub sub_account_id: String,
pub timestamp: i64,
pub symbol: Option<String>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_api_ip_restriction_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountApiIpRestrictionV1Params {
pub sub_account_id: String,
pub sub_account_api_key: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_api_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountApiV1Params {
pub sub_account_id: String,
pub timestamp: i64,
pub sub_account_api_key: Option<String>,
/// default 1
pub page: Option<i64>,
/// default 500, max 500
pub size: Option<i64>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_bnb_burn_status_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountBnbBurnStatusV1Params {
pub sub_account_id: String,
pub timestamp: i64,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_deposit_hist_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountDepositHistV1Params {
pub timestamp: i64,
pub sub_account_id: Option<String>,
pub coin: Option<String>,
/// 0(0:pending,6: credited but cannot withdraw, 1:success)
pub status: Option<i32>,
/// Default: 7 days from current timestamp
pub start_time: Option<i64>,
/// Default: present timestamp
pub end_time: Option<i64>,
/// Default:500
pub limit: Option<i32>,
/// Default:0
pub offset: Option<i32>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_deposit_hist_v2`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountDepositHistV2Params {
pub deposit_id: String,
pub sub_account_id: String,
pub timestamp: i64,
/// Default:500
pub limit: Option<i32>,
/// Default:0
pub offset: Option<i32>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_futures_summary_v3`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountFuturesSummaryV3Params {
/// 1:USD Margined Futures, 2:COIN Margined Futures
pub futures_type: i32,
pub timestamp: i64,
pub sub_account_id: Option<String>,
/// default 1
pub page: Option<i64>,
/// default 10, max 20
pub size: Option<i64>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_margin_summary_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountMarginSummaryV1Params {
pub timestamp: i64,
pub sub_account_id: Option<String>,
/// default 1
pub page: Option<i64>,
/// default 10, max 20
pub size: Option<i64>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_spot_summary_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountSpotSummaryV1Params {
pub timestamp: i64,
pub sub_account_id: Option<String>,
/// default 1
pub page: Option<i64>,
/// default 10, max 20
pub size: Option<i64>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_sub_account_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerSubAccountV1Params {
pub timestamp: i64,
pub sub_account_id: Option<String>,
/// default 1
pub page: Option<i64>,
/// default 500
pub size: Option<i64>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_transfer_futures_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerTransferFuturesV1Params {
pub sub_account_id: String,
/// 1:USDT Futures,2: COIN Futures
pub futures_type: i64,
pub timestamp: i64,
pub client_tran_id: Option<String>,
/// default 30 days records
pub start_time: Option<i64>,
/// default 30 days records
pub end_time: Option<i64>,
/// default 1
pub page: Option<i32>,
/// default 50, max 500
pub limit: Option<i32>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_transfer_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerTransferV1Params {
pub timestamp: i64,
pub from_id: Option<String>,
pub to_id: Option<String>,
/// client transfer id
pub client_tran_id: Option<String>,
/// true or false, default: false
pub show_all_status: Option<String>,
pub start_time: Option<i64>,
pub end_time: Option<i64>,
pub page: Option<i32>,
/// default 500, max 500
pub limit: Option<i32>,
pub recv_window: Option<i64>
}
/// struct for passing parameters to the method [`get_broker_universal_transfer_v1`]
#[derive(Clone, Debug, Default)]
pub struct GetBrokerUniversalTransferV1Params {
pub timestamp: i64,
pub from_id: Option<String>,
pub to_id: Option<String>,
/// client transfer id
pub client_tran_id: Option<String>,
pub start_time: Option<i64>,
pub end_time: Option<i64>,
/// default 1
pub page: Option<i32>,
/// default 500, max 500
pub limit: Option<i32>,
/// TRUE or FALSE
pub show_all_status: Option<bool>,
pub recv_window: Option<i64>
}
/// struct for typed errors of method [`create_api_referral_customization_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateApiReferralCustomizationV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_api_referral_user_customization_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateApiReferralUserCustomizationV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_api_commission_coin_futures_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountApiCommissionCoinFuturesV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_api_commission_futures_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountApiCommissionFuturesV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_api_commission_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountApiCommissionV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_api_ip_restriction_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountApiIpRestrictionV2Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_api_permission_universal_transfer_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountApiPermissionUniversalTransferV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_api_permission_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountApiPermissionV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_api_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountApiV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_bnb_burn_margin_interest_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountBnbBurnMarginInterestV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_bnb_burn_spot_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountBnbBurnSpotV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_futures_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountFuturesV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_sub_account_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerSubAccountV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_transfer_futures_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerTransferFuturesV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_transfer_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerTransferV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_broker_universal_transfer_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrokerUniversalTransferV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_broker_sub_account_api_ip_restriction_ip_list_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteBrokerSubAccountApiIpRestrictionIpListV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_broker_sub_account_api_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteBrokerSubAccountApiV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_broker_sub_account_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteBrokerSubAccountV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_api_referral_customization_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetApiReferralCustomizationV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_api_referral_if_new_user_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetApiReferralIfNewUserV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_api_referral_kickback_recent_record_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetApiReferralKickbackRecentRecordV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_api_referral_rebate_recent_record_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetApiReferralRebateRecentRecordV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_api_referral_user_customization_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetApiReferralUserCustomizationV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_info_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerInfoV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_rebate_futures_recent_record_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerRebateFuturesRecentRecordV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_rebate_recent_record_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerRebateRecentRecordV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_api_commission_coin_futures_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountApiCommissionCoinFuturesV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_api_commission_futures_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountApiCommissionFuturesV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_api_ip_restriction_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountApiIpRestrictionV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_api_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountApiV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_bnb_burn_status_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountBnbBurnStatusV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_deposit_hist_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountDepositHistV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_deposit_hist_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountDepositHistV2Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_futures_summary_v3`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountFuturesSummaryV3Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_margin_summary_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountMarginSummaryV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_spot_summary_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountSpotSummaryV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_sub_account_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerSubAccountV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_transfer_futures_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerTransferFuturesV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_transfer_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerTransferV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_broker_universal_transfer_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBrokerUniversalTransferV1Error {
Status4XX(models::ApiError),
Status5XX(models::ApiError),
UnknownValue(serde_json::Value),
}
/// - CustomerId must be unique - For the same email, the customerId will be modified in real time
pub async fn create_api_referral_customization_v1(configuration: &configuration::Configuration, params: CreateApiReferralCustomizationV1Params) -> Result<models::CreateApiReferralCustomizationV1Resp, Error<CreateApiReferralCustomizationV1Error>> {
let uri_str = format!("{}/sapi/v1/apiReferral/customization", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("customerId", params.customer_id.to_string());
multipart_form_params.insert("email", params.email.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateApiReferralCustomizationV1Resp`"))),
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`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateApiReferralCustomizationV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - CustomerId must be unique for each apiAgent
pub async fn create_api_referral_user_customization_v1(configuration: &configuration::Configuration, params: CreateApiReferralUserCustomizationV1Params) -> Result<models::CreateApiReferralUserCustomizationV1Resp, Error<CreateApiReferralUserCustomizationV1Error>> {
let uri_str = format!("{}/sapi/v1/apiReferral/userCustomization", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("apiAgentCode", params.api_agent_code.to_string());
multipart_form_params.insert("customerId", params.customer_id.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateApiReferralUserCustomizationV1Resp`"))),
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`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateApiReferralUserCustomizationV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This request will change the COIN-Ⓜ futures commission for a sub account. You need to enable \"trade\" option for the api key which requests this endpoint. The sub-account's COIN-Ⓜ futures commission of a symbol equals to the base commission of the symbol on the sub-account's fee tier plus the commission adjustment.
pub async fn create_broker_sub_account_api_commission_coin_futures_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiCommissionCoinFuturesV1Params) -> Result<models::CreateBrokerSubAccountApiCommissionCoinFuturesV1Resp, Error<CreateBrokerSubAccountApiCommissionCoinFuturesV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission/coinFutures", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("makerAdjustment", params.maker_adjustment.to_string());
multipart_form_params.insert("pair", params.pair.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("takerAdjustment", params.taker_adjustment.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiCommissionCoinFuturesV1Resp`"))),
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::CreateBrokerSubAccountApiCommissionCoinFuturesV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountApiCommissionCoinFuturesV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This request will change the USDT-Ⓜ futures commission for a sub account. You need to enable \"trade\" option for the api key which requests this endpoint. The sub-account's USDT-Ⓜ futures commission of a symbol equals to the base commission of the symbol on the sub-account's fee tier plus the commission adjustment.
pub async fn create_broker_sub_account_api_commission_futures_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiCommissionFuturesV1Params) -> Result<models::CreateBrokerSubAccountApiCommissionFuturesV1Resp, Error<CreateBrokerSubAccountApiCommissionFuturesV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission/futures", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("makerAdjustment", params.maker_adjustment.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("symbol", params.symbol.to_string());
multipart_form_params.insert("takerAdjustment", params.taker_adjustment.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiCommissionFuturesV1Resp`"))),
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::CreateBrokerSubAccountApiCommissionFuturesV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountApiCommissionFuturesV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This request will change the commission for a sub account. You need to enable \"trade\" option for the api key which requests this endpoint.
pub async fn create_broker_sub_account_api_commission_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiCommissionV1Params) -> Result<models::CreateBrokerSubAccountApiCommissionV1Resp, Error<CreateBrokerSubAccountApiCommissionV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("makerCommission", params.maker_commission.to_string());
if let Some(param_value) = params.margin_maker_commission {
multipart_form_params.insert("marginMakerCommission", param_value.to_string());
}
if let Some(param_value) = params.margin_taker_commission {
multipart_form_params.insert("marginTakerCommission", param_value.to_string());
}
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("takerCommission", params.taker_commission.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiCommissionV1Resp`"))),
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::CreateBrokerSubAccountApiCommissionV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountApiCommissionV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn create_broker_sub_account_api_ip_restriction_v2(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiIpRestrictionV2Params) -> Result<models::CreateBrokerSubAccountApiIpRestrictionV2Resp, Error<CreateBrokerSubAccountApiIpRestrictionV2Error>> {
let uri_str = format!("{}/sapi/v2/broker/subAccountApi/ipRestriction", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
if let Some(param_value) = params.ip_address {
multipart_form_params.insert("ipAddress", param_value.to_string());
}
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("status", params.status.to_string());
multipart_form_params.insert("subAccountApiKey", params.sub_account_api_key.to_string());
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiIpRestrictionV2Resp`"))),
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::CreateBrokerSubAccountApiIpRestrictionV2Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountApiIpRestrictionV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - This request will enable the api permission for a sub account to use POST /sapi/v1/asset/transferendpoint. - You need to enable \"trade\" option for the api key which requests this endpoint.
pub async fn create_broker_sub_account_api_permission_universal_transfer_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiPermissionUniversalTransferV1Params) -> Result<models::CreateBrokerSubAccountApiPermissionUniversalTransferV1Resp, Error<CreateBrokerSubAccountApiPermissionUniversalTransferV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/permission/universalTransfer", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("canUniversalTransfer", params.can_universal_transfer.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("subAccountApiKey", params.sub_account_api_key.to_string());
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiPermissionUniversalTransferV1Resp`"))),
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::CreateBrokerSubAccountApiPermissionUniversalTransferV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountApiPermissionUniversalTransferV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - This request will change the api permission for a sub account. - You need to enable \"trade\" option for the api key which requests this endpoint. - Sub account should be enable margin before its api-key's marginTrade being enabled. - Sub account should be enable futures before its api-key's futuresTrade being enabled.
pub async fn create_broker_sub_account_api_permission_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiPermissionV1Params) -> Result<models::CreateBrokerSubAccountApiPermissionV1Resp, Error<CreateBrokerSubAccountApiPermissionV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/permission", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("canTrade", params.can_trade.to_string());
multipart_form_params.insert("futuresTrade", params.futures_trade.to_string());
multipart_form_params.insert("marginTrade", params.margin_trade.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("subAccountApiKey", params.sub_account_api_key.to_string());
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiPermissionV1Resp`"))),
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::CreateBrokerSubAccountApiPermissionV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountApiPermissionV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - This request will generate a api key for a sub account. - You need to enable \"trade\" option for the api key which requests this endpoint - Sub account should be enable margin before its api-key's marginTrade being enabled - Sub account should be enable futures before its api-key's futuresTrade being enabled - You can only create 1 api key for each sub account per second
pub async fn create_broker_sub_account_api_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountApiV1Params) -> Result<models::CreateBrokerSubAccountApiV1Resp, Error<CreateBrokerSubAccountApiV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("canTrade", params.can_trade.to_string());
if let Some(param_value) = params.futures_trade {
multipart_form_params.insert("futuresTrade", param_value.to_string());
}
if let Some(param_value) = params.margin_trade {
multipart_form_params.insert("marginTrade", param_value.to_string());
}
if let Some(param_value) = params.public_key {
multipart_form_params.insert("publicKey", param_value.to_string());
}
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountApiV1Resp`"))),
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::CreateBrokerSubAccountApiV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountApiV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - Subaccount must be enabled margin before using this switch
pub async fn create_broker_sub_account_bnb_burn_margin_interest_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountBnbBurnMarginInterestV1Params) -> Result<models::CreateBrokerSubAccountBnbBurnMarginInterestV1Resp, Error<CreateBrokerSubAccountBnbBurnMarginInterestV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount/bnbBurn/marginInterest", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("interestBNBBurn", params.interest_bnb_burn.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountBnbBurnMarginInterestV1Resp`"))),
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::CreateBrokerSubAccountBnbBurnMarginInterestV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountBnbBurnMarginInterestV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn create_broker_sub_account_bnb_burn_spot_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountBnbBurnSpotV1Params) -> Result<models::CreateBrokerSubAccountBnbBurnSpotV1Resp, Error<CreateBrokerSubAccountBnbBurnSpotV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount/bnbBurn/spot", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("spotBNBBurn", params.spot_bnb_burn.to_string());
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountBnbBurnSpotV1Resp`"))),
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::CreateBrokerSubAccountBnbBurnSpotV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountBnbBurnSpotV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn create_broker_sub_account_futures_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountFuturesV1Params) -> Result<models::CreateBrokerSubAccountFuturesV1Resp, Error<CreateBrokerSubAccountFuturesV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount/futures", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("futures", params.futures.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("subAccountId", params.sub_account_id.to_string());
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountFuturesV1Resp`"))),
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::CreateBrokerSubAccountFuturesV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountFuturesV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// To create a link sub-account
pub async fn create_broker_sub_account_v1(configuration: &configuration::Configuration, params: CreateBrokerSubAccountV1Params) -> Result<models::CreateBrokerSubAccountV1Resp, Error<CreateBrokerSubAccountV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
if let Some(param_value) = params.tag {
multipart_form_params.insert("tag", param_value.to_string());
}
multipart_form_params.insert("timestamp", params.timestamp.to_string());
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerSubAccountV1Resp`"))),
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::CreateBrokerSubAccountV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerSubAccountV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - You need to enable \"internal transfer\" option for the api key which requests this endpoint. - Transfer from master account if fromId not sent. - Transfer to master account if toId not sent. - Each master account could transfer 5000 times/min
pub async fn create_broker_transfer_futures_v1(configuration: &configuration::Configuration, params: CreateBrokerTransferFuturesV1Params) -> Result<models::CreateBrokerTransferFuturesV1Resp, Error<CreateBrokerTransferFuturesV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/transfer/futures", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("amount", params.amount.to_string());
multipart_form_params.insert("asset", params.asset.to_string());
if let Some(param_value) = params.client_tran_id {
multipart_form_params.insert("clientTranId", param_value.to_string());
}
if let Some(param_value) = params.from_id {
multipart_form_params.insert("fromId", param_value.to_string());
}
multipart_form_params.insert("futuresType", params.futures_type.to_string());
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("timestamp", params.timestamp.to_string());
if let Some(param_value) = params.to_id {
multipart_form_params.insert("toId", param_value.to_string());
}
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerTransferFuturesV1Resp`"))),
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::CreateBrokerTransferFuturesV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerTransferFuturesV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - You need to enable \"internal transfer\" option for the api key which requests this endpoint. - Transfer from master account if fromId not sent. - Transfer to master account if toId not sent.
pub async fn create_broker_transfer_v1(configuration: &configuration::Configuration, params: CreateBrokerTransferV1Params) -> Result<models::CreateBrokerTransferV1Resp, Error<CreateBrokerTransferV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/transfer", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("amount", params.amount.to_string());
multipart_form_params.insert("asset", params.asset.to_string());
if let Some(param_value) = params.client_tran_id {
multipart_form_params.insert("clientTranId", param_value.to_string());
}
if let Some(param_value) = params.from_id {
multipart_form_params.insert("fromId", param_value.to_string());
}
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("timestamp", params.timestamp.to_string());
if let Some(param_value) = params.to_id {
multipart_form_params.insert("toId", param_value.to_string());
}
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerTransferV1Resp`"))),
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::CreateBrokerTransferV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerTransferV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - You need to enable \"internal transfer\" option for the api key which requests this endpoint. - Transfer from master account if fromId not sent. - Transfer to master account if toId not sent. - Transfer between futures acount is not supported.
pub async fn create_broker_universal_transfer_v1(configuration: &configuration::Configuration, params: CreateBrokerUniversalTransferV1Params) -> Result<models::CreateBrokerUniversalTransferV1Resp, Error<CreateBrokerUniversalTransferV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/universalTransfer", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let mut multipart_form_params = std::collections::HashMap::new();
multipart_form_params.insert("amount", params.amount.to_string());
multipart_form_params.insert("asset", params.asset.to_string());
if let Some(param_value) = params.client_tran_id {
multipart_form_params.insert("clientTranId", param_value.to_string());
}
multipart_form_params.insert("fromAccountType", params.from_account_type.to_string());
if let Some(param_value) = params.from_id {
multipart_form_params.insert("fromId", param_value.to_string());
}
if let Some(param_value) = params.recv_window {
multipart_form_params.insert("recvWindow", param_value.to_string());
}
multipart_form_params.insert("timestamp", params.timestamp.to_string());
multipart_form_params.insert("toAccountType", params.to_account_type.to_string());
if let Some(param_value) = params.to_id {
multipart_form_params.insert("toId", param_value.to_string());
}
req_builder = req_builder.form(&multipart_form_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBrokerUniversalTransferV1Resp`"))),
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::CreateBrokerUniversalTransferV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateBrokerUniversalTransferV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn delete_broker_sub_account_api_ip_restriction_ip_list_v1(configuration: &configuration::Configuration, params: DeleteBrokerSubAccountApiIpRestrictionIpListV1Params) -> Result<models::DeleteBrokerSubAccountApiIpRestrictionIpListV1Resp, Error<DeleteBrokerSubAccountApiIpRestrictionIpListV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/ipRestriction/ipList", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
query_params.push(("subAccountApiKey".to_string(), params.sub_account_api_key.to_string()));
if let Some(ref param_value) = params.ip_address {
query_params.push(("ipAddress".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteBrokerSubAccountApiIpRestrictionIpListV1Resp`"))),
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::DeleteBrokerSubAccountApiIpRestrictionIpListV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteBrokerSubAccountApiIpRestrictionIpListV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - This request will delete a api key for a sub account - You need to enable \"trade\" option for the api key which requests this endpoint - You can only delete 1 api key for each sub account per second
pub async fn delete_broker_sub_account_api_v1(configuration: &configuration::Configuration, params: DeleteBrokerSubAccountApiV1Params) -> Result<serde_json::Value, Error<DeleteBrokerSubAccountApiV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
query_params.push(("subAccountApiKey".to_string(), params.sub_account_api_key.to_string()));
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
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`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteBrokerSubAccountApiV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn delete_broker_sub_account_v1(configuration: &configuration::Configuration, params: DeleteBrokerSubAccountV1Params) -> Result<serde_json::Value, Error<DeleteBrokerSubAccountV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
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`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteBrokerSubAccountV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - CustomerId and email can not be sent at the same time
pub async fn get_api_referral_customization_v1(configuration: &configuration::Configuration, params: GetApiReferralCustomizationV1Params) -> Result<Vec<models::GetApiReferralCustomizationV1RespItem>, Error<GetApiReferralCustomizationV1Error>> {
let uri_str = format!("{}/sapi/v1/apiReferral/customization", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.customer_id {
query_params.push(("customerId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.email {
query_params.push(("email".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralCustomizationV1RespItem>`"))),
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>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetApiReferralCustomizationV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_api_referral_if_new_user_v1(configuration: &configuration::Configuration, params: GetApiReferralIfNewUserV1Params) -> Result<models::GetApiReferralIfNewUserV1Resp, Error<GetApiReferralIfNewUserV1Error>> {
let uri_str = format!("{}/sapi/v1/apiReferral/ifNewUser", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("apiAgentCode".to_string(), params.api_agent_code.to_string()));
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralIfNewUserV1Resp`"))),
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`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetApiReferralIfNewUserV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - Only get the latest history of past 7 days.
pub async fn get_api_referral_kickback_recent_record_v1(configuration: &configuration::Configuration, params: GetApiReferralKickbackRecentRecordV1Params) -> Result<Vec<models::GetApiReferralKickbackRecentRecordV1RespItem>, Error<GetApiReferralKickbackRecentRecordV1Error>> {
let uri_str = format!("{}/sapi/v1/apiReferral/kickback/recentRecord", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.start_time {
query_params.push(("startTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.end_time {
query_params.push(("endTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.limit {
query_params.push(("limit".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralKickbackRecentRecordV1RespItem>`"))),
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::GetApiReferralKickbackRecentRecordV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetApiReferralKickbackRecentRecordV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - startTime and endTime must be both specified or both omitted. - When both omitted it returns last 7 days. - When both specified the span has to be within 7 days.
pub async fn get_api_referral_rebate_recent_record_v1(configuration: &configuration::Configuration, params: GetApiReferralRebateRecentRecordV1Params) -> Result<Vec<models::GetApiReferralRebateRecentRecordV1RespItem>, Error<GetApiReferralRebateRecentRecordV1Error>> {
let uri_str = format!("{}/sapi/v1/apiReferral/rebate/recentRecord", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.customer_id {
query_params.push(("customerId".to_string(), param_value.to_string()));
}
query_params.push(("startTime".to_string(), params.start_time.to_string()));
query_params.push(("endTime".to_string(), params.end_time.to_string()));
query_params.push(("limit".to_string(), params.limit.to_string()));
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetApiReferralRebateRecentRecordV1RespItem>`"))),
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::GetApiReferralRebateRecentRecordV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetApiReferralRebateRecentRecordV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - CustomerId must be unique
pub async fn get_api_referral_user_customization_v1(configuration: &configuration::Configuration, params: GetApiReferralUserCustomizationV1Params) -> Result<models::GetApiReferralUserCustomizationV1Resp, Error<GetApiReferralUserCustomizationV1Error>> {
let uri_str = format!("{}/sapi/v1/apiReferral/userCustomization", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("apiAgentCode".to_string(), params.api_agent_code.to_string()));
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetApiReferralUserCustomizationV1Resp`"))),
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`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetApiReferralUserCustomizationV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_broker_info_v1(configuration: &configuration::Configuration, params: GetBrokerInfoV1Params) -> Result<models::GetBrokerInfoV1Resp, Error<GetBrokerInfoV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/info", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerInfoV1Resp`"))),
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::GetBrokerInfoV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerInfoV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - If filterResult = TRUE, rebates not from its own sub accounts will be filtered out in response.
pub async fn get_broker_rebate_futures_recent_record_v1(configuration: &configuration::Configuration, params: GetBrokerRebateFuturesRecentRecordV1Params) -> Result<Vec<models::GetBrokerRebateFuturesRecentRecordV1RespItem>, Error<GetBrokerRebateFuturesRecentRecordV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/rebate/futures/recentRecord", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
query_params.push(("startTime".to_string(), params.start_time.to_string()));
query_params.push(("endTime".to_string(), params.end_time.to_string()));
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.size {
query_params.push(("size".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.filter_result {
query_params.push(("filterResult".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerRebateFuturesRecentRecordV1RespItem>`"))),
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::GetBrokerRebateFuturesRecentRecordV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerRebateFuturesRecentRecordV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - The query time period must be less than 7 days (default as the recent 7 days).
pub async fn get_broker_rebate_recent_record_v1(configuration: &configuration::Configuration, params: GetBrokerRebateRecentRecordV1Params) -> Result<Vec<models::GetBrokerRebateRecentRecordV1RespItem>, Error<GetBrokerRebateRecentRecordV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/rebate/recentRecord", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.sub_account_id {
query_params.push(("subAccountId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.start_time {
query_params.push(("startTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.end_time {
query_params.push(("endTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.size {
query_params.push(("size".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerRebateRecentRecordV1RespItem>`"))),
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::GetBrokerRebateRecentRecordV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerRebateRecentRecordV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - The sub-account's COIN-Ⓜ futures commission of a symbol equals to the base commission of the symbol on the sub-account's fee tier plus the commission adjustment. - If symbol not sent, commission adjustment of all symbols will be returned. - If futures disabled, it is not allowed to set subaccount's COIN-Ⓜ futures commission adjustment on any symbol. - Different symbols have the same commission for the same pair
pub async fn get_broker_sub_account_api_commission_coin_futures_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountApiCommissionCoinFuturesV1Params) -> Result<Vec<models::GetBrokerSubAccountApiCommissionCoinFuturesV1RespItem>, Error<GetBrokerSubAccountApiCommissionCoinFuturesV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission/coinFutures", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
if let Some(ref param_value) = params.pair {
query_params.push(("pair".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountApiCommissionCoinFuturesV1RespItem>`"))),
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::GetBrokerSubAccountApiCommissionCoinFuturesV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountApiCommissionCoinFuturesV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// The sub-account's USDT-Ⓜ futures commission of a symbol equals to the base commission of the symbol on the sub-account's fee tier plus the commission adjustment.
pub async fn get_broker_sub_account_api_commission_futures_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountApiCommissionFuturesV1Params) -> Result<Vec<models::GetBrokerSubAccountApiCommissionFuturesV1RespItem>, Error<GetBrokerSubAccountApiCommissionFuturesV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/commission/futures", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
if let Some(ref param_value) = params.symbol {
query_params.push(("symbol".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountApiCommissionFuturesV1RespItem>`"))),
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::GetBrokerSubAccountApiCommissionFuturesV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountApiCommissionFuturesV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_broker_sub_account_api_ip_restriction_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountApiIpRestrictionV1Params) -> Result<models::GetBrokerSubAccountApiIpRestrictionV1Resp, Error<GetBrokerSubAccountApiIpRestrictionV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi/ipRestriction", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
query_params.push(("subAccountApiKey".to_string(), params.sub_account_api_key.to_string()));
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerSubAccountApiIpRestrictionV1Resp`"))),
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::GetBrokerSubAccountApiIpRestrictionV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountApiIpRestrictionV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - You need to enable \"trade\" option for the api key which requests this endpoint
pub async fn get_broker_sub_account_api_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountApiV1Params) -> Result<Vec<models::GetBrokerSubAccountApiV1RespItem>, Error<GetBrokerSubAccountApiV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccountApi", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
if let Some(ref param_value) = params.sub_account_api_key {
query_params.push(("subAccountApiKey".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.size {
query_params.push(("size".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountApiV1RespItem>`"))),
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::GetBrokerSubAccountApiV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountApiV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_broker_sub_account_bnb_burn_status_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountBnbBurnStatusV1Params) -> Result<models::GetBrokerSubAccountBnbBurnStatusV1Resp, Error<GetBrokerSubAccountBnbBurnStatusV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount/bnbBurn/status", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerSubAccountBnbBurnStatusV1Resp`"))),
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::GetBrokerSubAccountBnbBurnStatusV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountBnbBurnStatusV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - The query time period must be less than 7 days( default as the recent 7 days).
pub async fn get_broker_sub_account_deposit_hist_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountDepositHistV1Params) -> Result<Vec<models::GetBrokerSubAccountDepositHistV1RespItem>, Error<GetBrokerSubAccountDepositHistV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount/depositHist", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.sub_account_id {
query_params.push(("subAccountId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.coin {
query_params.push(("coin".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.status {
query_params.push(("status".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.start_time {
query_params.push(("startTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.end_time {
query_params.push(("endTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.limit {
query_params.push(("limit".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.offset {
query_params.push(("offset".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountDepositHistV1RespItem>`"))),
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::GetBrokerSubAccountDepositHistV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountDepositHistV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_broker_sub_account_deposit_hist_v2(configuration: &configuration::Configuration, params: GetBrokerSubAccountDepositHistV2Params) -> Result<Vec<models::GetBrokerSubAccountDepositHistV2RespItem>, Error<GetBrokerSubAccountDepositHistV2Error>> {
let uri_str = format!("{}/sapi/v2/broker/subAccount/depositHist", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("depositId".to_string(), params.deposit_id.to_string()));
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
if let Some(ref param_value) = params.limit {
query_params.push(("limit".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.offset {
query_params.push(("offset".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountDepositHistV2RespItem>`"))),
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::GetBrokerSubAccountDepositHistV2RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountDepositHistV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_broker_sub_account_futures_summary_v3(configuration: &configuration::Configuration, params: GetBrokerSubAccountFuturesSummaryV3Params) -> Result<models::ExchangelinkGetBrokerSubAccountFuturesSummaryV3Resp, Error<GetBrokerSubAccountFuturesSummaryV3Error>> {
let uri_str = format!("{}/sapi/v3/broker/subAccount/futuresSummary", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.sub_account_id {
query_params.push(("subAccountId".to_string(), param_value.to_string()));
}
query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.size {
query_params.push(("size".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ExchangelinkGetBrokerSubAccountFuturesSummaryV3Resp`"))),
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::ExchangelinkGetBrokerSubAccountFuturesSummaryV3Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountFuturesSummaryV3Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - If subaccountId is not sent, the size must be sent
pub async fn get_broker_sub_account_margin_summary_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountMarginSummaryV1Params) -> Result<models::GetBrokerSubAccountMarginSummaryV1Resp, Error<GetBrokerSubAccountMarginSummaryV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount/marginSummary", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.sub_account_id {
query_params.push(("subAccountId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.size {
query_params.push(("size".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerSubAccountMarginSummaryV1Resp`"))),
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::GetBrokerSubAccountMarginSummaryV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountMarginSummaryV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - If subaccountId is not sent, the size must be sent - Requests per UID are limited to 60 requests per minute
pub async fn get_broker_sub_account_spot_summary_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountSpotSummaryV1Params) -> Result<models::GetBrokerSubAccountSpotSummaryV1Resp, Error<GetBrokerSubAccountSpotSummaryV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount/spotSummary", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.sub_account_id {
query_params.push(("subAccountId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.size {
query_params.push(("size".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerSubAccountSpotSummaryV1Resp`"))),
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::GetBrokerSubAccountSpotSummaryV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountSpotSummaryV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_broker_sub_account_v1(configuration: &configuration::Configuration, params: GetBrokerSubAccountV1Params) -> Result<Vec<models::GetBrokerSubAccountV1RespItem>, Error<GetBrokerSubAccountV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/subAccount", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.sub_account_id {
query_params.push(("subAccountId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.size {
query_params.push(("size".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerSubAccountV1RespItem>`"))),
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::GetBrokerSubAccountV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerSubAccountV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// - Only get the latest history of past 30 days.
pub async fn get_broker_transfer_futures_v1(configuration: &configuration::Configuration, params: GetBrokerTransferFuturesV1Params) -> Result<models::GetBrokerTransferFuturesV1Resp, Error<GetBrokerTransferFuturesV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/transfer/futures", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("subAccountId".to_string(), params.sub_account_id.to_string()));
query_params.push(("futuresType".to_string(), params.futures_type.to_string()));
if let Some(ref param_value) = params.client_tran_id {
query_params.push(("clientTranId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.start_time {
query_params.push(("startTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.end_time {
query_params.push(("endTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.limit {
query_params.push(("limit".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBrokerTransferFuturesV1Resp`"))),
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::GetBrokerTransferFuturesV1Resp`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerTransferFuturesV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - If showAllStatus is true, the status in response will show four types: INIT,PROCESS,SUCCESS,FAILURE. - If showAllStatus is false, the status in response will show three types: INIT,PROCESS,SUCCESS. - Either fromId or toId must be sent. Return fromId equal master account by default. Query scope is limited to 100 days: - Both startTime and endTime are provided: If it exceeds, the endTime will be re-calculated 100 days after the startTime. - Neither startTime nor endTime are provided: Calculate 100 days before today. - endTime is not provided: Calculate 100 days after startTime. - startTime is not provided: Calculate 100 days before endTime.
pub async fn get_broker_transfer_v1(configuration: &configuration::Configuration, params: GetBrokerTransferV1Params) -> Result<Vec<models::GetBrokerTransferV1RespItem>, Error<GetBrokerTransferV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/transfer", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.from_id {
query_params.push(("fromId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.to_id {
query_params.push(("toId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.client_tran_id {
query_params.push(("clientTranId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.show_all_status {
query_params.push(("showAllStatus".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.start_time {
query_params.push(("startTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.end_time {
query_params.push(("endTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.limit {
query_params.push(("limit".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerTransferV1RespItem>`"))),
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::GetBrokerTransferV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerTransferV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Caution: - Either fromId or toId must be sent. - If either fromId or toId is the master account itself, it will not return in response. - If showAllStatus is true, the status in response will show four types: INIT,PROCESS,SUCCESS,FAILURE. Query scope is limited to 100 days: - Both startTime and endTime are provided: If it exceeds, the endTime will be re-calculated 100 days after the startTime. - Neither startTime nor endTime are provided: Calculate 30 days before today. - endTime is not provided: Calculate as Current time. - startTime is not provided: Calculate 30 days before endTime.
pub async fn get_broker_universal_transfer_v1(configuration: &configuration::Configuration, params: GetBrokerUniversalTransferV1Params) -> Result<Vec<models::GetBrokerUniversalTransferV1RespItem>, Error<GetBrokerUniversalTransferV1Error>> {
let uri_str = format!("{}/sapi/v1/broker/universalTransfer", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
// Create a mutable vector for query parameters
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(ref param_value) = params.from_id {
query_params.push(("fromId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.to_id {
query_params.push(("toId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.client_tran_id {
query_params.push(("clientTranId".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.start_time {
query_params.push(("startTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.end_time {
query_params.push(("endTime".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.page {
query_params.push(("page".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.limit {
query_params.push(("limit".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.show_all_status {
query_params.push(("showAllStatus".to_string(), param_value.to_string()));
}
if let Some(ref param_value) = params.recv_window {
query_params.push(("recvWindow".to_string(), param_value.to_string()));
}
query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
// Create header parameters collection
let mut header_params = std::collections::HashMap::new();
// Handle Binance Auth first if configured
if let Some(ref binance_auth) = configuration.binance_auth {
// Add API key to headers
header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
// Generate request body for signing (if any)
let body_string: Option<Vec<u8>> = None;
// Sign the request
let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
Ok(sig) => sig,
Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
};
// Add signature to query params
query_params.push(("signature".to_string(), signature));
}
// Apply all query parameters
if !query_params.is_empty() {
req_builder = req_builder.query(&query_params);
}
// Add user agent if configured
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// Apply all header parameters
for (header_name, header_value) in header_params {
req_builder = req_builder.header(&header_name, &header_value);
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetBrokerUniversalTransferV1RespItem>`"))),
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::GetBrokerUniversalTransferV1RespItem>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBrokerUniversalTransferV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}