#![allow(clippy::doc_markdown)]
use chrono::{DateTime, SecondsFormat, Utc};
use crate::models_gen::*;
pub const SPEC_VERSION: &str = "1.0.0";
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[non_exhaustive]
pub enum OperationId {
CancelAll,
CancelAllAfter,
CancelBatch,
CancelOrder,
CancelOrderByClientId,
DepositAddress,
ExchangeConfig,
ExitPool,
ExportDeposits,
ExportLedger,
ExportOrders,
ExportTrades,
ExportWithdrawals,
FuturesCandles,
FuturesFills,
FuturesFunding,
FuturesMarket,
FuturesMarkets,
FuturesOpenOrders,
FuturesOrderbook,
FuturesPositions,
FuturesTrades,
GetAccountId,
GetAsset,
GetBalance,
GetCandles,
GetDeposit,
GetLedger,
GetMarket,
GetMarketTrades,
GetOrder,
GetOrderBook,
GetOrderByClientId,
GetPool,
GetWithdrawal,
JoinPool,
ListApiKeys,
ListAssets,
ListBalances,
ListDeposits,
ListFeeSchedules,
ListMarkets,
ListNetworks,
ListNotifications,
ListOpenOrders,
ListPools,
ListSubAccounts,
ListWithdrawalAddresses,
ListWithdrawals,
OrderHistory,
PlaceBatch,
PlaceOrder,
ServerTime,
SubAccountBalances,
TradeHistory,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct OperationInfo {
pub method: &'static str,
pub path: &'static str,
pub auth: &'static str,
pub scope: &'static str,
}
impl OperationId {
pub const ALL: [OperationId; 55] = [
OperationId::CancelAll,
OperationId::CancelAllAfter,
OperationId::CancelBatch,
OperationId::CancelOrder,
OperationId::CancelOrderByClientId,
OperationId::DepositAddress,
OperationId::ExchangeConfig,
OperationId::ExitPool,
OperationId::ExportDeposits,
OperationId::ExportLedger,
OperationId::ExportOrders,
OperationId::ExportTrades,
OperationId::ExportWithdrawals,
OperationId::FuturesCandles,
OperationId::FuturesFills,
OperationId::FuturesFunding,
OperationId::FuturesMarket,
OperationId::FuturesMarkets,
OperationId::FuturesOpenOrders,
OperationId::FuturesOrderbook,
OperationId::FuturesPositions,
OperationId::FuturesTrades,
OperationId::GetAccountId,
OperationId::GetAsset,
OperationId::GetBalance,
OperationId::GetCandles,
OperationId::GetDeposit,
OperationId::GetLedger,
OperationId::GetMarket,
OperationId::GetMarketTrades,
OperationId::GetOrder,
OperationId::GetOrderBook,
OperationId::GetOrderByClientId,
OperationId::GetPool,
OperationId::GetWithdrawal,
OperationId::JoinPool,
OperationId::ListApiKeys,
OperationId::ListAssets,
OperationId::ListBalances,
OperationId::ListDeposits,
OperationId::ListFeeSchedules,
OperationId::ListMarkets,
OperationId::ListNetworks,
OperationId::ListNotifications,
OperationId::ListOpenOrders,
OperationId::ListPools,
OperationId::ListSubAccounts,
OperationId::ListWithdrawalAddresses,
OperationId::ListWithdrawals,
OperationId::OrderHistory,
OperationId::PlaceBatch,
OperationId::PlaceOrder,
OperationId::ServerTime,
OperationId::SubAccountBalances,
OperationId::TradeHistory,
];
pub fn as_str(self) -> &'static str {
match self {
OperationId::CancelAll => "cancel_all",
OperationId::CancelAllAfter => "cancel_all_after",
OperationId::CancelBatch => "cancel_batch",
OperationId::CancelOrder => "cancel_order",
OperationId::CancelOrderByClientId => "cancel_order_by_client_id",
OperationId::DepositAddress => "deposit_address",
OperationId::ExchangeConfig => "exchange_config",
OperationId::ExitPool => "exit_pool",
OperationId::ExportDeposits => "export_deposits",
OperationId::ExportLedger => "export_ledger",
OperationId::ExportOrders => "export_orders",
OperationId::ExportTrades => "export_trades",
OperationId::ExportWithdrawals => "export_withdrawals",
OperationId::FuturesCandles => "futures_candles",
OperationId::FuturesFills => "futures_fills",
OperationId::FuturesFunding => "futures_funding",
OperationId::FuturesMarket => "futures_market",
OperationId::FuturesMarkets => "futures_markets",
OperationId::FuturesOpenOrders => "futures_open_orders",
OperationId::FuturesOrderbook => "futures_orderbook",
OperationId::FuturesPositions => "futures_positions",
OperationId::FuturesTrades => "futures_trades",
OperationId::GetAccountId => "get_account_id",
OperationId::GetAsset => "get_asset",
OperationId::GetBalance => "get_balance",
OperationId::GetCandles => "get_candles",
OperationId::GetDeposit => "get_deposit",
OperationId::GetLedger => "get_ledger",
OperationId::GetMarket => "get_market",
OperationId::GetMarketTrades => "get_market_trades",
OperationId::GetOrder => "get_order",
OperationId::GetOrderBook => "get_order_book",
OperationId::GetOrderByClientId => "get_order_by_client_id",
OperationId::GetPool => "get_pool",
OperationId::GetWithdrawal => "get_withdrawal",
OperationId::JoinPool => "join_pool",
OperationId::ListApiKeys => "list_api_keys",
OperationId::ListAssets => "list_assets",
OperationId::ListBalances => "list_balances",
OperationId::ListDeposits => "list_deposits",
OperationId::ListFeeSchedules => "list_fee_schedules",
OperationId::ListMarkets => "list_markets",
OperationId::ListNetworks => "list_networks",
OperationId::ListNotifications => "list_notifications",
OperationId::ListOpenOrders => "list_open_orders",
OperationId::ListPools => "list_pools",
OperationId::ListSubAccounts => "list_sub_accounts",
OperationId::ListWithdrawalAddresses => "list_withdrawal_addresses",
OperationId::ListWithdrawals => "list_withdrawals",
OperationId::OrderHistory => "order_history",
OperationId::PlaceBatch => "place_batch",
OperationId::PlaceOrder => "place_order",
OperationId::ServerTime => "server_time",
OperationId::SubAccountBalances => "sub_account_balances",
OperationId::TradeHistory => "trade_history",
}
}
pub fn info(self) -> OperationInfo {
match self {
OperationId::CancelAll => OperationInfo {
method: "POST",
path: "/api/v1/trading/orders/cancel-all",
auth: "api_key",
scope: "trade",
},
OperationId::CancelAllAfter => OperationInfo {
method: "POST",
path: "/api/v1/trading/orders/cancel-all-after",
auth: "api_key",
scope: "trade",
},
OperationId::CancelBatch => OperationInfo {
method: "POST",
path: "/api/v1/trading/orders/cancel-batch",
auth: "api_key",
scope: "trade",
},
OperationId::CancelOrder => OperationInfo {
method: "DELETE",
path: "/api/v1/trading/orders/{order_id}",
auth: "api_key",
scope: "trade",
},
OperationId::CancelOrderByClientId => OperationInfo {
method: "DELETE",
path: "/api/v1/trading/orders/by-client-id/{client_order_id}",
auth: "api_key",
scope: "trade",
},
OperationId::DepositAddress => OperationInfo {
method: "GET",
path: "/api/v1/wallet/deposit-address",
auth: "api_key",
scope: "read",
},
OperationId::ExchangeConfig => OperationInfo {
method: "GET",
path: "/api/v1/config",
auth: "none",
scope: "",
},
OperationId::ExitPool => OperationInfo {
method: "POST",
path: "/api/v1/pools/{symbol}/exit",
auth: "api_key",
scope: "trade",
},
OperationId::ExportDeposits => OperationInfo {
method: "GET",
path: "/api/v1/exports/deposits",
auth: "api_key",
scope: "read",
},
OperationId::ExportLedger => OperationInfo {
method: "GET",
path: "/api/v1/exports/ledger",
auth: "api_key",
scope: "read",
},
OperationId::ExportOrders => OperationInfo {
method: "GET",
path: "/api/v1/exports/orders",
auth: "api_key",
scope: "read",
},
OperationId::ExportTrades => OperationInfo {
method: "GET",
path: "/api/v1/exports/trades",
auth: "api_key",
scope: "read",
},
OperationId::ExportWithdrawals => OperationInfo {
method: "GET",
path: "/api/v1/exports/withdrawals",
auth: "api_key",
scope: "read",
},
OperationId::FuturesCandles => OperationInfo {
method: "GET",
path: "/api/v1/futures/markets/{coin}/candles",
auth: "none",
scope: "",
},
OperationId::FuturesFills => OperationInfo {
method: "GET",
path: "/api/v1/futures/fills",
auth: "api_key",
scope: "read",
},
OperationId::FuturesFunding => OperationInfo {
method: "GET",
path: "/api/v1/futures/funding",
auth: "api_key",
scope: "read",
},
OperationId::FuturesMarket => OperationInfo {
method: "GET",
path: "/api/v1/futures/markets/{coin}",
auth: "none",
scope: "",
},
OperationId::FuturesMarkets => OperationInfo {
method: "GET",
path: "/api/v1/futures/markets",
auth: "none",
scope: "",
},
OperationId::FuturesOpenOrders => OperationInfo {
method: "GET",
path: "/api/v1/futures/orders",
auth: "api_key",
scope: "read",
},
OperationId::FuturesOrderbook => OperationInfo {
method: "GET",
path: "/api/v1/futures/markets/{coin}/orderbook",
auth: "none",
scope: "",
},
OperationId::FuturesPositions => OperationInfo {
method: "GET",
path: "/api/v1/futures/positions",
auth: "api_key",
scope: "read",
},
OperationId::FuturesTrades => OperationInfo {
method: "GET",
path: "/api/v1/futures/markets/{coin}/trades",
auth: "none",
scope: "",
},
OperationId::GetAccountId => OperationInfo {
method: "GET",
path: "/api/v1/account/id",
auth: "api_key",
scope: "read",
},
OperationId::GetAsset => OperationInfo {
method: "GET",
path: "/api/v1/assets/{symbol}",
auth: "none",
scope: "",
},
OperationId::GetBalance => OperationInfo {
method: "GET",
path: "/api/v1/account/balances/{asset}",
auth: "api_key",
scope: "read",
},
OperationId::GetCandles => OperationInfo {
method: "GET",
path: "/api/v1/markets/{symbol}/candles",
auth: "none",
scope: "",
},
OperationId::GetDeposit => OperationInfo {
method: "GET",
path: "/api/v1/wallet/deposits/{deposit_id}",
auth: "api_key",
scope: "read",
},
OperationId::GetLedger => OperationInfo {
method: "GET",
path: "/api/v1/account/ledger",
auth: "api_key",
scope: "read",
},
OperationId::GetMarket => OperationInfo {
method: "GET",
path: "/api/v1/markets/{symbol}",
auth: "none",
scope: "",
},
OperationId::GetMarketTrades => OperationInfo {
method: "GET",
path: "/api/v1/markets/{symbol}/trades",
auth: "none",
scope: "",
},
OperationId::GetOrder => OperationInfo {
method: "GET",
path: "/api/v1/trading/orders/{order_id}",
auth: "api_key",
scope: "read",
},
OperationId::GetOrderBook => OperationInfo {
method: "GET",
path: "/api/v1/markets/{symbol}/orderbook",
auth: "none",
scope: "",
},
OperationId::GetOrderByClientId => OperationInfo {
method: "GET",
path: "/api/v1/trading/orders/by-client-id/{client_order_id}",
auth: "api_key",
scope: "read",
},
OperationId::GetPool => OperationInfo {
method: "GET",
path: "/api/v1/pools/{symbol}",
auth: "none",
scope: "",
},
OperationId::GetWithdrawal => OperationInfo {
method: "GET",
path: "/api/v1/wallet/withdrawals/{withdrawal_id}",
auth: "api_key",
scope: "read",
},
OperationId::JoinPool => OperationInfo {
method: "POST",
path: "/api/v1/pools/{symbol}/join",
auth: "api_key",
scope: "trade",
},
OperationId::ListApiKeys => OperationInfo {
method: "GET",
path: "/api/v1/account/api-keys",
auth: "api_key",
scope: "read",
},
OperationId::ListAssets => OperationInfo {
method: "GET",
path: "/api/v1/assets",
auth: "none",
scope: "",
},
OperationId::ListBalances => OperationInfo {
method: "GET",
path: "/api/v1/account/balances",
auth: "api_key",
scope: "read",
},
OperationId::ListDeposits => OperationInfo {
method: "GET",
path: "/api/v1/wallet/deposits",
auth: "api_key",
scope: "read",
},
OperationId::ListFeeSchedules => OperationInfo {
method: "GET",
path: "/api/v1/fees",
auth: "none",
scope: "",
},
OperationId::ListMarkets => OperationInfo {
method: "GET",
path: "/api/v1/markets",
auth: "none",
scope: "",
},
OperationId::ListNetworks => OperationInfo {
method: "GET",
path: "/api/v1/networks",
auth: "none",
scope: "",
},
OperationId::ListNotifications => OperationInfo {
method: "GET",
path: "/api/v1/account/notifications",
auth: "api_key",
scope: "read",
},
OperationId::ListOpenOrders => OperationInfo {
method: "GET",
path: "/api/v1/trading/orders",
auth: "api_key",
scope: "read",
},
OperationId::ListPools => OperationInfo {
method: "GET",
path: "/api/v1/pools",
auth: "none",
scope: "",
},
OperationId::ListSubAccounts => OperationInfo {
method: "GET",
path: "/api/v1/account/sub-accounts",
auth: "api_key",
scope: "read",
},
OperationId::ListWithdrawalAddresses => OperationInfo {
method: "GET",
path: "/api/v1/wallet/withdrawal-addresses",
auth: "api_key",
scope: "read",
},
OperationId::ListWithdrawals => OperationInfo {
method: "GET",
path: "/api/v1/wallet/withdrawals",
auth: "api_key",
scope: "read",
},
OperationId::OrderHistory => OperationInfo {
method: "GET",
path: "/api/v1/trading/orders/history",
auth: "api_key",
scope: "read",
},
OperationId::PlaceBatch => OperationInfo {
method: "POST",
path: "/api/v1/trading/orders/batch",
auth: "api_key",
scope: "trade",
},
OperationId::PlaceOrder => OperationInfo {
method: "POST",
path: "/api/v1/trading/orders",
auth: "api_key",
scope: "trade",
},
OperationId::ServerTime => OperationInfo {
method: "GET",
path: "/api/v1/time",
auth: "none",
scope: "",
},
OperationId::SubAccountBalances => OperationInfo {
method: "GET",
path: "/api/v1/account/sub-accounts/{id}/balances",
auth: "api_key",
scope: "read",
},
OperationId::TradeHistory => OperationInfo {
method: "GET",
path: "/api/v1/trading/trades",
auth: "api_key",
scope: "read",
},
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct DepositAddressParams {
pub asset: String,
pub network: String,
}
impl DepositAddressParams {
pub fn new(asset: impl Into<String>, network: impl Into<String>) -> Self {
Self {
asset: asset.into(),
network: network.into(),
}
}
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
{
let v = &self.asset;
q.push(("asset", v.clone()));
}
{
let v = &self.network;
q.push(("network", v.clone()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ExportParams {
pub from: Option<DateTime<Utc>>,
pub to: Option<DateTime<Utc>>,
}
impl ExportParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.from {
q.push(("from", v.to_rfc3339_opts(SecondsFormat::AutoSi, true)));
}
if let Some(v) = &self.to {
q.push(("to", v.to_rfc3339_opts(SecondsFormat::AutoSi, true)));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct FuturesCandlesParams {
pub interval: String,
pub before: Option<i64>,
}
impl FuturesCandlesParams {
pub fn new(interval: impl Into<String>) -> Self {
Self {
interval: interval.into(),
before: None,
}
}
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
{
let v = &self.interval;
q.push(("interval", v.clone()));
}
if let Some(v) = &self.before {
q.push(("before", v.to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct FuturesFillsParams {
pub cursor: Option<String>,
}
impl FuturesFillsParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct FuturesFundingParams {
pub cursor: Option<String>,
}
impl FuturesFundingParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct FuturesOrderbookParams {
pub depth: Option<i64>,
}
impl FuturesOrderbookParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.depth {
q.push(("depth", v.to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct FuturesTradesParams {
pub limit: Option<i64>,
}
impl FuturesTradesParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCandlesParams {
pub interval: CandleInterval,
pub start_time: Option<DateTime<Utc>>,
pub end_time: Option<DateTime<Utc>>,
pub limit: Option<i32>,
}
impl GetCandlesParams {
pub fn new(interval: CandleInterval) -> Self {
Self {
interval,
start_time: None,
end_time: None,
limit: None,
}
}
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
{
let v = &self.interval;
q.push(("interval", v.as_str().to_string()));
}
if let Some(v) = &self.start_time {
q.push(("start_time", v.to_rfc3339_opts(SecondsFormat::AutoSi, true)));
}
if let Some(v) = &self.end_time {
q.push(("end_time", v.to_rfc3339_opts(SecondsFormat::AutoSi, true)));
}
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct GetLedgerParams {
pub asset: Option<String>,
pub cursor: Option<String>,
pub limit: Option<i32>,
pub direction: Option<SortDirection>,
}
impl GetLedgerParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.asset {
q.push(("asset", v.clone()));
}
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
if let Some(v) = &self.direction {
q.push(("direction", v.as_str().to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct GetMarketTradesParams {
pub cursor: Option<String>,
pub limit: Option<i32>,
pub direction: Option<SortDirection>,
}
impl GetMarketTradesParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
if let Some(v) = &self.direction {
q.push(("direction", v.as_str().to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct GetOrderBookParams {
pub depth: Option<i64>,
}
impl GetOrderBookParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.depth {
q.push(("depth", v.to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ListDepositsParams {
pub asset: Option<String>,
pub cursor: Option<String>,
pub limit: Option<i32>,
pub direction: Option<SortDirection>,
}
impl ListDepositsParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.asset {
q.push(("asset", v.clone()));
}
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
if let Some(v) = &self.direction {
q.push(("direction", v.as_str().to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ListNotificationsParams {
pub unread_only: Option<bool>,
pub cursor: Option<String>,
pub limit: Option<i32>,
pub direction: Option<SortDirection>,
}
impl ListNotificationsParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.unread_only {
q.push(("unread_only", v.to_string()));
}
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
if let Some(v) = &self.direction {
q.push(("direction", v.as_str().to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ListOpenOrdersParams {
pub symbol: Option<String>,
pub status: Option<OrderStatus>,
}
impl ListOpenOrdersParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.symbol {
q.push(("symbol", v.clone()));
}
if let Some(v) = &self.status {
q.push(("status", v.as_str().to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ListWithdrawalsParams {
pub asset: Option<String>,
pub cursor: Option<String>,
pub limit: Option<i32>,
pub direction: Option<SortDirection>,
}
impl ListWithdrawalsParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.asset {
q.push(("asset", v.clone()));
}
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
if let Some(v) = &self.direction {
q.push(("direction", v.as_str().to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct OrderHistoryParams {
pub symbol: Option<String>,
pub status: Option<OrderStatus>,
pub cursor: Option<String>,
pub limit: Option<i32>,
pub direction: Option<SortDirection>,
}
impl OrderHistoryParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.symbol {
q.push(("symbol", v.clone()));
}
if let Some(v) = &self.status {
q.push(("status", v.as_str().to_string()));
}
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
if let Some(v) = &self.direction {
q.push(("direction", v.as_str().to_string()));
}
q
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct TradeHistoryParams {
pub symbol: Option<String>,
pub cursor: Option<String>,
pub limit: Option<i32>,
pub direction: Option<SortDirection>,
}
impl TradeHistoryParams {
pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
let mut q = Vec::new();
if let Some(v) = &self.symbol {
q.push(("symbol", v.clone()));
}
if let Some(v) = &self.cursor {
q.push(("cursor", v.clone()));
}
if let Some(v) = &self.limit {
q.push(("limit", v.to_string()));
}
if let Some(v) = &self.direction {
q.push(("direction", v.as_str().to_string()));
}
q
}
}