Skip to content

Commit

Permalink
incident_api: added option to reopen and close incidents
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelFangel committed Apr 28, 2024
1 parent 92748b3 commit 4b37525
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/incident_api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ defmodule LogpointApi.IncidentApi do
def resolve_incidents(ip, credential, %IncidentIDs{} = incident_ids),
do: update_incident_state(ip, "/resolve_incident", credential, incident_ids)

@spec reopen_incidents(String.t(), Credential.t(), IncidentIDs.t()) ::
{:ok, map()} | {:error, String.t()}
def reopen_incidents(ip, credential, %IncidentIDs{} = incident_ids),
do: update_incident_state(ip, "/reopen_incident", credential, incident_ids)

@spec close_incidents(String.t(), Credential.t(), IncidentIDs.t()) ::
{:ok, map()} | {:error, String.t()}
def close_incidents(ip, credential, %IncidentIDs{} = incident_ids),
do: update_incident_state(ip, "/close_incident", credential, incident_ids)

@spec update_incident_state(String.t(), String.t(), Credential.t(), map()) ::
{:ok, map()} | {:error, String.t()}
defp update_incident_state(ip, path, %Credential{} = credential, request_data) do
Expand Down

0 comments on commit 4b37525

Please sign in to comment.