codeforces

package module
v0.0.0-...-0f93304 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = NewClient()

DefaultClient is the default Client and is used by GetBlogEntryComments, GetBlogEntry, GetContestHacks, GetContestList, GetContestRatingChanges, GetContestStandings, GetContestStatus, GetProblemsetProblems, GetProblemsetRecentStatus, GetRecentActions, GetUserBlogEntries, GetUserFriends, GetUserInfo, GetUserRatedList, GetUserRating and GetUserStatus

Functions

func GetContestStandings

func GetContestStandings(contestID, from, count int, handles []string, room int, showUnofficial bool) (Contest, []Problem, []RanklistRow, error)

GetContestStandings returns the description of the contest and the requested part of the standings.

Set count to 0 for infinite count. Set handles to a empty list to not filter by handles. Set room to 0 to show all participants.

Returns object with three fields: "contest", "problems" and "rows". Field "contest" contains a Contest object. Field "problems" contains a list of Problem objects. Field "rows" contains a list of RanklistRow objects.

GetContestStandings is a wrapper around DefaultClient.GetContestStandings.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.standings

func GetProblemsetProblems

func GetProblemsetProblems(tags []string, problemsetName string) ([]Problem, []ProblemStatistics, error)

GetProblemsetProblems returns all problems from problemset. Problems can be filtered by tags.

Leave problemsetName empty for default problemset.

GetProblemsetProblems is a wrapper around DefaultClient.GetProblemsetProblems.

Codeforces API docs: https://codeforces.com/apiHelp/methods#problemset.problems

func GetUserFriends

func GetUserFriends(onlyOnline bool) ([]string, error)

GetUserFriends returns authorized user's friends. Using this method requires authorization.

GetUserFriends is a wrapper around DefaultClient.GetUserFriends.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.friends

Types

type BlogEntry

type BlogEntry struct {
	ID                      int      `json:"id"`
	OriginalLocale          string   `json:"originalLocale"`
	CreationTimeSeconds     int      `json:"creationTimeSeconds"`
	AuthorHandle            string   `json:"authorHandle"`
	Title                   string   `json:"title"`
	Content                 string   `json:"content"`
	Locale                  string   `json:"locale"`
	ModificationTimeSeconds int      `json:"modificationTimeSeconds"`
	AllowViewHistory        bool     `json:"allowViewHistory"`
	Tags                    []string `json:"tags"`
	Rating                  int      `json:"rating"`
}

BlogEntry represents a Codeforces blog entry. May be in either short or full version.

Codeforces API docs: https://codeforces.com/apiHelp/objects#BlogEntry

func GetBlogEntry

func GetBlogEntry(blogEntryID int) (BlogEntry, error)

GetBlogEntry returns blog entry.

GetBlogEntry is a wrapper around DefaultClient.GetBlogEntry.

Codeforces API docs: https://codeforces.com/apiHelp/methods#blogEntry.view

func GetUserBlogEntries

func GetUserBlogEntries(handle string) ([]BlogEntry, error)

GetUserBlogEntries returns a list of all user's blog entries.

GetUserBlogEntries is a wrapper around DefaultClient.GetUserBlogEntries.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.blogEntries

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

NewClient creates a new Client

func (*Client) GetBlogEntry

func (c *Client) GetBlogEntry(blogEntryID int) (BlogEntry, error)

GetBlogEntry returns blog entry.

Codeforces Api docs: https://codeforces.com/apiHelp/methods#blogEntry.view

func (*Client) GetBlogEntryComments

func (c *Client) GetBlogEntryComments(blogEntryID int) ([]Comment, error)

GetBlogEntryComments returns a list of comments to the specified blog entry.

Codeforces API docs: https://codeforces.com/apiHelp/methods#blogEntry.comments

func (*Client) GetContestHacks

func (c *Client) GetContestHacks(contestID int) ([]Hack, error)

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.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.hacks

func (*Client) GetContestList

func (c *Client) GetContestList(gym bool) ([]Contest, error)

GetContestList returns information about all available contests.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.list

func (*Client) GetContestRatingChanges

func (c *Client) GetContestRatingChanges(contestID int) ([]RatingChange, error)

GetContestRatingChanges returns rating changes after the contest.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.ratingChanges

func (*Client) GetContestStandings

func (c *Client) GetContestStandings(contestID, from, count int, handles []string, room int, showUnofficial bool) (Contest, []Problem, []RanklistRow, error)

GetContestStandings returns the description of the contest and the requested part of the standings.

Set count to 0 for infinite count. Set handles to a empty list to not filter by handles. Set room to 0 to show all participants.

Returns object with three fields: "contest", "problems" and "rows". Field "contest" contains a Contest object. Field "problems" contains a list of Problem objects. Field "rows" contains a list of RanklistRow objects.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.standings

func (*Client) GetContestStatus

func (c *Client) GetContestStatus(contestID int, handle string, from, count int) ([]Submission, error)

GetContestStatus returns submissions for specified contest. Optionally can return submissions of specified user.

Set handle to a empty string to get status for all handles. Set count to 0 for infinite count.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.status

func (*Client) GetProblemsetProblems

func (c *Client) GetProblemsetProblems(tags []string, problemsetName string) ([]Problem, []ProblemStatistics, error)

GetProblemsetProblems returns all problems from problemset. Problems can be filtered by tags.

Leave problemsetName empty for default problemset.

Codeforces API docs: https://codeforces.com/apiHelp/methods#problemset.problems

func (*Client) GetProblemsetRecentStatus

func (c *Client) GetProblemsetRecentStatus(count int, problemsetName string) ([]Submission, error)

GetProblemsetRecentStatus returns recent submissions.

Leave problemsetName empty for default problemset.

Codeforces API docs: https://codeforces.com/apiHelp/methods#problemset.recentStatus

func (*Client) GetRecentActions

func (c *Client) GetRecentActions(maxCount int) ([]RecentAction, error)

GetRecentActions returns recent actions.

Codeforces API docs: https://codeforces.com/apiHelp/methods#recentActions

func (*Client) GetUserBlogEntries

func (c *Client) GetUserBlogEntries(handle string) ([]BlogEntry, error)

GetUserBlogEntries returns a list of all user's blog entries.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.blogEntries

func (*Client) GetUserFriends

func (c *Client) GetUserFriends(onlyOnline bool) ([]string, error)

GetUserFriends Returns authorized user's friends. Using this method requires authorization.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.friends

func (*Client) GetUserInfo

func (c *Client) GetUserInfo(handles []string) ([]User, error)

GetUserInfo returns information about one or several users.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.info

func (*Client) GetUserRatedList

func (c *Client) GetUserRatedList(activeOnly bool) ([]User, error)

GetUserRatedList returns the list users who have participated in at least one rated contest.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.ratedList

func (*Client) GetUserRating

func (c *Client) GetUserRating(handle string) ([]RatingChange, error)

GetUserRating returns rating history of the specified user.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.rating

func (*Client) GetUserStatus

func (c *Client) GetUserStatus(handle string, from, count int) ([]Submission, error)

GetUserStatus returns submissions of specified user.

Set count to 0 for infinite count.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.status

func (*Client) SetAPIKey

func (c *Client) SetAPIKey(apiKey, apiSecret string)

SetAPIKey sets apiKey and apiSecret of a client

func (*Client) SetLocale

func (c *Client) SetLocale(locale string)

SetLocale sets locale of a client

type Comment

type Comment struct {
	ID                  int    `json:"id"`
	CreationTimeSeconds int    `json:"creationTimeSeconds"`
	CommentatorHandle   string `json:"commentatorHandle"`
	Locale              string `json:"locale"`
	Text                string `json:"text"`
	ParentCommentID     int    `json:"parentCommentId,omitempty"`
	Rating              int    `json:"rating"`
}

Comment represents a comment.

Codeforces API docs: https://codeforces.com/apiHelp/objects#Comment

func GetBlogEntryComments

func GetBlogEntryComments(blogEntryID int) ([]Comment, error)

GetBlogEntryComments returns a list of comments to the specified blog entry.

GetBlogEntryComments is a wrapper around DefaultClient.GetBlogEntryComments.

Codeforces API docs: https://codeforces.com/apiHelp/methods#blogEntry.comments

type Contest

type Contest struct {
	ID                  int    `json:"id"`
	Name                string `json:"name"`
	Type                string `json:"type"`
	Phase               string `json:"phase"`
	Frozen              bool   `json:"frozen"`
	DurationSeconds     int    `json:"durationSeconds"`
	StartTimeSeconds    int    `json:"startTimeSeconds,omitempty"`
	RelativeTimeSeconds int    `json:"relativeTimeSeconds,omitempty"`
	PreparedBy          string `json:"preparedBy,omitempty"`
	WebsiteURL          string `json:"websiteUrl,omitempty"`
	Description         string `json:"description,omitempty"`
	Difficulty          int    `json:"difficulty,omitempty"`
	Kind                string `json:"kind,omitempty"`
	IcpcRegion          string `json:"icpcRegion,omitempty"`
	Country             string `json:"country,omitempty"`
	City                string `json:"city,omitempty"`
	Season              string `json:"season,omitempty"`
}

Contest represents a contest on Codeforces.

Codeforces API docs: https://codeforces.com/apiHelp/objects#Contest

func GetContestList

func GetContestList(gym bool) ([]Contest, error)

GetContestList returns information about all available contests.

GetContestList is a wrapper around DefaultClient.GetContestList.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.list

type Hack

type Hack struct {
	ID                  int     `json:"id"`
	CreationTimeSeconds int     `json:"creationTimeSeconds"`
	Hacker              Party   `json:"hacker"`
	Defender            Party   `json:"defender"`
	Verdict             string  `json:"verdict,omitempty"`
	Problem             Problem `json:"problem"`
	Test                string  `json:"test,omitempty"`
	JudgeProtocol       struct {
		Manual   string `json:"manual"`
		Protocol string `json:"protocol"`
		Verdict  string `json:"verdict"`
	} `json:"judgeProtocol,omitempty"`
}

Hack represents a hack, made during Codeforces Round.

Codeforces API docs: https://codeforces.com/apiHelp/objects#Hack

func GetContestHacks

func GetContestHacks(contestID int) ([]Hack, error)

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.

GetContestHacks is a wrapper around DefaultClient.GetContestHacks.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.hacks

type Member

type Member struct {
	Handle string `json:"handle"`
}

Member represents a member of a party.

Codeforces API docs: https://codeforces.com/apiHelp/objects#Member

type Party

type Party struct {
	ContestID        int      `json:"contestId,omitempty"`
	Members          []Member `json:"members"`
	ParticipantType  string   `json:"participantType"`
	TeamID           int      `json:"teamId,omitempty"`
	TeamName         string   `json:"teamName,omitempty"`
	Ghost            bool     `json:"ghost"`
	Room             int      `json:"room,omitempty"`
	StartTimeSeconds int      `json:"startTimeSeconds,omitempty"`
}

Party represents a party, participating in a contest.

Codeforces API docs: https://codeforces.com/apiHelp/objects#Party

type Problem

type Problem struct {
	ContestID      int      `json:"contestId,omitempty"`
	ProblemsetName string   `json:"problemsetName,omitempty"`
	Index          string   `json:"index"`
	Name           string   `json:"name"`
	Type           string   `json:"type"`
	Points         float64  `json:"points,omitempty"`
	Rating         int      `json:"rating,omitempty"`
	Tags           []string `json:"tags"`
}

Problem represents a problem.

Codeforces API docs: https://codeforces.com/apiHelp/objects#Problem

type ProblemResult

type ProblemResult struct {
	Points                    float64 `json:"points"`
	Penalty                   int     `json:"penalty"`
	RejectedAttemptCount      int     `json:"rejectedAttemptCount"`
	Type                      string  `json:"type"`
	BestSubmissionTimeSeconds int     `json:"bestSubmissionTimeSeconds"`
}

ProblemResult represents a submissions results of a party for a problem.

Codeforces API docs: https://codeforces.com/apiHelp/objects#ProblemResult

type ProblemStatistics

type ProblemStatistics struct {
	ContestID   int    `json:"contestId,omitempty"`
	Index       string `json:"index"`
	SolvedCount int    `json:"solvedCount"`
}

ProblemStatistics represents a statistic data about a problem.

Codeforces API docs: https://codeforces.com/apiHelp/objects#ProblemStatistics

type RanklistRow

type RanklistRow struct {
	Party                     Party           `json:"party"`
	Rank                      int             `json:"rank"`
	Points                    float64         `json:"points"`
	Penalty                   int             `json:"penalty"`
	SuccessfulHackCount       int             `json:"successfulHackCount"`
	UnsuccessfulHackCount     int             `json:"unsuccessfulHackCount"`
	ProblemResults            []ProblemResult `json:"problemResults"`
	LastSubmissionTimeSeconds int             `json:"lastSubmissionTimeSeconds,omitempty"`
}

RanklistRow represents a ranklist row.

Codeforces API docs: https://codeforces.com/apiHelp/objects#RanklistRow

type RatingChange

type RatingChange struct {
	ContestID               int    `json:"contestId"`
	ContestName             string `json:"contestName"`
	Handle                  string `json:"handle"`
	Rank                    int    `json:"rank"`
	RatingUpdateTimeSeconds int    `json:"ratingUpdateTimeSeconds"`
	OldRating               int    `json:"oldRating"`
	NewRating               int    `json:"newRating"`
}

RatingChange represents a participation of user in rated contest.

Codeforces API docs: https://codeforces.com/apiHelp/objects#RatingChange

func GetContestRatingChanges

func GetContestRatingChanges(contestID int) ([]RatingChange, error)

GetContestRatingChanges returns rating changes after the contest.

GetContestRatingChanges is a wrapper around DefaultClient.GetContestRatingChanges.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.ratingChanges

func GetUserRating

func GetUserRating(handle string) ([]RatingChange, error)

GetUserRating returns rating history of the specified user.

GetUserRating is a wrapper around DefaultClient.GetUserRating.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.rating

type RecentAction

type RecentAction struct {
	TimeSeconds int       `json:"timeSeconds"`
	BlogEntry   BlogEntry `json:"blogEntry"`
	Comment     Comment   `json:"comment"`
}

RecentAction represents a recent action.

Codeforces API docs: https://codeforces.com/apiHelp/objects#RecentAction

func GetRecentActions

func GetRecentActions(maxCount int) ([]RecentAction, error)

GetRecentActions returns recent actions.

GetRecentActions is a wrapper around DefaultClient.GetRecentActions.

Codeforces API docs: https://codeforces.com/apiHelp/methods#recentActions

type Submission

type Submission struct {
	ID                  int     `json:"id"`
	ContestID           int     `json:"contestId,omitempty"`
	CreationTimeSeconds int     `json:"creationTimeSeconds"`
	RelativeTimeSeconds int     `json:"relativeTimeSeconds"`
	Problem             Problem `json:"problem"`
	Author              Party   `json:"author"`
	ProgrammingLanguage string  `json:"programmingLanguage"`
	Verdict             string  `json:"verdict,omitempty"`
	Testset             string  `json:"testset"`
	PassedTestCount     int     `json:"passedTestCount"`
	TimeConsumedMillis  int     `json:"timeConsumedMillis"`
	MemoryConsumedBytes int     `json:"memoryConsumedBytes"`
}

Submission represents a submission.

Codeforces API docs: https://codeforces.com/apiHelp/objects#Submission

func GetContestStatus

func GetContestStatus(contestID int, handle string, from, count int) ([]Submission, error)

GetContestStatus returns submissions for specified contest. Optionally can return submissions of specified user.

Set handle to a empty string to get status for all handles. Set count to 0 for infinite count.

GetContestStatus is a wrapper around DefaultClient.GetContestStatus.

Codeforces API docs: https://codeforces.com/apiHelp/methods#contest.status

func GetProblemsetRecentStatus

func GetProblemsetRecentStatus(count int, problemsetName string) ([]Submission, error)

GetProblemsetRecentStatus returns recent submissions.

Leave problemsetName empty for default problemset.

GetProblemsetRecentStatus is a wrapper around DefaultClient.GetProblemsetRecentStatus.

Codeforces API docs: https://codeforces.com/apiHelp/methods#problemset.recentStatus

func GetUserStatus

func GetUserStatus(handle string, from, count int) ([]Submission, error)

GetUserStatus returns submissions of specified user.

Set count to 0 for infinite count.

GetUserStatus is a wrapper around DefaultClient.GetUserStatus.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.status

type User

type User struct {
	Handle                  string `json:"handle"`
	Email                   string `json:"email,omitempty"`
	VkID                    string `json:"vkId,omitempty"`
	OpenID                  string `json:"openId,omitempty"`
	FirstName               string `json:"firstName,omitempty"`
	LastName                string `json:"lastName,omitempty"`
	Country                 string `json:"country,omitempty"`
	City                    string `json:"city,omitempty"`
	Organization            string `json:"organization,omitempty"`
	Contribution            int    `json:"contribution"`
	Rank                    string `json:"rank"`
	Rating                  int    `json:"rating"`
	MaxRank                 string `json:"maxRank"`
	MaxRating               int    `json:"maxRating"`
	LastOnlineTimeSeconds   int    `json:"lastOnlineTimeSeconds"`
	RegistrationTimeSeconds int    `json:"registrationTimeSeconds"`
	FriendOfCount           int    `json:"friendOfCount"`
	Avatar                  string `json:"avatar"`
	TitlePhoto              string `json:"titlePhoto"`
}

User represents a Codeforces user.

Codeforces API docs: https://codeforces.com/apiHelp/objects#User

func GetUserInfo

func GetUserInfo(handles []string) ([]User, error)

GetUserInfo returns information about one or several users.

GetUserInfo is a wrapper around DefaultClient.GetUserInfo.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.info

func GetUserRatedList

func GetUserRatedList(activeOnly bool) ([]User, error)

GetUserRatedList returns the list users who have participated in at least one rated contest.

GetUserRatedList is a wrapper around DefaultClient.GetUserRatedList.

Codeforces API docs: https://codeforces.com/apiHelp/methods#user.ratedList

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL