Initial commit

This commit is contained in:
itzaname 2022-07-16 21:09:09 -04:00
commit 7aae646fca
8 changed files with 460 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# StrafesNET protobuf definitions

54
bots.proto Normal file
View File

@ -0,0 +1,54 @@
syntax = "proto3";
option go_package = "pkg/rpc/bots";
package bots;
service BotsService {
rpc Get(IdMessage) returns (BotResponse);
rpc GetList(IdList) returns (BotList);
rpc Update(BotRequest) returns (NullResponse);
rpc Create(BotRequest) returns (IdMessage);
rpc Delete(IdMessage) returns (NullResponse);
rpc List(ListRequest) returns (BotList);
}
message IdList {
repeated int64 ID = 1;
}
message IdMessage {
int64 ID = 1;
}
message BotResponse {
int64 ID = 1;
int64 TimeID = 2;
int64 Date = 3;
string FileID = 4;
}
message BotRequest {
int64 ID = 1;
optional int64 TimeID = 2;
optional int64 Date = 3;
optional string FileID = 4;
}
message BotList {
repeated BotResponse Bots = 1;
}
message ListRequest {
BotRequest Filter = 1;
Pagination Page = 2;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message NullResponse {
}

48
events.proto Normal file
View File

@ -0,0 +1,48 @@
syntax = "proto3";
option go_package = "pkg/rpc/events";
package events;
import "google/protobuf/struct.proto";
service EventsService {
rpc Latest(LatestRequest) returns (LatestResponse);
rpc Create(EventCreate) returns (NullResponse);
rpc Clean(NullResponse) returns (NullResponse);
}
message EventCreate {
string Event = 1;
string Server = 2;
int32 GameID = 3;
int64 Date = 4;
google.protobuf.Struct Data = 5;
}
message EventItem {
int64 ID = 1;
string Event = 2;
string Server = 3;
int32 GameID = 4;
int64 Date = 5;
google.protobuf.Struct Data = 6;
}
message LatestRequest {
optional int64 LastID = 1;
Pagination Page = 2;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message LatestResponse {
repeated EventItem Events = 1;
}
message NullResponse {
}

63
maps.proto Normal file
View File

@ -0,0 +1,63 @@
syntax = "proto3";
option go_package = "pkg/rpc/maps";
package maps;
service MapsService {
rpc Get(IdMessage) returns (MapResponse);
rpc GetList(IdList) returns (MapList);
rpc Update(MapRequest) returns (NullResponse);
rpc Create(MapRequest) returns (IdMessage);
rpc Delete(IdMessage) returns (NullResponse);
rpc List(ListRequest) returns (MapList);
}
message IdList {
repeated int64 ID = 1;
}
message IdMessage {
int64 ID = 1;
}
message MapResponse {
int64 ID = 1;
string DisplayName = 2;
string Creator = 3;
int32 GameID = 4;
int64 Date = 5;
}
message MapRequest {
int64 ID = 1;
optional string DisplayName = 2;
optional string Creator = 3;
optional int32 GameID = 4;
optional int64 Date = 5;
}
message MapFilter {
int64 ID = 1;
optional string DisplayName = 2;
optional string Creator = 3;
optional int32 GameID = 4;
}
message MapList {
repeated MapResponse Maps = 1;
}
message ListRequest {
MapFilter Filter = 1;
Pagination Page = 2;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message NullResponse {
}

80
servers.proto Normal file
View File

@ -0,0 +1,80 @@
syntax = "proto3";
option go_package = "pkg/rpc/servers";
import "proto/users.proto";
import "proto/maps.proto";
package servers;
service ServerService {
rpc Create(ServerCreate) returns (NullResponse);
rpc Update(ServerUpdate) returns (NullResponse);
rpc Delete(IdMessage) returns (NullResponse);
rpc Get(IdMessage) returns (ServerItem);
rpc List(ServerListRequest) returns (ServerList);
}
message ServerList {
repeated ServerItem Servers = 1;
}
message IdMessage {
string ID = 1;
}
message ServerCreate {
string ID = 1;
int64 PlaceID = 2;
int64 StartTime = 3;
string VipServerID = 4;
int64 UserID = 5;
int32 GameID = 6;
int64 MapID = 7;
int64 MapDate = 8;
repeated int64 PlayerList = 9;
int64 LastUpdate = 10;
}
message ServerItem {
string ID = 1;
int64 PlaceID = 2;
int64 StartTime = 3;
string VipServerID = 4;
users.UserResponse User = 5;
int32 GameID = 6;
maps.MapResponse Map = 7;
int64 MapDate = 8;
repeated int64 PlayerList = 9;
int64 LastUpdate = 10;
}
message ServerUpdate {
string ID = 1;
optional int64 MapID = 2;
optional int64 MapDate = 3;
repeated int64 PlayerList = 4;
}
message ServerFilter {
optional string ID = 1;
optional int64 PlaceID = 2;
optional string VipServerID = 4;
optional int64 UserID = 5;
optional int32 GameID = 6;
optional int64 MapID = 7;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message ServerListRequest {
ServerFilter Filter = 1;
Pagination Page = 2;
}
message NullResponse {
}

80
times.proto Normal file
View File

@ -0,0 +1,80 @@
syntax = "proto3";
import "proto/users.proto";
import "proto/maps.proto";
import "proto/bots.proto";
option go_package = "pkg/rpc/times";
package times;
service TimesService {
rpc Create(TimeRequest) returns (IdMessage);
rpc Update(TimeRequest) returns (NullResponse);
rpc Delete(IdMessage) returns (NullResponse);
rpc Get(IdMessage) returns (TimeResponse);
rpc List(ListRequest) returns (TimeList);
rpc Rank(IdMessage) returns (RankResponse);
}
message TimeRequest {
int64 ID = 1;
optional int64 Time = 2;
optional int64 UserID = 3;
optional int64 MapID = 4;
optional int64 Date = 5;
optional int32 StyleID = 6;
optional int32 ModeID = 7;
optional int32 GameID = 8;
}
message TimeFilter {
optional int64 ID = 1;
optional int64 Time = 2;
optional int64 UserID = 3;
optional int64 MapID = 4;
optional int64 Date = 5;
optional int32 StyleID = 6;
optional int32 ModeID = 7;
optional int32 GameID = 8;
}
message TimeResponse {
int64 ID = 1;
int64 Time = 2;
users.UserResponse User = 3;
maps.MapResponse Map = 4;
optional bots.BotResponse Bot = 5;
int64 Date = 6;
int32 StyleID = 7;
int32 ModeID = 8;
int32 GameID = 9;
}
message IdMessage {
int64 ID = 1;
}
message TimeList {
repeated TimeResponse Times = 1;
int64 Total = 2;
}
message RankResponse {
int64 Rank = 1;
}
message ListRequest {
TimeFilter Filter = 1;
bool Blacklisted = 2;
Pagination Page = 3;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message NullResponse {
}

76
transactions.proto Normal file
View File

@ -0,0 +1,76 @@
syntax = "proto3";
option go_package = "pkg/rpc/transactions";
package transactions;
import "proto/users.proto";
import "google/protobuf/struct.proto";
service TransactionsService {
rpc Create(TransactionCreate) returns (IdMessage);
rpc Update(TransactionUpdate) returns (NullResponse);
rpc Delete(IdMessage) returns (NullResponse);
rpc Balance(UserIdMessage) returns (BalanceResponse);
rpc Get(IdMessage) returns (TransactionItem);
rpc List(ListRequest) returns (TransactionList);
}
message TransactionCreate {
int64 UserID = 1;
int64 Value = 2;
int32 StateID = 3;
google.protobuf.Struct Data = 4;
}
message TransactionUpdate {
string ID = 1;
optional int64 Value = 2;
optional int64 StateID = 3;
optional google.protobuf.Struct Data = 4;
}
message TransactionItem {
string ID = 1;
users.UserResponse User = 2;
int64 Value = 3;
int32 StateID = 4;
int64 Created = 5;
int64 Updated = 6;
google.protobuf.Struct Data = 7;
}
message TransactionFilter {
optional int64 UserID = 1;
optional int32 StateID = 2;
}
message ListRequest {
TransactionFilter Filter = 1;
Pagination Page = 2;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message TransactionList {
repeated TransactionItem Transactions = 1;
}
message BalanceResponse {
int64 Balance = 1;
}
message IdMessage {
string ID = 1;
}
message UserIdMessage {
int64 UserID = 1;
}
message NullResponse {
}

58
users.proto Normal file
View File

@ -0,0 +1,58 @@
syntax = "proto3";
option go_package = "pkg/rpc/users";
package users;
service UsersService {
rpc Get(IdMessage) returns (UserResponse);
rpc GetList(IdList) returns (UserList);
rpc Update(UserRequest) returns (NullResponse);
rpc Create(UserRequest) returns (IdMessage);
rpc Delete(IdMessage) returns (NullResponse);
rpc List(ListRequest) returns (UserList);
}
message IdList {
repeated int64 ID = 1;
}
message IdMessage {
int64 ID = 1;
}
message UserResponse {
int64 ID = 1;
string Username = 2;
int32 StateID = 3;
}
message UserRequest {
int64 ID = 1;
optional string Username = 2;
optional int32 StateID = 3;
}
message UserFilter {
optional int64 ID = 1;
optional string Username = 2;
optional int32 StateID = 3;
}
message UserList {
repeated UserResponse Users = 1;
}
message ListRequest {
UserFilter Filter = 1;
Pagination Page = 2;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message NullResponse {
}