Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.2.0

type Client struct {
	*client.Client
	*Option
}

func New

func New(url string, options ...OptionFunc) (x *Client, err error)

New 创建

func (*Client) GetCities added in v0.2.0

func (x *Client) GetCities(ctx context.Context, country string, state string, fields []string) (data []model.City, err error)

func (*Client) GetCountries added in v0.2.0

func (x *Client) GetCountries(ctx context.Context, fields []string) (data []model.Country, err error)

func (*Client) GetIp added in v0.2.0

func (x *Client) GetIp(ctx context.Context, ip string) (data M, err error)

GetIp 获取 Ip

func (*Client) GetStates added in v0.2.0

func (x *Client) GetStates(ctx context.Context, country string, fields []string) (data []model.State, err error)

func (*Client) Ping added in v0.2.0

func (x *Client) Ping(ctx context.Context) (result M, err error)

Ping 测试

func (*Client) R added in v0.2.0

func (x *Client) R(method string, path string) *OpenAPI

R 创建请求

type M added in v0.2.0

type M = map[string]interface{}

type OpenAPI

type OpenAPI struct {
	Client *Client
	Method string
	Path   string
	Header map[string]string
	Query  url.Values
	Body   []byte
}

func (*OpenAPI) Send added in v0.2.0

func (x *OpenAPI) Send(ctx context.Context) (resp *protocol.Response, err error)

func (*OpenAPI) SetAuthorization

func (x *OpenAPI) SetAuthorization() string

func (*OpenAPI) SetData added in v0.2.0

func (x *OpenAPI) SetData(v interface{}) *OpenAPI

func (*OpenAPI) SetHeaders added in v0.2.0

func (x *OpenAPI) SetHeaders(v map[string]string) *OpenAPI

func (*OpenAPI) SetQuery added in v0.2.0

func (x *OpenAPI) SetQuery(v url.Values) *OpenAPI

type Option

type Option struct {
	Url    string
	Key    string
	Secret string
}

type OptionFunc

type OptionFunc func(x *Client)

func SetApiGateway added in v0.2.0

func SetApiGateway(key string, secret string) OptionFunc

SetApiGateway 设置网关认证 https://cloud.tencent.com/document/product/628/55088

Jump to

Keyboard shortcuts

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