Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions codegen/elm.codegen.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"elm-codegen-version": "0.6.1",
"elm-codegen-version": "0.6.3",
"codegen-helpers": {
"packages": {
"elm/bytes": "1.0.8",
Expand All @@ -8,7 +8,7 @@
"elm/json": "1.1.3",
"elm-community/json-extra": "4.3.0",
"elm/url": "1.0.0",
"dillonkearns/elm-pages": "11.0.0",
"dillonkearns/elm-pages": "12.1.0",
"justinmimbs/time-extra": "1.2.0",
"justinmimbs/date": "4.1.0",
"elm/time": "1.0.0",
Expand All @@ -21,4 +21,4 @@
"helpers"
]
}
}
}
1 change: 1 addition & 0 deletions review/src/ReviewConfig.elm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ exceptCodegenRules =
, Docs.ReviewLinksAndSections.rule
|> Rule.ignoreErrorsForDirectories [ "src/Gen" ]
, Docs.ReviewAtDocs.rule
|> Rule.ignoreErrorsForDirectories [ "src/Gen" ]
, Docs.UpToDateReadmeLinks.rule
, NoConfusingPrefixOperator.rule
, NoDebug.Log.rule
Expand Down
14 changes: 0 additions & 14 deletions review/suppressed/Docs.ReviewAtDocs.json

This file was deleted.

52 changes: 3 additions & 49 deletions src/Gen/BackendTask/Http.elm
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
module Gen.BackendTask.Http exposing
( expectString, expectJson
, expectBytes, emptyBody, jsonBody
, expectBytes, emptyBody
, annotation_, call_
, bytesBody
)

{-|


# Generated bindings for BackendTask.Http

@docs get, expectString, expectJson
@docs expectBytes, emptyBody, jsonBody
@docs bytesBodyWithOptions
@docs expectString, expectJson
@docs expectBytes, emptyBody
@docs annotation_, call_

-}
Expand Down Expand Up @@ -138,50 +136,6 @@ emptyBody =
}


{-| 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).

jsonBody: Json.Encode.Value -> BackendTask.Http.Body

-}
jsonBody : Elm.Expression -> Elm.Expression
jsonBody jsonBodyArg_ =
Elm.apply
(Elm.value
{ importFrom = [ "BackendTask", "Http" ]
, name = "jsonBody"
, annotation =
Just
(Type.function
[ Type.namedWith [ "Json", "Encode" ] "Value" [] ]
(Type.namedWith [ "BackendTask", "Http" ] "Body" [])
)
}
)
[ jsonBodyArg_ ]


{-| 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).

bytesBody: String -> Bytes.Bytes -> BackendTask.Http.Body

-}
bytesBody : String -> Elm.Expression -> Elm.Expression
bytesBody bytesBodyArg_ bytesBodyArg_0 =
Elm.apply
(Elm.value
{ importFrom = [ "BackendTask", "Http" ]
, name = "bytesBody"
, annotation =
Just
(Type.function
[ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ]
(Type.namedWith [ "BackendTask", "Http" ] "Body" [])
)
}
)
[ Elm.string bytesBodyArg_, bytesBodyArg_0 ]


annotation_ :
{ expect : Type.Annotation -> Type.Annotation
, error : Type.Annotation
Expand Down
65 changes: 0 additions & 65 deletions src/Gen/Effect/Http.elm
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module Gen.Effect.Http exposing
( bytesResolver, stringResolver
, expectBytesResponse, expectStringResponse
, bytesBody, jsonBody
, emptyBody, annotation_
, caseOf_, call_
)
Expand All @@ -13,7 +12,6 @@ module Gen.Effect.Http exposing

@docs bytesResolver, stringResolver
@docs expectBytesResponse, expectStringResponse
@docs bytesBody, jsonBody
@docs emptyBody, annotation_
@docs caseOf_, call_

Expand Down Expand Up @@ -237,69 +235,6 @@ expectStringResponse expectStringResponseArg_ expectStringResponseArg_0 =
]


{-| {-| Put some `Bytes` in the body of your `Request`. This allows you to use
[`elm/bytes`](/packages/elm/bytes/latest) to have full control over the binary
representation of the data you are sending. For example, you could create an
`archive.zip` file and send it along like this:

import Bytes exposing (Bytes)

zipBody : Bytes -> Body
zipBody bytes =
bytesBody "application/zip" bytes

The first argument is a [MIME type](https://en.wikipedia.org/wiki/Media_type)
of the body. In other scenarios you may want to use MIME types like `image/png`
or `image/jpeg` instead.

**Note:** Use [`track`](#track) to track upload progress.

-}

bytesBody: String -> Bytes.Bytes -> Effect.Http.Body

-}
bytesBody : String -> Elm.Expression -> Elm.Expression
bytesBody bytesBodyArg_ bytesBodyArg_0 =
Elm.apply
(Elm.value
{ importFrom = [ "Effect", "Http" ]
, name = "bytesBody"
, annotation =
Just
(Type.function
[ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ]
(Type.namedWith [ "Effect", "Http" ] "Body" [])
)
}
)
[ Elm.string bytesBodyArg_, bytesBodyArg_0 ]


{-| {-| Put some JSON value in the body of your `Request`. This will automatically
add the `Content-Type: application/json` header.
-}

jsonBody: Json.Encode.Value -> Effect.Http.Body

-}
jsonBody : Elm.Expression -> Elm.Expression
jsonBody jsonBodyArg_ =
Elm.apply
(Elm.value
{ importFrom = [ "Effect", "Http" ]
, name = "jsonBody"
, annotation =
Just
(Type.function
[ Type.namedWith [ "Json", "Encode" ] "Value" [] ]
(Type.namedWith [ "Effect", "Http" ] "Body" [])
)
}
)
[ jsonBodyArg_ ]


{-| {-| Create an empty body for your `Request`.
-}

Expand Down
69 changes: 2 additions & 67 deletions src/Gen/Http.elm
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module Gen.Http exposing
( emptyBody
, jsonBody, bytesBody
, expectBytesResponse, stringResolver, bytesResolver, annotation_
, expectBytesResponse, expectStringResponse, stringResolver, bytesResolver, annotation_
, caseOf_, call_
, expectStringResponse
)

{-|
Expand All @@ -12,10 +10,7 @@ module Gen.Http exposing
# Generated bindings for Http

@docs emptyBody
@docs jsonBody, bytesBody
@docs expectString
@docs trackResponse
@docs expectBytesResponse, stringResolver, bytesResolver, annotation_
@docs expectBytesResponse, expectStringResponse, stringResolver, bytesResolver, annotation_
@docs caseOf_, call_

-}
Expand Down Expand Up @@ -48,66 +43,6 @@ emptyBody =
}


{-| Put some JSON value in the body of your `Request`. This will automatically
add the `Content-Type: application/json` header.

jsonBody: Json.Encode.Value -> Http.Body

-}
jsonBody : Elm.Expression -> Elm.Expression
jsonBody jsonBodyArg_ =
Elm.apply
(Elm.value
{ importFrom = [ "Http" ]
, name = "jsonBody"
, annotation =
Just
(Type.function
[ Type.namedWith [ "Json", "Encode" ] "Value" [] ]
(Type.namedWith [ "Http" ] "Body" [])
)
}
)
[ jsonBodyArg_ ]


{-| Put some `Bytes` in the body of your `Request`. This allows you to use
[`elm/bytes`](/packages/elm/bytes/latest) to have full control over the binary
representation of the data you are sending. For example, you could create an
`archive.zip` file and send it along like this:

import Bytes exposing (Bytes)

zipBody : Bytes -> Body
zipBody bytes =
bytesBody "application/zip" bytes

The first argument is a [MIME type](https://en.wikipedia.org/wiki/Media_type)
of the body. In other scenarios you may want to use MIME types like `image/png`
or `image/jpeg` instead.

**Note:** Use [`track`](#track) to track upload progress.

bytesBody: String -> Bytes.Bytes -> Http.Body

-}
bytesBody : String -> Elm.Expression -> Elm.Expression
bytesBody bytesBodyArg_ bytesBodyArg_0 =
Elm.apply
(Elm.value
{ importFrom = [ "Http" ]
, name = "bytesBody"
, annotation =
Just
(Type.function
[ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ]
(Type.namedWith [ "Http" ] "Body" [])
)
}
)
[ Elm.string bytesBodyArg_, bytesBodyArg_0 ]


{-| Expect a [`Response`](#Response) with a `String` body. So you could define
your own [`expectJson`](#expectJson) like this:

Expand Down
16 changes: 8 additions & 8 deletions src/OpenApi/Generate.elm
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,9 @@ toRequestFunctions server effectTypes method pathUrl operation =
encoded =
encoder <| Elm.get "body" config
in
{ core = Gen.Http.jsonBody encoded
, elmPages = Gen.BackendTask.Http.jsonBody encoded
, lamderaProgramTest = Gen.Effect.Http.jsonBody encoded
{ core = Gen.Http.call_.jsonBody encoded
, elmPages = Gen.BackendTask.Http.call_.jsonBody encoded
, lamderaProgramTest = Gen.Effect.Http.call_.jsonBody encoded
}
)

Expand All @@ -539,13 +539,13 @@ toRequestFunctions server effectTypes method pathUrl operation =
CliMonad.succeed <|
\config ->
let
toBody : (String -> Elm.Expression -> Elm.Expression) -> Elm.Expression
toBody : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression
toBody f =
f mime (Elm.get "body" config)
f (Elm.string mime) (Elm.get "body" config)
in
{ core = toBody Gen.Http.bytesBody
, elmPages = toBody Gen.BackendTask.Http.bytesBody
, lamderaProgramTest = toBody Gen.Effect.Http.bytesBody
{ core = toBody Gen.Http.call_.bytesBody
, elmPages = toBody Gen.BackendTask.Http.call_.bytesBody
, lamderaProgramTest = toBody Gen.Effect.Http.call_.bytesBody
}

Base64Content mime ->
Expand Down
Loading