Copyright | (c) Naoto Shimazaki 2017 |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | https://github.com/nshimaza |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Network.WebexTeams.Internal
Description
Implements some internal functions for Cisco Webex Teams API.
Synopsis
- dropAndLow :: Int -> String -> String
- data LinkParam
- = Rel
- | Other ByteString
- data LinkHeader = LinkHeader {}
- dQuote :: Parser Word8
- semicolon :: Parser Word8
- equalChar :: Parser Word8
- lessThan :: Parser Word8
- greaterThan :: Parser Word8
- skipSpace :: Parser ()
- token :: Parser ByteString
- quotedPair :: Parser Word8
- quotedString :: Parser ByteString
- paramValue :: Parser ByteString
- paramName :: ByteString -> LinkParam
- param :: Parser (LinkParam, ByteString)
- linkHeader :: Parser LinkHeader
- extractNextUrl :: [ByteString] -> [ByteString]
- getNextUrl :: Response a -> Maybe ByteString
- validateUrl :: String -> URIAuth -> ByteString -> Maybe ByteString
Documentation
Arguments
:: Int | Number of characters to drop |
-> String | Field name to be modified to JSON field name |
-> String |
Drop given number of characters from the given String
then
change first character of the remaining string to lowercase.
This function is intended to be used for fieldLabelModifier
and constructorTagModifier
argument of DeriveJSON
from DATA.Aeson.TH.
You can find how this function is used in WebexTeams
source code.
Parsed Link header parameter. Convert only rel param to Rel
and keeps other params as-is.
Constructors
Rel | |
Other ByteString |
data LinkHeader Source #
Parsed entire Link header value. It keeps URI-Reference part untouched for farther processing in different way.
Constructors
LinkHeader | |
Fields
|
Instances
Eq LinkHeader Source # | |
Defined in Network.WebexTeams.Internal | |
Show LinkHeader Source # | |
Defined in Network.WebexTeams.Internal Methods showsPrec :: Int -> LinkHeader -> ShowS # show :: LinkHeader -> String # showList :: [LinkHeader] -> ShowS # |
greaterThan :: Parser Word8 Source #
Matches to greater-than character.
token :: Parser ByteString Source #
Parse RFC7230 token.
quotedPair :: Parser Word8 Source #
Parse RFC7230 quoted-pair.
quotedString :: Parser ByteString Source #
Parse RFC7230 quoted-string.
paramValue :: Parser ByteString Source #
Parse a parameter value in Link header.
paramName :: ByteString -> LinkParam Source #
Convert parameter name string to LinkParam.
linkHeader :: Parser LinkHeader Source #
Attoparsec parser of RFC5988 HTTP Link Header. Link header is defined in RFC5988 https://tools.ietf.org/html/rfc5988. This parser doesn't parse complete spec of RFC5988 but only parses rel="next" link for simple pagination. It doesn't parse obs-fold defined in RFC7230 https://tools.ietf.org/html/rfc7230. It assumes Header in Response never contains CRLF or LF.
extractNextUrl :: [ByteString] -> [ByteString] Source #
Accept all RFC5988 Link HTTP header, filter first header containing rel="next" param, parse URL part.
getNextUrl :: Response a -> Maybe ByteString Source #
Return URL for next page if it exists in given response.
validateUrl :: String -> URIAuth -> ByteString -> Maybe ByteString Source #
Validate extracted URL from HTTP Link Header by getNextUrl
.
Check if it has same scheme and URI authority as original request.