Commit e235ba06 authored by Mamadou Diallo's avatar Mamadou Diallo
Browse files

Ajout des services + quelques changements

parent 8554ee37
......@@ -10,3 +10,21 @@ exception GameNotFound {
1: i32 code,
2: string description
}
struct GamePhase {
1: i32 GamePhase
}
struct Winner {
1: string winner,
2: string message
}
struct Response {
1: bool value
2: string detal
}
......@@ -11,5 +11,8 @@ service GameService {
i32 createGame(i32 numberOfPlayers)
i32 join(i32 gameId, JoinRequest request) throws (1:common.GameNotFound e)
i32 join(i32 gameId, JoinRequest request) throws (1:common.GameNotFound e)
i32 add(i32 left, i32 right)
}
node_modules/
node/
dist/
src/codegen/
\ No newline at end of file
This diff is collapsed.
......@@ -15,13 +15,17 @@
"@creditkarma/thrift-typescript": "^3.7.6",
"@types/thrift": "^0.10.10",
"codelyzer": "^6.0.1",
"tslint": "^6.1.3"
"tslint": "^6.1.3",
"typescript": "^4.1.2"
},
"dependencies": {
"@creditkarma/thrift-client": "^0.16.1",
"@creditkarma/thrift-server-core": "^0.16.1",
"@creditkarma/thrift-server-express": "^0.16.1",
"express": "^4.17.1"
"@types/express": "^4.17.9",
"@types/request": "^2.48.5",
"express": "^4.17.1",
"request": "^2.88.2"
},
"browser": {
"crypto": false,
......
......@@ -20,8 +20,8 @@
<version>1.10.0</version>
<configuration>
<workingDirectory>./</workingDirectory>
<nodeVersion>v12.19.0</nodeVersion>
<npmVersion>6.14.8</npmVersion>
<nodeVersion>v14.11.0</nodeVersion>
<npmVersion>7.0.10</npmVersion>
</configuration>
<executions>
<execution>
......
/* tslint:disable */
/* eslint-disable */
/*
* Autogenerated by @creditkarma/thrift-typescript v3.7.6
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as thrift from "@creditkarma/thrift-server-core";
export interface IGameNotFound {
code?: number;
description?: string;
}
export interface IGameNotFoundArgs {
code?: number;
description?: string;
}
export const GameNotFoundCodec: thrift.IStructCodec<IGameNotFoundArgs, IGameNotFound> = {
encode(args: IGameNotFoundArgs, output: thrift.TProtocol): void {
const obj: any = {
code: args.code,
description: args.description
};
output.writeStructBegin("GameNotFound");
if (obj.code != null) {
output.writeFieldBegin("code", thrift.TType.I32, 1);
output.writeI32(obj.code);
output.writeFieldEnd();
}
if (obj.description != null) {
output.writeFieldBegin("description", thrift.TType.STRING, 2);
output.writeString(obj.description);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
},
decode(input: thrift.TProtocol): IGameNotFound {
let _args: any = {};
input.readStructBegin();
while (true) {
const ret: thrift.IThriftField = input.readFieldBegin();
const fieldType: thrift.TType = ret.fieldType;
const fieldId: number = ret.fieldId;
if (fieldType === thrift.TType.STOP) {
break;
}
switch (fieldId) {
case 1:
if (fieldType === thrift.TType.I32) {
const value_1: number = input.readI32();
_args.code = value_1;
}
else {
input.skip(fieldType);
}
break;
case 2:
if (fieldType === thrift.TType.STRING) {
const value_2: string = input.readString();
_args.description = value_2;
}
else {
input.skip(fieldType);
}
break;
default: {
input.skip(fieldType);
}
}
input.readFieldEnd();
}
input.readStructEnd();
return {
code: _args.code,
description: _args.description
};
}
};
export class GameNotFound extends thrift.StructLike implements IGameNotFound {
public code?: number;
public description?: string;
public readonly _annotations: thrift.IThriftAnnotations = {};
public readonly _fieldAnnotations: thrift.IFieldAnnotations = {};
constructor(args: IGameNotFoundArgs = {}) {
super();
if (args.code != null) {
const value_3: number = args.code;
this.code = value_3;
}
if (args.description != null) {
const value_4: string = args.description;
this.description = value_4;
}
}
public static read(input: thrift.TProtocol): GameNotFound {
return new GameNotFound(GameNotFoundCodec.decode(input));
}
public static write(args: IGameNotFoundArgs, output: thrift.TProtocol): void {
return GameNotFoundCodec.encode(args, output);
}
public write(output: thrift.TProtocol): void {
return GameNotFoundCodec.encode(this, output);
}
}
/* tslint:disable */
/* eslint-disable */
/*
* Autogenerated by @creditkarma/thrift-typescript v3.7.6
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as thrift from "@creditkarma/thrift-server-core";
export interface IGamePhase {
GamePhase?: number;
}
export interface IGamePhaseArgs {
GamePhase?: number;
}
export const GamePhaseCodec: thrift.IStructCodec<IGamePhaseArgs, IGamePhase> = {
encode(args: IGamePhaseArgs, output: thrift.TProtocol): void {
const obj: any = {
GamePhase: args.GamePhase
};
output.writeStructBegin("GamePhase");
if (obj.GamePhase != null) {
output.writeFieldBegin("GamePhase", thrift.TType.I32, 1);
output.writeI32(obj.GamePhase);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
},
decode(input: thrift.TProtocol): IGamePhase {
let _args: any = {};
input.readStructBegin();
while (true) {
const ret: thrift.IThriftField = input.readFieldBegin();
const fieldType: thrift.TType = ret.fieldType;
const fieldId: number = ret.fieldId;
if (fieldType === thrift.TType.STOP) {
break;
}
switch (fieldId) {
case 1:
if (fieldType === thrift.TType.I32) {
const value_1: number = input.readI32();
_args.GamePhase = value_1;
}
else {
input.skip(fieldType);
}
break;
default: {
input.skip(fieldType);
}
}
input.readFieldEnd();
}
input.readStructEnd();
return {
GamePhase: _args.GamePhase
};
}
};
export class GamePhase extends thrift.StructLike implements IGamePhase {
public GamePhase?: number;
public readonly _annotations: thrift.IThriftAnnotations = {};
public readonly _fieldAnnotations: thrift.IFieldAnnotations = {};
constructor(args: IGamePhaseArgs = {}) {
super();
if (args.GamePhase != null) {
const value_2: number = args.GamePhase;
this.GamePhase = value_2;
}
}
public static read(input: thrift.TProtocol): GamePhase {
return new GamePhase(GamePhaseCodec.decode(input));
}
public static write(args: IGamePhaseArgs, output: thrift.TProtocol): void {
return GamePhaseCodec.encode(args, output);
}
public write(output: thrift.TProtocol): void {
return GamePhaseCodec.encode(this, output);
}
}
This diff is collapsed.
/* tslint:disable */
/* eslint-disable */
/*
* Autogenerated by @creditkarma/thrift-typescript v3.7.6
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as thrift from "@creditkarma/thrift-server-core";
export interface IInvalidOperationException {
code?: number;
description?: string;
}
export interface IInvalidOperationExceptionArgs {
code?: number;
description?: string;
}
export const InvalidOperationExceptionCodec: thrift.IStructCodec<IInvalidOperationExceptionArgs, IInvalidOperationException> = {
encode(args: IInvalidOperationExceptionArgs, output: thrift.TProtocol): void {
const obj: any = {
code: args.code,
description: args.description
};
output.writeStructBegin("InvalidOperationException");
if (obj.code != null) {
output.writeFieldBegin("code", thrift.TType.I32, 1);
output.writeI32(obj.code);
output.writeFieldEnd();
}
if (obj.description != null) {
output.writeFieldBegin("description", thrift.TType.STRING, 2);
output.writeString(obj.description);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
},
decode(input: thrift.TProtocol): IInvalidOperationException {
let _args: any = {};
input.readStructBegin();
while (true) {
const ret: thrift.IThriftField = input.readFieldBegin();
const fieldType: thrift.TType = ret.fieldType;
const fieldId: number = ret.fieldId;
if (fieldType === thrift.TType.STOP) {
break;
}
switch (fieldId) {
case 1:
if (fieldType === thrift.TType.I32) {
const value_1: number = input.readI32();
_args.code = value_1;
}
else {
input.skip(fieldType);
}
break;
case 2:
if (fieldType === thrift.TType.STRING) {
const value_2: string = input.readString();
_args.description = value_2;
}
else {
input.skip(fieldType);
}
break;
default: {
input.skip(fieldType);
}
}
input.readFieldEnd();
}
input.readStructEnd();
return {
code: _args.code,
description: _args.description
};
}
};
export class InvalidOperationException extends thrift.StructLike implements IInvalidOperationException {
public code?: number;
public description?: string;
public readonly _annotations: thrift.IThriftAnnotations = {};
public readonly _fieldAnnotations: thrift.IFieldAnnotations = {};
constructor(args: IInvalidOperationExceptionArgs = {}) {
super();
if (args.code != null) {
const value_3: number = args.code;
this.code = value_3;
}
if (args.description != null) {
const value_4: string = args.description;
this.description = value_4;
}
}
public static read(input: thrift.TProtocol): InvalidOperationException {
return new InvalidOperationException(InvalidOperationExceptionCodec.decode(input));
}
public static write(args: IInvalidOperationExceptionArgs, output: thrift.TProtocol): void {
return InvalidOperationExceptionCodec.encode(args, output);
}
public write(output: thrift.TProtocol): void {
return InvalidOperationExceptionCodec.encode(this, output);
}
}
/* tslint:disable */
/* eslint-disable */
/*
* Autogenerated by @creditkarma/thrift-typescript v3.7.6
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as thrift from "@creditkarma/thrift-server-core";
export interface IJoinRequest {
name?: string;
}
export interface IJoinRequestArgs {
name?: string;
}
export const JoinRequestCodec: thrift.IStructCodec<IJoinRequestArgs, IJoinRequest> = {
encode(args: IJoinRequestArgs, output: thrift.TProtocol): void {
const obj: any = {
name: args.name
};
output.writeStructBegin("JoinRequest");
if (obj.name != null) {
output.writeFieldBegin("name", thrift.TType.STRING, 1);
output.writeString(obj.name);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
},
decode(input: thrift.TProtocol): IJoinRequest {
let _args: any = {};
input.readStructBegin();
while (true) {
const ret: thrift.IThriftField = input.readFieldBegin();
const fieldType: thrift.TType = ret.fieldType;
const fieldId: number = ret.fieldId;
if (fieldType === thrift.TType.STOP) {
break;
}
switch (fieldId) {
case 1:
if (fieldType === thrift.TType.STRING) {
const value_1: string = input.readString();
_args.name = value_1;
}
else {
input.skip(fieldType);
}
break;
default: {
input.skip(fieldType);
}
}
input.readFieldEnd();
}
input.readStructEnd();
return {
name: _args.name
};
}
};
export class JoinRequest extends thrift.StructLike implements IJoinRequest {
public name?: string;
public readonly _annotations: thrift.IThriftAnnotations = {};
public readonly _fieldAnnotations: thrift.IFieldAnnotations = {};
constructor(args: IJoinRequestArgs = {}) {
super();
if (args.name != null) {
const value_2: string = args.name;
this.name = value_2;
}
}
public static read(input: thrift.TProtocol): JoinRequest {
return new JoinRequest(JoinRequestCodec.decode(input));
}
public static write(args: IJoinRequestArgs, output: thrift.TProtocol): void {
return JoinRequestCodec.encode(args, output);
}
public write(output: thrift.TProtocol): void {
return JoinRequestCodec.encode(this, output);
}
}
/* tslint:disable */
/* eslint-disable */
/*
* Autogenerated by @creditkarma/thrift-typescript v3.7.6
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as thrift from "@creditkarma/thrift-server-core";
export const serviceName: string = "PlayerService";
export const annotations: thrift.IThriftAnnotations = {};
export const methodAnnotations: thrift.IMethodAnnotations = {
startGame: {
annotations: {},
fieldAnnotations: {}
}
};
export const methodNames: Array<string> = ["startGame"];
export const methodParameters: {
[methodName: string]: number;
} = {
startGame: 2
};
export interface IStartGame__Args {
gameId: number;
}
export interface IStartGame__ArgsArgs {
gameId: number;
}
export const StartGame__ArgsCodec: thrift.IStructCodec<IStartGame__ArgsArgs, IStartGame__Args> = {
encode(args: IStartGame__ArgsArgs, output: thrift.TProtocol): void {
const obj: any = {
gameId: args.gameId
};
output.writeStructBegin("StartGame__Args");
if (obj.gameId != null) {
output.writeFieldBegin("gameId", thrift.TType.I32, -1);
output.writeI32(obj.gameId);
output.writeFieldEnd();
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[gameId] is unset!");
}
output.writeFieldStop();
output.writeStructEnd();
return;
},
decode(input: thrift.TProtocol): IStartGame__Args {
let _args: any = {};
input.readStructBegin();
while (true) {
const ret: thrift.IThriftField = input.readFieldBegin();
const fieldType: thrift.TType = ret.fieldType;
const fieldId: number = ret.fieldId;
if (fieldType === thrift.TType.STOP) {
break;
}
switch (fieldId) {
case -1:
if (fieldType === thrift.TType.I32) {
const value_1: number = input.readI32();
_args.gameId = value_1;
}
else {
input.skip(fieldType);
}
break;
default: {
input.skip(fieldType);
}
}
input.readFieldEnd();
}
input.readStructEnd();
if (_args.gameId !== undefined) {
return {
gameId: _args.gameId
};
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read StartGame__Args from input");
}
}
};
export class StartGame__Args extends thrift.StructLike implements IStartGame__Args {
public gameId: number;
public readonly _annotations: thrift.IThriftAnnotations = {};
public readonly _fieldAnnotations: thrift.IFieldAnnotations = {};
constructor(args: IStartGame__ArgsArgs) {
super();
if (args.gameId != null) {
const value_2: number = args.gameId;
this.gameId = value_2;
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[gameId] is unset!");
}
}
public static read(input: thrift.TProtocol): StartGame__Args {
return new StartGame__Args(StartGame__ArgsCodec.decode(input));
}
public static write(args: IStartGame__ArgsArgs, output: thrift.TProtocol): void {
return StartGame__ArgsCodec.encode(args, output);
}
public write(output: thrift.TProtocol): void {
return StartGame__ArgsCodec.encode(this, output);
}
}
export interface IStartGame__Result {
success?: void;
}
export interface IStartGame__ResultArgs {
success?: void;
}
export const StartGame__ResultCodec: thrift.IStructCodec<IStartGame__ResultArgs, IStartGame__Result> = {
encode(args: IStartGame__ResultArgs, output: thrift.TProtocol): void {
output.writeStructBegin("StartGame__Result");
output.writeFieldStop();
output.writeStructEnd();
return;
},
decode(input: thrift.TProtocol): IStartGame__Result {
let _args: any = {};
input.readStructBegin();
while (true) {
const ret: thrift.IThriftField = input.readFieldBegin();
const fieldType: thrift.TType = ret.fieldType;
const fieldId: number = ret.fieldId;
if (fieldType === thrift.TType.STOP) {