Beispiel #1
0
        /// <summary>
        /// Note: You cannot add end users to groups they go in organizations.        
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        public int CreateOrUpdateGroup(Group group)
        {
            //Check to see if a group already exists
            var oldGroups = GetGroups().Where(x => x.Name == group.Name);
            if (oldGroups.Count() > 0)
            {
                group.Id = oldGroups.First().Id;
                if (UpdateGroup(group))
                    return group.Id;

                return -1;
            }

            //Make sure to use the UserIds not the Users
            group.CopyUsersToUserIds();

            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = Groups + ".xml"
            };

            request.AddBody(group);

            var res = Execute(request);

            return GetIdFromLocationHeader(res);
        }
Beispiel #2
0
        public int CreateOrUpdateOrganization(Organization newOrg)
        {
            var orgs = GetOgranizations();
            var curOrg = orgs.Where(x => x.Name == newOrg.Name);

            if (curOrg.Count() > 0)
            {
                newOrg.Id = curOrg.First().Id;

                //If it couldn't be updated
                if (!UpdateOrganization(newOrg))
                    return -1;

                return curOrg.First().Id;
            }

            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = _organizations + ".xml"
            };

            request.AddBody(newOrg);

            var res = Execute(request);

            return GetIdFromLocationHeader(res);
        }
Beispiel #3
0
        public int CreateOrUpdateForum(Forum forum)
        {
            int existingId = GetExistingForumId(forum);

            if(existingId > 0)
            {
                forum.Id = existingId;

                //If it couldn't be updated
                if (!UpdateForum(forum))
                    return -1;

                return forum.Id;
            }

            var request = new ZenRestRequest
                              {
                                  Method = Method.POST,
                                  Resource = _forums + ".xml"
                              };
            request.AddBody(forum);

            var res = Execute(request);

            return GetIdFromLocationHeader(res);
        }
Beispiel #4
0
        public Organization GetOgranizationById(int id)
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = string.Format("{0}/{1}.xml", _organizations, id)
            };

            return Execute<Organization>(request);
        }
Beispiel #5
0
        public List <Entry> GetEntriesByForumId(int forumId)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = string.Format("forums/{0}/{1}.json", forumId, Entries)
            };

            return(Execute <List <Entry> >(request));
        }
Beispiel #6
0
        /// <summary>
        /// The first comment for a ticket is always equivalent to the ticket description.
        /// If you have any custom fields in your zendesk, they will show up in the <ticket-field-entries> part of the document.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Ticket GetTicketById(int id)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = string.Format("{0}/{1}.xml", Tickets, id)
            };

            return(Execute <Ticket>(request));
        }
Beispiel #7
0
        public Organization GetOgranizationById(int id)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = string.Format("{0}/{1}.json", _organizations, id)
            };

            return(Execute <Organization>(request));
        }
Beispiel #8
0
        public Forum GetForumById(int id)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = string.Format("{0}/{1}.json", _forums, id)
            };

            return(Execute <Forum>(request));
        }
Beispiel #9
0
        public Entry GetEntryById(int id)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = string.Format("{0}/{1}.json", Entries, id)
            };

            return(Execute <Entry>(request));
        }
Beispiel #10
0
        /// <summary>
        /// Gets the Collection
        /// </summary>
        /// <returns></returns>
        public List <T> GetCollection <T>(string resource, string rootElement = "")
        {
            var request = new ZenRestRequest
            {
                Method      = Method.GET,
                Resource    = resource,
                RootElement = rootElement
            };

            return(Execute <List <T> >(request));
        }
Beispiel #11
0
        public List<View> GetViews()
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = "views.xml",
                RootElement = "views"
            };

            return Execute<List<View>>(request);
        }
Beispiel #12
0
        public List <View> GetViews()
        {
            var request = new ZenRestRequest
            {
                Method      = Method.GET,
                Resource    = "views.xml",
                RootElement = "views"
            };

            return(Execute <List <View> >(request));
        }
Beispiel #13
0
        public bool DestroyOrganization(int orgId)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.DELETE,
                Resource = string.Format("{0}/{1}.xml", _organizations, orgId)
            };

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #14
0
        public bool MakeUserIdentityPrimary(int userId, int identityId)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.POST,
                Resource = string.Format("/{0}/{1}/user_identities/{2}/make_primary", Users, userId, identityId)
            };

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #15
0
        public List <Ticket> GetTicketsInViewByPage(int viewId, int page = 1)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = string.Format("rules/{0}.xml", viewId)
            };

            request.AddParameter("page", page.ToString());

            return(Execute <List <Ticket> >(request));
        }
Beispiel #16
0
        public bool DestroyRequest(int requestId)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.DELETE,
                Resource = string.Format("{0}/{1}.xml", Requests, requestId.ToString())
            };

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #17
0
        public bool DestroyForum(int forumId)
        {
            var request = new ZenRestRequest
            {
                Method = Method.DELETE,
                Resource = string.Format("{0}/{1}.xml", _forums, forumId)
            };

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #18
0
        /// <summary>
        /// Returns tickets with that tag in groups of 15. Use the page index to get the next set.
        /// </summary>
        /// <param name="tagName"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public List<Ticket> GetTicktesForTagByPage(string tagName, int page = 1)
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = string.Format("{0}/{1}.xml", Tags, tagName)
            };

            request.AddParameter("page", page.ToString());

            return Execute<List<Ticket>>(request);
        }
Beispiel #19
0
        public bool DestroyGroup(int groupId)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.DELETE,
                Resource = string.Format("{0}/{1}.json", Groups, groupId)
            };

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #20
0
        /// <summary>
        /// Returns tickets with that tag in groups of 15. Use the page index to get the next set.
        /// </summary>
        /// <param name="tagName"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public List <Ticket> GetTicktesForTagByPage(string tagName, int page = 1)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = string.Format("{0}/{1}.xml", Tags, tagName)
            };

            request.AddParameter("page", page.ToString());

            return(Execute <List <Ticket> >(request));
        }
Beispiel #21
0
        public bool DestroyForum(int forumId)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.DELETE,
                Resource = string.Format("{0}/{1}.xml", _forums, forumId)
            };

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #22
0
        public bool DestroyOrganization(int orgId)
        {
            var request = new ZenRestRequest
            {
                Method = Method.DELETE,
                Resource = string.Format("{0}/{1}.xml", _organizations, orgId)
            };

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #23
0
        /// <summary>
        /// Matches the api method at http://www.zendesk.com/api/users
        /// Ex: QueryUsers("*****@*****.**") returns a list of users with that email, which should only be one.
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List <User> QueryUsers(string query)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.GET,
                Resource = Users,
            };

            request.AddParameter("query", query);

            return(Execute <List <User> >(request));
        }
Beispiel #24
0
        public bool AddComment(int ticketId, Comment comment)
        {
            var request = new ZenRestRequest
            {
                Method = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Tickets, ticketId)
            };
            request.AddBody(comment);

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #25
0
        public bool DeleteUserIdentity(int userId, int identityId)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.DELETE,
                Resource = string.Format("/{0}/{1}/user_identities/{2}", Users, userId, identityId)
            };

            var res = Execute(request);

            //If it is not found then it is already deleted
            return(res.StatusCode == System.Net.HttpStatusCode.OK || res.StatusCode == System.Net.HttpStatusCode.NotFound);
        }
Beispiel #26
0
        public int CreateTicket(Ticket ticket)
        {
            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = Tickets + ".xml"
            };

            request.AddBody(ticket);

            var res = Execute(request);
            return GetIdFromLocationHeader(res);
        }
Beispiel #27
0
        public int CreatePost(Post post)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.POST,
                Resource = Posts
            };

            request.AddBody(post);

            var res = Execute(request);

            return(GetIdFromLocationHeader(res));
        }
Beispiel #28
0
        public bool AddComment(int ticketId, Comment comment)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Tickets, ticketId)
            };

            request.AddBody(comment);

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #29
0
        /// <summary>
        /// Creates a new ticket AND creates a new user as the tickets requester, IF the user does not already exist (based on the requester email).
        /// If the requester exists, no user is created and the ticket is created with the existing user as requester
        /// </summary>
        /// <param name="ticket"></param>
        /// <returns></returns>
        public int CreateTicketWithRequester(Ticket ticket)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.POST,
                Resource = Tickets + ".xml"
            };

            request.AddBody(ticket);

            var res = Execute(request);

            return(GetIdFromLocationHeader(res));
        }
Beispiel #30
0
        public int CreateEntry(Entry entry)
        {
            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = Entries + ".xml"
            };

            request.AddBody(entry);

            var res = Execute(request);

            return GetIdFromLocationHeader(res);
        }
Beispiel #31
0
        public int CreatePost(Post post)
        {
            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = Posts
            };

            request.AddBody(post);

            var res = Execute(request);

            return GetIdFromLocationHeader(res);
        }
Beispiel #32
0
        public bool ApplyMacro(int macroId, int ticketId)
        {
            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = string.Format("{0}/{1}/apply.xml", Macros, macroId)
            };

            request.AddParameter("ticket_id", ticketId.ToString());

            var resp = Execute(request);

            return resp.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #33
0
        public bool UpdateEntry(Entry entry)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Entries, entry.Id)
            };

            request.AddBody(entry);

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #34
0
        public int CreateEntry(Entry entry)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.POST,
                Resource = Entries + ".xml"
            };

            request.AddBody(entry);

            var res = Execute(request);

            return(GetIdFromLocationHeader(res));
        }
Beispiel #35
0
        public bool UpdateUser(User user)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Users, user.Id)
            };

            request.AddBody(user);

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #36
0
        public bool ApplyMacro(int macroId, int ticketId)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.POST,
                Resource = string.Format("{0}/{1}/apply.json", Macros, macroId)
            };

            request.AddParameter("ticket_id", ticketId.ToString());

            var resp = Execute(request);

            return(resp.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #37
0
        public bool UpdateOrganization(Organization org)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", _organizations, org.Id)
            };

            request.AddBody(org);

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #38
0
        public bool UpdateForum(Forum forum)
        {
            var request = new ZenRestRequest
            {
                Method   = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", _forums, forum.Id)
            };

            request.AddBody(forum);

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #39
0
        /// <summary>
        /// To update custom ticket fields just add them to the ticket's TicketFieldEntries.
        /// Use GetTicketFields and then manually search to find the one you want to update.
        /// Note you can't add comments this way. Call AddComments to do that.
        /// </summary>
        /// <param name="ticket"></param>
        /// <returns></returns>
        public bool UpdateTicket(Ticket ticket)
        {
            ticket.Comments.Clear();
            var request = new ZenRestRequest
            {
                Method   = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Tickets, ticket.NiceId.ToString())
            };

            request.AddBody(ticket);

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #40
0
        /// <summary>
        /// Gets the Collection
        /// </summary>
        /// <returns></returns>
        public List <T> GetCollection <T>(string resource, string rootElement = "")
        {
            if (!resource.EndsWith(".xml"))
            {
                resource += ".xml";
            }

            var request = new ZenRestRequest
            {
                Method      = Method.GET,
                Resource    = resource,
                RootElement = rootElement
            };

            return(Execute <List <T> >(request));
        }
Beispiel #41
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);
        }
Beispiel #42
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));
        }
Beispiel #43
0
        public bool UpdateGroup(Group group)
        {
            //Make sure to use the UserIds not the Users
            group.CopyUsersToUserIds();

            var request = new ZenRestRequest
            {
                Method   = Method.PUT,
                Resource = string.Format("{0}/{1}.json", Groups, group.Id)
            };

            request.AddBody(group);

            var res = Execute(request);

            return(res.StatusCode == System.Net.HttpStatusCode.OK);
        }
Beispiel #44
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);
        }
Beispiel #45
0
        /// <summary>
        /// Throws a ZenDeskNotAcceptableInputException if the twitter account doesn't exist or is already assigned to someone else.
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="twitterHandle"></param>
        /// <returns></returns>
        public bool AddTwitterHandleToUser(int userId, string twitterHandle)
        {
            //first check to see if the user already has that twitter identity
            var records = GetUserIdentities(userId);
            if (records.Where(x => x.ScreenName == twitterHandle).Count() > 0)
                return true;

            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = string.Format("{0}/{1}/user_identities.xml", Users, userId)
            };

            request.AddParameter("text/xml", string.Format("<twitter>{0}</twitter>", twitterHandle), ParameterType.RequestBody);

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.Created;
        }
Beispiel #46
0
        public bool AddEmailAddressToAUser(int userId, string email)
        {
            //first check to see if the user allready has that email identity
            var emails = GetUserIdentities(userId);
            if (emails.Where(x => x.Value == email).Count() > 0)
                return true;

            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = string.Format("{0}/{1}/user_identities.xml", Users, userId)
            };

            request.AddParameter("text/xml", string.Format("<email>{0}</email>", email), ParameterType.RequestBody);

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.Created;
        }
Beispiel #47
0
        public bool DestroyTicket(int ticketId)
        {
            var request = new ZenRestRequest
                              {
                                  Method = Method.DELETE,
                                  Resource = string.Format("{0}/{1}.xml", Tickets, ticketId.ToString())
                              };

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #48
0
        public bool UpdateForum(Forum forum)
        {
            var request = new ZenRestRequest
            {
                Method = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", _forums, forum.Id)
            };

            request.AddBody(forum);

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #49
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;
        }
Beispiel #50
0
        public List<Ticket> GetTicketsInViewByPage(int viewId, int page = 1)
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = string.Format("rules/{0}.xml", viewId)
            };

            request.AddParameter("page", page.ToString());

            return Execute<List<Ticket>>(request);
        }
Beispiel #51
0
        /// <summary>
        /// To update custom ticket fields just add them to the ticket's TicketFieldEntries.
        /// Use GetTicketFields and then manually search to find the one you want to update.
        /// Note you can't add comments this way. Call AddComments to do that.
        /// </summary>
        /// <param name="ticket"></param>
        /// <returns></returns>
        public bool UpdateTicket(Ticket ticket)
        {
            ticket.Comments.Clear();
            var request = new ZenRestRequest
            {
                Method = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Tickets, ticket.NiceId.ToString())
            };

            request.AddBody(ticket);

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #52
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;
        }
Beispiel #53
0
        /// <summary>
        /// Creates the new user and returns their id. Or updates if that email address is already in the system.
        /// </summary>
        /// <param name="newUser"></param>
        /// <returns></returns>
        public int CreateOrUpdateUser(User newUser)
        {
            //Update if the user exists
            var users = QueryUsers(newUser.Email);
            if (users.Count > 0)
            {
                newUser.Id = users.First().Id;

                if (!UpdateUser(newUser))
                    return -1;

                return (int)users.First().Id;
            }

            var request = new ZenRestRequest
            {
                Method = Method.POST,
                Resource = Users + ".xml",
            };

            request.AddBody(newUser);

            var res = Execute(request);

            return GetIdFromLocationHeader(res);
        }
Beispiel #54
0
        public bool UpdateOrganization(Organization org)
        {
            var request = new ZenRestRequest
            {
                Method = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", _organizations, org.Id)
            };

            request.AddBody(org);

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #55
0
        private List<User> GetUsersByPage(int page)
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = string.Format("{0}.xml", Users)
            };

            request.AddParameter("page", page.ToString());

            return Execute<List<User>>(request);
        }
Beispiel #56
0
        public Forum GetForumById(int id)
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = string.Format("{0}/{1}.xml", _forums, id)
            };

            return Execute<Forum>(request);
        }
Beispiel #57
0
        public void MyTest()
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = "posts.rss"
            };

            var res = _api.Execute(request);
        }
Beispiel #58
0
        private List<Organization> GetOrganizationssByPage(int page)
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = string.Format("{0}.xml", _organizations)
            };

            request.AddParameter("page", page.ToString());

            return Execute<List<Organization>>(request);
        }
Beispiel #59
0
        public bool UpdateGroup(Group group)
        {
            //Make sure to use the UserIds not the Users
            group.CopyUsersToUserIds();

            var request = new ZenRestRequest
            {
                Method = Method.PUT,
                Resource = string.Format("{0}/{1}.xml", Groups, group.Id)
            };

            request.AddBody(group);

            var res = Execute(request);

            return res.StatusCode == System.Net.HttpStatusCode.OK;
        }
Beispiel #60
0
        /// <summary>
        /// The first comment for a ticket is always equivalent to the ticket description.
        /// If you have any custom fields in your zendesk, they will show up in the <ticket-field-entries> part of the document.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Ticket GetTicketById(int id)
        {
            var request = new ZenRestRequest
            {
                Method = Method.GET,
                Resource = string.Format("{0}/{1}.xml", Tickets, id)
            };

            return Execute<Ticket>(request);
        }