/// <summary> /// Get multiple objects of type T by running a query (IClarizenQuery) /// </summary> /// <typeparam name="T"></typeparam> /// <param name="query">Clarizen Query Language (CZQL) query</param> /// <param name="pageSize">Default size to be used for pagination</param> /// <returns></returns> public async Task <List <T> > GetAll <T>(Ekin.Clarizen.Interfaces.IClarizenQuery query, int?pageSize = null, int?sleepTime = null) { GetAllResult result = await ClarizenAPI.GetAll(query, typeof(T), pageSize, sleepTime); if (result == null || result.Errors.Any()) { var detailedMsg = "Error: " + string.Join(System.Environment.NewLine, result.Errors.Select(i => i.Message)); Logs.AddError("Ekin.Clarizen.BulkOperations", "Get All (Query)", detailedMsg); return(null); } return((List <T>)result.Data); }
/// <summary> /// Get multiple objects of type T by providing an EntityName /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entityName">Name of the Clarizen entity, e.g. Timesheet, WorkItem, etc.</param> /// <param name="customCondition"></param> /// <returns></returns> public async Task <List <T> > GetAll <T>(string entityName, string customCondition = "", int sleepTime = 0) { customCondition = customCondition?.Trim(); CZQLCondition condition = null; if (!string.IsNullOrEmpty(customCondition)) { condition = new CZQLCondition(customCondition); } GetAllResult result = await ClarizenAPI.GetAll(entityName, typeof(T), condition, sleepTime); if (result == null || result.Errors.Any()) { var detailedMsg = "Error: " + string.Join(System.Environment.NewLine, result.Errors.Select(i => i.Message)); Logs.AddError("Ekin.Clarizen.BulkOperations", "Get All " + entityName, detailedMsg); return(null); } return((List <T>)result.Data); }