flare_core/net/
flare.net.rs

1// This file is @generated by prost-build.
2/// 请求消息
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Message {
5    /// 命令
6    #[prost(enumeration = "Command", tag = "1")]
7    pub command: i32,
8    /// 消息体
9    #[prost(bytes = "vec", tag = "2")]
10    pub data: ::prost::alloc::vec::Vec<u8>,
11    /// 客户端消息id
12    #[prost(string, tag = "3")]
13    pub client_id: ::prost::alloc::string::String,
14}
15/// 响应消息
16#[derive(Clone, PartialEq, ::prost::Message)]
17pub struct Response {
18    #[prost(int32, tag = "1")]
19    pub code: i32,
20    #[prost(string, tag = "2")]
21    pub message: ::prost::alloc::string::String,
22    #[prost(bytes = "vec", tag = "3")]
23    pub data: ::prost::alloc::vec::Vec<u8>,
24}
25/// 登录请求
26#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct LoginReq {
28    /// 用户id
29    #[prost(string, tag = "1")]
30    pub user_id: ::prost::alloc::string::String,
31    /// 平台
32    #[prost(enumeration = "Platform", tag = "2")]
33    pub platform: i32,
34    /// 客户端id
35    #[prost(string, tag = "3")]
36    pub client_id: ::prost::alloc::string::String,
37    /// token
38    #[prost(string, tag = "4")]
39    pub token: ::prost::alloc::string::String,
40}
41/// 登录响应
42#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct LoginResp {
44    /// 用户id
45    #[prost(string, tag = "1")]
46    pub user_id: ::prost::alloc::string::String,
47    /// 语言
48    #[prost(string, tag = "2")]
49    pub language: ::prost::alloc::string::String,
50}
51/// 设备平台
52#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
53#[repr(i32)]
54pub enum Platform {
55    Unknown = 0,
56    Ios = 1,
57    Android = 2,
58    Windows = 3,
59    /// mac os
60    Osx = 4,
61    /// 网页
62    Web = 5,
63    /// 迷你web
64    MiniWeb = 6,
65    /// Linux设备
66    Linux = 7,
67    /// 安卓平板
68    Apad = 8,
69    /// 苹果平板
70    Ipad = 9,
71}
72impl Platform {
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::Unknown => "UNKNOWN",
80            Self::Ios => "IOS",
81            Self::Android => "ANDROID",
82            Self::Windows => "WINDOWS",
83            Self::Osx => "OSX",
84            Self::Web => "WEB",
85            Self::MiniWeb => "MINI_WEB",
86            Self::Linux => "LINUX",
87            Self::Apad => "APAD",
88            Self::Ipad => "IPAD",
89        }
90    }
91    /// Creates an enum from field names used in the ProtoBuf definition.
92    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
93        match value {
94            "UNKNOWN" => Some(Self::Unknown),
95            "IOS" => Some(Self::Ios),
96            "ANDROID" => Some(Self::Android),
97            "WINDOWS" => Some(Self::Windows),
98            "OSX" => Some(Self::Osx),
99            "WEB" => Some(Self::Web),
100            "MINI_WEB" => Some(Self::MiniWeb),
101            "LINUX" => Some(Self::Linux),
102            "APAD" => Some(Self::Apad),
103            "IPAD" => Some(Self::Ipad),
104            _ => None,
105        }
106    }
107}
108/// 消息标识符
109#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
110#[repr(i32)]
111pub enum Command {
112    CmdUnknown = 0,
113    /// 系统命令 (1-9)
114    ///
115    /// ping
116    Ping = 1,
117    /// pong
118    Pong = 2,
119    /// 登录
120    Login = 3,
121    /// 退出登录
122    LoginOut = 4,
123    /// 设置后台运行
124    SetBackground = 5,
125    /// 语言设置
126    SetLanguage = 6,
127    /// 强制用户下线
128    KickOnline = 7,
129    /// 链接关闭
130    Close = 8,
131    /// 客户端命令 (10-29)
132    ///
133    /// 客户端发送消息
134    ClientSendMessage = 10,
135    /// 客户端拉取消息
136    ClientPullMessage = 11,
137    /// 客户端发送请求
138    ClientRequest = 12,
139    /// 客户端确认接收
140    ClientAck = 13,
141    /// 服务端命令 (30-49)
142    ///
143    /// 服务端推送消息
144    ServerPushMsg = 30,
145    /// 服务端推送自定义消息
146    ServerPushCustom = 31,
147    /// 服务端推送通知
148    ServerPushNotice = 32,
149    /// 服务端推送数据
150    ServerPushData = 33,
151    /// 服务端确认接收
152    ServerAck = 34,
153    /// 服务端响应
154    ServerResponse = 35,
155}
156impl Command {
157    /// String value of the enum field names used in the ProtoBuf definition.
158    ///
159    /// The values are not transformed in any way and thus are considered stable
160    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
161    pub fn as_str_name(&self) -> &'static str {
162        match self {
163            Self::CmdUnknown => "CMD_UNKNOWN",
164            Self::Ping => "PING",
165            Self::Pong => "PONG",
166            Self::Login => "LOGIN",
167            Self::LoginOut => "LOGIN_OUT",
168            Self::SetBackground => "SET_BACKGROUND",
169            Self::SetLanguage => "SET_LANGUAGE",
170            Self::KickOnline => "KICK_ONLINE",
171            Self::Close => "CLOSE",
172            Self::ClientSendMessage => "CLIENT_SEND_MESSAGE",
173            Self::ClientPullMessage => "CLIENT_PULL_MESSAGE",
174            Self::ClientRequest => "CLIENT_REQUEST",
175            Self::ClientAck => "CLIENT_ACK",
176            Self::ServerPushMsg => "SERVER_PUSH_MSG",
177            Self::ServerPushCustom => "SERVER_PUSH_CUSTOM",
178            Self::ServerPushNotice => "SERVER_PUSH_NOTICE",
179            Self::ServerPushData => "SERVER_PUSH_DATA",
180            Self::ServerAck => "SERVER_ACK",
181            Self::ServerResponse => "SERVER_RESPONSE",
182        }
183    }
184    /// Creates an enum from field names used in the ProtoBuf definition.
185    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
186        match value {
187            "CMD_UNKNOWN" => Some(Self::CmdUnknown),
188            "PING" => Some(Self::Ping),
189            "PONG" => Some(Self::Pong),
190            "LOGIN" => Some(Self::Login),
191            "LOGIN_OUT" => Some(Self::LoginOut),
192            "SET_BACKGROUND" => Some(Self::SetBackground),
193            "SET_LANGUAGE" => Some(Self::SetLanguage),
194            "KICK_ONLINE" => Some(Self::KickOnline),
195            "CLOSE" => Some(Self::Close),
196            "CLIENT_SEND_MESSAGE" => Some(Self::ClientSendMessage),
197            "CLIENT_PULL_MESSAGE" => Some(Self::ClientPullMessage),
198            "CLIENT_REQUEST" => Some(Self::ClientRequest),
199            "CLIENT_ACK" => Some(Self::ClientAck),
200            "SERVER_PUSH_MSG" => Some(Self::ServerPushMsg),
201            "SERVER_PUSH_CUSTOM" => Some(Self::ServerPushCustom),
202            "SERVER_PUSH_NOTICE" => Some(Self::ServerPushNotice),
203            "SERVER_PUSH_DATA" => Some(Self::ServerPushData),
204            "SERVER_ACK" => Some(Self::ServerAck),
205            "SERVER_RESPONSE" => Some(Self::ServerResponse),
206            _ => None,
207        }
208    }
209}
210/// 消息响应码
211#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
212#[repr(i32)]
213pub enum ResCode {
214    /// 成功
215    Success = 0,
216    /// 未知错误
217    UnknownCode = 1,
218    /// 连接关闭
219    ConnectionClosed = 2,
220    /// 连接不存在
221    ConnectionNotFound = 3,
222    /// 解码错误
223    DecodeError = 4,
224    /// 编码错误
225    EncodeError = 5,
226    /// WebSocket错误
227    WebsocketError = 6,
228    /// 无效消息类型
229    InvalidMessageType = 7,
230    /// 业务错误
231    BusinessError = 8,
232    /// 协议错误
233    ProtocolError = 9,
234    /// 认证错误
235    AuthError = 10,
236    /// 未找到处理器
237    NotFoundHandler = 11,
238    /// 推送客户端错误
239    PushToClientError = 12,
240    /// 发送消息错误
241    SendMessageError = 13,
242    /// 无效参数
243    InvalidParams = 14,
244    /// 无效命令
245    InvalidCommand = 15,
246    /// 未授权
247    Unauthorized = 16,
248    /// 内部错误
249    InternalError = 17,
250    /// 无效状态
251    InvalidState = 18,
252    /// 超时
253    Timeout = 19,
254    /// 资源错误
255    ResourceError = 20,
256    /// 连接错误
257    ConnectionError = 21,
258    /// 参数错误
259    ArgsError = 22,
260}
261impl ResCode {
262    /// String value of the enum field names used in the ProtoBuf definition.
263    ///
264    /// The values are not transformed in any way and thus are considered stable
265    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
266    pub fn as_str_name(&self) -> &'static str {
267        match self {
268            Self::Success => "SUCCESS",
269            Self::UnknownCode => "UNKNOWN_CODE",
270            Self::ConnectionClosed => "CONNECTION_CLOSED",
271            Self::ConnectionNotFound => "CONNECTION_NOT_FOUND",
272            Self::DecodeError => "DECODE_ERROR",
273            Self::EncodeError => "ENCODE_ERROR",
274            Self::WebsocketError => "WEBSOCKET_ERROR",
275            Self::InvalidMessageType => "INVALID_MESSAGE_TYPE",
276            Self::BusinessError => "BUSINESS_ERROR",
277            Self::ProtocolError => "PROTOCOL_ERROR",
278            Self::AuthError => "AUTH_ERROR",
279            Self::NotFoundHandler => "NOT_FOUND_HANDLER",
280            Self::PushToClientError => "PUSH_TO_CLIENT_ERROR",
281            Self::SendMessageError => "SEND_MESSAGE_ERROR",
282            Self::InvalidParams => "INVALID_PARAMS",
283            Self::InvalidCommand => "INVALID_COMMAND",
284            Self::Unauthorized => "UNAUTHORIZED",
285            Self::InternalError => "INTERNAL_ERROR",
286            Self::InvalidState => "INVALID_STATE",
287            Self::Timeout => "TIMEOUT",
288            Self::ResourceError => "RESOURCE_ERROR",
289            Self::ConnectionError => "CONNECTION_ERROR",
290            Self::ArgsError => "ARGS_ERROR",
291        }
292    }
293    /// Creates an enum from field names used in the ProtoBuf definition.
294    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
295        match value {
296            "SUCCESS" => Some(Self::Success),
297            "UNKNOWN_CODE" => Some(Self::UnknownCode),
298            "CONNECTION_CLOSED" => Some(Self::ConnectionClosed),
299            "CONNECTION_NOT_FOUND" => Some(Self::ConnectionNotFound),
300            "DECODE_ERROR" => Some(Self::DecodeError),
301            "ENCODE_ERROR" => Some(Self::EncodeError),
302            "WEBSOCKET_ERROR" => Some(Self::WebsocketError),
303            "INVALID_MESSAGE_TYPE" => Some(Self::InvalidMessageType),
304            "BUSINESS_ERROR" => Some(Self::BusinessError),
305            "PROTOCOL_ERROR" => Some(Self::ProtocolError),
306            "AUTH_ERROR" => Some(Self::AuthError),
307            "NOT_FOUND_HANDLER" => Some(Self::NotFoundHandler),
308            "PUSH_TO_CLIENT_ERROR" => Some(Self::PushToClientError),
309            "SEND_MESSAGE_ERROR" => Some(Self::SendMessageError),
310            "INVALID_PARAMS" => Some(Self::InvalidParams),
311            "INVALID_COMMAND" => Some(Self::InvalidCommand),
312            "UNAUTHORIZED" => Some(Self::Unauthorized),
313            "INTERNAL_ERROR" => Some(Self::InternalError),
314            "INVALID_STATE" => Some(Self::InvalidState),
315            "TIMEOUT" => Some(Self::Timeout),
316            "RESOURCE_ERROR" => Some(Self::ResourceError),
317            "CONNECTION_ERROR" => Some(Self::ConnectionError),
318            "ARGS_ERROR" => Some(Self::ArgsError),
319            _ => None,
320        }
321    }
322}