rest

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindJSON

func BindJSON(w http.ResponseWriter, r *http.Request, v interface{}) error

Bind JSON from request body to a struct

func SendJSON

func SendJSON(status int, w http.ResponseWriter, v interface{}) error

Send JSON response

Types

type RESTClient

type RESTClient struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string, token string, insecureSkipVerify bool) *RESTClient

func (*RESTClient) Delete

func (c *RESTClient) Delete(path string, request interface{}, response interface{}, successCode int) (int, error)

func (*RESTClient) Get

func (c *RESTClient) Get(path string, response interface{}) (int, error)

func (*RESTClient) Post

func (c *RESTClient) Post(path string, request interface{}, response interface{}, successCode int) (int, error)

func (*RESTClient) Put

func (c *RESTClient) Put(path string, request interface{}, response interface{}, successCode int) (int, error)

func (*RESTClient) SendData

func (c *RESTClient) SendData(method string, path string, request interface{}, response interface{}, successCode int) (int, error)

func (*RESTClient) SetAuthToken

func (c *RESTClient) SetAuthToken(token string) *RESTClient

func (*RESTClient) SetTokenKey

func (c *RESTClient) SetTokenKey(key string) *RESTClient

func (*RESTClient) SetTokenValue

func (c *RESTClient) SetTokenValue(value string) *RESTClient

Jump to

Keyboard shortcuts

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