contracts/user/v1/user.proto

118 lines
2.2 KiB
Protocol Buffer
Raw Normal View History

2024-08-16 10:54:17 +00:00
syntax = "proto3";
2024-08-16 12:58:13 +00:00
package user.v1;
option go_package = "/user/v1;userv1";
2024-08-16 10:54:17 +00:00
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "google/api/annotations.proto";
2024-08-16 10:54:17 +00:00
service UserService {
rpc Login(LoginRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/session/login"
body: "*"
};
}
rpc Logout(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/session/logout"
body: "*"
};
}
rpc Refresh(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/session/refresh"
body: "*"
};
}
rpc Verify(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {
get: "/session/verify"
};
}
rpc CompleteLogout(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {
post : "/session/complete-logout"
};
}
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) {
option (google.api.http) = {
post: "/users"
body: "*"
};
}
rpc GetUser(GetUserRequest) returns (GetUserResponse) {
option (google.api.http) = {
get: "/users/{id}"
};
}
rpc UpdateUser(UpdateUserRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
patch: "/users/{id}"
body: "*"
};
}
rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/users/{id}"
};
}
2024-08-16 10:54:17 +00:00
}
enum Role {
ROLE_PARTICIPANT_UNSPECIFIED = 0;
ROLE_MODERATOR = 1;
ROLE_ADMIN = 2;
2024-08-16 10:54:17 +00:00
}
message User {
int32 id = 1;
string username = 2;
reserved 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp modified_at = 5;
Role role = 6;
}
2024-08-16 10:54:17 +00:00
message LoginRequest {
string username = 1;
string password = 2;
}
message CreateUserRequest {
string username = 1;
string password = 2;
2024-08-16 10:54:17 +00:00
}
2024-08-16 10:54:17 +00:00
message CreateUserResponse {
int32 id = 1;
}
message GetUserRequest {
2024-10-09 17:11:40 +00:00
int32 id = 1;
2024-08-16 10:54:17 +00:00
}
message GetUserResponse {
2024-08-16 10:54:17 +00:00
User user = 1;
}
message UpdateUserRequest {
int32 id = 1;
string username = 2;
reserved 3;
Role role = 4;
2024-08-16 10:54:17 +00:00
}
message DeleteUserRequest {
2024-10-09 17:11:40 +00:00
int32 id = 1;
}