birdie 0.1.0

Birdie is a third party Binance API client, allowing you to easily interact with the Binance API using Rust.
Documentation
use jiff::Timestamp;
use reqwest::Method;
use serde::{Deserialize, Serialize};

use crate::{enums::SecurityType, rest_api::endpoint};

endpoint!(
    "/sapi/v1/margin/isolated/account",
    Method::GET,
    SecurityType::UserData,
    QueryIsolatedMarginAccountInfoEndpoint,
    QueryIsolatedMarginAccountInfoParams,
    QueryIsolatedMarginAccountInfoResponse
);

/// Query Isolated Margin Account Info.
///
/// - Weight: 10
pub struct QueryIsolatedMarginAccountInfoEndpoint<'r> {
    client: &'r crate::rest_api::RestApiClient,
}

impl<'r> QueryIsolatedMarginAccountInfoEndpoint<'r> {
    pub fn new(client: &'r crate::rest_api::RestApiClient) -> Self {
        Self { client }
    }
}

#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct QueryIsolatedMarginAccountInfoParams {
    symbol: Option<String>,
    recv_window: Option<i64>,
    timestamp: i64,
}

impl QueryIsolatedMarginAccountInfoParams {
    pub fn new() -> Self {
        Self {
            symbol: None,
            recv_window: None,
            timestamp: Timestamp::now().as_millisecond(),
        }
    }

    pub fn symbol(mut self, symbol: String) -> Self {
        self.symbol = Some(symbol);
        self
    }

    pub fn recv_window(mut self, recv_window: i64) -> Self {
        self.recv_window = Some(recv_window);
        self
    }
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct QueryIsolatedMarginAccountInfoResponse {
    pub assets: Vec<Asset>,
    pub total_asset_of_btc: Option<String>,
    pub total_liability_of_btc: Option<String>,
    pub total_net_asset_of_btc: Option<String>,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Asset {
    pub asset: String,
    pub borrow_enabled: bool,
    pub borrowed: String,
    pub free: String,
    pub interest: String,
    pub locked: String,
    pub net_asset: String,
    pub net_asset_of_btc: String,
    pub repay_enabled: bool,
    pub total_asset: String,
}