1#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Message {
5 #[prost(enumeration = "Command", tag = "1")]
7 pub command: i32,
8 #[prost(bytes = "vec", tag = "2")]
10 pub data: ::prost::alloc::vec::Vec<u8>,
11 #[prost(string, tag = "3")]
13 pub client_id: ::prost::alloc::string::String,
14}
15#[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#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct LoginReq {
28 #[prost(string, tag = "1")]
30 pub user_id: ::prost::alloc::string::String,
31 #[prost(enumeration = "Platform", tag = "2")]
33 pub platform: i32,
34 #[prost(string, tag = "3")]
36 pub client_id: ::prost::alloc::string::String,
37 #[prost(string, tag = "4")]
39 pub token: ::prost::alloc::string::String,
40}
41#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct LoginResp {
44 #[prost(string, tag = "1")]
46 pub user_id: ::prost::alloc::string::String,
47 #[prost(string, tag = "2")]
49 pub language: ::prost::alloc::string::String,
50}
51#[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 Osx = 4,
61 Web = 5,
63 MiniWeb = 6,
65 Linux = 7,
67 Apad = 8,
69 Ipad = 9,
71}
72impl Platform {
73 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 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#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
110#[repr(i32)]
111pub enum Command {
112 CmdUnknown = 0,
113 Ping = 1,
117 Pong = 2,
119 Login = 3,
121 LoginOut = 4,
123 SetBackground = 5,
125 SetLanguage = 6,
127 KickOnline = 7,
129 Close = 8,
131 ClientSendMessage = 10,
135 ClientPullMessage = 11,
137 ClientRequest = 12,
139 ClientAck = 13,
141 ServerPushMsg = 30,
145 ServerPushCustom = 31,
147 ServerPushNotice = 32,
149 ServerPushData = 33,
151 ServerAck = 34,
153 ServerResponse = 35,
155}
156impl Command {
157 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 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#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
212#[repr(i32)]
213pub enum ResCode {
214 Success = 0,
216 UnknownCode = 1,
218 ConnectionClosed = 2,
220 ConnectionNotFound = 3,
222 DecodeError = 4,
224 EncodeError = 5,
226 WebsocketError = 6,
228 InvalidMessageType = 7,
230 BusinessError = 8,
232 ProtocolError = 9,
234 AuthError = 10,
236 NotFoundHandler = 11,
238 PushToClientError = 12,
240 SendMessageError = 13,
242 InvalidParams = 14,
244 InvalidCommand = 15,
246 Unauthorized = 16,
248 InternalError = 17,
250 InvalidState = 18,
252 Timeout = 19,
254 ResourceError = 20,
256 ConnectionError = 21,
258 ArgsError = 22,
260}
261impl ResCode {
262 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 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}