client

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 16 Imported by: 4

Documentation

Overview

Package client provides HTTP clients for accessing remote services.

Index

Constants

This section is empty.

Variables

View Source
var GlobalCookieJar http.CookieJar

Functions

func Get

func Get(ctx *b.Context, spec m.Map, addr string, params map[string][]string) string

func GetAddress added in v0.1.15

func GetAddress(ctx *b.Context, spec m.Map) string

func GetAuth added in v0.1.15

func GetAuth(ctx *b.Context, spec m.Map) m.Map

func GetPath added in v0.1.15

func GetPath(ctx *b.Context, spec m.Map) string

func PollStep

func PollStep(ctx *b.Context) (loop bool)

func PostData

func PostData(ctx *b.Context, spec m.Map, url string, pdata io.Reader) string

func PostMessage

func PostMessage(ctx *b.Context, spec m.Map, msg *b.Message) string

func PostStream added in v0.1.13

func PostStream(ctx *b.Context, spec m.Map, msg *b.Message,
	pdata io.Reader) string

func Send added in v0.1.15

func Send(ctx *b.Context, spec m.Map, rdata *RequestData) string

func SendData

func SendData(ctx *b.Context, spec m.Map, msg *b.Message)

func SendMessage

func SendMessage(ctx *b.Context, spec m.Map, msg *b.Message)

func SetAuthentication

func SetAuthentication(ctx *b.Context, spec m.Map, req *http.Request)

func StartClient added in v0.1.8

func StartClient(ctx *b.Context)

Types

type ClientState added in v0.1.8

type ClientState struct {
	b.DefaultState
	ErrorLevel int
	SessionId  string
	Connection interface{} // for persistent connections, e.g. websocket
	Address    string      // default values, may be overridden in Request
	Path       string
	Auth       m.Map
	CustomData interface{}
}

type RequestData added in v0.1.15

type RequestData struct {
	Method      string              // GET, PUT, POST, PATCH, DELETE; default: GET
	Address     string              // URL base; default: take from config (ctx or spec)
	Path        string              // fixed part of path; default: take from config
	Prefix      string              // first part of variant path, e.g. container name
	Id          string              // second part, e.g. document ID
	Suffix      string              // third part
	Params      map[string][]string // URL params, will be URL-encoded
	Payload     interface{}         // structured Post Data, will be rendered as JSON
	Postdata    io.Reader           // use directly, ignore Payload if != nil
	ContentType string              // Content-type header, no default
}

type RequestData allows simimplified and flexible set-up of requests for accessing foreign APIs via the Send() function.

Jump to

Keyboard shortcuts

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