sdk

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 14 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 ErrorString added in v1.1.3

func ErrorString[T int | int64 | string](code T, msg string) string

func GetBufferPool added in v1.1.3

func GetBufferPool() *bytes.Buffer

func GetOauthURL

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

func GetStringsBuilder added in v1.1.3

func GetStringsBuilder() *strings.Builder

func GetUrlValues added in v1.1.3

func GetUrlValues() url.Values

func Json

func Json(obj interface{}) []byte

func PutBufferPool added in v1.1.3

func PutBufferPool(buf *bytes.Buffer)

func PutStringsBuilder added in v1.1.3

func PutStringsBuilder(b *strings.Builder)

func PutUrlValues added in v1.1.3

func PutUrlValues(vals url.Values)

func StringsJoin added in v1.1.3

func StringsJoin(strs ...string) string

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, rep IResponse) 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, rep IResponse) 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 IResponse added in v1.1.1

type IResponse interface {
	error
	IsError() bool
}

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