api

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLICommandResult added in v1.3.0

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

type CLICommandTest added in v1.15.1

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

type CLIData added in v1.15.0

type CLIData struct {
	// ContainsCompleteDir bool
	BaseURL *string
	Steps   []struct {
		CLICommand  *CLIStepCLICommand
		HTTPRequest *CLIStepHTTPRequest
	}
}

type CLIStepCLICommand added in v1.15.0

type CLIStepCLICommand struct {
	Command string
	Tests   []CLICommandTest
}

type CLIStepHTTPRequest added in v1.15.0

type CLIStepHTTPRequest struct {
	ResponseVariables []HTTPRequestResponseVariable
	Tests             []HTTPRequestTest
	Request           struct {
		Method    string
		Path      string
		FullURL   string // overrides BaseURL and Path if set
		Headers   map[string]string
		BodyJSON  map[string]interface{}
		BasicAuth *struct {
			Username string
			Password string
		}
		Actions struct {
			DelayRequestByMs *int32
		}
	}
}

type CLIStepResult added in v1.15.0

type CLIStepResult struct {
	CLICommandResult  *CLICommandResult
	HTTPRequestResult *HTTPRequestResult
}

type HTTPRequestResponseVariable added in v1.15.1

type HTTPRequestResponseVariable struct {
	Name string
	Path string
}

type HTTPRequestResult added in v1.15.0

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 added in v1.15.1

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 added in v1.15.1

type HTTPRequestTestHeader struct {
	Key   string
	Value string
}

type HTTPRequestTestJSONValue added in v1.15.1

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

type Lesson added in v1.4.0

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

func FetchLesson added in v1.4.0

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

type LessonDataCLI added in v1.15.0

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 StructuredErrCLI added in v1.15.0

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

func SubmitCLILesson added in v1.15.0

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

Jump to

Keyboard shortcuts

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