Skip to content

Commit 54b6bbf

Browse files
committed
Use call_ bindings directly
1 parent 2509100 commit 54b6bbf

4 files changed

Lines changed: 13 additions & 189 deletions

File tree

src/Gen/BackendTask/Http.elm

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
module Gen.BackendTask.Http exposing
22
( expectString, expectJson
3-
, expectBytes, emptyBody, jsonBody
3+
, expectBytes, emptyBody
44
, annotation_, call_
5-
, bytesBody
65
)
76

87
{-|
98
109
1110
# Generated bindings for BackendTask.Http
1211
13-
@docs get, expectString, expectJson
14-
@docs expectBytes, emptyBody, jsonBody
15-
@docs bytesBodyWithOptions
12+
@docs expectString, expectJson
13+
@docs expectBytes, emptyBody
1614
@docs annotation_, call_
1715
1816
-}
@@ -138,50 +136,6 @@ emptyBody =
138136
}
139137

140138

141-
{-| Builds a JSON body for a BackendTask.Http request. See [elm/http's `Http.jsonBody`](https://package.elm-lang.org/packages/elm/http/latest/Http#jsonBody).
142-
143-
jsonBody: Json.Encode.Value -> BackendTask.Http.Body
144-
145-
-}
146-
jsonBody : Elm.Expression -> Elm.Expression
147-
jsonBody jsonBodyArg_ =
148-
Elm.apply
149-
(Elm.value
150-
{ importFrom = [ "BackendTask", "Http" ]
151-
, name = "jsonBody"
152-
, annotation =
153-
Just
154-
(Type.function
155-
[ Type.namedWith [ "Json", "Encode" ] "Value" [] ]
156-
(Type.namedWith [ "BackendTask", "Http" ] "Body" [])
157-
)
158-
}
159-
)
160-
[ jsonBodyArg_ ]
161-
162-
163-
{-| Build a body from `Bytes` for a BackendTask.Http request. See [elm/http's `Http.bytesBody`](https://package.elm-lang.org/packages/elm/http/latest/Http#bytesBody).
164-
165-
bytesBody: String -> Bytes.Bytes -> BackendTask.Http.Body
166-
167-
-}
168-
bytesBody : String -> Elm.Expression -> Elm.Expression
169-
bytesBody bytesBodyArg_ bytesBodyArg_0 =
170-
Elm.apply
171-
(Elm.value
172-
{ importFrom = [ "BackendTask", "Http" ]
173-
, name = "bytesBody"
174-
, annotation =
175-
Just
176-
(Type.function
177-
[ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ]
178-
(Type.namedWith [ "BackendTask", "Http" ] "Body" [])
179-
)
180-
}
181-
)
182-
[ Elm.string bytesBodyArg_, bytesBodyArg_0 ]
183-
184-
185139
annotation_ :
186140
{ expect : Type.Annotation -> Type.Annotation
187141
, error : Type.Annotation

src/Gen/Effect/Http.elm

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Gen.Effect.Http exposing
22
( bytesResolver, stringResolver
33
, expectBytesResponse, expectStringResponse
4-
, bytesBody, jsonBody
54
, emptyBody, annotation_
65
, caseOf_, call_
76
)
@@ -13,7 +12,6 @@ module Gen.Effect.Http exposing
1312
1413
@docs bytesResolver, stringResolver
1514
@docs expectBytesResponse, expectStringResponse
16-
@docs bytesBody, jsonBody
1715
@docs emptyBody, annotation_
1816
@docs caseOf_, call_
1917
@@ -237,69 +235,6 @@ expectStringResponse expectStringResponseArg_ expectStringResponseArg_0 =
237235
]
238236

239237

240-
{-| {-| Put some `Bytes` in the body of your `Request`. This allows you to use
241-
[`elm/bytes`](/packages/elm/bytes/latest) to have full control over the binary
242-
representation of the data you are sending. For example, you could create an
243-
`archive.zip` file and send it along like this:
244-
245-
import Bytes exposing (Bytes)
246-
247-
zipBody : Bytes -> Body
248-
zipBody bytes =
249-
bytesBody "application/zip" bytes
250-
251-
The first argument is a [MIME type](https://en.wikipedia.org/wiki/Media_type)
252-
of the body. In other scenarios you may want to use MIME types like `image/png`
253-
or `image/jpeg` instead.
254-
255-
**Note:** Use [`track`](#track) to track upload progress.
256-
257-
-}
258-
259-
bytesBody: String -> Bytes.Bytes -> Effect.Http.Body
260-
261-
-}
262-
bytesBody : String -> Elm.Expression -> Elm.Expression
263-
bytesBody bytesBodyArg_ bytesBodyArg_0 =
264-
Elm.apply
265-
(Elm.value
266-
{ importFrom = [ "Effect", "Http" ]
267-
, name = "bytesBody"
268-
, annotation =
269-
Just
270-
(Type.function
271-
[ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ]
272-
(Type.namedWith [ "Effect", "Http" ] "Body" [])
273-
)
274-
}
275-
)
276-
[ Elm.string bytesBodyArg_, bytesBodyArg_0 ]
277-
278-
279-
{-| {-| Put some JSON value in the body of your `Request`. This will automatically
280-
add the `Content-Type: application/json` header.
281-
-}
282-
283-
jsonBody: Json.Encode.Value -> Effect.Http.Body
284-
285-
-}
286-
jsonBody : Elm.Expression -> Elm.Expression
287-
jsonBody jsonBodyArg_ =
288-
Elm.apply
289-
(Elm.value
290-
{ importFrom = [ "Effect", "Http" ]
291-
, name = "jsonBody"
292-
, annotation =
293-
Just
294-
(Type.function
295-
[ Type.namedWith [ "Json", "Encode" ] "Value" [] ]
296-
(Type.namedWith [ "Effect", "Http" ] "Body" [])
297-
)
298-
}
299-
)
300-
[ jsonBodyArg_ ]
301-
302-
303238
{-| {-| Create an empty body for your `Request`.
304239
-}
305240

src/Gen/Http.elm

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
module Gen.Http exposing
22
( emptyBody
3-
, jsonBody, bytesBody
4-
, expectBytesResponse, stringResolver, bytesResolver, annotation_
3+
, expectBytesResponse, expectStringResponse, stringResolver, bytesResolver, annotation_
54
, caseOf_, call_
6-
, expectStringResponse
75
)
86

97
{-|
@@ -12,10 +10,7 @@ module Gen.Http exposing
1210
# Generated bindings for Http
1311
1412
@docs emptyBody
15-
@docs jsonBody, bytesBody
16-
@docs expectString
17-
@docs trackResponse
18-
@docs expectBytesResponse, stringResolver, bytesResolver, annotation_
13+
@docs expectBytesResponse, expectStringResponse, stringResolver, bytesResolver, annotation_
1914
@docs caseOf_, call_
2015
2116
-}
@@ -48,66 +43,6 @@ emptyBody =
4843
}
4944

5045

51-
{-| Put some JSON value in the body of your `Request`. This will automatically
52-
add the `Content-Type: application/json` header.
53-
54-
jsonBody: Json.Encode.Value -> Http.Body
55-
56-
-}
57-
jsonBody : Elm.Expression -> Elm.Expression
58-
jsonBody jsonBodyArg_ =
59-
Elm.apply
60-
(Elm.value
61-
{ importFrom = [ "Http" ]
62-
, name = "jsonBody"
63-
, annotation =
64-
Just
65-
(Type.function
66-
[ Type.namedWith [ "Json", "Encode" ] "Value" [] ]
67-
(Type.namedWith [ "Http" ] "Body" [])
68-
)
69-
}
70-
)
71-
[ jsonBodyArg_ ]
72-
73-
74-
{-| Put some `Bytes` in the body of your `Request`. This allows you to use
75-
[`elm/bytes`](/packages/elm/bytes/latest) to have full control over the binary
76-
representation of the data you are sending. For example, you could create an
77-
`archive.zip` file and send it along like this:
78-
79-
import Bytes exposing (Bytes)
80-
81-
zipBody : Bytes -> Body
82-
zipBody bytes =
83-
bytesBody "application/zip" bytes
84-
85-
The first argument is a [MIME type](https://en.wikipedia.org/wiki/Media_type)
86-
of the body. In other scenarios you may want to use MIME types like `image/png`
87-
or `image/jpeg` instead.
88-
89-
**Note:** Use [`track`](#track) to track upload progress.
90-
91-
bytesBody: String -> Bytes.Bytes -> Http.Body
92-
93-
-}
94-
bytesBody : String -> Elm.Expression -> Elm.Expression
95-
bytesBody bytesBodyArg_ bytesBodyArg_0 =
96-
Elm.apply
97-
(Elm.value
98-
{ importFrom = [ "Http" ]
99-
, name = "bytesBody"
100-
, annotation =
101-
Just
102-
(Type.function
103-
[ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ]
104-
(Type.namedWith [ "Http" ] "Body" [])
105-
)
106-
}
107-
)
108-
[ Elm.string bytesBodyArg_, bytesBodyArg_0 ]
109-
110-
11146
{-| Expect a [`Response`](#Response) with a `String` body. So you could define
11247
your own [`expectJson`](#expectJson) like this:
11348

src/OpenApi/Generate.elm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,9 @@ toRequestFunctions server effectTypes method pathUrl operation =
516516
encoded =
517517
encoder <| Elm.get "body" config
518518
in
519-
{ core = Gen.Http.jsonBody encoded
520-
, elmPages = Gen.BackendTask.Http.jsonBody encoded
521-
, lamderaProgramTest = Gen.Effect.Http.jsonBody encoded
519+
{ core = Gen.Http.call_.jsonBody encoded
520+
, elmPages = Gen.BackendTask.Http.call_.jsonBody encoded
521+
, lamderaProgramTest = Gen.Effect.Http.call_.jsonBody encoded
522522
}
523523
)
524524

@@ -539,13 +539,13 @@ toRequestFunctions server effectTypes method pathUrl operation =
539539
CliMonad.succeed <|
540540
\config ->
541541
let
542-
toBody : (String -> Elm.Expression -> Elm.Expression) -> Elm.Expression
542+
toBody : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression
543543
toBody f =
544-
f mime (Elm.get "body" config)
544+
f (Elm.string mime) (Elm.get "body" config)
545545
in
546-
{ core = toBody Gen.Http.bytesBody
547-
, elmPages = toBody Gen.BackendTask.Http.bytesBody
548-
, lamderaProgramTest = toBody Gen.Effect.Http.bytesBody
546+
{ core = toBody Gen.Http.call_.bytesBody
547+
, elmPages = toBody Gen.BackendTask.Http.call_.bytesBody
548+
, lamderaProgramTest = toBody Gen.Effect.Http.call_.bytesBody
549549
}
550550

551551
Base64Content mime ->

0 commit comments

Comments
 (0)