Documentation
¶
Overview ¶
Package registry provides types for provider registration and discovery.
Index ¶
- type CallSystemProviderFactory
- type ProviderConfig
- type ProviderOption
- func WithAPIKey(apiKey string) ProviderOption
- func WithAccountSID(sid string) ProviderOption
- func WithAuthToken(token string) ProviderOption
- func WithBaseURL(baseURL string) ProviderOption
- func WithExtension(key string, value any) ProviderOption
- func WithPhoneNumber(number string) ProviderOption
- func WithRegion(region string) ProviderOption
- func WithWebhookURL(url string) ProviderOption
- type Registry
- type STTProviderFactory
- type TTSProviderFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallSystemProviderFactory ¶
type CallSystemProviderFactory func(config ProviderConfig) (callsystem.CallSystem, error)
CallSystemProviderFactory creates a CallSystem provider with the given configuration.
type ProviderConfig ¶
type ProviderConfig struct {
// APIKey is the authentication key for the provider.
APIKey string //nolint:gosec // G117: This is a config struct, not storing secrets
// BaseURL is an optional custom API endpoint.
BaseURL string
// Extensions holds provider-specific configuration.
Extensions map[string]any
}
ProviderConfig holds common configuration options for creating providers.
func ApplyOptions ¶
func ApplyOptions(opts ...ProviderOption) ProviderConfig
ApplyOptions applies provider options to a config.
type ProviderOption ¶
type ProviderOption func(*ProviderConfig)
ProviderOption configures a ProviderConfig.
func WithAPIKey ¶
func WithAPIKey(apiKey string) ProviderOption
WithAPIKey sets the API key for the provider.
func WithAccountSID ¶
func WithAccountSID(sid string) ProviderOption
WithAccountSID sets the account SID (Twilio).
func WithAuthToken ¶
func WithAuthToken(token string) ProviderOption
WithAuthToken sets the auth token (Twilio).
func WithBaseURL ¶
func WithBaseURL(baseURL string) ProviderOption
WithBaseURL sets a custom base URL for the provider.
func WithExtension ¶
func WithExtension(key string, value any) ProviderOption
WithExtension sets a provider-specific configuration value.
func WithPhoneNumber ¶
func WithPhoneNumber(number string) ProviderOption
WithPhoneNumber sets the default outbound phone number.
func WithWebhookURL ¶
func WithWebhookURL(url string) ProviderOption
WithWebhookURL sets the webhook URL for incoming calls.
type Registry ¶
type Registry interface {
// TTS registration
RegisterTTSProvider(name string, factory TTSProviderFactory)
GetTTSProvider(name string, opts ...ProviderOption) (tts.Provider, error)
ListTTSProviders() []string
HasTTSProvider(name string) bool
// STT registration
RegisterSTTProvider(name string, factory STTProviderFactory)
GetSTTProvider(name string, opts ...ProviderOption) (stt.Provider, error)
ListSTTProviders() []string
HasSTTProvider(name string) bool
// CallSystem registration
RegisterCallSystemProvider(name string, factory CallSystemProviderFactory)
GetCallSystemProvider(name string, opts ...ProviderOption) (callsystem.CallSystem, error)
ListCallSystemProviders() []string
HasCallSystemProvider(name string) bool
}
Registry defines the interface for provider discovery.
type STTProviderFactory ¶
type STTProviderFactory func(config ProviderConfig) (stt.Provider, error)
STTProviderFactory creates an STT provider with the given configuration.
type TTSProviderFactory ¶
type TTSProviderFactory func(config ProviderConfig) (tts.Provider, error)
TTSProviderFactory creates a TTS provider with the given configuration.