/// <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()); }
/// <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); }
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); }
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); }
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); }
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); }
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); }
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); }
public static TFolder GetDetails(Int64 folderId, ParaCredentials creds) { var folder = FillDetails(folderId, creds); return(folder); }
public static ApiCallResponse Delete(Int64 folderId, ParaCredentials creds) { return(ApiCallFactory.ObjectDelete <TFolder>(creds, folderId, true)); }
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)); }
public static ParaEntityList <TEntity> GetList(ParaCredentials creds) { return(ApiUtils.ApiGetEntityList <TModule, TEntity>(creds, new TQuery())); }
public void AddAttachment(ParaCredentials creds, Byte[] attachment, string contentType, string fileName) { Action_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, attachment, contentType, fileName)); }
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 ApiCallResponse ActionRun(Int64 assetId, Action action, ParaCredentials creds) { var ar = ApiUtils.ActionRun <ParaObjects.Asset>(assetId, action, creds); return(ar); }
public static ParaEntityList <ParaObjects.Download> GetList(ParaCredentials pc) { return(ApiUtils.ApiGetDownloadEntityList(pc)); }
public static ParaObjects.Download GetDetails(Int64 entityId, ParaCredentials pc, ArrayList queryStringParams) { var entity = ApiUtils.ApiGetDownloadEntity(pc, entityId, queryStringParams); return(entity); }
public static ParaObjects.Download GetDetails(Int64 entityId, ParaCredentials pc) { return(GetDetails(entityId, pc, new ArrayList())); }
internal static Attachment DownloadUploadFile(ParaCredentials creds, System.Net.Mail.Attachment attachment) { return(ApiUtils.UploadFile <ParaObjects.Download>(creds, attachment)); }
internal static Attachment DownloadUploadFile(ParaCredentials creds, Byte[] attachment, string contentType, string fileName) { return(ApiUtils.UploadFile <ParaObjects.Download>(creds, attachment, contentType, fileName)); }
public static ParaEntityList <TFolder> GetList(ParaCredentials creds, TQuery query) { return(FillList(creds, query)); }
public void AttachmentsAdd(ParaCredentials paracredentials, System.Net.Mail.Attachment EmailAttachment) { Attachment = ApiHandler.Download.DownloadUploadFile(paracredentials, EmailAttachment); Guid = Attachment.Guid; }
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())); }
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 ApiCallResponse Update(TFolder folder, ParaCredentials creds) { var ar = ApiCallFactory.ObjectCreateUpdate <TFolder>(creds, XmlGenerator.GenerateXml(folder), folder.Id); return(ar); }
public static TEntity GetDetails(Int64 id, ParaCredentials creds) { var entity = ApiUtils.ApiGetEntity <TEntity>(creds, id); return(entity); }
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()); }
public static ParaEntityList <TEntity> GetList(ParaCredentials pc) { return(ApiUtils.ApiGetEntityList <TEntity>(pc)); }
public void AttachmentsAdd(ParaCredentials creds, string text, string contentType, string fileName) { Ticket_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, text, contentType, fileName)); }