client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAPI

type OpenAPI struct {
	Client *resty.Client
	*Option
}

func New

func New(url string, options ...OptionFunc) *OpenAPI

New 新建客户端

func (*OpenAPI) GeoCountries added in v0.1.0

func (x *OpenAPI) GeoCountries(ctx context.Context, fields []string) (result []model.Country, err error)

func (*OpenAPI) GetCities added in v0.1.0

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

func (*OpenAPI) GetStates added in v0.1.0

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

func (*OpenAPI) Ip added in v0.1.0

func (x *OpenAPI) Ip(ctx context.Context, ip string) (result map[string]interface{}, err error)

func (*OpenAPI) Ping

func (x *OpenAPI) Ping(ctx context.Context) (result map[string]interface{}, err error)

Ping 测试

func (*OpenAPI) R

func (x *OpenAPI) R(method string, path string) *resty.Request

R 创建请求

func (*OpenAPI) SetAuthorization

func (x *OpenAPI) SetAuthorization(req *resty.Request)

SetAuthorization 设置应用认证

type Option

type Option struct {
	Key    string
	Secret string
}

type OptionFunc

type OptionFunc func(x *OpenAPI)

func SetCertification

func SetCertification(key string, secret string) OptionFunc

SetCertification 设置认证

Jump to

Keyboard shortcuts

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