rest

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 3

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) MakeRequestWithURL added in v0.13.0

func (c *Client) MakeRequestWithURL(method string, urlOpt *url.URL) (*http.Response, error)

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) PutWithCustomMediaType added in v0.13.0

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

type MediaType added in v0.13.0

type MediaType string
const (
	ApplicationJSON          MediaType = "application/json"
	PartitionedTopicMetaJSON MediaType = "application/vnd.partitioned-topic-metadata+json"
)

func (MediaType) String added in v0.13.0

func (m MediaType) String() string

Jump to

Keyboard shortcuts

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