Documentation ¶
Index ¶
- func RequestRetryAll(retryFuncs ...RequestRetryFunc) func(resp *http.Response, o *odata.OData) (bool, error)
- func RequestRetryAny(retryFuncs ...RequestRetryFunc) func(resp *http.Response, o *odata.OData) (bool, error)
- func RetryOn404ConsistencyFailureFunc(resp *http.Response, _ *odata.OData) (bool, error)
- func RetryableErrorHandler(resp *http.Response, err error, _ int) (*http.Response, error)
- type BaseClient
- type Client
- type Headers
- type Options
- type QueryParams
- type Request
- type RequestMiddleware
- type RequestOptions
- type RequestRetryFunc
- type Response
- type ResponseMiddleware
- type ValidStatusFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestRetryAll ¶
func RequestRetryAll(retryFuncs ...RequestRetryFunc) func(resp *http.Response, o *odata.OData) (bool, error)
RequestRetryAll wraps multiple RequestRetryFuncs and calls them in turn, only returning true if all funcs return true
func RequestRetryAny ¶
func RequestRetryAny(retryFuncs ...RequestRetryFunc) func(resp *http.Response, o *odata.OData) (bool, error)
RequestRetryAny wraps multiple RequestRetryFuncs and calls them in turn, returning true if any func returns true
func RetryOn404ConsistencyFailureFunc ¶
RetryOn404ConsistencyFailureFunc can be used to retry a request when a 404 response is received
Types ¶
type BaseClient ¶
type Client ¶
type Client struct { // BaseUri is the base endpoint for this API. BaseUri string // UserAgent is the HTTP user agent string to send in requests. UserAgent string // CorrelationId is a custom correlation ID which can be added to requests for tracing purposes CorrelationId string // Authorizer is anything that can provide an access token with which to authorize requests. Authorizer auth.Authorizer // DisableRetries prevents the client from reattempting failed requests (which it does to work around eventual consistency issues). // This does not impact handling of retries related to rate limiting, which are always performed. DisableRetries bool // RequestMiddlewares is a slice of functions that are called in order before a request is sent RequestMiddlewares *[]RequestMiddleware // ResponseMiddlewares is a slice of functions that are called in order before a response is parsed and returned ResponseMiddlewares *[]ResponseMiddleware }
Client is a base client to be used by API-specific clients. It satisfies the BaseClient interface.
func (*Client) ExecutePaged ¶
ExecutePaged automatically pages through the results of Execute
func (*Client) NewRequest ¶
NewRequest configures a new *Request
type Headers ¶
type Headers struct {
// contains filtered or unexported fields
}
Headers is a representation of the HTTP headers to be sent with a Request
func (*Headers) AppendHeader ¶ added in v0.20230216.1112535
AppendHeader appends the http.Header values
type Options ¶
type Options interface { ToHeaders() *Headers ToOData() *odata.Query ToQuery() *QueryParams }
type QueryParams ¶
type QueryParams struct {
// contains filtered or unexported fields
}
QueryParams is a representation of the URL query parameters to be sent with a Request
func (*QueryParams) Append ¶
func (q *QueryParams) Append(key, value string)
Append sets a single query parameter value
func (*QueryParams) AppendValues ¶ added in v0.20230216.1112535
func (q *QueryParams) AppendValues(q2 url.Values)
AppendValues appends the url.Values values
func (*QueryParams) Merge ¶ added in v0.20230216.1112535
func (q *QueryParams) Merge(q2 Headers)
Merge copies the query parameter values from q2, overwriting as necessary
func (*QueryParams) Values ¶
func (q *QueryParams) Values() url.Values
Values returns a url.Values map containing query parameter values
type Request ¶
type Request struct { RetryFunc RequestRetryFunc ValidStatusCodes []int ValidStatusFunc ValidStatusFunc Client BaseClient // Embed *http.Request so that we can send this to an *http.Client *http.Request }
Request embeds *http.Request and adds useful metadata
func (*Request) ExecutePaged ¶
func (*Request) IsIdempotent ¶
type RequestMiddleware ¶
RequestMiddleware can manipulate or log a request before it is sent
type RequestOptions ¶
type RequestOptions struct { ContentType string ExpectedStatusCodes []int HttpMethod string OptionsObject Options Path string }
func (RequestOptions) Validate ¶
func (ro RequestOptions) Validate() error
type RequestRetryFunc ¶
RequestRetryFunc is a function that determines whether an HTTP request has failed due to eventual consistency and should be retried
type ResponseMiddleware ¶
ResponseMiddleware can manipulate or log a response before it is parsed and returned