75 lines
1.4 KiB
Protocol Buffer
75 lines
1.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
package auth;
|
|
|
|
option go_package = "pkg/api/auth";
|
|
|
|
service AuthService {
|
|
rpc SignUp(SignUpRequest) returns (SignUpResponse);
|
|
rpc SignIn(SignInRequest) returns (SignInResponse);
|
|
rpc GetMe(GetMeRequest) returns (GetMeResponse);
|
|
rpc GetUser(GetUserRequest) returns (GetUserResponse);
|
|
rpc GetMyStat(GetMyStatRequest) returns (GetMyStatResponse);
|
|
rpc GetLeaderboard(GetLeaderboardRequest) returns (GetLeaderboardResponse);
|
|
}
|
|
|
|
message SignUpRequest {
|
|
string email = 1;
|
|
string username = 2;
|
|
string password = 3;
|
|
}
|
|
message SignUpResponse {
|
|
string token = 1;
|
|
}
|
|
|
|
message SignInRequest {
|
|
string email = 1;
|
|
string password = 2;
|
|
}
|
|
message SignInResponse {
|
|
string token = 1;
|
|
}
|
|
|
|
message GetMeRequest {}
|
|
message GetMeResponse {
|
|
User user = 1;
|
|
}
|
|
|
|
message GetUserRequest {
|
|
string user_id = 1;
|
|
}
|
|
message GetUserResponse {
|
|
User user = 1;
|
|
}
|
|
|
|
message GetMyStatRequest {}
|
|
message GetMyStatResponse {
|
|
Stat stat = 1;
|
|
}
|
|
|
|
message GetLeaderboardRequest {}
|
|
message GetLeaderboardResponse {
|
|
repeated User users = 1;
|
|
}
|
|
|
|
message User {
|
|
optional string id = 1;
|
|
string email = 2;
|
|
string username = 3;
|
|
optional string avatar = 4;
|
|
string created_at = 5;
|
|
repeated UserAchievement achievements = 6;
|
|
}
|
|
|
|
message UserAchievement {
|
|
string name = 1;
|
|
string description = 2;
|
|
string icon = 3;
|
|
string received_at = 4;
|
|
}
|
|
|
|
message Stat {
|
|
int32 total_attempts = 1;
|
|
int32 solved_tasks = 2;
|
|
}
|
|
|