Example #1
0
        public async Task <DataSetSummary> Create(IDataSetSource source, CancellationToken cancellationToken = default(CancellationToken))
        {
            Argument.IsNotNullOrEmpty(source.Name, nameof(source.Name));

            switch (source)
            {
            case DataSetDetailSource detail:
                Argument.IsNotNull(detail.Data, nameof(detail.Data));
                return(await apiConnection.Put <DataSetSummary>($"data/{detail.Name}", null, detail.Data, HttpMessageTransformer, cancellationToken).ConfigureAwait(false));

            case DataSetStreamSource stream:
                Argument.IsNotNull(stream.Data, nameof(stream.Data));
                return(await apiConnection.Put <DataSetSummary>($"data/{stream.Name}", null, stream.Data, HttpMessageTransformer, cancellationToken).ConfigureAwait(false));

            default:
                throw new NotImplementedException($"No DataSet create supported for {source.GetType()}");
            }
        }
Example #2
0
        public async Task <DataSetSummary> Create(IDataSetSource source)
        {
            Argument.IsNotNullOrEmpty(source.Name, nameof(source.Name));

            switch (source)
            {
            case DataSetDetailSource detail:
                Argument.IsNotNull(detail.Data, nameof(detail.Data));
                return(await Client.Put <DataSetSummary>($"{ApiKeys.Endpoint}data/{detail.Name}", ApiKeys.ApiToken, null, detail.Data).ConfigureAwait(false));

            case DataSetStreamSource stream:
                Argument.IsNotNull(stream.Data, nameof(stream.Data));
                return(await Client.Put <DataSetSummary>($"{ApiKeys.Endpoint}data/{stream.Name}", ApiKeys.ApiToken, null, stream.Data).ConfigureAwait(false));

            default:
                throw new NotImplementedException($"No DataSet create supported for {source.GetType()}");
            }
        }