public async Task <ListResponse <TelemetryReportData> > GetForDeviceTypeAsync(DeviceRepository deviceRepo, string deviceTypeId, string recordType, ListRequest request, EntityHeader org, EntityHeader user)
        {
            if (deviceRepo.Instance == null)
            {
                return(ListResponse <TelemetryReportData> .FromError("No associated instance."));
            }

            await base.AuthorizeOrgAccessAsync(user, org, typeof(TelemetryReportData));

            var instance = await _deploymentInstanceRepo.GetInstanceAsync(deviceRepo.Instance.Id);

            if (instance.LogStorage.Value == LogStorage.Local)
            {
                var proxy = _proxyFactory.Create <ITelemetryService>(new ProxySettings {
                    OrganizationId = org.Id, InstanceId = deviceRepo.Instance.Id
                });
                return(await proxy.GetForDeviceTypeAsync(deviceTypeId, recordType, request));
            }
            else
            {
                return(await _telemetryService.GetForDeviceTypeAsync(deviceTypeId, recordType, request));
            }
        }
Esempio n. 2
0
        public async Task <ListResponse <TelemetryReportData> > GetForDeviceTypeAsync(DeviceRepository deviceRepo, string deviceTypeId, string recordType, ListRequest request, EntityHeader org, EntityHeader user)
        {
            await base.AuthorizeOrgAccessAsync(user, org, typeof(TelemetryReportData));

            return(await _telemetryService.GetForDeviceTypeAsync(deviceTypeId, recordType, request));
        }