common

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: MIT Imports: 10 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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, request interface{}, headers []*Header) error

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

func (*Client) GetRawMsgpack

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

func (*Client) Post

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

post sends a POST request to the given path with the given request object. No query parameters will be sent if request 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