Documentation
¶
Index ¶
- func WithBaseURL(baseURL string) *core.BaseURLOption
- func WithBodyProperties(bodyProperties map[string]interface{}) *core.BodyPropertiesOption
- func WithHTTPClient(httpClient core.HTTPClient) *core.HTTPClientOption
- func WithHTTPHeader(httpHeader http.Header) *core.HTTPHeaderOption
- func WithMaxAttempts(attempts uint) *core.MaxAttemptsOption
- func WithMaxStreamBufSize(size int) *core.MaxBufSizeOption
- func WithMaxStreamReconnectAttempts(attempts uint) *core.MaxStreamReconnectAttemptsOption
- func WithQueryParameters(queryParameters url.Values) *core.QueryParametersOption
- func WithToken(token string) *core.TokenOption
- func WithTokenFunc(fn func() (string, error)) *core.TokenFuncOption
- func WithoutRetries() *core.WithoutRetriesOption
- func WithoutStreamReconnection() *core.WithoutStreamReconnectionOption
- type RequestOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBaseURL ¶
func WithBaseURL(baseURL string) *core.BaseURLOption
WithBaseURL sets the base URL, overriding the default environment, if any.
func WithBodyProperties ¶
func WithBodyProperties(bodyProperties map[string]interface{}) *core.BodyPropertiesOption
WithBodyProperties adds the given body properties to the request.
func WithHTTPClient ¶
func WithHTTPClient(httpClient core.HTTPClient) *core.HTTPClientOption
WithHTTPClient uses the given HTTPClient to issue the request.
func WithHTTPHeader ¶
func WithHTTPHeader(httpHeader http.Header) *core.HTTPHeaderOption
WithHTTPHeader adds the given http.Header to the request.
func WithMaxAttempts ¶
func WithMaxAttempts(attempts uint) *core.MaxAttemptsOption
WithMaxAttempts configures the maximum number of retry attempts.
func WithMaxStreamBufSize ¶
func WithMaxStreamBufSize(size int) *core.MaxBufSizeOption
WithMaxStreamBufSize configures the maximum buffer size for streaming responses. This controls the maximum size of a single message (in bytes) that the stream can process. By default, this is set to 1MB.
func WithMaxStreamReconnectAttempts ¶
func WithMaxStreamReconnectAttempts(attempts uint) *core.MaxStreamReconnectAttemptsOption
WithMaxStreamReconnectAttempts caps the number of transparent mid-stream reconnect attempts on streaming endpoints that support resumption. The reconnect loop honors Last-Event-ID and any server-sent `retry:` directives. Has no effect on endpoints that don't support resumption.
func WithQueryParameters ¶
func WithQueryParameters(queryParameters url.Values) *core.QueryParametersOption
WithQueryParameters adds the given query parameters to the request.
func WithToken ¶
func WithToken(token string) *core.TokenOption
WithToken sets the 'Authorization: Bearer <token>' request header.
func WithTokenFunc ¶
func WithTokenFunc(fn func() (string, error)) *core.TokenFuncOption
WithTokenFunc sets a function that returns the 'Authorization: Bearer' token at request time.
func WithoutRetries ¶
func WithoutRetries() *core.WithoutRetriesOption
WithoutRetries disables HTTP-level retry attempts for the request. Use this instead of WithMaxAttempts(0), which falls through to the default of 2 attempts.
func WithoutStreamReconnection ¶
func WithoutStreamReconnection() *core.WithoutStreamReconnectionOption
WithoutStreamReconnection disables transparent mid-stream reconnection on resumable SSE endpoints. Has no effect on non-resumable endpoints.
Types ¶
type RequestOption ¶
type RequestOption = core.RequestOption
RequestOption adapts the behavior of an individual request.