Skip to content

Commit 734bf77

Browse files
Merge pull request #185 from regulaforensics/feature/SP-23182
SP-23182 - remove example license
2 parents 541b2a3 + 490b60f commit 734bf77

File tree

10 files changed

+49
-64
lines changed

10 files changed

+49
-64
lines changed

src/Regula.DocumentReader.NetCoreExample/Program.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,11 @@ namespace Regula.DocumentReader.NetCoreExample
1212
internal static class Program
1313
{
1414
private const string API_BASE_PATH = "API_BASE_PATH";
15-
private const string TEST_LICENSE = "TEST_LICENSE";
16-
private const string LICENSE_FILE_NAME = "regula.license";
1715

1816
public static void Main()
1917
{
2018
var apiBaseUrl = Environment.GetEnvironmentVariable(API_BASE_PATH) ?? "https://api.regulaforensics.com";
2119

22-
var licenseFromEnv =
23-
Environment.GetEnvironmentVariable(TEST_LICENSE); // optional, used here only for smoke test purposes
24-
var licenseFromFile = File.Exists(LICENSE_FILE_NAME)
25-
? File.ReadAllBytes(LICENSE_FILE_NAME)
26-
: null;
27-
2820
var whitePage0 = File.ReadAllBytes("WHITE.jpg");
2921
var irPage0 = File.ReadAllBytes("IR.jpg");
3022
var uvPage0 = File.ReadAllBytes("UV.jpg");
@@ -59,9 +51,7 @@ public static void Main()
5951
// { "Authorization", $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes("USER:PASSWORD"))}" },
6052
// }
6153
};
62-
var api = licenseFromEnv != null
63-
? new DocumentReaderApi(configuration).WithLicense(licenseFromEnv)
64-
: new DocumentReaderApi(configuration).WithLicense(licenseFromFile);
54+
var api = new DocumentReaderApi(configuration);
6555

6656
var response = api.Process(request);
6757

src/Regula.DocumentReader.NetCoreExamplePortraitComparison/Program.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ namespace Regula.DocumentReader.NetCoreExamplePortraitComparison
99
internal static class Program
1010
{
1111
private const string API_BASE_PATH = "API_BASE_PATH";
12-
private const string TEST_LICENSE = "TEST_LICENSE";
13-
private const string LICENSE_FILE_NAME = "regula.license";
1412

1513
public static void Main()
1614
{
@@ -21,12 +19,6 @@ public static void Main()
2119

2220
var apiBaseUrl = Environment.GetEnvironmentVariable(API_BASE_PATH) ?? "https://api.regulaforensics.com";
2321

24-
var licenseFromEnv =
25-
Environment.GetEnvironmentVariable(TEST_LICENSE); // optional, used here only for smoke test purposes
26-
var licenseFromFile = File.Exists(LICENSE_FILE_NAME)
27-
? File.ReadAllBytes(LICENSE_FILE_NAME)
28-
: null;
29-
3022
var whitePage0 = File.ReadAllBytes("WHITE.jpg");
3123

3224
var requestParams = new RecognitionParams { AlreadyCropped = true }
@@ -51,9 +43,7 @@ public static void Main()
5143
// { "Authorization", $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes("USER:PASSWORD"))}" },
5244
// }
5345
};
54-
var api = licenseFromEnv != null
55-
? new DocumentReaderApi(configuration).WithLicense(licenseFromEnv)
56-
: new DocumentReaderApi(configuration).WithLicense(licenseFromFile);
46+
var api = new DocumentReaderApi(configuration);
5747

5848
var request = new RecognitionRequest(requestParams, new List<ProcessRequestImage>
5949
{

src/Regula.DocumentReader.WebClient/Model/ChosenDocumentType.cs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ protected ChosenDocumentType() { }
4646
/// <summary>
4747
/// Initializes a new instance of the <see cref="ChosenDocumentType" /> class.
4848
/// </summary>
49-
/// <param name="documentName">Document name (required).</param>
49+
/// <param name="documentName">Document name.</param>
5050
/// <param name="iD">Unique document type template identifier (Regula&#39;s internal numeric code) (required).</param>
5151
/// <param name="p">A measure of the likelihood of correct recognition in the analysis of this type of document (required).</param>
5252
/// <param name="rotated180">true if the document of the given type is rotated by 180 degrees (required).</param>
5353
/// <param name="rFIDPresence">rFIDPresence (required).</param>
54-
/// <param name="fDSIDList">fDSIDList (required).</param>
54+
/// <param name="fDSIDList">fDSIDList.</param>
5555
/// <param name="necessaryLights">Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document (required).</param>
5656
/// <param name="checkAuthenticity">Set of authentication options provided for this type of document (combination of Authenticity enum) (required).</param>
5757
/// <param name="uVExp">The required exposure value of the camera when receiving images of a document of this type for a UV lighting scheme (required).</param>
@@ -60,36 +60,26 @@ protected ChosenDocumentType() { }
6060
/// <param name="rotationAngle">rotationAngle.</param>
6161
public ChosenDocumentType(string documentName = default(string), int iD = default(int), decimal p = default(decimal), int rotated180 = default(int), RfidLocation rFIDPresence = default(RfidLocation), FDSIDList fDSIDList = default(FDSIDList), int necessaryLights = default(int), int checkAuthenticity = default(int), int uVExp = default(int), int authenticityNecessaryLights = default(int), decimal oVIExp = default(decimal), int rotationAngle = default(int))
6262
{
63-
// to ensure "documentName" is required (not null)
64-
if (documentName == null)
65-
{
66-
throw new ArgumentNullException("documentName is a required property for ChosenDocumentType and cannot be null");
67-
}
68-
this.DocumentName = documentName;
6963
this.ID = iD;
7064
this.P = p;
7165
this.Rotated180 = rotated180;
7266
this.RFIDPresence = rFIDPresence;
73-
// to ensure "fDSIDList" is required (not null)
74-
if (fDSIDList == null)
75-
{
76-
throw new ArgumentNullException("fDSIDList is a required property for ChosenDocumentType and cannot be null");
77-
}
78-
this.FDSIDList = fDSIDList;
7967
this.NecessaryLights = necessaryLights;
8068
this.CheckAuthenticity = checkAuthenticity;
8169
this.UVExp = uVExp;
8270
this.AuthenticityNecessaryLights = authenticityNecessaryLights;
8371
this.OVIExp = oVIExp;
72+
this.DocumentName = documentName;
73+
this.FDSIDList = fDSIDList;
8474
this.RotationAngle = rotationAngle;
8575
}
8676

8777
/// <summary>
8878
/// Document name
8979
/// </summary>
9080
/// <value>Document name</value>
91-
[DataMember(Name = "DocumentName", IsRequired = true, EmitDefaultValue = true)]
92-
public string DocumentName { get; set; }
81+
[DataMember(Name = "DocumentName", EmitDefaultValue = false)]
82+
public string? DocumentName { get; set; }
9383

9484
/// <summary>
9585
/// Unique document type template identifier (Regula&#39;s internal numeric code)
@@ -118,8 +108,8 @@ protected ChosenDocumentType() { }
118108
/// <summary>
119109
/// Gets or Sets FDSIDList
120110
/// </summary>
121-
[DataMember(Name = "FDSIDList", IsRequired = true, EmitDefaultValue = true)]
122-
public FDSIDList FDSIDList { get; set; }
111+
[DataMember(Name = "FDSIDList", EmitDefaultValue = false)]
112+
public FDSIDList? FDSIDList { get; set; }
123113

124114
/// <summary>
125115
/// Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document

src/Regula.DocumentReader.WebClient/Model/EncryptedRCLItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected EncryptedRCLItem() { }
5656
/// </summary>
5757
/// <value>Base64 encoded data</value>
5858
/*
59-
<example>[B@4b3f0960</example>
59+
<example>[B@2d970d48</example>
6060
*/
6161
[DataMember(Name = "EncryptedRCL", IsRequired = true, EmitDefaultValue = true)]
6262
public byte[] EncryptedRCL { get; set; }

src/Regula.DocumentReader.WebClient/Model/EncryptedRCLResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected EncryptedRCLResult() { }
6262
/// </summary>
6363
/// <value>Base64 encoded data</value>
6464
/*
65-
<example>[B@4b3f0960</example>
65+
<example>[B@2d970d48</example>
6666
*/
6767
[DataMember(Name = "EncryptedRCL", IsRequired = true, EmitDefaultValue = true)]
6868
public byte[] EncryptedRCL { get; set; }

src/Regula.DocumentReader.WebClient/Model/LicenseItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected LicenseItem() { }
5656
/// </summary>
5757
/// <value>Base64 encoded data</value>
5858
/*
59-
<example>[B@5259b0e4</example>
59+
<example>[B@2065118c</example>
6060
*/
6161
[DataMember(Name = "License", IsRequired = true, EmitDefaultValue = true)]
6262
public byte[] License { get; set; }

src/Regula.DocumentReader.WebClient/Model/LicenseResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected LicenseResult() { }
6262
/// </summary>
6363
/// <value>Base64 encoded data</value>
6464
/*
65-
<example>[B@5259b0e4</example>
65+
<example>[B@2065118c</example>
6666
*/
6767
[DataMember(Name = "License", IsRequired = true, EmitDefaultValue = true)]
6868
public byte[] License { get; set; }

src/Regula.DocumentReader.WebClient/Model/OneCandidate.cs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ protected OneCandidate() { }
4646
/// <summary>
4747
/// Initializes a new instance of the <see cref="OneCandidate" /> class.
4848
/// </summary>
49-
/// <param name="documentName">Document name (required).</param>
49+
/// <param name="documentName">Document name.</param>
5050
/// <param name="iD">Unique document type template identifier (Regula&#39;s internal numeric code) (required).</param>
5151
/// <param name="p">A measure of the likelihood of correct recognition in the analysis of this type of document (required).</param>
5252
/// <param name="rotated180">true if the document of the given type is rotated by 180 degrees (required).</param>
5353
/// <param name="rFIDPresence">rFIDPresence (required).</param>
54-
/// <param name="fDSIDList">fDSIDList (required).</param>
54+
/// <param name="fDSIDList">fDSIDList.</param>
5555
/// <param name="necessaryLights">Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document (required).</param>
5656
/// <param name="checkAuthenticity">Set of authentication options provided for this type of document (combination of Authenticity enum) (required).</param>
5757
/// <param name="uVExp">The required exposure value of the camera when receiving images of a document of this type for a UV lighting scheme (required).</param>
@@ -60,36 +60,26 @@ protected OneCandidate() { }
6060
/// <param name="rotationAngle">rotationAngle.</param>
6161
public OneCandidate(string documentName = default(string), int iD = default(int), decimal p = default(decimal), int rotated180 = default(int), RfidLocation rFIDPresence = default(RfidLocation), FDSIDList fDSIDList = default(FDSIDList), int necessaryLights = default(int), int checkAuthenticity = default(int), int uVExp = default(int), int authenticityNecessaryLights = default(int), decimal oVIExp = default(decimal), int rotationAngle = default(int))
6262
{
63-
// to ensure "documentName" is required (not null)
64-
if (documentName == null)
65-
{
66-
throw new ArgumentNullException("documentName is a required property for OneCandidate and cannot be null");
67-
}
68-
this.DocumentName = documentName;
6963
this.ID = iD;
7064
this.P = p;
7165
this.Rotated180 = rotated180;
7266
this.RFIDPresence = rFIDPresence;
73-
// to ensure "fDSIDList" is required (not null)
74-
if (fDSIDList == null)
75-
{
76-
throw new ArgumentNullException("fDSIDList is a required property for OneCandidate and cannot be null");
77-
}
78-
this.FDSIDList = fDSIDList;
7967
this.NecessaryLights = necessaryLights;
8068
this.CheckAuthenticity = checkAuthenticity;
8169
this.UVExp = uVExp;
8270
this.AuthenticityNecessaryLights = authenticityNecessaryLights;
8371
this.OVIExp = oVIExp;
72+
this.DocumentName = documentName;
73+
this.FDSIDList = fDSIDList;
8474
this.RotationAngle = rotationAngle;
8575
}
8676

8777
/// <summary>
8878
/// Document name
8979
/// </summary>
9080
/// <value>Document name</value>
91-
[DataMember(Name = "DocumentName", IsRequired = true, EmitDefaultValue = true)]
92-
public string DocumentName { get; set; }
81+
[DataMember(Name = "DocumentName", EmitDefaultValue = false)]
82+
public string? DocumentName { get; set; }
9383

9484
/// <summary>
9585
/// Unique document type template identifier (Regula&#39;s internal numeric code)
@@ -118,8 +108,8 @@ protected OneCandidate() { }
118108
/// <summary>
119109
/// Gets or Sets FDSIDList
120110
/// </summary>
121-
[DataMember(Name = "FDSIDList", IsRequired = true, EmitDefaultValue = true)]
122-
public FDSIDList FDSIDList { get; set; }
111+
[DataMember(Name = "FDSIDList", EmitDefaultValue = false)]
112+
public FDSIDList? FDSIDList { get; set; }
123113

124114
/// <summary>
125115
/// Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document

src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ protected ProcessParams() { }
144144
/// <param name="doBarcodes">Set the types of barcodes to process..</param>
145145
/// <param name="strictDLCategoryExpiry">Set to force DL categories expiry date to affect the overall status or not. As documents usually have their own date of expiry, which might be less or greater than category expiry date, this might be handy for specific cases..</param>
146146
/// <param name="generateAlpha2Codes">Set to generate Alpha-2 codes for nationality and issuing state fields..</param>
147-
public ProcessParams(bool generateDTCVC = default(bool), List<LCID> lcidFilter = default(List<LCID>), bool checkLiveness = default(bool), List<LCID> lcidIgnoreFilter = default(List<LCID>), bool oneShotIdentification = default(bool), bool useFaceApi = default(bool), FaceApi faceApi = default(FaceApi), bool doDetectCan = default(bool), int imageOutputMaxHeight = default(int), int imageOutputMaxWidth = default(int), Scenario scenario = default(Scenario), List<Result> resultTypeOutput = default(List<Result>), bool doublePageSpread = default(bool), bool generateDoublePageSpreadImage = default(bool), List<TextFieldType> fieldTypesFilter = default(List<TextFieldType>), string dateFormat = default(string), MeasureSystem? measureSystem = default(MeasureSystem?), int imageDpiOutMax = default(int), bool alreadyCropped = default(bool), Dictionary<string, Object> customParams = default(Dictionary<string, Object>), List<PerDocumentConfig> config = default(List<PerDocumentConfig>), bool log = default(bool), LogLevel? logLevel = default(LogLevel?), int forceDocID = default(int), bool matchTextFieldMask = default(bool), bool fastDocDetect = default(bool), bool updateOCRValidityByGlare = default(bool), bool checkRequiredTextFields = default(bool), bool returnCroppedBarcode = default(bool), ImageQA imageQa = default(ImageQA), bool strictImageQuality = default(bool), bool respectImageQuality = default(bool), DocumentFormat? forceDocFormat = default(DocumentFormat?), bool noGraphics = default(bool), bool depersonalizeLog = default(bool), bool multiDocOnImage = default(bool), int shiftExpiryDate = default(int), int minimalHolderAge = default(int), bool returnUncroppedImage = default(bool), List<MRZFormat> mrzFormatsFilter = default(List<MRZFormat>), bool forceReadMrzBeforeLocate = default(bool), bool parseBarcodes = default(bool), TextPostProcessing? convertCase = default(TextPostProcessing?), bool splitNames = default(bool), bool disablePerforationOCR = default(bool), List<DocumentType> documentGroupFilter = default(List<DocumentType>), AuthenticityResultType? processAuth = default(AuthenticityResultType?), int deviceId = default(int), int deviceType = default(int), string deviceTypeHex = default(string), bool ignoreDeviceIdFromImage = default(bool), List<int> documentIdList = default(List<int>), ProcessParamsRfid rfid = default(ProcessParamsRfid), bool checkAuth = default(bool), AuthParams authParams = default(AuthParams), MrzDetectModeEnum? mrzDetectMode = default(MrzDetectModeEnum?), bool generateNumericCodes = default(bool), bool strictBarcodeDigitalSignatureCheck = default(bool), bool selectLongestNames = default(bool), List<InputBarcodeType> doBarcodes = default(List<InputBarcodeType>), bool strictDLCategoryExpiry = default(bool), bool generateAlpha2Codes = default(bool))
147+
/// <param name="pdfPagesLimit">Limits the number of pages to be processed from a PDF file..</param>
148+
public ProcessParams(bool generateDTCVC = default(bool), List<LCID> lcidFilter = default(List<LCID>), bool checkLiveness = default(bool), List<LCID> lcidIgnoreFilter = default(List<LCID>), bool oneShotIdentification = default(bool), bool useFaceApi = default(bool), FaceApi faceApi = default(FaceApi), bool doDetectCan = default(bool), int imageOutputMaxHeight = default(int), int imageOutputMaxWidth = default(int), Scenario scenario = default(Scenario), List<Result> resultTypeOutput = default(List<Result>), bool doublePageSpread = default(bool), bool generateDoublePageSpreadImage = default(bool), List<TextFieldType> fieldTypesFilter = default(List<TextFieldType>), string dateFormat = default(string), MeasureSystem? measureSystem = default(MeasureSystem?), int imageDpiOutMax = default(int), bool alreadyCropped = default(bool), Dictionary<string, Object> customParams = default(Dictionary<string, Object>), List<PerDocumentConfig> config = default(List<PerDocumentConfig>), bool log = default(bool), LogLevel? logLevel = default(LogLevel?), int forceDocID = default(int), bool matchTextFieldMask = default(bool), bool fastDocDetect = default(bool), bool updateOCRValidityByGlare = default(bool), bool checkRequiredTextFields = default(bool), bool returnCroppedBarcode = default(bool), ImageQA imageQa = default(ImageQA), bool strictImageQuality = default(bool), bool respectImageQuality = default(bool), DocumentFormat? forceDocFormat = default(DocumentFormat?), bool noGraphics = default(bool), bool depersonalizeLog = default(bool), bool multiDocOnImage = default(bool), int shiftExpiryDate = default(int), int minimalHolderAge = default(int), bool returnUncroppedImage = default(bool), List<MRZFormat> mrzFormatsFilter = default(List<MRZFormat>), bool forceReadMrzBeforeLocate = default(bool), bool parseBarcodes = default(bool), TextPostProcessing? convertCase = default(TextPostProcessing?), bool splitNames = default(bool), bool disablePerforationOCR = default(bool), List<DocumentType> documentGroupFilter = default(List<DocumentType>), AuthenticityResultType? processAuth = default(AuthenticityResultType?), int deviceId = default(int), int deviceType = default(int), string deviceTypeHex = default(string), bool ignoreDeviceIdFromImage = default(bool), List<int> documentIdList = default(List<int>), ProcessParamsRfid rfid = default(ProcessParamsRfid), bool checkAuth = default(bool), AuthParams authParams = default(AuthParams), MrzDetectModeEnum? mrzDetectMode = default(MrzDetectModeEnum?), bool generateNumericCodes = default(bool), bool strictBarcodeDigitalSignatureCheck = default(bool), bool selectLongestNames = default(bool), List<InputBarcodeType> doBarcodes = default(List<InputBarcodeType>), bool strictDLCategoryExpiry = default(bool), bool generateAlpha2Codes = default(bool), int pdfPagesLimit = default(int))
148149
{
149150
this.Scenario = scenario;
150151
this.GenerateDTCVC = generateDTCVC;
@@ -208,6 +209,7 @@ protected ProcessParams() { }
208209
this.DoBarcodes = doBarcodes;
209210
this.StrictDLCategoryExpiry = strictDLCategoryExpiry;
210211
this.GenerateAlpha2Codes = generateAlpha2Codes;
212+
this.PdfPagesLimit = pdfPagesLimit;
211213
}
212214

213215
/// <summary>
@@ -597,6 +599,13 @@ protected ProcessParams() { }
597599
[DataMember(Name = "generateAlpha2Codes", EmitDefaultValue = false)]
598600
public bool? GenerateAlpha2Codes { get; set; }
599601

602+
/// <summary>
603+
/// Limits the number of pages to be processed from a PDF file.
604+
/// </summary>
605+
/// <value>Limits the number of pages to be processed from a PDF file.</value>
606+
[DataMember(Name = "pdfPagesLimit", EmitDefaultValue = false)]
607+
public int? PdfPagesLimit { get; set; }
608+
600609
/// <summary>
601610
/// Returns the string presentation of the object
602611
/// </summary>
@@ -667,6 +676,7 @@ public override string ToString()
667676
sb.Append(" DoBarcodes: ").Append(DoBarcodes).Append("\n");
668677
sb.Append(" StrictDLCategoryExpiry: ").Append(StrictDLCategoryExpiry).Append("\n");
669678
sb.Append(" GenerateAlpha2Codes: ").Append(GenerateAlpha2Codes).Append("\n");
679+
sb.Append(" PdfPagesLimit: ").Append(PdfPagesLimit).Append("\n");
670680
sb.Append("}\n");
671681
return sb.ToString();
672682
}

0 commit comments

Comments
 (0)