This repository has no description
1package notella
2
3import "time"
4
5type Event string
6
7const (
8 // EventClearScheduledJobs is used to clear all future scheduled jobs for a given churros object
9 // For example, when adding a new ticket to an event, we want to unschedule all future notifications for the event since the shotgun date may have changed
10 EventClearScheduledJobs Event = "clear_scheduled_jobs"
11 EventClearStoredSchedule Event = "clear_stored_schedule"
12 EventShowScheduledJobs Event = "show_scheduled_jobs"
13 EventSaveSchedule Event = "save_schedule"
14 EventRestoreSchedule Event = "restore_schedule"
15 // Like restore_schedule, but also re-schedules events that have send_at in the past
16 EventRestoreScheduleEager Event = "restore_schedule_eager"
17 EventClearSchedule Event = "clear_schedule"
18 EventNewPost Event = "new_post"
19 EventGodchildRequest Event = "godchild_request"
20 EventCustom Event = "custom"
21 EventTest Event = "test"
22 EventGodchildAccepted Event = "godchild_accepted"
23 EventGodchildRejected Event = "godchild_rejected"
24 EventPendingSignup Event = "pending_signup"
25 EventLoginStuck Event = "login_stuck"
26 EventBookingPaid Event = "booking_paid"
27 EventContributionPaid Event = "contribution_paid"
28 EventShotgunOpensSoon Event = "shotgun_opens_soon"
29 EventShotgunClosesSoon Event = "shotgun_closes_soon"
30)
31
32type Message struct {
33 // Unique ID for the notification scheduling request.
34 Id string `json:"id"`
35 // When to push the notification
36 SendAt time.Time `json:"send_at"`
37 // Type of event that triggered the notification
38 // next-line-generate event-enum-jsonschema-values
39 Event Event `json:"event" jsonschema:"enum=clear_scheduled_jobs,enum=clear_stored_schedule,enum=show_scheduled_jobs,enum=save_schedule,enum=restore_schedule,enum=restore_schedule_eager,enum=clear_schedule,enum=new_post,enum=godchild_request,enum=custom,enum=test,enum=godchild_accepted,enum=godchild_rejected,enum=pending_signup,enum=login_stuck,enum=booking_paid,enum=contribution_paid,enum=shotgun_opens_soon,enum=shotgun_closes_soon"`
40 // Churros ID of the ressource (the ticket, the post, the comment, etc)
41 // Used to determine to whom the notification should be sent
42 // For godchild_request, this is not a user id, but a godparent request id.
43 ChurrosObjectId string `json:"object_id"`
44 // Notification title
45 Title string `json:"title"`
46 // Notification body
47 Body string `json:"body"`
48 // URL to go to when the notification is clicked
49 Action string `json:"action"`
50 // Additional action buttons
51 Actions []struct {
52 // Label of the action button
53 Label string `json:"label"`
54 // URL to go to when the action button is clicked
55 Action string `json:"action"`
56 } `json:"actions,omitempty"`
57 // URL to an image to display in the notification
58 Image string `json:"image,omitempty"`
59}