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); }
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()); }
private static ParaEntityList <ParaObjects.Download> RetrieveAllDownloadEntities(ParaCredentials pc, DownloadQuery query) { ApiCallResponse ar; var downloadList = new ParaEntityList <ParaObjects.Download>(); ar = ApiCallFactory.ObjectGetList <ParaObjects.Download>(pc, query.BuildQueryArguments()); if (ar.HasException == false) { downloadList = ParaEntityParser.FillListDownload(ar.XmlReceived); } downloadList.ApiCallResponse = ar; var continueCalling = true; while (continueCalling) { if (downloadList.TotalItems > downloadList.Data.Count) { // We still need to pull data // Getting next page's data query.PageNumber = query.PageNumber + 1; ar = ApiCallFactory.ObjectGetList <ParaObjects.Download>(pc, query.BuildQueryArguments()); if (ar.HasException == false) { var objectlist = ParaEntityParser.FillListDownload(ar.XmlReceived); downloadList.Data.AddRange(objectlist.Data); downloadList.ResultsReturned = downloadList.Data.Count; downloadList.PageNumber = query.PageNumber; } else { // There is an error processing request downloadList.ApiCallResponse = ar; continueCalling = false; } } else { // That is it, pulled all the items. continueCalling = false; downloadList.ApiCallResponse = ar; } } return(downloadList); }
internal static ParaEntityList <ParaObjects.Download> ApiGetDownloadEntityList(ParaCredentials pc, DownloadQuery query) { var entityList = new ParaEntityList <ParaObjects.Download>(); // Checking if the system needs to recursively call all of the data returned. if (query.RetrieveAllRecords) { entityList = RetrieveAllDownloadEntities(pc, query); } else { var ar = ApiCallFactory.ObjectGetList <ParaObjects.Download>(pc, query.BuildQueryArguments()); if (ar.HasException == false) { entityList = ParaEntityParser.FillListDownload(ar.XmlReceived); } entityList.ApiCallResponse = ar; } return(entityList); }