webgrade

package
v0.0.0-...-c70ea3d Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownGraders = map[string]Grader{
	"C":       {ID: 1, Name: "C"},
	"OS":      {ID: 2, Name: "OS"},
	"C++":     {ID: 3, Name: "C++"},
	"Pascal":  {ID: 5, Name: "Pascal"},
	"Haskell": {ID: 6, Name: "Haskell"},
	"Python":  {ID: 7, Name: "Python"},
	"Java":    {ID: 8, Name: "Java"},
}

Functions

This section is empty.

Types

type Grader

type Grader struct {
	ID   int
	Name string
}

type ProblemData

type ProblemData struct {
	CourseID  int
	TopicID   int
	ProblemID int
}

type ProblemDetailsResult

type ProblemDetailsResult struct {
	BreadcrumbData struct {
		Course struct {
			Name string `json:"name"`
		} `json:"course"`
		Topic   string `json:"topic"`
		Problem struct {
			Name string `json:"name"`
		} `json:"problem"`
	} `json:"breadcrumbData"`
	AuthData struct {
		Username   string `json:"username"`
		UserID     int    `json:"userId"`
		Email      string `json:"email"`
		RoleName   string `json:"roleName"`
		IsVerified int    `json:"isVerified"`
	} `json:"authData"`
	ProblemSubmissions []struct {
		Score           int         `json:"score"`
		Timestamp       string      `json:"timestamp"`
		RequestedReview int         `json:"requestedReview"`
		RequestText     interface{} `json:"requestText"`
		SourceFile      string      `json:"sourceFile"`
		CodeReview      interface{} `json:"codeReview"`
		Reviewer        interface{} `json:"reviewer"`
		SubmissionID    int         `json:"submissionId"`
		ReviewerAvatar  interface{} `json:"reviewerAvatar"`
		ReviewerID      interface{} `json:"reviewerId"`
		SeenReview      interface{} `json:"seenReview"`
		Extension       string      `json:"extension"`
	} `json:"problemSubmissions"`
	ProblemDetails struct {
		ProblemDetails struct {
			Name                string      `json:"name"`
			Text                string      `json:"text"`
			TimeLimit           int         `json:"timeLimit"`
			MemoryLimit         int         `json:"memoryLimit"`
			TestCasesNum        int         `json:"testCasesNum"`
			TemplateFileContent interface{} `json:"templateFileContent"`
		} `json:"problemDetails"`
		Graders []struct {
			ID   int    `json:"id"`
			Name string `json:"name"`
		} `json:"graders"`
	} `json:"problemDetails"`
	Professors []struct {
		IDUser    int    `json:"idUser"`
		Avatar    string `json:"avatar"`
		FirstName string `json:"firstName"`
		LastName  string `json:"lastName"`
	} `json:"professors"`
	Reports         []interface{} `json:"reports"`
	CanSubmitReport bool          `json:"canSubmitReport"`
	CompanyData     interface{}   `json:"companyData"`
}

type SubmissionDetailsResponse

type SubmissionDetailsResponse struct {
	Score           string      `json:"score"`
	Timestamp       string      `json:"timestamp"`
	RequestedReview string      `json:"requestedReview"`
	RequestText     interface{} `json:"requestText"`
	SourceFile      string      `json:"sourceFile"`
	CodeReview      interface{} `json:"codeReview"`
	Reviewer        interface{} `json:"reviewer"`
	SubmissionID    string      `json:"submissionId"`
	ReviewerAvatar  interface{} `json:"reviewerAvatar"`
	ReviewerID      interface{} `json:"reviewerId"`
	SeenReview      string      `json:"seenReview"`
	Extension       string      `json:"extension"`
}

type SubmissionRequest

type SubmissionRequest struct {
	GraderID   int
	ProblemID  int
	GraderName string
	FileName   string
}

type SubmissionResponse

type SubmissionResponse struct {
	GraderTaskID string `json:"graderTaskId"`
	SubmissionID string `json:"submissionId"`
}

type TaskStatusResponse

type TaskStatusResponse struct {
	State string `json:"state"`
	Tests []struct {
		Status   string `json:"status"`
		Code     int    `json:"code"`
		Output   int    `json:"output"`
		Time     int    `json:"time"`
		WallTime int    `json:"wall_time"`
		Memory   int    `json:"memory"`
	} `json:"tests,omitempty"`
}

type WebGradeClient

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

func NewWebGradeClientLogin

func NewWebGradeClientLogin(username, password string) (*WebGradeClient, error)

func (WebGradeClient) GetProblemDetails

func (w WebGradeClient) GetProblemDetails(problem ProblemData) (ProblemDetailsResult, error)

func (WebGradeClient) GetSubmissionDetails

func (w WebGradeClient) GetSubmissionDetails(submissionId string) (SubmissionDetailsResponse, error)

func (WebGradeClient) GetTaskDetails

func (w WebGradeClient) GetTaskDetails(submission SubmissionResponse) (TaskStatusResponse, error)

func (WebGradeClient) Logout

func (w WebGradeClient) Logout() error

func (WebGradeClient) SubmitCode

func (w WebGradeClient) SubmitCode(requestData SubmissionRequest, source io.Reader) (SubmissionResponse, error)

Jump to

Keyboard shortcuts

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