Example #1
0
        public IndividualTicketFieldResponse CreateTicketField(TicketField ticketField)
        {
            var request = new RestRequest
            {
                Method = Method.POST,
                Resource = "ticket_fields.json",
                RequestFormat = DataFormat.Json
            };

            var tmp = new
                          {
                              type = ticketField.Type,
                              title = ticketField.Title,
                          };
            request.AddAndSerializeParam(new { ticket_field = tmp }, ParameterType.RequestBody);

            var res = Execute<IndividualTicketFieldResponse>(request);
            return res;

            //return GenericPost<IndividualTicketFieldResponse, object>("ticket_fields.json", new { ticket_field = tmp });
        }
Example #2
0
 public IndividualTicketFieldResponse UpdateTicketField(TicketField ticketField)
 {
     return GenericPut<IndividualTicketFieldResponse>(string.Format("ticket_fields/{0}.json", ticketField.Id), ticketField);
 }
        public void CanCreateUpdateAndDeleteTicketFields()
        {
            var tField = new TicketField()
                             {
                                 Type = TicketFieldTypes.Text,
                                 Title = "MyField",
                             };

            var res = api.Tickets.CreateTicketField(tField);
            Assert.NotNull(res.TicketField);

            var updatedTF = res.TicketField;
            updatedTF.Title = "My Custom Field";

            var updatedRes = api.Tickets.UpdateTicketField(updatedTF);
            Assert.AreEqual(updatedRes.TicketField.Title, updatedTF.Title);

            Assert.True(api.Tickets.DeleteTicketField(updatedTF.Id.Value));
        }