client

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompleteRanklistTask

func CompleteRanklistTask(ctx context.Context, req *CompleteRanklistTaskRequest) error

func CompleteSolutionTask

func CompleteSolutionTask(ctx context.Context) error

func GetDefaultHTTPClient

func GetDefaultHTTPClient() *resty.Client

func GetSolutionTaskDetailsUrl

func GetSolutionTaskDetailsUrl(ctx context.Context, urlType string) (string, error)

func InitFromConfig

func InitFromConfig()

func LoadRanklistCtx

func LoadRanklistCtx(ctx context.Context) (string, string)

func LoadSolutionTask

func LoadSolutionTask(ctx context.Context) (solutionId string, taskId string)

func PatchSolutionTask

func PatchSolutionTask(ctx context.Context, req *common.SolutionInfo) error

func SaveRanklist

func SaveRanklist(ctx context.Context, ranklist map[string]*Ranklist) error

func SaveSolutionDetails

func SaveSolutionDetails(ctx context.Context, details *common.SolutionDetails) error

func WithRanklistTask

func WithRanklistTask(ctx context.Context, taskId, contestId string) context.Context

func WithSolutionTask

func WithSolutionTask(ctx context.Context, solutionId string, taskId string) context.Context

Types

type APIError

type APIError struct {
	Message    string `json:"message"`
	ErrorName  string `json:"error"`
	StatusCode int    `json:"statusCode"`
}

func (*APIError) Error

func (e *APIError) Error() string

type CompleteRanklistTaskRequest

type CompleteRanklistTaskRequest struct {
	RanklistUpdatedAt int `json:"ranklistUpdatedAt"`
}

type GetRanklistParticipantsResponse

type GetRanklistParticipantsResponse []struct {
	Id        string   `json:"_id" bson:"_id"`
	UserId    string   `json:"userId" bson:"userId"`
	ContestId string   `json:"contestId" bson:"contestId"`
	Tags      []string `json:"tags" bson:"tags"`
	Results   map[string]struct {
		SolutionCount  int    `json:"solutionCount" bson:"solutionCount"`
		LastSolutionId string `json:"lastSolutionId" bson:"lastSolutionId"`
		LastSolution   struct {
			Score       float64 `json:"score" bson:"score"`
			Status      string  `json:"status" bson:"status"`
			CompletedAt int     `json:"completedAt" bson:"completedAt"`
		} `json:"lastSolution" bson:"lastSolution"`
	} `json:"results" bson:"results"`
	UpdatedAt int `json:"updatedAt" bson:"updatedAt"`
}

func GetRanklistParticipants

func GetRanklistParticipants(ctx context.Context, since int, lastId string) (*GetRanklistParticipantsResponse, error)

type GetRanklistProblemsResponse

type GetRanklistProblemsResponse []struct {
	Id       string   `json:"_id"`
	Title    string   `json:"title"`
	Tags     []string `json:"tags"`
	Settings struct {
		Score              float64 `json:"score"`
		Slug               string  `json:"slug"`
		SolutionCountLimit int     `json:"solutionCountLimit"`
		ShowAfter          int     `json:"showAfter"`
	} `json:"settings"`
}

func GetRanklistProblems

func GetRanklistProblems(ctx context.Context) (*GetRanklistProblemsResponse, error)

type GetRanklistSolutionsResponse

type GetRanklistSolutionsResponse []struct {
	Id               string             `json:"_id"`
	OrgId            string             `json:"orgId"`
	ProblemId        string             `json:"problemId"`
	ContestId        string             `json:"contestId"`
	UserId           string             `json:"userId"`
	ProblemDataHash  string             `json:"problemDataHash"`
	State            int                `json:"state"`
	SolutionDataHash string             `json:"solutionDataHash"`
	Score            float64            `json:"score"`
	Metrics          map[string]float64 `json:"metrics"`
	Status           string             `json:"status"`
	Message          string             `json:"message"`
	RunnerId         string             `json:"runnerId"`
	CreatedAt        int                `json:"createdAt"`
	SubmittedAt      int                `json:"submittedAt"`
	CompletedAt      int                `json:"completedAt"`
}

func GetRanklistSolutions

func GetRanklistSolutions(ctx context.Context, since int, lastId string) (*GetRanklistSolutionsResponse, error)

type GetRanklistUploadUrlsResponse

type GetRanklistUploadUrlsResponse = []struct {
	Key string `json:"key"`
	Url string `json:"url"`
}

func GetRanklistUploadUrls

func GetRanklistUploadUrls(ctx context.Context) (*GetRanklistUploadUrlsResponse, error)

type PollRanklistRequest

type PollRanklistRequest struct {
}

type PollRanklistResponse

type PollRanklistResponse struct {
	TaskId            string        `json:"taskId"`
	ContestId         string        `json:"contestId"`
	Ranklists         []RanklistDTO `json:"ranklists"`
	RanklistUpdatedAt int           `json:"ranklistUpdatedAt"`
}

type PollSolutionRequest

type PollSolutionRequest struct {
}

type PollSolutionResponse

type PollSolutionResponse struct {
	TaskId           string               `json:"taskId"`
	SolutionId       string               `json:"solutionId"`
	UserId           string               `json:"userId"`
	ContestId        string               `json:"contestId"`
	ProblemConfig    common.ProblemConfig `json:"problemConfig"`
	ProblemDataUrl   string               `json:"problemDataUrl"`
	ProblemDataHash  string               `json:"problemDataHash"`
	SolutionDataUrl  string               `json:"solutionDataUrl"`
	SolutionDataHash string               `json:"solutionDataHash"`
	ErrMsg           string               `json:"errMsg"`
}

type Ranklist

type Ranklist struct {
	Topstar     *RanklistTopstar     `json:"topstar,omitempty"`
	Participant *RanklistParticipant `json:"participant"`
	Metadata    *RanklistMetadata    `json:"metadata"`
}

type RanklistDTO

type RanklistDTO struct {
	Key      string           `json:"key"`
	Name     string           `json:"name"`
	Settings RanklistSettings `json:"settings"`
}

type RanklistMetadata

type RanklistMetadata struct {
	GeneratedAt int    `json:"generatedAt"`
	Description string `json:"description"`
}

type RanklistParticipant

type RanklistParticipant struct {
	Columns []*RanklistParticipantColumn `json:"columns"`
	List    []*RanklistParticipantItem   `json:"list"`
}

type RanklistParticipantColumn

type RanklistParticipantColumn struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type RanklistParticipantItem

type RanklistParticipantItem struct {
	Rank    int                              `json:"rank"`
	UserId  string                           `json:"userId"`
	Tags    []string                         `json:"tags"`
	Columns []*RanklistParticipantItemColumn `json:"columns"`
}

type RanklistParticipantItemColumn

type RanklistParticipantItemColumn struct {
	Content string `json:"content"`
}

type RanklistSettings

type RanklistSettings struct {
	ShowAfter  int    `json:"showAfter"`
	ShowBefore int    `json:"showBefore"`
	Config     string `json:"config"`
}

type RanklistTopstar

type RanklistTopstar struct {
	List []*RanklistTopstarItem `json:"list"`
}

type RanklistTopstarItem

type RanklistTopstarItem struct {
	UserId    string                         `json:"userId"`
	Mutations []*RanklistTopstarItemMutation `json:"mutations"`
}

type RanklistTopstarItemMutation

type RanklistTopstarItemMutation struct {
	Score float64 `json:"score"`
	Ts    int     `json:"ts"`
}

type RegisterRequest

type RegisterRequest struct {
	Name              string   `json:"name"`
	Labels            []string `json:"labels"`
	Version           string   `json:"version"`
	RegistrationToken string   `json:"registrationToken"`
}

type RegisterResponse

type RegisterResponse struct {
	RunnerId  string `json:"runnerId"`
	RunnerKey string `json:"runnerKey"`
}

func Register

func Register(ctx context.Context, req *RegisterRequest) (*RegisterResponse, error)

type UrlResponse

type UrlResponse struct {
	Url string `json:"url"`
}

Jump to

Keyboard shortcuts

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