| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Codeforces.Config
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.
Constructors
| UserConfig | |
Instances
| Show UserConfig Source # | |
Defined in Codeforces.Config Methods showsPrec :: Int -> UserConfig -> ShowS # show :: UserConfig -> String # showList :: [UserConfig] -> ShowS # | |
| ToJSON UserConfig Source # | |
Defined in Codeforces.Config Methods toJSON :: UserConfig -> Value # toEncoding :: UserConfig -> Encoding # toJSONList :: [UserConfig] -> Value # toEncodingList :: [UserConfig] -> Encoding # | |
| FromJSON UserConfig Source # | |
Defined in Codeforces.Config | |
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
randis a random 6-digit integertimeis current time since epoch in secondshashis the SHA-512 hashcode of the UTF-8 encoded string:
rand/methodName?paramI=valueI&apiKey=key&time=time#secret