From 1ea47f458caa1834b0d953dfd678bbd95f04ffaf Mon Sep 17 00:00:00 2001 From: Markus Reinhold Date: Wed, 3 Dec 2025 23:35:50 +0100 Subject: [PATCH 1/5] Add game messages --- go/connectfour/v1/messaging.pb.go | 611 ++++++++++++++++++ .../ConnectFour/V1/ConnectFourV1Factory.php | 91 +++ .../Api/ConnectFour/V1/Game.php | 166 +++++ .../Api/ConnectFour/V1/Game/Move.php | 115 ++++ .../Api/ConnectFour/V1/Game/Move/Color.php | 56 ++ .../Api/ConnectFour/V1/GetGamesByPlayer.php | 146 +++++ .../V1/GetGamesByPlayerResponse.php | 85 +++ .../Api/ConnectFour/V1/JoinGame.php | 85 +++ .../Api/ConnectFour/V1/JoinGameResponse.php | 31 + .../Api/ConnectFour/V1/MakeMove.php | 112 ++++ .../Api/ConnectFour/V1/MakeMoveResponse.php | 31 + .../GPBMetadata/ConnectFour/V1/Messaging.php | Bin 0 -> 1472 bytes .../api/connectfour/v1/messaging.proto | 54 ++ 13 files changed, 1583 insertions(+) create mode 100644 go/connectfour/v1/messaging.pb.go create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/Game.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/Game/Move.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/Game/Move/Color.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayerResponse.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/JoinGame.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/JoinGameResponse.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/MakeMove.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/MakeMoveResponse.php create mode 100644 php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php create mode 100644 schema/gamingplatform/api/connectfour/v1/messaging.proto diff --git a/go/connectfour/v1/messaging.pb.go b/go/connectfour/v1/messaging.pb.go new file mode 100644 index 0000000..23e78b7 --- /dev/null +++ b/go/connectfour/v1/messaging.pb.go @@ -0,0 +1,611 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v4.25.1 +// source: gamingplatform/api/connectfour/v1/messaging.proto + +package connectfourv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Game_Move_Color int32 + +const ( + Game_Move_COLOR_UNSPECIFIED Game_Move_Color = 0 + Game_Move_RED Game_Move_Color = 1 + Game_Move_YELLOW Game_Move_Color = 2 +) + +// Enum value maps for Game_Move_Color. +var ( + Game_Move_Color_name = map[int32]string{ + 0: "COLOR_UNSPECIFIED", + 1: "RED", + 2: "YELLOW", + } + Game_Move_Color_value = map[string]int32{ + "COLOR_UNSPECIFIED": 0, + "RED": 1, + "YELLOW": 2, + } +) + +func (x Game_Move_Color) Enum() *Game_Move_Color { + p := new(Game_Move_Color) + *p = x + return p +} + +func (x Game_Move_Color) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Game_Move_Color) Descriptor() protoreflect.EnumDescriptor { + return file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[0].Descriptor() +} + +func (Game_Move_Color) Type() protoreflect.EnumType { + return &file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[0] +} + +func (x Game_Move_Color) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Game_Move_Color.Descriptor instead. +func (Game_Move_Color) EnumDescriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6, 0, 0} +} + +type JoinGame struct { + state protoimpl.MessageState `protogen:"open.v1"` + GameId string `protobuf:"bytes,1,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"` + PlayerId string `protobuf:"bytes,2,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JoinGame) Reset() { + *x = JoinGame{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JoinGame) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinGame) ProtoMessage() {} + +func (x *JoinGame) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinGame.ProtoReflect.Descriptor instead. +func (*JoinGame) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{0} +} + +func (x *JoinGame) GetGameId() string { + if x != nil { + return x.GameId + } + return "" +} + +func (x *JoinGame) GetPlayerId() string { + if x != nil { + return x.PlayerId + } + return "" +} + +type JoinGameResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JoinGameResponse) Reset() { + *x = JoinGameResponse{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JoinGameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinGameResponse) ProtoMessage() {} + +func (x *JoinGameResponse) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinGameResponse.ProtoReflect.Descriptor instead. +func (*JoinGameResponse) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{1} +} + +type MakeMove struct { + state protoimpl.MessageState `protogen:"open.v1"` + GameId string `protobuf:"bytes,1,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"` + PlayerId string `protobuf:"bytes,2,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"` + Column int32 `protobuf:"varint,3,opt,name=column,proto3" json:"column,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MakeMove) Reset() { + *x = MakeMove{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MakeMove) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MakeMove) ProtoMessage() {} + +func (x *MakeMove) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MakeMove.ProtoReflect.Descriptor instead. +func (*MakeMove) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{2} +} + +func (x *MakeMove) GetGameId() string { + if x != nil { + return x.GameId + } + return "" +} + +func (x *MakeMove) GetPlayerId() string { + if x != nil { + return x.PlayerId + } + return "" +} + +func (x *MakeMove) GetColumn() int32 { + if x != nil { + return x.Column + } + return 0 +} + +type MakeMoveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MakeMoveResponse) Reset() { + *x = MakeMoveResponse{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MakeMoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MakeMoveResponse) ProtoMessage() {} + +func (x *MakeMoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MakeMoveResponse.ProtoReflect.Descriptor instead. +func (*MakeMoveResponse) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{3} +} + +type GetGamesByPlayer struct { + state protoimpl.MessageState `protogen:"open.v1"` + PlayerId string `protobuf:"bytes,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"` + GameState string `protobuf:"bytes,2,opt,name=game_state,json=gameState,proto3" json:"game_state,omitempty"` // "all", "running", "won, "lost", "drawn" + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetGamesByPlayer) Reset() { + *x = GetGamesByPlayer{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetGamesByPlayer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGamesByPlayer) ProtoMessage() {} + +func (x *GetGamesByPlayer) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetGamesByPlayer.ProtoReflect.Descriptor instead. +func (*GetGamesByPlayer) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{4} +} + +func (x *GetGamesByPlayer) GetPlayerId() string { + if x != nil { + return x.PlayerId + } + return "" +} + +func (x *GetGamesByPlayer) GetGameState() string { + if x != nil { + return x.GameState + } + return "" +} + +func (x *GetGamesByPlayer) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetGamesByPlayer) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +type GetGamesByPlayerResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Games []*Game `protobuf:"bytes,1,rep,name=games,proto3" json:"games,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetGamesByPlayerResponse) Reset() { + *x = GetGamesByPlayerResponse{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetGamesByPlayerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGamesByPlayerResponse) ProtoMessage() {} + +func (x *GetGamesByPlayerResponse) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetGamesByPlayerResponse.ProtoReflect.Descriptor instead. +func (*GetGamesByPlayerResponse) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{5} +} + +func (x *GetGamesByPlayerResponse) GetGames() []*Game { + if x != nil { + return x.Games + } + return nil +} + +func (x *GetGamesByPlayerResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +type Game struct { + state protoimpl.MessageState `protogen:"open.v1"` + GameId string `protobuf:"bytes,1,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"` + RedPlayerId string `protobuf:"bytes,2,opt,name=red_player_id,json=redPlayerId,proto3" json:"red_player_id,omitempty"` + YellowPlayerId string `protobuf:"bytes,3,opt,name=yellow_player_id,json=yellowPlayerId,proto3" json:"yellow_player_id,omitempty"` + CurrentPlayerId string `protobuf:"bytes,4,opt,name=current_player_id,json=currentPlayerId,proto3" json:"current_player_id,omitempty"` + Moves []*Game_Move `protobuf:"bytes,5,rep,name=moves,proto3" json:"moves,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Game) Reset() { + *x = Game{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Game) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Game) ProtoMessage() {} + +func (x *Game) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Game.ProtoReflect.Descriptor instead. +func (*Game) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6} +} + +func (x *Game) GetGameId() string { + if x != nil { + return x.GameId + } + return "" +} + +func (x *Game) GetRedPlayerId() string { + if x != nil { + return x.RedPlayerId + } + return "" +} + +func (x *Game) GetYellowPlayerId() string { + if x != nil { + return x.YellowPlayerId + } + return "" +} + +func (x *Game) GetCurrentPlayerId() string { + if x != nil { + return x.CurrentPlayerId + } + return "" +} + +func (x *Game) GetMoves() []*Game_Move { + if x != nil { + return x.Moves + } + return nil +} + +type Game_Move struct { + state protoimpl.MessageState `protogen:"open.v1"` + X int32 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"` + Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"` + Color Game_Move_Color `protobuf:"varint,3,opt,name=color,proto3,enum=gamingplatform.api.connectfour.v1.Game_Move_Color" json:"color,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Game_Move) Reset() { + *x = Game_Move{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Game_Move) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Game_Move) ProtoMessage() {} + +func (x *Game_Move) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Game_Move.ProtoReflect.Descriptor instead. +func (*Game_Move) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *Game_Move) GetX() int32 { + if x != nil { + return x.X + } + return 0 +} + +func (x *Game_Move) GetY() int32 { + if x != nil { + return x.Y + } + return 0 +} + +func (x *Game_Move) GetColor() Game_Move_Color { + if x != nil { + return x.Color + } + return Game_Move_COLOR_UNSPECIFIED +} + +var File_gamingplatform_api_connectfour_v1_messaging_proto protoreflect.FileDescriptor + +const file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc = "" + + "\n" + + "1gamingplatform/api/connectfour/v1/messaging.proto\x12!gamingplatform.api.connectfour.v1\"@\n" + + "\bJoinGame\x12\x17\n" + + "\agame_id\x18\x01 \x01(\tR\x06gameId\x12\x1b\n" + + "\tplayer_id\x18\x02 \x01(\tR\bplayerId\"\x12\n" + + "\x10JoinGameResponse\"X\n" + + "\bMakeMove\x12\x17\n" + + "\agame_id\x18\x01 \x01(\tR\x06gameId\x12\x1b\n" + + "\tplayer_id\x18\x02 \x01(\tR\bplayerId\x12\x16\n" + + "\x06column\x18\x03 \x01(\x05R\x06column\"\x12\n" + + "\x10MakeMoveResponse\"x\n" + + "\x10GetGamesByPlayer\x12\x1b\n" + + "\tplayer_id\x18\x01 \x01(\tR\bplayerId\x12\x1d\n" + + "\n" + + "game_state\x18\x02 \x01(\tR\tgameState\x12\x12\n" + + "\x04page\x18\x03 \x01(\x05R\x04page\x12\x14\n" + + "\x05limit\x18\x04 \x01(\x05R\x05limit\"o\n" + + "\x18GetGamesByPlayerResponse\x12=\n" + + "\x05games\x18\x01 \x03(\v2'.gamingplatform.api.connectfour.v1.GameR\x05games\x12\x14\n" + + "\x05total\x18\x02 \x01(\x05R\x05total\"\x81\x03\n" + + "\x04Game\x12\x17\n" + + "\agame_id\x18\x01 \x01(\tR\x06gameId\x12\"\n" + + "\rred_player_id\x18\x02 \x01(\tR\vredPlayerId\x12(\n" + + "\x10yellow_player_id\x18\x03 \x01(\tR\x0eyellowPlayerId\x12*\n" + + "\x11current_player_id\x18\x04 \x01(\tR\x0fcurrentPlayerId\x12B\n" + + "\x05moves\x18\x05 \x03(\v2,.gamingplatform.api.connectfour.v1.Game.MoveR\x05moves\x1a\xa1\x01\n" + + "\x04Move\x12\f\n" + + "\x01x\x18\x01 \x01(\x05R\x01x\x12\f\n" + + "\x01y\x18\x02 \x01(\x05R\x01y\x12H\n" + + "\x05color\x18\x03 \x01(\x0e22.gamingplatform.api.connectfour.v1.Game.Move.ColorR\x05color\"3\n" + + "\x05Color\x12\x15\n" + + "\x11COLOR_UNSPECIFIED\x10\x00\x12\a\n" + + "\x03RED\x10\x01\x12\n" + + "\n" + + "\x06YELLOW\x10\x02B\x94\x01Z>github.com/gaming-platform/api/go/connectfour/v1;connectfourv1\xca\x02!GamingPlatform\\Api\\ConnectFour\\V1\xe2\x02-GamingPlatform\\Api\\GPBMetadata\\ConnectFour\\V1b\x06proto3" + +var ( + file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescOnce sync.Once + file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescData []byte +) + +func file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP() []byte { + file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescOnce.Do(func() { + file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc), len(file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc))) + }) + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescData +} + +var file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_gamingplatform_api_connectfour_v1_messaging_proto_goTypes = []any{ + (Game_Move_Color)(0), // 0: gamingplatform.api.connectfour.v1.Game.Move.Color + (*JoinGame)(nil), // 1: gamingplatform.api.connectfour.v1.JoinGame + (*JoinGameResponse)(nil), // 2: gamingplatform.api.connectfour.v1.JoinGameResponse + (*MakeMove)(nil), // 3: gamingplatform.api.connectfour.v1.MakeMove + (*MakeMoveResponse)(nil), // 4: gamingplatform.api.connectfour.v1.MakeMoveResponse + (*GetGamesByPlayer)(nil), // 5: gamingplatform.api.connectfour.v1.GetGamesByPlayer + (*GetGamesByPlayerResponse)(nil), // 6: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse + (*Game)(nil), // 7: gamingplatform.api.connectfour.v1.Game + (*Game_Move)(nil), // 8: gamingplatform.api.connectfour.v1.Game.Move +} +var file_gamingplatform_api_connectfour_v1_messaging_proto_depIdxs = []int32{ + 7, // 0: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse.games:type_name -> gamingplatform.api.connectfour.v1.Game + 8, // 1: gamingplatform.api.connectfour.v1.Game.moves:type_name -> gamingplatform.api.connectfour.v1.Game.Move + 0, // 2: gamingplatform.api.connectfour.v1.Game.Move.color:type_name -> gamingplatform.api.connectfour.v1.Game.Move.Color + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_gamingplatform_api_connectfour_v1_messaging_proto_init() } +func file_gamingplatform_api_connectfour_v1_messaging_proto_init() { + if File_gamingplatform_api_connectfour_v1_messaging_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc), len(file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc)), + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_gamingplatform_api_connectfour_v1_messaging_proto_goTypes, + DependencyIndexes: file_gamingplatform_api_connectfour_v1_messaging_proto_depIdxs, + EnumInfos: file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes, + MessageInfos: file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes, + }.Build() + File_gamingplatform_api_connectfour_v1_messaging_proto = out.File + file_gamingplatform_api_connectfour_v1_messaging_proto_goTypes = nil + file_gamingplatform_api_connectfour_v1_messaging_proto_depIdxs = nil +} diff --git a/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php b/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php new file mode 100644 index 0000000..99e8c68 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php @@ -0,0 +1,91 @@ +mergeFromString($data); + return $message; + } + + public static function createGame( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\Game { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\Game(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + + public static function createGetGamesByPlayer( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayer { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayer(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + + public static function createGetGamesByPlayerResponse( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayerResponse { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayerResponse(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + + public static function createJoinGame( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\JoinGame { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\JoinGame(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + + public static function createJoinGameResponse( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\JoinGameResponse { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\JoinGameResponse(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + + public static function createMakeMove( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\MakeMove { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\MakeMove(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + + public static function createMakeMoveResponse( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\MakeMoveResponse { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\MakeMoveResponse(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + +} diff --git a/php/GamingPlatform/Api/ConnectFour/V1/Game.php b/php/GamingPlatform/Api/ConnectFour/V1/Game.php new file mode 100644 index 0000000..05cc809 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/Game.php @@ -0,0 +1,166 @@ +gamingplatform.api.connectfour.v1.Game + */ +class Game extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string game_id = 1; + */ + protected $game_id = ''; + /** + * Generated from protobuf field string red_player_id = 2; + */ + protected $red_player_id = ''; + /** + * Generated from protobuf field string yellow_player_id = 3; + */ + protected $yellow_player_id = ''; + /** + * Generated from protobuf field string current_player_id = 4; + */ + protected $current_player_id = ''; + /** + * Generated from protobuf field repeated .gamingplatform.api.connectfour.v1.Game.Move moves = 5; + */ + private $moves; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $game_id + * @type string $red_player_id + * @type string $yellow_player_id + * @type string $current_player_id + * @type array<\GamingPlatform\Api\ConnectFour\V1\Game\Move>|\Google\Protobuf\Internal\RepeatedField $moves + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string game_id = 1; + * @return string + */ + public function getGameId() + { + return $this->game_id; + } + + /** + * Generated from protobuf field string game_id = 1; + * @param string $var + * @return $this + */ + public function setGameId($var) + { + GPBUtil::checkString($var, True); + $this->game_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string red_player_id = 2; + * @return string + */ + public function getRedPlayerId() + { + return $this->red_player_id; + } + + /** + * Generated from protobuf field string red_player_id = 2; + * @param string $var + * @return $this + */ + public function setRedPlayerId($var) + { + GPBUtil::checkString($var, True); + $this->red_player_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string yellow_player_id = 3; + * @return string + */ + public function getYellowPlayerId() + { + return $this->yellow_player_id; + } + + /** + * Generated from protobuf field string yellow_player_id = 3; + * @param string $var + * @return $this + */ + public function setYellowPlayerId($var) + { + GPBUtil::checkString($var, True); + $this->yellow_player_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string current_player_id = 4; + * @return string + */ + public function getCurrentPlayerId() + { + return $this->current_player_id; + } + + /** + * Generated from protobuf field string current_player_id = 4; + * @param string $var + * @return $this + */ + public function setCurrentPlayerId($var) + { + GPBUtil::checkString($var, True); + $this->current_player_id = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .gamingplatform.api.connectfour.v1.Game.Move moves = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMoves() + { + return $this->moves; + } + + /** + * Generated from protobuf field repeated .gamingplatform.api.connectfour.v1.Game.Move moves = 5; + * @param array<\GamingPlatform\Api\ConnectFour\V1\Game\Move>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMoves($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \GamingPlatform\Api\ConnectFour\V1\Game\Move::class); + $this->moves = $arr; + + return $this; + } + +} + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/Game/Move.php b/php/GamingPlatform/Api/ConnectFour/V1/Game/Move.php new file mode 100644 index 0000000..43cd6e4 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/Game/Move.php @@ -0,0 +1,115 @@ +gamingplatform.api.connectfour.v1.Game.Move + */ +class Move extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int32 x = 1; + */ + protected $x = 0; + /** + * Generated from protobuf field int32 y = 2; + */ + protected $y = 0; + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.Game.Move.Color color = 3; + */ + protected $color = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $x + * @type int $y + * @type int $color + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int32 x = 1; + * @return int + */ + public function getX() + { + return $this->x; + } + + /** + * Generated from protobuf field int32 x = 1; + * @param int $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkInt32($var); + $this->x = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 y = 2; + * @return int + */ + public function getY() + { + return $this->y; + } + + /** + * Generated from protobuf field int32 y = 2; + * @param int $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkInt32($var); + $this->y = $var; + + return $this; + } + + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.Game.Move.Color color = 3; + * @return int + */ + public function getColor() + { + return $this->color; + } + + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.Game.Move.Color color = 3; + * @param int $var + * @return $this + */ + public function setColor($var) + { + GPBUtil::checkEnum($var, \GamingPlatform\Api\ConnectFour\V1\Game\Move\Color::class); + $this->color = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Move::class, \GamingPlatform\Api\ConnectFour\V1\Game_Move::class); + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/Game/Move/Color.php b/php/GamingPlatform/Api/ConnectFour/V1/Game/Move/Color.php new file mode 100644 index 0000000..4ca5d63 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/Game/Move/Color.php @@ -0,0 +1,56 @@ +gamingplatform.api.connectfour.v1.Game.Move.Color + */ +class Color +{ + /** + * Generated from protobuf enum COLOR_UNSPECIFIED = 0; + */ + const COLOR_UNSPECIFIED = 0; + /** + * Generated from protobuf enum RED = 1; + */ + const RED = 1; + /** + * Generated from protobuf enum YELLOW = 2; + */ + const YELLOW = 2; + + private static $valueToName = [ + self::COLOR_UNSPECIFIED => 'COLOR_UNSPECIFIED', + self::RED => 'RED', + self::YELLOW => 'YELLOW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Color::class, \GamingPlatform\Api\ConnectFour\V1\Game_Move_Color::class); + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php new file mode 100644 index 0000000..f6f6765 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php @@ -0,0 +1,146 @@ +gamingplatform.api.connectfour.v1.GetGamesByPlayer + */ +class GetGamesByPlayer extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string player_id = 1; + */ + protected $player_id = ''; + /** + * "all", "running", "won, "lost", "drawn" + * + * Generated from protobuf field string game_state = 2; + */ + protected $game_state = ''; + /** + * Generated from protobuf field int32 page = 3; + */ + protected $page = 0; + /** + * Generated from protobuf field int32 limit = 4; + */ + protected $limit = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $player_id + * @type string $game_state + * "all", "running", "won, "lost", "drawn" + * @type int $page + * @type int $limit + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string player_id = 1; + * @return string + */ + public function getPlayerId() + { + return $this->player_id; + } + + /** + * Generated from protobuf field string player_id = 1; + * @param string $var + * @return $this + */ + public function setPlayerId($var) + { + GPBUtil::checkString($var, True); + $this->player_id = $var; + + return $this; + } + + /** + * "all", "running", "won, "lost", "drawn" + * + * Generated from protobuf field string game_state = 2; + * @return string + */ + public function getGameState() + { + return $this->game_state; + } + + /** + * "all", "running", "won, "lost", "drawn" + * + * Generated from protobuf field string game_state = 2; + * @param string $var + * @return $this + */ + public function setGameState($var) + { + GPBUtil::checkString($var, True); + $this->game_state = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 page = 3; + * @return int + */ + public function getPage() + { + return $this->page; + } + + /** + * Generated from protobuf field int32 page = 3; + * @param int $var + * @return $this + */ + public function setPage($var) + { + GPBUtil::checkInt32($var); + $this->page = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 limit = 4; + * @return int + */ + public function getLimit() + { + return $this->limit; + } + + /** + * Generated from protobuf field int32 limit = 4; + * @param int $var + * @return $this + */ + public function setLimit($var) + { + GPBUtil::checkInt32($var); + $this->limit = $var; + + return $this; + } + +} + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayerResponse.php b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayerResponse.php new file mode 100644 index 0000000..e027645 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayerResponse.php @@ -0,0 +1,85 @@ +gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse + */ +class GetGamesByPlayerResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .gamingplatform.api.connectfour.v1.Game games = 1; + */ + private $games; + /** + * Generated from protobuf field int32 total = 2; + */ + protected $total = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\GamingPlatform\Api\ConnectFour\V1\Game>|\Google\Protobuf\Internal\RepeatedField $games + * @type int $total + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .gamingplatform.api.connectfour.v1.Game games = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGames() + { + return $this->games; + } + + /** + * Generated from protobuf field repeated .gamingplatform.api.connectfour.v1.Game games = 1; + * @param array<\GamingPlatform\Api\ConnectFour\V1\Game>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \GamingPlatform\Api\ConnectFour\V1\Game::class); + $this->games = $arr; + + return $this; + } + + /** + * Generated from protobuf field int32 total = 2; + * @return int + */ + public function getTotal() + { + return $this->total; + } + + /** + * Generated from protobuf field int32 total = 2; + * @param int $var + * @return $this + */ + public function setTotal($var) + { + GPBUtil::checkInt32($var); + $this->total = $var; + + return $this; + } + +} + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/JoinGame.php b/php/GamingPlatform/Api/ConnectFour/V1/JoinGame.php new file mode 100644 index 0000000..516967c --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/JoinGame.php @@ -0,0 +1,85 @@ +gamingplatform.api.connectfour.v1.JoinGame + */ +class JoinGame extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string game_id = 1; + */ + protected $game_id = ''; + /** + * Generated from protobuf field string player_id = 2; + */ + protected $player_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $game_id + * @type string $player_id + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string game_id = 1; + * @return string + */ + public function getGameId() + { + return $this->game_id; + } + + /** + * Generated from protobuf field string game_id = 1; + * @param string $var + * @return $this + */ + public function setGameId($var) + { + GPBUtil::checkString($var, True); + $this->game_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string player_id = 2; + * @return string + */ + public function getPlayerId() + { + return $this->player_id; + } + + /** + * Generated from protobuf field string player_id = 2; + * @param string $var + * @return $this + */ + public function setPlayerId($var) + { + GPBUtil::checkString($var, True); + $this->player_id = $var; + + return $this; + } + +} + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/JoinGameResponse.php b/php/GamingPlatform/Api/ConnectFour/V1/JoinGameResponse.php new file mode 100644 index 0000000..539b49b --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/JoinGameResponse.php @@ -0,0 +1,31 @@ +gamingplatform.api.connectfour.v1.JoinGameResponse + */ +class JoinGameResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + +} + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/MakeMove.php b/php/GamingPlatform/Api/ConnectFour/V1/MakeMove.php new file mode 100644 index 0000000..dc34fac --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/MakeMove.php @@ -0,0 +1,112 @@ +gamingplatform.api.connectfour.v1.MakeMove + */ +class MakeMove extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string game_id = 1; + */ + protected $game_id = ''; + /** + * Generated from protobuf field string player_id = 2; + */ + protected $player_id = ''; + /** + * Generated from protobuf field int32 column = 3; + */ + protected $column = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $game_id + * @type string $player_id + * @type int $column + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string game_id = 1; + * @return string + */ + public function getGameId() + { + return $this->game_id; + } + + /** + * Generated from protobuf field string game_id = 1; + * @param string $var + * @return $this + */ + public function setGameId($var) + { + GPBUtil::checkString($var, True); + $this->game_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string player_id = 2; + * @return string + */ + public function getPlayerId() + { + return $this->player_id; + } + + /** + * Generated from protobuf field string player_id = 2; + * @param string $var + * @return $this + */ + public function setPlayerId($var) + { + GPBUtil::checkString($var, True); + $this->player_id = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 column = 3; + * @return int + */ + public function getColumn() + { + return $this->column; + } + + /** + * Generated from protobuf field int32 column = 3; + * @param int $var + * @return $this + */ + public function setColumn($var) + { + GPBUtil::checkInt32($var); + $this->column = $var; + + return $this; + } + +} + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/MakeMoveResponse.php b/php/GamingPlatform/Api/ConnectFour/V1/MakeMoveResponse.php new file mode 100644 index 0000000..eaa7222 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/MakeMoveResponse.php @@ -0,0 +1,31 @@ +gamingplatform.api.connectfour.v1.MakeMoveResponse + */ +class MakeMoveResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + +} + diff --git a/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php b/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php new file mode 100644 index 0000000000000000000000000000000000000000..8d699f2c35d58059c52533e828c8d08ebfc70826 GIT binary patch literal 1472 zcmb7E(M}pc6fMZA+*XU5n9x3r)I>~l37Yf)tBs-(8Wm!#O`A=~unaiqva^|;wWWA2{DpDb=N^d^Rrt5eqZSXi;?(Eg@n+kkOZ|u;`fhDE4m`z0Ks2Bcc&xZe5>8#a z913(|o47S0dOmZT+8i{-tp|$9fcow}i#*9gC1evzE0rEoBTMy8arNd{O~<>Wm}sn2 z?ugtbO2%ybbV4Lku?)71ZcT7CS{Y^QJN!n+Zl^Ok_7LMLjtVtw1%A#z`O!JqOSd5o zM(d14>s*!#4$Qt2Jir*4{TyZxz*@YMPmxqHYcD_++hV|^-b(AOf(^N0{VBG92qIS4 zf!SmFg&m8_2XWZ*FpUiw_k;Wta$1^mh#zsDL#~EV=sw#UV0)p6+j0_xHh__=Q(=ij z`x#_H+G7d1JqMQ0`&{KS<}3>NN#5a^_G_>-S%kNrDn8wCR~&pC`!w$H&(R9?8A>SX z8v$0~R~j;A|Bj)HFeh23HDRiqhunbqzW6%!Mq87$U%-MFOUVK?_DbI*Yj1(oN5`YQ zWz?=cP^_b4dU>6KjL9ntsc$B2%f{s(xq-b47A7R5@o;`)<1yS$RU-?VV3~!z2n*H5 zQRB4r;pBbupjtnyAMEFz*fTJ7ii;E`IQ{A1=&12Am)^ThectJDbrH9*Py40B{&lqL z-)QQIiRrX8*3p;c-{~c^9z(;PF(B8>q+5dsC()nu`n_f2vuhI5o;K5Ob7k~xt|g!R R*o64+bTF04Ah?1nfWLS5!1n+E literal 0 HcmV?d00001 diff --git a/schema/gamingplatform/api/connectfour/v1/messaging.proto b/schema/gamingplatform/api/connectfour/v1/messaging.proto new file mode 100644 index 0000000..74abf26 --- /dev/null +++ b/schema/gamingplatform/api/connectfour/v1/messaging.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package gamingplatform.api.connectfour.v1; + +option go_package = "github.com/gaming-platform/api/go/connectfour/v1;connectfourv1"; +option php_namespace = "GamingPlatform\\Api\\ConnectFour\\V1"; +option php_metadata_namespace = "GamingPlatform\\Api\\GPBMetadata\\ConnectFour\\V1"; + +message JoinGame { + string game_id = 1; + string player_id = 2; +} + +message JoinGameResponse { +} + +message MakeMove { + string game_id = 1; + string player_id = 2; + int32 column = 3; +} + +message MakeMoveResponse { +} + +message GetGamesByPlayer { + string player_id = 1; + string game_state = 2; // "all", "running", "won, "lost", "drawn" + int32 page = 3; + int32 limit = 4; +} + +message GetGamesByPlayerResponse { + repeated Game games = 1; + int32 total = 2; +} + +message Game { + message Move { + enum Color { + COLOR_UNSPECIFIED = 0; + RED = 1; + YELLOW = 2; + } + int32 x = 1; + int32 y = 2; + Color color = 3; + } + string game_id = 1; + string red_player_id = 2; + string yellow_player_id = 3; + string current_player_id = 4; + repeated Move moves = 5; +} From 1e69d607ced5bb8075629fdb5c211273c6d9efb5 Mon Sep 17 00:00:00 2001 From: Markus Reinhold Date: Thu, 4 Dec 2025 00:08:43 +0100 Subject: [PATCH 2/5] Prefix enum value names --- go/connectfour/v1/messaging.pb.go | 25 +++++++++--------- .../Api/ConnectFour/V1/Game/Move/Color.php | 12 ++++----- .../GPBMetadata/ConnectFour/V1/Messaging.php | Bin 1472 -> 1484 bytes .../api/connectfour/v1/messaging.proto | 4 +-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/go/connectfour/v1/messaging.pb.go b/go/connectfour/v1/messaging.pb.go index 23e78b7..2b38973 100644 --- a/go/connectfour/v1/messaging.pb.go +++ b/go/connectfour/v1/messaging.pb.go @@ -25,21 +25,21 @@ type Game_Move_Color int32 const ( Game_Move_COLOR_UNSPECIFIED Game_Move_Color = 0 - Game_Move_RED Game_Move_Color = 1 - Game_Move_YELLOW Game_Move_Color = 2 + Game_Move_COLOR_RED Game_Move_Color = 1 + Game_Move_COLOR_YELLOW Game_Move_Color = 2 ) // Enum value maps for Game_Move_Color. var ( Game_Move_Color_name = map[int32]string{ 0: "COLOR_UNSPECIFIED", - 1: "RED", - 2: "YELLOW", + 1: "COLOR_RED", + 2: "COLOR_YELLOW", } Game_Move_Color_value = map[string]int32{ "COLOR_UNSPECIFIED": 0, - "RED": 1, - "YELLOW": 2, + "COLOR_RED": 1, + "COLOR_YELLOW": 2, } ) @@ -532,22 +532,21 @@ const file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc = "" + "\x05limit\x18\x04 \x01(\x05R\x05limit\"o\n" + "\x18GetGamesByPlayerResponse\x12=\n" + "\x05games\x18\x01 \x03(\v2'.gamingplatform.api.connectfour.v1.GameR\x05games\x12\x14\n" + - "\x05total\x18\x02 \x01(\x05R\x05total\"\x81\x03\n" + + "\x05total\x18\x02 \x01(\x05R\x05total\"\x8d\x03\n" + "\x04Game\x12\x17\n" + "\agame_id\x18\x01 \x01(\tR\x06gameId\x12\"\n" + "\rred_player_id\x18\x02 \x01(\tR\vredPlayerId\x12(\n" + "\x10yellow_player_id\x18\x03 \x01(\tR\x0eyellowPlayerId\x12*\n" + "\x11current_player_id\x18\x04 \x01(\tR\x0fcurrentPlayerId\x12B\n" + - "\x05moves\x18\x05 \x03(\v2,.gamingplatform.api.connectfour.v1.Game.MoveR\x05moves\x1a\xa1\x01\n" + + "\x05moves\x18\x05 \x03(\v2,.gamingplatform.api.connectfour.v1.Game.MoveR\x05moves\x1a\xad\x01\n" + "\x04Move\x12\f\n" + "\x01x\x18\x01 \x01(\x05R\x01x\x12\f\n" + "\x01y\x18\x02 \x01(\x05R\x01y\x12H\n" + - "\x05color\x18\x03 \x01(\x0e22.gamingplatform.api.connectfour.v1.Game.Move.ColorR\x05color\"3\n" + + "\x05color\x18\x03 \x01(\x0e22.gamingplatform.api.connectfour.v1.Game.Move.ColorR\x05color\"?\n" + "\x05Color\x12\x15\n" + - "\x11COLOR_UNSPECIFIED\x10\x00\x12\a\n" + - "\x03RED\x10\x01\x12\n" + - "\n" + - "\x06YELLOW\x10\x02B\x94\x01Z>github.com/gaming-platform/api/go/connectfour/v1;connectfourv1\xca\x02!GamingPlatform\\Api\\ConnectFour\\V1\xe2\x02-GamingPlatform\\Api\\GPBMetadata\\ConnectFour\\V1b\x06proto3" + "\x11COLOR_UNSPECIFIED\x10\x00\x12\r\n" + + "\tCOLOR_RED\x10\x01\x12\x10\n" + + "\fCOLOR_YELLOW\x10\x02B\x94\x01Z>github.com/gaming-platform/api/go/connectfour/v1;connectfourv1\xca\x02!GamingPlatform\\Api\\ConnectFour\\V1\xe2\x02-GamingPlatform\\Api\\GPBMetadata\\ConnectFour\\V1b\x06proto3" var ( file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescOnce sync.Once diff --git a/php/GamingPlatform/Api/ConnectFour/V1/Game/Move/Color.php b/php/GamingPlatform/Api/ConnectFour/V1/Game/Move/Color.php index 4ca5d63..19ae9e5 100644 --- a/php/GamingPlatform/Api/ConnectFour/V1/Game/Move/Color.php +++ b/php/GamingPlatform/Api/ConnectFour/V1/Game/Move/Color.php @@ -16,18 +16,18 @@ class Color */ const COLOR_UNSPECIFIED = 0; /** - * Generated from protobuf enum RED = 1; + * Generated from protobuf enum COLOR_RED = 1; */ - const RED = 1; + const COLOR_RED = 1; /** - * Generated from protobuf enum YELLOW = 2; + * Generated from protobuf enum COLOR_YELLOW = 2; */ - const YELLOW = 2; + const COLOR_YELLOW = 2; private static $valueToName = [ self::COLOR_UNSPECIFIED => 'COLOR_UNSPECIFIED', - self::RED => 'RED', - self::YELLOW => 'YELLOW', + self::COLOR_RED => 'COLOR_RED', + self::COLOR_YELLOW => 'COLOR_YELLOW', ]; public static function name($value) diff --git a/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php b/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php index 8d699f2c35d58059c52533e828c8d08ebfc70826..e97b53aaea48bea1723d8ac15f24fa4c5aa9f0fc 100644 GIT binary patch delta 87 zcmX@WeTI9(dq&2-%^w)oFftyVJePS9 Date: Thu, 4 Dec 2025 00:12:59 +0100 Subject: [PATCH 3/5] Rename game_state to state --- go/connectfour/v1/messaging.pb.go | 13 ++++++------- .../Api/ConnectFour/V1/GetGamesByPlayer.php | 18 +++++++++--------- .../GPBMetadata/ConnectFour/V1/Messaging.php | Bin 1484 -> 1479 bytes .../api/connectfour/v1/messaging.proto | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/go/connectfour/v1/messaging.pb.go b/go/connectfour/v1/messaging.pb.go index 2b38973..ee2f8a9 100644 --- a/go/connectfour/v1/messaging.pb.go +++ b/go/connectfour/v1/messaging.pb.go @@ -257,7 +257,7 @@ func (*MakeMoveResponse) Descriptor() ([]byte, []int) { type GetGamesByPlayer struct { state protoimpl.MessageState `protogen:"open.v1"` PlayerId string `protobuf:"bytes,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"` - GameState string `protobuf:"bytes,2,opt,name=game_state,json=gameState,proto3" json:"game_state,omitempty"` // "all", "running", "won, "lost", "drawn" + State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` // "all", "running", "won, "lost", "drawn" Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` unknownFields protoimpl.UnknownFields @@ -301,9 +301,9 @@ func (x *GetGamesByPlayer) GetPlayerId() string { return "" } -func (x *GetGamesByPlayer) GetGameState() string { +func (x *GetGamesByPlayer) GetState() string { if x != nil { - return x.GameState + return x.State } return "" } @@ -523,11 +523,10 @@ const file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc = "" + "\agame_id\x18\x01 \x01(\tR\x06gameId\x12\x1b\n" + "\tplayer_id\x18\x02 \x01(\tR\bplayerId\x12\x16\n" + "\x06column\x18\x03 \x01(\x05R\x06column\"\x12\n" + - "\x10MakeMoveResponse\"x\n" + + "\x10MakeMoveResponse\"o\n" + "\x10GetGamesByPlayer\x12\x1b\n" + - "\tplayer_id\x18\x01 \x01(\tR\bplayerId\x12\x1d\n" + - "\n" + - "game_state\x18\x02 \x01(\tR\tgameState\x12\x12\n" + + "\tplayer_id\x18\x01 \x01(\tR\bplayerId\x12\x14\n" + + "\x05state\x18\x02 \x01(\tR\x05state\x12\x12\n" + "\x04page\x18\x03 \x01(\x05R\x04page\x12\x14\n" + "\x05limit\x18\x04 \x01(\x05R\x05limit\"o\n" + "\x18GetGamesByPlayerResponse\x12=\n" + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php index f6f6765..eb6e1ef 100644 --- a/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php +++ b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php @@ -20,9 +20,9 @@ class GetGamesByPlayer extends \Google\Protobuf\Internal\Message /** * "all", "running", "won, "lost", "drawn" * - * Generated from protobuf field string game_state = 2; + * Generated from protobuf field string state = 2; */ - protected $game_state = ''; + protected $state = ''; /** * Generated from protobuf field int32 page = 3; */ @@ -39,7 +39,7 @@ class GetGamesByPlayer extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $player_id - * @type string $game_state + * @type string $state * "all", "running", "won, "lost", "drawn" * @type int $page * @type int $limit @@ -75,25 +75,25 @@ public function setPlayerId($var) /** * "all", "running", "won, "lost", "drawn" * - * Generated from protobuf field string game_state = 2; + * Generated from protobuf field string state = 2; * @return string */ - public function getGameState() + public function getState() { - return $this->game_state; + return $this->state; } /** * "all", "running", "won, "lost", "drawn" * - * Generated from protobuf field string game_state = 2; + * Generated from protobuf field string state = 2; * @param string $var * @return $this */ - public function setGameState($var) + public function setState($var) { GPBUtil::checkString($var, True); - $this->game_state = $var; + $this->state = $var; return $this; } diff --git a/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php b/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php index e97b53aaea48bea1723d8ac15f24fa4c5aa9f0fc..dbe49d1480424199849d35d07b890626972cf5dc 100644 GIT binary patch delta 28 kcmX@ZeVlv4dq&32$sZU$Fa}P3$fU;1%f-5xpLs760H( Date: Thu, 4 Dec 2025 22:56:00 +0100 Subject: [PATCH 4/5] Add OpenGame --- go/connectfour/v1/gamingplatform.go | 13 + go/connectfour/v1/messaging.pb.go | 287 +++++++++++++++--- .../Api/ConnectFour/V1/ConnectFourV1.php | 110 +++++++ .../ConnectFour/V1/ConnectFourV1Factory.php | 31 ++ .../Api/ConnectFour/V1/OpenGame.php | 173 +++++++++++ .../Api/ConnectFour/V1/OpenGame/Stone.php | 61 ++++ .../Api/ConnectFour/V1/OpenGameResponse.php | 58 ++++ .../GPBMetadata/ConnectFour/V1/Messaging.php | Bin 1479 -> 1752 bytes .../api/connectfour/v1/messaging.proto | 18 ++ 9 files changed, 702 insertions(+), 49 deletions(-) create mode 100644 go/connectfour/v1/gamingplatform.go create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/OpenGame.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/OpenGame/Stone.php create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/OpenGameResponse.php diff --git a/go/connectfour/v1/gamingplatform.go b/go/connectfour/v1/gamingplatform.go new file mode 100644 index 0000000..6b6c15f --- /dev/null +++ b/go/connectfour/v1/gamingplatform.go @@ -0,0 +1,13 @@ +package connectfourv1 + +// This file is auto-generated. Do not edit! + +const GameType = "ConnectFour.Game.v1" +const GetGamesByPlayerType = "ConnectFour.GetGamesByPlayer.v1" +const GetGamesByPlayerResponseType = "ConnectFour.GetGamesByPlayerResponse.v1" +const JoinGameType = "ConnectFour.JoinGame.v1" +const JoinGameResponseType = "ConnectFour.JoinGameResponse.v1" +const MakeMoveType = "ConnectFour.MakeMove.v1" +const MakeMoveResponseType = "ConnectFour.MakeMoveResponse.v1" +const OpenGameType = "ConnectFour.OpenGame.v1" +const OpenGameResponseType = "ConnectFour.OpenGameResponse.v1" diff --git a/go/connectfour/v1/messaging.pb.go b/go/connectfour/v1/messaging.pb.go index ee2f8a9..d0d3d33 100644 --- a/go/connectfour/v1/messaging.pb.go +++ b/go/connectfour/v1/messaging.pb.go @@ -21,6 +21,58 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type OpenGame_Stone int32 + +const ( + OpenGame_STONE_UNSPECIFIED OpenGame_Stone = 0 + OpenGame_STONE_RED OpenGame_Stone = 1 + OpenGame_STONE_YELLOW OpenGame_Stone = 2 + OpenGame_STONE_RANDOM OpenGame_Stone = -1 +) + +// Enum value maps for OpenGame_Stone. +var ( + OpenGame_Stone_name = map[int32]string{ + 0: "STONE_UNSPECIFIED", + 1: "STONE_RED", + 2: "STONE_YELLOW", + -1: "STONE_RANDOM", + } + OpenGame_Stone_value = map[string]int32{ + "STONE_UNSPECIFIED": 0, + "STONE_RED": 1, + "STONE_YELLOW": 2, + "STONE_RANDOM": -1, + } +) + +func (x OpenGame_Stone) Enum() *OpenGame_Stone { + p := new(OpenGame_Stone) + *p = x + return p +} + +func (x OpenGame_Stone) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OpenGame_Stone) Descriptor() protoreflect.EnumDescriptor { + return file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[0].Descriptor() +} + +func (OpenGame_Stone) Type() protoreflect.EnumType { + return &file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[0] +} + +func (x OpenGame_Stone) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OpenGame_Stone.Descriptor instead. +func (OpenGame_Stone) EnumDescriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{0, 0} +} + type Game_Move_Color int32 const ( @@ -54,11 +106,11 @@ func (x Game_Move_Color) String() string { } func (Game_Move_Color) Descriptor() protoreflect.EnumDescriptor { - return file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[0].Descriptor() + return file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[1].Descriptor() } func (Game_Move_Color) Type() protoreflect.EnumType { - return &file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[0] + return &file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[1] } func (x Game_Move_Color) Number() protoreflect.EnumNumber { @@ -67,7 +119,127 @@ func (x Game_Move_Color) Number() protoreflect.EnumNumber { // Deprecated: Use Game_Move_Color.Descriptor instead. func (Game_Move_Color) EnumDescriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6, 0, 0} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{8, 0, 0} +} + +type OpenGame struct { + state protoimpl.MessageState `protogen:"open.v1"` + PlayerId string `protobuf:"bytes,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"` + Width int32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` + Height int32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + Stone OpenGame_Stone `protobuf:"varint,4,opt,name=stone,proto3,enum=gamingplatform.api.connectfour.v1.OpenGame_Stone" json:"stone,omitempty"` + Timer string `protobuf:"bytes,5,opt,name=timer,proto3" json:"timer,omitempty"` // "move:15000", "game:60000:0", "game:60000:3000" + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpenGame) Reset() { + *x = OpenGame{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpenGame) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpenGame) ProtoMessage() {} + +func (x *OpenGame) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpenGame.ProtoReflect.Descriptor instead. +func (*OpenGame) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{0} +} + +func (x *OpenGame) GetPlayerId() string { + if x != nil { + return x.PlayerId + } + return "" +} + +func (x *OpenGame) GetWidth() int32 { + if x != nil { + return x.Width + } + return 0 +} + +func (x *OpenGame) GetHeight() int32 { + if x != nil { + return x.Height + } + return 0 +} + +func (x *OpenGame) GetStone() OpenGame_Stone { + if x != nil { + return x.Stone + } + return OpenGame_STONE_UNSPECIFIED +} + +func (x *OpenGame) GetTimer() string { + if x != nil { + return x.Timer + } + return "" +} + +type OpenGameResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + GameId string `protobuf:"bytes,1,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OpenGameResponse) Reset() { + *x = OpenGameResponse{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OpenGameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpenGameResponse) ProtoMessage() {} + +func (x *OpenGameResponse) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpenGameResponse.ProtoReflect.Descriptor instead. +func (*OpenGameResponse) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{1} +} + +func (x *OpenGameResponse) GetGameId() string { + if x != nil { + return x.GameId + } + return "" } type JoinGame struct { @@ -80,7 +252,7 @@ type JoinGame struct { func (x *JoinGame) Reset() { *x = JoinGame{} - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[0] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92,7 +264,7 @@ func (x *JoinGame) String() string { func (*JoinGame) ProtoMessage() {} func (x *JoinGame) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[0] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105,7 +277,7 @@ func (x *JoinGame) ProtoReflect() protoreflect.Message { // Deprecated: Use JoinGame.ProtoReflect.Descriptor instead. func (*JoinGame) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{0} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{2} } func (x *JoinGame) GetGameId() string { @@ -130,7 +302,7 @@ type JoinGameResponse struct { func (x *JoinGameResponse) Reset() { *x = JoinGameResponse{} - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[1] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -142,7 +314,7 @@ func (x *JoinGameResponse) String() string { func (*JoinGameResponse) ProtoMessage() {} func (x *JoinGameResponse) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[1] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -155,7 +327,7 @@ func (x *JoinGameResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use JoinGameResponse.ProtoReflect.Descriptor instead. func (*JoinGameResponse) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{1} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{3} } type MakeMove struct { @@ -169,7 +341,7 @@ type MakeMove struct { func (x *MakeMove) Reset() { *x = MakeMove{} - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[2] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -181,7 +353,7 @@ func (x *MakeMove) String() string { func (*MakeMove) ProtoMessage() {} func (x *MakeMove) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[2] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -194,7 +366,7 @@ func (x *MakeMove) ProtoReflect() protoreflect.Message { // Deprecated: Use MakeMove.ProtoReflect.Descriptor instead. func (*MakeMove) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{2} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{4} } func (x *MakeMove) GetGameId() string { @@ -226,7 +398,7 @@ type MakeMoveResponse struct { func (x *MakeMoveResponse) Reset() { *x = MakeMoveResponse{} - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[3] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -238,7 +410,7 @@ func (x *MakeMoveResponse) String() string { func (*MakeMoveResponse) ProtoMessage() {} func (x *MakeMoveResponse) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[3] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -251,7 +423,7 @@ func (x *MakeMoveResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use MakeMoveResponse.ProtoReflect.Descriptor instead. func (*MakeMoveResponse) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{3} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{5} } type GetGamesByPlayer struct { @@ -266,7 +438,7 @@ type GetGamesByPlayer struct { func (x *GetGamesByPlayer) Reset() { *x = GetGamesByPlayer{} - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[4] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -278,7 +450,7 @@ func (x *GetGamesByPlayer) String() string { func (*GetGamesByPlayer) ProtoMessage() {} func (x *GetGamesByPlayer) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[4] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -291,7 +463,7 @@ func (x *GetGamesByPlayer) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGamesByPlayer.ProtoReflect.Descriptor instead. func (*GetGamesByPlayer) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{4} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6} } func (x *GetGamesByPlayer) GetPlayerId() string { @@ -332,7 +504,7 @@ type GetGamesByPlayerResponse struct { func (x *GetGamesByPlayerResponse) Reset() { *x = GetGamesByPlayerResponse{} - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[5] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -344,7 +516,7 @@ func (x *GetGamesByPlayerResponse) String() string { func (*GetGamesByPlayerResponse) ProtoMessage() {} func (x *GetGamesByPlayerResponse) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[5] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -357,7 +529,7 @@ func (x *GetGamesByPlayerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGamesByPlayerResponse.ProtoReflect.Descriptor instead. func (*GetGamesByPlayerResponse) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{5} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{7} } func (x *GetGamesByPlayerResponse) GetGames() []*Game { @@ -387,7 +559,7 @@ type Game struct { func (x *Game) Reset() { *x = Game{} - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[6] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -399,7 +571,7 @@ func (x *Game) String() string { func (*Game) ProtoMessage() {} func (x *Game) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[6] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -412,7 +584,7 @@ func (x *Game) ProtoReflect() protoreflect.Message { // Deprecated: Use Game.ProtoReflect.Descriptor instead. func (*Game) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{8} } func (x *Game) GetGameId() string { @@ -461,7 +633,7 @@ type Game_Move struct { func (x *Game_Move) Reset() { *x = Game_Move{} - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[7] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -473,7 +645,7 @@ func (x *Game_Move) String() string { func (*Game_Move) ProtoMessage() {} func (x *Game_Move) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[7] + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -486,7 +658,7 @@ func (x *Game_Move) ProtoReflect() protoreflect.Message { // Deprecated: Use Game_Move.ProtoReflect.Descriptor instead. func (*Game_Move) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6, 0} + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{8, 0} } func (x *Game_Move) GetX() int32 { @@ -514,7 +686,20 @@ var File_gamingplatform_api_connectfour_v1_messaging_proto protoreflect.FileDesc const file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc = "" + "\n" + - "1gamingplatform/api/connectfour/v1/messaging.proto\x12!gamingplatform.api.connectfour.v1\"@\n" + + "1gamingplatform/api/connectfour/v1/messaging.proto\x12!gamingplatform.api.connectfour.v1\"\x90\x02\n" + + "\bOpenGame\x12\x1b\n" + + "\tplayer_id\x18\x01 \x01(\tR\bplayerId\x12\x14\n" + + "\x05width\x18\x02 \x01(\x05R\x05width\x12\x16\n" + + "\x06height\x18\x03 \x01(\x05R\x06height\x12G\n" + + "\x05stone\x18\x04 \x01(\x0e21.gamingplatform.api.connectfour.v1.OpenGame.StoneR\x05stone\x12\x14\n" + + "\x05timer\x18\x05 \x01(\tR\x05timer\"Z\n" + + "\x05Stone\x12\x15\n" + + "\x11STONE_UNSPECIFIED\x10\x00\x12\r\n" + + "\tSTONE_RED\x10\x01\x12\x10\n" + + "\fSTONE_YELLOW\x10\x02\x12\x19\n" + + "\fSTONE_RANDOM\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\"+\n" + + "\x10OpenGameResponse\x12\x17\n" + + "\agame_id\x18\x01 \x01(\tR\x06gameId\"@\n" + "\bJoinGame\x12\x17\n" + "\agame_id\x18\x01 \x01(\tR\x06gameId\x12\x1b\n" + "\tplayer_id\x18\x02 \x01(\tR\bplayerId\"\x12\n" + @@ -559,28 +744,32 @@ func file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP() []byte return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescData } -var file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_gamingplatform_api_connectfour_v1_messaging_proto_goTypes = []any{ - (Game_Move_Color)(0), // 0: gamingplatform.api.connectfour.v1.Game.Move.Color - (*JoinGame)(nil), // 1: gamingplatform.api.connectfour.v1.JoinGame - (*JoinGameResponse)(nil), // 2: gamingplatform.api.connectfour.v1.JoinGameResponse - (*MakeMove)(nil), // 3: gamingplatform.api.connectfour.v1.MakeMove - (*MakeMoveResponse)(nil), // 4: gamingplatform.api.connectfour.v1.MakeMoveResponse - (*GetGamesByPlayer)(nil), // 5: gamingplatform.api.connectfour.v1.GetGamesByPlayer - (*GetGamesByPlayerResponse)(nil), // 6: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse - (*Game)(nil), // 7: gamingplatform.api.connectfour.v1.Game - (*Game_Move)(nil), // 8: gamingplatform.api.connectfour.v1.Game.Move + (OpenGame_Stone)(0), // 0: gamingplatform.api.connectfour.v1.OpenGame.Stone + (Game_Move_Color)(0), // 1: gamingplatform.api.connectfour.v1.Game.Move.Color + (*OpenGame)(nil), // 2: gamingplatform.api.connectfour.v1.OpenGame + (*OpenGameResponse)(nil), // 3: gamingplatform.api.connectfour.v1.OpenGameResponse + (*JoinGame)(nil), // 4: gamingplatform.api.connectfour.v1.JoinGame + (*JoinGameResponse)(nil), // 5: gamingplatform.api.connectfour.v1.JoinGameResponse + (*MakeMove)(nil), // 6: gamingplatform.api.connectfour.v1.MakeMove + (*MakeMoveResponse)(nil), // 7: gamingplatform.api.connectfour.v1.MakeMoveResponse + (*GetGamesByPlayer)(nil), // 8: gamingplatform.api.connectfour.v1.GetGamesByPlayer + (*GetGamesByPlayerResponse)(nil), // 9: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse + (*Game)(nil), // 10: gamingplatform.api.connectfour.v1.Game + (*Game_Move)(nil), // 11: gamingplatform.api.connectfour.v1.Game.Move } var file_gamingplatform_api_connectfour_v1_messaging_proto_depIdxs = []int32{ - 7, // 0: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse.games:type_name -> gamingplatform.api.connectfour.v1.Game - 8, // 1: gamingplatform.api.connectfour.v1.Game.moves:type_name -> gamingplatform.api.connectfour.v1.Game.Move - 0, // 2: gamingplatform.api.connectfour.v1.Game.Move.color:type_name -> gamingplatform.api.connectfour.v1.Game.Move.Color - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 0, // 0: gamingplatform.api.connectfour.v1.OpenGame.stone:type_name -> gamingplatform.api.connectfour.v1.OpenGame.Stone + 10, // 1: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse.games:type_name -> gamingplatform.api.connectfour.v1.Game + 11, // 2: gamingplatform.api.connectfour.v1.Game.moves:type_name -> gamingplatform.api.connectfour.v1.Game.Move + 1, // 3: gamingplatform.api.connectfour.v1.Game.Move.color:type_name -> gamingplatform.api.connectfour.v1.Game.Move.Color + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_gamingplatform_api_connectfour_v1_messaging_proto_init() } @@ -593,8 +782,8 @@ func file_gamingplatform_api_connectfour_v1_messaging_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc), len(file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc)), - NumEnums: 1, - NumMessages: 8, + NumEnums: 2, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1.php b/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1.php new file mode 100644 index 0000000..94fe9e2 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1.php @@ -0,0 +1,110 @@ +mergeFromString($data); + return $message; + } + public const string GameType = 'ConnectFour.Game.v1'; + public static function createGame( + ?string $data = null + ): Game { + static $template; + $template ??= new Game(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string GetGamesByPlayerType = 'ConnectFour.GetGamesByPlayer.v1'; + public static function createGetGamesByPlayer( + ?string $data = null + ): GetGamesByPlayer { + static $template; + $template ??= new GetGamesByPlayer(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string GetGamesByPlayerResponseType = 'ConnectFour.GetGamesByPlayerResponse.v1'; + public static function createGetGamesByPlayerResponse( + ?string $data = null + ): GetGamesByPlayerResponse { + static $template; + $template ??= new GetGamesByPlayerResponse(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string JoinGameType = 'ConnectFour.JoinGame.v1'; + public static function createJoinGame( + ?string $data = null + ): JoinGame { + static $template; + $template ??= new JoinGame(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string JoinGameResponseType = 'ConnectFour.JoinGameResponse.v1'; + public static function createJoinGameResponse( + ?string $data = null + ): JoinGameResponse { + static $template; + $template ??= new JoinGameResponse(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string MakeMoveType = 'ConnectFour.MakeMove.v1'; + public static function createMakeMove( + ?string $data = null + ): MakeMove { + static $template; + $template ??= new MakeMove(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string MakeMoveResponseType = 'ConnectFour.MakeMoveResponse.v1'; + public static function createMakeMoveResponse( + ?string $data = null + ): MakeMoveResponse { + static $template; + $template ??= new MakeMoveResponse(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string OpenGameType = 'ConnectFour.OpenGame.v1'; + public static function createOpenGame( + ?string $data = null + ): OpenGame { + static $template; + $template ??= new OpenGame(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string OpenGameResponseType = 'ConnectFour.OpenGameResponse.v1'; + public static function createOpenGameResponse( + ?string $data = null + ): OpenGameResponse { + static $template; + $template ??= new OpenGameResponse(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } +} diff --git a/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php b/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php index 99e8c68..fecd043 100644 --- a/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php +++ b/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php @@ -6,8 +6,10 @@ // This file is auto-generated. Do not edit! +/** @deprecated */ final class ConnectFourV1Factory { + /** @deprecated */ public static function createGame_Move( string $data ): \GamingPlatform\Api\ConnectFour\V1\Game\Move { @@ -18,6 +20,7 @@ public static function createGame_Move( return $message; } + /** @deprecated */ public static function createGame( string $data ): \GamingPlatform\Api\ConnectFour\V1\Game { @@ -28,6 +31,7 @@ public static function createGame( return $message; } + /** @deprecated */ public static function createGetGamesByPlayer( string $data ): \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayer { @@ -38,6 +42,7 @@ public static function createGetGamesByPlayer( return $message; } + /** @deprecated */ public static function createGetGamesByPlayerResponse( string $data ): \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayerResponse { @@ -48,6 +53,7 @@ public static function createGetGamesByPlayerResponse( return $message; } + /** @deprecated */ public static function createJoinGame( string $data ): \GamingPlatform\Api\ConnectFour\V1\JoinGame { @@ -58,6 +64,7 @@ public static function createJoinGame( return $message; } + /** @deprecated */ public static function createJoinGameResponse( string $data ): \GamingPlatform\Api\ConnectFour\V1\JoinGameResponse { @@ -68,6 +75,7 @@ public static function createJoinGameResponse( return $message; } + /** @deprecated */ public static function createMakeMove( string $data ): \GamingPlatform\Api\ConnectFour\V1\MakeMove { @@ -78,6 +86,7 @@ public static function createMakeMove( return $message; } + /** @deprecated */ public static function createMakeMoveResponse( string $data ): \GamingPlatform\Api\ConnectFour\V1\MakeMoveResponse { @@ -88,4 +97,26 @@ public static function createMakeMoveResponse( return $message; } + /** @deprecated */ + public static function createOpenGame( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\OpenGame { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\OpenGame(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + + /** @deprecated */ + public static function createOpenGameResponse( + string $data + ): \GamingPlatform\Api\ConnectFour\V1\OpenGameResponse { + static $template; + $template ??= new \GamingPlatform\Api\ConnectFour\V1\OpenGameResponse(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + } diff --git a/php/GamingPlatform/Api/ConnectFour/V1/OpenGame.php b/php/GamingPlatform/Api/ConnectFour/V1/OpenGame.php new file mode 100644 index 0000000..ffaaa75 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/OpenGame.php @@ -0,0 +1,173 @@ +gamingplatform.api.connectfour.v1.OpenGame + */ +class OpenGame extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string player_id = 1; + */ + protected $player_id = ''; + /** + * Generated from protobuf field int32 width = 2; + */ + protected $width = 0; + /** + * Generated from protobuf field int32 height = 3; + */ + protected $height = 0; + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.OpenGame.Stone stone = 4; + */ + protected $stone = 0; + /** + * "move:15000", "game:60000:0", "game:60000:3000" + * + * Generated from protobuf field string timer = 5; + */ + protected $timer = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $player_id + * @type int $width + * @type int $height + * @type int $stone + * @type string $timer + * "move:15000", "game:60000:0", "game:60000:3000" + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string player_id = 1; + * @return string + */ + public function getPlayerId() + { + return $this->player_id; + } + + /** + * Generated from protobuf field string player_id = 1; + * @param string $var + * @return $this + */ + public function setPlayerId($var) + { + GPBUtil::checkString($var, True); + $this->player_id = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 width = 2; + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Generated from protobuf field int32 width = 2; + * @param int $var + * @return $this + */ + public function setWidth($var) + { + GPBUtil::checkInt32($var); + $this->width = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 height = 3; + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * Generated from protobuf field int32 height = 3; + * @param int $var + * @return $this + */ + public function setHeight($var) + { + GPBUtil::checkInt32($var); + $this->height = $var; + + return $this; + } + + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.OpenGame.Stone stone = 4; + * @return int + */ + public function getStone() + { + return $this->stone; + } + + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.OpenGame.Stone stone = 4; + * @param int $var + * @return $this + */ + public function setStone($var) + { + GPBUtil::checkEnum($var, \GamingPlatform\Api\ConnectFour\V1\OpenGame\Stone::class); + $this->stone = $var; + + return $this; + } + + /** + * "move:15000", "game:60000:0", "game:60000:3000" + * + * Generated from protobuf field string timer = 5; + * @return string + */ + public function getTimer() + { + return $this->timer; + } + + /** + * "move:15000", "game:60000:0", "game:60000:3000" + * + * Generated from protobuf field string timer = 5; + * @param string $var + * @return $this + */ + public function setTimer($var) + { + GPBUtil::checkString($var, True); + $this->timer = $var; + + return $this; + } + +} + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/OpenGame/Stone.php b/php/GamingPlatform/Api/ConnectFour/V1/OpenGame/Stone.php new file mode 100644 index 0000000..48149bc --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/OpenGame/Stone.php @@ -0,0 +1,61 @@ +gamingplatform.api.connectfour.v1.OpenGame.Stone + */ +class Stone +{ + /** + * Generated from protobuf enum STONE_UNSPECIFIED = 0; + */ + const STONE_UNSPECIFIED = 0; + /** + * Generated from protobuf enum STONE_RED = 1; + */ + const STONE_RED = 1; + /** + * Generated from protobuf enum STONE_YELLOW = 2; + */ + const STONE_YELLOW = 2; + /** + * Generated from protobuf enum STONE_RANDOM = -1; + */ + const STONE_RANDOM = -1; + + private static $valueToName = [ + self::STONE_UNSPECIFIED => 'STONE_UNSPECIFIED', + self::STONE_RED => 'STONE_RED', + self::STONE_YELLOW => 'STONE_YELLOW', + self::STONE_RANDOM => 'STONE_RANDOM', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Stone::class, \GamingPlatform\Api\ConnectFour\V1\OpenGame_Stone::class); + diff --git a/php/GamingPlatform/Api/ConnectFour/V1/OpenGameResponse.php b/php/GamingPlatform/Api/ConnectFour/V1/OpenGameResponse.php new file mode 100644 index 0000000..14d9271 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/OpenGameResponse.php @@ -0,0 +1,58 @@ +gamingplatform.api.connectfour.v1.OpenGameResponse + */ +class OpenGameResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string game_id = 1; + */ + protected $game_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $game_id + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\ConnectFour\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string game_id = 1; + * @return string + */ + public function getGameId() + { + return $this->game_id; + } + + /** + * Generated from protobuf field string game_id = 1; + * @param string $var + * @return $this + */ + public function setGameId($var) + { + GPBUtil::checkString($var, True); + $this->game_id = $var; + + return $this; + } + +} + diff --git a/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php b/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php index dbe49d1480424199849d35d07b890626972cf5dc..14a5d7ba49e718df35b22a6c6a08932864746d3b 100644 GIT binary patch delta 263 zcmX@keS>$ydq$>NoRdE?hWo!{Ik%uN*%assn*JC_Q@X^!#77V*E0hEQB4O| diff --git a/schema/gamingplatform/api/connectfour/v1/messaging.proto b/schema/gamingplatform/api/connectfour/v1/messaging.proto index 7acbae6..7ad1f61 100644 --- a/schema/gamingplatform/api/connectfour/v1/messaging.proto +++ b/schema/gamingplatform/api/connectfour/v1/messaging.proto @@ -6,6 +6,24 @@ option go_package = "github.com/gaming-platform/api/go/connectfour/v1;connectfou option php_namespace = "GamingPlatform\\Api\\ConnectFour\\V1"; option php_metadata_namespace = "GamingPlatform\\Api\\GPBMetadata\\ConnectFour\\V1"; +message OpenGame { + enum Stone { + STONE_UNSPECIFIED = 0; + STONE_RED = 1; + STONE_YELLOW = 2; + STONE_RANDOM = -1; + } + string player_id = 1; + int32 width = 2; + int32 height = 3; + Stone stone = 4; + string timer = 5; // "move:15000", "game:60000:0", "game:60000:3000" +} + +message OpenGameResponse { + string game_id = 1; +} + message JoinGame { string game_id = 1; string player_id = 2; From 121916d2a127d8e9d1f98c69757bd30b7177e95e Mon Sep 17 00:00:00 2001 From: Markus Reinhold Date: Mon, 8 Dec 2025 22:52:37 +0100 Subject: [PATCH 5/5] GetGamesByPlayer.State as enum --- go/connectfour/v1/messaging.pb.go | 133 ++++++++++++++---- .../Api/ConnectFour/V1/GetGamesByPlayer.php | 23 ++- .../ConnectFour/V1/GetGamesByPlayer/State.php | 76 ++++++++++ .../GPBMetadata/ConnectFour/V1/Messaging.php | Bin 1752 -> 1943 bytes .../api/connectfour/v1/messaging.proto | 11 +- 5 files changed, 197 insertions(+), 46 deletions(-) create mode 100644 php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer/State.php diff --git a/go/connectfour/v1/messaging.pb.go b/go/connectfour/v1/messaging.pb.go index d0d3d33..78561d0 100644 --- a/go/connectfour/v1/messaging.pb.go +++ b/go/connectfour/v1/messaging.pb.go @@ -73,6 +73,67 @@ func (OpenGame_Stone) EnumDescriptor() ([]byte, []int) { return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{0, 0} } +type GetGamesByPlayer_State int32 + +const ( + GetGamesByPlayer_STATE_UNSPECIFIED GetGamesByPlayer_State = 0 + GetGamesByPlayer_STATE_ALL GetGamesByPlayer_State = 1 + GetGamesByPlayer_STATE_OPEN GetGamesByPlayer_State = 2 + GetGamesByPlayer_STATE_RUNNING GetGamesByPlayer_State = 3 + GetGamesByPlayer_STATE_WON GetGamesByPlayer_State = 4 + GetGamesByPlayer_STATE_LOST GetGamesByPlayer_State = 5 + GetGamesByPlayer_STATE_DRAWN GetGamesByPlayer_State = 6 +) + +// Enum value maps for GetGamesByPlayer_State. +var ( + GetGamesByPlayer_State_name = map[int32]string{ + 0: "STATE_UNSPECIFIED", + 1: "STATE_ALL", + 2: "STATE_OPEN", + 3: "STATE_RUNNING", + 4: "STATE_WON", + 5: "STATE_LOST", + 6: "STATE_DRAWN", + } + GetGamesByPlayer_State_value = map[string]int32{ + "STATE_UNSPECIFIED": 0, + "STATE_ALL": 1, + "STATE_OPEN": 2, + "STATE_RUNNING": 3, + "STATE_WON": 4, + "STATE_LOST": 5, + "STATE_DRAWN": 6, + } +) + +func (x GetGamesByPlayer_State) Enum() *GetGamesByPlayer_State { + p := new(GetGamesByPlayer_State) + *p = x + return p +} + +func (x GetGamesByPlayer_State) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GetGamesByPlayer_State) Descriptor() protoreflect.EnumDescriptor { + return file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[1].Descriptor() +} + +func (GetGamesByPlayer_State) Type() protoreflect.EnumType { + return &file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[1] +} + +func (x GetGamesByPlayer_State) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GetGamesByPlayer_State.Descriptor instead. +func (GetGamesByPlayer_State) EnumDescriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6, 0} +} + type Game_Move_Color int32 const ( @@ -106,11 +167,11 @@ func (x Game_Move_Color) String() string { } func (Game_Move_Color) Descriptor() protoreflect.EnumDescriptor { - return file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[1].Descriptor() + return file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[2].Descriptor() } func (Game_Move_Color) Type() protoreflect.EnumType { - return &file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[1] + return &file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[2] } func (x Game_Move_Color) Number() protoreflect.EnumNumber { @@ -429,7 +490,7 @@ func (*MakeMoveResponse) Descriptor() ([]byte, []int) { type GetGamesByPlayer struct { state protoimpl.MessageState `protogen:"open.v1"` PlayerId string `protobuf:"bytes,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"` - State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` // "all", "running", "won, "lost", "drawn" + State GetGamesByPlayer_State `protobuf:"varint,2,opt,name=state,proto3,enum=gamingplatform.api.connectfour.v1.GetGamesByPlayer_State" json:"state,omitempty"` Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` unknownFields protoimpl.UnknownFields @@ -473,11 +534,11 @@ func (x *GetGamesByPlayer) GetPlayerId() string { return "" } -func (x *GetGamesByPlayer) GetState() string { +func (x *GetGamesByPlayer) GetState() GetGamesByPlayer_State { if x != nil { return x.State } - return "" + return GetGamesByPlayer_STATE_UNSPECIFIED } func (x *GetGamesByPlayer) GetPage() int32 { @@ -708,12 +769,22 @@ const file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc = "" + "\agame_id\x18\x01 \x01(\tR\x06gameId\x12\x1b\n" + "\tplayer_id\x18\x02 \x01(\tR\bplayerId\x12\x16\n" + "\x06column\x18\x03 \x01(\x05R\x06column\"\x12\n" + - "\x10MakeMoveResponse\"o\n" + + "\x10MakeMoveResponse\"\xad\x02\n" + "\x10GetGamesByPlayer\x12\x1b\n" + - "\tplayer_id\x18\x01 \x01(\tR\bplayerId\x12\x14\n" + - "\x05state\x18\x02 \x01(\tR\x05state\x12\x12\n" + + "\tplayer_id\x18\x01 \x01(\tR\bplayerId\x12O\n" + + "\x05state\x18\x02 \x01(\x0e29.gamingplatform.api.connectfour.v1.GetGamesByPlayer.StateR\x05state\x12\x12\n" + "\x04page\x18\x03 \x01(\x05R\x04page\x12\x14\n" + - "\x05limit\x18\x04 \x01(\x05R\x05limit\"o\n" + + "\x05limit\x18\x04 \x01(\x05R\x05limit\"\x80\x01\n" + + "\x05State\x12\x15\n" + + "\x11STATE_UNSPECIFIED\x10\x00\x12\r\n" + + "\tSTATE_ALL\x10\x01\x12\x0e\n" + + "\n" + + "STATE_OPEN\x10\x02\x12\x11\n" + + "\rSTATE_RUNNING\x10\x03\x12\r\n" + + "\tSTATE_WON\x10\x04\x12\x0e\n" + + "\n" + + "STATE_LOST\x10\x05\x12\x0f\n" + + "\vSTATE_DRAWN\x10\x06\"o\n" + "\x18GetGamesByPlayerResponse\x12=\n" + "\x05games\x18\x01 \x03(\v2'.gamingplatform.api.connectfour.v1.GameR\x05games\x12\x14\n" + "\x05total\x18\x02 \x01(\x05R\x05total\"\x8d\x03\n" + @@ -744,32 +815,34 @@ func file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP() []byte return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescData } -var file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_gamingplatform_api_connectfour_v1_messaging_proto_goTypes = []any{ (OpenGame_Stone)(0), // 0: gamingplatform.api.connectfour.v1.OpenGame.Stone - (Game_Move_Color)(0), // 1: gamingplatform.api.connectfour.v1.Game.Move.Color - (*OpenGame)(nil), // 2: gamingplatform.api.connectfour.v1.OpenGame - (*OpenGameResponse)(nil), // 3: gamingplatform.api.connectfour.v1.OpenGameResponse - (*JoinGame)(nil), // 4: gamingplatform.api.connectfour.v1.JoinGame - (*JoinGameResponse)(nil), // 5: gamingplatform.api.connectfour.v1.JoinGameResponse - (*MakeMove)(nil), // 6: gamingplatform.api.connectfour.v1.MakeMove - (*MakeMoveResponse)(nil), // 7: gamingplatform.api.connectfour.v1.MakeMoveResponse - (*GetGamesByPlayer)(nil), // 8: gamingplatform.api.connectfour.v1.GetGamesByPlayer - (*GetGamesByPlayerResponse)(nil), // 9: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse - (*Game)(nil), // 10: gamingplatform.api.connectfour.v1.Game - (*Game_Move)(nil), // 11: gamingplatform.api.connectfour.v1.Game.Move + (GetGamesByPlayer_State)(0), // 1: gamingplatform.api.connectfour.v1.GetGamesByPlayer.State + (Game_Move_Color)(0), // 2: gamingplatform.api.connectfour.v1.Game.Move.Color + (*OpenGame)(nil), // 3: gamingplatform.api.connectfour.v1.OpenGame + (*OpenGameResponse)(nil), // 4: gamingplatform.api.connectfour.v1.OpenGameResponse + (*JoinGame)(nil), // 5: gamingplatform.api.connectfour.v1.JoinGame + (*JoinGameResponse)(nil), // 6: gamingplatform.api.connectfour.v1.JoinGameResponse + (*MakeMove)(nil), // 7: gamingplatform.api.connectfour.v1.MakeMove + (*MakeMoveResponse)(nil), // 8: gamingplatform.api.connectfour.v1.MakeMoveResponse + (*GetGamesByPlayer)(nil), // 9: gamingplatform.api.connectfour.v1.GetGamesByPlayer + (*GetGamesByPlayerResponse)(nil), // 10: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse + (*Game)(nil), // 11: gamingplatform.api.connectfour.v1.Game + (*Game_Move)(nil), // 12: gamingplatform.api.connectfour.v1.Game.Move } var file_gamingplatform_api_connectfour_v1_messaging_proto_depIdxs = []int32{ 0, // 0: gamingplatform.api.connectfour.v1.OpenGame.stone:type_name -> gamingplatform.api.connectfour.v1.OpenGame.Stone - 10, // 1: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse.games:type_name -> gamingplatform.api.connectfour.v1.Game - 11, // 2: gamingplatform.api.connectfour.v1.Game.moves:type_name -> gamingplatform.api.connectfour.v1.Game.Move - 1, // 3: gamingplatform.api.connectfour.v1.Game.Move.color:type_name -> gamingplatform.api.connectfour.v1.Game.Move.Color - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 1, // 1: gamingplatform.api.connectfour.v1.GetGamesByPlayer.state:type_name -> gamingplatform.api.connectfour.v1.GetGamesByPlayer.State + 11, // 2: gamingplatform.api.connectfour.v1.GetGamesByPlayerResponse.games:type_name -> gamingplatform.api.connectfour.v1.Game + 12, // 3: gamingplatform.api.connectfour.v1.Game.moves:type_name -> gamingplatform.api.connectfour.v1.Game.Move + 2, // 4: gamingplatform.api.connectfour.v1.Game.Move.color:type_name -> gamingplatform.api.connectfour.v1.Game.Move.Color + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_gamingplatform_api_connectfour_v1_messaging_proto_init() } @@ -782,7 +855,7 @@ func file_gamingplatform_api_connectfour_v1_messaging_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc), len(file_gamingplatform_api_connectfour_v1_messaging_proto_rawDesc)), - NumEnums: 2, + NumEnums: 3, NumMessages: 10, NumExtensions: 0, NumServices: 0, diff --git a/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php index eb6e1ef..50d6ad7 100644 --- a/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php +++ b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php @@ -18,11 +18,9 @@ class GetGamesByPlayer extends \Google\Protobuf\Internal\Message */ protected $player_id = ''; /** - * "all", "running", "won, "lost", "drawn" - * - * Generated from protobuf field string state = 2; + * Generated from protobuf field .gamingplatform.api.connectfour.v1.GetGamesByPlayer.State state = 2; */ - protected $state = ''; + protected $state = 0; /** * Generated from protobuf field int32 page = 3; */ @@ -39,8 +37,7 @@ class GetGamesByPlayer extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $player_id - * @type string $state - * "all", "running", "won, "lost", "drawn" + * @type int $state * @type int $page * @type int $limit * } @@ -73,10 +70,8 @@ public function setPlayerId($var) } /** - * "all", "running", "won, "lost", "drawn" - * - * Generated from protobuf field string state = 2; - * @return string + * Generated from protobuf field .gamingplatform.api.connectfour.v1.GetGamesByPlayer.State state = 2; + * @return int */ public function getState() { @@ -84,15 +79,13 @@ public function getState() } /** - * "all", "running", "won, "lost", "drawn" - * - * Generated from protobuf field string state = 2; - * @param string $var + * Generated from protobuf field .gamingplatform.api.connectfour.v1.GetGamesByPlayer.State state = 2; + * @param int $var * @return $this */ public function setState($var) { - GPBUtil::checkString($var, True); + GPBUtil::checkEnum($var, \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayer\State::class); $this->state = $var; return $this; diff --git a/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer/State.php b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer/State.php new file mode 100644 index 0000000..2187169 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer/State.php @@ -0,0 +1,76 @@ +gamingplatform.api.connectfour.v1.GetGamesByPlayer.State + */ +class State +{ + /** + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Generated from protobuf enum STATE_ALL = 1; + */ + const STATE_ALL = 1; + /** + * Generated from protobuf enum STATE_OPEN = 2; + */ + const STATE_OPEN = 2; + /** + * Generated from protobuf enum STATE_RUNNING = 3; + */ + const STATE_RUNNING = 3; + /** + * Generated from protobuf enum STATE_WON = 4; + */ + const STATE_WON = 4; + /** + * Generated from protobuf enum STATE_LOST = 5; + */ + const STATE_LOST = 5; + /** + * Generated from protobuf enum STATE_DRAWN = 6; + */ + const STATE_DRAWN = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::STATE_ALL => 'STATE_ALL', + self::STATE_OPEN => 'STATE_OPEN', + self::STATE_RUNNING => 'STATE_RUNNING', + self::STATE_WON => 'STATE_WON', + self::STATE_LOST => 'STATE_LOST', + self::STATE_DRAWN => 'STATE_DRAWN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayer_State::class); + diff --git a/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php b/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php index 14a5d7ba49e718df35b22a6c6a08932864746d3b..23572b0ac470aede34a8f600b61c18e3a3be4807 100644 GIT binary patch delta 205 zcmcb?JDq>Sdq$?4T#G+4GBNctP5#8JCg8!vT3nJ?k}AQZz^K7zWI4HzMMX5V#62-L zwb-dLASbahwMZ`*q++rfi(GvJBNr=}CnU-x7#!jl;u;_77aZW~?CIv|>LS1(#LLAA z5q9+P5nvSJNoQpp)GBE~D{>-eV&CA7FT#{IlD#4_{sKF`3!^KjNn4T)Z4CJv2 U0VQ)Xb2CdMSU}v(OsrFx0G@LYcK`qY diff --git a/schema/gamingplatform/api/connectfour/v1/messaging.proto b/schema/gamingplatform/api/connectfour/v1/messaging.proto index 7ad1f61..1c049da 100644 --- a/schema/gamingplatform/api/connectfour/v1/messaging.proto +++ b/schema/gamingplatform/api/connectfour/v1/messaging.proto @@ -42,8 +42,17 @@ message MakeMoveResponse { } message GetGamesByPlayer { + enum State { + STATE_UNSPECIFIED = 0; + STATE_ALL = 1; + STATE_OPEN = 2; + STATE_RUNNING = 3; + STATE_WON = 4; + STATE_LOST = 5; + STATE_DRAWN = 6; + } string player_id = 1; - string state = 2; // "all", "running", "won, "lost", "drawn" + State state = 2; int32 page = 3; int32 limit = 4; }