api

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubmitHTTPTestAssignment

func SubmitHTTPTestAssignment(uuid string, results any) error

Types

type Assignment

type Assignment struct {
	Assignment struct {
		Type                     string
		AssignmentDataHTTPTests  *AssignmentDataHTTPTests
		AssignmentDataCLICommand *AssignmentDataCLICommand
	}
}

func FetchAssignment

func FetchAssignment(uuid string) (*Assignment, error)

type AssignmentDataCLICommand added in v1.3.0

type AssignmentDataCLICommand struct {
	CLICommandData struct {
		Commands []struct {
			Command string
			Tests   []CLICommandTestCase
		}
	}
}

type AssignmentDataHTTPTests added in v1.3.0

type AssignmentDataHTTPTests struct {
	HttpTests struct {
		BaseURL             *string
		ContainsCompleteDir bool
		Requests            []struct {
			ResponseVariables []ResponseVariable
			Tests             []HTTPTest
			Request           struct {
				BasicAuth *struct {
					Username string
					Password string
				}
				Headers  map[string]string
				BodyJSON map[string]interface{}
				Method   string
				Path     string
				Actions  struct {
					DelayRequestByMs *int32
				}
			}
		}
	}
}

type CLICommandResult added in v1.3.0

type CLICommandResult struct {
	ExitCode int
	Stdout   string
}

type CLICommandTestCase added in v1.3.0

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

type HTTPTest

type HTTPTest struct {
	StatusCode     *int
	BodyContains   *string
	HeadersContain *HTTPTestHeader
	JSONValue      *HTTPTestJSONValue
}

Only one of these fields should be set

type HTTPTestHeader

type HTTPTestHeader struct {
	Key   string
	Value string
}

type HTTPTestJSONValue

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

type HTTPTestValidationError

type HTTPTestValidationError struct {
	ErrorMessage       *string `json:"Error"`
	FailedRequestIndex *int    `json:"FailedRequestIndex"`
	FailedTestIndex    *int    `json:"FailedTestIndex"`
}

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"
)

type ResponseVariable

type ResponseVariable struct {
	Name string
	Path string
}

type StructuredErrCLICommand added in v1.3.0

type StructuredErrCLICommand struct {
	ErrorMessage       string `json:"Error"`
	FailedCommandIndex int    `json:"FailedCommandIndex"`
	FailedTestIndex    int    `json:"FailedTestIndex"`
}

func SubmitCLICommandAssignment added in v1.3.0

func SubmitCLICommandAssignment(uuid string, results []CLICommandResult) (*StructuredErrCLICommand, error)

Jump to

Keyboard shortcuts

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