HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulestripeapi-3.0.0.0Haskell2010

StripeAPI.Common

This module serves the purpose of defining common functionality which remains the same across all OpenAPI specifications.

Synopsis
valuedoBodyCallWithConfiguration
  1. :: (MonadHTTP m, ToJSON body)
  2. => Configuration

    Configuration options like base URL and security scheme

  3. -> Text

    HTTP method (GET, POST, etc.)

  4. -> Text

    Path to append to the base URL (path parameters should already be replaced)

  5. -> [QueryParameter]

    Query parameters

  6. -> Maybe body

    Request body

  7. -> RequestBodyEncoding

    JSON or form data deepobjects

  8. -> m (Response ByteString)

    The raw response from the server

This is the main functionality of this module

It makes a concrete Call to a Server with a body

methodstringifyModel :: a -> String

Stringifies a showable value

Example1 expression
stringifyModel "Test""Test"
Example1 expression
stringifyModel 123"123"
datadata Configuration

An operation can and must be configured with data, which may be common for many operations.

This configuration consists of information about the server URL and the used security scheme.

In OpenAPI these information can be defined

  • Root level

  • Path level

  • Operation level

To get started, the defaultConfiguration can be used and changed accordingly.

Note that it is possible that bearerAuthenticationSecurityScheme is not available because it is not a security scheme in the OpenAPI specification.

defaultConfiguration
  { configSecurityScheme = bearerAuthenticationSecurityScheme "token" }

Constructors

Instances1MonadReader

This type specifies a security scheme which can modify a request according to the scheme (e. g. add an Authorization header)

classclass Monad m => MonadHTTP (m :: Type -> Type) where

Abstracts the usage of httpBS away, so that it can be used for testing

Instances3MonadHTTP
classclass Show a => StringifyModel a where

This type class makes the code generation for URL parameters easier as it allows to stringify a value

The Show class is not sufficient as strings should not be stringified with quotes.

Instances3StringifyModel
newtypenewtype JsonByteString

Wraps a ByteString to implement ToJSON and FromJSON

Instances5Eq, Ord, Show, FromJSON, ToJSON
newtypenewtype ClientT (m :: Type -> Type) a

The monad in which the operations can be run. Contains the Configuration to run the requests with.

Run it with runWithConfiguration

Constructors

Instances7MonadTrans, MonadReader, Monad, Functor, Applicative, MonadIO, …