1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct LoginResp {
5 pub code: i32,
6 pub msg: String,
7 pub data: LoginRespData,
8}
9
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct LoginRespData {
12 pub id: i64,
13 pub name: String,
14 pub score: i64,
15 pub username: String,
16 pub token: String,
17}
18
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct AuthInfo {
21 pub id: i64,
22 pub name: String,
23 pub score: i64,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct Packet {
28 pub body: Vec<u8>,
29}
30
31impl Packet {
32 pub fn new(body: Vec<u8>) -> Self {
33 Self { body }
34 }
35
36 pub fn from_string(s: &str) -> Self {
37 Self {
38 body: s.as_bytes().to_vec(),
39 }
40 }
41}