-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Helpers for generating clients for servant APIs in any programming language
--   
--   Helper types and functions for generating client functions for servant
--   APIs in any programming language
--   
--   This package provides types and functions that collect all the data
--   needed to generate client functions in the programming language of
--   your choice. This effectively means you only have to write the code
--   that "pretty-prints" this data as some code in your target language.
--   
--   See the servant-js package for an example
--   
--   <a>CHANGELOG</a>
@package servant-foreign
@version 0.16.1

module Servant.Foreign.Internal

-- | Canonical name of the endpoint, can be used to generate a function
--   name.
--   
--   You can use the functions in <a>Servant.Foreign.Inflections</a>, like
--   <a>camelCase</a> to transform to <a>Text</a>.
newtype FunctionName
FunctionName :: [Text] -> FunctionName
[unFunctionName] :: FunctionName -> [Text]
_FunctionName :: Iso' FunctionName [Text]

-- | See documentation of <tt>Arg</tt>
newtype PathSegment
PathSegment :: Text -> PathSegment
[unPathSegment] :: PathSegment -> Text
_PathSegment :: Iso' PathSegment Text

-- | Maps a name to the foreign type that belongs to the annotated value.
--   
--   Used for header args, query args, and capture args.
data Arg ftype
Arg :: PathSegment -> ftype -> Arg ftype

-- | The name to be captured.
--   
--   Only for capture args it really denotes a path segment.
[_argName] :: Arg ftype -> PathSegment

-- | Foreign type the associated value will have
[_argType] :: Arg ftype -> ftype
argName :: forall ftype f. Functor f => (PathSegment -> f PathSegment) -> Arg ftype -> f (Arg ftype)
argType :: forall ftype1 ftype2 f. Functor f => (ftype1 -> f ftype2) -> Arg ftype1 -> f (Arg ftype2)
argPath :: forall ftype f. (Contravariant f, Functor f) => (Text -> f Text) -> Arg ftype -> f (Arg ftype)
data SegmentType ftype

-- | Static path segment.
--   
--   <pre>
--   "foo/bar/baz"
--   </pre>
--   
--   contains the static segments <tt>"foo"</tt>, <tt>"bar"</tt> and
--   <tt>"baz"</tt>.
Static :: PathSegment -> SegmentType ftype

-- | A capture.
--   
--   <pre>
--   "user/{userid}/name"
--   </pre>
--   
--   would capture the arg <tt>userid</tt> with type <tt>ftype</tt>.
Cap :: Arg ftype -> SegmentType ftype
_Static :: forall ftype p f. (Choice p, Applicative f) => p PathSegment (f PathSegment) -> p (SegmentType ftype) (f (SegmentType ftype))
_Cap :: forall ftype1 ftype2 p f. (Choice p, Applicative f) => p (Arg ftype1) (f (Arg ftype2)) -> p (SegmentType ftype1) (f (SegmentType ftype2))

-- | A part of the Url’s path.
newtype Segment ftype
Segment :: SegmentType ftype -> Segment ftype
[unSegment] :: Segment ftype -> SegmentType ftype
_Segment :: forall ftype1 ftype2 p f. (Profunctor p, Functor f) => p (SegmentType ftype1) (f (SegmentType ftype2)) -> p (Segment ftype1) (f (Segment ftype2))

-- | Whether a segment is a <a>Cap</a>.
isCapture :: Segment ftype -> Bool

-- | Crashing Arg extraction from segment, TODO: remove
captureArg :: Segment ftype -> Arg ftype
type Path ftype = [Segment ftype]

-- | Type of a <tt>QueryArg</tt>.
data ArgType
Normal :: ArgType
Flag :: ArgType
List :: ArgType
_Normal :: Prism' ArgType ()
_Flag :: Prism' ArgType ()
_List :: Prism' ArgType ()

-- | Url Query argument.
--   
--   Urls can contain query arguments, which is a list of key-value pairs.
--   In a typical url, query arguments look like this:
--   
--   <pre>
--   ?foo=bar&amp;alist[]=el1&amp;alist[]=el2&amp;aflag
--   </pre>
--   
--   Each pair can be
--   
--   <ul>
--   <li><tt>?foo=bar</tt>: a plain key-val pair, either optional or
--   required (<a>QueryParam</a>)</li>
--   <li><tt>?aflag</tt>: a flag (no value, implicitly Bool with default
--   <tt>false</tt> if it’s missing) (<a>QueryFlag</a>)</li>
--   <li><tt>?alist[]=el1&amp;alist[]=el2</tt>: list of values
--   (<a>QueryParams</a>)</li>
--   </ul>
--   
--   <tt>_queryArgType</tt> will be set accordingly.
--   
--   For the plain key-val pairs (<a>QueryParam</a>),
--   <tt>_queryArgName</tt>’s <tt>ftype</tt> will be wrapped in a
--   <tt>Maybe</tt> if the argument is optional.
data QueryArg ftype
QueryArg :: Arg ftype -> ArgType -> QueryArg ftype

-- | Name and foreign type of the argument. Will be wrapped in <a>Maybe</a>
--   if the query is optional and in a `[]` if the query is a list
[_queryArgName] :: QueryArg ftype -> Arg ftype

-- | one of normal/plain, list or flag
[_queryArgType] :: QueryArg ftype -> ArgType
queryArgName :: forall ftype1 ftype2 f. Functor f => (Arg ftype1 -> f (Arg ftype2)) -> QueryArg ftype1 -> f (QueryArg ftype2)
queryArgType :: forall ftype f. Functor f => (ArgType -> f ArgType) -> QueryArg ftype -> f (QueryArg ftype)
data HeaderArg ftype

-- | The name of the header and the foreign type of its value.
HeaderArg :: Arg ftype -> HeaderArg ftype
[_headerArg] :: HeaderArg ftype -> Arg ftype

-- | Unused, will never be set.
--   
--   TODO: remove
ReplaceHeaderArg :: Arg ftype -> Text -> HeaderArg ftype
[_headerArg] :: HeaderArg ftype -> Arg ftype
[_headerPattern] :: HeaderArg ftype -> Text
headerArg :: forall ftype1 ftype2 f. Functor f => (Arg ftype1 -> f (Arg ftype2)) -> HeaderArg ftype1 -> f (HeaderArg ftype2)
headerPattern :: forall ftype f. Applicative f => (Text -> f Text) -> HeaderArg ftype -> f (HeaderArg ftype)
_HeaderArg :: forall ftype p f. (Choice p, Applicative f) => p (Arg ftype) (f (Arg ftype)) -> p (HeaderArg ftype) (f (HeaderArg ftype))
_ReplaceHeaderArg :: forall ftype p f. (Choice p, Applicative f) => p (Arg ftype, Text) (f (Arg ftype, Text)) -> p (HeaderArg ftype) (f (HeaderArg ftype))

-- | Full endpoint url, with all captures and parameters
data Url ftype
Url :: Path ftype -> [QueryArg ftype] -> Maybe ftype -> Url ftype

-- | Url path, list of either static segments or captures
--   
--   <pre>
--   "foo/{id}/bar"
--   </pre>
[_path] :: Url ftype -> Path ftype

-- | List of query args
--   
--   <pre>
--   "?foo=bar&amp;a=b"
--   </pre>
[_queryStr] :: Url ftype -> [QueryArg ftype]

-- | Url fragment.
--   
--   Not sent to the HTTP server, so only useful for frontend matters (e.g.
--   inter-page linking).
--   
--   <pre>
--   #fragmentText
--   </pre>
[_frag] :: Url ftype -> Maybe ftype
defUrl :: Url ftype
frag :: forall ftype f. Functor f => (Maybe ftype -> f (Maybe ftype)) -> Url ftype -> f (Url ftype)
path :: forall ftype f. Functor f => (Path ftype -> f (Path ftype)) -> Url ftype -> f (Url ftype)
queryStr :: forall ftype f. Functor f => ([QueryArg ftype] -> f [QueryArg ftype]) -> Url ftype -> f (Url ftype)

-- | See documentation of <a>_reqBodyContentType</a>
data ReqBodyContentType
ReqBodyJSON :: ReqBodyContentType
ReqBodyMultipart :: ReqBodyContentType

-- | Full description of an endpoint in your API, generated by
--   <tt>listFromAPI</tt>. It should give you all the information needed to
--   generate foreign language bindings.
--   
--   Every field containing <tt>ftype</tt> will use the foreign type
--   mapping specified via <tt>HasForeignType</tt> (see its docstring on
--   how to set that up).
--   
--   See <a>https://docs.servant.dev/en/stable/tutorial/ApiType.html</a>
--   for accessible documentation of the possible content of an endpoint.
data Req ftype
Req :: Url ftype -> Method -> [HeaderArg ftype] -> Maybe ftype -> Maybe ftype -> FunctionName -> ReqBodyContentType -> Req ftype

-- | Full list of URL segments, including captures
[_reqUrl] :: Req ftype -> Url ftype

-- | <tt>"GET"</tt>/<tt>"POST"</tt>/<tt>"PUT"</tt>/…
[_reqMethod] :: Req ftype -> Method

-- | Headers required by this endpoint, with their type
[_reqHeaders] :: Req ftype -> [HeaderArg ftype]

-- | Foreign type of the expected request body (<a>ReqBody</a>), if any
[_reqBody] :: Req ftype -> Maybe ftype

-- | The foreign type of the response, if any
[_reqReturnType] :: Req ftype -> Maybe ftype

-- | The URL segments rendered in a way that they can be easily
--   concatenated into a canonical function name
[_reqFuncName] :: Req ftype -> FunctionName

-- | The content type the request body is transferred as.
--   
--   This is a severe limitation of <tt>servant-foreign</tt> currently, as
--   we only allow the content type to be <a>JSON</a> no user-defined
--   content types. (<a>ReqBodyMultipart</a> is not actually implemented.)
--   
--   Thus, any routes looking like this will work:
--   
--   <pre>
--   "foo" :&gt; Get '[JSON] Foo
--   </pre>
--   
--   while routes like
--   
--   <pre>
--   "foo" :&gt; Get '[MyFancyContentType] Foo
--   </pre>
--   
--   will fail with an error like
--   
--   <pre>
--   • JSON expected in list '[MyFancyContentType]
--   </pre>
[_reqBodyContentType] :: Req ftype -> ReqBodyContentType
reqBody :: forall ftype f. Functor f => (Maybe ftype -> f (Maybe ftype)) -> Req ftype -> f (Req ftype)
reqBodyContentType :: forall ftype f. Functor f => (ReqBodyContentType -> f ReqBodyContentType) -> Req ftype -> f (Req ftype)
reqFuncName :: forall ftype f. Functor f => (FunctionName -> f FunctionName) -> Req ftype -> f (Req ftype)
reqHeaders :: forall ftype f. Functor f => ([HeaderArg ftype] -> f [HeaderArg ftype]) -> Req ftype -> f (Req ftype)
reqMethod :: forall ftype f. Functor f => (Method -> f Method) -> Req ftype -> f (Req ftype)
reqReturnType :: forall ftype f. Functor f => (Maybe ftype -> f (Maybe ftype)) -> Req ftype -> f (Req ftype)
reqUrl :: forall ftype f. Functor f => (Url ftype -> f (Url ftype)) -> Req ftype -> f (Req ftype)
defReq :: Req ftype

-- | <a>HasForeignType</a> maps Haskell types with types in the target
--   language of your backend. For example, let's say you're implementing a
--   backend to some language <b>X</b>, and you want a Text representation
--   of each input/output type mentioned in the API:
--   
--   <pre>
--   -- First you need to create a dummy type to parametrize your
--   -- instances.
--   data LangX
--   
--   -- Otherwise you define instances for the types you need
--   instance HasForeignType LangX Text Int where
--      typeFor _ _ _ = "intX"
--   
--   -- Or for example in case of lists
--   instance HasForeignType LangX Text a =&gt; HasForeignType LangX Text [a] where
--      typeFor lang ftype _ = "listX of " &lt;&gt; typeFor lang ftype (Proxy :: Proxy a)
--   </pre>
--   
--   Finally to generate list of information about all the endpoints for an
--   API you create a function of a form:
--   
--   <pre>
--   getEndpoints :: (HasForeign LangX Text api, GenerateList Text (Foreign Text api))
--                =&gt; Proxy api -&gt; [Req Text]
--   getEndpoints api = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy Text) api
--   </pre>
--   
--   <pre>
--   -- If language __X__ is dynamically typed then you can use
--   -- a predefined NoTypes parameter with the NoContent output type:
--   </pre>
--   
--   <pre>
--   getEndpoints :: (HasForeign NoTypes NoContent api, GenerateList Text (Foreign NoContent api))
--                =&gt; Proxy api -&gt; [Req NoContent]
--   getEndpoints api = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) api
--   </pre>
class HasForeignType (lang :: k) ftype (a :: k1)
typeFor :: HasForeignType lang ftype a => Proxy lang -> Proxy ftype -> Proxy a -> ftype

-- | The language definition without any foreign types. It can be used for
--   dynamic languages which do not <i>do</i> type annotations.
data NoTypes

-- | Implementation of the Servant framework types.
--   
--   Relevant instances: Everything containing <a>HasForeignType</a>.
class HasForeign (lang :: k) ftype api where {
    type Foreign ftype api;
}
foreignFor :: HasForeign lang ftype api => Proxy lang -> Proxy ftype -> Proxy api -> Req ftype -> Foreign ftype api
data EmptyForeignAPI
EmptyForeignAPI :: EmptyForeignAPI

-- | Utility class used by <a>listFromAPI</a> which computes the data
--   needed to generate a function for each endpoint and hands it all back
--   in a list.
class GenerateList ftype reqs
generateList :: GenerateList ftype reqs => reqs -> [Req ftype]

-- | Generate the necessary data for codegen as a list, each <a>Req</a>
--   describing one endpoint from your API type.
listFromAPI :: forall {k} (lang :: k) ftype api. (HasForeign lang ftype api, GenerateList ftype (Foreign ftype api)) => Proxy lang -> Proxy ftype -> Proxy api -> [Req ftype]
instance GHC.Internal.Data.Data.Data ftype => GHC.Internal.Data.Data.Data (Servant.Foreign.Internal.Arg ftype)
instance GHC.Internal.Data.Data.Data Servant.Foreign.Internal.ArgType
instance GHC.Internal.Data.Data.Data Servant.Foreign.Internal.FunctionName
instance GHC.Internal.Data.Data.Data ftype => GHC.Internal.Data.Data.Data (Servant.Foreign.Internal.HeaderArg ftype)
instance GHC.Internal.Data.Data.Data Servant.Foreign.Internal.PathSegment
instance GHC.Internal.Data.Data.Data ftype => GHC.Internal.Data.Data.Data (Servant.Foreign.Internal.QueryArg ftype)
instance GHC.Internal.Data.Data.Data ftype => GHC.Internal.Data.Data.Data (Servant.Foreign.Internal.Req ftype)
instance GHC.Internal.Data.Data.Data Servant.Foreign.Internal.ReqBodyContentType
instance GHC.Internal.Data.Data.Data ftype => GHC.Internal.Data.Data.Data (Servant.Foreign.Internal.Segment ftype)
instance GHC.Internal.Data.Data.Data ftype => GHC.Internal.Data.Data.Data (Servant.Foreign.Internal.SegmentType ftype)
instance GHC.Internal.Data.Data.Data ftype => GHC.Internal.Data.Data.Data (Servant.Foreign.Internal.Url ftype)
instance GHC.Classes.Eq ftype => GHC.Classes.Eq (Servant.Foreign.Internal.Arg ftype)
instance GHC.Classes.Eq Servant.Foreign.Internal.ArgType
instance GHC.Classes.Eq Servant.Foreign.Internal.FunctionName
instance GHC.Classes.Eq ftype => GHC.Classes.Eq (Servant.Foreign.Internal.HeaderArg ftype)
instance GHC.Classes.Eq Servant.Foreign.Internal.PathSegment
instance GHC.Classes.Eq ftype => GHC.Classes.Eq (Servant.Foreign.Internal.QueryArg ftype)
instance GHC.Classes.Eq ftype => GHC.Classes.Eq (Servant.Foreign.Internal.Req ftype)
instance GHC.Classes.Eq Servant.Foreign.Internal.ReqBodyContentType
instance GHC.Classes.Eq ftype => GHC.Classes.Eq (Servant.Foreign.Internal.Segment ftype)
instance GHC.Classes.Eq ftype => GHC.Classes.Eq (Servant.Foreign.Internal.SegmentType ftype)
instance GHC.Classes.Eq ftype => GHC.Classes.Eq (Servant.Foreign.Internal.Url ftype)
instance (Servant.Foreign.Internal.GenerateList ftype start, Servant.Foreign.Internal.GenerateList ftype rest) => Servant.Foreign.Internal.GenerateList ftype (start Servant.API.Alternative.:<|> rest)
instance Servant.Foreign.Internal.GenerateList ftype Servant.Foreign.Internal.EmptyForeignAPI
instance Servant.Foreign.Internal.GenerateList ftype (Servant.Foreign.Internal.Req ftype)
instance forall k (a :: k). Servant.Foreign.Internal.HasForeignType Servant.Foreign.Internal.NoTypes Servant.API.ContentTypes.NoContent a
instance forall k (lang :: k) ftype a b. (Servant.Foreign.Internal.HasForeign lang ftype a, Servant.Foreign.Internal.HasForeign lang ftype b) => Servant.Foreign.Internal.HasForeign lang ftype (a Servant.API.Alternative.:<|> b)
instance forall k (lang :: k) ftype a api. (Servant.Foreign.Internal.HasForeignType lang ftype (GHC.Internal.Maybe.Maybe a), Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Fragment.Fragment a Servant.API.Sub.:> api)
instance forall k (list :: [*]) (lang :: k) ftype a api (mods :: [*]). (Servant.API.TypeLevel.Elem Servant.API.ContentTypes.JSON list, Servant.Foreign.Internal.HasForeignType lang ftype a, Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.ReqBody.ReqBody' mods list a Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api (mods :: [*]) framing ctype a. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Stream.StreamBody' mods framing ctype a Servant.API.Sub.:> api)
instance forall k (path :: GHC.Types.Symbol) (lang :: k) ftype api. (GHC.Internal.TypeLits.KnownSymbol path, Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (path Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.RemoteHost.RemoteHost Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.IsSecure.IsSecure Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Data.Vault.Lazy.Vault Servant.API.Sub.:> api)
instance forall k1 k2 (lang :: k1) ftype api (res :: k2). Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.WithResource.WithResource res Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype t api (mods :: [*]). (GHC.Internal.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype t, Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Capture.Capture' mods sym t Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype t sublayout. (GHC.Internal.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype [t], Servant.Foreign.Internal.HasForeign lang ftype sublayout) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Capture.CaptureAll sym t Servant.API.Sub.:> sublayout)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype (mods :: [*]) a api. (GHC.Internal.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype (Servant.API.Modifiers.RequiredArgument mods a), Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Header.Header' mods sym a Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype (mods :: [*]) a api. (GHC.Internal.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype (Servant.API.Modifiers.RequiredArgument mods a), Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.QueryParam.QueryParam' mods sym a Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype a api. (GHC.Internal.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype [a], Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.QueryParam.QueryParams sym a Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype api. (GHC.Internal.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype GHC.Types.Bool, Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.QueryParam.QueryFlag sym Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Network.HTTP.Types.Version.HttpVersion Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api (desc :: GHC.Types.Symbol). Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Description.Summary desc Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api (desc :: GHC.Types.Symbol). Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Description.Description desc Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype. Servant.Foreign.Internal.HasForeign lang ftype Servant.API.Empty.EmptyAPI
instance forall k (lang :: k) ftype (r :: * -> *). Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Generic.ToServantApi r) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.NamedRoutes.NamedRoutes r)
instance forall k k1 (lang :: k) ftype (method :: k1). (Servant.Foreign.Internal.HasForeignType lang ftype Servant.API.ContentTypes.NoContent, Servant.API.Verbs.ReflectMethod method) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Verbs.NoContentVerb method)
instance forall k (lang :: k) ftype. Servant.Foreign.Internal.HasForeign lang ftype Servant.API.Raw.Raw
instance forall k k1 ct (lang :: k) ftype a (method :: k1) (status :: GHC.Internal.TypeNats.Nat) framing. (ct GHC.Types.~ Servant.API.ContentTypes.JSON, Servant.Foreign.Internal.HasForeignType lang ftype a, Servant.API.Verbs.ReflectMethod method) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Stream.Stream method status framing ct a)
instance forall k k1 (list :: [*]) (lang :: k) ftype a (method :: k1) (status :: GHC.Internal.TypeNats.Nat). (Servant.API.TypeLevel.Elem Servant.API.ContentTypes.JSON list, Servant.Foreign.Internal.HasForeignType lang ftype a, Servant.API.Verbs.ReflectMethod method) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Verbs.Verb method status list a)
instance forall k (lang :: k) ftype api (name :: GHC.Types.Symbol) (context :: [*]). Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.WithNamedContext.WithNamedContext name context api)
instance GHC.Internal.Data.String.IsString Servant.Foreign.Internal.PathSegment
instance GHC.Internal.Base.Monoid Servant.Foreign.Internal.FunctionName
instance GHC.Internal.Base.Monoid Servant.Foreign.Internal.PathSegment
instance GHC.Internal.Read.Read Servant.Foreign.Internal.ReqBodyContentType
instance GHC.Internal.Base.Semigroup Servant.Foreign.Internal.FunctionName
instance GHC.Internal.Base.Semigroup Servant.Foreign.Internal.PathSegment
instance GHC.Internal.Show.Show ftype => GHC.Internal.Show.Show (Servant.Foreign.Internal.Arg ftype)
instance GHC.Internal.Show.Show Servant.Foreign.Internal.ArgType
instance GHC.Internal.Show.Show Servant.Foreign.Internal.FunctionName
instance GHC.Internal.Show.Show ftype => GHC.Internal.Show.Show (Servant.Foreign.Internal.HeaderArg ftype)
instance GHC.Internal.Show.Show Servant.Foreign.Internal.PathSegment
instance GHC.Internal.Show.Show ftype => GHC.Internal.Show.Show (Servant.Foreign.Internal.QueryArg ftype)
instance GHC.Internal.Show.Show ftype => GHC.Internal.Show.Show (Servant.Foreign.Internal.Req ftype)
instance GHC.Internal.Show.Show Servant.Foreign.Internal.ReqBodyContentType
instance GHC.Internal.Show.Show ftype => GHC.Internal.Show.Show (Servant.Foreign.Internal.Segment ftype)
instance GHC.Internal.Show.Show ftype => GHC.Internal.Show.Show (Servant.Foreign.Internal.SegmentType ftype)
instance GHC.Internal.Show.Show ftype => GHC.Internal.Show.Show (Servant.Foreign.Internal.Url ftype)

module Servant.Foreign.Inflections

-- | Simply concat each part of the FunctionName together.
--   
--   <pre>
--   [ "get", "documents", "by", "id" ] → "getdocumentsbyid"
--   </pre>
concatCase :: FunctionName -> Text

-- | Use the snake_case convention. Each part is separated by a single
--   underscore character.
--   
--   <pre>
--   [ "get", "documents", "by", "id" ] → "get_documents_by_id"
--   </pre>
snakeCase :: FunctionName -> Text

-- | Use the camelCase convention. The first part is lower case, every
--   other part starts with an upper case character.
--   
--   <pre>
--   [ "get", "documents", "by", "id" ] → "getDocumentsById"
--   </pre>
camelCase :: FunctionName -> Text
concatCaseL :: Getter FunctionName Text
snakeCaseL :: Getter FunctionName Text
camelCaseL :: Getter FunctionName Text


-- | Generalizes all the data needed to make code generation work with
--   arbitrary programming languages.
--   
--   See documentation of <a>HasForeignType</a> for a simple example.
--   <a>listFromAPI</a> returns a list of all your endpoints and their
--   foreign types, given a mapping from Haskell types to foreign types
--   (conventionally called <tt>ftypes</tt> below).
module Servant.Foreign

-- | Generate the necessary data for codegen as a list, each <a>Req</a>
--   describing one endpoint from your API type.
listFromAPI :: forall {k} (lang :: k) ftype api. (HasForeign lang ftype api, GenerateList ftype (Foreign ftype api)) => Proxy lang -> Proxy ftype -> Proxy api -> [Req ftype]

-- | Full description of an endpoint in your API, generated by
--   <tt>listFromAPI</tt>. It should give you all the information needed to
--   generate foreign language bindings.
--   
--   Every field containing <tt>ftype</tt> will use the foreign type
--   mapping specified via <tt>HasForeignType</tt> (see its docstring on
--   how to set that up).
--   
--   See <a>https://docs.servant.dev/en/stable/tutorial/ApiType.html</a>
--   for accessible documentation of the possible content of an endpoint.
data Req ftype
Req :: Url ftype -> Method -> [HeaderArg ftype] -> Maybe ftype -> Maybe ftype -> FunctionName -> ReqBodyContentType -> Req ftype

-- | Full list of URL segments, including captures
[_reqUrl] :: Req ftype -> Url ftype

-- | <tt>"GET"</tt>/<tt>"POST"</tt>/<tt>"PUT"</tt>/…
[_reqMethod] :: Req ftype -> Method

-- | Headers required by this endpoint, with their type
[_reqHeaders] :: Req ftype -> [HeaderArg ftype]

-- | Foreign type of the expected request body (<a>ReqBody</a>), if any
[_reqBody] :: Req ftype -> Maybe ftype

-- | The foreign type of the response, if any
[_reqReturnType] :: Req ftype -> Maybe ftype

-- | The URL segments rendered in a way that they can be easily
--   concatenated into a canonical function name
[_reqFuncName] :: Req ftype -> FunctionName

-- | The content type the request body is transferred as.
--   
--   This is a severe limitation of <tt>servant-foreign</tt> currently, as
--   we only allow the content type to be <a>JSON</a> no user-defined
--   content types. (<a>ReqBodyMultipart</a> is not actually implemented.)
--   
--   Thus, any routes looking like this will work:
--   
--   <pre>
--   "foo" :&gt; Get '[JSON] Foo
--   </pre>
--   
--   while routes like
--   
--   <pre>
--   "foo" :&gt; Get '[MyFancyContentType] Foo
--   </pre>
--   
--   will fail with an error like
--   
--   <pre>
--   • JSON expected in list '[MyFancyContentType]
--   </pre>
[_reqBodyContentType] :: Req ftype -> ReqBodyContentType
defReq :: Req ftype

-- | <a>HasForeignType</a> maps Haskell types with types in the target
--   language of your backend. For example, let's say you're implementing a
--   backend to some language <b>X</b>, and you want a Text representation
--   of each input/output type mentioned in the API:
--   
--   <pre>
--   -- First you need to create a dummy type to parametrize your
--   -- instances.
--   data LangX
--   
--   -- Otherwise you define instances for the types you need
--   instance HasForeignType LangX Text Int where
--      typeFor _ _ _ = "intX"
--   
--   -- Or for example in case of lists
--   instance HasForeignType LangX Text a =&gt; HasForeignType LangX Text [a] where
--      typeFor lang ftype _ = "listX of " &lt;&gt; typeFor lang ftype (Proxy :: Proxy a)
--   </pre>
--   
--   Finally to generate list of information about all the endpoints for an
--   API you create a function of a form:
--   
--   <pre>
--   getEndpoints :: (HasForeign LangX Text api, GenerateList Text (Foreign Text api))
--                =&gt; Proxy api -&gt; [Req Text]
--   getEndpoints api = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy Text) api
--   </pre>
--   
--   <pre>
--   -- If language __X__ is dynamically typed then you can use
--   -- a predefined NoTypes parameter with the NoContent output type:
--   </pre>
--   
--   <pre>
--   getEndpoints :: (HasForeign NoTypes NoContent api, GenerateList Text (Foreign NoContent api))
--                =&gt; Proxy api -&gt; [Req NoContent]
--   getEndpoints api = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) api
--   </pre>
class HasForeignType (lang :: k) ftype (a :: k1)
typeFor :: HasForeignType lang ftype a => Proxy lang -> Proxy ftype -> Proxy a -> ftype

-- | Utility class used by <a>listFromAPI</a> which computes the data
--   needed to generate a function for each endpoint and hands it all back
--   in a list.
class GenerateList ftype reqs
generateList :: GenerateList ftype reqs => reqs -> [Req ftype]

-- | Implementation of the Servant framework types.
--   
--   Relevant instances: Everything containing <a>HasForeignType</a>.
class HasForeign (lang :: k) ftype api where {
    type Foreign ftype api;
}
foreignFor :: HasForeign lang ftype api => Proxy lang -> Proxy ftype -> Proxy api -> Req ftype -> Foreign ftype api

-- | The language definition without any foreign types. It can be used for
--   dynamic languages which do not <i>do</i> type annotations.
data NoTypes

-- | Full endpoint url, with all captures and parameters
data Url ftype
Url :: Path ftype -> [QueryArg ftype] -> Maybe ftype -> Url ftype

-- | Url path, list of either static segments or captures
--   
--   <pre>
--   "foo/{id}/bar"
--   </pre>
[_path] :: Url ftype -> Path ftype

-- | List of query args
--   
--   <pre>
--   "?foo=bar&amp;a=b"
--   </pre>
[_queryStr] :: Url ftype -> [QueryArg ftype]

-- | Url fragment.
--   
--   Not sent to the HTTP server, so only useful for frontend matters (e.g.
--   inter-page linking).
--   
--   <pre>
--   #fragmentText
--   </pre>
[_frag] :: Url ftype -> Maybe ftype
type Path ftype = [Segment ftype]

-- | A part of the Url’s path.
newtype Segment ftype
Segment :: SegmentType ftype -> Segment ftype
[unSegment] :: Segment ftype -> SegmentType ftype
data SegmentType ftype

-- | Static path segment.
--   
--   <pre>
--   "foo/bar/baz"
--   </pre>
--   
--   contains the static segments <tt>"foo"</tt>, <tt>"bar"</tt> and
--   <tt>"baz"</tt>.
Static :: PathSegment -> SegmentType ftype

-- | A capture.
--   
--   <pre>
--   "user/{userid}/name"
--   </pre>
--   
--   would capture the arg <tt>userid</tt> with type <tt>ftype</tt>.
Cap :: Arg ftype -> SegmentType ftype

-- | Whether a segment is a <a>Cap</a>.
isCapture :: Segment ftype -> Bool

-- | Crashing Arg extraction from segment, TODO: remove
captureArg :: Segment ftype -> Arg ftype

-- | Url Query argument.
--   
--   Urls can contain query arguments, which is a list of key-value pairs.
--   In a typical url, query arguments look like this:
--   
--   <pre>
--   ?foo=bar&amp;alist[]=el1&amp;alist[]=el2&amp;aflag
--   </pre>
--   
--   Each pair can be
--   
--   <ul>
--   <li><tt>?foo=bar</tt>: a plain key-val pair, either optional or
--   required (<a>QueryParam</a>)</li>
--   <li><tt>?aflag</tt>: a flag (no value, implicitly Bool with default
--   <tt>false</tt> if it’s missing) (<a>QueryFlag</a>)</li>
--   <li><tt>?alist[]=el1&amp;alist[]=el2</tt>: list of values
--   (<a>QueryParams</a>)</li>
--   </ul>
--   
--   <tt>_queryArgType</tt> will be set accordingly.
--   
--   For the plain key-val pairs (<a>QueryParam</a>),
--   <tt>_queryArgName</tt>’s <tt>ftype</tt> will be wrapped in a
--   <tt>Maybe</tt> if the argument is optional.
data QueryArg ftype
QueryArg :: Arg ftype -> ArgType -> QueryArg ftype

-- | Name and foreign type of the argument. Will be wrapped in <a>Maybe</a>
--   if the query is optional and in a `[]` if the query is a list
[_queryArgName] :: QueryArg ftype -> Arg ftype

-- | one of normal/plain, list or flag
[_queryArgType] :: QueryArg ftype -> ArgType

-- | Type of a <tt>QueryArg</tt>.
data ArgType
Normal :: ArgType
Flag :: ArgType
List :: ArgType
data HeaderArg ftype

-- | The name of the header and the foreign type of its value.
HeaderArg :: Arg ftype -> HeaderArg ftype
[_headerArg] :: HeaderArg ftype -> Arg ftype

-- | Unused, will never be set.
--   
--   TODO: remove
ReplaceHeaderArg :: Arg ftype -> Text -> HeaderArg ftype
[_headerArg] :: HeaderArg ftype -> Arg ftype
[_headerPattern] :: HeaderArg ftype -> Text

-- | Maps a name to the foreign type that belongs to the annotated value.
--   
--   Used for header args, query args, and capture args.
data Arg ftype
Arg :: PathSegment -> ftype -> Arg ftype

-- | The name to be captured.
--   
--   Only for capture args it really denotes a path segment.
[_argName] :: Arg ftype -> PathSegment

-- | Foreign type the associated value will have
[_argType] :: Arg ftype -> ftype

-- | Canonical name of the endpoint, can be used to generate a function
--   name.
--   
--   You can use the functions in <a>Servant.Foreign.Inflections</a>, like
--   <a>camelCase</a> to transform to <a>Text</a>.
newtype FunctionName
FunctionName :: [Text] -> FunctionName
[unFunctionName] :: FunctionName -> [Text]

-- | See documentation of <a>_reqBodyContentType</a>
data ReqBodyContentType
ReqBodyJSON :: ReqBodyContentType
ReqBodyMultipart :: ReqBodyContentType

-- | See documentation of <tt>Arg</tt>
newtype PathSegment
PathSegment :: Text -> PathSegment
[unPathSegment] :: PathSegment -> Text
argName :: forall ftype f. Functor f => (PathSegment -> f PathSegment) -> Arg ftype -> f (Arg ftype)
argType :: forall ftype1 ftype2 f. Functor f => (ftype1 -> f ftype2) -> Arg ftype1 -> f (Arg ftype2)
argPath :: forall ftype f. (Contravariant f, Functor f) => (Text -> f Text) -> Arg ftype -> f (Arg ftype)
reqUrl :: forall ftype f. Functor f => (Url ftype -> f (Url ftype)) -> Req ftype -> f (Req ftype)
reqMethod :: forall ftype f. Functor f => (Method -> f Method) -> Req ftype -> f (Req ftype)
reqHeaders :: forall ftype f. Functor f => ([HeaderArg ftype] -> f [HeaderArg ftype]) -> Req ftype -> f (Req ftype)
reqBody :: forall ftype f. Functor f => (Maybe ftype -> f (Maybe ftype)) -> Req ftype -> f (Req ftype)
reqBodyContentType :: forall ftype f. Functor f => (ReqBodyContentType -> f ReqBodyContentType) -> Req ftype -> f (Req ftype)
reqReturnType :: forall ftype f. Functor f => (Maybe ftype -> f (Maybe ftype)) -> Req ftype -> f (Req ftype)
reqFuncName :: forall ftype f. Functor f => (FunctionName -> f FunctionName) -> Req ftype -> f (Req ftype)
path :: forall ftype f. Functor f => (Path ftype -> f (Path ftype)) -> Url ftype -> f (Url ftype)
queryStr :: forall ftype f. Functor f => ([QueryArg ftype] -> f [QueryArg ftype]) -> Url ftype -> f (Url ftype)
queryArgName :: forall ftype1 ftype2 f. Functor f => (Arg ftype1 -> f (Arg ftype2)) -> QueryArg ftype1 -> f (QueryArg ftype2)
queryArgType :: forall ftype f. Functor f => (ArgType -> f ArgType) -> QueryArg ftype -> f (QueryArg ftype)
headerArg :: forall ftype1 ftype2 f. Functor f => (Arg ftype1 -> f (Arg ftype2)) -> HeaderArg ftype1 -> f (HeaderArg ftype2)
_PathSegment :: Iso' PathSegment Text
_HeaderArg :: forall ftype p f. (Choice p, Applicative f) => p (Arg ftype) (f (Arg ftype)) -> p (HeaderArg ftype) (f (HeaderArg ftype))
_ReplaceHeaderArg :: forall ftype p f. (Choice p, Applicative f) => p (Arg ftype, Text) (f (Arg ftype, Text)) -> p (HeaderArg ftype) (f (HeaderArg ftype))
_Static :: forall ftype p f. (Choice p, Applicative f) => p PathSegment (f PathSegment) -> p (SegmentType ftype) (f (SegmentType ftype))
_Cap :: forall ftype1 ftype2 p f. (Choice p, Applicative f) => p (Arg ftype1) (f (Arg ftype2)) -> p (SegmentType ftype1) (f (SegmentType ftype2))
_Normal :: Prism' ArgType ()
_Flag :: Prism' ArgType ()
_List :: Prism' ArgType ()
data NoContent
NoContent :: NoContent
data a :<|> b
(:<|>) :: a -> b -> (:<|>) a b
data EmptyAPI
EmptyAPI :: EmptyAPI
data Capture' (mods :: [Type]) (sym :: Symbol) a
data (path :: k) :> a
data CaptureAll (sym :: Symbol) a
data JSON
class ReflectMethod (a :: k)
reflectMethod :: ReflectMethod a => Proxy a -> Method
data Verb (method :: k1) (statusCode :: Nat) (contentTypes :: [Type]) a
data NoContentVerb (method :: k1)
data Stream (method :: k1) (status :: Nat) framing contentType a
data Header' (mods :: [Type]) (sym :: Symbol) a
data QueryParam' (mods :: [Type]) (sym :: Symbol) a
data QueryParams (sym :: Symbol) a
data QueryFlag (sym :: Symbol)
data Fragment a
data Raw
data ReqBody' (mods :: [Type]) (contentTypes :: [Type]) a
data StreamBody' (mods :: [Type]) framing contentType a
data RemoteHost
data IsSecure
Secure :: IsSecure
NotSecure :: IsSecure
type Vault = Vault RealWorld
data WithNamedContext (name :: Symbol) (subContext :: [Type]) (subApi :: k)
data WithResource (res :: k)
data HttpVersion
HttpVersion :: !Int -> !Int -> HttpVersion
[httpMajor] :: HttpVersion -> !Int
[httpMinor] :: HttpVersion -> !Int
data Summary (sym :: Symbol)
data Description (sym :: Symbol)
type ToServantApi (routes :: Type -> Type) = ToServant routes AsApi
data NamedRoutes (api :: Type -> Type)
data Strict
type Header = Header' '[Optional, Strict]
data ResponseHeader (sym :: Symbol) a
Header :: a -> ResponseHeader (sym :: Symbol) a
MissingHeader :: ResponseHeader (sym :: Symbol) a
UndecodableHeader :: ByteString -> ResponseHeader (sym :: Symbol) a
data StdMethod
GET :: StdMethod
POST :: StdMethod
HEAD :: StdMethod
PUT :: StdMethod
DELETE :: StdMethod
TRACE :: StdMethod
CONNECT :: StdMethod
OPTIONS :: StdMethod
PATCH :: StdMethod
data BasicAuth (realm :: Symbol) userData
data BasicAuthData
BasicAuthData :: !ByteString -> !ByteString -> BasicAuthData
[basicAuthUsername] :: BasicAuthData -> !ByteString
[basicAuthPassword] :: BasicAuthData -> !ByteString
type Capture = Capture' '[] :: [Type]
class Accept (ctype :: k)
contentType :: Accept ctype => Proxy ctype -> MediaType
contentTypes :: Accept ctype => Proxy ctype -> NonEmpty MediaType
data FormUrlEncoded
class Accept ctype => MimeRender (ctype :: k) a
mimeRender :: MimeRender ctype a => Proxy ctype -> a -> ByteString
class Accept ctype => MimeUnrender (ctype :: k) a
mimeUnrender :: MimeUnrender ctype a => Proxy ctype -> ByteString -> Either String a
mimeUnrenderWithType :: MimeUnrender ctype a => Proxy ctype -> MediaType -> ByteString -> Either String a
data OctetStream
data PlainText
data AuthProtect (tag :: k)
class GenericMode (mode :: k) where {
    type (mode :: k) :- api;
}
type family (mode :: k) :- api
data AsApi
class GServantProduct (f :: k -> Type)
type GenericServant (routes :: k -> Type) (mode :: k) = (GenericMode mode, Generic routes mode, GServantProduct Rep routes mode)
type ToServant (routes :: k -> Type) (mode :: k) = GToServant Rep routes mode
fromServant :: forall {k} routes (mode :: k). GenericServant routes mode => ToServant routes mode -> routes mode
genericApi :: forall (routes :: Type -> Type). GenericServant routes AsApi => Proxy routes -> Proxy (ToServantApi routes)
toServant :: forall {k} routes (mode :: k). GenericServant routes mode => routes mode -> ToServant routes mode
data Host (sym :: Symbol)
data Lenient
data Optional
data Required
type QueryParam = QueryParam' '[Optional, Strict]
data DeepQuery (sym :: Symbol) a
data QueryString
data RawM
type ReqBody = ReqBody' '[Required, Strict]
class AddHeader (mods :: [Type]) (h :: Symbol) v orig new | mods h v orig -> new, new -> mods, new -> h, new -> v, new -> orig
class BuildHeadersTo (hs :: [Type])
buildHeadersTo :: BuildHeadersTo hs => [Header] -> HList hs
class GetHeaders ls
getHeaders :: GetHeaders ls => ls -> [Header]
data HList (a :: [Type])
[HNil] :: HList ('[] :: [Type])
[HCons] :: forall (h :: Symbol) x (xs :: [Type]) (mods :: [Type]). ResponseHeader h x -> HList xs -> HList (Header' mods h x ': xs)
class HasResponseHeader (h :: Symbol) a (headers :: [Type])
data Headers (ls :: [Type]) a
Headers :: a -> HList ls -> Headers (ls :: [Type]) a
[getResponse] :: Headers (ls :: [Type]) a -> a
[getHeadersHList] :: Headers (ls :: [Type]) a -> HList ls
addHeader :: forall (h :: Symbol) v orig new. AddHeader '[Optional, Strict] h v orig new => v -> orig -> new
addHeader' :: forall (mods :: [Type]) (h :: Symbol) v orig new. AddHeader mods h v orig new => v -> orig -> new
lookupResponseHeader :: forall (h :: Symbol) a (headers :: [Type]) r. HasResponseHeader h a headers => Headers headers r -> ResponseHeader h a
noHeader :: forall (h :: Symbol) v orig new. AddHeader '[Optional, Strict] h v orig new => orig -> new
noHeader' :: forall (mods :: [Type]) (h :: Symbol) v orig new. AddHeader mods h v orig new => orig -> new
data EventKind
RawEvent :: EventKind
JsonEvent :: EventKind
type ServerSentEvents = ServerSentEvents' 'GET 200
data ServerSentEvents' (method :: k) (status :: Nat) (kind :: EventKind) a
class FramingRender (strategy :: k)
framingRender :: forall (m :: Type -> Type) a. (FramingRender strategy, Monad m) => Proxy strategy -> (a -> ByteString) -> SourceT m a -> SourceT m ByteString
class FramingUnrender (strategy :: k)
framingUnrender :: forall (m :: Type -> Type) a. (FramingUnrender strategy, Monad m) => Proxy strategy -> (ByteString -> Either String a) -> SourceT m ByteString -> SourceT m a
class FromSourceIO chunk a | a -> chunk
fromSourceIO :: FromSourceIO chunk a => SourceIO chunk -> IO a
data NetstringFraming
data NewlineFraming
data NoFraming
type SourceIO = SourceT IO
type StreamBody = StreamBody' '[] :: [Type]
type StreamGet = Stream 'GET 200
type StreamPost = Stream 'POST 200
class ToSourceIO chunk a | a -> chunk
toSourceIO :: ToSourceIO chunk a => a -> SourceIO chunk
type family IsElem endpoint api
type family IsElem' a s
class KnownStatus StatusOf a => HasStatus a where {
    type StatusOf a :: Nat;
}
type family StatusOf a :: Nat
type family Statuses (as :: [Type]) :: [Nat]
type family Statuses (as :: [Type]) :: [Nat]
data UVerb (method :: StdMethod) (contentTypes :: [Type]) (as :: [Type])
newtype WithStatus (k :: Nat) a
WithStatus :: a -> WithStatus (k :: Nat) a
statusOf :: HasStatus a => proxy a -> Status
type IsMember (a :: u) (as :: [u]) = (Unique as, CheckElemIsMember a as, UElem a as)
type Union = NS I
type family Unique (xs :: [k])
inject :: UElem x xs => f x -> NS f xs
type Delete = Verb 'DELETE 200
type DeleteAccepted = Verb 'DELETE 202
type DeleteNoContent = NoContentVerb 'DELETE
type DeleteNonAuthoritative = Verb 'DELETE 203
type Get = Verb 'GET 200
type GetAccepted = Verb 'GET 202
type GetNoContent = NoContentVerb 'GET
type GetNonAuthoritative = Verb 'GET 203
type GetPartialContent = Verb 'GET 206
type GetResetContent = Verb 'GET 205
type Patch = Verb 'PATCH 200
type PatchAccepted = Verb 'PATCH 202
type PatchNoContent = NoContentVerb 'PATCH
type PatchNonAuthoritative = Verb 'PATCH 203
type Post = Verb 'POST 200
type PostAccepted = Verb 'POST 202
type PostCreated = Verb 'POST 201
type PostNoContent = NoContentVerb 'POST
type PostNonAuthoritative = Verb 'POST 203
type PostResetContent = Verb 'POST 205
type Put = Verb 'PUT 200
type PutAccepted = Verb 'PUT 202
type PutCreated = Verb 'PUT 201
type PutNoContent = NoContentVerb 'PUT
type PutNonAuthoritative = Verb 'PUT 203
class HasLink (endpoint :: k) where {
    type MkLink (endpoint :: k) a;
}
toLink :: HasLink endpoint => (Link -> a) -> Proxy endpoint -> Link -> MkLink endpoint a
data Link
type family MkLink (endpoint :: k) a
safeLink :: (IsElem endpoint api, HasLink endpoint) => Proxy api -> Proxy endpoint -> MkLink endpoint Link
type family If (cond :: Bool) (tru :: k) (fls :: k) :: k
class FromHttpApiData a
parseUrlPiece :: FromHttpApiData a => Text -> Either Text a
parseHeader :: FromHttpApiData a => ByteString -> Either Text a
parseQueryParam :: FromHttpApiData a => Text -> Either Text a
class ToHttpApiData a
toUrlPiece :: ToHttpApiData a => a -> Text
toEncodedUrlPiece :: ToHttpApiData a => a -> Builder
toHeader :: ToHttpApiData a => a -> ByteString
toQueryParam :: ToHttpApiData a => a -> Text
toEncodedQueryParam :: ToHttpApiData a => a -> Builder
data URI
URI :: String -> Maybe URIAuth -> String -> String -> String -> URI
[uriScheme] :: URI -> String
[uriAuthority] :: URI -> Maybe URIAuth
[uriPath] :: URI -> String
[uriQuery] :: URI -> String
[uriFragment] :: URI -> String
data SBool (b :: Bool)
[STrue] :: SBool 'True
[SFalse] :: SBool 'False
class SBoolI (b :: Bool)
sbool :: SBoolI b => SBool b
