@@ -17,19 +17,25 @@ trait ManagesNotifications
17
17
*/
18
18
public function getNotification ($ notificationId )
19
19
{
20
- $ response = $ this ->get ("notifications/ {$ notificationId }" );
20
+ $ response = $ this ->get ("notifications/ {$ notificationId }" )[ ' data ' ] ;
21
21
22
22
return new Notification ($ response , $ this );
23
23
}
24
24
25
25
/**
26
26
* Get All Notifications
27
- *
27
+ * @param array $queryParams
28
28
* @return \Novu\SDK\Resources\Notification
29
29
*/
30
- public function getNotifications ()
30
+ public function getNotifications (array $ queryParams = [] )
31
31
{
32
- $ response = $ this ->get ("notifications " )['data ' ];
32
+ $ uri = "notifications " ;
33
+
34
+ if (! empty ($ queryParams )) {
35
+ $ uri .= '? ' . http_build_query ($ queryParams );
36
+ }
37
+
38
+ $ response = $ this ->get ($ uri );
33
39
34
40
return new Notification ($ response , $ this );
35
41
}
@@ -48,13 +54,19 @@ public function getNotificationStats()
48
54
49
55
/**
50
56
* Get Notification Graph Stats
51
- *
57
+ * @param array $queryParams
52
58
* @return \Novu\SDK\Resources\NotificationGraphStats
53
59
*/
54
- public function getNotificationGraphStats ()
60
+ public function getNotificationGraphStats (array $ queryParams = [] )
55
61
{
56
- $ response = $ this ->get ("notifications/graph/stats " )['data ' ];
62
+ $ uri = "notifications/graph/stats " ;
63
+
64
+ if (! empty ($ queryParams )) {
65
+ $ uri .= '? ' . http_build_query ($ queryParams );
66
+ }
57
67
68
+ $ response = $ this ->get ($ uri )['data ' ];
69
+
58
70
return new NotificationGraphStats ($ response , $ this );
59
71
}
60
72
0 commit comments