cisco-spark-api-0.1.0.4: DEPRECATED in favor of webex-teams-api

Copyright(c) Naoto Shimazaki 2017
LicenseMIT (see the file LICENSE)
Maintainerhttps://github.com/nshimaza
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Network.CiscoSpark.Internal

Description

Implements some internal functions for Cisco Spark API.

Synopsis

Documentation

dropAndLow Source #

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 CiscoSpark source code.

data LinkParam Source #

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

Constructors

Rel 
Other ByteString 
Instances
Eq LinkParam Source # 
Instance details

Defined in Network.CiscoSpark.Internal

Show LinkParam Source # 
Instance details

Defined in Network.CiscoSpark.Internal

data LinkHeader Source #

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

Instances
Eq LinkHeader Source # 
Instance details

Defined in Network.CiscoSpark.Internal

Show LinkHeader Source # 
Instance details

Defined in Network.CiscoSpark.Internal

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.