From bb1d105a6dfe229c8ab911d1278206ab07a216d7 Mon Sep 17 00:00:00 2001 From: Andrew Summers Date: Mon, 3 Aug 2020 20:39:49 -0500 Subject: [PATCH 1/2] Add get incident and list log entries endpoints --- lib/mixduty/incidents.ex | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/mixduty/incidents.ex b/lib/mixduty/incidents.ex index 3cb2e51..108409c 100644 --- a/lib/mixduty/incidents.ex +++ b/lib/mixduty/incidents.ex @@ -40,6 +40,27 @@ defmodule Mixduty.Incidents do post("#{@path}", client, body) end + @doc """ + Get an incident + #### Example + Mixduty.Users.incident("P00PBUG", client) + """ + def incident(id, client, params \\ [], options \\ []) do + get("#{@path}/#{id}", client, params, options) + end + + @doc """ + List log entries of an incident + #### Example + Mixduty.Incidents.log_entries("P00PBUG", client) + """ + def log_entries(incident_id, client, params \\ [], options \\ []) do + @path + |> Path.join(incident_id) + |> Path.join("log_entries") + |> get(client, params, options) + end + @doc """ Create an incident note #### Example From ff2f7542963694ef9f183b4be997492112afd60e Mon Sep 17 00:00:00 2001 From: Andrew Summers Date: Tue, 4 Aug 2020 19:19:28 -0500 Subject: [PATCH 2/2] Fix function docs. --- lib/mixduty/incidents.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mixduty/incidents.ex b/lib/mixduty/incidents.ex index 108409c..45790b1 100644 --- a/lib/mixduty/incidents.ex +++ b/lib/mixduty/incidents.ex @@ -24,7 +24,7 @@ defmodule Mixduty.Incidents do @doc """ Create an incident #### Example - Mixduty.Incident.create("Server is on fire", "P00PBUG", "user@pagerduty.com", client) + Mixduty.Incidents.create("Server is on fire", "P00PBUG", "user@pagerduty.com", client) """ def create(title, service_id, from, client, options \\ %{}) do incident_body = %{ @@ -43,7 +43,7 @@ defmodule Mixduty.Incidents do @doc """ Get an incident #### Example - Mixduty.Users.incident("P00PBUG", client) + Mixduty.Incidents.incident("P00PBUG", client) """ def incident(id, client, params \\ [], options \\ []) do get("#{@path}/#{id}", client, params, options) @@ -64,7 +64,7 @@ defmodule Mixduty.Incidents do @doc """ Create an incident note #### Example - Mixduty.Incident.create_note("This is a note describing details", "P00PBUG", "user@pagerduty.com", client) + Mixduty.Incidents.create_note("This is a note describing details", "P00PBUG", "user@pagerduty.com", client) """ def create_note(note, incident_id, from, client) do body = %{