Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BaseURLOverrideRequired = "override"
View Source
const BaseURLPlaceholder = "${baseURL}"

Variables

This section is empty.

Functions

This section is empty.

Types

type CLICommandJqOutput

type CLICommandJqOutput struct {
	Query   string
	Results []string
	Error   string
}

type CLICommandResult

type CLICommandResult struct {
	ExitCode     int
	FinalCommand string `json:"-"`
	Stdout       string
	Variables    map[string]string
	JqOutputs    []CLICommandJqOutput `json:"-"`
}

type CLICommandTest

type CLICommandTest struct {
	ExitCode           *int
	StdoutContainsAll  []string
	StdoutContainsNone []string
	StdoutLinesGt      *int
	StdoutJq           *StdoutJqTest
}

type CLIData

type CLIData struct {
	// ContainsCompleteDir bool
	BaseURLDefault          string
	Steps                   []CLIStep
	AllowedOperatingSystems []string
}

type CLIStep

type CLIStep struct {
	CLICommand  *CLIStepCLICommand
	HTTPRequest *CLIStepHTTPRequest
}

type CLIStepCLICommand

type CLIStepCLICommand struct {
	Command          string
	Tests            []CLICommandTest
	SleepAfterMs     *int
	StdoutFilterTmdl *string
}

func (*CLIStepCLICommand) GetSleepAfterMs

func (c *CLIStepCLICommand) GetSleepAfterMs() *int

type CLIStepHTTPRequest

type CLIStepHTTPRequest struct {
	ResponseVariables []HTTPRequestResponseVariable
	Tests             []HTTPRequestTest
	Request           HTTPRequest
	SleepAfterMs      *int
}

func (*CLIStepHTTPRequest) GetSleepAfterMs

func (h *CLIStepHTTPRequest) GetSleepAfterMs() *int

type CLIStepResult

type CLIStepResult struct {
	CLICommandResult  *CLICommandResult
	HTTPRequestResult *HTTPRequestResult
}

type HTTPBasicAuth

type HTTPBasicAuth struct {
	Username string
	Password string
}

type HTTPRequest

type HTTPRequest struct {
	Method   string
	FullURL  string
	Headers  map[string]string
	BodyJSON map[string]any

	BasicAuth *HTTPBasicAuth
}

type HTTPRequestResponseVariable

type HTTPRequestResponseVariable struct {
	Name string
	Path string
}

type HTTPRequestResult

type HTTPRequestResult struct {
	Err              string `json:"-"`
	StatusCode       int
	ResponseHeaders  map[string]string
	ResponseTrailers map[string]string
	BodyString       string
	Variables        map[string]string
	Request          CLIStepHTTPRequest
}

type HTTPRequestTest

type HTTPRequestTest struct {
	StatusCode       *int
	BodyContains     *string
	BodyContainsNone *string
	HeadersContain   *HTTPRequestTestHeader
	TrailersContain  *HTTPRequestTestHeader
	JSONValue        *HTTPRequestTestJSONValue
}

Only one of these fields should be set

type HTTPRequestTestHeader

type HTTPRequestTestHeader struct {
	Key   string
	Value string
}

type HTTPRequestTestJSONValue

type HTTPRequestTestJSONValue struct {
	Path        string
	Operator    OperatorType
	IntValue    *int
	StringValue *string
	BoolValue   *bool
}

type JqExpectedResult

type JqExpectedResult struct {
	Type     JqValueType
	Operator JqOperator
	Value    any
}

type JqOperator

type JqOperator string // defined fully on backend

type JqValueType

type JqValueType string
const (
	JqTypeString JqValueType = "string"
	JqTypeInt    JqValueType = "int"
	JqTypeBool   JqValueType = "bool"
)

type Lesson

type Lesson struct {
	Lesson struct {
		Type          string
		LessonDataCLI *LessonDataCLI
	}
}

func FetchLesson

func FetchLesson(uuid string) (*Lesson, error)

type LessonDataCLI

type LessonDataCLI struct {
	// Readme string
	CLIData CLIData
}

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 OperatorType

type OperatorType string
const (
	OpEquals      OperatorType = "eq"
	OpGreaterThan OperatorType = "gt"
	OpContains    OperatorType = "contains"
	OpNotContains OperatorType = "not_contains"
)

type Sleepable

type Sleepable interface {
	GetSleepAfterMs() *int
}

type StdoutJqTest

type StdoutJqTest struct {
	InputMode       string // "json" or "jsonl"
	Query           string
	ExpectedResults []JqExpectedResult
}

type VerificationResultStructuredErrCLI

type VerificationResultStructuredErrCLI struct {
	ErrorMessage    string `json:"Error"`
	FailedStepIndex int    `json:"FailedStepIndex"`
	FailedTestIndex int    `json:"FailedTestIndex"`
}

func SubmitCLILesson

func SubmitCLILesson(uuid string, results []CLIStepResult) (*VerificationResultStructuredErrCLI, error)

Jump to

Keyboard shortcuts

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