huggingface

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 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 Action

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

func (*Action) ReflectBodyToBinary

func (h *Action) ReflectBodyToBinary() []byte

func (*Action) ReflectBodyToMap

func (h *Action) ReflectBodyToMap() map[string]string

func (*Action) ReflectBodyToRaw

func (h *Action) ReflectBodyToRaw() *RawBody

func (*Action) ReflectBodyToRecord

func (h *Action) ReflectBodyToRecord() []*RecordBody

type BinaryBody

type BinaryBody string

type Connector

type Connector struct {
	ResourceOpts Resource
	ActionOpts   Action
}

func (*Connector) GetMetaInfo

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

func (*Connector) Run

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

func (*Connector) TestConnection

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

func (*Connector) ValidateActionOptions

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

func (*Connector) ValidateResourceOptions

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

type RawBody

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

type RecordBody

type RecordBody struct {
	Key   string
	Value string
}

type Resource

type Resource 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"`
}

Jump to

Keyboard shortcuts

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