Documentation
¶
Overview ¶
Package requestconfig holds the resolved per-request configuration. It lives in internal/ so the option package can mutate it and the bird package can read it without an import cycle between them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attempt ¶
Attempt performs one network round-trip with the per-attempt context and the idempotency key to set as a header.
type Config ¶
type Config struct {
BaseURL string
APIKey string
Region string
APIVersion string
HTTPClient *http.Client
MaxRetries int
Timeout time.Duration
IdempotencyKey string
WebhookSecret string
Header http.Header
ResponseInto *Response
EmailDefaults EmailDefaults
// Sealed is set on the per-call config so construction-only options
// (WithBaseURL/WithAPIKey/WithHTTPClient) can reject being applied per call.
Sealed bool
}
Config is the settings for a single API call. Client options seed it at construction; per-call options Clone it and override individual fields.
BaseURL, APIKey, Region, and HTTPClient take effect at client construction only — the underlying HTTP client is built once. The remaining fields are honored per call.
func (Config) Clone ¶
Clone returns a copy safe to mutate with per-call options. The Header map is deep-copied; ResponseInto stays a shared pointer so the call can write into the caller's Response.
func (Config) Execute ¶
Execute runs the request lifecycle: for a mutation, a single idempotency key generated once and reused across attempts; a per-attempt timeout; and retries of transient failures with jittered backoff honoring Retry-After. It returns the drained 2xx body, or a typed *apierror error, and writes transport metadata to cfg.ResponseInto when set.
type EmailDefaults ¶
type EmailDefaults struct {
From string
ReplyTo []string
Category oapi.EmailMessageCategory
TrackOpens *bool
TrackClicks *bool
Headers map[string]string
Tags []oapi.Tag
Metadata map[string]interface{}
}
EmailDefaults are values applied to an email send when the per-send params leave the corresponding field unset. Re-exported as bird.EmailDefaults.