request

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 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 AuthTransport

type AuthTransport struct {
	Manager conf.ManagerInterface
	Base    http.RoundTripper
	Cred    *conf.Credential
	// contains filtered or unexported fields
}

func (*AuthTransport) NewAccessToken

func (t *AuthTransport) NewAccessToken(ctx context.Context) error

func (*AuthTransport) RoundTrip

func (t *AuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Request

type Request struct {
	Logs        *logs.Gen3Logger
	RetryClient *retryablehttp.Client
}

func (*Request) Do

func (r *Request) Do(ctx context.Context, rb *RequestBuilder) (*http.Response, error)

func (*Request) New

func (r *Request) New(method, url string) *RequestBuilder

type RequestBuilder

type RequestBuilder struct {
	//Req     *Request // the underlying retry client holder
	Method   string
	Url      string
	Body     io.Reader // store as []byte for easy reuse
	Headers  map[string]string
	Token    string
	PartSize int64
	SkipAuth bool
}

New addition to your request package

func (*RequestBuilder) WithBody

func (ar *RequestBuilder) WithBody(body io.Reader) *RequestBuilder

func (*RequestBuilder) WithHeader

func (ar *RequestBuilder) WithHeader(key, value string) *RequestBuilder

func (*RequestBuilder) WithJSONBody

func (ar *RequestBuilder) WithJSONBody(v any) (*RequestBuilder, error)

func (*RequestBuilder) WithSkipAuth

func (ar *RequestBuilder) WithSkipAuth(skip bool) *RequestBuilder

func (*RequestBuilder) WithToken

func (ar *RequestBuilder) WithToken(token string) *RequestBuilder

type RequestInterface

type RequestInterface interface {
	New(method, url string) *RequestBuilder
	Do(ctx context.Context, req *RequestBuilder) (*http.Response, error)
}

func NewRequestInterface

func NewRequestInterface(
	logger *logs.Gen3Logger,
	cred *conf.Credential,
	conf conf.ManagerInterface,
) RequestInterface

Jump to

Keyboard shortcuts

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