commit 7aae646fca1410c1c61f0e78b18f709151153a65 Author: itzaname Date: Sat Jul 16 21:09:09 2022 -0400 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..f992b39 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# StrafesNET protobuf definitions \ No newline at end of file diff --git a/bots.proto b/bots.proto new file mode 100644 index 0000000..ce1f5d4 --- /dev/null +++ b/bots.proto @@ -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 { + +} \ No newline at end of file diff --git a/events.proto b/events.proto new file mode 100644 index 0000000..b3e7a9b --- /dev/null +++ b/events.proto @@ -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 { + +} \ No newline at end of file diff --git a/maps.proto b/maps.proto new file mode 100644 index 0000000..6414071 --- /dev/null +++ b/maps.proto @@ -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 { + +} \ No newline at end of file diff --git a/servers.proto b/servers.proto new file mode 100644 index 0000000..3887c1f --- /dev/null +++ b/servers.proto @@ -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 { + +} \ No newline at end of file diff --git a/times.proto b/times.proto new file mode 100644 index 0000000..44a752a --- /dev/null +++ b/times.proto @@ -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 { + +} \ No newline at end of file diff --git a/transactions.proto b/transactions.proto new file mode 100644 index 0000000..e80ffb4 --- /dev/null +++ b/transactions.proto @@ -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 { + +} \ No newline at end of file diff --git a/users.proto b/users.proto new file mode 100644 index 0000000..f4b50ac --- /dev/null +++ b/users.proto @@ -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 { + +} \ No newline at end of file