314 lines
12 KiB
Plaintext
314 lines
12 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "Server Statistics API"
|
|
desc: "Server Statistics API"
|
|
author: "cialloo"
|
|
date: "2025-10-04"
|
|
version: "v1"
|
|
)
|
|
|
|
type (
|
|
PingReq {}
|
|
PingResp {
|
|
ok bool `json:"ok"`
|
|
}
|
|
)
|
|
|
|
type (
|
|
TotalPlayerJoinReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
}
|
|
TotalPlayerJoinResp {
|
|
Count int64 `json:"count"`
|
|
}
|
|
)
|
|
|
|
type (
|
|
TotalPlayerCountReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
}
|
|
TotalPlayerCountResp {
|
|
Count int64 `json:"count"`
|
|
}
|
|
)
|
|
|
|
type (
|
|
TotalPlayTimeReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
}
|
|
TotalPlayTimeResp {
|
|
TotalPlayTime int64 `json:"totalPlayTime"` // Total playtime in seconds
|
|
}
|
|
)
|
|
|
|
type (
|
|
TotalKillCountReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
HeadshotOnly bool `json:"headshotOnly"` // If true, count only headshot kills
|
|
WeaponFilter []string `json:"weaponFilter"` // List of weapon names to filter by (optional)
|
|
PlayerFilter []string `json:"playerFilter"` // List of player SteamID64s to filter by (optional)
|
|
}
|
|
TotalKillCountResp {
|
|
TotalKillCount int64 `json:"totalKillCount"` // Total kill count
|
|
}
|
|
)
|
|
|
|
type (
|
|
TotalConnectCountReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
}
|
|
TotalConnectCountResp {
|
|
TotalConnectCount int64 `json:"totalConnectCount"` // Total connect count
|
|
}
|
|
)
|
|
|
|
type (
|
|
TotalDamageCountReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
WeaponFilter []string `json:"weaponFilter"` // List of weapon names to filter by (optional)
|
|
PlayerFilter []string `json:"playerFilter"` // List of player SteamID64s to filter by (optional)
|
|
}
|
|
TotalDamageCountResp {
|
|
TotalDamageCount int64 `json:"totalDamageCount"` // Total damage count
|
|
}
|
|
)
|
|
|
|
type (
|
|
TotalChatMessageCountReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
PlayerFilter []string `json:"playerFilter"` // List of player SteamID64s to filter by (optional)
|
|
}
|
|
TotalChatMessageCountResp {
|
|
TotalChatMessageCount int64 `json:"totalChatMessageCount"` // Total chat message count
|
|
}
|
|
)
|
|
|
|
type (
|
|
RecentJoinPlayerReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
Limit int `json:"limit,range=[1:10],example=10,default=10"` // Maximum number of players to return
|
|
}
|
|
RecentJoinPlayerResp {
|
|
Players []RecentJoinPlayerRespPlayer `json:"players"` // List of player SteamID64s who joined in the time range
|
|
}
|
|
RecentJoinPlayerRespPlayer {
|
|
SteamID64 string `json:"steamID64"` // Player's SteamID64
|
|
JoinTime int64 `json:"joinTime"` // Join time as Unix timestamp in milliseconds
|
|
UserName string `json:"userName"` // Player's username at the time of joining
|
|
PlayTime int64 `json:"playTime"` // Playtime in seconds since joining
|
|
}
|
|
)
|
|
|
|
type (
|
|
RecentChatMessageReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
Limit int `json:"limit,range=[1:10],example=10,default=10"` // Maximum number of messages to return
|
|
}
|
|
RecentChatMessageResp {
|
|
Messages []RecentChatMessageRespMessage `json:"messages"` // List of recent chat messages
|
|
}
|
|
RecentChatMessageRespMessage {
|
|
SteamID64 string `json:"steamID64"` // Player's SteamID64
|
|
UserName string `json:"userName"` // Player's username at the time of message
|
|
Message string `json:"message"` // Chat message content
|
|
TimeStamp int64 `json:"timeStamp"` // Message timestamp as Unix timestamp in milliseconds
|
|
ServerName string `json:"serverName"` // Server name where the message was sent
|
|
MapName string `json:"mapName"` // Map name where the message was sent
|
|
ServerIP string `json:"serverIP"` // Server IP where the message was sent
|
|
ServerPort int `json:"serverPort"` // Server port where the message was sent
|
|
}
|
|
)
|
|
|
|
type (
|
|
RecentPlayReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
LeastPlayTime int64 `json:"leastPlayTime"` // Least playtime in seconds to filter by
|
|
Limit int `json:"limit,range=[1:10],example=10,default=10"` // Maximum number of players to return
|
|
}
|
|
RecentPlayResp {
|
|
Players []RecentPlayRespPlayer `json:"players"` // List of players who played in the time range
|
|
}
|
|
RecentPlayRespPlayer {
|
|
SteamID64 string `json:"steamID64"` // Player's SteamID64
|
|
UserName string `json:"userName"` // Player's username at the time of playing
|
|
MapName string `json:"mapName"` // Map name where the player played
|
|
PlayTime int64 `json:"playTime"` // Playtime in seconds during the time range
|
|
}
|
|
)
|
|
|
|
type (
|
|
TopPlayTimeReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
Limit int `json:"limit,range=[1:10],example=10,default=10"` // Maximum number of players to return
|
|
}
|
|
TopPlayTimeResp {
|
|
Players []TopPlayTimeRespPlayer `json:"players"` // List of top players by playtime
|
|
}
|
|
TopPlayTimeRespPlayer {
|
|
SteamID64 string `json:"steamID64"` // Player's SteamID64
|
|
UserName string `json:"userName"` // Player's username at the time of playing
|
|
PlayTime int64 `json:"playTime"` // Playtime in seconds during the time range
|
|
}
|
|
)
|
|
|
|
type (
|
|
TopKillerReq {
|
|
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
|
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
|
Limit int `json:"limit,range=[1:10],example=10,default=10"` // Maximum number of players to return
|
|
}
|
|
TopKillerResp {
|
|
Players []TopKillerRespPlayer `json:"players"` // List of top players by kill count
|
|
}
|
|
TopKillerRespPlayer {
|
|
SteamID64 string `json:"steamID64"` // Player's SteamID64
|
|
UserName string `json:"userName"` // Player's username at the time of playing
|
|
KillCount int64 `json:"killCount"` // Kill count during the time range
|
|
}
|
|
)
|
|
|
|
type (
|
|
A2SQueryReqServer {
|
|
ServerIP string `json:"serverIP"` // Server IP address
|
|
ServerPort int `json:"serverPort"` // Server port
|
|
Timeout int `json:"timeout,example=3000,default=3000"` // Timeout in milliseconds (default: 3000ms)
|
|
}
|
|
A2SQueryReq {
|
|
Servers []A2SQueryReqServer `json:"servers"` // List of servers to query
|
|
}
|
|
A2SQueryRespServer {
|
|
ServerName string `json:"serverName"` // Server name
|
|
MapName string `json:"mapName"` // Current map name
|
|
GameDirectory string `json:"gameDirectory"` // Game directory
|
|
GameDescription string `json:"gameDescription"` // Game description
|
|
AppID int `json:"appID"` // Steam App ID
|
|
PlayerCount int `json:"playerCount"` // Current player count
|
|
MaxPlayers int `json:"maxPlayers"` // Maximum player count
|
|
BotCount int `json:"botCount"` // Bot count
|
|
ServerType string `json:"serverType"` // Server type (e.g., "d" for dedicated)
|
|
Environment string `json:"environment"` // Environment (e.g., "w" for Windows, "l" for Linux)
|
|
Visibility int `json:"visibility"` // Visibility (0 for public, 1 for private)
|
|
VAC int `json:"vac"` // VAC status (0 for unsecured, 1 for secured)
|
|
Version string `json:"version"` // Server version
|
|
}
|
|
A2SQueryResp {
|
|
Results []A2SQueryRespServer `json:"results"` // List of query results for each server
|
|
}
|
|
)
|
|
|
|
@server (
|
|
prefix: /api/server/statistics
|
|
)
|
|
service ServerStatistics {
|
|
@doc (
|
|
summary: "Ping the server to check if it's alive"
|
|
description: "Ping the server to check if it's alive"
|
|
)
|
|
@handler pingHandler
|
|
get /ping (PingReq) returns (PingResp)
|
|
|
|
@doc (
|
|
summary: "Get recent player joins within a specified time range"
|
|
description: "Get recent player joins within a specified time range"
|
|
)
|
|
@handler recentPlayerJoinHandler
|
|
post /recent-player-join (TotalPlayerJoinReq) returns (TotalPlayerJoinResp)
|
|
|
|
@doc (
|
|
summary: "Get total player count within a specified time range"
|
|
description: "Get total Total count within a specified time range"
|
|
)
|
|
@handler totalPlayerCountHandler
|
|
post /total-player-count (TotalPlayerCountReq) returns (TotalPlayerCountResp)
|
|
|
|
@doc (
|
|
summary: "Get total kill count within a specified time range"
|
|
description: "Get total kill count within a specified time range"
|
|
)
|
|
@handler totalKillCountHandler
|
|
post /total-kill-count (TotalKillCountReq) returns (TotalKillCountResp)
|
|
|
|
@doc (
|
|
summary: "Get total playtime within a specified time range"
|
|
description: "Get total playtime within a specified time range"
|
|
)
|
|
@handler totalPlayTimeHandler
|
|
post /total-play-time (TotalPlayTimeReq) returns (TotalPlayTimeResp)
|
|
|
|
@doc (
|
|
summary: "Get total connect count within a specified time range"
|
|
description: "Get total connect count within a specified time range"
|
|
)
|
|
@handler totalConnectCountHandler
|
|
post /total-connect-count (TotalConnectCountReq) returns (TotalConnectCountResp)
|
|
|
|
@doc (
|
|
summary: "Get total damage count within a specified time range"
|
|
description: "Get total damage count within a specified time range"
|
|
)
|
|
@handler totalDamageCountHandler
|
|
post /total-damage-count (TotalDamageCountReq) returns (TotalDamageCountResp)
|
|
|
|
@doc (
|
|
summary: "Get total chat message count within a specified time range"
|
|
description: "Get total chat message count within a specified time range"
|
|
)
|
|
@handler totalChatMessageCountHandler
|
|
post /total-chat-message-count (TotalChatMessageCountReq) returns (TotalChatMessageCountResp)
|
|
|
|
@doc (
|
|
summary: "Get recent players who joined within a specified time range"
|
|
description: "Get recent players who joined within a specified time range"
|
|
)
|
|
@handler recentJoinPlayerHandler
|
|
post /recent-join-player (RecentJoinPlayerReq) returns (RecentJoinPlayerResp)
|
|
|
|
@doc (
|
|
summary: "Get recent chat messages within a specified time range"
|
|
description: "Get recent chat messages within a specified time range"
|
|
)
|
|
@handler recentChatMessageHandler
|
|
post /recent-chat-message (RecentChatMessageReq) returns (RecentChatMessageResp)
|
|
|
|
@doc (
|
|
summary: "Get recent players who played within a specified time range"
|
|
description: "Get recent players who played within a specified time range"
|
|
)
|
|
@handler recentPlayHandler
|
|
post /recent-play (RecentPlayReq) returns (RecentPlayResp)
|
|
|
|
@doc (
|
|
summary: "Get top players by playtime within a specified time range"
|
|
description: "Get top players by playtime within a specified time range"
|
|
)
|
|
@handler topPlayTimeHandler
|
|
post /top-play-time (TopPlayTimeReq) returns (TopPlayTimeResp)
|
|
|
|
@doc (
|
|
summary: "Get top players by kill count within a specified time range"
|
|
description: "Get top players by kill count within a specified time range"
|
|
)
|
|
@handler topKillerHandler
|
|
post /top-killer (TopKillerReq) returns (TopKillerResp)
|
|
|
|
@doc (
|
|
summary: "Perform an A2S query to get real-time server information"
|
|
description: "Perform an A2S query to get real-time server information"
|
|
)
|
|
@handler a2sQueryHandler
|
|
post /a2s-query (A2SQueryReq) returns (A2SQueryResp)
|
|
}
|
|
|