Skip to main content

longbridge_proto/
longbridge.trade.v1.rs

1// This file is @generated by prost-build.
2/// Sub is Sub command content, command is 16
3#[derive(serde::Serialize, serde::Deserialize)]
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct Sub {
6    #[prost(string, repeated, tag = "1")]
7    pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
8}
9/// SubResponse is response of Sub Request
10#[derive(serde::Serialize, serde::Deserialize)]
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct SubResponse {
13    /// 订阅成功
14    #[prost(string, repeated, tag = "1")]
15    pub success: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
16    /// 订阅失败
17    #[prost(message, repeated, tag = "2")]
18    pub fail: ::prost::alloc::vec::Vec<sub_response::Fail>,
19    /// 当前订阅
20    #[prost(string, repeated, tag = "3")]
21    pub current: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
22}
23/// Nested message and enum types in `SubResponse`.
24pub mod sub_response {
25    #[derive(serde::Serialize, serde::Deserialize)]
26    #[derive(Clone, PartialEq, ::prost::Message)]
27    pub struct Fail {
28        #[prost(string, tag = "1")]
29        pub topic: ::prost::alloc::string::String,
30        #[prost(string, tag = "2")]
31        pub reason: ::prost::alloc::string::String,
32    }
33}
34/// Unsub is Unsub command content, command is 17
35#[derive(serde::Serialize, serde::Deserialize)]
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct Unsub {
38    #[prost(string, repeated, tag = "1")]
39    pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
40}
41/// UnsubResponse is response of Unsub request
42#[derive(serde::Serialize, serde::Deserialize)]
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct UnsubResponse {
45    /// 当前订阅
46    #[prost(string, repeated, tag = "3")]
47    pub current: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
48}
49/// Notification is push message, command is 18
50#[derive(serde::Serialize, serde::Deserialize)]
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct Notification {
53    #[prost(string, tag = "1")]
54    pub topic: ::prost::alloc::string::String,
55    #[prost(enumeration = "ContentType", tag = "2")]
56    pub content_type: i32,
57    #[prost(enumeration = "DispatchType", tag = "3")]
58    pub dispatch_type: i32,
59    #[prost(bytes = "vec", tag = "4")]
60    pub data: ::prost::alloc::vec::Vec<u8>,
61}
62/// trade gateway command, see: <https://open.longbridgeapp.com/docs/trade/trade-push>
63#[derive(serde::Serialize, serde::Deserialize)]
64#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
65#[repr(i32)]
66pub enum Command {
67    CmdUnknown = 0,
68    CmdSub = 16,
69    CmdUnsub = 17,
70    CmdNotify = 18,
71}
72impl Command {
73    /// String value of the enum field names used in the ProtoBuf definition.
74    ///
75    /// The values are not transformed in any way and thus are considered stable
76    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
77    pub fn as_str_name(&self) -> &'static str {
78        match self {
79            Self::CmdUnknown => "CMD_UNKNOWN",
80            Self::CmdSub => "CMD_SUB",
81            Self::CmdUnsub => "CMD_UNSUB",
82            Self::CmdNotify => "CMD_NOTIFY",
83        }
84    }
85    /// Creates an enum from field names used in the ProtoBuf definition.
86    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
87        match value {
88            "CMD_UNKNOWN" => Some(Self::CmdUnknown),
89            "CMD_SUB" => Some(Self::CmdSub),
90            "CMD_UNSUB" => Some(Self::CmdUnsub),
91            "CMD_NOTIFY" => Some(Self::CmdNotify),
92            _ => None,
93        }
94    }
95}
96/// Dispatch type
97#[derive(serde::Serialize, serde::Deserialize)]
98#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
99#[repr(i32)]
100pub enum DispatchType {
101    DispatchUndefined = 0,
102    DispatchDirect = 1,
103    DispatchBroadcast = 2,
104}
105impl DispatchType {
106    /// String value of the enum field names used in the ProtoBuf definition.
107    ///
108    /// The values are not transformed in any way and thus are considered stable
109    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
110    pub fn as_str_name(&self) -> &'static str {
111        match self {
112            Self::DispatchUndefined => "DISPATCH_UNDEFINED",
113            Self::DispatchDirect => "DISPATCH_DIRECT",
114            Self::DispatchBroadcast => "DISPATCH_BROADCAST",
115        }
116    }
117    /// Creates an enum from field names used in the ProtoBuf definition.
118    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
119        match value {
120            "DISPATCH_UNDEFINED" => Some(Self::DispatchUndefined),
121            "DISPATCH_DIRECT" => Some(Self::DispatchDirect),
122            "DISPATCH_BROADCAST" => Some(Self::DispatchBroadcast),
123            _ => None,
124        }
125    }
126}
127#[derive(serde::Serialize, serde::Deserialize)]
128#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
129#[repr(i32)]
130pub enum ContentType {
131    ContentUndefined = 0,
132    ContentJson = 1,
133    ContentProto = 2,
134}
135impl ContentType {
136    /// String value of the enum field names used in the ProtoBuf definition.
137    ///
138    /// The values are not transformed in any way and thus are considered stable
139    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
140    pub fn as_str_name(&self) -> &'static str {
141        match self {
142            Self::ContentUndefined => "CONTENT_UNDEFINED",
143            Self::ContentJson => "CONTENT_JSON",
144            Self::ContentProto => "CONTENT_PROTO",
145        }
146    }
147    /// Creates an enum from field names used in the ProtoBuf definition.
148    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
149        match value {
150            "CONTENT_UNDEFINED" => Some(Self::ContentUndefined),
151            "CONTENT_JSON" => Some(Self::ContentJson),
152            "CONTENT_PROTO" => Some(Self::ContentProto),
153            _ => None,
154        }
155    }
156}