Documentation ¶
Index ¶
- Constants
- Variables
- type AccessToken
- type BaseDoudianOpApiRequest
- type BaseDoudianOpApiResponse
- type BaseDoudianOpSpiRequest
- func (b *BaseDoudianOpSpiRequest) Execute() (interface{}, error)
- func (b *BaseDoudianOpSpiRequest) GetBizHandler() BizHandler
- func (b *BaseDoudianOpSpiRequest) GetClient() DoudianOpSpiClient
- func (b *BaseDoudianOpSpiRequest) GetConfig() *DoudianOpConfig
- func (b *BaseDoudianOpSpiRequest) GetParamJsonObject() interface{}
- func (b *BaseDoudianOpSpiRequest) GetResponseObject() interface{}
- func (b *BaseDoudianOpSpiRequest) GetSpiParam() *DoudianOpSpiParam
- func (b *BaseDoudianOpSpiRequest) RegisterHandler(bizHandler BizHandler)
- func (b *BaseDoudianOpSpiRequest) ResponseJson() (string, error)
- func (b *BaseDoudianOpSpiRequest) SetClient(client DoudianOpSpiClient)
- func (b *BaseDoudianOpSpiRequest) SetConfig(config *DoudianOpConfig)
- func (b *BaseDoudianOpSpiRequest) SetSpiParam(spiParam *DoudianOpSpiParam)
- type BaseDoudianOpSpiResponse
- type BizHandler
- type BuildAccessTokenParam
- type CreateTokenData
- type CreateTokenParam
- type CreateTokenRequest
- type CreateTokenResponse
- type DoudianOpApiClient
- type DoudianOpApiRequest
- type DoudianOpConfig
- type DoudianOpSpiClient
- type DoudianOpSpiClientImpl
- type DoudianOpSpiContext
- type DoudianOpSpiParam
- type DoudianOpSpiRequest
- type DoudianOpSpiResponse
- type RefreshAccessTokenParam
- type RefreshTokenParam
- type RefreshTokenRequest
- type SpiConfigurator
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 (r *BaseDoudianOpApiRequest) GetClient() *DoudianOpApiClient
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 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 (b *BaseDoudianOpSpiRequest) GetClient() DoudianOpSpiClient
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 ¶
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 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 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 RefreshAccessTokenParam ¶
type RefreshAccessTokenParam struct { RefreshToken string Config *DoudianOpConfig }
type RefreshTokenParam ¶
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)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.