Exemple #1
0
        public async Task <AddTagsToStreamResponse> AddTagsToStreamAsync(Dictionary <string, string> tags, string streamName = null)
        {
            if (string.IsNullOrEmpty(streamName) && string.IsNullOrEmpty(_streamName))
            {
                throw new Exception("Please specify a stream name to add tags");
            }

            if (tags == null || tags.Count == 0 || tags.Count > 10)
            {
                throw new Exception("Please create a tag dictionary that's between 0 and 10 in size");
            }

            var addTagsRequest = new AddTagsToStreamRequest()
            {
                StreamName = streamName ?? _streamName,
                Tags       = tags
            };

            var response = await _client.AddTagsToStreamAsync(addTagsRequest, CancellationToken.None);

            return(response);
        }