1
+ <?php
2
+
3
+ namespace Novu \SDK \Actions ;
4
+
5
+ use Novu \SDK \Resources \Notification ;
6
+ use Novu \SDK \Resources \NotificationStats ;
7
+ use Novu \SDK \Resources \NotificationGraphStats ;
8
+
9
+ trait ManagesNotifications
10
+ {
11
+
12
+ /**
13
+ * Get A Notification
14
+ *
15
+ * @param string $notificationId
16
+ * @return \Novu\SDK\Resources\Notification
17
+ */
18
+ public function getNotification ($ notificationId )
19
+ {
20
+ $ response = $ this ->get ("notifications/ {$ notificationId }" );
21
+
22
+ return new Notification ($ response , $ this );
23
+ }
24
+
25
+ /**
26
+ * Get All Notifications
27
+ *
28
+ * @return \Novu\SDK\Resources\Notification
29
+ */
30
+ public function getNotifications ()
31
+ {
32
+ $ response = $ this ->get ("notifications " )['data ' ];
33
+
34
+ return new Notification ($ response , $ this );
35
+ }
36
+
37
+ /**
38
+ * Get Notification Statistics
39
+ *
40
+ * @return \Novu\SDK\Resources\NotificationStats
41
+ */
42
+ public function getNotificationStats ()
43
+ {
44
+ $ response = $ this ->get ("notifications/stats " )['data ' ];
45
+
46
+ return new NotificationStats ($ response , $ this );
47
+ }
48
+
49
+ /**
50
+ * Get Notification Graph Stats
51
+ *
52
+ * @return \Novu\SDK\Resources\NotificationGraphStats
53
+ */
54
+ public function getNotificationGraphStats ()
55
+ {
56
+ $ response = $ this ->get ("notifications/graph/stats " )['data ' ];
57
+
58
+ return new NotificationGraphStats ($ response , $ this );
59
+ }
60
+
61
+ }
0 commit comments