public void Serialise_SafeModifyTags(SafeModifyTags ticket) { var json = JsonConvert.SerializeObject( ticket, Zendesk.ApiFactoryExtensions.serialiser); var expected = $"{{\"ticket\":{{" + $"\"safe_update\":true," + $"\"updated_stamp\":\"{ticket.UpdatedStamp.ToString(iso8601)}\"," + $"\"tags\":[{ticket.Tags.ToQuotedList()}]" + $"}}}}"; json.Should().BeEquivalentTo(expected); }
public static async Task ModifyTags( this IApi api, Ticket ticket, string[]?additions = null, string[]?removals = null) { if (api == null) { throw new ArgumentNullException(nameof(api)); } if (ticket == null) { throw new ArgumentNullException(nameof(ticket)); } var ticketResponse = await api.GetTicket(ticket.Id); var update = new SafeModifyTags(ticketResponse.Ticket); update.Add(additions ?? Array.Empty <string>()); update.Remove(removals ?? Array.Empty <string>()); await api.UpdateTags(ticket.Id, update); }
public Task UpdateTags([Path] long id, [Body] SafeModifyTags update) { Tickets.First(x => x.Id == id).Tags = update.Tags; return(Task.CompletedTask); }
public Task UpdateTags([Path] long id, [Body] SafeModifyTags update) => Task.CompletedTask;