From 37373fad38c7af66443c72485511ffbe68270624 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 22 Jul 2024 21:19:32 -0400 Subject: [PATCH] refactor --- P2P/Http.hs | 32 -------------------------------- P2P/Http/Types.hs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/P2P/Http.hs b/P2P/Http.hs index ce1e1a44b2..d1efce3ed4 100644 --- a/P2P/Http.hs +++ b/P2P/Http.hs @@ -960,35 +960,3 @@ clientKeepLocked clientenv (ProtocolVersion ver) lckid su cu bypass auth a = do _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI - -type PV3 = Capture "v3" V3 - -type PV2 = Capture "v2" V2 - -type PV1 = Capture "v1" V1 - -type PV0 = Capture "v0" V0 - -type SU = Capture "serveruuid" (B64UUID ServerSide) - -type CU req = QueryParam' '[req] "clientuuid" (B64UUID ClientSide) - -type BypassUUIDs = QueryParams "bypass" (B64UUID Bypass) - -type CaptureKey = Capture "key" B64Key - -type KeyParam = QueryParam' '[Required] "key" B64Key - -type AssociatedFileParam = QueryParam "associatedfile" B64FilePath - -type OffsetParam = QueryParam "offset" Offset - -type DataLengthHeader = Header DataLengthHeader' DataLength - -type DataLengthHeaderRequired = Header' '[Required] DataLengthHeader' DataLength - -type DataLengthHeader' = "X-git-annex-data-length" - -type LockIDParam = QueryParam' '[Required] "lockid" LockID - -type AuthHeader = Header "Authorization" Auth diff --git a/P2P/Http/Types.hs b/P2P/Http/Types.hs index f5db2089ef..6a9b63a0c0 100644 --- a/P2P/Http/Types.hs +++ b/P2P/Http/Types.hs @@ -10,6 +10,7 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE DataKinds #-} module P2P.Http.Types where @@ -28,6 +29,35 @@ import Data.Aeson hiding (Key) import Control.DeepSeq import GHC.Generics (Generic) +type SU = Capture "serveruuid" (B64UUID ServerSide) + +type CU req = QueryParam' '[req] "clientuuid" (B64UUID ClientSide) + +type BypassUUIDs = QueryParams "bypass" (B64UUID Bypass) + +type CaptureKey = Capture "key" B64Key + +type KeyParam = QueryParam' '[Required] "key" B64Key + +type AssociatedFileParam = QueryParam "associatedfile" B64FilePath + +type OffsetParam = QueryParam "offset" Offset + +type DataLengthHeader = Header DataLengthHeader' DataLength + +type DataLengthHeaderRequired = Header' '[Required] DataLengthHeader' DataLength + +type DataLengthHeader' = "X-git-annex-data-length" + +type LockIDParam = QueryParam' '[Required] "lockid" LockID + +type AuthHeader = Header "Authorization" Auth + +type PV3 = Capture "v3" V3 +type PV2 = Capture "v2" V2 +type PV1 = Capture "v1" V1 +type PV0 = Capture "v0" V0 + data V3 = V3 deriving (Show) data V2 = V2 deriving (Show) data V1 = V1 deriving (Show)