client

package
v0.0.0-...-e82b790 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*TokenHolder
	// 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,string,omitempty"`
	Message string `json:"message,omitempty"`
}

Error ...

func (*Error) Error

func (e *Error) Error() string

type Token

type Token struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
	Error
}

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