xclient

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpClientWrapper

type HttpClientWrapper struct {
	// base is the root URL for all invocations of the client
	BaseURL string

	// Set specific behavior of the client.  If not set http.DefaultClient will be used.
	*http.Client
}

HttpClientWrapper imposes common Client API conventions on a set of resource paths. The baseURL is expected to point to an HTTP path that is the parent of one or more resources. The server should return a decodable API resource object, or an Status object which contains information about the reason for any failure.

func NewHttpClientWrapper

func NewHttpClientWrapper(client *http.Client, baseUrl string) *HttpClientWrapper

NewHttpClientWrapper wraps http.Client to extend this client additional features

func (*HttpClientWrapper) Get

func (c *HttpClientWrapper) Get() NewRequest

Get begins a GET request. Short for c.Verb("GET").

func (*HttpClientWrapper) Into

func (c *HttpClientWrapper) Into(body io.ReadCloser, r interface{}) error

func (*HttpClientWrapper) Verb

func (c *HttpClientWrapper) Verb(verb string) NewRequest

Verb begins a request with a http method verb.

type NewRequest

type NewRequest func(string, io.Reader) (*http.Request, error)

type Opts

type Opts struct {
	Hooks hooks.HooksClient
	Ctx   context.Context
}

Opts contains hooks and an optional context object

Jump to

Keyboard shortcuts

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