placeholder

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Seed = 5
)
View Source
const UAHeader = "User-Agent"

Variables

View Source
var DefaultGRPC = &GRPC{name: "gRPC"}
View Source
var DefaultGraphQL = &GraphQL{name: "GraphQL"}
View Source
var DefaultHTMLForm = &HTMLForm{name: "HTMLForm"}
View Source
var DefaultHTMLMultipartForm = &HTMLMultipartForm{name: "HTMLMultipartForm"}
View Source
var DefaultHeader = &Header{name: "Header"}
View Source
var DefaultJSONBody = &JSONBody{name: "JSONBody"}
View Source
var DefaultJSONRequest = &JSONRequest{name: "JSONRequest"}
View Source
var DefaultRawRequest = &RawRequest{name: "RawRequest"}
View Source
var DefaultRequestBody = &RequestBody{name: "RequestBody"}
View Source
var DefaultSOAPBody = &SOAPBody{name: "SOAPBody"}
View Source
var DefaultURLParam = &URLParam{name: "URLParam"}
View Source
var DefaultURLPath = &URLPath{name: "URLPath"}
View Source
var DefaultUserAgent = &UserAgent{name: "UserAgent"}
View Source
var DefaultXMLBody = &XMLBody{name: "XMLBody"}
View Source
var Placeholders map[string]Placeholder

Functions

func Apply

func Apply(
	url, data, placeholder string,
	config PlaceholderConfig,
	httpClientType types.HTTPClientType,
) (types.Request, error)

func RandomHex

func RandomHex(n int) (string, error)

Types

type BadPlaceholderConfigError added in v0.4.4

type BadPlaceholderConfigError struct {
	// contains filtered or unexported fields
}

func (*BadPlaceholderConfigError) Error added in v0.4.4

func (e *BadPlaceholderConfigError) Error() string

func (*BadPlaceholderConfigError) Unwrap added in v0.4.4

func (e *BadPlaceholderConfigError) Unwrap() error

type GRPC added in v0.4.0

type GRPC struct {
	// contains filtered or unexported fields
}

func (*GRPC) CreateRequest added in v0.4.0

func (*GRPC) GetName added in v0.4.0

func (p *GRPC) GetName() string

func (*GRPC) NewPlaceholderConfig added in v0.5.0

func (p *GRPC) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type GraphQL added in v0.5.1

type GraphQL struct {
	// contains filtered or unexported fields
}

func (*GraphQL) CreateRequest added in v0.5.1

func (p *GraphQL) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*GraphQL) GetName added in v0.5.1

func (p *GraphQL) GetName() string

func (*GraphQL) NewPlaceholderConfig added in v0.5.1

func (p *GraphQL) NewPlaceholderConfig(conf map[any]any) (PlaceholderConfig, error)

type GraphQLConfig added in v0.5.1

type GraphQLConfig struct {
	Method string
}

func (*GraphQLConfig) Hash added in v0.5.1

func (g *GraphQLConfig) Hash() []byte

type HTMLForm added in v0.4.0

type HTMLForm struct {
	// contains filtered or unexported fields
}

func (*HTMLForm) CreateRequest added in v0.4.0

func (p *HTMLForm) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*HTMLForm) GetName added in v0.4.0

func (p *HTMLForm) GetName() string

func (*HTMLForm) NewPlaceholderConfig added in v0.5.0

func (p *HTMLForm) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type HTMLMultipartForm added in v0.4.0

type HTMLMultipartForm struct {
	// contains filtered or unexported fields
}

func (*HTMLMultipartForm) CreateRequest added in v0.4.0

func (p *HTMLMultipartForm) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*HTMLMultipartForm) GetName added in v0.4.0

func (p *HTMLMultipartForm) GetName() string

func (*HTMLMultipartForm) NewPlaceholderConfig added in v0.5.0

func (p *HTMLMultipartForm) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)
type Header struct {
	// contains filtered or unexported fields
}

func (*Header) CreateRequest added in v0.4.0

func (p *Header) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*Header) GetName added in v0.4.0

func (p *Header) GetName() string

func (*Header) NewPlaceholderConfig added in v0.5.0

func (p *Header) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type JSONBody

type JSONBody struct {
	// contains filtered or unexported fields
}

func (*JSONBody) CreateRequest added in v0.4.0

func (p *JSONBody) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*JSONBody) GetName added in v0.4.0

func (p *JSONBody) GetName() string

func (*JSONBody) NewPlaceholderConfig added in v0.5.0

func (p *JSONBody) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type JSONRequest added in v0.4.0

type JSONRequest struct {
	// contains filtered or unexported fields
}

func (*JSONRequest) CreateRequest added in v0.4.0

func (p *JSONRequest) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*JSONRequest) GetName added in v0.4.0

func (p *JSONRequest) GetName() string

func (*JSONRequest) NewPlaceholderConfig added in v0.5.0

func (p *JSONRequest) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type Placeholder

type Placeholder interface {
	NewPlaceholderConfig(conf map[any]any) (PlaceholderConfig, error)

	GetName() string
	CreateRequest(
		requestURL, payload string,
		config PlaceholderConfig,
		httpClientType types.HTTPClientType,
	) (types.Request, error)
}

type PlaceholderConfig added in v0.4.12

type PlaceholderConfig interface {
	helpers.Hash
}

func GetPlaceholderConfig added in v0.4.4

func GetPlaceholderConfig(name string, conf any) (PlaceholderConfig, error)

type RawRequest added in v0.4.4

type RawRequest struct {
	// contains filtered or unexported fields
}

func (*RawRequest) CreateRequest added in v0.4.4

func (p *RawRequest) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

CreateRequest creates a new request from config. config must be a RawRequestConfig struct.

func (*RawRequest) GetName added in v0.4.4

func (p *RawRequest) GetName() string

func (*RawRequest) NewPlaceholderConfig added in v0.5.0

func (p *RawRequest) NewPlaceholderConfig(conf map[any]any) (PlaceholderConfig, error)

type RawRequestConfig added in v0.4.4

type RawRequestConfig struct {
	Method  string
	Path    string
	Headers map[string]string
	Body    string
}

func (*RawRequestConfig) Hash added in v0.4.12

func (r *RawRequestConfig) Hash() []byte

type RequestBody

type RequestBody struct {
	// contains filtered or unexported fields
}

func (*RequestBody) CreateRequest added in v0.4.0

func (p *RequestBody) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*RequestBody) GetName added in v0.4.0

func (p *RequestBody) GetName() string

func (*RequestBody) NewPlaceholderConfig added in v0.5.0

func (p *RequestBody) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type SOAPBody

type SOAPBody struct {
	// contains filtered or unexported fields
}

func (*SOAPBody) CreateRequest added in v0.4.0

func (p *SOAPBody) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*SOAPBody) GetName added in v0.4.0

func (p *SOAPBody) GetName() string

func (*SOAPBody) NewPlaceholderConfig added in v0.5.0

func (p *SOAPBody) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type URLParam

type URLParam struct {
	// contains filtered or unexported fields
}

func (*URLParam) CreateRequest added in v0.4.0

func (p *URLParam) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*URLParam) GetName added in v0.4.0

func (p *URLParam) GetName() string

func (*URLParam) NewPlaceholderConfig added in v0.5.0

func (p *URLParam) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type URLPath

type URLPath struct {
	// contains filtered or unexported fields
}

func (*URLPath) CreateRequest added in v0.4.0

func (p *URLPath) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*URLPath) GetName added in v0.4.0

func (p *URLPath) GetName() string

func (*URLPath) NewPlaceholderConfig added in v0.5.0

func (p *URLPath) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type UnknownPlaceholderError added in v0.4.3

type UnknownPlaceholderError struct {
	// contains filtered or unexported fields
}

func (*UnknownPlaceholderError) Error added in v0.4.3

func (e *UnknownPlaceholderError) Error() string

type UserAgent added in v0.4.3

type UserAgent struct {
	// contains filtered or unexported fields
}

func (*UserAgent) CreateRequest added in v0.4.3

func (p *UserAgent) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*UserAgent) GetName added in v0.4.3

func (p *UserAgent) GetName() string

func (*UserAgent) NewPlaceholderConfig added in v0.5.0

func (p *UserAgent) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

type XMLBody added in v0.4.0

type XMLBody struct {
	// contains filtered or unexported fields
}

func (*XMLBody) CreateRequest added in v0.4.0

func (p *XMLBody) CreateRequest(requestURL, payload string, config PlaceholderConfig, httpClientType types.HTTPClientType) (types.Request, error)

func (*XMLBody) GetName added in v0.4.0

func (p *XMLBody) GetName() string

func (*XMLBody) NewPlaceholderConfig added in v0.5.0

func (p *XMLBody) NewPlaceholderConfig(map[any]any) (PlaceholderConfig, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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