| 1 | package gotifyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/ |
| 2 | |
| 3 | import "fmtscip-go gomod github.com/golang/go/src . fmt/" |
| 4 | |
| 5 | // MessageRequest is the actual payload being sent to the Gotify API. |
| 6 | // This struct represents the JSON request body sent to the Gotify message endpoint, |
| 7 | // containing all notification data including message content, metadata, and custom extras. |
| 8 | type MessageRequestscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/MessageRequest# struct { |
| 9 | Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/MessageRequest#Message. string `json:"message"` // The main notification message text content |
| 10 | Titlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/MessageRequest#Title. string `json:"title"` // Notification title displayed in the Gotify interface |
| 11 | Priorityscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/MessageRequest#Priority. int `json:"priority"` // Priority level (-2-10) affecting notification behavior; negative values have special meanings in some clients |
| 12 | Datescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/MessageRequest#Date. *string `json:"date,omitempty"` // Optional custom timestamp in ISO 8601 format for the notification |
| 13 | Extrasscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/MessageRequest#Extras. map[string]any `json:"extras"` // Additional custom key-value pairs for extended functionality |
| 14 | } |
| 15 | |
| 16 | // messageResponse represents the successful response from the Gotify API. |
| 17 | // This struct captures the server's confirmation of message acceptance, |
| 18 | // including the assigned ID and metadata about the created notification. |
| 19 | type messageResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/messageResponse# struct { |
| 20 | Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/messageResponse#Message. string `json:"message"` // Echo of the sent message content |
| 21 | Titlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/messageResponse#Title. string `json:"title"` // Echo of the notification title |
| 22 | Priorityscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/messageResponse#Priority. int `json:"priority"` // Echo of the priority level set |
| 23 | Extrasscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/messageResponse#Extras. map[string]any `json:"extras"` // Echo of any extras sent with the message |
| 24 | IDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/messageResponse#ID. uint64 `json:"id"` // Unique identifier assigned by Gotify to this message |
| 25 | AppIDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/messageResponse#AppID. uint64 `json:"appid"` // Application ID that sent the message |
| 26 | Datescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/messageResponse#Date. string `json:"date"` // ISO 8601 timestamp of when the message was created |
| 27 | } |
| 28 | |
| 29 | // responseError represents an error response from the Gotify API. |
| 30 | // This struct captures structured error information returned by the server |
| 31 | // when a request fails, providing detailed error context. |
| 32 | type responseErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError# struct { |
| 33 | Namescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError#Name. string `json:"error"` // Error name/type identifier |
| 34 | Codescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError#Code. uint64 `json:"errorCode"` // Numeric error code for programmatic handling |
| 35 | Descriptionscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError#Description. string `json:"errorDescription"` // Human-readable error description |
| 36 | } |
| 37 | |
| 38 | // Error implements the error interface for responseError. |
| 39 | // This method formats the error information into a consistent error message |
| 40 | // that can be returned as a standard Go error. |
| 41 | func (er *responseErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError#) Errorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError#Error().() string { |
| 42 | return fmtscip-go gomod github.com/golang/go/src . fmt/.Sprintfscip-go gomod github.com/golang/go/src . fmt/Sprintf().("server responded with %v (%v): %v", er.Namescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError#Name., er.Codescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError#Code., er.Descriptionscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/gotify`/responseError#Description.) |
| 43 | } |