File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/elm
samples/openapi3/client/elm/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module Api exposing
33 , request
44 , send
55 , sendWithCustomError
6+ , sendWithCustomExpect
67 , task
78 , map
89 , withBasePath
@@ -55,13 +56,18 @@ send toMsg req =
5556
5657
5758sendWithCustomError : (Http.Error -> e) -> (Result e a -> msg) -> Request a -> Cmd msg
58- sendWithCustomError mapError toMsg (Request req) =
59+ sendWithCustomError mapError toMsg req =
60+ sendWithCustomExpect (expectJson mapError toMsg) req
61+
62+
63+ sendWithCustomExpect : (Json.Decode.Decoder a -> Http.Expect msg) -> Request a -> Cmd msg
64+ sendWithCustomExpect expect (Request req) =
5965 Http.request
6066 { method = req.method
6167 , headers = req.headers
6268 , url = Url.Builder.crossOrigin req.basePath req.pathParams req.queryParams
6369 , body = req.body
64- , expect = expectJson mapError toMsg req.decoder
70+ , expect = expect req.decoder
6571 , timeout = req.timeout
6672 , tracker = req.tracker
6773 }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module Api exposing
33 , request
44 , send
55 , sendWithCustomError
6+ , sendWithCustomExpect
67 , task
78 , map
89 , withBasePath
@@ -55,13 +56,18 @@ send toMsg req =
5556
5657
5758sendWithCustomError : (Http .Error -> e ) -> (Result e a -> msg ) -> Request a -> Cmd msg
58- sendWithCustomError mapError toMsg ( Request req) =
59+ sendWithCustomError mapError toMsg req =
60+ sendWithCustomExpect ( expectJson mapError toMsg) req
61+
62+
63+ sendWithCustomExpect : (Json .Decode .Decoder a -> Http .Expect msg ) -> Request a -> Cmd msg
64+ sendWithCustomExpect expect ( Request req) =
5965 Http . request
6066 { method = req. method
6167 , headers = req. headers
6268 , url = Url . Builder . crossOrigin req. basePath req. pathParams req. queryParams
6369 , body = req. body
64- , expect = expectJson mapError toMsg req. decoder
70+ , expect = expect req. decoder
6571 , timeout = req. timeout
6672 , tracker = req. tracker
6773 }
You can’t perform that action at this time.
0 commit comments