longbridge-proto 4.0.5

Longbridge Protocol
Documentation
// This file is @generated by prost-build.
/// Sub is Sub command content, command is 16
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Sub {
    #[prost(string, repeated, tag = "1")]
    pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// SubResponse is response of Sub Request
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubResponse {
    /// 订阅成功
    #[prost(string, repeated, tag = "1")]
    pub success: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// 订阅失败
    #[prost(message, repeated, tag = "2")]
    pub fail: ::prost::alloc::vec::Vec<sub_response::Fail>,
    /// 当前订阅
    #[prost(string, repeated, tag = "3")]
    pub current: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Nested message and enum types in `SubResponse`.
pub mod sub_response {
    #[derive(serde::Serialize, serde::Deserialize)]
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Fail {
        #[prost(string, tag = "1")]
        pub topic: ::prost::alloc::string::String,
        #[prost(string, tag = "2")]
        pub reason: ::prost::alloc::string::String,
    }
}
/// Unsub is Unsub command content, command is 17
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Unsub {
    #[prost(string, repeated, tag = "1")]
    pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// UnsubResponse is response of Unsub request
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnsubResponse {
    /// 当前订阅
    #[prost(string, repeated, tag = "3")]
    pub current: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Notification is push message, command is 18
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Notification {
    #[prost(string, tag = "1")]
    pub topic: ::prost::alloc::string::String,
    #[prost(enumeration = "ContentType", tag = "2")]
    pub content_type: i32,
    #[prost(enumeration = "DispatchType", tag = "3")]
    pub dispatch_type: i32,
    #[prost(bytes = "vec", tag = "4")]
    pub data: ::prost::alloc::vec::Vec<u8>,
}
/// trade gateway command, see: <https://open.longbridge.com/docs/trade/trade-push>
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Command {
    CmdUnknown = 0,
    CmdSub = 16,
    CmdUnsub = 17,
    CmdNotify = 18,
}
impl Command {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::CmdUnknown => "CMD_UNKNOWN",
            Self::CmdSub => "CMD_SUB",
            Self::CmdUnsub => "CMD_UNSUB",
            Self::CmdNotify => "CMD_NOTIFY",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "CMD_UNKNOWN" => Some(Self::CmdUnknown),
            "CMD_SUB" => Some(Self::CmdSub),
            "CMD_UNSUB" => Some(Self::CmdUnsub),
            "CMD_NOTIFY" => Some(Self::CmdNotify),
            _ => None,
        }
    }
}
/// Dispatch type
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DispatchType {
    DispatchUndefined = 0,
    DispatchDirect = 1,
    DispatchBroadcast = 2,
}
impl DispatchType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::DispatchUndefined => "DISPATCH_UNDEFINED",
            Self::DispatchDirect => "DISPATCH_DIRECT",
            Self::DispatchBroadcast => "DISPATCH_BROADCAST",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "DISPATCH_UNDEFINED" => Some(Self::DispatchUndefined),
            "DISPATCH_DIRECT" => Some(Self::DispatchDirect),
            "DISPATCH_BROADCAST" => Some(Self::DispatchBroadcast),
            _ => None,
        }
    }
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ContentType {
    ContentUndefined = 0,
    ContentJson = 1,
    ContentProto = 2,
}
impl ContentType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::ContentUndefined => "CONTENT_UNDEFINED",
            Self::ContentJson => "CONTENT_JSON",
            Self::ContentProto => "CONTENT_PROTO",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "CONTENT_UNDEFINED" => Some(Self::ContentUndefined),
            "CONTENT_JSON" => Some(Self::ContentJson),
            "CONTENT_PROTO" => Some(Self::ContentProto),
            _ => None,
        }
    }
}