Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- elmEndpointDefinition :: Expression Void -> Module -> Endpoint -> Definition
- elmEndpointRequestInfo :: Module -> Endpoint -> Definition
- class HasElmEndpoints api where
- elmEndpoints' :: Endpoint -> [Endpoint]
- elmEndpoints :: forall api. HasElmEndpoints api => [Endpoint]
- data Endpoint = Endpoint {}
- data PathSegment e
- data QueryParamType
- data URL = URL {
- _path :: [PathSegment Encoder]
- _queryString :: [(Text, QueryParamType, Encoder)]
- data Encoder = Encoder {}
- data Decoder = Decoder {}
- makeEncoder :: forall value a. HasElmEncoder value a => Encoder
- makeDecoder :: forall value a. HasElmDecoder value a => Decoder
Documentation
elmEndpointDefinition Source #
:: Expression Void | The URL base of the endpoint |
-> Module | The module that the function should be generated into |
-> Endpoint | A description of the endpoint |
-> Definition |
Generate an Elm function for making a request to a Servant endpoint.
See elmEndpointRequestInfo
if you need more flexibility,
such as setting timeouts.
elmEndpointRequestInfo Source #
:: Module | The module that the function should be generated into |
-> Endpoint | A description of the endpoint |
-> Definition |
Generate an Elm function for creating information needed to make an HTTP request. This gives the user flexibility in how to actually make the request.
For example, they can use the https://package.elm-lang.org/packages/elm/http/latest/Http#request
function and provide it with their own timeout
and tracker
arguments.
It also leaves building the final URL to the Elm user.
This gives them the flexibility to do things like vary the domain used at runtime
based on whether the app's in staging or production.
Note that they must remember to use BOTH urlPath
and urlQueryParams
.
class HasElmEndpoints api where Source #
means that the Servant API HasElmEndpoints
apiapi
can be converted
to a list of Endpoint
s, which contains the information we need to generate
an Elm client library for the API.
elmEndpoints' :: Endpoint -> [Endpoint] Source #
Instances
elmEndpoints :: forall api. HasElmEndpoints api => [Endpoint] Source #
Convert an API to a list of Elm endpoint descriptors, Endpoint
.
Usage: elmEndpoints
@MyAPI
Contains the information we need about an endpoint to generate an Elm definition that calls it.
data PathSegment e Source #
Instances
Show e => Show (PathSegment e) Source # | |
Defined in Servant.To.Elm showsPrec :: Int -> PathSegment e -> ShowS # show :: PathSegment e -> String # showList :: [PathSegment e] -> ShowS # |
data QueryParamType Source #
Instances
Show QueryParamType Source # | |
Defined in Servant.To.Elm showsPrec :: Int -> QueryParamType -> ShowS # show :: QueryParamType -> String # showList :: [QueryParamType] -> ShowS # |
URL | |
|
makeEncoder :: forall value a. HasElmEncoder value a => Encoder Source #
makeDecoder :: forall value a. HasElmDecoder value a => Decoder Source #
Orphan instances
HasElmType (MultipartData tag :: Type) Source # | |
HasElmEncoder (MultipartData tag :: Type) (MultipartData tag :: Type) Source # | |