11using System ;
2- using System . Net . Http ;
3- using System . Text . Json ;
2+ using System . Collections . Generic ;
43using System . Threading ;
54using System . Threading . Tasks ;
6- using Microsoft . Extensions . Logging ;
75using Regula . DocumentReader . WebClient . Client ;
86using Regula . DocumentReader . WebClient . Model ;
97using Regula . DocumentReader . WebClient . Model . Ext ;
@@ -17,82 +15,90 @@ public class DocumentReaderApi
1715
1816 public DocumentReaderApi ( string basePath )
1917 {
20- var loggerFactory = LoggerFactory . Create ( builder =>
21- {
22- builder . AddConsole ( ) ;
23- } ) ;
18+ this . _healthcheckApi = new HealthcheckApi ( basePath ) ;
19+ this . _processApi = new ProcessApi ( basePath ) ;
20+ }
2421
25- ILogger < HealthcheckApi > healthcheckLogger = loggerFactory . CreateLogger < HealthcheckApi > ( ) ;
26- ILogger < ProcessApi > processLogger = loggerFactory . CreateLogger < ProcessApi > ( ) ;
22+ public IReadableConfiguration Configuration
23+ {
24+ get => this . _processApi . Configuration ;
25+ set => this . _processApi . Configuration = value ;
26+ }
2727
28- var httpClient = new HttpClient
29- {
30- BaseAddress = new Uri ( basePath )
31- } ;
28+ private string License { get ; set ; }
3229
33- var jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider ( new JsonSerializerOptions ( ) ) ;
3430
35- var healthcheckApiEvents = new HealthcheckApiEvents ( ) ;
36- var processApiEvents = new ProcessApiEvents ( ) ;
3731
38- this . _healthcheckApi = new HealthcheckApi (
39- healthcheckLogger ,
40- loggerFactory ,
41- httpClient ,
42- jsonSerializerOptionsProvider ,
43- healthcheckApiEvents
44- ) ;
45- this . _processApi = new ProcessApi (
46- processLogger ,
47- loggerFactory ,
48- httpClient ,
49- jsonSerializerOptionsProvider ,
50- processApiEvents
51- ) ;
32+ public RecognitionResponse Process ( ProcessRequest processRequest )
33+ {
34+ return Process ( processRequest , new Dictionary < String , String > ( ) , default ( string ) ) ;
5235 }
5336
54- private string License { get ; set ; }
37+ public RecognitionResponse Process ( ProcessRequest processRequest , Dictionary < String , String > headers )
38+ {
39+ return Process ( processRequest , headers , default ( string ) ) ;
40+ }
41+
42+ public RecognitionResponse Process ( ProcessRequest processRequest , String xRequestID )
43+ {
44+ return Process ( processRequest , new Dictionary < String , String > ( ) , xRequestID ) ;
45+ }
46+
47+ public RecognitionResponse Process ( ProcessRequest processRequest , Dictionary < String , String > headers , String xRequestID )
48+ {
49+ if ( processRequest . SystemInfo == null )
50+ processRequest . SystemInfo = new ProcessSystemInfo ( License ) ;
51+ else
52+ processRequest . SystemInfo . License = License ;
53+
54+ return new RecognitionResponse ( this . _processApi . ApiProcessWithHttpInfo ( processRequest , xRequestID ) ) ;
55+ }
5556
5657 public async Task < RecognitionResponse > ProcessAsync ( ProcessRequest processRequest )
5758 {
58- return await ProcessAsync ( processRequest ) ;
59+ return await ProcessAsync ( processRequest , new Dictionary < String , String > ( ) , default ( string ) ) ;
60+ }
61+
62+ public async Task < RecognitionResponse > ProcessAsync ( ProcessRequest processRequest , Dictionary < String , String > headers )
63+ {
64+ return await ProcessAsync ( processRequest , headers , default ( string ) ) ;
5965 }
6066
6167 public async Task < RecognitionResponse > ProcessAsync ( ProcessRequest processRequest , String xRequestID )
6268 {
63- return await ProcessAsync ( processRequest , xRequestID ) ;
69+ return await ProcessAsync ( processRequest , new Dictionary < String , String > ( ) , xRequestID ) ;
6470 }
6571
66- public async Task < RecognitionResponse > ProcessAsync ( ProcessRequest processRequest , string xRequestID = default , CancellationToken cancellationToken = default )
72+ public async Task < RecognitionResponse > ProcessAsync ( ProcessRequest processRequest , Dictionary < String , String > headers , String xRequestID , CancellationToken cancellationToken = default ( CancellationToken ) )
6773 {
6874 if ( processRequest . SystemInfo == null )
6975 processRequest . SystemInfo = new ProcessSystemInfo ( License ) ;
7076 else
7177 processRequest . SystemInfo . License = License ;
7278
73- var response = await this . _processApi . ApiProcessAsync ( processRequest , xRequestID , cancellationToken ) ;
79+ var response = await this . _processApi . ApiProcessWithHttpInfoAsync ( processRequest , xRequestID , cancellationToken ) ;
7480
7581 return new RecognitionResponse ( response ) ;
7682 }
7783
78- public async Task < IPingApiResponse > PingAsync ( string xRequestID )
84+ public DeviceInfo Ping ( string xRequestID )
7985 {
80- return await this . _healthcheckApi . PingAsync ( xRequestID ) ;
86+ return this . _healthcheckApi . Ping ( xRequestID ) ;
8187 }
8288
83- public async Task < IPingApiResponse > PingAsync ( )
89+ public DeviceInfo Ping ( )
8490 {
85- return await this . _healthcheckApi . PingAsync ( ) ;
91+ return this . _healthcheckApi . Ping ( ) ;
8692 }
87-
88- public async Task < IHealthzApiResponse > HealthAsync ( string xRequestID )
93+
94+ public Healthcheck Health ( string xRequestID )
8995 {
90- return await this . _healthcheckApi . HealthzAsync ( xRequestID ) ;
96+ return this . _healthcheckApi . Healthz ( xRequestID ) ;
9197 }
9298
93- public async Task < IHealthzApiResponse > HealthAsync ( )
99+ public Healthcheck Health ( )
94100 {
95- return await this . _healthcheckApi . HealthzAsync ( ) ;
101+ return this . _healthcheckApi . Healthz ( ) ;
96102 }
97103
98104 public DocumentReaderApi WithLicense ( string license )
0 commit comments