doudian_sdk

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: MulanPSL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DoudianSdkVersion = "doudian-sdk-golang-1.1.0"

Variables

View Source
var DefaultDoudianOpSpiClient = NewDefaultDoudianOpSpiClient()

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	CreateTokenData
	// contains filtered or unexported fields
}

func BuildAccessToken

func BuildAccessToken(param *BuildAccessTokenParam) (*AccessToken, error)

func ParseAccessToken

func ParseAccessToken(accessTokenStr string) *AccessToken

func RefreshAccessToken

func RefreshAccessToken(param *RefreshAccessTokenParam) (*AccessToken, error)

func (*AccessToken) IsSuccess

func (at *AccessToken) IsSuccess() bool

type BaseDoudianOpApiRequest

type BaseDoudianOpApiRequest struct {
	// contains filtered or unexported fields
}

func (*BaseDoudianOpApiRequest) GetClient

func (*BaseDoudianOpApiRequest) GetConfig

func (r *BaseDoudianOpApiRequest) GetConfig() *DoudianOpConfig

func (*BaseDoudianOpApiRequest) SetClient

func (r *BaseDoudianOpApiRequest) SetClient(client *DoudianOpApiClient)

func (*BaseDoudianOpApiRequest) SetConfig

func (r *BaseDoudianOpApiRequest) SetConfig(config *DoudianOpConfig)

type BaseDoudianOpApiResponse

type BaseDoudianOpApiResponse struct {
	LogId string `json:"log_id"`

	Code int64 `json:"code"`

	Msg string `json:"msg"`

	SubCode string `json:"sub_code"`

	SubMsg string `json:"sub_msg"`
}

type BaseDoudianOpSpiRequest

type BaseDoudianOpSpiRequest struct {
	// contains filtered or unexported fields
}

func (*BaseDoudianOpSpiRequest) Execute

func (b *BaseDoudianOpSpiRequest) Execute() (interface{}, error)

func (*BaseDoudianOpSpiRequest) GetBizHandler

func (b *BaseDoudianOpSpiRequest) GetBizHandler() BizHandler

func (*BaseDoudianOpSpiRequest) GetClient

func (*BaseDoudianOpSpiRequest) GetConfig

func (b *BaseDoudianOpSpiRequest) GetConfig() *DoudianOpConfig

func (*BaseDoudianOpSpiRequest) GetParamJsonObject

func (b *BaseDoudianOpSpiRequest) GetParamJsonObject() interface{}

func (*BaseDoudianOpSpiRequest) GetResponseObject

func (b *BaseDoudianOpSpiRequest) GetResponseObject() interface{}

func (*BaseDoudianOpSpiRequest) GetSpiParam

func (b *BaseDoudianOpSpiRequest) GetSpiParam() *DoudianOpSpiParam

func (*BaseDoudianOpSpiRequest) RegisterHandler

func (b *BaseDoudianOpSpiRequest) RegisterHandler(bizHandler BizHandler)

func (*BaseDoudianOpSpiRequest) ResponseJson

func (b *BaseDoudianOpSpiRequest) ResponseJson() (string, error)

func (*BaseDoudianOpSpiRequest) SetClient

func (b *BaseDoudianOpSpiRequest) SetClient(client DoudianOpSpiClient)

func (*BaseDoudianOpSpiRequest) SetConfig

func (b *BaseDoudianOpSpiRequest) SetConfig(config *DoudianOpConfig)

func (*BaseDoudianOpSpiRequest) SetSpiParam

func (b *BaseDoudianOpSpiRequest) SetSpiParam(spiParam *DoudianOpSpiParam)

type BaseDoudianOpSpiResponse

type BaseDoudianOpSpiResponse struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

func (*BaseDoudianOpSpiResponse) SetCode

func (b *BaseDoudianOpSpiResponse) SetCode(code int64)

func (*BaseDoudianOpSpiResponse) SetMessage

func (b *BaseDoudianOpSpiResponse) SetMessage(message string)

type BizHandler

type BizHandler func(context *DoudianOpSpiContext)

type BuildAccessTokenParam

type BuildAccessTokenParam struct {
	Code   string
	ShopId int64
	Config *DoudianOpConfig
}

type CreateTokenData

type CreateTokenData struct {

	//用于调用API的access_token
	//过期时间为expires_in值
	//可通过refresh_token刷新获取新的access_token,过期时间仍为expires_in值
	AccessToken string `json:"access_token"`

	//access_token接口调用凭证超时时间,单位(秒),默认有效期:7天
	ExpiresIn int64 `json:"expires_in"`

	//授权作用域,使用逗号,分隔。预留字段
	Scope string `json:"scope"`

	//店铺ID
	ShopId string `json:"shop_id"`

	//店铺名称
	ShopName string `json:"shop_name"`

	//用于刷新access_token的刷新令牌(有效期:14 天)
	RefreshToken string `json:"refresh_token"`

	//授权主体id
	AuthorityId string `json:"authority_id"`
}

type CreateTokenParam

type CreateTokenParam struct {
	Code string `json:"code"`

	GrantType string `json:"grant_type"`

	ShopId int64 `json:"shop_id"`
}

type CreateTokenRequest

type CreateTokenRequest struct {
	BaseDoudianOpApiRequest
	// contains filtered or unexported fields
}

func NewCreateTokenRequest

func NewCreateTokenRequest() *CreateTokenRequest

func (*CreateTokenRequest) Execute

func (r *CreateTokenRequest) Execute(accessToken *AccessToken) (*CreateTokenResponse, error)

func (*CreateTokenRequest) GetParamObject

func (r *CreateTokenRequest) GetParamObject() interface{}

func (*CreateTokenRequest) GetParams

func (r *CreateTokenRequest) GetParams() *CreateTokenParam

func (*CreateTokenRequest) GetUrlPath

func (r *CreateTokenRequest) GetUrlPath() string

type CreateTokenResponse

type CreateTokenResponse struct {
	BaseDoudianOpApiResponse
	Data CreateTokenData `json:"data"`
}

type DoudianOpApiClient

type DoudianOpApiClient struct{}
var DefaultDoudianOpApiClient *DoudianOpApiClient = NewDoudianOpApiClient()

func NewDoudianOpApiClient

func NewDoudianOpApiClient() *DoudianOpApiClient

func (*DoudianOpApiClient) Request

func (client *DoudianOpApiClient) Request(request DoudianOpApiRequest, accessToken *AccessToken) (string, error)

type DoudianOpApiRequest

type DoudianOpApiRequest interface {
	GetConfig() *DoudianOpConfig
	SetConfig(config *DoudianOpConfig)
	GetParamObject() interface{}
	GetUrlPath() string
}

type DoudianOpConfig

type DoudianOpConfig struct {
	AppKey          string
	AppSecret       string
	HttpReadTimeout int64
	OpenRequestUrl  string
}
var GlobalConfig *DoudianOpConfig = NewDoudianOpConfig()

func NewDoudianOpConfig

func NewDoudianOpConfig() *DoudianOpConfig

type DoudianOpSpiClient

type DoudianOpSpiClient interface {
	Request(request DoudianOpSpiRequest) (interface{}, error)
}

func NewDefaultDoudianOpSpiClient

func NewDefaultDoudianOpSpiClient() DoudianOpSpiClient

type DoudianOpSpiClientImpl

type DoudianOpSpiClientImpl struct {
}

func (*DoudianOpSpiClientImpl) Request

func (c *DoudianOpSpiClientImpl) Request(request DoudianOpSpiRequest) (interface{}, error)

type DoudianOpSpiContext

type DoudianOpSpiContext struct {
	// contains filtered or unexported fields
}

func (*DoudianOpSpiContext) GetData

func (c *DoudianOpSpiContext) GetData() interface{}

func (*DoudianOpSpiContext) GetParamObject

func (c *DoudianOpSpiContext) GetParamObject() interface{}

func (*DoudianOpSpiContext) WrapError

func (c *DoudianOpSpiContext) WrapError(code int64, message string)

func (*DoudianOpSpiContext) WrapSuccess

func (c *DoudianOpSpiContext) WrapSuccess()

type DoudianOpSpiParam

type DoudianOpSpiParam struct {
	AppKey string

	Timestamp string

	Sign string

	SignV2 string

	SignMethod string

	ParamJson string
}

type DoudianOpSpiRequest

type DoudianOpSpiRequest interface {
	GetSpiParam() *DoudianOpSpiParam
	GetConfig() *DoudianOpConfig
	GetResponseObject() interface{}
	GetParamJsonObject() interface{}
	GetBizHandler() BizHandler
	Execute() (interface{}, error)
	ResponseJson() (string, error)
	RegisterHandler(bizHandler BizHandler)
}

type DoudianOpSpiResponse

type DoudianOpSpiResponse interface {
	GetData() interface{}
	SetCode(code int64)
	SetMessage(message string)
}

type RefreshAccessTokenParam

type RefreshAccessTokenParam struct {
	RefreshToken string
	Config       *DoudianOpConfig
}

type RefreshTokenParam

type RefreshTokenParam struct {
	GrantType string `json:"grant_type"`

	RefreshToken string `json:"refresh_token"`
}

type RefreshTokenRequest

type RefreshTokenRequest struct {
	BaseDoudianOpApiRequest
	// contains filtered or unexported fields
}

func NewRefreshTokenRequest

func NewRefreshTokenRequest() *RefreshTokenRequest

func (*RefreshTokenRequest) Execute

func (r *RefreshTokenRequest) Execute(accessToken *AccessToken) (*CreateTokenResponse, error)

func (*RefreshTokenRequest) GetParam

func (r *RefreshTokenRequest) GetParam() *RefreshTokenParam

func (*RefreshTokenRequest) GetParamObject

func (r *RefreshTokenRequest) GetParamObject() interface{}

func (*RefreshTokenRequest) GetUrlPath

func (r *RefreshTokenRequest) GetUrlPath() string

type SpiConfigurator

type SpiConfigurator struct {
	// contains filtered or unexported fields
}

func ConfigSpiWithParam

func ConfigSpiWithParam(request DoudianOpSpiRequest, handler BizHandler, spiParam *DoudianOpSpiParam) *SpiConfigurator

func ConfigSpiWithUrlQuery

func ConfigSpiWithUrlQuery(request DoudianOpSpiRequest, handler BizHandler, queryString string, body io.Reader) *SpiConfigurator

func (*SpiConfigurator) ResponseJson

func (c *SpiConfigurator) ResponseJson() (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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