traffic

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, path string, resp any, options ...RequestOption) error

func MustInit

func MustInit(conf *config.Config, options ...Option)

func PostJSON

func PostJSON(ctx context.Context, path string, req any, resp any, options ...RequestOption) error

func PostUrlEncodeForm

func PostUrlEncodeForm(ctx context.Context, path string, req Former, resp any) error

func UploadImage

func UploadImage(ctx context.Context, path string, form MultiPartForm, resp any, options ...RequestOption) error

func WithAccessTokenHeader

func WithAccessTokenHeader(token string) func(*resty.Request)

func WithHeaders

func WithHeaders(headers map[string]string) func(*resty.Request)

func WithOpenIdQueryParam

func WithOpenIdQueryParam(openId string) func(*resty.Request)

func WithQueryParams

func WithQueryParams(params map[string]string) func(*resty.Request)

Types

type Former

type Former interface {
	IntoForm() map[string]string
}

type MultiPartForm

type MultiPartForm struct {
	Param    string
	Filename string
	Reader   io.Reader
}

func NewImageUploadForm

func NewImageUploadForm(filename string, reader io.Reader) MultiPartForm

type Option

type Option func(c *client)

func WithClient

func WithClient(httpClient *http.Client) Option

type RequestOption

type RequestOption func(*resty.Request)

Jump to

Keyboard shortcuts

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