-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchat.proto
More file actions
99 lines (86 loc) · 2.38 KB
/
chat.proto
File metadata and controls
99 lines (86 loc) · 2.38 KB
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
syntax = "proto3";
package chat;
import "tin.proto";
enum Urgency {
URGENCY_NORMAL = 0;
URGENCY_URGENT = 1;
URGENCY_RELAXED = 2;
};
message IdentRequest {
string nick = 1 [
(tin.field_validation) = "required |> trimString |> nonEmptyString |> maxStrLen(8)"
];
}
message IdentReply {
string error = 1;
}
message SendMessageRequest {
string channel = 1 [
(tin.field_validation) = "required |> trimString |> minStrLen(3) |> maxStrLen(16)"
];
string text = 2 [
(tin.field_validation) = "required |> trimString |> nonEmptyString |> maxStrLen(70)"
];
Urgency urgency = 3 [
(tin.field_validation) = "required"
];
option (tin.message_validation) = "x|.channelGet|.Belt.Option.getExn != \"#nope\" ? okSome(x) : transFieldError(\"can't send to channel #nope\")";
}
message SendPasswordedMessageRequest {
string password = 1 [
(tin.field_validation) = "required"
];
SendMessageRequest sendMessageRequest = 2 [
(tin.field_validation) = "required"
];
}
message SendMessageReply {
string error = 1;
}
message PollRequest {
repeated string channels = 1 [
(tin.field_validation) = "minItemCount(1) |> maxItemCount(16) |> repeated(x => x |> minStrLen(3) |> maxStrLen(16))"
];
fixed32 time = 2 [
(tin.field_validation) = "required |> positive"
];
}
message ChannelMessage {
string channel = 1;
string nick = 2;
string text = 3;
Urgency urgency = 4 [
(tin.field_validation) = "required"
];
};
message ChannelMessages {
repeated ChannelMessage channel_messages = 1;
};
message PollReply {
oneof result {
ChannelMessages channel_messages = 1;
string error = 2;
}
}
message Some64BitValues {
fixed64 fix64 = 1;
sfixed64 sfix64 = 2;
int64 varint64 = 3;
sint64 svarint64 = 4;
uint64 uvarint64 = 5;
};
message PasswordResetRequest {
string password = 1 [
(tin.field_validation) = "required |> minStrLen(10)"
];
string passwordConfirm = 2 [
(tin.field_validation) = "required |> minStrLen(10)"
];
option (tin.message_validation) = "passwordGet(x) == passwordConfirmGet(x) ? okSome(x) : transFieldError(\"passwords don't match\")";
}
service ChatService {
rpc SendMessage (SendMessageRequest) returns (SendMessageReply) {}
rpc SendPasswordedMessage (SendPasswordedMessageRequest) returns (SendMessageReply) {}
rpc Poll (PollRequest) returns (PollReply) {}
rpc Echo64 (Some64BitValues) returns (Some64BitValues) {}
}