requester

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	Username string
	Password string
}

type RequestOptions

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

type Requester

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

func NewRequester

func NewRequester(baseURL *url.URL, httpClient *http.Client, auth *Authentication) *Requester

func (*Requester) Authenticate

func (r *Requester) Authenticate(ctx context.Context) error

func (*Requester) CloneWithNewBasePath

func (r *Requester) CloneWithNewBasePath(newPath string) *Requester

func (*Requester) Delete

func (r *Requester) Delete(ctx context.Context, opts ...WithRequestOption) (*http.Response, error)

Delete is just a shortcut for Do(ctx, WithDELETE())

func (*Requester) Do

func (r *Requester) Do(ctx context.Context, opts ...WithRequestOption) (*http.Response, error)

func (*Requester) Get

func (r *Requester) Get(ctx context.Context, opts ...WithRequestOption) (*http.Response, error)

Get is just a shortcut for Do(ctx, WithGET())

func (*Requester) Post

func (r *Requester) Post(ctx context.Context, opts ...WithRequestOption) (*http.Response, error)

Post is just a shortcut for Do(ctx, WithPOST())

func (*Requester) Put

func (r *Requester) Put(ctx context.Context, opts ...WithRequestOption) (*http.Response, error)

Put is just a shortcut for Do(ctx, WithPUT())

type WithRequestOption

type WithRequestOption func(r *RequestOptions)

func WithBodyBytes

func WithBodyBytes(body []byte) WithRequestOption

func WithBodyReader

func WithBodyReader(body io.Reader) WithRequestOption

func WithDELETE

func WithDELETE() WithRequestOption

func WithGET

func WithGET() WithRequestOption

func WithHeader

func WithHeader(key string, values ...string) WithRequestOption

func WithNoRetry

func WithNoRetry() WithRequestOption

func WithPOST

func WithPOST() WithRequestOption

func WithPUT

func WithPUT() WithRequestOption

func WithPath

func WithPath(urlPath string) WithRequestOption

func WithQueryParameter

func WithQueryParameter(key string, values ...string) WithRequestOption

func WithResponseField

func WithResponseField(field string) WithRequestOption

Jump to

Keyboard shortcuts

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