avers-api-0.0.5: Types describing the core and extended Avers APIs

Safe HaskellNone
LanguageHaskell2010

Avers.API

Synopsis

Documentation

type AversCoreAPI = ("objects" :> (Credentials :> (ReqBody '[JSON] CreateObjectBody :> Post '[JSON] CreateObjectResponse))) :<|> (("objects" :> (Capture "objId" ObjId :> (Credentials :> (CacheValidationToken :> Get '[JSON] (Cacheable LookupObjectResponse))))) :<|> (("objects" :> (Capture "objId" ObjId :> (Credentials :> (ReqBody '[JSON] PatchObjectBody :> Patch '[JSON] PatchObjectResponse)))) :<|> (("objects" :> (Capture "objId" ObjId :> (Credentials :> Delete '[JSON] ()))) :<|> (("objects" :> (Capture "objId" ObjId :> ("patches" :> (Capture "revId" RevId :> (Credentials :> (CacheValidationToken :> Get '[JSON] (Cacheable LookupPatchResponse))))))) :<|> (("objects" :> (Capture "objId" ObjId :> ("changes" :> (Credentials :> Raw)))) :<|> (("objects" :> (Capture "objId" ObjId :> ("releases" :> (Credentials :> (ReqBody '[JSON] CreateReleaseBody :> Post '[JSON] CreateReleaseResponse))))) :<|> (("objects" :> (Capture "objId" ObjId :> ("releases" :> (Capture "revId" RevId :> (Credentials :> (CacheValidationToken :> Get '[JSON] (Cacheable LookupReleaseResponse))))))) :<|> (("objects" :> (Capture "objId" ObjId :> ("releases" :> ("_latest" :> (Credentials :> (CacheValidationToken :> Get '[JSON] (Cacheable LookupLatestReleaseResponse))))))) :<|> (("feed" :> (Credentials :> Raw)) :<|> ("secret" :> (Credentials :> (ReqBody '[JSON] ChangeSecretBody :> Post '[] ())))))))))))) Source #

The Core API to manipulate objects, patches, releases etc.

type AversSessionAPI = ("session" :> (ReqBody '[JSON] CreateSessionBody :> Post '[JSON] (Headers '[Header "Set-Cookie" SetCookie] CreateSessionResponse))) :<|> (("session" :> (SessionId :> Get '[JSON] (Headers '[Header "Set-Cookie" SetCookie] LookupSessionResponse))) :<|> ("session" :> (SessionId :> Delete '[JSON] (Headers '[Header "Set-Cookie" SetCookie] ())))) Source #

API to create and maintain sessions. Also contains API to change the secret, which is part of the session code.

type AversBlobAPI = ("blobs" :> (Header "Content-Type" Text :> (ReqBody '[OctetStream] ByteString :> Post '[JSON] UploadBlobResponse))) :<|> (("blobs" :> (Capture "blobId" BlobId :> Get '[JSON] LookupBlobResponse)) :<|> ("blobs" :> (Capture "blobId" BlobId :> ("content" :> Get '[OctetStream] (Headers '[Header "Content-Type" Text] ByteString))))) Source #

API to manange blobs

type AversAccountAPI = "signup" :> (ReqBody '[JSON] SignupBody :> Post '[JSON] SignupResponse) Source #

API to manage accounts. These are optional and not really part of Avers, but many applications do have a concept of a user or account, some person which is using the API.

type CacheValidationToken = Header "If-None-Match" Text Source #

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 Cacheable a = Headers '[Header "Cache-Control" Text, Header "ETag" Text] a Source #

Includes Cache-Control and ETag headers in the response to mark it as cacheable by the client.

data LookupObjectResponse Source #

data PatchObjectBody Source #

Constructors

PatchObjectBody 

Fields

  • pobRevisionId :: !RevId

    The RevId against which the client created the operations. This may be a bit behind if some other client submitted patches in parallel.

  • pobOperations :: ![Operation]

    The operations which the client wants to store in the database.

Instances

data PatchObjectResponse Source #

Constructors

PatchObjectResponse 

Fields

  • porPreviousPatches :: ![Patch]

    Patches which were already in the database. The submitted ops were rebased on top of these.

  • porNumProcessedOperations :: !Int

    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.

  • porResultingPatches :: ![Patch]

    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).

data CreateReleaseBody Source #

Constructors

CreateReleaseBody 

Instances

Generic CreateReleaseBody Source # 
FromJSON CreateReleaseBody Source # 
type Rep CreateReleaseBody Source # 
type Rep CreateReleaseBody = D1 (MetaData "CreateReleaseBody" "Avers.API.Types" "avers-api-0.0.5-KolJwYQYbYq2FjqIaDnV9w" False) (C1 (MetaCons "CreateReleaseBody" PrefixI False) U1)

data ChangeSecretBody Source #

Constructors

ChangeSecretBody 

Fields

Instances

Generic ChangeSecretBody Source # 
FromJSON ChangeSecretBody Source # 
type Rep ChangeSecretBody Source # 
type Rep ChangeSecretBody = D1 (MetaData "ChangeSecretBody" "Avers.API.Types" "avers-api-0.0.5-KolJwYQYbYq2FjqIaDnV9w" False) (C1 (MetaCons "ChangeSecretBody" PrefixI True) (S1 (MetaSel (Just Symbol "csbNewSecret") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)))

data UploadBlobResponse Source #

Constructors

UploadBlobResponse 

Instances

Generic UploadBlobResponse Source # 
type Rep UploadBlobResponse Source # 
type Rep UploadBlobResponse = D1 (MetaData "UploadBlobResponse" "Avers.API.Types" "avers-api-0.0.5-KolJwYQYbYq2FjqIaDnV9w" False) (C1 (MetaCons "UploadBlobResponse" PrefixI False) U1)

data LookupBlobResponse Source #

Constructors

LookupBlobResponse 

Instances

Generic LookupBlobResponse Source # 
type Rep LookupBlobResponse Source # 
type Rep LookupBlobResponse = D1 (MetaData "LookupBlobResponse" "Avers.API.Types" "avers-api-0.0.5-KolJwYQYbYq2FjqIaDnV9w" False) (C1 (MetaCons "LookupBlobResponse" PrefixI False) U1)

data SignupBody Source #

Constructors

SignupBody 

Instances

Generic SignupBody Source # 

Associated Types

type Rep SignupBody :: * -> * #

FromJSON SignupBody Source # 
type Rep SignupBody Source # 
type Rep SignupBody = D1 (MetaData "SignupBody" "Avers.API.Types" "avers-api-0.0.5-KolJwYQYbYq2FjqIaDnV9w" False) (C1 (MetaCons "SignupBody" PrefixI False) U1)

data SignupResponse Source #

Constructors

SignupResponse 

Instances

Generic SignupResponse Source # 

Associated Types

type Rep SignupResponse :: * -> * #

ToJSON SignupResponse Source # 
type Rep SignupResponse Source # 
type Rep SignupResponse = D1 (MetaData "SignupResponse" "Avers.API.Types" "avers-api-0.0.5-KolJwYQYbYq2FjqIaDnV9w" False) (C1 (MetaCons "SignupResponse" PrefixI False) U1)

data Credentials Source #

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.