implemented GemRequest type and constructor

This commit is contained in:
Jonathan Lamothe 2021-10-28 19:18:20 -04:00
parent 75d5e44278
commit d1f26115f6

View File

@ -25,11 +25,16 @@ License along with this program. If not, see
-}
module Network.GemServ.Types (
-- * Types
GemURL (..),
newGemURL
GemRequest (..),
-- * Constructors
newGemURL,
newGemRequest
) where
import Data.Word (Word32)
import Data.X509 (Certificate)
-- | Gemini URL
data GemURL = GemURL
@ -43,6 +48,14 @@ data GemURL = GemURL
-- ^ The decoded request query (if supplied)
} deriving (Eq, Show)
-- | Describes a Gemini request
data GemRequest = GemRequest
{ reqURL :: GemURL
-- ^ The URL being requested
, reqCert :: Maybe Certificate
-- ^ The client certificate (if available)
} deriving (Eq, Show)
-- | Builds a new 'GemURL'
newGemURL
:: String
@ -55,4 +68,14 @@ newGemURL host = GemURL
, gemQuery = Nothing
}
-- | Builds a 'GemRequest'
newGemRequest
:: GemURL
-- ^ The request URL
-> GemRequest
newGemRequest url = GemRequest
{ reqURL = url
, reqCert = Nothing
}
--jl