Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions src/Regula.DocumentReader.NetCoreExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,11 @@ namespace Regula.DocumentReader.NetCoreExample
internal static class Program
{
private const string API_BASE_PATH = "API_BASE_PATH";
private const string TEST_LICENSE = "TEST_LICENSE";
private const string LICENSE_FILE_NAME = "regula.license";

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

var licenseFromEnv =
Environment.GetEnvironmentVariable(TEST_LICENSE); // optional, used here only for smoke test purposes
var licenseFromFile = File.Exists(LICENSE_FILE_NAME)
? File.ReadAllBytes(LICENSE_FILE_NAME)
: null;

var whitePage0 = File.ReadAllBytes("WHITE.jpg");
var irPage0 = File.ReadAllBytes("IR.jpg");
var uvPage0 = File.ReadAllBytes("UV.jpg");
Expand Down Expand Up @@ -59,9 +51,7 @@ public static void Main()
// { "Authorization", $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes("USER:PASSWORD"))}" },
// }
};
var api = licenseFromEnv != null
? new DocumentReaderApi(configuration).WithLicense(licenseFromEnv)
: new DocumentReaderApi(configuration).WithLicense(licenseFromFile);
var api = new DocumentReaderApi(configuration);

var response = api.Process(request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ namespace Regula.DocumentReader.NetCoreExamplePortraitComparison
internal static class Program
{
private const string API_BASE_PATH = "API_BASE_PATH";
private const string TEST_LICENSE = "TEST_LICENSE";
private const string LICENSE_FILE_NAME = "regula.license";

public static void Main()
{
Expand All @@ -21,12 +19,6 @@ public static void Main()

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

var licenseFromEnv =
Environment.GetEnvironmentVariable(TEST_LICENSE); // optional, used here only for smoke test purposes
var licenseFromFile = File.Exists(LICENSE_FILE_NAME)
? File.ReadAllBytes(LICENSE_FILE_NAME)
: null;

var whitePage0 = File.ReadAllBytes("WHITE.jpg");

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

var request = new RecognitionRequest(requestParams, new List<ProcessRequestImage>
{
Expand Down
26 changes: 8 additions & 18 deletions src/Regula.DocumentReader.WebClient/Model/ChosenDocumentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ protected ChosenDocumentType() { }
/// <summary>
/// Initializes a new instance of the <see cref="ChosenDocumentType" /> class.
/// </summary>
/// <param name="documentName">Document name (required).</param>
/// <param name="documentName">Document name.</param>
/// <param name="iD">Unique document type template identifier (Regula&#39;s internal numeric code) (required).</param>
/// <param name="p">A measure of the likelihood of correct recognition in the analysis of this type of document (required).</param>
/// <param name="rotated180">true if the document of the given type is rotated by 180 degrees (required).</param>
/// <param name="rFIDPresence">rFIDPresence (required).</param>
/// <param name="fDSIDList">fDSIDList (required).</param>
/// <param name="fDSIDList">fDSIDList.</param>
/// <param name="necessaryLights">Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document (required).</param>
/// <param name="checkAuthenticity">Set of authentication options provided for this type of document (combination of Authenticity enum) (required).</param>
/// <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>
Expand All @@ -60,36 +60,26 @@ protected ChosenDocumentType() { }
/// <param name="rotationAngle">rotationAngle.</param>
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))
{
// to ensure "documentName" is required (not null)
if (documentName == null)
{
throw new ArgumentNullException("documentName is a required property for ChosenDocumentType and cannot be null");
}
this.DocumentName = documentName;
this.ID = iD;
this.P = p;
this.Rotated180 = rotated180;
this.RFIDPresence = rFIDPresence;
// to ensure "fDSIDList" is required (not null)
if (fDSIDList == null)
{
throw new ArgumentNullException("fDSIDList is a required property for ChosenDocumentType and cannot be null");
}
this.FDSIDList = fDSIDList;
this.NecessaryLights = necessaryLights;
this.CheckAuthenticity = checkAuthenticity;
this.UVExp = uVExp;
this.AuthenticityNecessaryLights = authenticityNecessaryLights;
this.OVIExp = oVIExp;
this.DocumentName = documentName;
this.FDSIDList = fDSIDList;
this.RotationAngle = rotationAngle;
}

/// <summary>
/// Document name
/// </summary>
/// <value>Document name</value>
[DataMember(Name = "DocumentName", IsRequired = true, EmitDefaultValue = true)]
public string DocumentName { get; set; }
[DataMember(Name = "DocumentName", EmitDefaultValue = false)]
public string? DocumentName { get; set; }

/// <summary>
/// Unique document type template identifier (Regula&#39;s internal numeric code)
Expand Down Expand Up @@ -118,8 +108,8 @@ protected ChosenDocumentType() { }
/// <summary>
/// Gets or Sets FDSIDList
/// </summary>
[DataMember(Name = "FDSIDList", IsRequired = true, EmitDefaultValue = true)]
public FDSIDList FDSIDList { get; set; }
[DataMember(Name = "FDSIDList", EmitDefaultValue = false)]
public FDSIDList? FDSIDList { get; set; }

/// <summary>
/// Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected EncryptedRCLItem() { }
/// </summary>
/// <value>Base64 encoded data</value>
/*
<example>[B@4b3f0960</example>
<example>[B@2d970d48</example>
*/
[DataMember(Name = "EncryptedRCL", IsRequired = true, EmitDefaultValue = true)]
public byte[] EncryptedRCL { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected EncryptedRCLResult() { }
/// </summary>
/// <value>Base64 encoded data</value>
/*
<example>[B@4b3f0960</example>
<example>[B@2d970d48</example>
*/
[DataMember(Name = "EncryptedRCL", IsRequired = true, EmitDefaultValue = true)]
public byte[] EncryptedRCL { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Regula.DocumentReader.WebClient/Model/LicenseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected LicenseItem() { }
/// </summary>
/// <value>Base64 encoded data</value>
/*
<example>[B@5259b0e4</example>
<example>[B@2065118c</example>
*/
[DataMember(Name = "License", IsRequired = true, EmitDefaultValue = true)]
public byte[] License { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected LicenseResult() { }
/// </summary>
/// <value>Base64 encoded data</value>
/*
<example>[B@5259b0e4</example>
<example>[B@2065118c</example>
*/
[DataMember(Name = "License", IsRequired = true, EmitDefaultValue = true)]
public byte[] License { get; set; }
Expand Down
26 changes: 8 additions & 18 deletions src/Regula.DocumentReader.WebClient/Model/OneCandidate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ protected OneCandidate() { }
/// <summary>
/// Initializes a new instance of the <see cref="OneCandidate" /> class.
/// </summary>
/// <param name="documentName">Document name (required).</param>
/// <param name="documentName">Document name.</param>
/// <param name="iD">Unique document type template identifier (Regula&#39;s internal numeric code) (required).</param>
/// <param name="p">A measure of the likelihood of correct recognition in the analysis of this type of document (required).</param>
/// <param name="rotated180">true if the document of the given type is rotated by 180 degrees (required).</param>
/// <param name="rFIDPresence">rFIDPresence (required).</param>
/// <param name="fDSIDList">fDSIDList (required).</param>
/// <param name="fDSIDList">fDSIDList.</param>
/// <param name="necessaryLights">Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document (required).</param>
/// <param name="checkAuthenticity">Set of authentication options provided for this type of document (combination of Authenticity enum) (required).</param>
/// <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>
Expand All @@ -60,36 +60,26 @@ protected OneCandidate() { }
/// <param name="rotationAngle">rotationAngle.</param>
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))
{
// to ensure "documentName" is required (not null)
if (documentName == null)
{
throw new ArgumentNullException("documentName is a required property for OneCandidate and cannot be null");
}
this.DocumentName = documentName;
this.ID = iD;
this.P = p;
this.Rotated180 = rotated180;
this.RFIDPresence = rFIDPresence;
// to ensure "fDSIDList" is required (not null)
if (fDSIDList == null)
{
throw new ArgumentNullException("fDSIDList is a required property for OneCandidate and cannot be null");
}
this.FDSIDList = fDSIDList;
this.NecessaryLights = necessaryLights;
this.CheckAuthenticity = checkAuthenticity;
this.UVExp = uVExp;
this.AuthenticityNecessaryLights = authenticityNecessaryLights;
this.OVIExp = oVIExp;
this.DocumentName = documentName;
this.FDSIDList = fDSIDList;
this.RotationAngle = rotationAngle;
}

/// <summary>
/// Document name
/// </summary>
/// <value>Document name</value>
[DataMember(Name = "DocumentName", IsRequired = true, EmitDefaultValue = true)]
public string DocumentName { get; set; }
[DataMember(Name = "DocumentName", EmitDefaultValue = false)]
public string? DocumentName { get; set; }

/// <summary>
/// Unique document type template identifier (Regula&#39;s internal numeric code)
Expand Down Expand Up @@ -118,8 +108,8 @@ protected OneCandidate() { }
/// <summary>
/// Gets or Sets FDSIDList
/// </summary>
[DataMember(Name = "FDSIDList", IsRequired = true, EmitDefaultValue = true)]
public FDSIDList FDSIDList { get; set; }
[DataMember(Name = "FDSIDList", EmitDefaultValue = false)]
public FDSIDList? FDSIDList { get; set; }

/// <summary>
/// Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document
Expand Down
12 changes: 11 additions & 1 deletion src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ protected ProcessParams() { }
/// <param name="doBarcodes">Set the types of barcodes to process..</param>
/// <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>
/// <param name="generateAlpha2Codes">Set to generate Alpha-2 codes for nationality and issuing state fields..</param>
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))
/// <param name="pdfPagesLimit">Limits the number of pages to be processed from a PDF file..</param>
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))
{
this.Scenario = scenario;
this.GenerateDTCVC = generateDTCVC;
Expand Down Expand Up @@ -208,6 +209,7 @@ protected ProcessParams() { }
this.DoBarcodes = doBarcodes;
this.StrictDLCategoryExpiry = strictDLCategoryExpiry;
this.GenerateAlpha2Codes = generateAlpha2Codes;
this.PdfPagesLimit = pdfPagesLimit;
}

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

/// <summary>
/// Limits the number of pages to be processed from a PDF file.
/// </summary>
/// <value>Limits the number of pages to be processed from a PDF file.</value>
[DataMember(Name = "pdfPagesLimit", EmitDefaultValue = false)]
public int? PdfPagesLimit { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand Down Expand Up @@ -667,6 +676,7 @@ public override string ToString()
sb.Append(" DoBarcodes: ").Append(DoBarcodes).Append("\n");
sb.Append(" StrictDLCategoryExpiry: ").Append(StrictDLCategoryExpiry).Append("\n");
sb.Append(" GenerateAlpha2Codes: ").Append(GenerateAlpha2Codes).Append("\n");
sb.Append(" PdfPagesLimit: ").Append(PdfPagesLimit).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand Down
Loading
Loading