Package com.rxcodeforces.api
Class CodeforcesWebClient
java.lang.Object
com.rxcodeforces.api.CodeforcesWebClient
Represents a CodeforcesWebClient.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance of CodeforcesWebClient.CodeforcesWebClient
(String apiKey, String apiSecret) Constructs a new instance of CodeforcesWebClient with the specified API key and API secret. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<CFResponseList<Comment>>
getBlogEntryComments
(String blogEntryId) Returns a list of comments to the specified blog entry.reactor.core.publisher.Mono<CFResponse<BlogEntry>>
getBlogEntryView
(String blogEntryId) Returns blog entry.reactor.core.publisher.Mono<CFResponseList<Hack>>
getContestHacks
(String contestId) Returns list of hacks in the specified contests.reactor.core.publisher.Mono<CFResponseList<Contest>>
getContestList
(Boolean gym) Returns information about all available contests.reactor.core.publisher.Mono<CFResponseList<RatingChange>>
getContestRatingChanges
(String contestId) Returns rating changes after the contest.reactor.core.publisher.Mono<CFResponse<ContestStandings>>
getContestStandings
(String contestId, Integer from, Integer count, List<String> handles, String room, Boolean showUnofficial) Returns the requested part of the contest standings.reactor.core.publisher.Mono<CFResponseList<Submission>>
getContestStatus
(String contestId, String handle, Integer from, Integer count) Retrieves the submissions for a specified contest.reactor.core.publisher.Mono<CFResponse<ProblemSet>>
getProblemSetProblems
(List<String> tags, String problemSetName) Retrieves all problems from the problemset.reactor.core.publisher.Mono<CFResponseList<Submission>>
getProblemSetRecentStatus
(Integer count, String problemSetName) Retrieves recent submissions.reactor.core.publisher.Mono<CFResponseList<RecentAction>>
getRecentActions
(Integer maxCount) Retrieves recent actions.reactor.core.publisher.Mono<CFResponseList<BlogEntry>>
getUserBlogEntries
(String handle) Retrieves a list of all user's blog entries.reactor.core.publisher.Mono<CFResponseList<String>>
getUserFriends
(Boolean onlyOnline) Returns authorized user's friends.reactor.core.publisher.Mono<CFResponseList<User>>
getUserInfo
(List<String> handles) Returns information about one or several users.reactor.core.publisher.Mono<CFResponseList<User>>
getUserRatedList
(Boolean activeOnly, Boolean includeRetired, String contestId) Retrieves the list of users who have participated in at least one rated contest.reactor.core.publisher.Mono<CFResponseList<RatingChange>>
getUserRating
(String handle) Retrieves the rating history of the specified user.reactor.core.publisher.Mono<CFResponseList<Submission>>
getUserStatus
(String handle, Integer from, Integer count) Retrieves the submissions of the specified user.
-
Constructor Details
-
CodeforcesWebClient
public CodeforcesWebClient()Constructs a new instance of CodeforcesWebClient. Initializes the WebClient with default settings and sets the base URL to "https://codeforces.com/api/". -
CodeforcesWebClient
Constructs a new instance of CodeforcesWebClient with the specified API key and API secret. Initializes the WebClient with default settings and sets the base URL to "https://codeforces.com/api/".- Parameters:
apiKey
- The API key for Codeforces authentication.apiSecret
- The API secret for Codeforces authentication.
-
-
Method Details
-
getBlogEntryComments
public reactor.core.publisher.Mono<CFResponseList<Comment>> getBlogEntryComments(String blogEntryId) Returns a list of comments to the specified blog entry.- Parameters:
blogEntryId
- Id of the blog entry. It can be seen in blog entry URL. For example: /blog/entry/79
-
getBlogEntryView
Returns blog entry.- Parameters:
blogEntryId
- Id of the blog entry. It can be seen in blog entry URL. For example: /blog/entry/79
-
getContestHacks
Returns list of hacks in the specified contests. Full information about hacks is available only after some time after the contest end. During the contest user can see only own hacks.- Parameters:
contestId
- (Required) Id of the contest. It is not the round number. It can be seen in contest URL. For example: /contest/566/status
-
getContestList
Returns information about all available contests.- Parameters:
gym
- Boolean. If true — than gym contests are returned. Otherwise, regular contests are returned.
-
getContestRatingChanges
public reactor.core.publisher.Mono<CFResponseList<RatingChange>> getContestRatingChanges(String contestId) Returns rating changes after the contest.- Parameters:
contestId
- Id of the contest. It is not the round number. It can be seen in contest URL. For example: /contest/566/status
-
getContestStandings
public reactor.core.publisher.Mono<CFResponse<ContestStandings>> getContestStandings(String contestId, Integer from, Integer count, List<String> handles, String room, Boolean showUnofficial) Returns the requested part of the contest standings.- Parameters:
contestId
- (Required) The ID of the contest. It is not the round number. It can be seen in the contest URL. For example: /contest/566/statusfrom
- The 1-based index of the standings row to start the ranklist.count
- The number of standing rows to return.handles
- The semicolon-separated list of handles. No more than 10000 handles are accepted.room
- If specified, only participants from this room will be shown in the result. If not specified, all participants will be shown.showUnofficial
- If true, all participants (including virtual and out of competition) are shown. Otherwise, only official contestants are shown.- Returns:
- The ContestStandings for the specified contest and parameters.
-
getContestStatus
public reactor.core.publisher.Mono<CFResponseList<Submission>> getContestStatus(String contestId, String handle, Integer from, Integer count) Retrieves the submissions for a specified contest. Optionally, it can return submissions of a specified user.- Parameters:
contestId
- (Required) The ID of the contest. It is not the round number. It can be seen in the contest URL. For example: /contest/566/statushandle
- The Codeforces user handle. If specified, only submissions of this user will be returned.from
- The 1-based index of the first submission to return.count
- The number of returned submissions.- Returns:
- The submissions for the specified contest and parameters.
-
getProblemSetProblems
public reactor.core.publisher.Mono<CFResponse<ProblemSet>> getProblemSetProblems(List<String> tags, String problemSetName) Retrieves all problems from the problemset. Problems can be filtered by tags.- Parameters:
tags
- A semicolon-separated list of tags. Only problems with matching tags will be returned.problemSetName
- The custom problemset's short name, like 'acmsguru'. If specified, only problems from the specified problemset will be returned.- Returns:
- Two lists: a list of Problem objects and a list of ProblemStatistics objects. The list of Problem objects contains the retrieved problems from the problemset. The list of ProblemStatistics objects contains the statistics data about each problem.
-
getProblemSetRecentStatus
public reactor.core.publisher.Mono<CFResponseList<Submission>> getProblemSetRecentStatus(Integer count, String problemSetName) throws CodeforcesApiException Retrieves recent submissions.- Parameters:
count
- (Required) The number of submissions to return. Can be up to 1000.problemSetName
- The custom problemset's short name, like 'acmsguru'. If specified, only submissions from the specified problemset will be returned.- Returns:
- A list of Submission objects, sorted in decreasing order of submission id.
- Throws:
CodeforcesApiException
-
getRecentActions
public reactor.core.publisher.Mono<CFResponseList<RecentAction>> getRecentActions(Integer maxCount) throws CodeforcesApiException Retrieves recent actions.- Parameters:
maxCount
- (Required) The number of recent actions to return. Can be up to 100.- Returns:
- A List response having list of RecentAction objects representing the recent actions.
- Throws:
CodeforcesApiException
-
getUserBlogEntries
public reactor.core.publisher.Mono<CFResponseList<BlogEntry>> getUserBlogEntries(String handle) throws CodeforcesApiException Retrieves a list of all user's blog entries.- Parameters:
handle
- (Required) The Codeforces user handle.- Returns:
- A list of BlogEntry objects in short form.
- Throws:
CodeforcesApiException
-
getUserFriends
Returns authorized user's friends. Using this method requires authorization.- Parameters:
onlyOnline
- Boolean. If true — only online friends are returned. Otherwise, all friends are returned.
-
getUserInfo
public reactor.core.publisher.Mono<CFResponseList<User>> getUserInfo(List<String> handles) throws CodeforcesApiException Returns information about one or several users.- Parameters:
handles
- Semicolon-separated list of handles. No more than 10000 handles is accepted.- Throws:
CodeforcesApiException
-
getUserRatedList
public reactor.core.publisher.Mono<CFResponseList<User>> getUserRatedList(Boolean activeOnly, Boolean includeRetired, String contestId) Retrieves the list of users who have participated in at least one rated contest.- Parameters:
activeOnly
- Boolean. If true, only users who participated in a rated contest during the last month are returned. Otherwise, all users with at least one rated contest are returned.includeRetired
- Boolean. If true, the method returns all rated users. Otherwise, the method returns only users who were online in the last month.contestId
- Id of the contest. It is not the round number. It can be seen in the contest URL. For example: /contest/566/status- Returns:
- A list of User objects, sorted in decreasing order of rating.
-
getUserRating
public reactor.core.publisher.Mono<CFResponseList<RatingChange>> getUserRating(String handle) throws CodeforcesApiException Retrieves the rating history of the specified user.- Parameters:
handle
- (Required) The Codeforces user handle.- Returns:
- A list of RatingChange objects representing the rating history of the requested user.
- Throws:
CodeforcesApiException
-
getUserStatus
public reactor.core.publisher.Mono<CFResponseList<Submission>> getUserStatus(String handle, Integer from, Integer count) throws CodeforcesApiException Retrieves the submissions of the specified user.- Parameters:
handle
- (Required) The Codeforces user handle.from
- The 1-based index of the first submission to return.count
- The number of submissions to return.- Returns:
- A list of Submission objects, sorted in decreasing order of submission id.
- Throws:
CodeforcesApiException
-