-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Types describing the core and extended Avers APIs -- -- Types describing the core and extended Avers APIs @package avers-api @version 0.1.0 module Avers.API -- | The complete Avers API as a data type. type AversAPI = CreateObject :<|> (LookupObject :<|> (PatchObject :<|> (DeleteObject :<|> (LookupPatch :<|> (ObjectChanges :<|> (CreateRelease :<|> (LookupRelease :<|> (LookupLatestRelease :<|> (Feed :<|> (ChangeSecret :<|> (CreateSession :<|> (LookupSession :<|> (DeleteSession :<|> (UploadBlob :<|> (LookupBlob :<|> LookupBlobContent))))))))))))))) -- | The complete Avers API type CreateObject = "objects" :> (Credentials :> (ReqBody '[JSON] CreateObjectBody :> Post '[JSON] CreateObjectResponse)) type LookupObject = "objects" :> (Capture "objId" ObjId :> (Credentials :> (CacheValidationToken :> Get '[JSON] (Cacheable LookupObjectResponse)))) type PatchObject = "objects" :> (Capture "objId" ObjId :> (Credentials :> (ReqBody '[JSON] PatchObjectBody :> Patch '[JSON] PatchObjectResponse))) type DeleteObject = "objects" :> (Capture "objId" ObjId :> (Credentials :> Delete '[JSON] ())) type LookupPatch = "objects" :> (Capture "objId" ObjId :> ("patches" :> (Capture "revId" RevId :> (Credentials :> (CacheValidationToken :> Get '[JSON] (Cacheable LookupPatchResponse)))))) type ObjectChanges = "objects" :> (Capture "objId" ObjId :> ("changes" :> (Credentials :> Raw))) type CreateRelease = "objects" :> (Capture "objId" ObjId :> ("releases" :> (Credentials :> (ReqBody '[JSON] CreateReleaseBody :> Post '[JSON] CreateReleaseResponse)))) type LookupRelease = "objects" :> (Capture "objId" ObjId :> ("releases" :> (Capture "revId" RevId :> (Credentials :> (CacheValidationToken :> Get '[JSON] (Cacheable LookupReleaseResponse)))))) type LookupLatestRelease = "objects" :> (Capture "objId" ObjId :> ("releases" :> ("_latest" :> (Credentials :> (CacheValidationToken :> Get '[JSON] (Cacheable LookupLatestReleaseResponse)))))) type Feed = "feed" :> (Credentials :> Raw) type ChangeSecret = "secret" :> (Credentials :> (ReqBody '[JSON] ChangeSecretBody :> Post '[JSON] ())) type CreateSession = "session" :> (ReqBody '[JSON] CreateSessionBody :> Post '[JSON] (Headers '[Header "Set-Cookie" SetCookie] CreateSessionResponse)) type LookupSession = "session" :> (SessionId :> Get '[JSON] (Headers '[Header "Set-Cookie" SetCookie] LookupSessionResponse)) type DeleteSession = "session" :> (SessionId :> Delete '[JSON] (Headers '[Header "Set-Cookie" SetCookie] ())) type UploadBlob = "blobs" :> (Credentials :> (Header "Content-Type" Text :> (ReqBody '[OctetStream] BlobContent :> Post '[JSON] UploadBlobResponse))) type LookupBlob = "blobs" :> (Capture "blobId" BlobId :> (Credentials :> Get '[JSON] LookupBlobResponse)) type LookupBlobContent = "blobs" :> (Capture "blobId" BlobId :> ("content" :> (Credentials :> Get '[OctetStream] (Headers '[Header "Content-Type" Text] BlobContent)))) -- | The cache validator token when passed in the request. The server will -- use it to determine if the cached response on the client can be reused -- or not. type CacheValidationToken = Header "If-None-Match" Text -- | Includes Cache-Control and ETag headers in the -- response to mark it as cacheable by the client. type Cacheable a = Headers '[Header "Cache-Control" Text, Header "ETag" Text] a data CreateObjectBody CreateObjectBody :: !Text -> !Value -> CreateObjectBody [cobType] :: CreateObjectBody -> !Text [cobContent] :: CreateObjectBody -> !Value data CreateObjectResponse CreateObjectResponse :: !ObjId -> !Text -> !Value -> CreateObjectResponse [corId] :: CreateObjectResponse -> !ObjId [corType] :: CreateObjectResponse -> !Text [corContent] :: CreateObjectResponse -> !Value data LookupObjectResponse LookupObjectResponse :: !ObjId -> !Text -> !UTCTime -> !ObjId -> !RevId -> !Value -> LookupObjectResponse [lorId] :: LookupObjectResponse -> !ObjId [lorType] :: LookupObjectResponse -> !Text [lorCreatedAt] :: LookupObjectResponse -> !UTCTime [lorCreatedBy] :: LookupObjectResponse -> !ObjId [lorRevisionId] :: LookupObjectResponse -> !RevId [lorContent] :: LookupObjectResponse -> !Value data PatchObjectBody PatchObjectBody :: !RevId -> ![Operation] -> PatchObjectBody -- | The RevId against which the client created the operations. This -- may be a bit behind if some other client submitted patches in -- parallel. [pobRevisionId] :: PatchObjectBody -> !RevId -- | The operations which the client wants to store in the database. [pobOperations] :: PatchObjectBody -> ![Operation] data PatchObjectResponse PatchObjectResponse :: ![Patch] -> !Int -> ![Patch] -> PatchObjectResponse -- | Patches which were already in the database. The submitted ops were -- rebased on top of these. [porPreviousPatches] :: PatchObjectResponse -> ![Patch] -- | The number of operations which were processed. This may be smaller -- than the number of submitted ops if the processing failed somewhere in -- the middle. The client can then decide what to do with those which -- were not accepted. [porNumProcessedOperations] :: PatchObjectResponse -> !Int -- | Out of the submitted operations, these are the patches which were -- actually applied and stored in the database. This list may be shorter -- if some operations were dropped (because redundant or conflicting). [porResultingPatches] :: PatchObjectResponse -> ![Patch] data ObjectChangeNotification -- | A new patch was created. PatchNotification :: !Patch -> ObjectChangeNotification type LookupPatchResponse = Patch data CreateReleaseBody CreateReleaseBody :: CreateReleaseBody data CreateReleaseResponse CreateReleaseResponse :: CreateReleaseResponse data LookupReleaseResponse LookupReleaseResponse :: LookupReleaseResponse data LookupLatestReleaseResponse LookupLatestReleaseResponse :: LookupLatestReleaseResponse data CreateSessionBody CreateSessionBody :: !SecretId -> !Text -> CreateSessionBody [csbLogin] :: CreateSessionBody -> !SecretId [csbSecret] :: CreateSessionBody -> !Text data CreateSessionResponse CreateSessionResponse :: !SessionId -> !ObjId -> CreateSessionResponse [csrSessionId] :: CreateSessionResponse -> !SessionId [csrSessionObjId] :: CreateSessionResponse -> !ObjId data LookupSessionResponse LookupSessionResponse :: !SessionId -> !ObjId -> LookupSessionResponse [lsrSessionId] :: LookupSessionResponse -> !SessionId [lsrSessionObjId] :: LookupSessionResponse -> !ObjId data ChangeFeedSubscription IncludeObjectChanges :: ObjId -> ChangeFeedSubscription data ChangeSecretBody ChangeSecretBody :: !Text -> ChangeSecretBody [csbNewSecret] :: ChangeSecretBody -> !Text newtype BlobContent BlobContent :: ByteString -> BlobContent data UploadBlobResponse UploadBlobResponse :: !BlobId -> !Int -> !Text -> UploadBlobResponse [ubrId] :: UploadBlobResponse -> !BlobId [ubrSize] :: UploadBlobResponse -> !Int [ubrContentType] :: UploadBlobResponse -> !Text data LookupBlobResponse LookupBlobResponse :: !BlobId -> !Int -> !Text -> LookupBlobResponse [lbrId] :: LookupBlobResponse -> !BlobId [lbrSize] :: LookupBlobResponse -> !Int [lbrContentType] :: LookupBlobResponse -> !Text -- | Credentials are used to authenticate the client. It can be a SessionId -- (extracted from the session cookie). -- -- Later we may add support for token based authentication. Then we -- extend this into a sumtype covering all the possible ways how -- credentials can be passed along with the request. data Credentials CredAnonymous :: Credentials CredSessionId :: !SessionId -> Credentials