internal

package
v1.7.0-preview20241117 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeHeader = "Content-Type"
	AcceptHeader      = "Accept"
	BinaryContentType = "application/octet-steam"
	JSONContentType   = "application/json"
	RawURLKey         = "request-raw-url"
)
View Source
const (
	BasePathParameter = "baseurl"
)

Variables

View Source
var (
	ErrEmptyURI                = core.ErrEmptyURI
	ErrNilPathParameters       = core.ErrNilPathParameters
	ErrNilQueryParamters       = core.ErrNilQueryParamters
	ErrMissingBasePathParam    = core.ErrMissingBasePathParam
	ErrMissingBasePathTemplate = core.ErrMissingBasePathTemplate
	ErrInvalidHeaderType       = core.ErrInvalidHeaderType
	ErrEmptyRawURL             = core.ErrEmptyRawURL
	ErrMissingSchema           = core.ErrMissingSchema
	ErrNilResponse             = core.ErrNilResponse
	ErrNilResponseBody         = core.ErrNilResponseBody
	ErrNilSource               = core.ErrNilSource
	ErrNilCredential           = core.ErrNilCredential

	//Page Iterator
	ErrNilClient         = core.ErrNilClient
	ErrNilResult         = core.ErrNilResult
	ErrWrongResponseType = core.ErrWrongResponseType
	ErrParsing           = core.ErrParsing
	ErrNilCallback       = core.ErrNilCallback

	//Authorization Provider
	ErrNilRequest = core.ErrNilRequest
)

Functions

func As

func As[T any](in interface{}, out T) error

As converts the value to the type T.

func FromJSON

func FromJSON[T any](response *http.Response, v T) error

FromJSON[T] Unmarshalls response body into v

func IsNil added in v1.6.0

func IsNil(a interface{}) bool

IsNil checks if a value is nil or a nil interface

func NewRequestHeader

func NewRequestHeader() core.RequestHeader

func ParseResponse

func ParseResponse[T Response](response *http.Response, value T) error

ParseResponse[T] parses the HTTP Response to the provided type

Types

type AuthorizationProvider added in v1.6.0

type AuthorizationProvider interface {
	AuthorizeRequest(request RequestInformation) error
}

type BaseAuthorizationProvider added in v1.6.0

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

func NewBaseAuthorizationProvider added in v1.6.0

func NewBaseAuthorizationProvider(credential Credential) (*BaseAuthorizationProvider, error)

func (*BaseAuthorizationProvider) AuthorizeRequest added in v1.6.0

func (b *BaseAuthorizationProvider) AuthorizeRequest(request RequestInformation) error

type Credential added in v1.6.0

type Credential interface {
	GetAuthentication() (string, error)
}

type ErrorMapping

type ErrorMapping interface {
	Set(code, err string)
	Len() int
	Get(code int) (string, bool)
}

type QueryParameter

type QueryParameter map[string]string

type RequestBody

type RequestBody = http.RequestBody

RequestBody is a type alias for http request bodies

type RequestConfiguration

type RequestConfiguration interface {
	Header() RequestHeader
	Query() map[string]string
	Data() string
	ErrorMapping() ErrorMapping
	SetResponse(interface{})
}

type RequestHeader

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

RequestHeader is a type alias for http request headers

func (*RequestHeader) Get

func (rH *RequestHeader) Get(key string) string

func (*RequestHeader) Iterate

func (rH *RequestHeader) Iterate(callback func(string, []string) bool)

func (*RequestHeader) Set

func (rH *RequestHeader) Set(key, value string)

func (*RequestHeader) SetAll

func (rH *RequestHeader) SetAll(headers http.Header)

type RequestInformation added in v1.6.0

type RequestInformation = http.RequestInformation

type Response

type Response = http.Response

Response represents all possible responses

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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