rest

package
v0.0.0-...-6fc1cce Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	User     string
	Password string
	APIKey   string
	Endpoint string
	Option   Options
	// contains filtered or unexported fields
}

Client - generic REST api client

func (*Client) GetQueryString

func (c *Client) GetQueryString(u *url.URL)

GetQueryString - get a query string for url

func (*Client) NewClient

func (c *Client) NewClient(user, key, endpoint string, logger log.Logger) *Client

NewClient - get a new network client

func (*Client) RestAPICall

func (c *Client) RestAPICall(method Method, path string, options interface{}) ([]byte, error)

RestAPICall - general rest method caller

func (*Client) SetAuthHeaderOptions

func (c *Client) SetAuthHeaderOptions(headers map[string]string)

SetAuthHeaderOptins - set the Headers Options

func (*Client) SetQueryString

func (c *Client) SetQueryString(query map[string]interface{})

SetQueryString - set the query strings to use

type Method

type Method int

Create a Method type

const (
	GET Method = 1 + iota
	POST
	PUT
	DELETE
	PATCH
)

func (Method) String

func (m Method) String() string

type Options

type Options struct {
	Headers map[string]string
	Query   map[string]interface{}
}

Options for REST call

Jump to

Keyboard shortcuts

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