summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/APIClient
diff options
context:
space:
mode:
authorJulien Dessaux2023-07-03 21:29:15 +0200
committerJulien Dessaux2023-07-03 21:29:15 +0200
commitb3d57cb6adf1e3f6a8ba7cf1c1553b6fd4acb578 (patch)
tree8f596ee49ad84f320d5950fe5690bee335f930be /haskell/src/SpaceTraders/APIClient
parentBootstrapped my haskell client (diff)
downloadspacetraders-b3d57cb6adf1e3f6a8ba7cf1c1553b6fd4acb578.tar.gz
spacetraders-b3d57cb6adf1e3f6a8ba7cf1c1553b6fd4acb578.tar.bz2
spacetraders-b3d57cb6adf1e3f6a8ba7cf1c1553b6fd4acb578.zip
[haskell] Implemented contract
Diffstat (limited to 'haskell/src/SpaceTraders/APIClient')
-rw-r--r--haskell/src/SpaceTraders/APIClient/Agent.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/haskell/src/SpaceTraders/APIClient/Agent.hs b/haskell/src/SpaceTraders/APIClient/Agent.hs
index 997d1e5..6728baf 100644
--- a/haskell/src/SpaceTraders/APIClient/Agent.hs
+++ b/haskell/src/SpaceTraders/APIClient/Agent.hs
@@ -15,16 +15,18 @@ import Network.HTTP.Simple
import SpaceTraders.APIClient.Client
import SpaceTraders.Model.Agent
+import SpaceTraders.Model.Contract
myAgent :: T.Text -> IO (Either APIError Agent)
myAgent t = send $ setRequestPath "/v2/my/agent"
$ tokenReq t
-data RegisterRequest = RegisterRequest { symbol :: T.Text
- , faction :: T.Text
+data RegisterRequest = RegisterRequest { faction :: T.Text
+ , symbol :: T.Text
} deriving (ToJSON, Generic, Show)
-data RegisterMessage = RegisterMessage { token :: T.Text
- , agent :: Agent
+data RegisterMessage = RegisterMessage { agent :: Agent
+ , contract :: Contract
+ , token :: T.Text
} deriving (FromJSON, Generic, Show)
register :: T.Text -> T.Text -> IO (Either APIError RegisterMessage)