Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data UserConfig = UserConfig {}
- data AuthQuery = AuthQuery {}
- generateRequestParams :: UserConfig -> String -> Query -> IO Query
Documentation
data UserConfig Source #
Represents the user's configuration settings.
The API key must first be generated on
the Codeforces API page.
An API key consists of two parameters: key
and secret
.
To use the API key in a request, some parameters need to be generated from this configuration.
Instances
Show UserConfig Source # | |
Defined in Codeforces.Config showsPrec :: Int -> UserConfig -> ShowS # show :: UserConfig -> String # showList :: [UserConfig] -> ShowS # | |
ToJSON UserConfig Source # | |
Defined in Codeforces.Config toJSON :: UserConfig -> Value # toEncoding :: UserConfig -> Encoding # toJSONList :: [UserConfig] -> Value # toEncodingList :: [UserConfig] -> Encoding # | |
FromJSON UserConfig Source # | |
Defined in Codeforces.Config parseJSON :: Value -> Parser UserConfig # parseJSONList :: Value -> Parser [UserConfig] # |
Contains the data needed to make an authorized GET request.
See generateRequestParams
.
generateRequestParams :: UserConfig -> String -> Query -> IO Query Source #
generateRequestParams
config path query
returns a query string with
extra query items that are generated to allow for authorized access.
The parameters are of the form:
?paramI=valueI&apiKey=key&time=time&apiSig=randhash
Where
rand
is a random 6-digit integertime
is current time since epoch in secondshash
is the SHA-512 hashcode of the UTF-8 encoded string:
rand/methodName?paramI=valueI&apiKey=key&time=time#secret