Skip to content

Commit 4a1911f

Browse files
authored
Merge pull request #439 from nue-digital/4749-alert-email-toggle
* SDK changes for Alert toggling
2 parents 1ab1b15 + d1449e8 commit 4a1911f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/ThreatMonitoring/AlertClient.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,49 @@ public function getById($id)
5656
return $this->serializeAlertResponse($body->data);
5757
}
5858

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+
59102
/**
60103
* Serialize the response to use friendly names
61104
* @param $data

0 commit comments

Comments
 (0)