This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: fill out the message struct

+75 -4
+25 -1
events.go
··· 1 1 package notella 2 2 3 + import "time" 4 + 3 5 type Event string 4 6 5 7 const ( ··· 11 13 ) 12 14 13 15 type Message struct { 16 + // Unique ID for the notification scheduling request. 14 17 Id string `json:"id"` 15 - // IMPORTANT: Keep this up to date!!! 18 + // When to push the notification 19 + SendAt time.Time `json:"send_at"` 20 + // Type of event that triggered the notification 16 21 Event Event `json:"event" jsonschema:"enum=new_ticket,enum=new_post,enum=godchild_request,enum=new_comment,enum=comment_reply"` 22 + // Churros ID of the ressource (the ticket, the post, the comment, etc) 23 + // Used to determine to whom the notification should be sent 24 + // For godchild_request, this is not a user id, but a godparent request id. 25 + ChurrosObjectId string `json:"object_id"` 26 + // Notification title 27 + Title string `json:"title"` 28 + // Notification body 29 + Body string `json:"body"` 30 + // URL to go to when the notification is clicked 31 + Action string `json:"action"` 32 + // Additional action buttons 33 + Actions []struct { 34 + // Label of the action button 35 + Label string `json:"label"` 36 + // URL to go to when the action button is clicked 37 + Action string `json:"action"` 38 + } `json:"actions"` 39 + // URL to an image to display in the notification 40 + Image string `json:"image"` 17 41 }
+5 -2
scripts/typing.go
··· 11 11 ) 12 12 13 13 func main() { 14 - // Generate the JSON schema 15 - schema := jsonschema.Reflect(&notella.Message{}) 14 + reflector := new(jsonschema.Reflector) 15 + if err := reflector.AddGoComments("git.inpt.fr/churros/notella", "./"); err != nil { 16 + fmt.Printf("Error adding Go comments: %v\n", err) 17 + } 18 + schema := reflector.Reflect(&notella.Message{}) 16 19 schemaJSON, err := json.Marshal(schema) 17 20 if err != nil { 18 21 fmt.Printf("Error generating schema: %v\n", err)
+45 -1
types.d.ts
··· 1 1 export interface Message { 2 + /** 3 + * URL to go to when the action button is clicked 4 + */ 5 + action: string; 6 + /** 7 + * Additional action buttons 8 + */ 9 + actions: Action[]; 10 + /** 11 + * Notification body 12 + */ 13 + body: string; 14 + /** 15 + * Type of event that triggered the notification 16 + */ 2 17 event: Event; 3 - id: string; 18 + /** 19 + * Unique ID for the notification scheduling request. 20 + */ 21 + id: string; 22 + /** 23 + * URL to an image to display in the notification 24 + */ 25 + image: string; 26 + /** 27 + * Churros ID of the ressource (the ticket, the post, the comment, etc) 28 + * Used to determine to whom the notification should be sent 29 + * For godchild_request, this is not a user id, but a godparent request id. 30 + */ 31 + object_id: string; 32 + /** 33 + * When to push the notification 34 + */ 35 + send_at: Date; 36 + /** 37 + * Notification title 38 + */ 39 + title: string; 4 40 } 5 41 42 + export interface Action { 43 + action: string; 44 + label: string; 45 + } 46 + 47 + /** 48 + * Type of event that triggered the notification 49 + */ 6 50 export enum Event { 7 51 CommentReply = "comment_reply", 8 52 GodchildRequest = "godchild_request",