client

package
v0.0.0-...-053a64e Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: MIT Imports: 8 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 {
	// contains filtered or unexported fields
}

func New

func New(user, password string) *Client

func (*Client) Delete

func (c *Client) Delete(endpoint Endpoint) error

func (*Client) Get

func (c *Client) Get(endpoint Endpoint, response json.Unmarshaler) error

func (*Client) Post

func (c *Client) Post(
	payload EndpointPayloadMarshaler,
	response json.Unmarshaler,
) error

type Endpoint

type Endpoint interface {
	// Path for the API endpoint.
	Path() string
}

type EndpointPayloadMarshaler

type EndpointPayloadMarshaler interface {
	Endpoint
	Payload
	json.Marshaler
}

type Error

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

func (*Error) Body

func (e *Error) Body() string

func (*Error) Error

func (e *Error) Error() string

type FieldError

type FieldError struct {
	// Name of the field.
	Name string
	// Descirption of the error.
	Description string
}

type Payload

type Payload interface {
	// Validate values of all fields.
	Validate() []FieldError
}

Payload send as request body.

type ValidationError

type ValidationError struct {
	// Name of the payload the validation failed on.
	Name string
	// FieldErrors encountered during validation.
	FieldErrors []FieldError
}

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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