restapi

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	METHOD_GET    = "GET"
	METHOD_POST   = "POST"
	METHOD_PUT    = "PUT"
	METHOD_DELETE = "DELETE"
	METHOD_PATCH  = "PATCH"

	BODY_NONE   = "none"
	BODY_RAW    = "raw"
	BODY_BINARY = "binary"
	BODY_FORM   = "form-data"
	BODY_XWFU   = "x-www-form-urlencoded"

	AUTH_NONE   = "none"
	AUTH_BASIC  = "basic"
	AUTH_BEARER = "bearer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryBody

type BinaryBody string

type RESTAPIConnector

type RESTAPIConnector struct {
	Resource RESTOptions
	Action   RESTTemplate
}

func (*RESTAPIConnector) GetMetaInfo

func (r *RESTAPIConnector) GetMetaInfo(resourceOptions map[string]interface{}) (common.MetaInfoResult, error)

func (*RESTAPIConnector) Run

func (r *RESTAPIConnector) Run(resourceOptions map[string]interface{}, actionOptions map[string]interface{}) (common.RuntimeResult, error)

func (*RESTAPIConnector) TestConnection

func (r *RESTAPIConnector) TestConnection(resourceOptions map[string]interface{}) (common.ConnectionResult, error)

func (*RESTAPIConnector) ValidateActionOptions

func (r *RESTAPIConnector) ValidateActionOptions(actionOptions map[string]interface{}) (common.ValidateResult, error)

func (*RESTAPIConnector) ValidateResourceOptions

func (r *RESTAPIConnector) ValidateResourceOptions(resourceOptions map[string]interface{}) (common.ValidateResult, error)

type RESTOptions

type RESTOptions struct {
	BaseURL        string `validate:"required"`
	URLParams      []map[string]string
	Headers        []map[string]string
	Cookies        []map[string]string
	Authentication string            `validate:"oneof=none basic bearer"`
	AuthContent    map[string]string `validate:"required_unless=Authentication none"`
}

type RESTTemplate

type RESTTemplate struct {
	URL       string
	Method    string `validate:"oneof=GET POST PUT PATCH DELETE"`
	BodyType  string `validate:"oneof=none form-data x-www-form-urlencoded raw json binary"`
	UrlParams []map[string]string
	Headers   []map[string]string
	Body      interface{} `validate:"required_unless=BodyType none"`
	Cookies   []map[string]string
}

func (*RESTTemplate) ReflectBodyToBinary

func (t *RESTTemplate) ReflectBodyToBinary() []byte

func (*RESTTemplate) ReflectBodyToMap

func (t *RESTTemplate) ReflectBodyToMap() map[string]string

func (*RESTTemplate) ReflectBodyToRaw

func (t *RESTTemplate) ReflectBodyToRaw() *RawBody

func (*RESTTemplate) ReflectBodyToRecord

func (t *RESTTemplate) ReflectBodyToRecord() []*RecordBody

type RawBody

type RawBody struct {
	Type    string `json:"type"`
	Content string `json:"content"`
}

type RecordBody

type RecordBody struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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