Documentation
¶
Index ¶
Constants ¶
const ( ParamOffset = "offset" ParamLimit = "limit" ParamLabelSelector = "labelSelector" )
const ( RelationSelf = "self" RelationNext = "next" RelationPrev = "prev" RelationAlternate = "alternate" RelationLabels = "https://stormforge.io/rel/labels" RelationTrials = "https://stormforge.io/rel/trials" RelationNextTrial = "https://stormforge.io/rel/next-trial" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalLinkRelation ¶ added in v0.0.11
CanonicalLinkRelation returns the supplied link relation name normalized for previously accepted values. The returned value can be compared case-insensitively to the supplied `Relation*` constants.
func IsUnauthorized ¶ added in v0.0.11
IsUnauthorized checks to see if the error is an "unauthorized" error.
func UnmarshalJSON ¶ added in v0.0.11
UnmarshalJSON extracts the supplied JSON, preserving the "_metadata" field if necessary. This should only be necessary on items in index (list) representations as top-level "_metadata" fields should normally be populated from HTTP headers.
Types ¶
type Client ¶
type Client interface {
// URL returns the location of the specified endpoint
URL(endpoint string) *url.URL
// Do performs the interaction specified by the HTTP request
Do(context.Context, *http.Request) (*http.Response, []byte, error)
}
Client is used to handle interactions with the API Server.
type Error ¶ added in v0.0.11
type Error struct {
Type ErrorType `json:"-"`
Message string `json:"error"`
RetryAfter time.Duration `json:"-"`
Location string `json:"-"`
}
Error represents the API specific error messages and may be used in response to HTTP status codes
func NewError ¶ added in v0.0.11
NewError returns a new error with an API specific error condition, it also captures the details of the response
func NewUnexpectedError ¶ added in v0.0.11
NewUnexpectedError returns an error in situations where the API returned an undocumented status for the requested resource.
type ErrorType ¶ added in v0.0.11
type ErrorType string
ErrorType is an identifying token for errors.
const ( ErrUnexpected ErrorType = "unexpected" )
type IndexQuery ¶ added in v0.0.11
IndexQuery represents the query parameter of an index resource.
func (IndexQuery) SetLabelSelector ¶ added in v0.0.11
func (q IndexQuery) SetLabelSelector(kv map[string]string)
SetLabelSelector is a helper to set label selectors used to filter the index.
func (IndexQuery) SetLimit ¶ added in v0.0.11
func (q IndexQuery) SetLimit(limit int)
SetLimit sets the maximum number of items to include with the index.
func (IndexQuery) SetOffset ¶ added in v0.0.11
func (q IndexQuery) SetOffset(offset int)
SetOffset sets the number of items to skip from the beginning of the index.
type Metadata ¶ added in v0.0.11
Metadata is used to hold single or multi-value metadata from list responses.