implemented GemResponse type and constructor
This commit is contained in:
parent
d1f26115f6
commit
7addd8982f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user