Documentation ¶
Index ¶
- type Account
- type ApiRelTime
- type ApiTime
- func (a ApiTime) AddDuration(d ApiRelTime) ApiTime
- func (a ApiTime) After(b ApiTime) bool
- func (a ApiTime) Before(b ApiTime) bool
- func (a ApiTime) Equal(b ApiTime) bool
- func (a ApiTime) MarshalJSON() ([]byte, error)
- func (a ApiTime) String() string
- func (a ApiTime) Time() time.Time
- func (a *ApiTime) UnmarshalJSON(b []byte) (err error)
- type ApiType
- type Clarification
- type Contest
- type ContestApi
- type ContestsApi
- type Error
- type FileReference
- type Group
- type Identifier
- type Judgement
- type JudgementType
- type Language
- type LocalFileReference
- type Organization
- type Person
- type Problem
- type Row
- type Score
- type ScoreProblem
- type Scoreboard
- type State
- type Submission
- type Submittable
- type Team
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type ApiRelTime ¶
ApiRelTime is a time.Duration which marshals to and from the format used in the CCS Api
func (ApiRelTime) Duration ¶
func (a ApiRelTime) Duration() time.Duration
func (ApiRelTime) String ¶
func (a ApiRelTime) String() string
func (*ApiRelTime) UnmarshalJSON ¶
func (a *ApiRelTime) UnmarshalJSON(b []byte) (err error)
type ApiTime ¶
ApiTime is a time.Time which marshals to and from the format used in the CCS Api
func (ApiTime) AddDuration ¶
func (a ApiTime) AddDuration(d ApiRelTime) ApiTime
func (ApiTime) MarshalJSON ¶
func (*ApiTime) UnmarshalJSON ¶
type ApiType ¶
type ApiType interface { FromJSON([]byte) (ApiType, error) fmt.Stringer Path() string Generate() ApiType InContest() bool }
ApiType is an interface used for objects that interact with the API.
type Clarification ¶
type Clarification struct { Id string `json:"id,omitempty"` FromTeamId string `json:"from_team_id,omitempty"` ToTeamId string `json:"to_team_id,omitempty"` ReplyToId string `json:"reply_to_id,omitempty"` ProblemId string `json:"problem_id,omitempty"` Text string `json:"text"` Time *ApiTime `json:"time,omitempty"` ContestTime ApiRelTime `json:"contest_time,omitempty"` }
func (Clarification) Generate ¶
func (c Clarification) Generate() ApiType
func (Clarification) InContest ¶
func (c Clarification) InContest() bool
func (Clarification) Path ¶
func (c Clarification) Path() string
func (Clarification) String ¶
func (c Clarification) String() string
type Contest ¶
type Contest struct { Id string `json:"id"` Name string `json:"name"` FormalName string `json:"formal_name,omitempty"` StartTime ApiTime `json:"start_time"` Duration ApiRelTime `json:"duration"` ScoreboardFreezeDuration ApiRelTime `json:"scoreboard_freeze_duration,omitempty"` CountdownTime ApiRelTime `json:"countdown_pause_time,omitempty"` }
type ContestApi ¶
type ContestApi interface { ContestsApi Contest() (Contest, error) State() (State, error) JudgementTypes() ([]JudgementType, error) JudgementTypeById(judgementTypeId string) (JudgementType, error) Languages() ([]Language, error) LanguageById(languageId string) (Language, error) Problems() ([]Problem, error) ProblemById(problemId string) (Problem, error) Groups() ([]Group, error) GroupById(groupId string) (Group, error) Organizations() ([]Organization, error) OrganizationById(organizationId string) (Organization, error) Teams() ([]Team, error) TeamById(teamId string) (Team, error) Persons() ([]Person, error) PersonById(personId string) (Person, error) Accounts() ([]Account, error) AccountById(accountId string) (Account, error) Account() (Account, error) Submissions() ([]Submission, error) SubmissionById(submissionId string) (Submission, error) Judgements() ([]Judgement, error) JudgementById(judgementId string) (Judgement, error) Clarifications() ([]Clarification, error) ClarificationById(clarificationId string) (Clarification, error) Scoreboard() (Scoreboard, error) Submit(submittable Submittable) (ApiType, error) PostClarification(problemId, text string) (Clarification, error) PostSubmission(problemId, languageId, entrypoint string, files LocalFileReference) (Submission, error) GetObject(interactor ApiType, id string) (ApiType, error) GetObjects(interactor ApiType) ([]ApiType, error) }
func ContestInteractor ¶
func ContestInteractor(baseUrl, username, password, contestId string, insecure bool) (ContestApi, error)
type ContestsApi ¶
type ContestsApi interface { Contests() ([]Contest, error) ContestById(contestId string) (Contest, error) ToContest(cid string) (ContestApi, error) }
func ContestsInteractor ¶
func ContestsInteractor(baseUrl, username, password string, insecure bool) (ContestsApi, error)
type FileReference ¶
type FileReference struct { Href string `json:"href,omitempty"` Mime string `json:"mime,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` Data LocalFileReference `json:"data,omitempty"` }
type Group ¶
type Identifier ¶
type Identifier string
func (*Identifier) UnmarshalJSON ¶
func (i *Identifier) UnmarshalJSON(bts []byte) error
type Judgement ¶
type Judgement struct { Id string `json:"id"` SubmissionId string `json:"submission_id"` JudgementTypeId string `json:"judgement_type_id,omitempty"` StartTime *ApiTime `json:"start_time"` StartContestTime ApiRelTime `json:"start_contest_time"` EndTime *ApiTime `json:"end_time,omitempty"` EndContestTime ApiRelTime `json:"end_contest_time,omitempty"` MaxRunTime float32 `json:"max_run_time,omitempty"` }
type JudgementType ¶
type JudgementType struct { Id string `json:"id"` Name string `json:"name"` Penalty bool `json:"penalty,omitempty"` Solved bool `json:"solved"` }
func (JudgementType) Generate ¶
func (jt JudgementType) Generate() ApiType
func (JudgementType) InContest ¶
func (jt JudgementType) InContest() bool
func (JudgementType) Path ¶
func (jt JudgementType) Path() string
func (JudgementType) String ¶
func (jt JudgementType) String() string
type Language ¶
type LocalFileReference ¶
type LocalFileReference struct {
// contains filtered or unexported fields
}
func (*LocalFileReference) FromString ¶
func (r *LocalFileReference) FromString(filename, body string) error
func (LocalFileReference) MarshalJSON ¶
func (r LocalFileReference) MarshalJSON() ([]byte, error)
type Organization ¶
type Organization struct { Id string `json:"id"` ICPCId string `json:"icpc_id"` Name string `json:"name"` FormalName string `json:"formal_name"` Country string `json:"country"` URL string `json:"url"` TwitterHashtag string `json:"twitter_hashtag"` }
func (Organization) Generate ¶
func (o Organization) Generate() ApiType
func (Organization) InContest ¶
func (o Organization) InContest() bool
func (Organization) Path ¶
func (o Organization) Path() string
func (Organization) String ¶
func (o Organization) String() string
type Person ¶
type Problem ¶
type Row ¶
type Row struct { Rank int `json:"rank"` TeamId Identifier `json:"team_id"` Score Score `json:"score,omitempty"` Problems []ScoreProblem `json:"problems"` }
type Score ¶
type ScoreProblem ¶
type ScoreProblem struct { ProblemId Identifier `json:"problem_id"` NumJudged int `json:"num_judged"` NumPending int `json:"num_pending"` Solved bool `json:"solved"` Score float64 `json:"score,omitempty"` Time int `json:"time"` }
func (ScoreProblem) String ¶
func (s ScoreProblem) String() string
type Scoreboard ¶
type Scoreboard struct { EventId Identifier `json:"event_id"` Time ApiTime `json:"time"` ContestTime ApiRelTime `json:"contest_time"` State State `json:"state"` Rows []Row `json:"rows"` }
func (Scoreboard) Generate ¶
func (s Scoreboard) Generate() ApiType
func (Scoreboard) InContest ¶
func (s Scoreboard) InContest() bool
func (Scoreboard) Path ¶
func (s Scoreboard) Path() string
func (Scoreboard) String ¶
func (s Scoreboard) String() string
type State ¶
type Submission ¶
type Submission struct { Id string `json:"id,omitempty"` LanguageId string `json:"language_id"` Time *ApiTime `json:"time,omitempty"` ContestTime ApiRelTime `json:"contest_time,omitempty"` TeamId string `json:"team_id,omitempty"` ProblemId string `json:"problem_id,omitempty"` EntryPoint string `json:"entry_point,omitempty"` Files []FileReference `json:"files,omitempty"` }
func (Submission) Generate ¶
func (s Submission) Generate() ApiType
func (Submission) InContest ¶
func (s Submission) InContest() bool
func (Submission) Path ¶
func (s Submission) Path() string
func (Submission) String ¶
func (s Submission) String() string
type Submittable ¶
type Submittable interface { ApiType }
Submittable is an ApiType that can be submitted to the API. TODO decide on whether to merge the interfaces
Click to show internal directories.
Click to hide internal directories.