Skip to content

Commit

Permalink
Merge pull request #463 from yuvalon/patch-1
Browse files Browse the repository at this point in the history
adding support for followUpIds in tickets
  • Loading branch information
mozts2005 authored Nov 20, 2019
2 parents e1ac77f + 723f255 commit 9cf719c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ZendeskApi_v2/Models/Tickets/Ticket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,11 @@ public class Ticket : BaseTicket
/// </summary>
[JsonProperty("incident_count")]
public int? IncidentCount { get; set; }

/// <summary>
/// Any follow-up tickets to this ticket.
/// </summary>
[JsonProperty("followup_ids")]
public IList<long> FollowUpIds { get; set; }
}
}
32 changes: 32 additions & 0 deletions test/ZendeskApi_v2.Test/TicketTestPart2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,37 @@ public async Task CustomDropDownFieldSaveAsync()

Assert.True(api.Tickets.Delete(newTicket.Id.Value));
}

[Test]
public async Task CanGetFollowUpIds()
{
var ticket = new Ticket { Comment = new Comment { Body = "Original ticket", Public = false } };

var resp1 = await api.Tickets.CreateTicketAsync(ticket);

var closedTicket = resp1.Ticket;

closedTicket.Status = TicketStatus.Closed;

await api.Tickets.UpdateTicketAsync(closedTicket, new Comment { Body = "Closing Original Ticket" });

var ticket_Followup = new Ticket()
{
Subject = "I am the follow up Ticket",
Comment = new Comment { Body = "I will be linked to the closed ticket" },
Priority = TicketPriorities.Low,
ViaFollowupSourceId = closedTicket.Id.Value
};

var resp3 = await api.Tickets.CreateTicketAsync(ticket_Followup);
var resp4 = api.Tickets.GetTicket(closedTicket.Id.Value);

Assert.That(resp3.Ticket.Via.Source.Rel, Is.EqualTo("follow_up"));
Assert.AreEqual(resp4.Ticket.FollowUpIds.Count, 1);
Assert.AreEqual(resp4.Ticket.FollowUpIds.ElementAt(0), resp3.Ticket.Id);

Assert.That(await api.Tickets.DeleteAsync(resp3.Ticket.Id.Value), Is.True);
Assert.That(await api.Tickets.DeleteAsync(closedTicket.Id.Value), Is.True);
}
}
}

0 comments on commit 9cf719c

Please sign in to comment.