Documentation
¶
Index ¶
- Constants
- func Logout() error
- func SubmitCLILesson(uuid string, results []CLIStepResult, captureDebug bool) (LessonSubmissionEvent, SubmissionDebugData, error)
- type CLICommandJqOutput
- type CLICommandResult
- type CLICommandStdoutVariable
- type CLICommandTest
- type CLIData
- type CLIStep
- type CLIStepCLICommand
- type CLIStepHTTPRequest
- type CLIStepResult
- type CurrentUserResponse
- type HTTPBasicAuth
- type HTTPRequest
- type HTTPRequestResponseHeaderVariable
- type HTTPRequestResponseVariable
- type HTTPRequestResult
- type HTTPRequestTest
- type HTTPRequestTestHeader
- type HTTPRequestTestJSONValue
- type JqExpectedResult
- type JqOperator
- type JqValueType
- type Lesson
- type LessonDataCLI
- type LessonSubmissionEvent
- type LoginRequest
- type LoginResponse
- type NextCLILesson
- type OperatorType
- type StdoutJqTest
- type StructuredErrCLI
- type SubmissionDebugData
- type VerificationResultSlug
- type XPBreakdownItem
Constants ¶
View Source
const BaseURLOverrideRequired = "override"
View Source
const BaseURLPlaceholder = "${baseURL}"
Variables ¶
This section is empty.
Functions ¶
func SubmitCLILesson ¶ added in v1.15.0
func SubmitCLILesson(uuid string, results []CLIStepResult, captureDebug bool) (LessonSubmissionEvent, SubmissionDebugData, error)
Types ¶
type CLICommandJqOutput ¶ added in v1.23.0
type CLICommandResult ¶ added in v1.3.0
type CLICommandResult struct {
ExitCode int
Err string `json:"-"`
FinalCommand string `json:"-"`
Command CLIStepCLICommand `json:"-"`
Stdout string
Stderr string `json:"-"`
Variables map[string]string
JqOutputs []CLICommandJqOutput `json:"-"`
}
type CLICommandStdoutVariable ¶ added in v1.30.0
type CLICommandTest ¶ added in v1.15.1
type CLICommandTest struct {
ExitCode *int `yaml:"exitCode"`
StdoutContainsAll []string `yaml:"stdoutContainsAll"`
StdoutContainsNone []string `yaml:"stdoutContainsNone"`
StdoutLinesGT *int `yaml:"stdoutLinesGT"`
StdoutJq *StdoutJqTest `yaml:"stdoutJq"`
}
type CLIStep ¶ added in v1.18.0
type CLIStep struct {
Description string `yaml:"description"`
CLICommand *CLIStepCLICommand `yaml:"cliCommand"`
HTTPRequest *CLIStepHTTPRequest `yaml:"httpRequest"`
NoPenaltyOnFail bool `yaml:"noPenaltyOnFail"`
}
type CLIStepCLICommand ¶ added in v1.15.0
type CLIStepCLICommand struct {
Command string `yaml:"command"`
Tests []CLICommandTest `yaml:"tests"`
StdoutVariables []CLICommandStdoutVariable `yaml:"stdoutVariables"`
SleepAfterMs *int `yaml:"sleepAfterMs"`
StdoutFilterTmdl *string `yaml:"stdoutFilterTmdl"`
}
type CLIStepHTTPRequest ¶ added in v1.15.0
type CLIStepHTTPRequest struct {
ResponseVariables []HTTPRequestResponseVariable `yaml:"responseVariables"`
ResponseHeaderVariables []HTTPRequestResponseHeaderVariable `yaml:"responseHeaderVariables"`
Tests []HTTPRequestTest `yaml:"tests"`
Request HTTPRequest `yaml:"request"`
SleepAfterMs *int `yaml:"sleepAfterMs"`
}
type CLIStepResult ¶ added in v1.15.0
type CLIStepResult struct {
CLICommandResult *CLICommandResult
HTTPRequestResult *HTTPRequestResult
}
type CurrentUserResponse ¶ added in v1.29.0
type CurrentUserResponse struct {
Handle string `json:"handle"`
}
func FetchCurrentUser ¶ added in v1.29.0
func FetchCurrentUser() (*CurrentUserResponse, error)
type HTTPBasicAuth ¶ added in v1.18.0
type HTTPRequest ¶ added in v1.18.0
type HTTPRequest struct {
Method string `yaml:"method"`
FullURL string `yaml:"fullURL"`
Headers map[string]string `yaml:"headers"`
BodyJSON map[string]any `yaml:"bodyJSON"`
BodyForm map[string]string `yaml:"bodyForm"`
FollowRedirects *bool `yaml:"followRedirects"`
BasicAuth *HTTPBasicAuth `yaml:"basicAuth"`
}
type HTTPRequestResponseHeaderVariable ¶ added in v1.30.0
type HTTPRequestResponseVariable ¶ added in v1.15.1
type HTTPRequestResult ¶ added in v1.15.0
type HTTPRequestTest ¶ added in v1.15.1
type HTTPRequestTest struct {
StatusCode *int `yaml:"statusCode"`
BodyContains *string `yaml:"bodyContains"`
BodyContainsNone *string `yaml:"bodyContainsNone"`
HeadersContain *HTTPRequestTestHeader `yaml:"headersContain"`
TrailersContain *HTTPRequestTestHeader `yaml:"trailersContain"`
JSONValue *HTTPRequestTestJSONValue `yaml:"jsonValue"`
}
HTTPRequestTest should have only one field set
type HTTPRequestTestHeader ¶ added in v1.15.1
type HTTPRequestTestJSONValue ¶ added in v1.15.1
type HTTPRequestTestJSONValue struct {
Path string `yaml:"path"`
Operator OperatorType `yaml:"operator"`
IntValue *int `yaml:"intValue"`
StringValue *string `yaml:"stringValue"`
BoolValue *bool `yaml:"boolValue"`
}
type JqExpectedResult ¶ added in v1.23.0
type JqExpectedResult struct {
Type JqValueType `yaml:"type"`
Operator JqOperator `yaml:"operator"`
Value any `yaml:"value"`
}
type JqOperator ¶ added in v1.23.0
type JqOperator string // defined fully on backend
type JqValueType ¶ added in v1.23.0
type JqValueType string
const ( JqTypeString JqValueType = "string" JqTypeInt JqValueType = "int" JqTypeBool JqValueType = "bool" )
type Lesson ¶ added in v1.4.0
type Lesson struct {
Lesson struct {
Type string
Title string
LessonDataCLI *LessonDataCLI
}
ChapterNumber int
LessonNumber int
}
func FetchLesson ¶ added in v1.4.0
type LessonDataCLI ¶ added in v1.15.0
type LessonDataCLI struct {
// Readme string
CLIData CLIData
}
type LessonSubmissionEvent ¶ added in v1.25.0
type LessonSubmissionEvent struct {
ResultSlug VerificationResultSlug
StructuredErrCLI *StructuredErrCLI
XPReward int
XPBreakdown []XPBreakdownItem
}
type LoginRequest ¶
type LoginRequest struct {
Otp string `json:"otp"`
}
type LoginResponse ¶
type LoginResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
func FetchAccessToken ¶
func FetchAccessToken() (*LoginResponse, error)
func LoginWithCode ¶
func LoginWithCode(code string) (*LoginResponse, error)
type NextCLILesson ¶ added in v1.31.0
type NextCLILesson struct {
LessonUUID string
LessonTitle string
ChapterTitle string
ChapterNumber int
LessonNumber int
}
func FetchNextCLILesson ¶ added in v1.31.0
func FetchNextCLILesson() (*NextCLILesson, error)
type OperatorType ¶
type OperatorType string
const ( OpEquals OperatorType = "eq" OpGreaterThan OperatorType = "gt" OpContains OperatorType = "contains" OpNotContains OperatorType = "not_contains" )
type StdoutJqTest ¶ added in v1.23.0
type StdoutJqTest struct {
InputMode string `yaml:"inputMode"` // "json" or "jsonl"
Query string `yaml:"query"`
ExpectedResults []JqExpectedResult `yaml:"expectedResults"`
}
type StructuredErrCLI ¶ added in v1.15.0
type SubmissionDebugData ¶ added in v1.27.0
type VerificationResultSlug ¶ added in v1.25.0
type VerificationResultSlug string
const ( // "noop" is for "noPenaltyOnFail" on the CLI type VerificationResultSlugNoop VerificationResultSlug = "noop" VerificationResultSlugSystemError VerificationResultSlug = "system-error" VerificationResultSlugSuccess VerificationResultSlug = "success" VerificationResultSlugFailure VerificationResultSlug = "failure" )
type XPBreakdownItem ¶ added in v1.29.6
Click to show internal directories.
Click to hide internal directories.