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 Event Event `json:"event" jsonschema:"enum=save_schedule,enum=clear_schedule,enum=clear_stored_schedule,enum=restore_schedule,enum=restore_schedule_eager,enum=clear_scheduled_jobs,enum=show_scheduled_jobs,enum=new_post,enum=godchild_request,enum=new_comment,enum=comment_reply,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"`
39 // Churros ID of the ressource (the ticket, the post, the comment, etc)
40 // Used to determine to whom the notification should be sent
41 // For godchild_request, this is not a user id, but a godparent request id.
42 ChurrosObjectId string `json:"object_id"`
43 // Notification title
44 Title string `json:"title"`
45 // Notification body
46 Body string `json:"body"`
47 // URL to go to when the notification is clicked
48 Action string `json:"action"`
49 // Additional action buttons
50 Actions []struct {
51 // Label of the action button
52 Label string `json:"label"`
53 // URL to go to when the action button is clicked
54 Action string `json:"action"`
55 } `json:"actions,omitempty"`
56 // URL to an image to display in the notification
57 Image string `json:"image,omitempty"`
58}