Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module re-exports types and combinators required for type level construction of API request components and expected type structure of an http request response.
Synopsis
- module Hreq.Core.API.Request
- module Hreq.Core.API.Response
- module Hreq.Core.API.Internal
- module Hreq.Core.API.MediaType
- module Hreq.Core.API.Streaming
- module Hreq.Core.API.TypeLevel
- module Hreq.Core.API.Verb
- type EmptyResponse v = Verb v ('[] :: [ResContent Type])
- type RawResponse v = Verb v '[Raw]
- type DeleteJson a = Delete '[ResBody JSON a]
- type PatchJson a = Patch '[ResBody JSON a]
- type PutJson a = Put '[ResBody JSON a]
- type PostJson a = Post '[ResBody JSON a]
- type GetJson a = Get '[ResBody JSON a]
- type JsonBody (a :: Type) = ReqBody JSON a
- type StatusCode = Int
- class ToHttpApiData a where
- toUrlPiece :: a -> Text
- toEncodedUrlPiece :: a -> Builder
- toHeader :: a -> ByteString
- toQueryParam :: a -> Text
- type Header = (HeaderName, ByteString)
- data Status = Status {}
- type HeaderName = CI ByteString
Request
module Hreq.Core.API.Request
Response
module Hreq.Core.API.Response
API Types and Kinds
module Hreq.Core.API.Internal
MediaType
module Hreq.Core.API.MediaType
Streaming
module Hreq.Core.API.Streaming
TypeLevel
module Hreq.Core.API.TypeLevel
Verb
module Hreq.Core.API.Verb
API Type Synonyms
type EmptyResponse v = Verb v ('[] :: [ResContent Type]) Source #
type RawResponse v = Verb v '[Raw] Source #
type StatusCode = Int Source #
Re-exports
class ToHttpApiData a where #
Convert value to HTTP API data.
WARNING: Do not derive this using DeriveAnyClass
as the generated
instance will loop indefinitely.
toUrlPiece :: a -> Text #
Convert to URL path piece.
toEncodedUrlPiece :: a -> Builder #
Convert to a URL path piece, making sure to encode any special chars.
The default definition uses encodePathSegmentsRelative
,
but this may be overriden with a more efficient version.
toHeader :: a -> ByteString #
Convert to HTTP header value.
toQueryParam :: a -> Text #
Convert to query param value.
Instances
type Header = (HeaderName, ByteString) #
Header
HTTP Status.
Only the statusCode
is used for comparisons.
Please use mkStatus
to create status codes from code and message, or the Enum
instance or the
status code constants (like ok200
). There might be additional record members in the future.
Note that the Show instance is only for debugging.
type HeaderName = CI ByteString #
Header name