do-spaces-0.2: DigitalOcean Spaces API bindings
Copyright(c) 2021 Rory Tyler Hayford
LicenseBSD-3-Clause
Maintainerrory.hayford@protonmail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Network.DO.Spaces.Utils

Description

Small utilities

Synopsis

General utilities

tshow :: Show a => a -> Text Source #

Show some Text

bshow :: Show a => a -> ByteString Source #

Show a ByteString

unquote :: Text -> Text Source #

Strip leading and trailing double quotes from a Text

quote :: (IsString a, Monoid a) => a -> a Source #

toLowerBS :: ByteString -> ByteString Source #

Map ByteString chars to lower-case

handleMaybe :: MonadCatch m => (a -> m b) -> a -> m (Maybe b) Source #

regionSlug :: IsString a => Region -> a Source #

Convert a Region to its equivalent slug

renderUploadHeaders :: UploadHeaders -> [Header] Source #

Convert UploadHeaders to a list of request Headers

getResponseMetadata :: Status -> RawResponse m -> SpacesMetadata Source #

Create a SpacesMetadata by reading response Headers, after passing the Status

mkNode :: Name -> Text -> Node Source #

Create an XML Node

Parsing/reading

XML

xmlInt :: (MonadThrow m, Num a) => Text -> m a Source #

Read a Num type from Text

xmlElemError :: Text -> ClientException Source #

Helper to build exceptions during XML parsing

xmlUTCTime :: MonadThrow m => Text -> m UTCTime Source #

Read a UTCTime from an ISO-O8601-formatted Text

xmlNum :: Num a => MonadThrow m => Text -> Cursor Node -> m a Source #

Read a Num type, encoded as an integer, from XML

bucketP :: MonadThrow m => Cursor Node -> m Bucket Source #

Parse the name of a Bucket from XML

objectP :: MonadThrow m => Cursor Node -> m Object Source #

Parse the name of an Object from XML

etagP :: MonadThrow m => Cursor Node -> m ETag Source #

XML parser for ETag attribute

ownerP :: MonadThrow m => Cursor Node -> m Owner Source #

XML parser for Owner attribute

lastModifiedP :: MonadThrow m => Cursor Node -> m UTCTime Source #

XML parser for LastModified attribute

writeACLSetter :: (HasField' "owner" r Owner, HasField' "acls" r [Grant]) => r -> ByteString Source #

Response headers

lookupHeader :: Monad m => RawResponse m -> HeaderName -> MaybeT m ByteString Source #

Lookup the value of a HeaderName from a RawResponse in a monadic context

readEtag :: Monad m => ByteString -> MaybeT m ETag Source #

Transform a Header value into an ETag

readContentLen :: Monad m => ByteString -> MaybeT m Int Source #

Transform a Header value into an Int (for Content-Length)