@@ -22,6 +22,9 @@ import (
22
22
type NotificationCounts struct {
23
23
MissedCalls int `json:"missed_calls,omitempty"`
24
24
Unread int `json:"unread,omitempty"`
25
+
26
+ BeeperServerType string `json:"com.beeper.server_type,omitempty"`
27
+ BeeperAsOfToken string `json:"com.beeper.as_of_token,omitempty"`
25
28
}
26
29
27
30
type PushPriority string
@@ -31,11 +34,69 @@ const (
31
34
PushPriorityLow PushPriority = "low"
32
35
)
33
36
37
+ type PushFormat string
38
+
39
+ const (
40
+ PushFormatDefault PushFormat = ""
41
+ PushFormatEventIDOnly PushFormat = "event_id_only"
42
+ )
43
+
44
+ type PusherData map [string ]any
45
+
46
+ func (pd PusherData ) Format () PushFormat {
47
+ val , _ := pd ["format" ].(string )
48
+ return PushFormat (val )
49
+ }
50
+
51
+ func (pd PusherData ) URL () string {
52
+ val , _ := pd ["url" ].(string )
53
+ return val
54
+ }
55
+
56
+ // ConvertToNotificationData returns a copy of the map with the url and format fields removed.
57
+ func (pd PusherData ) ConvertToNotificationData () PusherData {
58
+ pdCopy := make (PusherData , len (pd )- 2 )
59
+ for key , value := range pd {
60
+ if key != "format" && key != "url" {
61
+ pdCopy [key ] = value
62
+ }
63
+ }
64
+ return pdCopy
65
+ }
66
+
67
+ type PusherKind string
68
+
69
+ const (
70
+ PusherKindHTTP PusherKind = "http"
71
+ PusherKindEmail PusherKind = "email"
72
+ )
73
+
74
+ type PusherAppID string
75
+
76
+ const (
77
+ PusherAppEmail PusherAppID = "m.email"
78
+ )
79
+
80
+ type Pusher struct {
81
+ AppDisplayName string `json:"app_display_name"`
82
+ AppID PusherAppID `json:"app_id"`
83
+ Data PusherData `json:"data"`
84
+ DeviceDisplayName string `json:"device_display_name"`
85
+ Kind * PusherKind `json:"kind"`
86
+ Language string `json:"lang"`
87
+ ProfileTag string `json:"profile_tag,omitempty"`
88
+ PushKey string `json:"pushkey"`
89
+ }
90
+
91
+ type RespPushers struct {
92
+ Pushers []Pusher `json:"pushers"`
93
+ }
94
+
34
95
type BaseDevice struct {
35
- AppID string `json:"app_id"`
36
- PushKey string `json:"pushkey"`
37
- PushKeyTS int64 `json:"pushkey_ts,omitempty"`
38
- Data map [ string ] any `json:"data,omitempty"`
96
+ AppID PusherAppID `json:"app_id"`
97
+ PushKey string `json:"pushkey"`
98
+ PushKeyTS int64 `json:"pushkey_ts,omitempty"`
99
+ Data PusherData `json:"data,omitempty"`
39
100
}
40
101
41
102
type PushKey struct {
0 commit comments