packages feed

battleplace 0.1.0.5 → 0.1.0.6

raw patch · 3 files changed

+30/−1 lines, 3 files

Files

BattlePlace/WebApi.hs view
@@ -13,6 +13,7 @@ 	, MatchRequest(..) 	, MatchResponse(..) 	, MatchStatusResponse(..)+	, MatchCancelResponse(..) 	, MatchTeam(..) 	, MatchPlayer(..) 	, MatchServer(..)@@ -41,10 +42,14 @@ 		:<|> "match" :> 			(    AuthProtect ClientToken :> ReqBody '[JSON] MatchRequest :> Post '[JSON] MatchResponse 			:<|> AuthProtect ClientToken :> Capture "matchToken" (InternalToken MatchToken) :> Get '[JSON] MatchStatusResponse+			:<|> AuthProtect ClientToken :> Capture "matchToken" (InternalToken MatchToken) :> Delete '[JSON] MatchCancelResponse 			) 		:<|> "session" :> Capture "sessionToken" (InternalToken SessionToken) :> 			(    "result" :> AuthProtect ClientToken :> ReqBody '[JSON] SessionResultRequest :> Post '[JSON] () 			)+		:<|> "info" :>+			(    "stats" :> AuthProtect ClientToken :> Get '[JSON] UserStats+			) 		) 	:<|> "server" :> 		(    "match" :> ReqBody '[JSON] ServerMatchRequest :> Post '[JSON] ServerMatchResponse@@ -147,6 +152,16 @@ instance J.FromJSON MatchServer where 	parseJSON = J.genericParseJSON jsonOptions instance J.ToJSON MatchServer where+	toJSON = J.genericToJSON jsonOptions+	toEncoding = J.genericToEncoding jsonOptions++data MatchCancelResponse+	= MatchCancelResponse_notFound+	| MatchCancelResponse_cancelled+	deriving Generic+instance J.FromJSON MatchCancelResponse where+	parseJSON = J.genericParseJSON jsonOptions+instance J.ToJSON MatchCancelResponse where 	toJSON = J.genericToJSON jsonOptions 	toEncoding = J.genericToEncoding jsonOptions 
BattlePlace/WebApi/Types.hs view
@@ -27,6 +27,7 @@ 	, SessionToken(..) 	, SessionId(..) 	, ServerSessionToken(..)+	, UserStats(..) 	, Identified(..) 	, Base64ByteString(..) 	, Base64Word64(..)@@ -50,6 +51,7 @@ import GHC.Generics(Generic) import Servant.API +import BattlePlace.Rating import BattlePlace.Util  -- | Account id.@@ -212,6 +214,17 @@ instance J.FromJSON ServerSessionToken where 	parseJSON = J.genericParseJSON jsonOptions instance J.ToJSON ServerSessionToken where+	toJSON = J.genericToJSON jsonOptions+	toEncoding = J.genericToEncoding jsonOptions++-- | User stats.+data UserStats = UserStats+	{ userStats_rank :: {-# UNPACK #-} !Int+	, userStats_rating :: {-# UNPACK #-} !Rating+	} deriving Generic+instance J.FromJSON UserStats where+	parseJSON = J.genericParseJSON jsonOptions+instance J.ToJSON UserStats where 	toJSON = J.genericToJSON jsonOptions 	toEncoding = J.genericToEncoding jsonOptions 
battleplace.cabal view
@@ -1,5 +1,5 @@ name:                battleplace-version:             0.1.0.5+version:             0.1.0.6 synopsis:            Core definitions for BattlePlace.io service description:         Core definitions for BattlePlace.io service license:             MIT@@ -33,4 +33,5 @@     , servant     , text     , vector+  ghc-options:         -Wall -Wno-tabs   default-language:    Haskell2010