Documentation ¶
Index ¶
- func BuildHTTPRequest(ctx context.Context, b BuildHTTPRequestOptions) (*http.Request, error)
- func IntInSlice(i int, want []int) bool
- func RelLink(resp *http.Response, lnk string) string
- func ResponseErrorCheck(resp *http.Response, validStatuses []int) error
- func SetBoolResult(r *http.Response, ptr *bool) error
- func String(s string) *string
- func UnmarshalResponseBody(r *http.Response, target interface{}) error
- type BuildHTTPRequestOptions
- type EndpointAttribute
- type ResponseError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHTTPRequest ¶
BuildHTTPRequest builds an *http.Request. All errors are *errors.RequestError.
func RelLink ¶
RelLink returns the content of lnk from the response's Link header or "" if it does not exist
func ResponseErrorCheck ¶
ResponseErrorCheck checks for error responses
func SetBoolResult ¶
SetBoolResult sets the value of ptr to true if r has a 204 status code to true or false if the status code is 404
returns an error if the response is any other value
func UnmarshalResponseBody ¶
UnmarshalResponseBody unmarshalls a response body onto target. Non-nil errors will have the type *errors.ResponseError.
Types ¶
type BuildHTTPRequestOptions ¶
type BuildHTTPRequestOptions struct { ExplicitURL string Method string RequiredPreviews []string AllPreviews []string HeaderVals map[string]*string Previews map[string]bool Body interface{} URLQuery url.Values URLPath string Options []requests.Option RequireExplicitURL bool }
BuildHTTPRequestOptions builds http requests
type EndpointAttribute ¶
type EndpointAttribute int
EndpointAttribute is an attribute for an endpoint
type ResponseError ¶
type ResponseError struct {
// contains filtered or unexported fields
}
ResponseError implements errors.ResponseError
func NewResponseError ¶
func NewResponseError(msg string, resp *http.Response) *ResponseError
NewResponseError returns a new *ResponseError
func (*ResponseError) Data ¶
func (r *ResponseError) Data() *components.ResponseErrorData
Data implements errors.ResponseError
func (*ResponseError) Error ¶
func (r *ResponseError) Error() string
func (*ResponseError) HttpResponse ¶
func (r *ResponseError) HttpResponse() *http.Response
HttpResponse implements errors.ResponseError
func (*ResponseError) IsClientError ¶
func (r *ResponseError) IsClientError() bool
IsClientError implements errors.ResponseError
func (*ResponseError) IsServerError ¶
func (r *ResponseError) IsServerError() bool
IsServerError implements errors.ResponseError