client

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Signature added in v1.3.0

func Signature(client *Client) resty.RequestMiddleware

Signature a example of RequestMiddleware sign algorithm:md5(query params + body + secret + timestamp + nonce) Notice:stuff body only when HTTP METHOD is not GET. Encode query params to `"bar=baz&foo=quux"` sorted by key in any case

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client http client

func New

func New(config *config.ClientConfig) *Client

New return a http client

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, req *Request, reply interface{}) (err error)

Delete http delete request Notice that Delete only applied to JSON and XML response MIME type

func (*Client) Get

func (c *Client) Get(ctx context.Context, req *Request, reply interface{}) (err error)

Get http get request Notice that Get only applied to JSON and XML response MIME type

func (*Client) Post

func (c *Client) Post(ctx context.Context, req *Request, reply interface{}) (err error)

Post http post request Notice that Post only applied to JSON and XML response MIME type

func (*Client) Put

func (c *Client) Put(ctx context.Context, req *Request, reply interface{}) (err error)

Put http put request Notice that Put only applied to JSON and XML response MIME type

func (*Client) RawDelete added in v1.3.0

func (c *Client) RawDelete(ctx context.Context, req *Request) (reply []byte, err error)

RawDelete http delete request and return response body raw byte

func (*Client) RawGet added in v1.3.0

func (c *Client) RawGet(ctx context.Context, req *Request) (reply []byte, err error)

RawGet http get request and return response body raw byte

func (*Client) RawPost added in v1.3.0

func (c *Client) RawPost(ctx context.Context, req *Request) (reply []byte, err error)

RawPost http post request and return response body raw byte

func (*Client) RawPut added in v1.3.0

func (c *Client) RawPut(ctx context.Context, req *Request) (reply []byte, err error)

RawPut http put request and return response body raw byte

func (*Client) Use added in v1.3.0

func (c *Client) Use(m RequestMiddleware) *Client

Use set client request middleware

type Request

type Request struct {
	URI        string
	QueryParam url.Values
	Body       interface{}
	PathParam  map[string]string
	Headers    map[string]string
}

Request request params

type RequestMiddleware added in v1.3.0

type RequestMiddleware func(client *Client) resty.RequestMiddleware

RequestMiddleware http request middleware

Jump to

Keyboard shortcuts

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