diff --git a/src/Network/GemServ/Types.hs b/src/Network/GemServ/Types.hs index d94c274..b4179f4 100644 --- a/src/Network/GemServ/Types.hs +++ b/src/Network/GemServ/Types.hs @@ -28,12 +28,15 @@ module Network.GemServ.Types ( -- * Types GemURL (..), GemRequest (..), + GemResponse (..), -- * Constructors newGemURL, - newGemRequest + newGemRequest, + newGemResponse, ) where -import Data.Word (Word32) +import qualified Data.ByteString as BS +import Data.Word (Word8, Word32) import Data.X509 (Certificate) -- | Gemini URL @@ -56,6 +59,16 @@ data GemRequest = GemRequest -- ^ The client certificate (if available) } deriving (Eq, Show) +-- | Describes a response to a Gemini request +data GemResponse = GemResponse + { respStatus :: Word8 + -- ^ The response status code + , respMeta :: String + -- ^ The response metadata + , respBody :: Maybe BS.ByteString + -- ^ The response body + } deriving (Eq, Show) + -- | Builds a new 'GemURL' newGemURL :: String @@ -78,4 +91,12 @@ newGemRequest url = GemRequest , reqCert = Nothing } +-- | Builds a 'GemResponse' +newGemResponse :: GemResponse +newGemResponse = GemResponse + { respStatus = 20 + , respMeta = "text/gemini" + , respBody = Nothing + } + --jl