stdsdk

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = &http.Client{
	Transport: &http.Transport{
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 10 * time.Second,
		}).DialContext,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
	},
}

Functions

This section is empty.

Types

type Authenticator

type Authenticator func(c *Client, w *http.Response) (http.Header, error)

type Client

type Client struct {
	Authenticator Authenticator
	Endpoint      *url.URL
	Headers       HeadersFunc
	// contains filtered or unexported fields
}

func New

func New(endpoint string) (*Client, error)

func (*Client) Delete

func (c *Client) Delete(path string, opts RequestOptions, out interface{}) error

func (*Client) Get

func (c *Client) Get(path string, opts RequestOptions, out interface{}) error

func (*Client) GetStream

func (c *Client) GetStream(path string, opts RequestOptions) (*http.Response, error)

func (*Client) HandleRequest

func (c *Client) HandleRequest(req *http.Request) (*http.Response, error)

func (*Client) Head

func (c *Client) Head(path string, opts RequestOptions, out *bool) error

func (*Client) Options

func (c *Client) Options(path string, opts RequestOptions, out interface{}) error

func (*Client) Post

func (c *Client) Post(path string, opts RequestOptions, out interface{}) error

func (*Client) PostStream

func (c *Client) PostStream(path string, opts RequestOptions) (*http.Response, error)

func (*Client) Put

func (c *Client) Put(path string, opts RequestOptions, out interface{}) error

func (*Client) PutStream

func (c *Client) PutStream(path string, opts RequestOptions) (*http.Response, error)

func (*Client) Request

func (c *Client) Request(method, path string, opts RequestOptions) (*http.Request, error)

func (*Client) Websocket

func (c *Client) Websocket(path string, opts RequestOptions) (io.ReadCloser, error)

func (*Client) WithContext

func (c *Client) WithContext(ctx context.Context) *Client

type Files

type Files map[string][]byte

type Headers

type Headers map[string]string

type HeadersFunc

type HeadersFunc func() http.Header

type Params

type Params map[string]interface{}

type Query

type Query map[string]interface{}

type RequestOptions

type RequestOptions struct {
	Body    io.Reader
	Files   Files
	Headers Headers
	Params  Params
	Query   Query
}

func MarshalOptions

func MarshalOptions(opts interface{}) (RequestOptions, error)

func (*RequestOptions) Content

func (o *RequestOptions) Content() (io.Reader, string, error)

func (*RequestOptions) Querystring

func (o *RequestOptions) Querystring() (string, error)

Jump to

Keyboard shortcuts

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