Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/play again #45

Merged
merged 4 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions protos/games.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ message GetGameResponse {
Game game = 1;
}

message GuessRequest {
string game_id = 1;
string player_id = 2;
string card_id = 3;
}

message GuessResponse {}

message HintRequest {
string game_id = 1;
string player_id = 2;
Expand All @@ -71,13 +79,12 @@ message HintRequest {

message HintResponse {}

message GuessRequest {
message PlayAgainRequest {
string game_id = 1;
string player_id = 2;
string card_id = 3;
}

message GuessResponse {}
message PlayAgainResponse {}

message SkipTurnRequest {
string game_id = 1;
Expand All @@ -89,7 +96,8 @@ message SkipTurnResponse {}
service GamesService {
rpc CreateGame (CreateGameRequest) returns (CreateGameResponse);
rpc GetGame (GetGameRequest) returns (GetGameResponse);
rpc Hint (HintRequest) returns (HintResponse);
rpc Guess (GuessRequest) returns (GuessResponse);
rpc Hint (HintRequest) returns (HintResponse);
rpc PlayAgain (PlayAgainRequest) returns (PlayAgainResponse);
rpc SkipTurn (SkipTurnRequest) returns (SkipTurnResponse);
}
5 changes: 5 additions & 0 deletions services/games-bff/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"arrowParens": "avoid",
"singleQuote": true,
"semi": true
}
2 changes: 1 addition & 1 deletion services/games-bff/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
OUT=genproto
# Windows users see protoc-gen-ts.cmd and grpc_tools_node_protoc_plugin.cmd
if [ "$OSTYPE" == "cygwin" ] || [ "$OSTYPE" == "msys" ]; then
Expand Down
15 changes: 10 additions & 5 deletions services/games-bff/genproto/games_grpc_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import * as grpc from "@grpc/grpc-js";
interface IGamesServiceService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
createGame: grpc.MethodDefinition<games_pb.CreateGameRequest, games_pb.CreateGameResponse>;
getGame: grpc.MethodDefinition<games_pb.GetGameRequest, games_pb.GetGameResponse>;
hint: grpc.MethodDefinition<games_pb.HintRequest, games_pb.HintResponse>;
guess: grpc.MethodDefinition<games_pb.GuessRequest, games_pb.GuessResponse>;
hint: grpc.MethodDefinition<games_pb.HintRequest, games_pb.HintResponse>;
playAgain: grpc.MethodDefinition<games_pb.PlayAgainRequest, games_pb.PlayAgainResponse>;
skipTurn: grpc.MethodDefinition<games_pb.SkipTurnRequest, games_pb.SkipTurnResponse>;
}

Expand All @@ -19,8 +20,9 @@ export const GamesServiceService: IGamesServiceService;
export interface IGamesServiceServer extends grpc.UntypedServiceImplementation {
createGame: grpc.handleUnaryCall<games_pb.CreateGameRequest, games_pb.CreateGameResponse>;
getGame: grpc.handleUnaryCall<games_pb.GetGameRequest, games_pb.GetGameResponse>;
hint: grpc.handleUnaryCall<games_pb.HintRequest, games_pb.HintResponse>;
guess: grpc.handleUnaryCall<games_pb.GuessRequest, games_pb.GuessResponse>;
hint: grpc.handleUnaryCall<games_pb.HintRequest, games_pb.HintResponse>;
playAgain: grpc.handleUnaryCall<games_pb.PlayAgainRequest, games_pb.PlayAgainResponse>;
skipTurn: grpc.handleUnaryCall<games_pb.SkipTurnRequest, games_pb.SkipTurnResponse>;
}

Expand All @@ -32,12 +34,15 @@ export class GamesServiceClient extends grpc.Client {
getGame(argument: games_pb.GetGameRequest, callback: grpc.requestCallback<games_pb.GetGameResponse>): grpc.ClientUnaryCall;
getGame(argument: games_pb.GetGameRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.GetGameResponse>): grpc.ClientUnaryCall;
getGame(argument: games_pb.GetGameRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.GetGameResponse>): grpc.ClientUnaryCall;
hint(argument: games_pb.HintRequest, callback: grpc.requestCallback<games_pb.HintResponse>): grpc.ClientUnaryCall;
hint(argument: games_pb.HintRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.HintResponse>): grpc.ClientUnaryCall;
hint(argument: games_pb.HintRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.HintResponse>): grpc.ClientUnaryCall;
guess(argument: games_pb.GuessRequest, callback: grpc.requestCallback<games_pb.GuessResponse>): grpc.ClientUnaryCall;
guess(argument: games_pb.GuessRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.GuessResponse>): grpc.ClientUnaryCall;
guess(argument: games_pb.GuessRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.GuessResponse>): grpc.ClientUnaryCall;
hint(argument: games_pb.HintRequest, callback: grpc.requestCallback<games_pb.HintResponse>): grpc.ClientUnaryCall;
hint(argument: games_pb.HintRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.HintResponse>): grpc.ClientUnaryCall;
hint(argument: games_pb.HintRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.HintResponse>): grpc.ClientUnaryCall;
playAgain(argument: games_pb.PlayAgainRequest, callback: grpc.requestCallback<games_pb.PlayAgainResponse>): grpc.ClientUnaryCall;
playAgain(argument: games_pb.PlayAgainRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.PlayAgainResponse>): grpc.ClientUnaryCall;
playAgain(argument: games_pb.PlayAgainRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.PlayAgainResponse>): grpc.ClientUnaryCall;
skipTurn(argument: games_pb.SkipTurnRequest, callback: grpc.requestCallback<games_pb.SkipTurnResponse>): grpc.ClientUnaryCall;
skipTurn(argument: games_pb.SkipTurnRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.SkipTurnResponse>): grpc.ClientUnaryCall;
skipTurn(argument: games_pb.SkipTurnRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<games_pb.SkipTurnResponse>): grpc.ClientUnaryCall;
Expand Down
49 changes: 41 additions & 8 deletions services/games-bff/genproto/games_grpc_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,28 @@ function deserialize_distributed_codenames_HintResponse(buffer_arg) {
return games_pb.HintResponse.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_distributed_codenames_PlayAgainRequest(arg) {
if (!(arg instanceof games_pb.PlayAgainRequest)) {
throw new Error('Expected argument of type distributed_codenames.PlayAgainRequest');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_distributed_codenames_PlayAgainRequest(buffer_arg) {
return games_pb.PlayAgainRequest.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_distributed_codenames_PlayAgainResponse(arg) {
if (!(arg instanceof games_pb.PlayAgainResponse)) {
throw new Error('Expected argument of type distributed_codenames.PlayAgainResponse');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_distributed_codenames_PlayAgainResponse(buffer_arg) {
return games_pb.PlayAgainResponse.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_distributed_codenames_SkipTurnRequest(arg) {
if (!(arg instanceof games_pb.SkipTurnRequest)) {
throw new Error('Expected argument of type distributed_codenames.SkipTurnRequest');
Expand Down Expand Up @@ -138,6 +160,17 @@ var GamesServiceService = exports.GamesServiceService = {
responseSerialize: serialize_distributed_codenames_GetGameResponse,
responseDeserialize: deserialize_distributed_codenames_GetGameResponse,
},
guess: {
path: '/distributed_codenames.GamesService/Guess',
requestStream: false,
responseStream: false,
requestType: games_pb.GuessRequest,
responseType: games_pb.GuessResponse,
requestSerialize: serialize_distributed_codenames_GuessRequest,
requestDeserialize: deserialize_distributed_codenames_GuessRequest,
responseSerialize: serialize_distributed_codenames_GuessResponse,
responseDeserialize: deserialize_distributed_codenames_GuessResponse,
},
hint: {
path: '/distributed_codenames.GamesService/Hint',
requestStream: false,
Expand All @@ -149,16 +182,16 @@ var GamesServiceService = exports.GamesServiceService = {
responseSerialize: serialize_distributed_codenames_HintResponse,
responseDeserialize: deserialize_distributed_codenames_HintResponse,
},
guess: {
path: '/distributed_codenames.GamesService/Guess',
playAgain: {
path: '/distributed_codenames.GamesService/PlayAgain',
requestStream: false,
responseStream: false,
requestType: games_pb.GuessRequest,
responseType: games_pb.GuessResponse,
requestSerialize: serialize_distributed_codenames_GuessRequest,
requestDeserialize: deserialize_distributed_codenames_GuessRequest,
responseSerialize: serialize_distributed_codenames_GuessResponse,
responseDeserialize: deserialize_distributed_codenames_GuessResponse,
requestType: games_pb.PlayAgainRequest,
responseType: games_pb.PlayAgainResponse,
requestSerialize: serialize_distributed_codenames_PlayAgainRequest,
requestDeserialize: deserialize_distributed_codenames_PlayAgainRequest,
responseSerialize: serialize_distributed_codenames_PlayAgainResponse,
responseDeserialize: deserialize_distributed_codenames_PlayAgainResponse,
},
skipTurn: {
path: '/distributed_codenames.GamesService/SkipTurn',
Expand Down
76 changes: 58 additions & 18 deletions services/games-bff/genproto/games_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,50 @@ export namespace GetGameResponse {
}
}

export class GuessRequest extends jspb.Message {
getGameId(): string;
setGameId(value: string): void;

getPlayerId(): string;
setPlayerId(value: string): void;

getCardId(): string;
setCardId(value: string): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GuessRequest.AsObject;
static toObject(includeInstance: boolean, msg: GuessRequest): GuessRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GuessRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GuessRequest;
static deserializeBinaryFromReader(message: GuessRequest, reader: jspb.BinaryReader): GuessRequest;
}

export namespace GuessRequest {
export type AsObject = {
gameId: string,
playerId: string,
cardId: string,
}
}

export class GuessResponse extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GuessResponse.AsObject;
static toObject(includeInstance: boolean, msg: GuessResponse): GuessResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GuessResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GuessResponse;
static deserializeBinaryFromReader(message: GuessResponse, reader: jspb.BinaryReader): GuessResponse;
}

export namespace GuessResponse {
export type AsObject = {
}
}

export class HintRequest extends jspb.Message {
getGameId(): string;
setGameId(value: string): void;
Expand Down Expand Up @@ -297,46 +341,42 @@ export namespace HintResponse {
}
}

export class GuessRequest extends jspb.Message {
export class PlayAgainRequest extends jspb.Message {
getGameId(): string;
setGameId(value: string): void;

getPlayerId(): string;
setPlayerId(value: string): void;

getCardId(): string;
setCardId(value: string): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GuessRequest.AsObject;
static toObject(includeInstance: boolean, msg: GuessRequest): GuessRequest.AsObject;
toObject(includeInstance?: boolean): PlayAgainRequest.AsObject;
static toObject(includeInstance: boolean, msg: PlayAgainRequest): PlayAgainRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GuessRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GuessRequest;
static deserializeBinaryFromReader(message: GuessRequest, reader: jspb.BinaryReader): GuessRequest;
static serializeBinaryToWriter(message: PlayAgainRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): PlayAgainRequest;
static deserializeBinaryFromReader(message: PlayAgainRequest, reader: jspb.BinaryReader): PlayAgainRequest;
}

export namespace GuessRequest {
export namespace PlayAgainRequest {
export type AsObject = {
gameId: string,
playerId: string,
cardId: string,
}
}

export class GuessResponse extends jspb.Message {
export class PlayAgainResponse extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GuessResponse.AsObject;
static toObject(includeInstance: boolean, msg: GuessResponse): GuessResponse.AsObject;
toObject(includeInstance?: boolean): PlayAgainResponse.AsObject;
static toObject(includeInstance: boolean, msg: PlayAgainResponse): PlayAgainResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GuessResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GuessResponse;
static deserializeBinaryFromReader(message: GuessResponse, reader: jspb.BinaryReader): GuessResponse;
static serializeBinaryToWriter(message: PlayAgainResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): PlayAgainResponse;
static deserializeBinaryFromReader(message: PlayAgainResponse, reader: jspb.BinaryReader): PlayAgainResponse;
}

export namespace GuessResponse {
export namespace PlayAgainResponse {
export type AsObject = {
}
}
Expand Down
Loading