response

package
v0.0.0-...-5c5c951 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

README

API

Common return codes.

message 结果
SUCCESS 正常
INTERNAL_ERROR 服务器内部错误
VALIDATION_ERROR 验证错误, 详见error字段
NOT_FOUND 找不到指定对象

Authentication

message 结果
AUTH_SESSION_EXPIRED session超时
AUTH_NEED_TOKEN 未提供token
AUTH_NEED_EMAIL_VERIFICATION 邮箱未验证

Permission

message 结果
PERMISSION_DENIED 没有权限

Auth

Login
message 结果
WRONG_USERNAME 错误的用户名/邮箱
WRONG_PASSWORD 密码错误
Register
message 结果
CONFLICT_EMAIL 邮箱重复
CONFLICT_USERNAME 用户名重复
EmailRegistered
message 结果
EMAIL_REGISTERED 邮箱已注册

Admin

Log
AdminGetLogs
message 结果
INVALID_LEVEL 非法的level
User
AdminCreateUser
message 结果
CONFLICT_EMAIL 邮箱重复
CONFLICT_USERNAME 用户名重复
AdminUpdateUser
message 结果
CONFLICT_EMAIL 邮箱重复
CONFLICT_USERNAME 用户名重复
AdminDeleteUser
AdminGetUser
AdminGetUsers
message 结果
INVALID_ORDER 无效的排序设置

User

GetMe
UpdateMe
message 结果
CONFLICT_EMAIL 邮箱重复
CONFLICT_USERNAME 用户名重复
GetUser
GetUsers
message 结果
INVALID_ORDER 无效的排序设置
ChangePassword
message 结果
WRONG_PASSWORD 密码错误

Problem

CreateProblem
GetProblem
GetRandomProblem
GetProblemAttachmentFile
GetProblems
message 结果
INVALID_STATUS 无效的状态设置
UpdateProblem
DeleteProblem
CreateTestCase
message 结果
INVALID_FILE 缺少文件
UpdateTestCase
DeleteTestCase
DeleteTestCases
GetTestCaseInputFile
GetTestCaseOutputFile

Image

CreateImage
code 结果
ILLEGAL_TYPE 类型非法

Submission

CreateSubmission
message 结果
INVALID_LANGUAGE 无效的语言
INVALID_FILE 缺少文件
GetSubmission
GetSubmissions
GetSubmissionCode
GetRunOutput
message 结果
SUBMISSION_NOT_FOUND 无法找到submission
JUDGEMENT_UNFINISHED 评测未完成
GetRunCompilerOutput
message 结果
SUBMISSION_NOT_FOUND 无法找到submission
JUDGEMENT_UNFINISHED 评测未完成
GetRunComparerOutput
message 结果
SUBMISSION_NOT_FOUND 无法找到submission
JUDGEMENT_UNFINISHED 评测未完成

Judger

UpdateRun

message 结果
WRONG_RUN_ID 发起请求的judger与获取道当前run的judger不同
ALREADY_SUBMITTED 一个run被提交了两次结果

Class

CreateClass
GetClass
GetClassesIManage
GetClassesITake
UpdateClass
RefreshInviteCode
AddStudents
DeleteStudents
JoinClass
message 结果
WRONG_INVITE_CODE 错误的邀请码
ALREADY_IN_CLASS 用户已是该class学生
DeleteClass

ProblemSet

CreateProblemSet
CloneProblemSet
GetProblemSet
UpdateProblemSet
AddProblemsToSet
DeleteProblemsFromSet
DeleteProblemSet
GetProblemSetProblem
GetProblemSetProblemInputFile
GetProblemSetProblemOutputFile
RefreshGrades

ProblemSetSubmission

ProblemSetCreateSubmission
message 结果
INVALID_LANGUAGE 无效的语言
INVALID_FILE 缺少文件
ProblemSetGetSubmission
ProblemSetGetSubmissions
ProblemSetGetSubmissionCode
ProblemSetGetRunOutput
message 结果
JUDGEMENT_UNFINISHED 评测未完成
ProblemSetGetRunInput
ProblemSetGetRunCompilerOutput
message 结果
JUDGEMENT_UNFINISHED 评测未完成
ProblemSetGetRunComparerOutput
message 结果
JUDGEMENT_UNFINISHED 评测未完成

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InternalErrorResp

func InternalErrorResp(c echo.Context) error

Types

type AddProblemsToSetResponse

type AddProblemsToSetResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetDetail `json:"problem_set"`
	} `json:"data"`
}

type AddStudentsResponse

type AddStudentsResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ClassDetail `json:"class"`
	} `json:"data"`
}

type AdminCreateUserResponse

type AdminCreateUserResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.UserForAdmin `json:"user"`
	} `json:"data"`
}

type AdminGetLogsResponse

type AdminGetLogsResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Logs   []log.Log `json:"logs"`
		Total  int       `json:"total"`
		Count  int       `json:"count"`
		Offset int       `json:"offset"`
		Prev   *string   `json:"prev"`
		Next   *string   `json:"next"`
	} `json:"data"`
}

type AdminGetUserResponse

type AdminGetUserResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.UserForAdmin `json:"user"`
	} `json:"data"`
}

type AdminGetUsersResponse

type AdminGetUsersResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Users  []resource.User `json:"users"`
		Total  int             `json:"total"`
		Count  int             `json:"count"`
		Offset int             `json:"offset"`
		Prev   *string         `json:"prev"`
		Next   *string         `json:"next"`
	} `json:"data"`
}

type AdminUpdateUserResponse

type AdminUpdateUserResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.UserForAdmin `json:"user"`
	} `json:"data"`
}

type CloneProblemSetResponse

type CloneProblemSetResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetDetail `json:"problem_set"`
	} `json:"data"`
}

type CreateClassResponse

type CreateClassResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ClassDetail `json:"class"`
	} `json:"data"`
}

type CreateImageResponse

type CreateImageResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		FilePath string `json:"filename"`
	} `json:"data"`
}

type CreateProblemResponse

type CreateProblemResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemForAdmin `json:"problem"`
	} `json:"data"`
}

type CreateProblemSetResponse

type CreateProblemSetResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetDetail `json:"problem_set"`
	} `json:"data"`
}

type CreateSubmissionResponse

type CreateSubmissionResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.SubmissionDetail `json:"submission"`
	} `json:"data"`
}

type CreateTestCaseResponse

type CreateTestCaseResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.TestCaseForAdmin `json:"test_case"`
	} `json:"data"`
}

type DeleteProblemsFromSetResponse

type DeleteProblemsFromSetResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetDetail `json:"problem_set"`
	} `json:"data"`
}

type DeleteStudentsResponse

type DeleteStudentsResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ClassDetail `json:"class"`
	} `json:"data"`
}

type EmailVerificationResponse

type EmailVerificationResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    interface{} `json:"data"`
}

type GetClassResponse

type GetClassResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.Class `json:"class"`
	} `json:"data"`
}

type GetClassResponseForAdmin

type GetClassResponseForAdmin struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ClassDetail `json:"class"`
	} `json:"data"`
}

type GetClassesIManageResponse

type GetClassesIManageResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Classes []resource.Class `json:"classes"`
	} `json:"data"`
}

type GetClassesITakeResponse

type GetClassesITakeResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Classes []resource.Class `json:"classes"`
	} `json:"data"`
}

type GetGradesResponse

type GetGradesResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetWithGrades `json:"problem_set"`
	} `json:"data"`
}

type GetMeResponse

type GetMeResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.UserForAdmin `json:"user"`
	} `json:"data"`
}

type GetProblemResponse

type GetProblemResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.Problem `json:"problem"`
	} `json:"data"`
}

type GetProblemResponseForAdmin

type GetProblemResponseForAdmin struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemForAdmin `json:"problem"`
	} `json:"data"`
}

type GetProblemSetProblemResponse

type GetProblemSetProblemResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.Problem `json:"problem"`
	} `json:"data"`
}

type GetProblemSetProblemResponseForAdmin

type GetProblemSetProblemResponseForAdmin struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemForAdmin `json:"problem"`
	} `json:"data"`
}

type GetProblemSetResponse

type GetProblemSetResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSet `json:"problem_set"`
	} `json:"data"`
}

type GetProblemSetResponseForAdmin

type GetProblemSetResponseForAdmin struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetDetail `json:"problem_set"`
	} `json:"data"`
}

type GetProblemSetResponseSummary

type GetProblemSetResponseSummary struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetSummary `json:"problem_set"`
	} `json:"data"`
}

type GetProblemsResponse

type GetProblemsResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Problems []resource.ProblemSummary `json:"problems"`
		Total    int                       `json:"total"`
		Count    int                       `json:"count"`
		Offset   int                       `json:"offset"`
		Prev     *string                   `json:"prev"`
		Next     *string                   `json:"next"`
	} `json:"data"`
}

type GetProblemsResponseForAdmin

type GetProblemsResponseForAdmin struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Problems []resource.ProblemSummaryForAdmin `json:"problems"`
		Total    int                               `json:"total"`
		Count    int                               `json:"count"`
		Offset   int                               `json:"offset"`
		Prev     *string                           `json:"prev"`
		Next     *string                           `json:"next"`
	} `json:"data"`
}

type GetRandomProblemResponse

type GetRandomProblemResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.Problem `json:"problem"`
	} `json:"data"`
}

type GetScriptResponse

type GetScriptResponse struct {
}

GetScriptResponse Will redirect to download url

type GetSubmissionResponse

type GetSubmissionResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.SubmissionDetail `json:"submission"`
	} `json:"data"`
}

type GetSubmissionsResponse

type GetSubmissionsResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Submissions []resource.Submission `json:"submissions"`
		Total       int                   `json:"total"`
		Count       int                   `json:"count"`
		Offset      int                   `json:"offset"`
		Prev        *string               `json:"prev"`
		Next        *string               `json:"next"`
	} `json:"data"`
}

type GetTaskResponse

type GetTaskResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		RunID             uint            `json:"run_id"`
		Language          models.Language `json:"language"`
		TestCaseID        uint            `json:"test_case_id"`
		InputFile         string          `json:"input_file"`  // pre-signed url
		OutputFile        string          `json:"output_file"` // same as above
		CodeFile          string          `json:"code_file"`
		TestCaseUpdatedAt time.Time       `json:"test_case_updated_at"`
		MemoryLimit       uint64          `json:"memory_limit"` // Byte
		TimeLimit         uint            `json:"time_limit"`   // ms
		BuildArg          string          `json:"build_arg"`    // E.g.  O2=false
		CompareScript     models.Script   `json:"compare_script"`
	} `json:"data"`
}

type GetUserProblemInfoResponse

type GetUserProblemInfoResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		TriedCount  int `json:"tried_count"`
		PassedCount int `json:"passed_count"`
		Rank        int `json:"rank"` // TODO: develop this
	} `json:"data"`
}

type GetUserResponse

type GetUserResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.User `json:"user"`
	} `json:"data"`
}

type GetUsersResponse

type GetUsersResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Users  []resource.User `json:"users"`
		Total  int             `json:"total"`
		Count  int             `json:"count"`
		Offset int             `json:"offset"`
		Prev   *string         `json:"prev"`
		Next   *string         `json:"next"`
	} `json:"data"`
}

type JoinClassResponse

type JoinClassResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.Class `json:"class"`
	} `json:"data"`
}

type LoginResponse

type LoginResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		User  resource.UserForAdmin `json:"user"`
		Token string                `json:"token"`
	} `json:"data"`
}

type ProblemSetCreateSubmissionResponse

type ProblemSetCreateSubmissionResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.SubmissionDetail `json:"submission"`
	} `json:"data"`
}

type ProblemSetGetSubmissionResponse

type ProblemSetGetSubmissionResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.SubmissionDetail `json:"submission"`
	} `json:"data"`
}

type ProblemSetGetSubmissionsResponse

type ProblemSetGetSubmissionsResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Submissions []resource.Submission `json:"submissions"`
		Total       int                   `json:"total"`
		Count       int                   `json:"count"`
		Offset      int                   `json:"offset"`
		Prev        *string               `json:"prev"`
		Next        *string               `json:"next"`
	} `json:"data"`
}

type RefreshGradesResponse

type RefreshGradesResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetWithGrades `json:"problem_set"`
	} `json:"data"`
}

type RefreshInviteCodeResponse

type RefreshInviteCodeResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ClassDetail `json:"class"`
	} `json:"data"`
}

type RegisterResponse

type RegisterResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		User  resource.UserForAdmin `json:"user"`
		Token string                `json:"token"`
	} `json:"data"`
}

type RequestResetPasswordResponse

type RequestResetPasswordResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    interface{} `json:"data"`
}

type ResendEmailVerificationResponse

type ResendEmailVerificationResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    interface{} `json:"data"`
}

type Response

type Response struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    interface{} `json:"data"`
}

func ErrorResp

func ErrorResp(message string, error interface{}) Response

func MakeInternalErrorResp

func MakeInternalErrorResp() Response

type UpdateClassResponse

type UpdateClassResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ClassDetail `json:"class"`
	} `json:"data"`
}

type UpdateEmailResponse

type UpdateEmailResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.UserForAdmin `json:"user"`
	} `json:"data"`
}

type UpdateMeResponse

type UpdateMeResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.UserForAdmin `json:"user"`
	} `json:"data"`
}

type UpdateProblemResponse

type UpdateProblemResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemForAdmin `json:"problem"`
	} `json:"data"`
}

type UpdateProblemSetResponse

type UpdateProblemSetResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ProblemSetDetail `json:"problem_set"`
	} `json:"data"`
}

type UpdateTestCaseResponse

type UpdateTestCaseResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.TestCaseForAdmin `json:"test_case"`
	} `json:"data"`
}

type ValidationError

type ValidationError struct {
	Field       string `json:"field"`
	Reason      string `json:"reason"`
	Translation string `json:"translation"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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