Example #1
0
        public void CanCreateAndUpdateRequests()
        {
            var req = new Request()
                          {
                              Subject = "end user request test",
                              Comment = new Comment() {Body = "end user test"}
                          };


            var res = api.Requests.CreateRequest(req);
            Assert.True(res.Request.Id > 0);

            var res1 = api.Requests.GetRequestById(res.Request.Id.Value);
            Assert.AreEqual(res1.Request.Id, res.Request.Id);

            res1.Request.Subject = "new subject";
            res1.Request.Comment = new Comment()
                {
                    Body = "something more to say"
                };

            var res2 = api.Requests.UpdateRequest(res1.Request);
            //var res2 = api.Requests.UpdateRequest(res.Request.Id.Value, new Comment() {Body = "something more to say"});
            var res3 = api.Requests.GetRequestCommentsById(res.Request.Id.Value);

            Assert.AreEqual(res3.Comments.Last().Body.Replace("\n", ""), "something more to say");

            var res4 = api.Requests.GetSpecificRequestComment(res.Request.Id.Value, res3.Comments.Last().Id.Value);
            Assert.AreEqual(res4.Comment.Id, res3.Comments.Last().Id);

            Assert.True(api.Tickets.Delete(res1.Request.Id.Value));
        }
Example #2
0
 public IndividualRequestResponse UpdateRequest(Request request, Comment comment=null)
 {
     if (comment != null)
         request.Comment = comment;
     var body = new { request };
     
     return GenericPut<IndividualRequestResponse>(string.Format("requests/{0}.json", request.Id.Value), body);
 }
Example #3
0
 public IndividualRequestResponse CreateRequest(Request request)
 {
     var body = new {request};
     return GenericPost<IndividualRequestResponse>("requests.json", body);
 }
Example #4
0
 public async Task<IndividualRequestResponse> CreateRequestAsync(Request request)
 {
     var body = new {request};
     return await GenericPostAsync<IndividualRequestResponse>("requests.json", body);
 }
Example #5
0
        public IndividualRequestResponse UpdateRequest(Request request, Comment comment=null)
        {
            if (!request.Id.HasValue) { throw new ArgumentException("request must have Id set."); }

            if (comment != null)
            {
                request.Comment = comment;
            }

            var body = new { request };
            
            return GenericPut<IndividualRequestResponse>(string.Format("requests/{0}.json", request.Id.Value), body);
        }
Example #6
0
        public IndividualRequestResponse UpdateRequest(long id, Comment comment)
        {
            var request = new Request
            {
                Id = id,
                Comment = comment
            };

            return UpdateRequest(request);
        }