Safe Haskell | None |
---|
- wai :: Ctx -> Application
- task :: Ctx -> Method -> Resource -> ResourceT IO (Maybe Task)
- data Task
- data Resource
- data Ctx = Ctx {}
- data Order
- data Wildcard
- data SetWildcard
- resource :: Request -> Resource
- url :: Char -> [Text] -> Resource
- component :: Char -> Parser (Either (Either Text Wildcard) SetWildcard)
- plain :: Char -> Parser Text
- wildcard :: Char -> Parser Wildcard
- setWildcard :: Char -> Parser SetWildcard
- star :: Char -> Parser SetWildcard
- wildcards :: [(Text, Wildcard)]
- resolve :: Ctx -> Resource -> ResourceT IO (Attempt [Text])
- listing :: Ctx -> Text -> ResourceT IO (Attempt ([Text], [Text]))
- expand :: SetWildcard -> [Text] -> [Text]
- (-/-) :: Text -> Text -> Text
- s3Pieces :: Text -> [Text]
- s3Encode :: Text -> Builder
- plusNL :: Builder -> Builder
- order :: Order -> [Text] -> [Text]
- textSemVer :: Text -> [Integer]
Documentation
wai :: Ctx -> ApplicationSource
Resources are either singular or plural in character. URLs ending ending
in /
or containing set wildcards specify plural resources; all other
URLs indicate singular resources. A singular resource results in a
redirect while a plural resource results in a newline-separated list of
URLs (themselves singular in character).
Ctx | |
|
data SetWildcard Source
resource :: Request -> ResourceSource
Interpret a request URL as a resource, expanding wildcards as needed. By
default, wildcards are expanded with @
as the meta-character (@hi
,
@lo.semver5
) but the meta-character can be changed with a query
parameter so we pass the whole request here.
The meta-character is in leading position in wildcard path components and escapes itself in leading position, in a simple way: leading runs are shortened by one character. Some examples of path components and their interpretation are helpful:
hi -> The string "hi". @hi -> The hi.semver wildcard. @@hi -> The string "@hi". @@@hi -> The string "@@hi". ...and so on...
Sending meta=_
as a query parameter changes the meta-character to an
underscore. The meta-character may be any single character; empty or
overlong meta
parameters are ignored.
component :: Char -> Parser (Either (Either Text Wildcard) SetWildcard)Source
Parse a single path component.
plain :: Char -> Parser TextSource
Parse a plain string, shrinking leading runs of the metacharacter by one.
setWildcard :: Char -> Parser SetWildcardSource
Match a wildcard set, ending with a count (if it is inclusive) or an optional count and a final tilde (if it is exclusive).
star :: Char -> Parser SetWildcardSource
resolve :: Ctx -> Resource -> ResourceT IO (Attempt [Text])Source
Translate a resource in to a listing of objects. While intermediate S3 prefixes (directories) are traversed, the final match is always on keys for objects.
expand :: SetWildcard -> [Text] -> [Text]Source
s3Pieces :: Text -> [Text]Source
Split a URL into components, placing the balance of slashes in a slash run to the left of the last slash. This is what all the Amazon APIs -- including the HTTP interface -- seem to expect, based on experiment. This function exists so that we can split a URL retrieved from S3, by way of list bucket, for example, into pieces for later escaping.
s3Encode :: Text -> BuilderSource
Encode an S3 path to a URL, splitting on slashes but preserving slash runs as appropriate.
textSemVer :: Text -> [Integer]Source