Implement simple integration grpc service.
Create HTTP client based on Client
interface in service/client.go
. Method GetGames
should
go to freetogame source
(in query key platform
you should pass only pc
or mobile
, implement validation for this) and receive list of games
in json format, parse all available fields to Games
struct.
Generate GRPC server based on proto/integration.proto
and implement methods GetBalance
and
SendBet
.
-
GetBalance
should validate following fields:token
,player
,platform
,currency
,game_id
then make request to service methodGetGames
and find game according togame_id
from grpc request if game is found then fill in field inGetBalanceResponse.game
(field namings are the same) and makeGetBalance
request to service byPlayer.id
(Here use any in-memory storage with prefabricated data by player_id) -
SendBet
should validate all fields and check in-memory storage if player has sufficient balance otherwise thow error, subtract amount from balance and update in-memory storage and return updated balance.
Fork this repository so we can see it, update README.md
with full documentation how to deploy and
run this service. Optionally it will be nice to have unit tests and any usage of middlewares throughout
this project.
Thank you for FreeToGame.com portal for providing free API.