289 lines
7.1 KiB
Protocol Buffer
289 lines
7.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package stalker;
|
|
|
|
option go_package = "stalker-service/proto/stalker";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
import "google/protobuf/empty.proto";
|
|
|
|
// StalkerService provides FaceIT match tracking and player management
|
|
service StalkerService {
|
|
// Player management
|
|
rpc SearchPlayer(SearchPlayerRequest) returns (Player);
|
|
rpc GetPlayerByID(GetPlayerByIDRequest) returns (Player);
|
|
|
|
// Match management
|
|
rpc GetPlayerMatches(GetPlayerMatchesRequest) returns (GetPlayerMatchesResponse);
|
|
rpc GetMatchDetails(GetMatchDetailsRequest) returns (MatchDetails);
|
|
|
|
// Database operations
|
|
rpc SaveMatches(SaveMatchesRequest) returns (google.protobuf.Empty);
|
|
rpc GetUserMatches(GetUserMatchesRequest) returns (GetUserMatchesResponse);
|
|
rpc GetUserMatchStats(GetUserMatchStatsRequest) returns (UserMatchStats);
|
|
rpc GetMatchesSince(GetMatchesSinceRequest) returns (GetUserMatchesResponse);
|
|
rpc GetMatchesLastNDays(GetMatchesLastNDaysRequest) returns (GetUserMatchesResponse);
|
|
|
|
// Account linking
|
|
rpc LinkFaceITAccount(LinkFaceITAccountRequest) returns (LinkedAccount);
|
|
rpc GetLinkedFaceITAccount(GetLinkedFaceITAccountRequest) returns (LinkedAccount);
|
|
rpc LinkSteamAccount(LinkSteamAccountRequest) returns (LinkedAccount);
|
|
rpc GetLinkedSteamAccount(GetLinkedSteamAccountRequest) returns (LinkedAccount);
|
|
|
|
// Steam session tracking
|
|
rpc GetSteamSessions(GetSteamSessionsRequest) returns (GetSteamSessionsResponse);
|
|
rpc GetSteamGameSessions(GetSteamGameSessionsRequest) returns (GetSteamGameSessionsResponse);
|
|
rpc GetSteamStats(GetSteamStatsRequest) returns (SteamStats);
|
|
}
|
|
|
|
// Player represents a FaceIT player
|
|
message Player {
|
|
string player_id = 1;
|
|
string nickname = 2;
|
|
string avatar = 3;
|
|
string country = 4;
|
|
string faceit_url = 5;
|
|
}
|
|
|
|
// MatchStats represents individual player statistics in a match
|
|
message MatchStats {
|
|
int32 kills = 1;
|
|
int32 deaths = 2;
|
|
int32 assists = 3;
|
|
int32 skill_level = 4;
|
|
int32 elo = 5;
|
|
int32 headshots = 6;
|
|
int32 headshots_pct = 7;
|
|
}
|
|
|
|
// TeamPlayer represents a player in a team
|
|
message TeamPlayer {
|
|
string player_id = 1;
|
|
string nickname = 2;
|
|
string avatar = 3;
|
|
int32 skill_level = 4;
|
|
string game_player_id = 5;
|
|
string game_player_name = 6;
|
|
string faceit_url = 7;
|
|
MatchStats stats = 8;
|
|
}
|
|
|
|
// Team represents a team in a match
|
|
message Team {
|
|
string team_id = 1;
|
|
string nickname = 2;
|
|
string avatar = 3;
|
|
string type = 4;
|
|
repeated TeamPlayer players = 5;
|
|
}
|
|
|
|
// MatchResult represents a single match result
|
|
message MatchResult {
|
|
string match_id = 1;
|
|
string game_id = 2;
|
|
string region = 3;
|
|
string match_type = 4;
|
|
string game_mode = 5;
|
|
int32 max_players = 6;
|
|
int32 teams_size = 7;
|
|
map<string, Team> teams = 8;
|
|
repeated string playing_players = 9;
|
|
string competition_id = 10;
|
|
string competition_name = 11;
|
|
string competition_type = 12;
|
|
string organizer_id = 13;
|
|
string status = 14;
|
|
int64 started_at = 15;
|
|
int64 finished_at = 16;
|
|
MatchResults results = 17;
|
|
string faceit_url = 18;
|
|
|
|
// Player-specific data
|
|
MatchStats player_stats = 19;
|
|
string player_faction = 20;
|
|
}
|
|
|
|
// MatchResults represents match results
|
|
message MatchResults {
|
|
string winner = 1;
|
|
map<string, int32> score = 2;
|
|
}
|
|
|
|
// MatchDetails represents detailed match information
|
|
message MatchDetails {
|
|
string match_id = 1;
|
|
string game_id = 2;
|
|
map<string, Team> teams = 3;
|
|
repeated string playing_players = 4;
|
|
MatchResults results = 5;
|
|
string status = 6;
|
|
int64 started_at = 7;
|
|
int64 finished_at = 8;
|
|
}
|
|
|
|
// FaceITMatch represents a match stored in the database
|
|
message FaceITMatch {
|
|
int64 id = 1;
|
|
int64 global_user_id = 2;
|
|
string faceit_player_id = 3;
|
|
string match_id = 4;
|
|
string game = 5;
|
|
string status = 6;
|
|
string result = 7;
|
|
int32 skill_level = 8;
|
|
google.protobuf.Timestamp match_start_time = 9;
|
|
google.protobuf.Timestamp match_end_time = 10;
|
|
google.protobuf.Timestamp synced_at = 11;
|
|
google.protobuf.Timestamp updated_at = 12;
|
|
}
|
|
|
|
// LinkedAccount represents a linked FaceIT account
|
|
message LinkedAccount {
|
|
int64 id = 1;
|
|
int64 global_user_id = 2;
|
|
string platform = 3;
|
|
string account_id = 4;
|
|
string account_username = 5;
|
|
string account_url = 6;
|
|
google.protobuf.Timestamp linked_at = 7;
|
|
google.protobuf.Timestamp updated_at = 8;
|
|
}
|
|
|
|
// UserMatchStats represents aggregated user statistics
|
|
message UserMatchStats {
|
|
int32 total_matches = 1;
|
|
int32 wins = 2;
|
|
int32 losses = 3;
|
|
float avg_kills = 4;
|
|
float avg_deaths = 5;
|
|
float avg_assists = 6;
|
|
float win_rate = 7;
|
|
}
|
|
|
|
// Request/Response messages
|
|
message SearchPlayerRequest {
|
|
string nickname = 1;
|
|
}
|
|
|
|
message GetPlayerByIDRequest {
|
|
string player_id = 1;
|
|
}
|
|
|
|
message GetPlayerMatchesRequest {
|
|
string player_id = 1;
|
|
int32 limit = 2;
|
|
}
|
|
|
|
message GetPlayerMatchesResponse {
|
|
repeated MatchResult matches = 1;
|
|
}
|
|
|
|
message GetMatchDetailsRequest {
|
|
string match_id = 1;
|
|
}
|
|
|
|
message SaveMatchesRequest {
|
|
repeated FaceITMatch matches = 1;
|
|
}
|
|
|
|
message GetUserMatchesRequest {
|
|
int64 global_user_id = 1;
|
|
int32 limit = 2;
|
|
}
|
|
|
|
message GetUserMatchesResponse {
|
|
repeated FaceITMatch matches = 1;
|
|
}
|
|
|
|
message GetUserMatchStatsRequest {
|
|
int64 global_user_id = 1;
|
|
}
|
|
|
|
message GetMatchesSinceRequest {
|
|
int64 global_user_id = 1;
|
|
google.protobuf.Timestamp since = 2;
|
|
}
|
|
|
|
message GetMatchesLastNDaysRequest {
|
|
int64 global_user_id = 1;
|
|
int32 days = 2;
|
|
}
|
|
|
|
message LinkFaceITAccountRequest {
|
|
int64 global_user_id = 1;
|
|
string account_id = 2;
|
|
string account_username = 3;
|
|
string account_url = 4;
|
|
}
|
|
|
|
message GetLinkedFaceITAccountRequest {
|
|
int64 global_user_id = 1;
|
|
}
|
|
|
|
message LinkSteamAccountRequest {
|
|
int64 global_user_id = 1;
|
|
string steam_id = 2;
|
|
string username = 3;
|
|
string profile_url = 4;
|
|
}
|
|
|
|
message GetLinkedSteamAccountRequest {
|
|
int64 global_user_id = 1;
|
|
}
|
|
|
|
// SteamOnlineSession represents a period when a user was online on Steam
|
|
message SteamOnlineSession {
|
|
int64 id = 1;
|
|
int64 global_user_id = 2;
|
|
string steam_id = 3;
|
|
google.protobuf.Timestamp started_at = 4;
|
|
google.protobuf.Timestamp ended_at = 5;
|
|
}
|
|
|
|
// SteamGameSession represents a period when a user was playing a specific game
|
|
message SteamGameSession {
|
|
int64 id = 1;
|
|
int64 global_user_id = 2;
|
|
string steam_id = 3;
|
|
int64 online_session_id = 4;
|
|
string game_id = 5;
|
|
string game_name = 6;
|
|
google.protobuf.Timestamp started_at = 7;
|
|
google.protobuf.Timestamp ended_at = 8;
|
|
}
|
|
|
|
// SteamStats represents aggregated Steam activity statistics
|
|
message SteamStats {
|
|
int64 total_online_sessions = 1;
|
|
int64 total_online_minutes = 2;
|
|
int64 total_game_sessions = 3;
|
|
int64 total_game_minutes = 4;
|
|
string favorite_game_id = 5;
|
|
string favorite_game_name = 6;
|
|
int64 favorite_game_minutes = 7;
|
|
}
|
|
|
|
message GetSteamSessionsRequest {
|
|
int64 global_user_id = 1;
|
|
google.protobuf.Timestamp from = 2;
|
|
google.protobuf.Timestamp to = 3;
|
|
}
|
|
|
|
message GetSteamSessionsResponse {
|
|
repeated SteamOnlineSession sessions = 1;
|
|
}
|
|
|
|
message GetSteamGameSessionsRequest {
|
|
int64 global_user_id = 1;
|
|
google.protobuf.Timestamp from = 2;
|
|
google.protobuf.Timestamp to = 3;
|
|
}
|
|
|
|
message GetSteamGameSessionsResponse {
|
|
repeated SteamGameSession sessions = 1;
|
|
}
|
|
|
|
message GetSteamStatsRequest {
|
|
int64 global_user_id = 1;
|
|
}
|