workflow

package
v0.1.3-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(definition *Definition, context *executionContext) error

func NewExecutionContext

func NewExecutionContext(options ...ExecutionOption) (*executionContext, error)

Types

type Assert

type Assert struct {
	Value    string
	Selector string
}

Assert represents an assertion where the Value represents the expected value and Selector represents the GJSON string that is used to extract the value from the JSON response.

func (*Assert) Validate

func (a *Assert) Validate(context *executionContext, response *http.Response) error

type CSVMap

type CSVMap map[string][]string

CSVMap is a data structure that maps a single key to multiple values.

func (*CSVMap) UnmarshalYAML

func (c *CSVMap) UnmarshalYAML(value *yaml.Node) error

type Definition

type Definition struct {
	Version   string
	BaseUrl   string `yaml:"base_url"`
	Timeout   uint
	MaxRetry  uint           `yaml:"max_retry"`
	Variables map[string]any `yaml:",flow"`
	Headers   Header         `yaml:",flow"`
	Sequence  Sequence
}

func ParseConfig

func ParseConfig(path string) (*Definition, error)

type ExecutionOption

type ExecutionOption func(context *executionContext) error

func WithGlobalOptions

func WithGlobalOptions(baseUrl string, header map[string][]string) ExecutionOption

func WithHttpClient

func WithHttpClient(client *http.Client) ExecutionOption

func WithLogger

func WithLogger(logger *log.Logger) ExecutionOption

func WithStore

func WithStore(store *store.Store) ExecutionOption
type Header CSVMap

Header represents the HTTP headers for the workflow step.

func (*Header) UnmarshalYAML

func (h *Header) UnmarshalYAML(value *yaml.Node) error

type QueryParam

type QueryParam CSVMap

QueryParam represents the HTTP query params for the workflow step.

func (*QueryParam) UnmarshalYAML

func (q *QueryParam) UnmarshalYAML(value *yaml.Node) error

type Request

type Request struct {
	Type        string
	Name        string
	Description string
	Url         string
	Method      string
	Body        RequestBody `yaml:"body"`
	Headers     Header
	QueryParams QueryParam `yaml:"query_params"`
	Store       map[string]string
	Timeout     uint
	Delay       uint
	Validations Validator
}

Request represents the HTTP request in the workflow step.

func (*Request) Execute

func (r *Request) Execute(context *executionContext) error

Execute executes the request with the given context.

type RequestBody

type RequestBody struct {
	Content []byte
	Data    map[string]string
}

RequestBody represents the body of the HTTP request in the workflow step.

func (*RequestBody) UnmarshalYAML

func (rb *RequestBody) UnmarshalYAML(value *yaml.Node) error

type Sequence

type Sequence struct {
	Name        string
	Description string
	Variables   map[string]any
	Steps       StepList
}

type Step

type Step interface {
	Execute(execCtx *executionContext) error
}

type StepList

type StepList []Step

func (*StepList) UnmarshalYAML

func (s *StepList) UnmarshalYAML(value *yaml.Node) error

type Validator

type Validator struct {
	Status_code *uint
	Asserts     []Assert
}

Validator is a data structure that represents the validations to the HTTP request.

func (*Validator) Validate

func (v *Validator) Validate(context *executionContext, response *http.Response) error

Jump to

Keyboard shortcuts

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