webex-teams-api- A Haskell bindings for Webex Teams API

Copyright(c) Naoto Shimazaki 2017
LicenseMIT (see the file LICENSE)
Safe HaskellNone



Implements some internal functions for Cisco Webex Teams API.



dropAndLow Source #


:: 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.

data LinkParam Source #

Parsed Link header parameter. Convert only rel param to Rel and keeps other params as-is.


Other ByteString 

data LinkHeader Source #

Parsed entire Link header value. It keeps URI-Reference part untouched for farther processing in different way.

dQuote :: Parser Word8 Source #

Matches to double quote.

semicolon :: Parser Word8 Source #

Matches to semicolon.

equalChar :: Parser Word8 Source #

Matches to equal character.

lessThan :: Parser Word8 Source #

Matches to less-than character.

greaterThan :: Parser Word8 Source #

Matches to greater-than character.

skipSpace :: Parser () Source #

Skips white spaces.

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.

param :: Parser (LinkParam, ByteString) Source #

Parse parameter part of Link header.

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.