rest

package
v0.0.0-...-3da42c7 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NoStatus = -1

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(httpClient *http.Client, baseURL string, additionalHeader HTTPHeader) *Client

NewClient creates a new Client.

func NewDefaultClient

func NewDefaultClient(httpClient *http.Client, baseURL string) *Client

NewDefaultClient creates a new Client with a default HTTP client set up

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, apiPath string) ([]byte, int, string, error)

Delete performs an HTTP delete request.

func (*Client) Get

func (c *Client) Get(ctx context.Context, apiPath string) ([]byte, int, string, error)

Get performs an HTTP get request.

func (*Client) Post

func (c *Client) Post(ctx context.Context, apiPath string, body []byte) ([]byte, int, string, error)

Post performs an HTTP post request.

func (*Client) Put

func (c *Client) Put(ctx context.Context, apiPath string, body []byte) ([]byte, int, string, error)

Put performs an HTTP put request.

type ClientError

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

func (*ClientError) Error

func (e *ClientError) Error() string

type ClientInterface

type ClientInterface interface {
	// Get performs an HTTP get request.
	Get(ctx context.Context, apiPath string) ([]byte, int, string, error)

	// Post performs an HTTP post request.
	Post(ctx context.Context, apiPath string, body []byte) ([]byte, int, string, error)

	// Put performs an HTTP put request.
	Put(ctx context.Context, apiPath string, body []byte) ([]byte, int, string, error)

	// Delete performs an HTTP delete request.
	Delete(ctx context.Context, apiPath string) ([]byte, int, string, error)
}

type HTTPHeader

type HTTPHeader map[string][]string

func (HTTPHeader) Add

func (h HTTPHeader) Add(key string, value string)

Jump to

Keyboard shortcuts

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