/// <summary>
        /// Retrieve all tickets from a department of Parature minus archived and deleted tickets.
        /// </summary>
        /// <param name="creds"></param>
        /// <returns></returns>
        public static List <Ticket> GetAllTickets(ParaCredentials creds)
        {
            var tq = new TicketQuery();

            tq.RetrieveAllRecords = true;
            var tickets = Service.GetList <Ticket>(tq);

            if (tickets.ApiCallResponse.HasException)
            {
                throw new Exception(tickets.ApiCallResponse.ExceptionDetails);
            }

            return(tickets.ToList());
        }
Beispiel #2
0
        /// <summary>
        /// Fills an Download list object.
        /// </summary>
        private static ParaEntityList <TFolder> FillList(ParaCredentials creds, TQuery query)
        {
            var folderList = new ParaEntityList <TFolder>();
            var ar         = ApiCallFactory.ObjectGetList <TFolder>(creds, query.BuildQueryArguments());

            if (ar.HasException == false)
            {
                folderList = ParaEntityParser.FillList <TFolder>(ar.XmlReceived);
            }
            folderList.ApiCallResponse = ar;

            // Checking if the system needs to recursively call all of the data returned.
            if (query.RetrieveAllRecords)
            {
                bool continueCalling = true;
                while (continueCalling)
                {
                    if (folderList.TotalItems > folderList.Data.Count)
                    {
                        // We still need to pull data

                        // Getting next page's data
                        query.PageNumber = query.PageNumber + 1;

                        ar = ApiCallFactory.ObjectGetList <TFolder>(creds, query.BuildQueryArguments());

                        var objectlist = ParaEntityParser.FillList <TFolder>(ar.XmlReceived);

                        if (objectlist.Data.Count == 0)
                        {
                            continueCalling = false;
                        }

                        folderList.Data.AddRange(objectlist.Data);
                        folderList.ResultsReturned = folderList.Data.Count;
                        folderList.PageNumber      = query.PageNumber;
                    }
                    else
                    {
                        // That is it, pulled all the items.
                        continueCalling            = false;
                        folderList.ApiCallResponse = ar;
                    }
                }
            }

            return(folderList);
        }
        /// <summary>
        /// Retrieve all tickets that belong to an organization minus archived and deleted tickets
        /// </summary>
        /// <param name="creds"></param>
        /// <param name="accountId">Account ID of the organization. Not to be confused with Instance ID. Use the Account APIs to determine the account ID</param>
        /// <returns></returns>
        public static List <ParatureSDK.ParaObjects.Ticket> GetAllTicketsForAccount(ParaCredentials creds, long accountId)
        {
            var tq = new TicketQuery();

            //Add an account filter: https://support.parature.com/public/doc/api.html#ticket-list
            tq.AddStaticFieldFilter(TicketQuery.TicketStaticFields.Account, ParaEnums.QueryCriteria.Equal, accountId.ToString());
            tq.RetrieveAllRecords = true;
            var tickets = Service.GetList <Ticket>(tq);

            if (tickets.ApiCallResponse.HasException)
            {
                throw new Exception(tickets.ApiCallResponse.ExceptionDetails);
            }

            return(tickets.ToList());
        }
        public static List <ParatureSDK.ParaObjects.Download> getDownloadsByFolder(ParaCredentials creds, long folderID)
        {
            var downloadQuery = new DownloadQuery();

            downloadQuery.RetrieveAllRecords = true;
            downloadQuery.AddStaticFieldFilter(DownloadQuery.DownloadStaticFields.Folder, ParaEnums.QueryCriteria.Equal, folderID.ToString());

            var downloads = Service.GetList <Download>(downloadQuery);

            if (downloads.ApiCallResponse.HasException)
            {
                throw new Exception(downloads.ApiCallResponse.ExceptionDetails);
            }

            return(downloads.ToList());
        }
        public static long getDownloadsCountByFolder(ParaCredentials creds, long folderID)
        {
            var downloadQuery = new DownloadQuery();

            downloadQuery.TotalOnly = true;
            downloadQuery.AddStaticFieldFilter(DownloadQuery.DownloadStaticFields.Folder, ParaEnums.QueryCriteria.Equal, folderID.ToString());

            var downloads = Service.GetList <Download>(downloadQuery);

            if (downloads.ApiCallResponse.HasException)
            {
                throw new Exception(downloads.ApiCallResponse.ExceptionDetails);
            }

            return(downloads.TotalItems);
        }
Beispiel #6
0
        private static ParaEntityList <ParaObjects.Chat> RetrieveAllEntitites(ParaCredentials creds, ChatQuery query)
        {
            var chatList = new ParaEntityList <ParaObjects.Chat>();
            var ar       = ApiCallFactory.ObjectGetList <ParaObjects.Chat>(creds, query.BuildQueryArguments());

            if (ar.HasException == false)
            {
                chatList = ParaEntityParser.FillList <ParaObjects.Chat>(ar.XmlReceived);
            }
            chatList.ApiCallResponse = ar;

            bool continueCalling = true;

            while (continueCalling)
            {
                if (chatList.TotalItems > chatList.Data.Count)
                {
                    // We still need to pull data

                    // Getting next page's data
                    query.PageNumber = query.PageNumber + 1;

                    ar = ApiCallFactory.ObjectGetList <ParaObjects.Chat>(creds, query.BuildQueryArguments());
                    if (ar.HasException == false)
                    {
                        chatList.Data.AddRange(ParaEntityParser.FillList <ParaObjects.Chat>(ar.XmlReceived).Data);
                        chatList.ResultsReturned = chatList.Data.Count;
                        chatList.PageNumber      = query.PageNumber;
                    }
                    else
                    {
                        continueCalling          = false;
                        chatList.ApiCallResponse = ar;
                        break;
                    }
                }
                else
                {
                    // That is it, pulled all the items.
                    continueCalling          = false;
                    chatList.ApiCallResponse = ar;
                }
            }

            return(chatList);
        }
Beispiel #7
0
        public static Int64 GetIdByName(string folderName, bool ignoreCase, ParaCredentials creds)
        {
            Int64 id    = 0;
            var   query = new TQuery {
                PageSize = 500
            };
            var folders = GetList(creds, query);

            foreach (var folder in folders.Data)
            {
                if (String.Compare(folder.Name, folderName, ignoreCase) == 0)
                {
                    id = folder.Id;
                    break;
                }
            }
            return(id);
        }
Beispiel #8
0
        private static TFolder FillDetails(Int64 folderId, ParaCredentials creds)
        {
            var folder = new TFolder();
            var ar     = ApiCallFactory.ObjectGetDetail <TFolder>(creds, folderId);

            if (ar.HasException == false)
            {
                folder             = ParaEntityParser.EntityFill <TFolder>(ar.XmlReceived);
                folder.FullyLoaded = true;
            }
            else
            {
                folder.FullyLoaded = false;
                folder.Id          = 0;
            }

            folder.ApiCallResponse = ar;
            return(folder);
        }
Beispiel #9
0
        private static ParaObjects.Chat FillTranscriptDetails(Int64 chatid, ParaCredentials paraCredentials)
        {
            //Because chat transcripts return a Chat object with just a list messages, we'll deserialize the transcript into a chat object
            var chat = new ParaObjects.Chat();

            var ar = ApiCallFactory.ChatTranscriptGetDetail(paraCredentials, chatid);

            if (ar.HasException == false)
            {
                chat             = ParaEntityParser.EntityFill <ParaObjects.Chat>(ar.XmlReceived);
                chat.FullyLoaded = true;
            }
            else
            {
                chat.FullyLoaded = false;
                chat.Id          = 0;
            }
            chat.ApiCallResponse = ar;
            chat.IsDirty         = false;
            return(chat);
        }
Beispiel #10
0
        public static Int64 GetIdByName(string folderName, bool ignoreCase, ParaCredentials creds,
                                        Int64 parentFolderId)
        {
            Int64 id     = 0;
            var   fQuery = new TQuery();

            fQuery.AddStaticFieldFilter(FolderQuery.FolderStaticFields.ParentFolder, ParaEnums.QueryCriteria.Equal,
                                        parentFolderId.ToString());
            fQuery.PageSize = 500;
            var folders = GetList(creds, fQuery);

            foreach (var folder in folders.Data)
            {
                if (String.Compare(folder.Name, folderName, ignoreCase) == 0)
                {
                    id = folder.Id;
                    break;
                }
            }
            return(id);
        }
Beispiel #11
0
        private static ParaEntityList <ParaObjects.Chat> FillList(ParaCredentials creds, Boolean includeTranscripts,
                                                                  ChatQuery query)
        {
            if (query == null)
            {
                query = new ChatQuery();
            }
            var chatList = new ParaEntityList <ParaObjects.Chat>();

            // Checking if the system needs to recursively call all of the data returned.
            if (query.RetrieveAllRecords)
            {
                chatList = RetrieveAllEntitites(creds, query);
            }
            else
            {
                var ar = ApiCallFactory.ObjectGetList <ParaObjects.Chat>(creds, query.BuildQueryArguments());
                if (ar.HasException == false)
                {
                    chatList = ParaEntityParser.FillList <ParaObjects.Chat>(ar.XmlReceived);
                }
                chatList.ApiCallResponse = ar;
            }

            if (includeTranscripts)
            {
                var service = new ParaService(creds);
                //Fetch transcripts for each chat. Each request is another API call...
                foreach (var chat in chatList)
                {
                    chat.Transcript = service.GetChatTranscript(chat.Id);
                }
            }

            return(chatList);
        }
Beispiel #12
0
        public static TFolder GetDetails(Int64 folderId, ParaCredentials creds)
        {
            var folder = FillDetails(folderId, creds);

            return(folder);
        }
Beispiel #13
0
 public static ApiCallResponse Delete(Int64 folderId, ParaCredentials creds)
 {
     return(ApiCallFactory.ObjectDelete <TFolder>(creds, folderId, true));
 }
Beispiel #14
0
 public void AttachmentsUpdate(ParaCredentials creds, Byte[] attachment, string attachmentGuid, string contentType, string fileName)
 {
     AttachmentsDelete(attachmentGuid);
     Ticket_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, attachment, contentType, fileName));
 }
Beispiel #15
0
 public static ParaEntityList <TEntity> GetList(ParaCredentials creds)
 {
     return(ApiUtils.ApiGetEntityList <TModule, TEntity>(creds, new TQuery()));
 }
Beispiel #16
0
 public void AddAttachment(ParaCredentials creds, Byte[] attachment, string contentType, string fileName)
 {
     Action_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, attachment, contentType, fileName));
 }
Beispiel #17
0
 public void AttachmentsUpdate(ParaCredentials paracredentials, Byte[] Attachment, string contentType, string FileName)
 {
     this.Attachment = ApiHandler.Download.DownloadUploadFile(paracredentials, Attachment, contentType, FileName);
     Guid = this.Attachment.Guid;
     Name = FileName;
 }
Beispiel #18
0
        public static ApiCallResponse ActionRun(Int64 assetId, Action action, ParaCredentials creds)
        {
            var ar = ApiUtils.ActionRun <ParaObjects.Asset>(assetId, action, creds);

            return(ar);
        }
Beispiel #19
0
 public static ParaEntityList <ParaObjects.Download> GetList(ParaCredentials pc)
 {
     return(ApiUtils.ApiGetDownloadEntityList(pc));
 }
Beispiel #20
0
        public static ParaObjects.Download GetDetails(Int64 entityId, ParaCredentials pc, ArrayList queryStringParams)
        {
            var entity = ApiUtils.ApiGetDownloadEntity(pc, entityId, queryStringParams);

            return(entity);
        }
Beispiel #21
0
 public static ParaObjects.Download GetDetails(Int64 entityId, ParaCredentials pc)
 {
     return(GetDetails(entityId, pc, new ArrayList()));
 }
Beispiel #22
0
 internal static Attachment DownloadUploadFile(ParaCredentials creds, System.Net.Mail.Attachment attachment)
 {
     return(ApiUtils.UploadFile <ParaObjects.Download>(creds, attachment));
 }
Beispiel #23
0
 internal static Attachment DownloadUploadFile(ParaCredentials creds, Byte[] attachment, string contentType, string fileName)
 {
     return(ApiUtils.UploadFile <ParaObjects.Download>(creds, attachment, contentType, fileName));
 }
Beispiel #24
0
 public static ParaEntityList <TFolder> GetList(ParaCredentials creds, TQuery query)
 {
     return(FillList(creds, query));
 }
Beispiel #25
0
 public void AttachmentsAdd(ParaCredentials paracredentials, System.Net.Mail.Attachment EmailAttachment)
 {
     Attachment = ApiHandler.Download.DownloadUploadFile(paracredentials, EmailAttachment);
     Guid = Attachment.Guid;
 }
Beispiel #26
0
 public void AddAttachment(ParaCredentials creds, string text, string contentType, string fileName)
 {
     Action_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, text, contentType, fileName));
 }
 public static TEntity GetDetails(Int64 entityId, ParaCredentials pc)
 {
     return(GetDetails(entityId, pc, new ArrayList()));
 }
Beispiel #28
0
 public void AttachmentsUpdate(ParaCredentials paracredentials, string text, string contentType, string FileName)
 {
     Attachment = ApiHandler.Download.DownloadUploadFile(paracredentials, text, contentType, FileName);
     Guid = Attachment.Guid;
     Name = FileName;
 }
Beispiel #29
0
        public static ApiCallResponse Update(TFolder folder, ParaCredentials creds)
        {
            var ar = ApiCallFactory.ObjectCreateUpdate <TFolder>(creds, XmlGenerator.GenerateXml(folder), folder.Id);

            return(ar);
        }
Beispiel #30
0
 public void AttachmentsAdd(ParaCredentials paracredentials, System.Net.Mail.Attachment EmailAttachment)
 {
     Attachment = ApiHandler.Download.DownloadUploadFile(paracredentials, EmailAttachment);
     Guid       = Attachment.Guid;
 }
Beispiel #31
0
        public static TEntity GetDetails(Int64 id, ParaCredentials creds)
        {
            var entity = ApiUtils.ApiGetEntity <TEntity>(creds, id);

            return(entity);
        }
Beispiel #32
0
 public void AttachmentsUpdate(ParaCredentials paracredentials, string text, string contentType, string FileName)
 {
     Attachment = ApiHandler.Download.DownloadUploadFile(paracredentials, text, contentType, FileName);
     Guid       = Attachment.Guid;
     Name       = FileName;
 }
        public static List <ParatureSDK.ParaObjects.DownloadFolder> getAllDownloadFolders(ParaCredentials creds)
        {
            var dfQuery = new DownloadFolderQuery();

            dfQuery.RetrieveAllRecords = true;

            var folders = Service.GetList <DownloadFolder>(dfQuery);

            if (folders.ApiCallResponse.HasException)
            {
                throw new Exception(folders.ApiCallResponse.ExceptionDetails);
            }

            return(folders.ToList());
        }
Beispiel #34
0
 public void AttachmentsUpdate(ParaCredentials paracredentials, Byte[] Attachment, string contentType, string FileName)
 {
     this.Attachment = ApiHandler.Download.DownloadUploadFile(paracredentials, Attachment, contentType, FileName);
     Guid            = this.Attachment.Guid;
     Name            = FileName;
 }
 public static ParaEntityList <TEntity> GetList(ParaCredentials pc)
 {
     return(ApiUtils.ApiGetEntityList <TEntity>(pc));
 }
Beispiel #36
0
 public void AttachmentsAdd(ParaCredentials creds, string text, string contentType, string fileName)
 {
     Ticket_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, text, contentType, fileName));
 }