| 1 | package notifiarr |
| 2 | |
| 3 | // Field represents a field in the Discord embed. |
| 4 | type Field struct { |
| 5 | Title string `json:"title"` // Field title |
| 6 | Text string `json:"text"` // Field text content |
| 7 | Inline bool `json:"inline"` // Whether the field is inline |
| 8 | } |
| 9 | |
| 10 | // NotificationPayload represents the main payload structure for Notifiarr API. |
| 11 | type NotificationPayload struct { |
| 12 | Notification NotificationData `json:"notification"` |
| 13 | Discord *DiscordPayload `json:"discord,omitempty"` |
| 14 | } |
| 15 | |
| 16 | // NotificationData contains the notification metadata. |
| 17 | type NotificationData struct { |
| 18 | Update *bool `json:"update,omitempty"` // Optional boolean for updating existing messages |
| 19 | Name string `json:"name"` // Required name of the custom app/script |
| 20 | Event string `json:"event,omitempty"` // Optional unique ID for this notification |
| 21 | } |
| 22 | |
| 23 | // DiscordPayload contains Discord-specific configuration for notifications. |
| 24 | type DiscordPayload struct { |
| 25 | Color string `json:"color,omitempty"` // Optional color as 6-digit HTML color code |
| 26 | Ping *PingPayload `json:"ping,omitempty"` // Optional ping configuration |
| 27 | Images *ImagePayload `json:"images,omitempty"` // Optional image configuration |
| 28 | Text *TextPayload `json:"text,omitempty"` // Optional text configuration |
| 29 | IDs *IDPayload `json:"ids,omitempty"` // Optional IDs configuration |
| 30 | } |
| 31 | |
| 32 | // PingPayload contains ping configuration for Discord notifications. |
| 33 | type PingPayload struct { |
| 34 | PingUser *int `json:"pingUser,omitempty"` // Optional user ID to ping |
| 35 | PingRole *int `json:"pingRole,omitempty"` // Optional role ID to ping |
| 36 | } |
| 37 | |
| 38 | // ImagePayload contains image URLs for Discord notifications. |
| 39 | type ImagePayload struct { |
| 40 | Thumbnail string `json:"thumbnail,omitempty"` // Optional thumbnail URL |
| 41 | Image string `json:"image,omitempty"` // Optional image URL |
| 42 | } |
| 43 | |
| 44 | // TextPayload contains text content for Discord notifications. |
| 45 | type TextPayload struct { |
| 46 | Title string `json:"title,omitempty"` // Optional notification title |
| 47 | Icon string `json:"icon,omitempty"` // Optional icon URL |
| 48 | Content string `json:"content,omitempty"` // Optional content |
| 49 | Description string `json:"description,omitempty"` // Optional description |
| 50 | Fields []Field `json:"fields,omitempty"` // Optional fields array |
| 51 | Footer string `json:"footer,omitempty"` // Optional footer text |
| 52 | } |
| 53 | |
| 54 | // IDPayload contains required IDs for Discord notifications. |
| 55 | type IDPayload struct { |
| 56 | Channel int `json:"channel"` // Required channel ID |
| 57 | } |