| 1 | // Package types provides the core type definitions and interfaces used throughout |
| 2 | // the shoutrrr notification library. |
| 3 | // |
| 4 | // This package defines the fundamental abstractions for notification services, |
| 5 | // including service interfaces, configuration types, message structures, and |
| 6 | // supporting utilities that enable consistent interaction with various |
| 7 | // notification channels. |
| 8 | // |
| 9 | // # Core Interfaces |
| 10 | // |
| 11 | // The package defines several key interfaces that form the foundation of |
| 12 | // shoutrrr's architecture: |
| 13 | // |
| 14 | // - Service: The primary interface for all notification services, combining |
| 15 | // sending, templating, and lifecycle management capabilities. |
| 16 | // - Sender: Defines the basic contract for sending notifications. |
| 17 | // - RichSender: Interface for services that support structured message items |
| 18 | // (attachments, fields, timestamps). The router dispatches SendItems to |
| 19 | // services implementing this interface; services that don't implement it |
| 20 | // fall back to plain text via ItemsToPlain. |
| 21 | // - ContextSender: Opt-in interface for services that accept a context.Context |
| 22 | // for cancellation and deadline propagation via SendContext. |
| 23 | // - ContextAttachmentSender: Opt-in interface for services that accept a |
| 24 | // context.Context in SendItemsContext for cancellation and deadline |
| 25 | // propagation on rich sends. |
| 26 | // - Templater: Provides template management for message formatting. |
| 27 | // - ServiceConfig: Common interface for service configuration types. |
| 28 | // - Generator: Interface for tools that generate service configurations. |
| 29 | // - HTTPClient: Interface for outbound HTTP operations (satisfied by *http.Client). |
| 30 | // Used for SSRF protection and custom egress control. |
| 31 | // - HTTPClientSetter: Implemented by services to accept a custom HTTPClient |
| 32 | // (injected by router.NewWithOptions / NewSenderWithOptions). |
| 33 | // - SenderOptions: Options for creating senders/routers, including HTTPClient |
| 34 | // and Timeout overrides. |
| 35 | // |
| 36 | // # Message Types |
| 37 | // |
| 38 | // Message handling is supported through several types: |
| 39 | // |
| 40 | // - MessageItem: Represents an individual notification entry with text, |
| 41 | // timestamp, level, and optional fields or file attachments. |
| 42 | // - MessageLevel: Denotes the urgency/severity of a message (Unknown, Debug, |
| 43 | // Info, Warning, Error). Params.SetLevel and Params.Level provide a |
| 44 | // convention for passing severity through the send pipeline. |
| 45 | // - Field: Key/value pairs for extra data in log messages. |
| 46 | // - File: Represents file attachments for messages. |
| 47 | // - TargetError: Wraps a send failure with the service URL/ID that produced it, |
| 48 | // enabling callers to identify which target failed in a multi-target send. |
| 49 | // Implements Unwrap so errors.Is and errors.As work against the underlying error. |
| 50 | // |
| 51 | // # Configuration Types |
| 52 | // |
| 53 | // Configuration management types include: |
| 54 | // |
| 55 | // - Params: A string map for providing additional variables to service |
| 56 | // templates, with helper methods for setting and retrieving common |
| 57 | // parameters like title, message, and level. |
| 58 | // - ServiceOpts: Interface describing service options including verbosity, |
| 59 | // logging, and properties. |
| 60 | // - ConfigQueryResolver: Interface for getting, setting, and listing service |
| 61 | // config query fields. |
| 62 | // |
| 63 | // # Supporting Types |
| 64 | // |
| 65 | // Additional utility types provided by the package: |
| 66 | // |
| 67 | // - EnumFormatter: Handles formatting of enumerated configuration values. |
| 68 | // - StdLogger: Standard logging interface used by services. |
| 69 | // - QueuedSender: Interface for senders that support message queuing. |
| 70 | // - CustomURLConfig: Interface for configurations that support custom URL |
| 71 | // resolution. |
| 72 | // - MessageLimit: Defines limits for message content. |
| 73 | // |
| 74 | // The types in this package are designed to be used by both service |
| 75 | // implementers and consumers of the shoutrrr library, providing a consistent |
| 76 | // and extensible foundation for notification functionality. |
| 77 | package types |