-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad67c1a
commit 249ad07
Showing
12 changed files
with
135 additions
and
53 deletions.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
text-analyzer/src/Clients/TextAnalyzer.Web.ConsoleClient/ApiOptions.cs
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
text-analyzer/src/Clients/TextAnalyzer.Web.ConsoleClient/AppOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace TextAnalyzer.Web.ConsoleClient | ||
{ | ||
public class AppOptions | ||
{ | ||
public const string Key = "App"; | ||
|
||
public string RestApi { get; set; } | ||
|
||
public string ReaderFactory { get; set; } | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
text-analyzer/src/Clients/TextAnalyzer.Web.ConsoleClient/ConsoleExecutor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TextAnalyzer.Core.Application.Commands.Documents; | ||
using TextAnalyzer.Web.ConsoleClient.Interface; | ||
using TextAnalyzer.Web.RestClient.Interface; | ||
|
||
namespace TextAnalyzer.Web.ConsoleClient | ||
{ | ||
public class ConsoleExecutor : IExecutor | ||
{ | ||
private readonly IApiClient _apiClient; | ||
private readonly IReaderFactory _readerFactory; | ||
|
||
public ConsoleExecutor(IApiClient apiClient, IReaderFactory readerFactory) | ||
{ | ||
_apiClient = apiClient; | ||
_readerFactory = readerFactory; | ||
} | ||
|
||
public async Task ExecuteAsync() | ||
{ | ||
var reader = _readerFactory.Create(); | ||
|
||
var document = reader.Read(); | ||
|
||
var request = new CreateDocumentCommand | ||
{ | ||
Name = document.Name, | ||
Text = document.Text, | ||
}; | ||
|
||
var response = await _apiClient.Documents.CreateDocumentAsync(request); | ||
|
||
Console.WriteLine($"Word count is: {response.Data.WordCount}"); | ||
|
||
Console.ReadKey(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
...Web.ConsoleClient/Interface/ReaderType.cs → ....Web.ConsoleClient/Interface/IExecutor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TextAnalyzer.Web.ConsoleClient.Interface | ||
{ | ||
public enum ReaderType | ||
public interface IExecutor | ||
{ | ||
None = 0, | ||
Console = 1, | ||
Database = 2, | ||
File = 3 | ||
Task ExecuteAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
text-analyzer/src/Clients/TextAnalyzer.Web.ConsoleClient/appsettings.Development.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
text-analyzer/src/Clients/TextAnalyzer.Web.ConsoleClient/appsettings.Production.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
text-analyzer/src/Clients/TextAnalyzer.Web.ConsoleClient/appsettings.Staging.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters