Skip to content

Commit 9cf719c

Browse files
authored
Merge pull request #463 from yuvalon/patch-1
adding support for followUpIds in tickets
2 parents e1ac77f + 723f255 commit 9cf719c

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/ZendeskApi_v2/Models/Tickets/Ticket.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,11 @@ public class Ticket : BaseTicket
131131
/// </summary>
132132
[JsonProperty("incident_count")]
133133
public int? IncidentCount { get; set; }
134+
135+
/// <summary>
136+
/// Any follow-up tickets to this ticket.
137+
/// </summary>
138+
[JsonProperty("followup_ids")]
139+
public IList<long> FollowUpIds { get; set; }
134140
}
135141
}

test/ZendeskApi_v2.Test/TicketTestPart2.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,37 @@ public async Task CustomDropDownFieldSaveAsync()
136136

137137
Assert.True(api.Tickets.Delete(newTicket.Id.Value));
138138
}
139+
140+
[Test]
141+
public async Task CanGetFollowUpIds()
142+
{
143+
var ticket = new Ticket { Comment = new Comment { Body = "Original ticket", Public = false } };
144+
145+
var resp1 = await api.Tickets.CreateTicketAsync(ticket);
146+
147+
var closedTicket = resp1.Ticket;
148+
149+
closedTicket.Status = TicketStatus.Closed;
150+
151+
await api.Tickets.UpdateTicketAsync(closedTicket, new Comment { Body = "Closing Original Ticket" });
152+
153+
var ticket_Followup = new Ticket()
154+
{
155+
Subject = "I am the follow up Ticket",
156+
Comment = new Comment { Body = "I will be linked to the closed ticket" },
157+
Priority = TicketPriorities.Low,
158+
ViaFollowupSourceId = closedTicket.Id.Value
159+
};
160+
161+
var resp3 = await api.Tickets.CreateTicketAsync(ticket_Followup);
162+
var resp4 = api.Tickets.GetTicket(closedTicket.Id.Value);
163+
164+
Assert.That(resp3.Ticket.Via.Source.Rel, Is.EqualTo("follow_up"));
165+
Assert.AreEqual(resp4.Ticket.FollowUpIds.Count, 1);
166+
Assert.AreEqual(resp4.Ticket.FollowUpIds.ElementAt(0), resp3.Ticket.Id);
167+
168+
Assert.That(await api.Tickets.DeleteAsync(resp3.Ticket.Id.Value), Is.True);
169+
Assert.That(await api.Tickets.DeleteAsync(closedTicket.Id.Value), Is.True);
170+
}
139171
}
140172
}

0 commit comments

Comments
 (0)