-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Servant HTTP API specification for https://cachix.org
--   
--   Servant HTTP API specification for <a>https://cachix.org</a>
@package cachix-api
@version 0.1.0.1

module Cachix.Api.Signing
fingerprint :: Text -> Text -> Int -> [Text] -> ByteString
passthroughSizeSink :: MonadIO m => IORef Int -> Conduit ByteString m ByteString
passthroughHashSink :: MonadIO m => IORef Text -> Conduit ByteString m ByteString

module Cachix.Api.Types
data NixCacheInfo
NixCacheInfo :: Text -> Integer -> Integer -> NixCacheInfo
[storeDir] :: NixCacheInfo -> Text
[wantMassQuery] :: NixCacheInfo -> Integer
[priority] :: NixCacheInfo -> Integer
data NarInfo
NarInfo :: Text -> Text -> Text -> Text -> Integer -> Text -> Integer -> [Text] -> Text -> Text -> NarInfo

-- | absolute path of the derivation in nix store
[storePath] :: NarInfo -> Text

-- | relative url (to current domain) to download nar file
[url] :: NarInfo -> Text

-- | name of the compression algorithm, eg. xz
[compression] :: NarInfo -> Text

-- | sha256 hash of the compressed nar file NOTE: to compute use "nix-hash
--   --type sha256 --flat --base32"
[fileHash] :: NarInfo -> Text

-- | file size of compressed nar file NOTE: du -b
[fileSize] :: NarInfo -> Integer

-- | sha256 hash of the decompressed nar file NOTE: to compute use
--   "nix-hash --type sha256 --flat --base32"
[narHash] :: NarInfo -> Text

-- | file size of decompressed nar file NOTE: du -b
[narSize] :: NarInfo -> Integer

-- | immediate dependencies of the storePath NOTE: nix-store -q
--   --references
[references] :: NarInfo -> [Text]

-- | relative store path (to nix store root) of the deriver NOTE: nix-store
--   -q --deriver
[deriver] :: NarInfo -> Text

-- | signature of fields: storePath, narHash, narSize, refs
[sig] :: NarInfo -> Text

-- | Client create type
data NarInfoCreate
NarInfoCreate :: Text -> Text -> Text -> Int -> Text -> Int -> [Text] -> Text -> Text -> NarInfoCreate

-- | $storePrefix / $storeHash - $storeSuffix
[cStoreHash] :: NarInfoCreate -> Text

-- | $storePrefix / $storeHash - $storeSuffix
[cStoreSuffix] :: NarInfoCreate -> Text
[cNarHash] :: NarInfoCreate -> Text
[cNarSize] :: NarInfoCreate -> Int
[cFileHash] :: NarInfoCreate -> Text
[cFileSize] :: NarInfoCreate -> Int
[cReferences] :: NarInfoCreate -> [Text]
[cDeriver] :: NarInfoCreate -> Text
[cSig] :: NarInfoCreate -> Text
data BinaryCache
BinaryCache :: Text -> Text -> [Text] -> BinaryCache
[name] :: BinaryCache -> Text
[uri] :: BinaryCache -> Text
[publicSigningKeys] :: BinaryCache -> [Text]
newtype BinaryCacheCreate
BinaryCacheCreate :: Text -> BinaryCacheCreate
[publicSigningKey] :: BinaryCacheCreate -> Text

-- | checksum of nar.xz file
newtype NarC
NarC :: Text -> NarC

-- | Store path hash
newtype NarInfoC
NarInfoC :: Text -> NarInfoC
newtype BinaryCacheError
BinaryCacheError :: Text -> BinaryCacheError
[error] :: BinaryCacheError -> Text
data User
User :: Text -> Text -> User
[fullname] :: User -> Text
[username] :: User -> Text
instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Api.Types.User
instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Api.Types.User
instance GHC.Generics.Generic Cachix.Api.Types.User
instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Api.Types.BinaryCacheError
instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Api.Types.BinaryCacheError
instance GHC.Generics.Generic Cachix.Api.Types.BinaryCacheError
instance GHC.Generics.Generic Cachix.Api.Types.NarInfoC
instance GHC.Generics.Generic Cachix.Api.Types.NarC
instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Api.Types.BinaryCacheCreate
instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Api.Types.BinaryCacheCreate
instance GHC.Generics.Generic Cachix.Api.Types.BinaryCacheCreate
instance GHC.Show.Show Cachix.Api.Types.BinaryCacheCreate
instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Api.Types.BinaryCache
instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Api.Types.BinaryCache
instance GHC.Generics.Generic Cachix.Api.Types.BinaryCache
instance GHC.Show.Show Cachix.Api.Types.BinaryCache
instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Api.Types.NarInfoCreate
instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Api.Types.NarInfoCreate
instance GHC.Show.Show Cachix.Api.Types.NarInfoCreate
instance GHC.Generics.Generic Cachix.Api.Types.NarInfoCreate
instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Api.Types.NarInfo
instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Api.Types.NarInfo
instance GHC.Show.Show Cachix.Api.Types.NarInfo
instance GHC.Generics.Generic Cachix.Api.Types.NarInfo
instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Api.Types.NixCacheInfo
instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Api.Types.NixCacheInfo
instance GHC.Show.Show Cachix.Api.Types.NixCacheInfo
instance GHC.Generics.Generic Cachix.Api.Types.NixCacheInfo
instance Web.Internal.HttpApiData.FromHttpApiData Cachix.Api.Types.NarInfoC
instance Web.Internal.HttpApiData.ToHttpApiData Cachix.Api.Types.NarInfoC
instance Web.Internal.HttpApiData.FromHttpApiData Cachix.Api.Types.NarC
instance Web.Internal.HttpApiData.ToHttpApiData Cachix.Api.Types.NarC

module Cachix.Api.Swagger
instance Data.Swagger.Internal.Schema.ToSchema Cachix.Api.Types.NixCacheInfo
instance Data.Swagger.Internal.Schema.ToSchema Cachix.Api.Types.NarInfo
instance Data.Swagger.Internal.Schema.ToSchema Cachix.Api.Types.NarInfoCreate
instance Data.Swagger.Internal.Schema.ToSchema Cachix.Api.Types.BinaryCache
instance Data.Swagger.Internal.Schema.ToSchema Cachix.Api.Types.BinaryCacheCreate
instance Data.Swagger.Internal.Schema.ToSchema Cachix.Api.Types.User
instance Data.Swagger.Internal.ParamSchema.ToParamSchema Cachix.Api.Types.NarC
instance Data.Swagger.Internal.ParamSchema.ToParamSchema Cachix.Api.Types.NarInfoC
instance Data.Swagger.Internal.ParamSchema.ToParamSchema Web.Cookie.SetCookie
instance Servant.Swagger.Internal.HasSwagger api => Servant.Swagger.Internal.HasSwagger (Servant.Streaming.StreamBodyMonad contentTypes m Servant.API.Sub.:> api)
instance Servant.Swagger.Internal.HasSwagger (Servant.Streaming.StreamResponseGet contentTypes)

module Cachix.Types.ContentTypes
data XNixNar
data XNixNarInfo
data XNixCacheInfo
instance Servant.API.ContentTypes.Accept Cachix.Types.ContentTypes.XNixCacheInfo
instance Servant.API.ContentTypes.MimeUnrender Cachix.Types.ContentTypes.XNixCacheInfo Cachix.Api.Types.NixCacheInfo
instance Servant.API.ContentTypes.Accept Cachix.Types.ContentTypes.XNixNarInfo
instance Servant.API.ContentTypes.MimeUnrender Cachix.Types.ContentTypes.XNixNarInfo Cachix.Api.Types.NarInfo
instance Servant.API.ContentTypes.Accept Cachix.Types.ContentTypes.XNixNar


-- | Servant specific additions that could be upstreamed
module Cachix.Types.Servant
type Get302 (cts :: [*]) (hs :: [*]) = Verb  'GET 302 cts (Headers (Header "Location" Text : hs) NoContent)
type Post302 (cts :: [*]) (hs :: [*]) = Verb  'POST 302 cts (Headers (Header "Location" Text : hs) NoContent)
type Head = Verb  'HEAD 200 '[JSON] NoContent


-- | Module for auth session storage
module Cachix.Types.Session
newtype Session
Session :: UserId -> Session
type UserId = Integer
instance Servant.Auth.Server.Internal.JWT.ToJWT Cachix.Types.Session.Session
instance Servant.Auth.Server.Internal.JWT.FromJWT Cachix.Types.Session.Session
instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Types.Session.Session
instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Types.Session.Session
instance GHC.Generics.Generic Cachix.Types.Session.Session
instance GHC.Show.Show Cachix.Types.Session.Session
instance GHC.Classes.Eq Cachix.Types.Session.Session

module Cachix.Api
api :: Proxy API
servantApi :: Proxy CachixServantAPI
swaggerDoc :: Swagger
data CachixAPI route
CachixAPI :: route :- "logout" :> CachixAuth :> Post302 '[JSON] '[Header "Set-Cookie" SetCookie, Header "Set-Cookie" SetCookie] -> route :- "login" :> Get302 '[JSON] '[] -> route :- "login" :> "callback" :> QueryParam "code" Text :> QueryParam "state" Text :> Get302 '[JSON] '[Header "Set-Cookie" SetCookie, Header "Set-Cookie" SetCookie] -> route :- CachixAuth :> "user" :> Get '[JSON] User -> route :- CachixAuth :> "token" :> Post '[JSON] Text -> route :- CachixAuth :> "cache" :> Get '[JSON] [BinaryCache] -> route :- "cache" :> Capture "name" Text :> ToServantApi BinaryCacheAPI -> CachixAPI route
[logout] :: CachixAPI route -> route :- "logout" :> CachixAuth :> Post302 '[JSON] '[Header "Set-Cookie" SetCookie, Header "Set-Cookie" SetCookie]
[login] :: CachixAPI route -> route :- "login" :> Get302 '[JSON] '[]
[loginCallback] :: CachixAPI route -> route :- "login" :> "callback" :> QueryParam "code" Text :> QueryParam "state" Text :> Get302 '[JSON] '[Header "Set-Cookie" SetCookie, Header "Set-Cookie" SetCookie]
[user] :: CachixAPI route -> route :- CachixAuth :> "user" :> Get '[JSON] User
[createToken] :: CachixAPI route -> route :- CachixAuth :> "token" :> Post '[JSON] Text
[caches] :: CachixAPI route -> route :- CachixAuth :> "cache" :> Get '[JSON] [BinaryCache]
[cache] :: CachixAPI route -> route :- "cache" :> Capture "name" Text :> ToServantApi BinaryCacheAPI
data BinaryCacheAPI route
BinaryCacheAPI :: route :- Get '[JSON] BinaryCache -> route :- CachixAuth :> ReqBody '[JSON] BinaryCacheCreate :> Post '[JSON] NoContent -> route :- "nix-cache-info" :> Get '[XNixCacheInfo, JSON] NixCacheInfo -> route :- "nar" :> Capture "nar" NarC :> StreamResponseGet '[XNixNar, JSON] -> route :- "nar" :> StreamBodyMonad '[XNixNar, JSON] AWS :> Post '[JSON] NoContent -> route :- Capture "narinfo" NarInfoC :> Get '[XNixNarInfo, JSON] NarInfo -> route :- Capture "narinfo" NarInfoC :> Head -> route :- Capture "narinfo" NarInfoC :> ReqBody '[JSON] NarInfoCreate :> Post '[JSON] NoContent -> BinaryCacheAPI route
[get] :: BinaryCacheAPI route -> route :- Get '[JSON] BinaryCache
[create] :: BinaryCacheAPI route -> route :- CachixAuth :> ReqBody '[JSON] BinaryCacheCreate :> Post '[JSON] NoContent
[nixCacheInfo] :: BinaryCacheAPI route -> route :- "nix-cache-info" :> Get '[XNixCacheInfo, JSON] NixCacheInfo
[nar] :: BinaryCacheAPI route -> route :- "nar" :> Capture "nar" NarC :> StreamResponseGet '[XNixNar, JSON]
[createNar] :: BinaryCacheAPI route -> route :- "nar" :> StreamBodyMonad '[XNixNar, JSON] AWS :> Post '[JSON] NoContent
[narinfo] :: BinaryCacheAPI route -> route :- Capture "narinfo" NarInfoC :> Get '[XNixNarInfo, JSON] NarInfo
[narinfoHead] :: BinaryCacheAPI route -> route :- Capture "narinfo" NarInfoC :> Head
[createNarinfo] :: BinaryCacheAPI route -> route :- Capture "narinfo" NarInfoC :> ReqBody '[JSON] NarInfoCreate :> Post '[JSON] NoContent
type CachixServantAPI = "api" :> "v1" :> ToServantApi CachixAPI
instance GHC.Generics.Generic (Cachix.Api.CachixAPI route)
instance GHC.Generics.Generic (Cachix.Api.BinaryCacheAPI route)
