rest

package
v2.7.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client - request client for any REST API

func (*Client) BuildURI

func (c *Client) BuildURI(uri string, params map[string]string) string

BuildURI builds request URI using [path?params...] format

func (*Client) Send

func (c *Client) Send(method, path string, data interface{}) (int, []byte, error)

Send sends request to REST server data interface{} - request payload, any interface for json.Marshal()

func (*Client) SetAuthToken

func (c *Client) SetAuthToken(token string)

SetAuthToken sets Bearer auth token for all requests

type ClientArgs

type ClientArgs struct {
	Address string
	Log     *logrus.Entry

	// InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name.
	InsecureSkipVerify bool
}

ClientArgs - params to create Client instance

type ClientInterface

type ClientInterface interface {
	BuildURI(uri string, params map[string]string) string
	Send(method, path string, data interface{}) (int, []byte, error)
	SetAuthToken(token string)
}

ClientInterface - request client interface

func NewClient

func NewClient(args ClientArgs) ClientInterface

NewClient creates new REST client

Jump to

Keyboard shortcuts

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