request

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 16 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

	BaseURL   string
	UserAgent string
	Token     string
	User      string
	Pass      string
}

func (*Request) Do

func (r *Request) Do(ctx context.Context, method, path string, body, out any, opts ...RequestOption) error

type RequestBuilder

type RequestBuilder struct {
	Method   string
	Url      string
	Body     io.Reader
	Headers  map[string]string
	Token    string
	PartSize int64
	SkipAuth bool
	Timeout  time.Duration
}

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) WithPartSize

func (ar *RequestBuilder) WithPartSize(size int64) *RequestBuilder

func (*RequestBuilder) WithQuery

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

func (*RequestBuilder) WithQueryValues

func (ar *RequestBuilder) WithQueryValues(v url.Values) *RequestBuilder

func (*RequestBuilder) WithSkipAuth

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

func (*RequestBuilder) WithTimeout

func (ar *RequestBuilder) WithTimeout(d time.Duration) *RequestBuilder

func (*RequestBuilder) WithToken

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

type RequestOption

type RequestOption func(*RequestBuilder)

func WithHeader

func WithHeader(key, value string) RequestOption

func WithPartSize

func WithPartSize(size int64) RequestOption

func WithQuery

func WithQuery(key, value string) RequestOption

func WithQueryValues

func WithQueryValues(v url.Values) RequestOption

func WithSkipAuth

func WithSkipAuth(skip bool) RequestOption

func WithTimeout

func WithTimeout(d time.Duration) RequestOption

func WithToken

func WithToken(token string) RequestOption

type Requester

type Requester interface {
	Do(ctx context.Context, method, path string, body, out any, opts ...RequestOption) error
}

func NewRequestor

func NewRequestor(
	logger *logs.Gen3Logger,
	cred *conf.Credential,
	conf conf.ManagerInterface,
	baseURL string,
	userAgent string,
	baseHTTPClient *http.Client,
) Requester

type ResponseError

type ResponseError struct {
	Method  string
	URL     string
	Status  int
	Body    string
	Headers http.Header
}

func (*ResponseError) Error

func (e *ResponseError) Error() string

Jump to

Keyboard shortcuts

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