-
Notifications
You must be signed in to change notification settings - Fork 3
/
login.proto
129 lines (105 loc) · 2.76 KB
/
login.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
syntax = "proto3";
package protocol.login.v1;
// Common Request Header
message CommonHeaderReq {
string user_name = 1;
string token = 2;
uint64 stamp = 3;
}
// Common Response Header
message CommonHeaderResp {
uint32 code = 1;
string message = 2;
}
// DeviceInfo definitions
message DeviceInfo {
// system_type can be: iOS, Android, Windows, MacOS, Linux, Web etc.
uint32 system_type = 1;
// device_type can be iPhone X, Huawei P30, Xiaomi 10 etc.
uint32 device_type = 2;
// channel_type can be App Store, Google Play, Mi Store etc.
uint32 channel_type = 3;
// device_name is the name set by the user, like: Ricky Gervais
string device_name = 4;
// device_id is the unique identifier of the device.
string device_id = 5;
}
// Register Request
message RegisterReq {
CommonHeaderReq header = 1;
string phone_number = 2;
DeviceInfo device_info = 3;
string sign = 4;
}
// Register Response
message RegisterResp {
CommonHeaderResp header = 1;
string token = 2;
}
// Login Request
message LoginReq {
CommonHeaderReq header = 1;
uint32 login_type = 2;
DeviceInfo device_info = 3;
string sign = 4;
}
// Login Response
message LoginResp {
message MessageItem {
uint32 msg_type = 1;
string content = 2;
}
CommonHeaderResp header = 1;
repeated MessageItem messages = 2;
}
// Basic Info
message BasicInfoItem {
string user_name = 1;
string user_nick = 2;
uint32 gender = 3;
string avatar = 4;
string signature = 5;
}
// Basic Info Update Request
message UpdateBasicInfoReq {
CommonHeaderReq header = 1;
BasicInfoItem info = 2;
}
// Basic Info Update Response
message UpdateBasicInfoResp {
CommonHeaderResp header = 1;
BasicInfoItem info = 2;
}
// Logout Request
message LogoutReq {
CommonHeaderReq header = 1;
}
// Logout Response
message LogoutResp {
CommonHeaderResp header = 1;
}
// Admin Operations
// Note: this exists mainly to facilitate testing.
// no validation operations(i.e. header check) are performed
message AdminReq {
CommonHeaderReq header = 1;
// cmd can be: change config, send broadcast, mock data etc.
string cmd = 2;
// f1 and f2 are placeholders.
// The values can be subcommands or data or even empty
// They vary in line with the specific `cmd`s
string f1 = 3;
string f2 = 4;
}
message AdminResp {
CommonHeaderResp header = 1;
string result = 2;
}
// Login API
service LoginAPI {
rpc Register(RegisterReq) returns (RegisterResp){}
rpc Login(LoginReq) returns (stream LoginResp){}
rpc UpdateBasicInfo(UpdateBasicInfoReq) returns (UpdateBasicInfoResp){}
rpc Logout(LogoutReq) returns (LogoutResp){}
rpc AdminOp(AdminReq) returns (AdminResp){}
}