-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDocumentReaderApi.cs
More file actions
129 lines (107 loc) · 4.25 KB
/
DocumentReaderApi.cs
File metadata and controls
129 lines (107 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Regula.DocumentReader.WebClient.Client;
using Regula.DocumentReader.WebClient.Model;
using Regula.DocumentReader.WebClient.Model.Ext;
namespace Regula.DocumentReader.WebClient.Api
{
public class DocumentReaderApi
{
private readonly HealthcheckApi _healthcheckApi;
private readonly ProcessApi _processApi;
private readonly ResourcesApi _resourcesApi;
public DocumentReaderApi(string basePath)
{
this._healthcheckApi = new HealthcheckApi(basePath);
this._processApi = new ProcessApi(basePath);
this._resourcesApi = new ResourcesApi(basePath);
}
public DocumentReaderApi(Configuration configuration)
{
this._healthcheckApi = new HealthcheckApi(configuration);
this._processApi = new ProcessApi(configuration);
this._resourcesApi = new ResourcesApi(configuration);
}
public IReadableConfiguration Configuration
{
get => this._processApi.Configuration;
set
{
this._healthcheckApi.Configuration = value;
this._processApi.Configuration = value;
this._resourcesApi.Configuration = value;
}
}
private string License { get; set; }
public RecognitionResponse Process(ProcessRequest processRequest)
{
return Process(processRequest, default(string));
}
public RecognitionResponse Process(ProcessRequest processRequest, String xRequestID)
{
if (processRequest.SystemInfo == null)
processRequest.SystemInfo = new ProcessSystemInfo(License);
else
processRequest.SystemInfo.License = License;
var response = this._processApi.ApiProcessWithHttpInfo(processRequest, xRequestID);
return new RecognitionResponse(response);
}
public async Task<RecognitionResponse> ProcessAsync(ProcessRequest processRequest)
{
return await ProcessAsync(processRequest, default(string));
}
public async Task<RecognitionResponse> ProcessAsync(ProcessRequest processRequest, String xRequestID)
{
return await ProcessAsync(processRequest, xRequestID, new CancellationToken());
}
public async Task<RecognitionResponse> ProcessAsync(ProcessRequest processRequest, String xRequestID, CancellationToken cancellationToken = default(CancellationToken))
{
if (processRequest.SystemInfo == null)
processRequest.SystemInfo = new ProcessSystemInfo(License);
else
processRequest.SystemInfo.License = License;
var response = await this._processApi.ApiProcessWithHttpInfoAsync(processRequest, xRequestID, cancellationToken);
return new RecognitionResponse(response);
}
public DatabaseDocumentList Doclist()
{
return this._resourcesApi.Doclist();
}
public async Task<DatabaseDocumentList> DoclistAsync()
{
return await DoclistAsync(new CancellationToken());
}
public async Task<DatabaseDocumentList> DoclistAsync(CancellationToken cancellationToken = default(CancellationToken))
{
return await this._resourcesApi.DoclistAsync(cancellationToken);
}
public DeviceInfo Ping(string xRequestID)
{
return this._healthcheckApi.Ping(xRequestID);
}
public DeviceInfo Ping()
{
return this._healthcheckApi.Ping();
}
public Healthcheck Health(string xRequestID)
{
return this._healthcheckApi.Healthz(xRequestID);
}
public Healthcheck Health()
{
return this._healthcheckApi.Healthz();
}
public DocumentReaderApi WithLicense(string license)
{
License = license;
return this;
}
public DocumentReaderApi WithLicense(byte[] license)
{
License = license != null ? Convert.ToBase64String(license) : null;
return this;
}
}
}