Documentation ¶
Index ¶
- func Exhaust(resp *http.Response)
- func GetJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}, ...) error
- func GetPaginatedJSON(client HTTPClient, headers http.Header, path *url.URL, p Paginator, ...) error
- func PostJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}) (http.Header, []byte, error)
- func PutJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}) (http.Header, []byte, error)
- func Query(client HTTPClient, method string, headers http.Header, path *url.URL, ...) (http.Header, error)
- func Update(client HTTPClient, method string, headers http.Header, path *url.URL, ...) (http.Header, []byte, error)
- type Backoff
- type DecodeError
- type ExponentialBackoff
- type HTTPClient
- type Keystone
- func (k *Keystone) Domains(client HTTPClient, headers http.Header, enabled bool) ([]fiware.Domain, error)
- func (o *Keystone) Headers(subservice, token string) http.Header
- func (o *Keystone) Login(client HTTPClient, password string, retries Backoff) (string, string, error)
- func (k *Keystone) Projects(client HTTPClient, headers http.Header) ([]fiware.Project, error)
- type LinealBackoff
- type NetError
- type Paginator
- type SlicePaginator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJSON ¶
func GetJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}, allowUnknownFields bool) error
GetJSON is a convenience wrapper for Query(client, http.MethodGet, ...) TODO: Add a variant with pagination support
func GetPaginatedJSON ¶ added in v0.2.8
func GetPaginatedJSON(client HTTPClient, headers http.Header, path *url.URL, p Paginator, allowUnknownFields bool, maximum int) error
GetPaginatedJSON is a convenience wrapper for Query(client, http.MethodGet, ...)
func PostJSON ¶
func PostJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}) (http.Header, []byte, error)
PostJSON is a convenience wrapper for Update(client, http.MethodPost, ...)
func PutJSON ¶ added in v0.3.2
func PutJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}) (http.Header, []byte, error)
PutJSON is a convenience wrapper for Update(client, http.MethodPut, ...)
Types ¶
type DecodeError ¶
type DecodeError struct { Type interface{} Data json.RawMessage Err error }
DecodeError returned when failed to decode json data
type ExponentialBackoff ¶ added in v0.3.7
type ExponentialBackoff struct { MaxRetries int InitialDelay time.Duration DelayFactor float64 MaxDelay time.Duration }
ExponentialBackoff performs exponential backoff
func (ExponentialBackoff) KeepTrying ¶ added in v0.3.7
func (l ExponentialBackoff) KeepTrying(retries int) (bool, time.Duration)
KeepTrying implements Retry
type HTTPClient ¶ added in v0.3.3
HTTPClient encapsulates the funcionality required from *http.Client.
type Keystone ¶
Keystone manages Requests to the Identity Manager
type LinealBackoff ¶ added in v0.3.7
LinealBackoff performs lineal backoff
func (LinealBackoff) KeepTrying ¶ added in v0.3.7
func (l LinealBackoff) KeepTrying(retries int) (bool, time.Duration)
KeepTrying implements Retry
type NetError ¶
type NetError struct { Req http.Request StatusCode int RespHeaders http.Header Resp []byte Err error }
NetError describes an error performing a request
type Paginator ¶ added in v0.2.8
type Paginator interface {
Append(item json.RawMessage, allowUnknownFields bool) error
}
type SlicePaginator ¶ added in v0.4.3
type SlicePaginator[T any] struct { Slice []T }
SlicePaginator is a generic type of Paginator based on a slice
func NewPaginator ¶ added in v0.4.3
func NewPaginator[T any](slice []T) *SlicePaginator[T]
NewPaginator creates a new paginator backed by the given slice
func (*SlicePaginator[T]) Append ¶ added in v0.4.3
func (s *SlicePaginator[T]) Append(raw json.RawMessage, allowUnknownFields bool) error
Append implements Paginator