Debian Codegraph @

pkg/types/doc.go

raw
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 // - DialContextFunc: Signature of net.Dialer.DialContext for non-HTTP TCP
34 // connections. Used for SSRF protection and custom egress control.
35 // - DialContextSetter: Implemented by services to accept a custom DialContextFunc
36 // (injected by router.NewWithOptions / NewSenderWithOptions).
37 // - SenderOptions: Options for creating senders/routers, including HTTPClient,
38 // DialContext, and Timeout overrides.
39 //
40 // # Message Types
41 //
42 // Message handling is supported through several types:
43 //
44 // - MessageItem: Represents an individual notification entry with text,
45 // timestamp, level, and optional fields or file attachments.
46 // - MessageLevel: Denotes the urgency/severity of a message (Unknown, Debug,
47 // Info, Warning, Error). Params.SetLevel and Params.Level provide a
48 // convention for passing severity through the send pipeline.
49 // - Field: Key/value pairs for extra data in log messages.
50 // - File: Represents file attachments for messages.
51 // - TargetError: Wraps a send failure with the service URL/ID that produced it,
52 // enabling callers to identify which target failed in a multi-target send.
53 // Implements Unwrap so errors.Is and errors.As work against the underlying error.
54 //
55 // # Configuration Types
56 //
57 // Configuration management types include:
58 //
59 // - Params: A string map for providing additional variables to service
60 // templates, with helper methods for setting and retrieving common
61 // parameters like title, message, and level.
62 // - ServiceOpts: Interface describing service options including verbosity,
63 // logging, and properties.
64 // - ConfigQueryResolver: Interface for getting, setting, and listing service
65 // config query fields.
66 //
67 // # Supporting Types
68 //
69 // Additional utility types provided by the package:
70 //
71 // - EnumFormatter: Handles formatting of enumerated configuration values.
72 // - StdLogger: Standard logging interface used by services.
73 // - QueuedSender: Interface for senders that support message queuing.
74 // - CustomURLConfig: Interface for configurations that support custom URL
75 // resolution.
76 // - MessageLimit: Defines limits for message content.
77 //
78 // The types in this package are designed to be used by both service
79 // implementers and consumers of the shoutrrr library, providing a consistent
80 // and extensible foundation for notification functionality.
81 package types