Files
evening_detective_server/api/main.proto
T
2026-07-06 23:38:21 +07:00

239 lines
4.6 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
syntax = "proto3";
package crabs.evening_detective_server;
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "pkg/proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title : "Документация сервиса \"Вечерний детектив\"";
version: "v0.1.0";
};
security_definitions: {
security: {
key : "BearerAuth";
value: {
type : TYPE_API_KEY;
in : IN_HEADER;
name : "Authorization";
description: "Authentication token, prefixed by Bearer: Bearer <token>";
}
}
}
security: {
security_requirement: {
key : "BearerAuth";
value: {};
}
}
};
service EveningDetectiveServer {
rpc Ping(PingReq) returns (PingRsp) {
option (google.api.http) = {
get: "/api/test/ping"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc Echo(EchoReq) returns (EchoRsp) {
option (google.api.http) = {
post: "/api/test/echo"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc Signup(SignupReq) returns (SignupRsp) {
option (google.api.http) = {
post: "/api/auth/signup"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc RefreshPassword(RefreshPasswordReq) returns (RefreshPasswordRsp) {
option (google.api.http) = {
post: "/api/auth/refresh-password"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc Login(LoginReq) returns (LoginRsp) {
option (google.api.http) = {
post: "/api/auth/login"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc Refresh(RefreshReq) returns (RefreshRsp) {
option (google.api.http) = {
post: "/api/auth/refresh"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc GetUsers(GetUsersReq) returns (GetUsersRsp) {
option (google.api.http) = {
get: "/api/users"
};
}
rpc GetUserById(GetUserByIdReq) returns (GetUserByIdRsp) {
option (google.api.http) = {
get: "/api/users/{id}"
};
}
rpc GetMe(GetMeReq) returns (GetMeRsp) {
option (google.api.http) = {
get: "/api/users/me"
};
}
rpc AddUserRole(AddUserRoleReq) returns (AddUserRoleRsp) {
option (google.api.http) = {
post: "/api/users/{id}/role/add"
body: "*"
};
}
rpc DeleteUserRole(DeleteUserRoleReq) returns (DeleteUserRoleRsp) {
option (google.api.http) = {
post: "/api/users/{id}/role/delete"
body : "*"
};
}
}
message PingReq {}
message PingRsp {}
message EchoReq {
string text = 1;
}
message EchoRsp {
string text = 1;
}
message SignupReq {
string username = 1;
string email = 2;
}
message SignupRsp {
string error = 1;
}
message RefreshPasswordReq {
string email = 1;
}
message RefreshPasswordRsp {
string error = 1;
}
message LoginReq {
string email = 1;
string password = 2;
}
message LoginRsp {
string error = 1;
string accessToken = 2;
string refreshToken = 3;
}
message RefreshReq {
string refreshToken = 1;
}
message RefreshRsp {
string error = 1;
string accessToken = 2;
string refreshToken = 3;
}
message GetUsersReq {}
message GetUsersRsp {
string error = 1;
repeated User users = 2;
}
message User {
int32 id = 1;
string username = 2;
string email = 3;
repeated string roles = 4;
bool is_active = 5;
google.protobuf.Timestamp created_at = 6;
}
message GetUserByIdReq {
int32 id = 1;
}
message GetUserByIdRsp {
string error = 1;
User user = 2;
}
message GetMeReq {}
message GetMeRsp {
string error = 1;
User user = 2;
}
message AddUserRoleReq {
int32 id = 1;
string role = 2;
}
message AddUserRoleRsp {
string error = 1;
}
message DeleteUserRoleReq {
int32 id = 1;
string role = 2;
}
message DeleteUserRoleRsp {
string error = 1;
}