示例#1
0
        /// <summary>
        /// Client for making requests to the API.
        /// </summary>
        /// <param name="authHandler">The authentication handler.</param>
        /// <param name="ctx">The HTTP context to use for this session.</param>
        private Client(Func <CancellationToken, Task <string> > authHandler, HttpContext ctx)
        {
            // Setup resources.
            Assets              = new AssetsResource(authHandler, ctx);
            TimeSeries          = new TimeSeriesResource(authHandler, ctx);
            DataPoints          = new DataPointsResource(authHandler, ctx);
            Events              = new EventsResource(authHandler, ctx);
            Sequences           = new SequencesResource(authHandler, ctx);
            Raw                 = new RawResource(authHandler, ctx);
            Relationships       = new RelationshipResource(authHandler, ctx);
            DataSets            = new DataSetsResource(authHandler, ctx);
            ThreeDModels        = new ThreeDModelsResource(authHandler, ctx);
            ThreeDRevisions     = new ThreeDRevisionsResource(authHandler, ctx);
            ThreeDAssetMappings = new ThreeDAssetMappingsResource(authHandler, ctx);
            Files               = new FilesResource(authHandler, ctx);
            Login               = new LoginResource(authHandler, ctx);
            Token               = new TokenResource(authHandler, ctx);
            ExtPipes            = new ExtPipesResource(authHandler, ctx);
            Labels              = new LabelsResource(authHandler, ctx);
            Groups              = new GroupsResource(authHandler, ctx);

            // Playground features (experimental)
            Playground = new PlaygroundResource(authHandler, ctx);
            // Beta features (experimental)
            Beta = new BetaResource(authHandler, ctx);
        }
        public ResourceCatalog  GetByDate(DateTime startDate, DateTime endDate)
        {
            List <Guid>     timeSeriesGuidList = new List <Guid>();
            List <Guid>     documentGuidList   = new List <Guid>();
            ResourceCatalog resCat             = new ResourceCatalog();
            DataTable       dt       = new DataTable();
            DateTime        nullDate = new DateTime();

            if (startDate == nullDate && endDate == nullDate)
            {
                dt = resCat.GetEntireByDate();
            }
            else
            if (endDate == nullDate)
            {
                dt = resCat.GetByStartDate(startDate);
            }
            else
            if (startDate == nullDate)
            {
                dt = resCat.GetByEndDate(endDate);
            }
            else
            {
                dt = resCat.GetBetweenDates(startDate, endDate);
            }



            foreach (DataRow row in dt.Rows)
            {
                int resourceTypeId = Convert.ToInt16(row["resourcetype"].ToString());
                if (resourceTypeId == 1)
                {
                    Guid timeGuid = new Guid(row["resourceid"].ToString());
                    timeSeriesGuidList.Add(timeGuid);
                }
                else
                {
                    Guid docGuid = new Guid(row["resourceid"].ToString());
                    documentGuidList.Add(docGuid);
                }
            }

            foreach (Guid g in timeSeriesGuidList)
            {
                TimeSeriesResource tm = new TimeSeriesResource();
                tm = tm.GetTimeSeriesObjectbyDataGuid(g);
                resCat.timeSeriesCatalog.Add(tm);
            }

            foreach (Guid g in documentGuidList)
            {
                Document doc = new Document();
                doc = doc.GetDocumentById(g);
                resCat.documentCatalog.Add(doc);
            }


            return(resCat);
        }