sdk

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_VERSION       = "2.0"
	GATEWAY_URL       = "https://api.jd.com/routerjson"
	GATEWAY_DEV_URL   = "https://api-dev.jd.com/routerjson"
	LOG_GATEWAY_URL   = "https://api-log.jd.com/routerjson"
	UNION_GATEWAY_URL = "https://api.jd.com/routerjson"
)

Variables

This section is empty.

Functions

func GetOauthURL

func GetOauthURL(appKey, rURI, state, scope string) string

func Json

func Json(obj interface{}) []byte

Types

type Client

type Client struct {
	AppKey    string
	SecretKey string

	Dev   bool
	Debug bool
}

func NewClient

func NewClient(appKey string, secretKey string) *Client

create new client

func (*Client) Execute

func (c *Client) Execute(req *Request, token string) (result []byte, err error)

func (*Client) GenerateRawSign

func (c *Client) GenerateRawSign(params map[string]string) string

func (*Client) GenerateSign

func (c *Client) GenerateSign(stringToBeSigned string) string

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(code, state, redirectUri string) (string, error)

func (*Client) GetAccessTokenNew

func (c *Client) GetAccessTokenNew(code string) (string, error)

func (*Client) Logger

func (c *Client) Logger() logger.Logger

func (*Client) PostExecute

func (c *Client) PostExecute(req *Request, token string) (result []byte, err error)

func (*Client) SetDev

func (c *Client) SetDev(dev bool)

type Error

type Error struct {
	Code    int
	SubCode string
	Msg     string
	SubMsg  string
}

func (Error) Error

func (e Error) Error() string

type Request

type Request struct {
	MethodName string
	Params     map[string]interface{}
	IsLogGW    bool `json:"-"`
	IsUnionGW  bool `json:"-"`
}

type Response

type Response struct {
	MethodName string
	Params     map[string]interface{}
}

Jump to

Keyboard shortcuts

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