use crate::internal::models::{Balance, Book, Order, OrdersInstant, Payment, Ticker, Trade};
use serde::Deserialize;
use serde_json::Value;
#[derive(Deserialize, Debug, Clone)]
pub struct Pagination {
pub limit: i32,
#[serde(default)]
pub page: i32,
#[serde(default)]
pub previous: Value, pub next: Value, }
impl Default for Pagination {
fn default() -> Self {
Pagination {
limit: 0,
page: 0,
previous: Value::default(),
next: Value::default(),
}
}
}
#[derive(Deserialize, Debug, Clone)]
pub struct CryptoMktResponse<T> {
pub status: String,
pub data: T,
#[serde(default)]
pub pagination: Pagination,
}
pub type MarketResponse = CryptoMktResponse<Vec<String>>;
pub type TickerResponse = CryptoMktResponse<Vec<Ticker>>;
pub type BookResponse = CryptoMktResponse<Vec<Book>>;
pub type TradeResponse = CryptoMktResponse<Vec<Trade>>;
pub type OrderResponse = CryptoMktResponse<Vec<Order>>;
pub type SimpleOrderResponse = CryptoMktResponse<Order>;
pub type OrdersInstantResponse = CryptoMktResponse<OrdersInstant>;
pub type EmptyResponse = CryptoMktResponse<String>;
pub type BalanceResponse = CryptoMktResponse<Vec<Balance>>;
pub type PaymentResponse = CryptoMktResponse<Payment>;
pub type PaymentListResponse = CryptoMktResponse<Vec<Payment>>;