taobao

package
v0.0.0-...-f2c966f Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCEPT_ENCODING             = "Accept-Encoding"
	APP_KEY                     = "app_key"
	CALL_TYPE_OAPI              = "oapi"
	CALL_TYPE_TOP               = "top"
	CHARSET_GBK                 = "GBK"
	CHARSET_UTF8                = "UTF-8"
	CONTENT_ENCODING            = "Content-Encoding"
	CONTENT_ENCODING_GZIP       = "gzip"
	CONTENT_TYPE_FORM           = "form"
	CONTENT_TYPE_JSON           = "json"
	CONTENT_TYPE_XML            = "xml"
	CTYPE_APPLICATION_XML       = "application/xml"
	CTYPE_APP_JSON              = "application/json"
	CTYPE_FILE_UPLOAD           = "multipart/form-data"
	CTYPE_FORM_DATA             = "application/x-www-form-urlencoded"
	CTYPE_TEXT_PLAIN            = "text/plain"
	CTYPE_TEXT_XML              = "text/xml"
	DATE_TIMEZONE               = "GMT+8"
	DATE_TIME_FORMAT            = "2006-01-02 15:04:05"
	ERROR_CODE                  = "code"
	ERROR_MSG                   = "msg"
	ERROR_RESPONSE              = "error_response"
	ERROR_SUB_CODE              = "sub_code"
	ERROR_SUB_MSG               = "sub_msg"
	FORMAT                      = "format"
	FORMAT_JSON                 = "json"
	FORMAT_JSON2                = "json2"
	FORMAT_XML                  = "xml"
	FORMAT_XML2                 = "xml2"
	METHOD                      = "method"
	METHOD_GET                  = "GET"
	METHOD_POST                 = "POST"
	MIME_TYPE_DEFAULT           = "application/octet-stream"
	PARTNER_ID                  = "partner_id"
	QIMEN_CLOUD_ERROR_RESPONSE  = "response"
	QIMEN_SDK_VERSION_HTTPDNS   = "top-qimen-sdk-java-httpdns"
	QM_CONTENT_TYPE             = "text/xml;charset=utf-8"
	QM_CONTENT_TYPE_JSON        = "application/json;charset=utf-8"
	QM_CUSTOMER_ID              = "customerId"
	QM_ROOT_TAG                 = "request"
	READ_BUFFER_SIZE            = 4096
	RESPONSE_TYPE_DINGTALK_OAPI = "dingtalk"
	RESPONSE_TYPE_QIMEN         = "qimen1"
	RESPONSE_TYPE_QIMEN2        = "qimen2"
	RESPONSE_TYPE_TOP           = "top"
	SDK_VERSION                 = "top-sdk-java-20210126"
	SDK_VERSION_CLUSTER         = "top-sdk-java-cluster-20210126"
	SDK_VERSION_HTTPDNS         = "top-sdk-java-httpdns-20210126"
	SESSION                     = "session"
	SIGN                        = "sign"
	SIGN_METHOD                 = "sign_method"
	SIGN_METHOD_HMAC            = "hmac"
	SIGN_METHOD_HMAC_SHA256     = "hmac-sha256"
	SIGN_METHOD_MD5             = "md5"
	SIMPLIFY                    = "simplify"
	TARGET_APP_KEY              = "target_app_key"
	TIMESTAMP                   = "timestamp"
	TOP_HTTP_DNS_HOST           = "TOP_HTTP_DNS_HOST"
	VERSION                     = "v"
)
View Source
const (
	CONFIRM_ATTACH_QUEUE       = "queue"
	CONFIRM_ID                 = "id"
	DATA_ATTACH_OUTGOING_TIME  = "outtime"
	DATA_CONTENT               = "content"
	DATA_DATAID                = "dataid"
	DATA_INCOMING_USER_SESSION = "session"
	DATA_OUTGOING_PUBLISHER    = "publisher"
	DATA_OUTGOING_USER_ID      = "userid"
	DATA_OUTGOING_USER_NICK    = "nick"
	DATA_PUBLISH_TIME          = "time"
	DATA_TOPIC                 = "topic"
	KIND                       = "__kind"
	MSG                        = "msg"
	OUTGOING_ID                = "id"
)

MessageFields

View Source
const (
	DEFAULT_CHARSET = "UTF-8"
)

Variables

This section is empty.

Functions

func OpenDebug

func OpenDebug(maxDebugBody int)

Types

type ApiRuleError

type ApiRuleError struct {
	ErrCode    string
	ErrMsg     string
	SubErrCode string
	SubErrMsg  string
}

func (*ApiRuleError) Error

func (are *ApiRuleError) Error() string

type HttpResponse

type HttpResponse struct {
	Header map[string]string
	Body   []byte
	Code   int
}

func DoGet

func DoGet(url string, params map[string]string, timeout time.Duration) (*HttpResponse, error)

func DoPost

func DoPost(url string, timeout time.Duration, params, header map[string]string) (*HttpResponse, error)

func DoPostWithJson

func DoPostWithJson(url string, params map[string]interface{}, timeout time.Duration) (*HttpResponse, error)

type SetResponse

type SetResponse interface {
	SetResponse(req TaobaoRequest, resp *HttpResponse) error
}

type SimpleResponse

type SimpleResponse struct{}

func (*SimpleResponse) SetResponse

func (ssr *SimpleResponse) SetResponse(req TaobaoRequest, resp *HttpResponse) error

type SimpleTaobaoRequest

type SimpleTaobaoRequest struct{}

func (*SimpleTaobaoRequest) Check

func (str *SimpleTaobaoRequest) Check() *ApiRuleError

func (*SimpleTaobaoRequest) GetApiMethodName

func (str *SimpleTaobaoRequest) GetApiMethodName() string

func (*SimpleTaobaoRequest) GetBatchApiOrder

func (str *SimpleTaobaoRequest) GetBatchApiOrder() int

func (*SimpleTaobaoRequest) GetBatchApiSession

func (str *SimpleTaobaoRequest) GetBatchApiSession() string

func (*SimpleTaobaoRequest) GetHeaderMap

func (str *SimpleTaobaoRequest) GetHeaderMap() map[string]string

func (*SimpleTaobaoRequest) GetRespInstance

func (str *SimpleTaobaoRequest) GetRespInstance() interface{}

func (*SimpleTaobaoRequest) GetTaobaoResp

func (str *SimpleTaobaoRequest) GetTaobaoResp() *TaobaoResponse

func (*SimpleTaobaoRequest) GetTargetAppKey

func (str *SimpleTaobaoRequest) GetTargetAppKey() string

func (*SimpleTaobaoRequest) GetTextParams

func (str *SimpleTaobaoRequest) GetTextParams() map[string]interface{}

func (*SimpleTaobaoRequest) GetTimestamp

func (str *SimpleTaobaoRequest) GetTimestamp() int64

func (*SimpleTaobaoRequest) GetTopApiCallType

func (str *SimpleTaobaoRequest) GetTopApiCallType() string

func (*SimpleTaobaoRequest) GetTopApiFormat

func (str *SimpleTaobaoRequest) GetTopApiFormat() string

func (*SimpleTaobaoRequest) GetTopApiVersion

func (str *SimpleTaobaoRequest) GetTopApiVersion() string

func (*SimpleTaobaoRequest) GetTopContentType

func (str *SimpleTaobaoRequest) GetTopContentType() string

func (*SimpleTaobaoRequest) GetTopHttpMethod

func (str *SimpleTaobaoRequest) GetTopHttpMethod() string

func (*SimpleTaobaoRequest) GetTopResponseType

func (str *SimpleTaobaoRequest) GetTopResponseType() string

func (*SimpleTaobaoRequest) SetBatchApiOrder

func (str *SimpleTaobaoRequest) SetBatchApiOrder(i int)

func (*SimpleTaobaoRequest) SetBatchApiSession

func (str *SimpleTaobaoRequest) SetBatchApiSession(s string)

func (*SimpleTaobaoRequest) SetTopApiCallType

func (str *SimpleTaobaoRequest) SetTopApiCallType(s string)

func (*SimpleTaobaoRequest) SetTopApiFormat

func (str *SimpleTaobaoRequest) SetTopApiFormat(s string)

func (*SimpleTaobaoRequest) SetTopApiVersion

func (str *SimpleTaobaoRequest) SetTopApiVersion(s string)

func (*SimpleTaobaoRequest) SetTopContentType

func (str *SimpleTaobaoRequest) SetTopContentType(s string)

func (*SimpleTaobaoRequest) SetTopHttpMethod

func (str *SimpleTaobaoRequest) SetTopHttpMethod(s string)

func (*SimpleTaobaoRequest) SetTopResponseType

func (str *SimpleTaobaoRequest) SetTopResponseType(s string)

type TaobaoRequest

type TaobaoRequest interface {
	Check() *ApiRuleError
	GetApiMethodName() string
	GetBatchApiOrder() int
	GetBatchApiSession() string
	GetHeaderMap() map[string]string
	GetTargetAppKey() string
	GetTextParams() map[string]interface{}
	GetTimestamp() int64
	GetTopApiCallType() string
	GetTopApiFormat() string
	GetTopApiVersion() string
	GetTopContentType() string
	GetTopHttpMethod() string
	GetTopResponseType() string
	SetBatchApiOrder(i int)
	SetBatchApiSession(str string)
	SetTopApiCallType(str string)
	SetTopApiFormat(str string)
	SetTopApiVersion(str string)
	SetTopContentType(str string)
	SetTopHttpMethod(str string)
	SetTopResponseType(str string)

	// Response
	GetRespInstance() interface{}
	GetTaobaoResp() *TaobaoResponse
}

type TaobaoResponse

type TaobaoResponse struct {
	// http info
	Code          string            `json:"-"`
	HeaderContent map[string]string `json:"-"`
	Body          string            `json:"-"`

	// common info
	ErrCode   int    `json:"errcode"`
	ErrMsg    string `json:"errmsg"`
	RequestId string `json:"requsestid"`
}

func (*TaobaoResponse) IsSuccess

func (tr *TaobaoResponse) IsSuccess() bool

type TaobaoUploadRequest

type TaobaoUploadRequest interface {
	TaobaoRequest
	GetFileParams() map[string]os.File
}

Jump to

Keyboard shortcuts

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