servant/servant-client-core/src/Servant/Client/Core.hs

73 lines
1.8 KiB
Haskell
Raw Normal View History

2017-09-13 18:36:20 +02:00
-- | This module provides backend-agnostic functionality for generating clients
-- from @servant@ APIs. By "backend," we mean something that concretely
-- executes the request, such as:
--
2017-09-14 19:21:53 +02:00
-- * The @http-client@ library
-- * The @haxl@ library
2017-09-13 18:36:20 +02:00
-- * GHCJS via FFI
--
-- etc.
--
-- Each backend is encapsulated in a monad that is an instance of the
-- 'RunClient' class.
--
2017-09-14 19:21:53 +02:00
-- This library is primarily of interest to backend-writers and
-- combinator-writers. For more information, see the README.md
2017-09-07 19:05:12 +02:00
module Servant.Client.Core
2017-09-13 17:05:48 +02:00
(
-- * Client generation
clientIn
, HasClient(..)
2020-10-31 20:45:46 +01:00
, foldMapUnion
, matchUnion
2017-09-13 17:05:48 +02:00
2017-09-13 18:36:20 +02:00
-- * Request
2017-09-14 19:17:19 +02:00
, Request
, RequestF(..)
2017-09-13 18:36:20 +02:00
, defaultRequest
, RequestBody(..)
2017-09-13 17:05:48 +02:00
-- * Authentication
2017-09-13 18:36:20 +02:00
, mkAuthenticatedRequest
, basicAuthReq
, AuthenticatedRequest(..)
2017-09-13 17:05:48 +02:00
, AuthClientData
-- * Generic Client
, ClientError(..)
2017-05-16 18:00:15 +02:00
, EmptyClient(..)
2017-09-13 17:05:48 +02:00
-- * Response
, Response
, ResponseF (..)
2017-09-13 17:05:48 +02:00
, RunClient(..)
-- * BaseUrl
, BaseUrl (..)
, Scheme (..)
, showBaseUrl
, parseBaseUrl
, InvalidBaseUrlException (..)
-- ** Streaming
, RunStreamingClient(..)
, StreamingResponse
2017-09-13 17:05:48 +02:00
-- * Writing HasClient instances
2017-09-13 18:36:20 +02:00
-- | These functions need not be re-exported by backend libraries.
2017-09-12 18:38:52 +02:00
, addHeader
, appendToQueryString
, appendToPath
, setRequestBodyLBS
, setRequestBody
) where
import Servant.Client.Core.Auth
import Servant.Client.Core.BaseUrl
(BaseUrl (..), InvalidBaseUrlException (..), Scheme (..),
2018-06-30 21:17:08 +02:00
parseBaseUrl, showBaseUrl)
import Servant.Client.Core.BasicAuth
import Servant.Client.Core.ClientError
import Servant.Client.Core.HasClient
import Servant.Client.Core.Request
import Servant.Client.Core.Response
import Servant.Client.Core.RunClient