codeforces-cli-0.1.0: Command line interface to interact with Codeforces.
Safe HaskellNone
LanguageHaskell2010

Codeforces.API

Synopsis

Documentation

data ResponseError Source #

An error that could occur during the retrieval and inital parsing of data from the Codeforces API.

Constructors

ApiFail String

Corresponds to a ResponseFail from the Codeforces API with the fail comment.

JsonError JSONException

Wrapper around JSONException, used if the successful JSON response could not be parsed.

HttpError HttpException

Wrapper around HttpException, used for situations like a failed connection.

Instances

Instances details
Show ResponseError Source # 
Instance details

Defined in Codeforces.Response

Contests

getContests :: Bool -> IO (Either ResponseError [Contest]) Source #

getContests isGym returns a list of contests that may or may not be gym contests.

getContestStandings :: StandingsParams -> IO (Either ResponseError Standings) Source #

getContestStandings standingsParams returns information about the contest and a part of the standings list.

getContestStandings' :: StandingsParams -> IO (Either ResponseError (Standings, Map Handle RatingChange)) Source #

Like getContestStandings but returns the standings and the RatingChanges for each user participating.

data StandingsParams Source #

Query parameters for retrieving contest standings.

Constructors

StandingsParams 

Fields

Instances

Instances details
Show StandingsParams Source # 
Instance details

Defined in Codeforces.API

Problems

getProblems :: [ProblemTag] -> IO (Either ResponseError [Problem]) Source #

getProblems tags returns a list of Problems containing the tags, if provided.

getContestProblems :: ContestId -> IO (Either ResponseError [Problem]) Source #

getContestProblems contestId returns the list of problems for the given contest.

This should be used instead of filtering results from getProblems for two main reasons:

  1. problemContestId can only refer to one contest, so problems appearing in multiple contests may not be filtered correctly.
  2. getProblems returns larger output potentially affecting performance

Ratings and ranks

getUserRatingHistory :: Handle -> IO (Either ResponseError [RatingChange]) Source #

getUserRatingHistory handle returns a list of RatingChanges for the requested user

Problem submissions

getContestSubmissions :: ContestId -> Handle -> IO (Either ResponseError [Submission]) Source #

getContestSubmissions contestId handle returns the submissions made by the user in the contest given by contestId

getUserStatus :: Handle -> Int -> Int -> IO (Either ResponseError [Submission]) Source #

getUserStatus handle from count returns the count most recent submissions by the user, starting from the from-th one.

User details

getUser :: Handle -> IO (Either ResponseError User) Source #

getUser handle returns the User with the given handle

getUsers :: [Handle] -> IO (Either ResponseError [User]) Source #

getUsers handles returns a list of Users with the given handles

Virtual rating calculation

calculateVirtualResult :: ContestId -> Handle -> Points -> Int -> IO (Either ResponseError (User, Maybe VirtualResult)) Source #

calculateVirtualResult contestId handle points penalty computes the rating change the user would gain had they competed in the contest live, and their expected ranking for the contest.

type Delta = Int Source #

Difference in rating between a user's current rating, and their rating following this contest.

type Seed = Float Source #

The seed is the expected ranking for each participant before the contest begins.

A contestant's rating increases should they perform better than their seed, and decreases should they perform worse.

data VirtualResult Source #

A virtual participation result

Instances

Instances details
Show VirtualResult Source # 
Instance details

Defined in Codeforces.Virtual.Types

Configuration options

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 

Fields