Esempio n. 1
0
        /// <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());
        }
Esempio n. 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);
        }
Esempio n. 3
0
        /// <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());
        }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
        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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 12
0
        public static TFolder GetDetails(Int64 folderId, ParaCredentials creds)
        {
            var folder = FillDetails(folderId, creds);

            return(folder);
        }
Esempio n. 13
0
 public static ApiCallResponse Delete(Int64 folderId, ParaCredentials creds)
 {
     return(ApiCallFactory.ObjectDelete <TFolder>(creds, folderId, true));
 }
Esempio n. 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));
 }
Esempio n. 15
0
 public static ParaEntityList <TEntity> GetList(ParaCredentials creds)
 {
     return(ApiUtils.ApiGetEntityList <TModule, TEntity>(creds, new TQuery()));
 }
Esempio n. 16
0
 public void AddAttachment(ParaCredentials creds, Byte[] attachment, string contentType, string fileName)
 {
     Action_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, attachment, contentType, fileName));
 }
Esempio n. 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;
 }
Esempio n. 18
0
        public static ApiCallResponse ActionRun(Int64 assetId, Action action, ParaCredentials creds)
        {
            var ar = ApiUtils.ActionRun <ParaObjects.Asset>(assetId, action, creds);

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

            return(entity);
        }
Esempio n. 21
0
 public static ParaObjects.Download GetDetails(Int64 entityId, ParaCredentials pc)
 {
     return(GetDetails(entityId, pc, new ArrayList()));
 }
Esempio n. 22
0
 internal static Attachment DownloadUploadFile(ParaCredentials creds, System.Net.Mail.Attachment attachment)
 {
     return(ApiUtils.UploadFile <ParaObjects.Download>(creds, attachment));
 }
Esempio n. 23
0
 internal static Attachment DownloadUploadFile(ParaCredentials creds, Byte[] attachment, string contentType, string fileName)
 {
     return(ApiUtils.UploadFile <ParaObjects.Download>(creds, attachment, contentType, fileName));
 }
Esempio n. 24
0
 public static ParaEntityList <TFolder> GetList(ParaCredentials creds, TQuery query)
 {
     return(FillList(creds, query));
 }
Esempio n. 25
0
 public void AttachmentsAdd(ParaCredentials paracredentials, System.Net.Mail.Attachment EmailAttachment)
 {
     Attachment = ApiHandler.Download.DownloadUploadFile(paracredentials, EmailAttachment);
     Guid = Attachment.Guid;
 }
Esempio n. 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()));
 }
Esempio n. 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;
 }
Esempio n. 29
0
        public static ApiCallResponse Update(TFolder folder, ParaCredentials creds)
        {
            var ar = ApiCallFactory.ObjectCreateUpdate <TFolder>(creds, XmlGenerator.GenerateXml(folder), folder.Id);

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

            return(entity);
        }
Esempio n. 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;
 }
Esempio n. 33
0
        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());
        }
Esempio n. 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));
 }
Esempio n. 36
0
 public void AttachmentsAdd(ParaCredentials creds, string text, string contentType, string fileName)
 {
     Ticket_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, text, contentType, fileName));
 }