49 lines
1.3 KiB
Protocol Buffer
49 lines
1.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package scoreboard.v1;
|
|
|
|
option go_package = "git.mkz.me/mycroft/root-me-api/gen/scoreboard/v1;scoreboardv1";
|
|
|
|
// ScoreboardService serves the cached root-me.org scoreboard.
|
|
service ScoreboardService {
|
|
// ListScoreboard returns a page of entries ordered by rank.
|
|
rpc ListScoreboard(ListScoreboardRequest) returns (ListScoreboardResponse);
|
|
// GetByRank returns the entry at the given canonical rank.
|
|
rpc GetByRank(GetByRankRequest) returns (Entry);
|
|
// GetByUsername returns the entry for a username (case-insensitive).
|
|
rpc GetByUsername(GetByUsernameRequest) returns (Entry);
|
|
}
|
|
|
|
// Entry is a single scoreboard row.
|
|
message Entry {
|
|
int32 rank = 1;
|
|
string username = 2;
|
|
string profile_path = 3;
|
|
string country = 4;
|
|
string grade = 5;
|
|
int32 score = 6;
|
|
}
|
|
|
|
message ListScoreboardRequest {
|
|
// Zero-based offset into the ranked list.
|
|
int32 offset = 1;
|
|
// Maximum entries to return; 0 means "all from offset".
|
|
int32 limit = 2;
|
|
}
|
|
|
|
message ListScoreboardResponse {
|
|
repeated Entry entries = 1;
|
|
// Total entries in the current snapshot.
|
|
int32 total = 2;
|
|
// Snapshot time (unix seconds) the data was fetched.
|
|
int64 fetched_at = 3;
|
|
}
|
|
|
|
message GetByRankRequest {
|
|
int32 rank = 1;
|
|
}
|
|
|
|
message GetByUsernameRequest {
|
|
string username = 1;
|
|
}
|