ethereal_rust_sdk 0.1.6

Trading client for Ethereal exchange
Documentation
/*
 * Ethereal Exchange API
 *
 * Ethereal HTTP API for real-time trading, order management, and market data access.
 *
 * The version of the OpenAPI document: 0.1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CancelOrderResultDto {
    /// Id representing the order
    #[serde(rename = "id")]
    pub id: String,
    /// A subaccount scoped unique client-generated order id (either a UUID or alphanumeric string up to 32 characters)
    #[serde(rename = "clientOrderId", skip_serializing_if = "Option::is_none")]
    pub client_order_id: Option<String>,
    /// Code indicating the result of the submission
    #[serde(rename = "result")]
    pub result: Result,
}

impl CancelOrderResultDto {
    pub fn new(id: String, result: Result) -> CancelOrderResultDto {
        CancelOrderResultDto {
            id,
            client_order_id: None,
            result,
        }
    }
}
/// Code indicating the result of the submission
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Result {
    #[serde(rename = "AlreadyCanceled")]
    AlreadyCanceled,
    #[serde(rename = "AlreadyExpired")]
    AlreadyExpired,
    #[serde(rename = "AlreadyFilled")]
    AlreadyFilled,
    #[serde(rename = "NotFound")]
    NotFound,
    #[serde(rename = "Ok")]
    Ok,
    #[serde(rename = "NonceAlreadyUsed")]
    NonceAlreadyUsed,
    #[serde(rename = "Unknown")]
    Unknown,
}

impl Default for Result {
    fn default() -> Result {
        Self::AlreadyCanceled
    }
}