rest

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

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) GetWithOptions

func (c *Client) GetWithOptions(endpoint string, obj interface{}, params map[string]string,
	decode bool, file io.Writer) ([]byte, 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) PostWithQueryParams

func (c *Client) PostWithQueryParams(endpoint string, in interface{}, params map[string]string) 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