model

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package model API models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	// RequestID .
	RequestID string `json:"request_id,omitempty" xml:"request_id,omitempty"`
}

BaseResponse .

type CommonRequest

type CommonRequest struct {
	// Type API接口名,形如:pdd.*
	Type string `json:"type,omitempty"`
	// ClientID 已创建成功的应用标志client_id,可在应用详情和中查看
	ClientID string `json:"client_id,omitempty"`
	// Sign API入参参数签名,签名值根据如下算法给出计算过程
	Sign string `json:"sign,omitempty"`
	// AccessToken 用户授权令牌access_token,通过pdd.pop.auth.token.create获取
	AccessToken string `json:"access_token,omitempty"`
	// Version API版本,默认为V1,无要求不传此参数
	Version string `json:"version,omitempty"`
	// DataType 请求返回的数据格式,可选参数为XML或JSON,默认为JSON
	DataType RequestDataType `json:"data_type,omitempty"`
	// Timestamp 时间戳,格式为UNIX时间(秒)
	Timestamp int64 `json:"timestamp,omitempty"`
}

CommonRequest 请求公共参数

func (CommonRequest) GetType

func (r CommonRequest) GetType() string

GetType implement Request interface

type CommonResponse

type CommonResponse struct {
	ErrorResponse *ErrorResponse `json:"error_response,omitempty" xml:"error_response,omitempty"`
}

CommonResponse API Response

func (CommonResponse) Error

func (r CommonResponse) Error() error

Error returns response error

func (CommonResponse) IsError

func (r CommonResponse) IsError() bool

IsError 判断Response是否Error

type ErrorResponse

type ErrorResponse struct {
	BaseResponse
	ErrorCode int    `json:"error_code" xml:"error_code"`
	ErrorMsg  string `json:"error_msg" xml:"error_msg"`
	SubMsg    string `json:"sub_msg" xml:"sub_msg"`
	SubCode   string `json:"sub_code" xml:"sub_code"`
}

ErrorResponse Response Error

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

Error implement Error interface

type Int added in v1.1.23

type Int int

Int support string quoted number in json

func (*Int) UnmarshalJSON added in v1.1.23

func (i32 *Int) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implement json Unmarshal interface

func (Int) Value added in v1.1.23

func (i32 Int) Value() int

type Request

type Request interface {
	GetType() string
}

Request 请求

type RequestDataType

type RequestDataType string

RequestDataType 请求返回的数据格式,可选参数为XML或JSON,默认为JSON

const (
	// RequestDataType_JSON 返回JSON格式
	RequestDataType_JSON RequestDataType = "JSON"
	// RequestDataType_XML 返回X M Lg格式
	RequestDataType_XML RequestDataType = "XML"
)

type Response

type Response interface {
	IsError() bool
	Error() error
}

Response 请求返回

type Uint64 added in v1.1.23

type Uint64 uint64

Uint64 support string quoted number in json

func (*Uint64) UnmarshalJSON added in v1.1.23

func (u64 *Uint64) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implement json Unmarshal interface

func (Uint64) Value added in v1.1.23

func (u64 Uint64) Value() uint64

type UploadField added in v1.1.6

type UploadField struct {
	// Reader upload file reader
	Reader io.Reader
	// Key field key
	Key string
	// Value field value
	Value string
}

UploadField multipart/form-data post request field struct

type UploadRequest added in v1.1.6

type UploadRequest interface {
	// Encode encode request to UploadFields
	Encode() []UploadField
	GetType() string
}

UploadRequest multipart/form-data reqeust interface

Jump to

Keyboard shortcuts

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