Copyright | (c) 2021 Rory Tyler Hayford |
---|---|
License | BSD-3-Clause |
Maintainer | rory.hayford@protonmail.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Small utilities
Synopsis
- tshow :: Show a => a -> Text
- bshow :: Show a => a -> ByteString
- unquote :: Text -> Text
- quote :: (IsString a, Monoid a) => a -> a
- bodyLBS :: MonadThrow m => RequestBody -> m ByteString
- toLowerBS :: ByteString -> ByteString
- handleMaybe :: MonadCatch m => (a -> m b) -> a -> m (Maybe b)
- regionSlug :: IsString a => Region -> a
- showCannedACL :: IsString a => CannedACL -> a
- renderUploadHeaders :: UploadHeaders -> [Header]
- defaultUploadHeaders :: UploadHeaders
- slugToRegion :: (MonadThrow m, IsString a, Eq a) => a -> m Region
- getResponseMetadata :: Status -> RawResponse m -> SpacesMetadata
- mkNode :: Name -> Text -> Node
- showPermission :: IsString a => Permission -> a
- xmlDocCursor :: (MonadIO m, MonadThrow m) => RawResponse m -> m Cursor
- xmlInt :: (MonadThrow m, Num a) => Text -> m a
- xmlElemError :: Text -> ClientException
- xmlUTCTime :: MonadThrow m => Text -> m UTCTime
- xmlNum :: Num a => MonadThrow m => Text -> Cursor Node -> m a
- xmlMaybeElem :: Cursor Node -> Text -> Maybe Text
- isTruncP :: MonadThrow m => Cursor Node -> m Bool
- bucketP :: MonadThrow m => Cursor Node -> m Bucket
- objectP :: MonadThrow m => Cursor Node -> m Object
- etagP :: MonadThrow m => Cursor Node -> m ETag
- ownerP :: MonadThrow m => Cursor Node -> m Owner
- lastModifiedP :: MonadThrow m => Cursor Node -> m UTCTime
- aclP :: MonadThrow m => Cursor Node -> m ACLResponse
- writeACLSetter :: (HasField' "owner" r Owner, HasField' "acls" r [Grant]) => r -> ByteString
- lookupObjectMetadata :: MonadThrow m => RawResponse m -> m ObjectMetadata
- lookupHeader :: Monad m => RawResponse m -> HeaderName -> MaybeT m ByteString
- readEtag :: Monad m => ByteString -> MaybeT m ETag
- readContentLen :: Monad m => ByteString -> MaybeT m Int
General utilities
bshow :: Show a => a -> ByteString Source #
Show a ByteString
bodyLBS :: MonadThrow m => RequestBody -> m ByteString Source #
Convert a RequestBody
to a ByteString
toLowerBS :: ByteString -> ByteString Source #
Map ByteString
chars to lower-case
handleMaybe :: MonadCatch m => (a -> m b) -> a -> m (Maybe b) Source #
showCannedACL :: IsString a => CannedACL -> a Source #
renderUploadHeaders :: UploadHeaders -> [Header] Source #
Convert UploadHeaders
to a list of request Header
s
slugToRegion :: (MonadThrow m, IsString a, Eq a) => a -> m Region Source #
getResponseMetadata :: Status -> RawResponse m -> SpacesMetadata Source #
Create a SpacesMetadata
by reading response Header
s, after passing the
Status
showPermission :: IsString a => Permission -> a Source #
Parsing/reading
XML
xmlDocCursor :: (MonadIO m, MonadThrow m) => RawResponse m -> m Cursor Source #
xmlElemError :: Text -> ClientException Source #
Helper to build exceptions during XML parsing
xmlUTCTime :: MonadThrow m => Text -> m UTCTime Source #
xmlNum :: Num a => MonadThrow m => Text -> Cursor Node -> m a Source #
Read a Num
type, encoded as an integer, from XML
lastModifiedP :: MonadThrow m => Cursor Node -> m UTCTime Source #
XML parser for LastModified
attribute
aclP :: MonadThrow m => Cursor Node -> m ACLResponse Source #
writeACLSetter :: (HasField' "owner" r Owner, HasField' "acls" r [Grant]) => r -> ByteString Source #
Response headers
lookupObjectMetadata :: MonadThrow m => RawResponse m -> m ObjectMetadata Source #
lookupHeader :: Monad m => RawResponse m -> HeaderName -> MaybeT m ByteString Source #
Lookup the value of a HeaderName
from a RawResponse
in a monadic context
readContentLen :: Monad m => ByteString -> MaybeT m Int Source #