common

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 10 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeParams added in v1.17.0

func EscapeParams(params ...interface{}) []interface{}

Helper function for correctly formatting and escaping URL path parameters. Used in the generated API client code.

Types

type BadRequest

type BadRequest error

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client manages the REST interface for a calling user.

func MakeClient

func MakeClient(address string, apiHeader, apiToken string) (c *Client, err error)

MakeClient is the factory for constructing a Client for a given endpoint.

func MakeClientWithHeaders

func MakeClientWithHeaders(address string, apiHeader, apiToken string, headers []*Header) (c *Client, err error)

MakeClientWithHeaders is the factory for constructing a Client for a given endpoint with additional user defined headers.

func (*Client) Get

func (client *Client) Get(ctx context.Context, response interface{}, path string, params interface{}, headers []*Header) error

Get performs a GET request to the specific path against the server

func (*Client) GetRaw added in v1.5.1

func (client *Client) GetRaw(ctx context.Context, path string, params interface{}, headers []*Header) (response []byte, err error)

GetRaw performs a GET request to the specific path against the server and returns the raw body bytes.

func (*Client) GetRawMsgpack

func (client *Client) GetRawMsgpack(ctx context.Context, response interface{}, path string, params interface{}, headers []*Header) error

GetRawMsgpack performs a GET request to the specific path against the server and returns the decoded messagepack response.

func (*Client) Post

func (client *Client) Post(ctx context.Context, response interface{}, path string, params interface{}, headers []*Header, body interface{}) error

Post sends a POST request to the given path with the given body object. No query parameters will be sent if body is nil. response must be a pointer to an object as post writes the response there.

type Header struct {
	Key   string
	Value string
}

Header is a struct for custom headers.

type InternalError

type InternalError error

type InvalidToken

type InvalidToken error

type NotFound

type NotFound error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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