httplib

package
v0.0.0-...-503ec33 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthSign

type AuthSign interface {
	Sign(req *http.Request) error
}

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

func (*BasicAuth) Sign

func (auth *BasicAuth) Sign(r *http.Request) error

type BearerTokenAuth

type BearerTokenAuth struct {
	Token string
}

func (*BearerTokenAuth) Sign

func (auth *BearerTokenAuth) Sign(r *http.Request) error

type Client

type Client struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseUrl string, timeout time.Duration) (*Client, error)

func (*Client) Clone

func (c *Client) Clone() Client

func (*Client) Delete

func (c *Client) Delete(reqUrl string, res interface{}, params ...map[string]string) (resp *http.Response, err error)

func (*Client) Do

func (c *Client) Do(method, reqUrl string, data, res interface{}, params ...map[string]string) (resp *http.Response, err error)

func (*Client) Get

func (c *Client) Get(reqUrl string, res interface{}, params ...map[string]string) (resp *http.Response, err error)

func (*Client) Patch

func (c *Client) Patch(reqUrl string, data interface{}, res interface{}, params ...map[string]string) (resp *http.Response, err error)

func (*Client) Post

func (c *Client) Post(reqUrl string, data interface{}, res interface{}, params ...map[string]string) (resp *http.Response, err error)

func (*Client) PostFileWithFields

func (c *Client) PostFileWithFields(reqUrl string, gFile string, fields map[string]string, res interface{}) error

func (*Client) Put

func (c *Client) Put(reqUrl string, data interface{}, res interface{}, params ...map[string]string) (resp *http.Response, err error)

func (*Client) SetAuthSign

func (c *Client) SetAuthSign(auth AuthSign)

func (*Client) SetCookie

func (c *Client) SetCookie(key string, value string)

func (*Client) SetHeader

func (c *Client) SetHeader(key, value string)

func (*Client) UploadFile

func (c *Client) UploadFile(reqUrl string, gFile string, res interface{}, params ...map[string]string) (err error)

type SigAuth

type SigAuth struct {
	KeyID    string
	SecretID string
}

func (*SigAuth) Sign

func (auth *SigAuth) Sign(r *http.Request) error

Jump to

Keyboard shortcuts

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