Example #1
0
        public int CreateTicketAsEndUser(string endUserEmail, Ticket ticket)
        {
            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = Requests + ".xml"
            };

            request.AddHeader(XOnBehalfOfEmail, endUserEmail);
            request.AddBody(ticket);

            //request.AddParameter("text/xml", string.Format("<ticket><subject>{0}</subject><description>{1}</description></ticket>", ticket.Subject, ticket.Description), ParameterType.RequestBody);

            var res = Execute(request);
            return GetIdFromLocationHeader(res);
        }
Example #2
0
        public int CreateTicketAsEndUser(string endUserEmail, Ticket ticket)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.POST,
                Resource = Requests + ".xml"
            };

            request.AddHeader(XOnBehalfOfEmail, endUserEmail);
            request.AddBody(ticket);

            //request.AddParameter("text/xml", string.Format("<ticket><subject>{0}</subject><description>{1}</description></ticket>", ticket.Subject, ticket.Description), ParameterType.RequestBody);

            var res = Execute(request);

            return(GetIdFromLocationHeader(res));
        }
Example #3
0
        public bool UpdateTicketAsEndUser(int ticketId, Comment comment)
        {
            string email = GetUserById(GetTicketById(ticketId).RequesterId).Email;

            var request = new ZenRestRequest
            {
                Method   = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Requests, ticketId.ToString())
            };

            request.AddHeader(XOnBehalfOfEmail, email);
            request.AddBody(comment);

            //request.AddParameter("text/xml", string.Format("<ticket><subject>{0}</subject><description>{1}</description></ticket>", ticket.Subject, ticket.Description), ParameterType.RequestBody);

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Example #4
0
        public List <Ticket> GetTicketsForUserByPage(string email, int page = 1)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = Requests + ".xml",
            };

            //Assume the user
            request.AddHeader(XOnBehalfOfEmail, email);
            request.AddParameter("page", page.ToString());

            //Get the open ones
            var ticktes = Execute <List <Ticket> >(request);

            //Now get the closed ones
            request.AddParameter("filter", "solved");
            var closedOrSolved = Execute <List <Ticket> >(request);

            ticktes.AddRange(closedOrSolved);
            return(ticktes);
        }
Example #5
0
        public bool UpdateTicketAsEndUser(int ticketId, Comment comment)
        {
            string email = GetUserById(GetTicketById(ticketId).RequesterId).Email;

            var request = new ZenRestRequest
            {
                Method = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Requests, ticketId.ToString())
            };

            request.AddHeader(XOnBehalfOfEmail, email);
            request.AddBody(comment);

            //request.AddParameter("text/xml", string.Format("<ticket><subject>{0}</subject><description>{1}</description></ticket>", ticket.Subject, ticket.Description), ParameterType.RequestBody);

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Example #6
0
        public List<Ticket> GetTicketsForUserByPage(string email, int page = 1)
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = Requests + ".xml",
            };

            //Assume the user
            request.AddHeader(XOnBehalfOfEmail, email);
            request.AddParameter("page", page.ToString());

            //Get the open ones
            var ticktes = Execute<List<Ticket>>(request);

            //Now get the closed ones
            request.AddParameter("filter", "solved");
            var closedOrSolved = Execute<List<Ticket>>(request);

            ticktes.AddRange(closedOrSolved);
            return ticktes;
        }