cli

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAdminError

func IsAdminError(err error) bool

Types

type Client

type Client struct {
	ServiceURL  string
	HTTPClient  *http.Client
	VersionInfo string
}

Client is a base client that is used to make http request to the ServiceURL

func (*Client) Delete

func (c *Client) Delete(endpoint string) error

func (*Client) DeleteWithQueryParams

func (c *Client) DeleteWithQueryParams(endpoint string, params map[string]string) error

func (*Client) Get

func (c *Client) Get(endpoint string, obj interface{}) error

func (*Client) GetWithQueryParams

func (c *Client) GetWithQueryParams(endpoint string, obj interface{}, params map[string]string,
	decode bool) ([]byte, error)

func (*Client) MakeRequest

func (c *Client) MakeRequest(method, endpoint string) (*http.Response, error)

MakeRequest can make a simple request and handle the response by yourself

func (*Client) Post

func (c *Client) Post(endpoint string, in interface{}) error

func (*Client) PostWithMultiPart

func (c *Client) PostWithMultiPart(endpoint string, in interface{}, body io.Reader, contentType string) error

func (*Client) PostWithObj

func (c *Client) PostWithObj(endpoint string, in, obj interface{}) error

func (*Client) Put

func (c *Client) Put(endpoint string, in interface{}) error

func (*Client) PutWithMultiPart

func (c *Client) PutWithMultiPart(endpoint string, body io.Reader, contentType string) error

func (*Client) PutWithQueryParams

func (c *Client) PutWithQueryParams(endpoint string, in, obj interface{}, params map[string]string) error

type Error

type Error struct {
	Reason string `json:"reason"`
	Code   int
}

Error is a admin error type

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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