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
|
2014-11-27 18:28:01 +01:00
|
|
|
, HasClient(..)
|
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
|
2015-03-05 02:46:35 +01:00
|
|
|
, ServantError(..)
|
2017-05-16 18:00:15 +02:00
|
|
|
, EmptyClient(..)
|
2017-09-13 17:05:48 +02:00
|
|
|
|
|
|
|
-- * Response
|
2018-01-30 17:40:02 +01:00
|
|
|
, Response
|
2019-02-06 11:12:56 +01:00
|
|
|
, ResponseF (..)
|
2017-09-13 17:05:48 +02:00
|
|
|
, RunClient(..)
|
2019-02-18 18:08:13 +01:00
|
|
|
-- * BaseUrl
|
|
|
|
, BaseUrl (..)
|
|
|
|
, Scheme (..)
|
|
|
|
, showBaseUrl
|
|
|
|
, parseBaseUrl
|
|
|
|
, InvalidBaseUrlException (..)
|
|
|
|
|
2018-11-01 18:42:30 +01:00
|
|
|
-- ** Streaming
|
|
|
|
, RunStreamingClient(..)
|
2018-06-26 19:11:28 +02:00
|
|
|
, 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
|
2014-11-27 18:28:01 +01:00
|
|
|
) where
|
2019-02-18 18:08:13 +01:00
|
|
|
import Servant.Client.Core.Auth
|
|
|
|
import Servant.Client.Core.BaseUrl
|
|
|
|
(BaseUrl (..), InvalidBaseUrlException (..), Scheme (..),
|
2018-06-30 21:17:08 +02:00
|
|
|
parseBaseUrl, showBaseUrl)
|
2019-02-18 18:08:13 +01:00
|
|
|
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
|