blob: 095697224bf3a52cec5a1ccccf6785481023ef46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
module Comm.GetBattles exposing (try)
-- Elm -------------------------------------------------------------------------
import Json.Encode
-- Extension -------------------------------------------------------------------
import Comm.Send
import Struct.Event
import Struct.Model
import Struct.Player
--------------------------------------------------------------------------------
-- 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 -> Struct.Player.Type -> (Maybe (Cmd Struct.Event.Type))
try model player =
(Comm.Send.try_sending
model
(
(Struct.Player.get_query_url player)
++ "/handler/player/plr_get_battles"
)
(try_encoding (Struct.Player.get_id player))
)
|