| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/Comm/GetBattles.elm')
| -rw-r--r-- | src/Comm/GetBattles.elm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Comm/GetBattles.elm b/src/Comm/GetBattles.elm new file mode 100644 index 0000000..59b8d1d --- /dev/null +++ b/src/Comm/GetBattles.elm @@ -0,0 +1,41 @@ +module Comm.GetBattles exposing (try) + +-- Elm ------------------------------------------------------------------------- +import Json.Encode + +-- Extension ------------------------------------------------------------------- +import Comm.Send +import Struct.Event +import Struct.Model + +-------------------------------------------------------------------------------- +-- TYPES ------------------------------------------------------------------------ +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +try_encoding : String -> Struct.Model.Type -> (Maybe Json.Encode.Value) +try_encoding player_id model = + let + encoded_player_id = (Json.Encode.string player_id) + in + (Just + (Json.Encode.object + [ + ("id", encoded_player_id) + ] + ) + ) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +try : Struct.Model.Type -> String -> (Maybe (Cmd Struct.Event.Type)) +try model player_id = + (Comm.Send.try_sending + model + -- FIXME: this is a param now... + Constants.IO.get_battles_handler + (try_encoding player_id) + ) |


