public Task <IOperationResult <IFarmList> > FarmListAsync( CancellationToken cancellationToken = default) { return(_executor.ExecuteAsync( new FarmListOperation(), cancellationToken)); }
public async Task RunAsync() { // Commands var decoratedCommand = new FooCommand { Name = "Decorated command" }; await _executor.ExecuteAsync(decoratedCommand); await _writer.WriteLineAsync("----------------"); var regularCommand = new BarCommand { Name = "Regular command" }; var regularCommandResult = await _executor.ExecuteAsync(regularCommand); await _writer.WriteLineAsync("----------------"); var syncCommand = new BazCommand(); var syncCommandResult = await _executor.ExecuteAsync(syncCommand); await _writer.WriteLineAsync($"Sync command result is `{syncCommandResult}`"); await _writer.WriteLineAsync("----------------"); // Queries var regularQuery = new FooQuery { Number1 = 3, Number2 = 4 }; var regularQueryResult = await _executor.ExecuteAsync(regularQuery); await _writer.WriteLineAsync("----------------"); }
public Task <IOperationResult <IGetHero> > GetHeroAsync( CancellationToken cancellationToken = default) { return(_executor.ExecuteAsync( new GetHeroOperation(), cancellationToken)); }
public Task <IOperationResult <IPublishSchema> > PublishSchemaAsync( Optional <string> schemaName = default, Optional <string> environmentName = default, Optional <string> sourceText = default, Optional <IReadOnlyList <TagInput>?> tags = default, CancellationToken cancellationToken = default) { if (schemaName.HasValue && schemaName.Value is null) { throw new ArgumentNullException(nameof(schemaName)); } if (environmentName.HasValue && environmentName.Value is null) { throw new ArgumentNullException(nameof(environmentName)); } if (sourceText.HasValue && sourceText.Value is null) { throw new ArgumentNullException(nameof(sourceText)); } return(_executor.ExecuteAsync( new PublishSchemaOperation { SchemaName = schemaName, EnvironmentName = environmentName, SourceText = sourceText, Tags = tags }, cancellationToken)); }
public Task <IOperationResult <IGetHero> > GetHeroAsync( Episode?episode, CancellationToken cancellationToken) { return(_executor.ExecuteAsync( new GetHeroOperation { Episode = episode }, cancellationToken)); }
public Task <IOperationResult <IGetHero> > GetHeroAsync( Optional <Episode> episode = default, CancellationToken cancellationToken = default) { return(_executor.ExecuteAsync( new GetHeroOperation { Episode = episode }, cancellationToken)); }
public Task <IOperationResult <IMediaDetails> > MediaDetailsAsync( Optional <System.Guid> id = default, CancellationToken cancellationToken = default) { return(_executor.ExecuteAsync( new MediaDetailsOperation { Id = id }, cancellationToken)); }
public Task <IOperationResult <IGetProducts> > GetProductsAsync( Optional <int> currentPage = default, Optional <double> highPrice = default, CancellationToken cancellationToken = default) { return(_executor.ExecuteAsync( new GetProductsOperation { CurrentPage = currentPage, HighPrice = highPrice }, cancellationToken)); }
public Task <IOperationResult <IGetHuman> > GetHumanAsync( Optional <string> id = default, CancellationToken cancellationToken = default) { if (id.HasValue && id.Value is null) { throw new ArgumentNullException(nameof(id)); } return(_executor.ExecuteAsync( new GetHumanOperation { Id = id }, cancellationToken)); }
public Task <IOperationResult <IGetUser> > GetUserAsync( Optional <string> login = default, CancellationToken cancellationToken = default) { if (login.HasValue && login.Value is null) { throw new ArgumentNullException(nameof(login)); } return(_executor.ExecuteAsync( new GetUserOperation { Login = login }, cancellationToken)); }
public Task <IOperationResult <IMyQuery> > MyQueryAsync( CancellationToken cancellationToken) { return(_executor.ExecuteAsync( new MyQueryOperation(), cancellationToken)); }
public Task <IOperationResult <IGetValues> > GetValuesAsync( CancellationToken cancellationToken) { return(_executor.ExecuteAsync( new GetValuesOperation(), cancellationToken)); }
public async Task <IOperationResult <GetHeroResult> > ExecuteAsync( CancellationToken cancellationToken = default) { OperationRequest request = CreateRequest(); return(await _operationExecutor .ExecuteAsync(request, cancellationToken) .ConfigureAwait(false)); }
public Task <IOperationResult <IGetCustomers> > GetCustomersAsync( CancellationToken cancellationToken = default) { return(_executor.ExecuteAsync( new GetCustomersOperation(), cancellationToken)); }
private async Task <TResult> ExecuteAsync <TResult>(IOperation <TResult> operation) { try { return(await _executor.ExecuteAsync(operation)); } catch (ValidationException ex) { var commandType = operation.GetType().Name; foreach (var failure in ex.ValidationResult) { await _writer.WriteLineAsync($"Validation {failure.Level} ({commandType}): {failure.Message}"); } return(default);
public Task <IOperationResult <IGetUser> > GetUserAsync( string login, CancellationToken cancellationToken) { if (login is null) { throw new ArgumentNullException(nameof(login)); } return(_executor.ExecuteAsync( new GetUserOperation { Login = login }, cancellationToken)); }
public Task <IOperationResult <IPeople> > GetPeopleAsync( Optional <string> userId = default, CancellationToken cancellationToken = default) { if (userId.HasValue && userId.Value is null) { throw new ArgumentNullException(nameof(userId)); } return(_executor.ExecuteAsync( new GetPeopleOperation { UserId = userId }, cancellationToken)); }