lightning-haskell-0.1.0.3: Haskell client for lightning-viz REST API

Copyright(c) Connor Moreside, 2016
LicenseBSD-3
Maintainerconnor@moresi.de
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Web.Lightning

Contents

Description

 

Synopsis

Lightning Types

data LoginMethod Source

Represents the different authentication mechanisms available in the lightning-viz server.

Constructors

Anonymous

No authentication required

BasicAuth Credentials

HTTP Basic Authentication

data LightningOptions Source

Defines the available options for running a lightning action(s).

Constructors

LightningOptions 

Fields

optConnManager :: Maybe Manager

Re-usable connection manager used during Lightning session.

optHostUrl :: Text

The base lightning-viz server url.

optLoginMethod :: LoginMethod

The authentication mechanism used to communicate with the lightning-viz server.

optSession :: Maybe Session

Defines what session to use when creating viaualizations on the lightning-viz server. If no session is specified, one will be created automatically.

data LightningState Source

Stores the current state of the lightning transformer stack.

Constructors

LightningState 

Fields

stCurrentBaseURL :: Text

Current base URL of the lightning-viz server.

stConnManager :: Manager

Current connection manager used to run actions.

stSession :: Maybe Session

The current lightning session to run actions against.

stApplyAuth :: Request -> Request

Hook to add auth credentials on performing a request to the lightning-viz sever.

Execute

runLightning :: MonadIO m => LightningT m a -> m (Either (APIError LightningError) a) Source

Performs a lightning action (or LightningT transformer actions) with the default lightning options. By default, the lightning-viz server is assumed to be running on http://localhost:3000 and a new session will be created.

runLightningWith :: MonadIO m => LightningOptions -> LightningT m a -> m (Either (APIError LightningError) a) Source

Performs a lightning action (or LightningT transformer actions) with the specified lightning options.

runResumeLightningtWith :: MonadIO m => LightningOptions -> LightningT m a -> m (Either (APIError LightningError, Maybe (LightningT m a)) a) Source

Runs a lightning action using the specified options.

interpretIO :: MonadIO m => LightningState -> LightningT m a -> m (Either (APIError LightningError, Maybe (LightningT m a)) a) Source

Runs a specified series of lightning actions.

Client configuration

defaultLightningOptions :: LightningOptions Source

Defines the default lightning-viz options.

setBaseURL Source

Arguments

:: Text

Fully qualified API base URL

-> LightningOptions 
-> LightningOptions 

Sets the base URL of Lightning's API in the given LightningOptions record.

setSessionName Source

Arguments

:: Text

The new session name

-> LightningOptions 
-> LightningOptions 

Sets the name of the session that is nested in the given LightningOptions record.

setSessionId Source

Arguments

:: Text

The new session ID

-> LightningOptions 
-> LightningOptions 

Sets the session ID of the session nested in the given LightningOptions record.

setBasicAuth :: Credentials -> LightningOptions -> LightningOptions Source

Sets BasicAuth with Credentials as the login method in the given LightningOptions record.

Re-exports

data APIError a :: * -> *

Error type for the API, where a is the type that should be returned when something goes wrong on the other end - i.e. any error that isn't directly related to this library.

Constructors

APIError a

A type that represents any error that happens on the API end. Define your own custom type with a FromJSON instance if you want to handle them, or you can use () if you just want to ignore them all.

HTTPError HttpException

Something went wrong when we tried to do a HTTP operation.

InvalidURLError

You're trying to create an invalid URL somewhere - check your Builder's base URL and your Routes.

ParseError String

Failed when parsing the response, and it wasn't an error on their end.

EmptyError

Empty error to serve as a zero element for Monoid.

Instances

Eq a => Eq (APIError a) 
Show a => Show (APIError a) 
Monoid (APIError a)