package ironnotify import "time" // Options configures the IronNotify client. type Options struct { // APIKey is the API key for authentication (required). // Format: ak_live_xxx or ak_test_xxx APIKey string // APIBaseURL is the base URL for the IronNotify API. // Default: https://api.ironnotify.com APIBaseURL string // WebSocketURL is the WebSocket URL for real-time notifications. // Default: wss://ws.ironnotify.com WebSocketURL string // Debug enables debug logging. Debug bool // EnableOfflineQueue enables offline notification queuing. // Default: true EnableOfflineQueue bool // MaxOfflineQueueSize is the maximum number of notifications to queue offline. // Default: 100 MaxOfflineQueueSize int // AutoReconnect enables automatic WebSocket reconnection. // Default: true AutoReconnect bool // MaxReconnectAttempts is the maximum number of reconnection attempts. // Default: 5 MaxReconnectAttempts int // ReconnectDelay is the base delay between reconnection attempts. // Default: 1 second ReconnectDelay time.Duration // HTTPTimeout is the timeout for HTTP requests. // Default: 30 seconds HTTPTimeout time.Duration } // DefaultOptions returns the default configuration options. func DefaultOptions() Options { return Options{ APIBaseURL: "https://api.ironnotify.com", WebSocketURL: "wss://ws.ironnotify.com", Debug: false, EnableOfflineQueue: true, MaxOfflineQueueSize: 100, AutoReconnect: true, MaxReconnectAttempts: 5, ReconnectDelay: time.Second, HTTPTimeout: 30 * time.Second, } } // WithDefaults returns the options with default values applied. func (o Options) WithDefaults() Options { defaults := DefaultOptions() if o.APIBaseURL == "" { o.APIBaseURL = defaults.APIBaseURL } if o.WebSocketURL == "" { o.WebSocketURL = defaults.WebSocketURL } if o.MaxOfflineQueueSize == 0 { o.MaxOfflineQueueSize = defaults.MaxOfflineQueueSize } if o.MaxReconnectAttempts == 0 { o.MaxReconnectAttempts = defaults.MaxReconnectAttempts } if o.ReconnectDelay == 0 { o.ReconnectDelay = defaults.ReconnectDelay } if o.HTTPTimeout == 0 { o.HTTPTimeout = defaults.HTTPTimeout } return o }