Exemple #1
0
        /// <summary>
        /// Appends a new field to an existing dataset
        /// </summary>
        /// <param name="datasetKey">The dataset key</param>
        /// <param name="field">The field to append</param>
        /// <returns>The error if there is one</returns>
        public async Task AddFieldAsync(string datasetKey, DatasetField field)
        {
            this._datasetValidator.ValidateDatasetKey(datasetKey);
            this._datasetValidator.ValidateField(field);

            await this._client.SendAsyncRequest(
                HttpMethod.Post,
                $"api/v1/definition/streaming/datasets/{datasetKey}/fields",
                JsonSerializer.Serialize(field, this._serializerSettings));
        }
Exemple #2
0
        public void ValidateField(DatasetField field)
        {
            this.ValidateFieldKey(field.Key);

            if (field.DisplayName.Length > 255)
            {
                throw new ArgumentException("displayName cannot be longer than 255 characters", field.DisplayName);
            }

            if (field.Description.Length > 1024)
            {
                throw new ArgumentException("description cannot be longer than 1024 characters", field.Description);
            }
        }