File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,49 @@ public function getById($id)
56
56
return $ this ->serializeAlertResponse ($ body ->data );
57
57
}
58
58
59
+ /**
60
+ * Get all alerts
61
+ *
62
+ * @param int $page
63
+ * @param int $perPage
64
+ * @param array $filters
65
+ * @throws \GuzzleHttp\Exception\GuzzleException
66
+ */
67
+ public function getAlerts ($ page = 1 , $ perPage = 15 , $ filters = [])
68
+ {
69
+ $ page = $ this ->paginatedRequest ('v1/alerts/rules ' , $ page , $ perPage , $ filters );
70
+
71
+ $ page ->serializeWith (function ($ item ) {
72
+ return $ this ->serializeAlertResponse ($ item );
73
+ });
74
+
75
+ return $ page ;
76
+ }
77
+
78
+ /**
79
+ * Encode and send the data to the API.
80
+ *
81
+ * @param $data
82
+ */
83
+ public function toggleAlerts ($ data )
84
+ {
85
+ $ response = $ this ->post ('v1/alerts/rules/toggle ' , json_encode ($ data ));
86
+ $ body = $ this ->decodeJson ($ response ->getBody ()->getContents ());
87
+ return $ body ;
88
+ }
89
+
90
+ /**
91
+ * Encode and send the data to the API.
92
+ *
93
+ * @param $data
94
+ */
95
+ public function bulkToggleAlerts ($ data )
96
+ {
97
+ $ response = $ this ->post ('v1/alerts/rules/bulk-toggle ' , json_encode ($ data ));
98
+ $ body = $ this ->decodeJson ($ response ->getBody ()->getContents ());
99
+ return $ body ;
100
+ }
101
+
59
102
/**
60
103
* Serialize the response to use friendly names
61
104
* @param $data
You can’t perform that action at this time.
0 commit comments