コード例 #1
0
        /// <summary>
        /// Fetches a list of information about the raw data for the <paramref name="entities"/>.
        /// </summary>
        /// <remarks> Use this method to fetch raw data information for several <see cref="RawDataEntityDto"/> types in one call.</remarks>
        /// <param name="client">The client class to use.</param>
        /// <param name="entities">The entities the raw data information should be fetched for.</param>
        /// <param name="filter">A condition used to filter the result.</param>
        /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
        /// <exception cref="ArgumentNullException"><paramref name="client"/> or <paramref name="entities"/> is <see langword="null" />.</exception>
        public static Task <RawDataInformationDto[]> ListRawData([NotNull] this IRawDataServiceRestClient client, [NotNull] IEnumerable <RawDataTargetEntityDto> entities, FilterCondition filter = null, CancellationToken cancellationToken = default)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (entities == null)
            {
                throw new ArgumentNullException(nameof(entities));
            }

            async Task <RawDataInformationDto[]> ListRawData()
            {
                var infoList = new List <RawDataInformationDto>();

                foreach (var group in entities.GroupBy(p => p.Entity))
                {
                    var infos = await client.ListRawData(group.Key, group.Select( p => p.Uuid.ToString()).ToArray(), filter, cancellationToken).ConfigureAwait(false);

                    infoList.AddRange(infos);
                }

                return(infoList.ToArray());
            }

            return(ListRawData());
        }
コード例 #2
0
 /// <summary>
 /// Fetches a list of raw data information for the measurement values identified by <paramref name="measurementValueUuids"/>.
 /// </summary>
 /// <param name="client">The client class to use.</param>
 /// <param name="measurementValueUuids">The list of value uuids the raw data information should be fetched for.</param>
 /// <param name="filter">A condition used to filter the result.</param>
 /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
 /// <exception cref="ArgumentNullException"><paramref name="client"/> is <see langword="null" />.</exception>
 public static Task <RawDataInformationDto[]> ListRawDataForValues([NotNull] this IRawDataServiceRestClient client, [CanBeNull] ValueRawDataIdentifierDto[] measurementValueUuids, FilterCondition filter = null, CancellationToken cancellationToken = default)
 {
     if (client == null)
     {
         throw new ArgumentNullException(nameof(client));
     }
     return(client.ListRawData(RawDataEntityDto.Value, measurementValueUuids?.Select(StringUuidTools.CreateStringUuidPair).ToArray(), filter, cancellationToken));
 }
コード例 #3
0
 /// <summary>
 /// Fetches a list of raw data information for the measurements identified by <paramref name="measurementUuids"/>.
 /// </summary>
 /// <param name="client">The client class to use.</param>
 /// <param name="measurementUuids">The list of measurement uuids the raw data information should be fetched for.</param>
 /// <param name="filter">A condition used to filter the result.</param>
 /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
 /// <exception cref="ArgumentNullException"><paramref name="client"/> is <see langword="null" />.</exception>
 public static Task <RawDataInformationDto[]> ListRawDataForMeasurements([NotNull] this IRawDataServiceRestClient client, [CanBeNull] Guid[] measurementUuids, FilterCondition filter = null, CancellationToken cancellationToken = default)
 {
     if (client == null)
     {
         throw new ArgumentNullException(nameof(client));
     }
     return(client.ListRawData(RawDataEntityDto.Measurement, measurementUuids?.Select(u => u.ToString()).ToArray(), filter, cancellationToken));
 }
コード例 #4
0
        /// <summary>
        /// Fetches a list of information about the raw data for the <paramref name="entities"/>.
        /// </summary>
        /// <remarks> Use this method to fetch raw data information for several <see cref="RawDataEntity"/> types in one call.</remarks>
        /// <param name="client">The client class to use.</param>
        /// <param name="entities">The entities the raw data information should be fetched for.</param>
        /// <param name="filter">A condition used to filter the result.</param>
        /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
        public static async Task <RawDataInformation[]> ListRawData(this IRawDataServiceRestClient client, IEnumerable <RawDataTargetEntity> entities, FilterCondition filter = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            var infoList = new List <RawDataInformation>();

            foreach (var group in entities.GroupBy(p => p.Entity))
            {
                var infos = await client.ListRawData(group.Key, group.Select( p => p.Uuid.ToString()).ToArray(), filter, cancellationToken).ConfigureAwait(false);

                infoList.AddRange(infos);
            }
            return(infoList.ToArray());
        }
コード例 #5
0
        /// <summary>
        /// Fetches a list of raw data information.
        /// </summary>
        /// <param name="client">The client class to use.</param>
        /// <param name="target">The target entity to fetch the raw data information.</param>
        /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
        /// <exception cref="ArgumentNullException"><paramref name="client"/> or <paramref name="target"/> is <see langword="null" />.</exception>
        public static Task <RawDataInformationDto[]> ListRawData([NotNull] this IRawDataServiceRestClient client, [NotNull] RawDataTargetEntityDto target, CancellationToken cancellationToken = default)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            return(client.ListRawData(target.Entity, new[] { target.Uuid }, null, cancellationToken));
        }
コード例 #6
0
 /// <summary>
 /// Fetches a list of raw data information for the measurements identified by <paramref name="measurementUuids"/>.
 /// </summary>
 /// <param name="client">The client class to use.</param>
 /// <param name="measurementUuids">The list of measurement uuids the raw data information should be fetched for.</param>
 /// <param name="filter">A condition used to filter the result.</param>
 /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
 public static Task <RawDataInformation[]> ListRawDataForMeasurements(this IRawDataServiceRestClient client, Guid[] measurementUuids, FilterCondition filter = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(client.ListRawData(RawDataEntity.Measurement, measurementUuids?.Select(u => u.ToString()).ToArray(), filter, cancellationToken));
 }
コード例 #7
0
 /// <summary>
 /// Fetches a list of raw data information.
 /// </summary>
 /// <param name="client">The client class to use.</param>
 /// <param name="target">The target entity to fetch the raw data information.</param>
 /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
 public static Task <RawDataInformation[]> ListRawData(this IRawDataServiceRestClient client, RawDataTargetEntity target, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(client.ListRawData(target.Entity, new[] { target.Uuid }, null, cancellationToken));
 }
コード例 #8
0
 /// <summary>
 /// Fetches a list of raw data information for the measurement values identified by <paramref name="measurementValueUuids"/>.
 /// </summary>
 /// <param name="client">The client class to use.</param>
 /// <param name="measurementValueUuids">The list of value uuids the raw data information should be fetched for.</param>
 /// <param name="filter">A condition used to filter the result.</param>
 /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
 public static Task <RawDataInformation[]> ListRawDataForValues(this IRawDataServiceRestClient client, ValueRawDataIdentifier[] measurementValueUuids, FilterCondition filter = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(client.ListRawData(RawDataEntity.Value, measurementValueUuids?.Select(StringUuidTools.CreateStringUuidPair).ToArray(), filter, cancellationToken));
 }