1
0
tinklu-paslaugos/Lab4/ChatRoomContract/Protos/service.proto
2024-12-07 17:21:09 +02:00

61 lines
1.2 KiB
Protocol Buffer

//set the language version
syntax = "proto3";
//this will translate into C# namespace
package ChatRoomContract.Protocol;
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
service ChatRoom {
rpc RegisterClient(RegisterClientRequest) returns (ClientId);
rpc GetStrikes(ClientId) returns (Srikes);
rpc GetBlockedUntil(ClientId) returns (BlockedUntil);
rpc SendMessage(UserMessageRequest) returns (BoolResponse);
rpc GetNewMessage(google.protobuf.Empty) returns (NewUserMessage);
rpc RejectMessage(MessageId) returns (google.protobuf.Empty);
rpc ApproveMessage(MessageId) returns (google.protobuf.Empty);
}
message BoolResponse {
bool success = 1;
}
message RegisterClientRequest {
string name = 1;
}
message Srikes {
int32 strikes = 1;
}
message ClientId {
int32 id = 1;
}
message MessageId {
int32 id = 1;
}
message BlockedUntil {
bool hasTimestamp = 1;
google.protobuf.Timestamp timestamp = 2;
}
message UserMessageRequest {
int32 clientId = 1;
string contents = 2;
bool needsToBeCensored = 3;
}
message UserMessage {
int32 id = 1;
string contents = 2;
bool needsToBeCensored = 3;
}
message NewUserMessage {
bool hasMessage = 1;
UserMessage message = 2;
}