Documentation
¶
Index ¶
- type Client
- func (c *Client) CreateCompiler(ctx context.Context, form CreateCompilerForm) (Compiler, error)
- func (c *Client) CreateContestParticipant(ctx context.Context, contest int64, form CreateContestParticipantForm) (ContestParticipant, error)
- func (c *Client) CreateProblem(ctx context.Context, form CreateProblemForm) (Problem, error)
- func (c *Client) CreateRole(ctx context.Context, name string) (Role, error)
- func (c *Client) CreateSetting(ctx context.Context, form CreateSettingForm) (Setting, error)
- func (c *Client) CreateUserRole(ctx context.Context, login string, role string) (Role, error)
- func (c *Client) DeleteCompiler(ctx context.Context, id int64) (Compiler, error)
- func (c *Client) DeleteProblem(ctx context.Context, id int64) (Problem, error)
- func (c *Client) DeleteRole(ctx context.Context, name any) (Role, error)
- func (c *Client) DeleteUserRole(ctx context.Context, login string, role string) (Role, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) Locale(ctx context.Context) (Locale, error)
- func (c *Client) Login(ctx context.Context, login, password string) (Session, error)
- func (c *Client) Logout(ctx context.Context) error
- func (c *Client) ObserveCompilers(ctx context.Context) (Compilers, error)
- func (c *Client) ObserveContest(ctx context.Context, id int64) (Contest, error)
- func (c *Client) ObserveContestSolution(ctx context.Context, id int64, solutionID int64) (ContestSolution, error)
- func (c *Client) ObserveContestSolutions(ctx context.Context, id int64) (ContestSolutions, error)
- func (c *Client) ObserveContestStandings(ctx context.Context, id int64) (ContestStandings, error)
- func (c *Client) ObserveRoles(ctx context.Context) (Roles, error)
- func (c *Client) ObserveScopeUsers(ctx context.Context, scope int64) (ScopeUsers, error)
- func (c *Client) ObserveSettings(ctx context.Context) (Settings, error)
- func (c *Client) ObserveUserRoles(ctx context.Context, login string) (Roles, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Register(ctx context.Context, form RegisterUserForm) (User, error)
- func (c *Client) SubmitContestSolution(ctx context.Context, contest int64, problem string, form SubmitSolutionForm) (ContestSolution, error)
- func (c *Client) UpdateCompiler(ctx context.Context, id int64, form UpdateCompilerForm) (Compiler, error)
- func (c *Client) UpdateProblem(ctx context.Context, id int64, form UpdateProblemForm) (Problem, error)
- func (c *Client) UpdateSetting(ctx context.Context, id int64, form UpdateSettingForm) (Setting, error)
- type ClientOption
- type Compiler
- type Compilers
- type Contest
- type ContestMessage
- type ContestMessages
- type ContestParticipant
- type ContestParticipants
- type ContestProblem
- type ContestProblems
- type ContestSolution
- type ContestSolutions
- type ContestStandings
- type ContestStandingsCell
- type ContestStandingsColumn
- type ContestStandingsRow
- type ContestState
- type Contests
- type CreateCompilerForm
- type CreateContestMessageForm
- type CreateContestParticipantForm
- type CreateProblemForm
- type CreateSettingForm
- type FileReader
- type JSON
- type Locale
- type Localization
- type NInt64
- type NString
- type ObserveContestStandingsForm
- type Problem
- type ProblemStatement
- type ProblemTask
- type Problems
- type RebuildProblemForm
- type RegisterUserForm
- type Role
- type Roles
- type Scope
- type ScopeUser
- type ScopeUsers
- type Scopes
- type Session
- type Sessions
- type Setting
- type Settings
- type Solution
- type SolutionReport
- type Solutions
- type Status
- type SubmitContestQuestionForm
- type SubmitSolutionForm
- type TestReport
- type UpdateCompilerForm
- type UpdateProblemForm
- type UpdateSettingForm
- type User
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewClient ¶
func NewClient(endpoint string, options ...ClientOption) *Client
NewClient returns new API client.
func (*Client) CreateCompiler ¶
func (*Client) CreateContestParticipant ¶ added in v0.1.3
func (c *Client) CreateContestParticipant( ctx context.Context, contest int64, form CreateContestParticipantForm, ) (ContestParticipant, error)
func (*Client) CreateProblem ¶
func (*Client) CreateRole ¶
func (*Client) CreateSetting ¶ added in v0.1.2
func (*Client) CreateUserRole ¶
func (*Client) DeleteCompiler ¶
func (*Client) DeleteProblem ¶
func (*Client) DeleteRole ¶
func (*Client) DeleteUserRole ¶
func (*Client) ObserveCompilers ¶
func (*Client) ObserveContest ¶
func (*Client) ObserveContestSolution ¶ added in v0.1.3
func (*Client) ObserveContestSolutions ¶ added in v0.1.3
func (*Client) ObserveContestStandings ¶ added in v0.1.8
func (*Client) ObserveScopeUsers ¶ added in v0.1.3
func (*Client) ObserveSettings ¶
func (*Client) ObserveUserRoles ¶
func (*Client) SubmitContestSolution ¶
func (c *Client) SubmitContestSolution( ctx context.Context, contest int64, problem string, form SubmitSolutionForm, ) (ContestSolution, error)
func (*Client) UpdateCompiler ¶
func (*Client) UpdateProblem ¶
func (*Client) UpdateSetting ¶ added in v0.1.2
type ClientOption ¶
type ClientOption func(*Client)
func WithSessionCookie ¶
func WithSessionCookie(value string) ClientOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
func WithTransport ¶
func WithTransport(transport *http.Transport) ClientOption
type Contest ¶
type Contest struct {
ID int64 `json:"id"`
Title string `json:"title"`
BeginTime NInt64 `json:"begin_time,omitempty"`
Duration int `json:"duration,omitempty"`
Permissions []string `json:"permissions,omitempty"`
EnableRegistration bool `json:"enable_registration"`
EnableUpsolving bool `json:"enable_upsolving"`
EnableObserving bool `json:"enable_observing,omitempty"`
FreezeBeginDuration int `json:"freeze_begin_duration,omitempty"`
FreezeEndTime NInt64 `json:"freeze_end_time,omitempty"`
StandingsKind models.StandingsKind `json:"standings_kind,omitempty"`
State *ContestState `json:"state,omitempty"`
}
type ContestMessage ¶
type ContestMessages ¶
type ContestMessages struct {
Messages []ContestMessage `json:"messages"`
}
type ContestParticipant ¶
type ContestParticipants ¶
type ContestParticipants struct {
Participants []ContestParticipant `json:"participants"`
}
type ContestProblem ¶
type ContestProblems ¶
type ContestProblems struct {
Problems []ContestProblem `json:"problems"`
}
type ContestSolution ¶
type ContestSolution struct {
ID int64 `json:"id"`
ContestID int64 `json:"contest_id"`
Problem *ContestProblem `json:"problem,omitempty"`
Compiler *Compiler `json:"compiler,omitempty"`
Participant *ContestParticipant `json:"participant,omitempty"`
Content string `json:"content,omitempty"`
Report *SolutionReport `json:"report"`
CreateTime int64 `json:"create_time"`
}
type ContestSolutions ¶
type ContestSolutions struct {
Solutions []ContestSolution `json:"solutions"`
}
ContestSolutions represents contest solutions response.
type ContestStandings ¶
type ContestStandings struct {
Kind string `json:"kind"`
Columns []ContestStandingsColumn `json:"columns,omitempty"`
Rows []ContestStandingsRow `json:"rows,omitempty"`
Frozen bool `json:"frozen,omitempty"`
}
type ContestStandingsCell ¶
type ContestStandingsColumn ¶
type ContestStandingsRow ¶
type ContestStandingsRow struct {
Participant ContestParticipant `json:"participant,omitempty"`
Score float64 `json:"score"`
Penalty *int64 `json:"penalty,omitempty"`
Place int `json:"place,omitempty"`
Cells []ContestStandingsCell `json:"cells,omitempty"`
}
type ContestState ¶
type ContestState struct {
Stage string `json:"stage"`
// Participant contains effective participant.
Participant *ContestParticipant `json:"participant,omitempty"`
}
type CreateCompilerForm ¶
type CreateCompilerForm struct {
UpdateCompilerForm
}
type CreateContestMessageForm ¶
type CreateContestMessageForm struct {
Title string `json:"title"`
Description string `json:"description"`
ParentID *int64 `json:"parent_id"`
}
func (*CreateContestMessageForm) Update ¶
func (f *CreateContestMessageForm) Update( c echo.Context, o *models.ContestMessage, messages models.ContestMessageStore, ) error
type CreateContestParticipantForm ¶ added in v0.1.3
type CreateContestParticipantForm struct {
UserID *int64 `json:"user_id"`
UserLogin *string `json:"user_login"`
ScopeUserID *int64 `json:"scope_user_id"`
Kind models.ParticipantKind `json:"kind"`
}
func (CreateContestParticipantForm) Update ¶ added in v0.1.3
func (f CreateContestParticipantForm) Update( c echo.Context, participant *models.ContestParticipant, core *core.Core, ) *errorResponse
type CreateProblemForm ¶
type CreateProblemForm struct {
UpdateProblemForm
}
type CreateSettingForm ¶ added in v0.1.2
type CreateSettingForm struct {
UpdateSettingForm
}
type FileReader ¶
type FileReader = managers.FileReader
type JSON ¶
func (*JSON) UnmarshalParam ¶
type Locale ¶
type Locale struct {
Name string `json:"name,omitempty"`
Localizations []Localization `json:"localizations,omitempty"`
}
type Localization ¶
type ObserveContestStandingsForm ¶ added in v0.1.3
type Problem ¶
type Problem struct {
ID int64 `json:"id"`
Title string `json:"title"`
Statement *ProblemStatement `json:"statement,omitempty"`
Config *models.ProblemConfig `json:"config,omitempty"`
Permissions []string `json:"permissions,omitempty"`
LastTask *ProblemTask `json:"last_task,omitempty"`
}
type ProblemStatement ¶
type ProblemStatement = models.ProblemStatementConfig
type ProblemTask ¶ added in v0.1.2
type RebuildProblemForm ¶
type RebuildProblemForm struct {
Compile bool `json:"compile"`
}
type RegisterUserForm ¶
type RegisterUserForm struct {
Login string `json:"login" form:"login"`
Email string `json:"email" form:"email"`
Password string `json:"password" form:"password"`
FirstName string `json:"first_name" form:"first_name"`
LastName string `json:"last_name" form:"last_name"`
MiddleName string `json:"middle_name" form:"middle_name"`
}
RegisterUserForm represents form for register new user.
type Role ¶
type Role struct {
// ID contains role ID.
ID int64 `json:"id"`
// Name contains role name.
Name string `json:"name"`
//
BuiltIn bool `json:"built_in,omitempty"`
}
Role represents role.
type ScopeUsers ¶
type ScopeUsers struct {
Users []ScopeUser `json:"users"`
}
type Session ¶
type Session struct {
// ID contains session ID.
ID int64 `json:"id"`
// CreateTime contains session create time.
CreateTime int64 `json:"create_time,omitempty"`
// ExpireTime contains session expire time.
ExpireTime int64 `json:"expire_time,omitempty"`
}
Session represents session.
type Sessions ¶
type Sessions struct {
Sessions []Session `json:"sessions"`
}
Sessions represents sessions response.
type Solution ¶
type Solution struct {
ID int64 `json:"id"`
Problem *Problem `json:"problem"`
Compiler *Compiler `json:"compiler"`
User *User `json:"user,omitempty"`
ScopeUser *ScopeUser `json:"scope_user,omitempty"`
Content string `json:"content,omitempty"`
Report *SolutionReport `json:"report"`
CreateTime int64 `json:"create_time"`
}
type SolutionReport ¶
type SolutionReport struct {
Verdict string `json:"verdict"`
Points *float64 `json:"points,omitempty"`
UsedTime int64 `json:"used_time,omitempty"`
UsedMemory int64 `json:"used_memory,omitempty"`
Tests []TestReport `json:"tests,omitempty"`
TestNumber int `json:"test_number,omitempty"`
CompileLog string `json:"compile_log,omitempty"`
}
type Status ¶
type Status struct {
User *User `json:"user,omitempty"`
ScopeUser *ScopeUser `json:"scope_user,omitempty"`
Session *Session `json:"session,omitempty"`
Permissions []string `json:"permissions"`
Locale string `json:"locale,omitempty"`
}
Status represents current authorization status.
type SubmitContestQuestionForm ¶
type SubmitContestQuestionForm struct {
Title string `json:"title"`
Description string `json:"description"`
}
func (SubmitContestQuestionForm) Update ¶
func (f SubmitContestQuestionForm) Update( c echo.Context, o *models.ContestMessage, ) error
type SubmitSolutionForm ¶
type SubmitSolutionForm struct {
CompilerID int64 `form:"compiler_id" json:"compiler_id"`
Content *string `form:"content" json:"content,omitempty"`
// ContentFile will be initialized with the content if it is provided.
ContentFile *FileReader `json:"-"`
}
func (*SubmitSolutionForm) Parse ¶
func (f *SubmitSolutionForm) Parse(c echo.Context) error
type TestReport ¶
type UpdateCompilerForm ¶
type UpdateCompilerForm struct {
Name *string `form:"name" json:"name"`
Config JSON `form:"config" json:"config"`
ImageFile *FileReader `json:"-"`
}
func (*UpdateCompilerForm) Close ¶
func (f *UpdateCompilerForm) Close() error
func (*UpdateCompilerForm) Parse ¶
func (f *UpdateCompilerForm) Parse(c echo.Context) error
type UpdateProblemForm ¶
type UpdateProblemForm struct {
Title *string `json:"title" form:"title"`
PackageFile *FileReader `json:"-"`
}
func (*UpdateProblemForm) Close ¶
func (f *UpdateProblemForm) Close() error
func (*UpdateProblemForm) Parse ¶
func (f *UpdateProblemForm) Parse(c echo.Context) error
type UpdateSettingForm ¶ added in v0.1.2
type User ¶
type User struct {
// ID contains user ID.
ID int64 `json:"id"`
// Login contains user login.
Login string `json:"login"`
// Email contains user email.
Email string `json:"email,omitempty"`
// FirstName contains first name.
FirstName string `json:"first_name,omitempty"`
// LastName contains last name.
LastName string `json:"last_name,omitempty"`
// MiddleName contains middle name.
MiddleName string `json:"middle_name,omitempty"`
}
User represents user.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View represents API view.
func (*View) ObserveCompilers ¶
ObserveCompilers returns list of available compilers.
func (*View) Register ¶
func (v *View) Register(g *echo.Group)
Register registers handlers in specified group.
func (*View) RegisterSocket ¶
func (v *View) RegisterSocket(g *echo.Group)
func (*View) StartDaemons ¶
func (v *View) StartDaemons()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.