httpclient

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const UserAgent = "Zadig REST Client"

Variables

This section is empty.

Functions

func Delete

func Delete(url string, rfs ...RequestFunc) (*resty.Response, error)

func Download

func Download(url, path string, rfs ...RequestFunc) error

Download retrieves content from the given url and write it to path.

func Get

func Get(url string, rfs ...RequestFunc) (*resty.Response, error)
func Head(url string, rfs ...RequestFunc) (*resty.Response, error)

func Options

func Options(url string, rfs ...RequestFunc) (*resty.Response, error)

func Patch

func Patch(url string, rfs ...RequestFunc) (*resty.Response, error)

func Post

func Post(url string, rfs ...RequestFunc) (*resty.Response, error)

func Put

func Put(url string, rfs ...RequestFunc) (*resty.Response, error)

Types

type Client

type Client struct {
	*resty.Client

	Host    string // http://example.org
	BaseURI string // /api/v1
}

func New

func New(cfs ...ClientFunc) *Client

func (*Client) Delete

func (c *Client) Delete(url string, rfs ...RequestFunc) (*resty.Response, error)

func (*Client) Get

func (c *Client) Get(url string, rfs ...RequestFunc) (*resty.Response, error)

func (*Client) Head

func (c *Client) Head(url string, rfs ...RequestFunc) (*resty.Response, error)

func (*Client) Options

func (c *Client) Options(url string, rfs ...RequestFunc) (*resty.Response, error)

func (*Client) Patch

func (c *Client) Patch(url string, rfs ...RequestFunc) (*resty.Response, error)

func (*Client) Post

func (c *Client) Post(url string, rfs ...RequestFunc) (*resty.Response, error)

func (*Client) Put

func (c *Client) Put(url string, rfs ...RequestFunc) (*resty.Response, error)

func (*Client) Request

func (c *Client) Request(method, url string, rfs ...RequestFunc) (*resty.Response, error)

type ClientFunc

type ClientFunc func(*Client)

func SetAuthScheme

func SetAuthScheme(scheme string) ClientFunc

func SetAuthToken

func SetAuthToken(token string) ClientFunc

func SetBaseURI

func SetBaseURI(uri string) ClientFunc

func SetBasicAuth

func SetBasicAuth(username, password string) ClientFunc

func SetHostURL

func SetHostURL(url string) ClientFunc

func SetProxy

func SetProxy(proxyURL string) ClientFunc

type Error

type Error struct {
	Code   int
	Status string
	Detail []byte
}

func (Error) Error

func (e Error) Error() string

type RequestFunc

type RequestFunc func(request *resty.Request)

func ForceContentType

func ForceContentType(contentType string) RequestFunc

func SetBody

func SetBody(body interface{}) RequestFunc

func SetHeader

func SetHeader(header, value string) RequestFunc

func SetQueryParam

func SetQueryParam(param, value string) RequestFunc

func SetQueryParams

func SetQueryParams(params map[string]string) RequestFunc

func SetQueryParamsFromValues

func SetQueryParamsFromValues(params url.Values) RequestFunc

func SetResult

func SetResult(res interface{}) RequestFunc

Jump to

Keyboard shortcuts

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