v0.0.0-...-5b8e3ff Latest Latest

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 10 Imported by: 1




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	// contains filtered or unexported fields

func NewClient

func NewClient(urlToken string) *Client

func (*Client) Do

func (c *Client) Do(method, uri string, body io.Reader) ([]byte, error)

func (*Client) Get

func (c *Client) Get(uri string) ([]byte, error)

func (*Client) GetJSON

func (c *Client) GetJSON(uri string, obj interface{}) error

GetJSON ...

func (*Client) Post

func (c *Client) Post(uri string, data []byte) ([]byte, error)

func (*Client) PostJSON

func (c *Client) PostJSON(uri string, data []byte, obj interface{}) error

PostJSON ...

func (*Client) SetContentType

func (c *Client) SetContentType(ctype string)

type Error

type Error struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"msg,omitempty"`

Error ...

func (*Error) Error

func (e *Error) Error() string

func (*Error) GetCode

func (e *Error) GetCode() int

GetCode ...

func (*Error) GetMessage

func (e *Error) GetMessage() string

GetMessage ...

type Token

type Token struct {
	AppAccessToken    string `json:"app_access_token,omitempty"`
	TenantAccessToken string `json:"tenant_access_token,omitempty"`
	ExpiresIn         int64  `json:"expires,omitempty"` // seconds // 过期时间,单位为秒(两小时失效)

Token ...

type TokenHolder

type TokenHolder struct {
	// contains filtered or unexported fields

TokenHolder ...

func NewTokenHolder

func NewTokenHolder(uri string) *TokenHolder

func (*TokenHolder) Expired

func (th *TokenHolder) Expired() bool

func (*TokenHolder) GetAuthToken

func (th *TokenHolder) GetAuthToken() (token string, err error)

func (*TokenHolder) SetAuth

func (th *TokenHolder) SetAuth(auths string)

func (*TokenHolder) SetCorp

func (th *TokenHolder) SetCorp(id, secret string)

func (*TokenHolder) Valid

func (th *TokenHolder) Valid() bool

Jump to

Keyboard shortcuts

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