client

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContentTypeApplicationJSON ...
	ContentTypeApplicationJSON = "application/json"
	// ContentTypeTextPlain ...
	ContentTypeTextPlain = "text/plain"
	//
	BasePath = "service/rest/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config Config) *Client

NewClient returns an instance of client that implements the Client interface

func (*Client) ContentType

func (c *Client) ContentType() string

ContentType returns the current configured HTTP content type

func (*Client) ContentTypeJSON

func (c *Client) ContentTypeJSON()

ContentTypJSON configures the content type for future requests to be 'application/json'

func (*Client) ContentTypeTextPlain

func (c *Client) ContentTypeTextPlain()

ContentTypTestPlain configures the content typ for future requests to be 'test/plain'

func (*Client) Delete

func (c *Client) Delete(endpoint string) ([]byte, *http.Response, error)

func (*Client) Get

func (c *Client) Get(endpoint string, payload io.Reader) ([]byte, *http.Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method string, endpoint string, body io.Reader) (req *http.Request, err error)

func (*Client) Post

func (c *Client) Post(endpoint string, payload io.Reader) ([]byte, *http.Response, error)

func (*Client) Put

func (c *Client) Put(endpoint string, payload io.Reader) ([]byte, *http.Response, error)

type Config

type Config struct {
	URL      string `json:"url"`
	Username string `json:"username"`
	Password string `json:"password"`
	Insecure bool   `json:"insecure"`
}

Config is the configuration structure used to instantiate the Nexus client

type Service

type Service struct {
	Client *Client
}

Jump to

Keyboard shortcuts

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