public async Task <string> UpdateAsync(SubscriptionUpdateOptions options, string database = null, CancellationToken token = default) { if (options == null) { throw new ArgumentNullException($"Cannot update a subscription if {nameof(options)} is null"); } if (string.IsNullOrEmpty(options.Name) && options.Id == null) { throw new ArgumentNullException($"Cannot update a subscription if both {nameof(options)}.{nameof(options.Name)} and {nameof(options)}.{nameof(options.Id)} are null"); } var requestExecutor = _store.GetRequestExecutor(database); using (requestExecutor.ContextPool.AllocateOperationContext(out JsonOperationContext context)) { var command = new UpdateSubscriptionCommand(options); await requestExecutor.ExecuteAsync(command, context, sessionInfo : null, token : token).ConfigureAwait(false); return(command.Result.Name); } }
/// <summary> /// Update a data subscription in a database. /// </summary> public string Update(SubscriptionUpdateOptions options, string database = null) { return(AsyncHelpers.RunSync(() => UpdateAsync(options, database))); }