response

package
v0.0.0-...-68eb7cf Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

README

API

Common return codes.

message 结果
SUCCESS 正常
INTERNAL_ERROR 服务器内部错误
VALIDATION_ERROR 验证错误, 详见error字段

Authentication

message 结果
AUTH_SESSION_EXPIRED session超时
AUTH_NEED_TOKEN 未提供token

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 结果
NOT_FOUND 无法找到指定user
CONFLICT_EMAIL 邮箱重复
CONFLICT_USERNAME 用户名重复
AdminDeleteUser
message 结果
NOT_FOUND 无法找到指定user
AdminGetUser
message 结果
NOT_FOUND 无法找到指定user
AdminGetUsers
message 结果
INVALID_ORDER 无效的排序设置

User

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

Problem

CreateProblem
GetProblem
message 结果
NOT_FOUND 无法找到指定problem
GetProblemAttachmentFile
message 结果
NOT_FOUND 错误的problem
ATTACHMENT_NOT_FOUND 无法找到指定附件
GetProblems
message 结果
INVALID_ORDER 无效的排序设置
UpdateProblem
message 结果
NOT_FOUND 无法找到指定problem
DeleteProblem
message 结果
NOT_FOUND 无法找到指定problem
CreateTestCase
message 结果
NOT_FOUND 错误的problem
INVALID_FILE 缺少文件
UpdateTestCase
message 结果
NOT_FOUND 无法找到problem
TEST_CASE_NOT_FOUND 无法找到test case
DeleteTestCase
message 结果
NOT_FOUND 无法找到problem
TEST_CASE_NOT_FOUND 无法找到test case
DeleteTestCases
message 结果
NOT_FOUND 无法找到problem
GetTestCaseInputFile
message 结果
NOT_FOUND 无法找到problem
TEST_CASE_NOT_FOUND 无法找到test case
GetTestCaseOutputFile
message 结果
NOT_FOUND 无法找到problem
TEST_CASE_NOT_FOUND 无法找到test case

Image

CreateImage
code 结果
ILLEGAL_TYPE 类型非法

Submission

CreateSubmission
message 结果
NOT_FOUND 错误的problem
INVALID_LANGUAGE 无效的语言
INVALID_FILE 缺少文件
GetSubmission
message 结果
NOT_FOUND 无法找到submission
GetSubmissions
GetSubmissionCode
message 结果
NOT_FOUND 无法找到submission
GetRunOutput
message 结果
SUBMISSION_NOT_FOUND 无法找到submission
NOT_FOUND 无法找到run
BAD_RUN_ID
GetRunCompilerOutput
message 结果
SUBMISSION_NOT_FOUND 无法找到submission
NOT_FOUND 无法找到run
GetRunComparerOutput
message 结果
SUBMISSION_NOT_FOUND 无法找到submission
NOT_FOUND 无法找到run

Judger

UpdateRun

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

Class

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InternalErrorResp

func InternalErrorResp(c echo.Context) error

Types

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   []models.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 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 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 DeleteStudentsResponse

type DeleteStudentsResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		*resource.ClassDetail `json:"class"`
	} `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 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 GetProblemsResponse

type GetProblemsResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Data    struct {
		Problems []resource.Problem `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.ProblemForAdmin `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 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 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 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 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 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 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