-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An API client for http://orchestrate.io/. -- -- An API client for http://orchestrate.io/. @package orchestrate @version 0.2.0.3 module Database.Orchestrate.Types type APIKey = Text type Collection = Text type Key = Text type Ref = Text type Timestamp = Integer type Location = Text -- | This represents a function that makes a call to the Orchestrate API -- server. It takes Options, a URL String, and returns a -- Response. type RestCall a = Options -> String -> IO (Response a) type Limit = Int type Offset = Int type IfMatch' = Maybe Ref -- | A richer type than IfMatch for specifying conditional calls. data IfMatch -- | Only perform the action if the ref does exist. IfMatch :: Ref -> IfMatch -- | Only perform the action if the ref does not exist. IfNoneMatch :: Ref -> IfMatch -- | Always perform the action. NoMatch :: IfMatch -- | This is a range tuple. Each end can be specified separately. type Range a = (RangeEnd a, RangeEnd a) -- | This represents the end of a range. data RangeEnd a -- | The end should be inclusive. I.e., it should include a. Inclusive :: a -> RangeEnd a -- | The end should be exclusive. I.e., it should not include a. Exclusive :: a -> RangeEnd a -- | There is no bound on this end. Open :: RangeEnd a -- | A list of data returned by listV. -- --
-- do { action1; action2; action3 } `catchError` handler
--
--
-- where the action functions can call throwError. Note
-- that handler and the do-block must have the same return type.
catchError :: MonadError e m => forall a. m a -> (e -> m a) -> m a
instance Data.Aeson.Types.Class.FromJSON v => Data.Aeson.Types.Class.FromJSON (Database.Orchestrate.Types.SearchList v)
instance GHC.Show.Show v => GHC.Show.Show (Database.Orchestrate.Types.SearchList v)
instance Data.Aeson.Types.Class.FromJSON v => Data.Aeson.Types.Class.FromJSON (Database.Orchestrate.Types.SearchItem v)
instance GHC.Show.Show v => GHC.Show.Show (Database.Orchestrate.Types.SearchItem v)
instance Data.Aeson.Types.Class.FromJSON v => Data.Aeson.Types.Class.FromJSON (Database.Orchestrate.Types.TombstoneItem v)
instance GHC.Show.Show v => GHC.Show.Show (Database.Orchestrate.Types.TombstoneItem v)
instance Data.Aeson.Types.Class.FromJSON a => Data.Aeson.Types.Class.FromJSON (Database.Orchestrate.Types.EventItem a b)
instance GHC.Show.Show a => GHC.Show.Show (Database.Orchestrate.Types.EventItem a b)
instance Data.Aeson.Types.Class.FromJSON Database.Orchestrate.Types.EventPath
instance Data.Aeson.Types.Class.ToJSON Database.Orchestrate.Types.EventPath
instance GHC.Show.Show Database.Orchestrate.Types.EventPath
instance (Data.Aeson.Types.Class.FromJSON p, Data.Aeson.Types.Class.FromJSON v) => Data.Aeson.Types.Class.FromJSON (Database.Orchestrate.Types.ResultItem p v)
instance (Data.Aeson.Types.Class.ToJSON p, Data.Aeson.Types.Class.ToJSON v) => Data.Aeson.Types.Class.ToJSON (Database.Orchestrate.Types.ResultItem p v)
instance (GHC.Show.Show p, GHC.Show.Show v) => GHC.Show.Show (Database.Orchestrate.Types.ResultItem p v)
instance Data.Aeson.Types.Class.FromJSON r => Data.Aeson.Types.Class.FromJSON (Database.Orchestrate.Types.ResultList r)
instance GHC.Show.Show i => GHC.Show.Show (Database.Orchestrate.Types.ResultList i)
instance Data.Aeson.Types.Class.FromJSON Database.Orchestrate.Types.Path
instance Data.Aeson.Types.Class.ToJSON Database.Orchestrate.Types.Path
instance GHC.Show.Show Database.Orchestrate.Types.Path
instance GHC.Base.Monad m => GHC.Base.Monad (Database.Orchestrate.Types.OrchestrateT m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Database.Orchestrate.Types.OrchestrateT m)
instance GHC.Base.Functor m => GHC.Base.Functor (Database.Orchestrate.Types.OrchestrateT m)
instance Data.Default.Class.Default Database.Orchestrate.Types.Session
instance Control.Monad.Trans.Class.MonadTrans Database.Orchestrate.Types.OrchestrateT
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Database.Orchestrate.Types.OrchestrateT m)
instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader Database.Orchestrate.Types.Session (Database.Orchestrate.Types.OrchestrateT m)
instance GHC.Base.Monad m => Control.Monad.Error.Class.MonadError GHC.Exception.SomeException (Database.Orchestrate.Types.OrchestrateT m)
instance GHC.Show.Show Database.Orchestrate.Types.Session
instance GHC.Base.Functor Database.Orchestrate.Types.RangeEnd
instance GHC.Show.Show a => GHC.Show.Show (Database.Orchestrate.Types.RangeEnd a)
instance GHC.Show.Show Database.Orchestrate.Types.IfMatch
-- | This module implements some network-oriented utility functions.
module Database.Orchestrate.Network
-- | This takes a response and checks that the status code passes.
--
-- If the HTTP status code is not OK, this returns an error in the
-- OrchestrateT monad.
checkResponse :: Monad m => Response a -> OrchestrateT m ()
-- | This checks the status code. Currently 200 and 204 are OK. Everything
-- else is bad. Bad codes throw an exception in OrchestrateT.
checkStatusCode :: Monad m => Int -> OrchestrateT m ()
module Database.Orchestrate.Utils
-- | Run an OrchestrateT action with a Session that does
-- not include authentication. This function will add proper
-- authentication before running the action.
runO :: Monad m => OrchestrateT m a -> Session -> m (Either SomeException a)
-- | Run an OrchestrateT action with a Session that already
-- includes authentication.
--
-- This is the most minimal handler.
runO' :: Monad m => OrchestrateT m a -> Session -> m (Either SomeException a)
-- | Lifts an Either value into the OrchestrateT monad.
orchestrateEither :: Monad m => Either SomeException a -> OrchestrateT m a
-- | Lifts an IO action into the OrchestrateT monad.
io :: MonadIO m => IO a -> OrchestrateT m a
-- | This assembles and performs an API call.
api :: RequestHeaders -> [Text] -> [FormParam] -> RestCall a -> OrchestrateIO (Response a)
-- | This assembles and peforms an API call, lifting any status code errors
-- out of the monad and returning them in an explicit Either.
api' :: RequestHeaders -> [Text] -> [FormParam] -> RestCall a -> OrchestrateIO (Either Status (Response a))
-- | This assembles and performs an API call. It returns Nothing if
-- the call returns a 404 status code.
api404 :: Show a => RequestHeaders -> [Text] -> [FormParam] -> RestCall a -> OrchestrateIO (Maybe (Response a))
-- | This assembles and performs an API call and checks that the status
-- passes checkResponse.
apiCheck :: RequestHeaders -> [Text] -> [FormParam] -> RestCall a -> OrchestrateIO (Response a)
-- | This assembles and performs an API call. Afterward it checks the
-- status code and decodes the JSON response.
apiCheckDecode :: FromJSON a => RequestHeaders -> [Text] -> [FormParam] -> RestCall ByteString -> OrchestrateIO a
-- | Pings the Orchestrate API.
ping :: OrchestrateIO ()
-- | Create the base Orchestrate API URL given the current Session.
baseUrl :: Monad m => OrchestrateT m Text
-- | Builds a URL from its assembled parts.
buildUrl :: Monad m => [Text] -> OrchestrateT m String
-- | Adds the API key to the default Options.
withAuth' :: APIKey -> Options
-- | Adds the API key to a set of wreq Options.
withAuth :: APIKey -> Options -> Options
-- | This returns the Session with the API key taken from the
-- ORCHESTRATE_API environment variable.
--
-- The value of sessionOptions will include authentication.
envSession :: IO Session
-- | Takes an IfMatch and returns a list of request headers.
ifMatch :: IfMatch -> [Header]
-- | Takes an IfMatch' and returns a list of request headers.
ifMatch' :: IfMatch' -> [Header]
-- | A prism over the collection part of a Location URL.
locationCollection :: Prism' Text Text
-- | A prism over the key part of a Location URL.
locationKey :: Prism' Text Text
-- | A prism over the ref part of a Location URL.
locationRef :: Prism' Text Text
-- | A prism over the type part of a Location URL from an event
-- operation.
locationType :: Prism' Text Text
-- | A prism over the timestamp part of a Location URL from an event
-- operation.
locationTimestamp :: Prism' Text Integer
-- | A prism over the ordinal part of a Location URL from an event
-- operation.
locationOrdinal :: Prism' Text Int
-- | Retrieves the Location from a response's headers.
getLocation :: Response a -> Text
-- | Given a starting RangeEnd, return the form parameter.
rangeStart :: FormValue a => ByteString -> RangeEnd a -> Maybe FormParam
-- | Given an ending RangeEnd, return the form parameter.
rangeEnd :: FormValue a => ByteString -> RangeEnd a -> Maybe FormParam
-- | This takes a three-parameter function and rotates the parameters to
-- return a function that takes the third parameter first.
rot :: (a -> b -> c -> d) -> c -> a -> b -> d
-- | Show data as Text.
tshow :: Show a => a -> Text
-- | Returns both the last item in a list and the list's init.
--
-- If the list is empty, it will return (Nothing, []).
-- Otherwise, it's an optimized call to (lastMay &&&
-- initSafe).
initTail :: [a] -> (Maybe a, [a])
-- | This module implements the Orchestrate Refs API.
--
-- Refs represent the immutable values that have been associated with a
-- key.
module Database.Orchestrate.Ref
-- | This retrieves a ref associated with some data.
--
-- -- getRef "coll-name" "key" "43214321" --getRef :: FromJSON r => Collection -> Key -> Ref -> OrchestrateIO (Maybe r) -- | This lists all the values that have been associated with a key in the -- database. Values are returned last to first. -- --
-- listRefs "coll-name" "key" Nothing Nothing False --listRefs :: FromJSON v => Collection -> Key -> Maybe Int -> Maybe Int -> Bool -> OrchestrateIO (ResultList (TombstoneItem v)) -- | This module implements the Orchestrate Search API. module Database.Orchestrate.Search -- | This performs the query and returns the results. -- --
-- query "coll-name" "query" (Just 25) Nothing --query :: FromJSON v => Collection -> QueryText -> Maybe Int -> Maybe Int -> OrchestrateIO (SearchList v) -- | This implements the Key/Value API. -- -- Generally, the data stored knows about its own key using via the -- OrchestrateData class instance defined for it. module Database.Orchestrate.KeyValue -- | This retrieves a value from a collection. -- --
-- lookup "contacts" "mom" --lookup :: FromJSON v => Collection -> Key -> OrchestrateIO (Maybe v) -- | This lists all the data in the collection within the range given. -- --
-- listVals "coll-name" Nothing (Open, Open) --listVals :: FromJSON v => Collection -> Maybe Int -> Range Key -> OrchestrateIO (KVList v) -- | This inserts data into the database or updates existing data using a -- key generated by the OrchestrateData instance. -- --
-- putV data NoMatch --putV :: OrchestrateData v => v -> IfMatch -> OrchestrateIO Location -- | This inserts data into the database or updates data in the database. -- This overrides the key provided by the data type's -- OrchestrateData instance. However, it still requires an -- implementation of that data type for the collection name. -- --
-- putKV "key" data NoMatch --putKV :: OrchestrateData v => Key -> v -> IfMatch -> OrchestrateIO Location -- | This inserts data in the database, generating a new database key for -- it. -- --
-- postV data --postV :: OrchestrateData v => v -> OrchestrateIO (Location, Maybe Key) -- | This removes data from the database. -- --
-- deleteV data Nothing --deleteV :: OrchestrateData v => v -> IfMatch' -> OrchestrateIO () -- | This removes data from the database. -- --
-- deleteKV "key" data Nothing --deleteKV :: OrchestrateData v => Key -> v -> IfMatch' -> OrchestrateIO () -- | This purges data from the database. Purging not only removes the data, -- but also all history and secondary items for it. -- --
-- purgeV data Nothing --purgeV :: OrchestrateData v => v -> IfMatch' -> OrchestrateIO () -- | This purges data from the database. Purging not only removes the data, -- but also all history and secondary items for it. -- --
-- purgeKV "key" data Nothing --purgeKV :: OrchestrateData v => Key -> v -> IfMatch' -> OrchestrateIO () -- | This module implements the Graph API. module Database.Orchestrate.Graph -- | This retrieves a list of target nodes from edges originating from -- a. For more information see the API documentation. -- -- If the third parameter is not empty, it represents additional edges -- that will be traversed to get to the target. -- -- For example: -- --
-- getRel data "friend" ["last_name"] --getRel :: (OrchestrateData a, FromJSON b) => a -> RelKind -> [RelKind] -> OrchestrateIO (RelList a b) -- | Creates a relationship (an edge) between two nodes. The edge has a -- RelKind type. See the API documentation for more -- information. -- -- For example: -- --
-- createRel start "parent" child --createRel :: (OrchestrateData a, OrchestrateData b) => a -> RelKind -> b -> OrchestrateIO () -- | This removes a relationship (an edge) between two nodes. -- -- For example: -- --
-- deleteRel start "parent" child --deleteRel :: (OrchestrateData a, OrchestrateData b) => a -> RelKind -> b -> OrchestrateIO () -- | This module implements the API calls for working with -- Orchestrate events. module Database.Orchestrate.Events -- | This retrieves a single event. See the API documentation for -- more information. -- -- For example, this retrieves a transaction event. -- --
-- getEvent data "transaction" 784111777000 79 --getEvent :: (OrchestrateData a, FromJSON b) => a -> EventType -> Timestamp -> Int -> OrchestrateIO (Maybe (EventItem b a)) -- | This creates an event and returns its Location. See API -- document for more information. -- -- For example, this creates a transaction, using the current time for -- the timestamp. -- --
-- createEvent data "transaction" transactionData Nothing --createEvent :: (OrchestrateData a, ToJSON b) => a -> EventType -> b -> Maybe Timestamp -> OrchestrateIO Location -- | This updates the data for an event. The storage is keyed by type, -- timestamp, and ordinal, so the event data can change. See the API -- documentation for more information. -- -- For example: -- --
-- updateEvent data "transaction" updatedTransactionData -- <$> loc ^? locationTimestamp -- <*> loc ^? locationOrdinal --updateEvent :: (OrchestrateData a, ToJSON b) => a -> EventType -> b -> Timestamp -> Int -> IfMatch' -> OrchestrateIO Location -- | This deletes an event. See the API documentation for more -- information. -- -- For example: -- --
-- deleteEvent data "transaction" -- <$> loc ^? locationTimestamp -- <*> loc ^? locationOrdinal --deleteEvent :: OrchestrateData a => a -> EventType -> Timestamp -> Int -> IfMatch' -> OrchestrateIO () -- | This lists all the events within a given range for a data. See the -- API documentation for more information. -- -- For example: -- --
-- listEvents data "transaction" (Just 25) (Open, Open) --listEvents :: (OrchestrateData a, FromJSON b) => a -> EventType -> Maybe Int -> Range (Timestamp, Maybe Int) -> OrchestrateIO (EventList b a) -- | This takes a Location and an event datum and returns the -- EventItem representing it. locationEventItem :: Location -> a -> Maybe (EventItem a b) -- | This takes an EventItem and returns the datum and -- Location associated with that item. eventItemLocation :: Monad m => EventItem a b -> OrchestrateT m (a, Location) -- | This implements the API calls to manage collections on -- Orchestrate. module Database.Orchestrate.Collection -- | This deletes a collection. See the API documentation for more -- information. -- --
-- deleteCollection "collection-name" --deleteCollection :: Collection -> OrchestrateIO () module Database.Orchestrate