packages feed

cachix-api 1.4.2 → 1.5

raw patch · 3 files changed

+31/−1 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Cachix.API: [createPin] :: BinaryCacheAPI route -> route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("pin" :> (ReqBody '[JSON] PinCreate :> Post '[JSON] NoContent)))))
+ Cachix.Types.PinCreate: Days :: Int -> Keep
+ Cachix.Types.PinCreate: Forever :: Keep
+ Cachix.Types.PinCreate: PinCreate :: Text -> Text -> [Text] -> Maybe Keep -> PinCreate
+ Cachix.Types.PinCreate: Revisions :: Int -> Keep
+ Cachix.Types.PinCreate: [artifacts] :: PinCreate -> [Text]
+ Cachix.Types.PinCreate: [keep] :: PinCreate -> Maybe Keep
+ Cachix.Types.PinCreate: [name] :: PinCreate -> Text
+ Cachix.Types.PinCreate: [storePath] :: PinCreate -> Text
+ Cachix.Types.PinCreate: data Keep
+ Cachix.Types.PinCreate: data PinCreate
+ Cachix.Types.PinCreate: instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Types.PinCreate.Keep
+ Cachix.Types.PinCreate: instance Data.Aeson.Types.FromJSON.FromJSON Cachix.Types.PinCreate.PinCreate
+ Cachix.Types.PinCreate: instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Types.PinCreate.Keep
+ Cachix.Types.PinCreate: instance Data.Aeson.Types.ToJSON.ToJSON Cachix.Types.PinCreate.PinCreate
+ Cachix.Types.PinCreate: instance Data.Swagger.Internal.Schema.ToSchema Cachix.Types.PinCreate.Keep
+ Cachix.Types.PinCreate: instance Data.Swagger.Internal.Schema.ToSchema Cachix.Types.PinCreate.PinCreate
+ Cachix.Types.PinCreate: instance GHC.Classes.Eq Cachix.Types.PinCreate.Keep
+ Cachix.Types.PinCreate: instance GHC.Classes.Eq Cachix.Types.PinCreate.PinCreate
+ Cachix.Types.PinCreate: instance GHC.Generics.Generic Cachix.Types.PinCreate.Keep
+ Cachix.Types.PinCreate: instance GHC.Generics.Generic Cachix.Types.PinCreate.PinCreate
+ Cachix.Types.PinCreate: instance GHC.Show.Show Cachix.Types.PinCreate.Keep
+ Cachix.Types.PinCreate: instance GHC.Show.Show Cachix.Types.PinCreate.PinCreate
- Cachix.API: BinaryCacheAPI :: (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("nix-cache-info" :> Get '[XNixCacheInfo, JSON] NixCacheInfo))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> (Capture "narinfohash" NarInfoHash :> Get '[XNixNarInfo, JSON] (Headers '[Header "Cache-Control" Text] CachixNarInfo)))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> (Capture "narinfohash" NarInfoHash :> Head))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("nar" :> (Capture "nar" NarFileName :> Get302 '[XNixNar] '[])))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> Get '[JSON] BinaryCache)))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("narinfo" :> (Summary "Given a list of store hashes, return a list of those that are missing" :> (ReqBody '[JSON] [Text] :> Post '[JSON] [Text]))))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("narurl" :> (Capture "nar" NarFileName :> Get '[JSON] Text)))))) -> (route :- (Summary "Upload a NAR directly to the Cachix Server" :> (Description "This is a legacy API for older Cachix clients. Prefer 'createNar' instead." :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("nar" :> (QueryParam "compression" CompressionMethod :> (StreamBody NoFraming XNixNar (ConduitT () ByteStringStreaming (ResourceT IO) ()) :> Post '[JSON] NoContent))))))))) -> (route :- (Summary "Create an empty NAR and initiate a multipart upload" :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("multipart-nar" :> (QueryParam "compression" CompressionMethod :> Post '[JSON] CreateMultipartUploadResponse))))))) -> (route :- (Summary "Retrieve a presigned URL to upload a part of a multipart NAR" :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("multipart-nar" :> (Capture "narUuid" UUID :> (QueryParam' '[Required] "uploadId" Text :> (QueryParam' '[Required] "partNumber" Int :> (ReqBody '[JSON] SigningData :> Post '[JSON] UploadPartResponse)))))))))) -> (route :- (Summary "Complete a multipart upload" :> (Description "Verify the etags for each part and create the narinfo" :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("multipart-nar" :> (Capture "narUuid" UUID :> ("complete" :> (QueryParam' '[Required] "uploadId" Text :> (ReqBody '[JSON] CompletedMultipartUpload :> Post '[JSON] NoContent))))))))))) -> (route :- (Summary "Abort a multipart upload" :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("multipart-nar" :> (Capture "narUuid" UUID :> ("abort" :> (QueryParam' '[Required] "uploadId" Text :> Post '[JSON] NoContent))))))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> (Capture "narinfohash" NarInfoHash :> (ReqBody '[JSON] NarInfoCreate :> Post '[JSON] NoContent)))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("serve" :> (Capture "storehash" Text :> (CaptureAll "filepath" Text :> (Summary "Serve a file from a given store path" :> Get '[XNixNar] (Headers '[Header "X-Content-Type-Options" Text, Header "Cache-Control" Text] LazyByteStringStreaming))))))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("key" :> (ReqBody '[JSON] SigningKeyCreate :> Post '[JSON] NoContent)))))) -> BinaryCacheAPI route
+ Cachix.API: BinaryCacheAPI :: (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("nix-cache-info" :> Get '[XNixCacheInfo, JSON] NixCacheInfo))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> (Capture "narinfohash" NarInfoHash :> Get '[XNixNarInfo, JSON] (Headers '[Header "Cache-Control" Text] CachixNarInfo)))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> (Capture "narinfohash" NarInfoHash :> Head))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("nar" :> (Capture "nar" NarFileName :> Get302 '[XNixNar] '[])))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> Get '[JSON] BinaryCache)))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("narinfo" :> (Summary "Given a list of store hashes, return a list of those that are missing" :> (ReqBody '[JSON] [Text] :> Post '[JSON] [Text]))))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("narurl" :> (Capture "nar" NarFileName :> Get '[JSON] Text)))))) -> (route :- (Summary "Upload a NAR directly to the Cachix Server" :> (Description "This is a legacy API for older Cachix clients. Prefer 'createNar' instead." :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("nar" :> (QueryParam "compression" CompressionMethod :> (StreamBody NoFraming XNixNar (ConduitT () ByteStringStreaming (ResourceT IO) ()) :> Post '[JSON] NoContent))))))))) -> (route :- (Summary "Create an empty NAR and initiate a multipart upload" :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("multipart-nar" :> (QueryParam "compression" CompressionMethod :> Post '[JSON] CreateMultipartUploadResponse))))))) -> (route :- (Summary "Retrieve a presigned URL to upload a part of a multipart NAR" :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("multipart-nar" :> (Capture "narUuid" UUID :> (QueryParam' '[Required] "uploadId" Text :> (QueryParam' '[Required] "partNumber" Int :> (ReqBody '[JSON] SigningData :> Post '[JSON] UploadPartResponse)))))))))) -> (route :- (Summary "Complete a multipart upload" :> (Description "Verify the etags for each part and create the narinfo" :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("multipart-nar" :> (Capture "narUuid" UUID :> ("complete" :> (QueryParam' '[Required] "uploadId" Text :> (ReqBody '[JSON] CompletedMultipartUpload :> Post '[JSON] NoContent))))))))))) -> (route :- (Summary "Abort a multipart upload" :> (CachixAuth :> ("cache" :> (Capture "name" Text :> ("multipart-nar" :> (Capture "narUuid" UUID :> ("abort" :> (QueryParam' '[Required] "uploadId" Text :> Post '[JSON] NoContent))))))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> (Capture "narinfohash" NarInfoHash :> (ReqBody '[JSON] NarInfoCreate :> Post '[JSON] NoContent)))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("serve" :> (Capture "storehash" Text :> (CaptureAll "filepath" Text :> (Summary "Serve a file from a given store path" :> Get '[XNixNar] (Headers '[Header "X-Content-Type-Options" Text, Header "Cache-Control" Text] LazyByteStringStreaming))))))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("key" :> (ReqBody '[JSON] SigningKeyCreate :> Post '[JSON] NoContent)))))) -> (route :- (CachixAuth :> ("cache" :> (Capture "name" Text :> ("pin" :> (ReqBody '[JSON] PinCreate :> Post '[JSON] NoContent)))))) -> BinaryCacheAPI route

Files

cachix-api.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.2 name:               cachix-api-version:            1.4.2+version:            1.5 synopsis:           Servant HTTP API specification for https://cachix.org homepage:           https://github.com/cachix/cachix#readme bug-reports:        https://github.com/cachix/cachix/issues@@ -59,6 +59,7 @@     Cachix.Types.NarInfoHash     Cachix.Types.NixCacheInfo     Cachix.Types.Permission+    Cachix.Types.PinCreate     Cachix.Types.Servant     Cachix.Types.Session     Cachix.Types.SigningKeyCreate
src/Cachix/API.hs view
@@ -18,6 +18,7 @@ import qualified Cachix.Types.NarInfoCreate as NarInfoCreate import qualified Cachix.Types.NarInfoHash as NarInfoHash import qualified Cachix.Types.NixCacheInfo as NixCacheInfo+import qualified Cachix.Types.PinCreate as PinCreate import Cachix.Types.Servant (Get302, Head) import Cachix.Types.Session (Session) import qualified Cachix.Types.SigningKeyCreate as SigningKeyCreate@@ -170,6 +171,14 @@           :> Capture "name" Text           :> "key"           :> ReqBody '[JSON] SigningKeyCreate.SigningKeyCreate+          :> Post '[JSON] NoContent,+    createPin ::+      route+        :- CachixAuth+          :> "cache"+          :> Capture "name" Text+          :> "pin"+          :> ReqBody '[JSON] PinCreate.PinCreate           :> Post '[JSON] NoContent   }   deriving (Generic)
+ src/Cachix/Types/PinCreate.hs view
@@ -0,0 +1,20 @@+module Cachix.Types.PinCreate where++import Data.Aeson (FromJSON, ToJSON)+import Data.Swagger (ToSchema (..), defaultSchemaOptions, genericDeclareNamedSchemaUnrestricted)+import Protolude++data Keep = Days Int | Revisions Int | Forever+  deriving (Show, Eq, Generic, ToJSON, FromJSON)++-- to support Keep with data constructor with arguments+instance ToSchema Keep where+  declareNamedSchema = genericDeclareNamedSchemaUnrestricted defaultSchemaOptions++data PinCreate = PinCreate+  { name :: Text,+    storePath :: Text,+    artifacts :: [Text],+    keep :: Maybe Keep+  }+  deriving (Show, Eq, Generic, ToJSON, FromJSON, ToSchema)