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 new file mode 100644 index 0000000..78561d0 --- /dev/null +++ b/go/connectfour/v1/messaging.pb.go @@ -0,0 +1,871 @@ +// 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 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 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 ( + Game_Move_COLOR_UNSPECIFIED Game_Move_Color = 0 + 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: "COLOR_RED", + 2: "COLOR_YELLOW", + } + Game_Move_Color_value = map[string]int32{ + "COLOR_UNSPECIFIED": 0, + "COLOR_RED": 1, + "COLOR_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[2].Descriptor() +} + +func (Game_Move_Color) Type() protoreflect.EnumType { + return &file_gamingplatform_api_connectfour_v1_messaging_proto_enumTypes[2] +} + +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{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 { + 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[2] + 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[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 JoinGame.ProtoReflect.Descriptor instead. +func (*JoinGame) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{2} +} + +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[3] + 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[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 JoinGameResponse.ProtoReflect.Descriptor instead. +func (*JoinGameResponse) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{3} +} + +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[4] + 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[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 MakeMove.ProtoReflect.Descriptor instead. +func (*MakeMove) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{4} +} + +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[5] + 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[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 MakeMoveResponse.ProtoReflect.Descriptor instead. +func (*MakeMoveResponse) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{5} +} + +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 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 + sizeCache protoimpl.SizeCache +} + +func (x *GetGamesByPlayer) Reset() { + *x = GetGamesByPlayer{} + mi := &file_gamingplatform_api_connectfour_v1_messaging_proto_msgTypes[6] + 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[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 GetGamesByPlayer.ProtoReflect.Descriptor instead. +func (*GetGamesByPlayer) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{6} +} + +func (x *GetGamesByPlayer) GetPlayerId() string { + if x != nil { + return x.PlayerId + } + return "" +} + +func (x *GetGamesByPlayer) GetState() GetGamesByPlayer_State { + if x != nil { + return x.State + } + return GetGamesByPlayer_STATE_UNSPECIFIED +} + +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[7] + 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[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 GetGamesByPlayerResponse.ProtoReflect.Descriptor instead. +func (*GetGamesByPlayerResponse) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_connectfour_v1_messaging_proto_rawDescGZIP(), []int{7} +} + +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[8] + 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[8] + 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{8} +} + +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[9] + 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[9] + 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{8, 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\"\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" + + "\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\"\xad\x02\n" + + "\x10GetGamesByPlayer\x12\x1b\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\"\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" + + "\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\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\"?\n" + + "\x05Color\x12\x15\n" + + "\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 + 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, 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 + (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 + 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() } +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: 3, + NumMessages: 10, + 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/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 new file mode 100644 index 0000000..fecd043 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/ConnectFourV1Factory.php @@ -0,0 +1,122 @@ +mergeFromString($data); + return $message; + } + + /** @deprecated */ + 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; + } + + /** @deprecated */ + 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; + } + + /** @deprecated */ + 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; + } + + /** @deprecated */ + 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; + } + + /** @deprecated */ + 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; + } + + /** @deprecated */ + 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; + } + + /** @deprecated */ + 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; + } + + /** @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/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..19ae9e5 --- /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 COLOR_RED = 1; + */ + const COLOR_RED = 1; + /** + * Generated from protobuf enum COLOR_YELLOW = 2; + */ + const COLOR_YELLOW = 2; + + private static $valueToName = [ + self::COLOR_UNSPECIFIED => 'COLOR_UNSPECIFIED', + self::COLOR_RED => 'COLOR_RED', + self::COLOR_YELLOW => 'COLOR_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..50d6ad7 --- /dev/null +++ b/php/GamingPlatform/Api/ConnectFour/V1/GetGamesByPlayer.php @@ -0,0 +1,139 @@ +gamingplatform.api.connectfour.v1.GetGamesByPlayer + */ +class GetGamesByPlayer extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string player_id = 1; + */ + protected $player_id = ''; + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.GetGamesByPlayer.State state = 2; + */ + protected $state = 0; + /** + * 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 int $state + * @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; + } + + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.GetGamesByPlayer.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Generated from protobuf field .gamingplatform.api.connectfour.v1.GetGamesByPlayer.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \GamingPlatform\Api\ConnectFour\V1\GetGamesByPlayer\State::class); + $this->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/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/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/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 new file mode 100644 index 0000000..23572b0 Binary files /dev/null and b/php/GamingPlatform/Api/GPBMetadata/ConnectFour/V1/Messaging.php differ diff --git a/schema/gamingplatform/api/connectfour/v1/messaging.proto b/schema/gamingplatform/api/connectfour/v1/messaging.proto new file mode 100644 index 0000000..1c049da --- /dev/null +++ b/schema/gamingplatform/api/connectfour/v1/messaging.proto @@ -0,0 +1,81 @@ +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 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; +} + +message JoinGameResponse { +} + +message MakeMove { + string game_id = 1; + string player_id = 2; + int32 column = 3; +} + +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; + State state = 2; + int32 page = 3; + int32 limit = 4; +} + +message GetGamesByPlayerResponse { + repeated Game games = 1; + int32 total = 2; +} + +message Game { + message Move { + enum Color { + COLOR_UNSPECIFIED = 0; + COLOR_RED = 1; + COLOR_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; +}