http

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BLANK_FORMAT = ""
View Source
const FORM_FORMAT = "application/x-www-form-urlencoded"
View Source
const HEAD_FORMAT = "head"
View Source
const JSON_FORMAT = "application/json"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a HTTP REST API client requesting a configured endpoint.

func NewClient

func NewClient(url string, secure bool) *Client

NewClient is HTTP Client constructor

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, route string, params url.Values) error

Patch an entity using route as base url then params as query parameters

func (*Client) Get

func (r *Client) Get(ctx context.Context, route string, params url.Values, output interface{}) error

Get an entity using route as base url then params as query parameters output as structure where to decode received JSON entity

func (*Client) Head

func (r *Client) Head(ctx context.Context, route string, params url.Values, output map[string][]string) error

Head entity using route as base url then params as query parameters

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, route string, input interface{}) error

Patch an entity using route as base url input as structure to encode into JSON as a body

func (*Client) Perform

func (r *Client) Perform(
	ctx context.Context,
	verb string,
	route string,
	params url.Values,
	input interface{},
	output interface{},
	format string,
) error

func (*Client) Post

func (r *Client) Post(ctx context.Context, route string, params url.Values, input interface{}, output interface{}) error

Post an entity using route as base url then params as query parameters input as structure to encode into JSON as a body output as structure where to decode received JSON entity

func (*Client) Put

func (r *Client) Put(ctx context.Context, route string, params url.Values, input interface{}, output interface{}) error

Put an entity using route as base url then params as query parameters input as structure to encode into JSON as a body output as structure where to decode received JSON entity

Jump to

Keyboard shortcuts

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