103 lines
2.2 KiB
Protocol Buffer
103 lines
2.2 KiB
Protocol Buffer
|
syntax = "proto3";
|
||
|
|
||
|
package proto.user.v1;
|
||
|
|
||
|
import "google/protobuf/timestamp.proto";
|
||
|
import "google/protobuf/empty.proto";
|
||
|
|
||
|
service UserService {
|
||
|
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
|
||
|
rpc ReadUser (ReadUserRequest) returns (ReadUserResponse);
|
||
|
rpc UpdateUser (UpdateUserRequest) returns (google.protobuf.Empty);
|
||
|
rpc DeleteUser (DeleteUserRequest) returns (google.protobuf.Empty);
|
||
|
|
||
|
rpc ConfirmEmail (ConfirmEmailRequest) returns (google.protobuf.Empty);
|
||
|
|
||
|
rpc RegisterUser (RegisterUserRequest) returns (google.protobuf.Empty);
|
||
|
rpc ConfirmRegisterUser (ConfirmRegisterUserRequest) returns (google.protobuf.Empty);
|
||
|
|
||
|
rpc ResetPassword (ResetPasswordRequest) returns (google.protobuf.Empty);
|
||
|
rpc ConfirmResetPassword (ConfirmResetPasswordRequest) returns (google.protobuf.Empty);
|
||
|
}
|
||
|
|
||
|
enum Role {
|
||
|
ROLE_SPECTATOR_UNSPECIFIED = 0;
|
||
|
ROLE_PARTICIPANT = 1;
|
||
|
ROLE_MODERATOR = 2;
|
||
|
ROLE_ADMIN = 3;
|
||
|
}
|
||
|
|
||
|
message CreateUserRequest {
|
||
|
message User {
|
||
|
string username = 1;
|
||
|
string password = 2;
|
||
|
optional string email = 3;
|
||
|
optional google.protobuf.Timestamp expires_at = 4;
|
||
|
optional Role role = 5;
|
||
|
}
|
||
|
|
||
|
string token = 1;
|
||
|
User user = 2;
|
||
|
}
|
||
|
message CreateUserResponse {
|
||
|
int32 id = 1;
|
||
|
}
|
||
|
|
||
|
message ReadUserRequest {
|
||
|
string token = 1;
|
||
|
int32 id = 2;
|
||
|
}
|
||
|
message ReadUserResponse {
|
||
|
message User {
|
||
|
int32 id = 1;
|
||
|
string username = 2;
|
||
|
optional string email = 3;
|
||
|
string password = 4;
|
||
|
google.protobuf.Timestamp expires_at = 5;
|
||
|
google.protobuf.Timestamp created_at = 6;
|
||
|
Role role = 7;
|
||
|
}
|
||
|
User user = 1;
|
||
|
}
|
||
|
|
||
|
message UpdateUserRequest {
|
||
|
message User {
|
||
|
int32 id = 1;
|
||
|
optional string username = 2;
|
||
|
optional string email = 3;
|
||
|
optional string password = 4;
|
||
|
optional google.protobuf.Timestamp expires_at = 5;
|
||
|
optional Role role = 6;
|
||
|
}
|
||
|
|
||
|
string token = 1;
|
||
|
User user = 2;
|
||
|
}
|
||
|
|
||
|
message DeleteUserRequest {
|
||
|
string token = 1;
|
||
|
int32 id = 2;
|
||
|
}
|
||
|
|
||
|
message ConfirmEmailRequest {
|
||
|
string conf_token = 1;
|
||
|
}
|
||
|
|
||
|
message RegisterUserRequest {
|
||
|
string email = 1;
|
||
|
}
|
||
|
|
||
|
message ConfirmRegisterUserRequest {
|
||
|
string conf_token = 1;
|
||
|
string username = 2;
|
||
|
string password = 3;
|
||
|
}
|
||
|
|
||
|
message ResetPasswordRequest {
|
||
|
string email = 1;
|
||
|
}
|
||
|
|
||
|
message ConfirmResetPasswordRequest {
|
||
|
string conf_token = 1;
|
||
|
string password = 2;
|
||
|
}
|