syntax = "proto3"; package user.v1; option go_package = "/user/v1;userv1"; import "google/protobuf/timestamp.proto"; import "google/protobuf/empty.proto"; import "google/api/annotations.proto"; 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}" }; } } enum Role { ROLE_PARTICIPANT_UNSPECIFIED = 0; ROLE_MODERATOR = 1; ROLE_ADMIN = 2; } 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; } message LoginRequest { string username = 1; string password = 2; } message CreateUserRequest { string username = 1; string password = 2; } message CreateUserResponse { int32 id = 1; } message GetUserRequest { int32 id = 1; } message GetUserResponse { User user = 1; } message UpdateUserRequest { int32 id = 1; string username = 2; reserved 3; Role role = 4; } message DeleteUserRequest { int32 id = 1; }