rest

package
v6.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Method
	User       string
	Password   string
	Domain     string
	APIKey     string
	APIVersion int
	SSLVerify  bool
	Endpoint   string
	IfMatch    string
	Option     Options
}

Client - generic REST api client

func (*Client) GetQueryString

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

GetQueryString - get a query string for url through the Client Struct

func (*Client) GetQueryStrings

func (c *Client) GetQueryStrings(u *url.URL, query map[string]interface{})

GetQueryString - get a query string for url

func (*Client) NewClient

func (c *Client) NewClient(user, key, endpoint string) *Client

NewClient - get a new network client

func (*Client) RestAPICall

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

RestAPICall - general rest method caller query is an variadic arg. It receives a slice of map[string]interface{}

func (*Client) SetAuthHeaderOptions

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

SetAuthHeaderOptions - 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