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

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