yeeAlidayu

package
v0.0.0-...-89bd919 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 正式的http请求接口
	ProHTTPGateWayURL string = "http://gw.api.taobao.com/router/rest"
	// 沙箱http请求接口
	DebugHTTPGateWayURL string = "http://gw.api.tbsandbox.com/router/rest"
	// 正式的https请求接口
	ProHTTPSGateWayURL string = "https://eco.taobao.com/router/rest"
	// 沙箱的https请求接口
	DebugHTTPSGateWayURL string = "https://gw.api.tbsandbox.com/router/rest"
)
View Source
const (
	ParamsMissError     = -1
	NewRequestError     = -2
	ClientDoError       = -3
	HTTPStatusCodeError = -4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// 是否是调试环境,调试环境,调用沙箱环境
	Debug bool
	// 是否调用https请求
	HTTPS bool
	// TOP分配给应用的AppKey
	AppKey string
	// AppSecret
	AppSecret string
	// 请求的地址
	GateWayURL string
	// 响应格式。接口不传默认为xml格式,可选值:xml,json。
	// 本sdk默认为json格式
	Format string

	// API协议版本,
	// 默认:2.0。
	ApiVersion string
	// contains filtered or unexported fields
}

Client 是为了可以同时支持多个appkey,可以通过多个client完成请求

func DefaultClient

func DefaultClient(debug, https bool, appKey, appSecret, gateWayURL string) *Client

DefaultClient 生成一个默认的client

func (*Client) Execute

func (c *Client) Execute(request request.BaseRequest) (res Result)

Execute 执行对应请求

type ErrorResponse

type ErrorResponse struct {
	Code      int    `json:"code"`
	Msg       string `json:"msg"`
	SubCode   string `json:"sub_code"`
	SubMsg    string `json:"sub_msg"`
	RequestID string `json:"request_id"`
}

type Response

type Response struct {
	Res ErrorResponse `json:"error_response"`
}

type Result

type Result struct {
	Code     int
	Msg      string
	Response string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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