From 9d95c624d5c0b38284033f4f80c3377848d631ef Mon Sep 17 00:00:00 2001 From: Sviataslau Dauhuchyts Date: Wed, 21 Aug 2024 16:56:18 +0300 Subject: [PATCH 01/12] Add SAST scan --- .github/workflows/sast.yaml | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/sast.yaml diff --git a/.github/workflows/sast.yaml b/.github/workflows/sast.yaml new file mode 100644 index 0000000..1e29f13 --- /dev/null +++ b/.github/workflows/sast.yaml @@ -0,0 +1,58 @@ +name: Semgrep SAST + +on: + pull_request: + branches: + - develop + - staging + - production + - stable + - main + - master + +env: + # Fail workflow or not if vulnerabilities found + FAIL_ON_VULNERABILITIES: true + # List of paths (space separated) to ignore + # Supports PATTERNS + # EXCLUDE_PATHS: 'foo bar/baz file.txt dir/*.yml' + EXCLUDE_PATHS: '' + # List of rules (space separated) to ignore + # EXCLUDE_RULES: 'generic.secrets.security.detected-aws-account-id.detected-aws-account-id' + # See https://github.com/semgrep/semgrep-rules for rules registry + EXCLUDE_RULES: '' + +jobs: + semgrep: + name: semgrep-oss/scan + runs-on: ubuntu-latest + container: + image: semgrep/semgrep + steps: + - uses: actions/checkout@v4 + - name: Scan + shell: bash + run: | + EXCLUDED_PATHS=() + if [[ ! -z $EXCLUDE_PATHS ]]; then + for path in $EXCLUDE_PATHS; do + EXCLUDED_PATHS+=("--exclude $path") + done + fi + + EXCLUDED_RULES=() + if [[ ! -z $EXCLUDE_RULES ]]; then + for rule in $EXCLUDE_RULES; do + EXCLUDED_RULES+=("--exclude-rule $rule") + done + fi + + if [[ $FAIL_ON_VULNERABILITIES == "true" ]]; then + semgrep scan --config auto ${EXCLUDED_PATHS[@]} ${EXCLUDED_RULES[@]} --error --verbose + elif [[ $FAIL_ON_VULNERABILITIES == "false" ]]; then + semgrep scan --config auto ${EXCLUDED_PATHS[@]} ${EXCLUDED_RULES[@]} --error --verbose || true + else + echo "Bad FAIL_ON_VULNERABILITIES env var value" + exit 1 + fi + From 02408bb4a8a1a6cf69b81932394f9ea3bf066262 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 3 Sep 2024 13:42:24 +0300 Subject: [PATCH 02/12] update smoke test run --- .github/workflows/run-smoke-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-smoke-test.yml b/.github/workflows/run-smoke-test.yml index cac9717..b60aa56 100755 --- a/.github/workflows/run-smoke-test.yml +++ b/.github/workflows/run-smoke-test.yml @@ -3,7 +3,9 @@ name: run smoke test on: pull_request: branches: + - develop - master + - stable jobs: run_smoke_test: From 7871642b7a02734171b4fa1c2bd7eafec6461832 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 2 Sep 2024 10:02:33 +0000 Subject: [PATCH 03/12] update-clients --- .../Model/GetTransactionsByTagResponse.cs | 159 ++++++++++++++++++ .../Model/ImageQA.cs | 19 +-- .../Model/ProcessParams.cs | 19 ++- .../Model/ProcessRequest.cs | 70 ++++++-- .../Model/TransactionProcessRequest.cs | 105 +++++++++++- 5 files changed, 333 insertions(+), 39 deletions(-) create mode 100644 src/Regula.DocumentReader.WebClient/Model/GetTransactionsByTagResponse.cs diff --git a/src/Regula.DocumentReader.WebClient/Model/GetTransactionsByTagResponse.cs b/src/Regula.DocumentReader.WebClient/Model/GetTransactionsByTagResponse.cs new file mode 100644 index 0000000..9bc7c88 --- /dev/null +++ b/src/Regula.DocumentReader.WebClient/Model/GetTransactionsByTagResponse.cs @@ -0,0 +1,159 @@ +/* + * Regula Document Reader Web API + * + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 7.2.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; + +namespace Regula.DocumentReader.WebClient.Model +{ + /// + /// GetTransactionsByTagResponse + /// + [DataContract] + public partial class GetTransactionsByTagResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Transaction id. + /// Transaction status. + /// Last time updated. + public GetTransactionsByTagResponse(int id = default(int), int state = default(int), DateTime updatedAt = default(DateTime)) + { + this.Id = id; + this.State = state; + this.UpdatedAt = updatedAt; + } + + /// + /// Transaction id + /// + /// Transaction id + [DataMember(Name="id", EmitDefaultValue=false)] + public int Id { get; set; } + + /// + /// Transaction status + /// + /// Transaction status + [DataMember(Name="state", EmitDefaultValue=false)] + public int State { get; set; } + + /// + /// Last time updated + /// + /// Last time updated + [DataMember(Name="updatedAt", EmitDefaultValue=false)] + public DateTime UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class GetTransactionsByTagResponse {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTransactionsByTagResponse); + } + + /// + /// Returns true if GetTransactionsByTagResponse instances are equal + /// + /// Instance of GetTransactionsByTagResponse to be compared + /// Boolean + public bool Equals(GetTransactionsByTagResponse input) + { + if (input == null) + return false; + + return + ( + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) + ) && + ( + this.State == input.State || + (this.State != null && + this.State.Equals(input.State)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Id != null) + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.State != null) + hashCode = hashCode * 59 + this.State.GetHashCode(); + if (this.UpdatedAt != null) + hashCode = hashCode * 59 + this.UpdatedAt.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Regula.DocumentReader.WebClient/Model/ImageQA.cs b/src/Regula.DocumentReader.WebClient/Model/ImageQA.cs index d301358..1179d12 100644 --- a/src/Regula.DocumentReader.WebClient/Model/ImageQA.cs +++ b/src/Regula.DocumentReader.WebClient/Model/ImageQA.cs @@ -39,9 +39,8 @@ public partial class ImageQA : IEquatable, IValidatableObject /// This option enables focus check while performing image quality validation.. /// This option enables glares check while performing image quality validation.. /// This option enables colorness check while performing image quality validation.. - /// This option enables screen capture (moire patterns) check while performing image quality validation.. /// This parameter specifies the necessary margin. Default 0.. - public ImageQA(double brightnessThreshold = default(double), int dpiThreshold = default(int), int angleThreshold = default(int), bool focusCheck = default(bool), bool glaresCheck = default(bool), bool colornessCheck = default(bool), bool moireCheck = default(bool), int documentPositionIndent = default(int)) + public ImageQA(double brightnessThreshold = default(double), int dpiThreshold = default(int), int angleThreshold = default(int), bool focusCheck = default(bool), bool glaresCheck = default(bool), bool colornessCheck = default(bool), int documentPositionIndent = default(int)) { this.BrightnessThreshold = brightnessThreshold; this.DpiThreshold = dpiThreshold; @@ -49,7 +48,6 @@ public partial class ImageQA : IEquatable, IValidatableObject this.FocusCheck = focusCheck; this.GlaresCheck = glaresCheck; this.ColornessCheck = colornessCheck; - this.MoireCheck = moireCheck; this.DocumentPositionIndent = documentPositionIndent; } @@ -95,13 +93,6 @@ public partial class ImageQA : IEquatable, IValidatableObject [DataMember(Name="colornessCheck", EmitDefaultValue=false)] public bool ColornessCheck { get; set; } - /// - /// This option enables screen capture (moire patterns) check while performing image quality validation. - /// - /// This option enables screen capture (moire patterns) check while performing image quality validation. - [DataMember(Name="moireCheck", EmitDefaultValue=false)] - public bool MoireCheck { get; set; } - /// /// This parameter specifies the necessary margin. Default 0. /// @@ -123,7 +114,6 @@ public override string ToString() sb.Append(" FocusCheck: ").Append(FocusCheck).Append("\n"); sb.Append(" GlaresCheck: ").Append(GlaresCheck).Append("\n"); sb.Append(" ColornessCheck: ").Append(ColornessCheck).Append("\n"); - sb.Append(" MoireCheck: ").Append(MoireCheck).Append("\n"); sb.Append(" DocumentPositionIndent: ").Append(DocumentPositionIndent).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -189,11 +179,6 @@ public bool Equals(ImageQA input) (this.ColornessCheck != null && this.ColornessCheck.Equals(input.ColornessCheck)) ) && - ( - this.MoireCheck == input.MoireCheck || - (this.MoireCheck != null && - this.MoireCheck.Equals(input.MoireCheck)) - ) && ( this.DocumentPositionIndent == input.DocumentPositionIndent || (this.DocumentPositionIndent != null && @@ -222,8 +207,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.GlaresCheck.GetHashCode(); if (this.ColornessCheck != null) hashCode = hashCode * 59 + this.ColornessCheck.GetHashCode(); - if (this.MoireCheck != null) - hashCode = hashCode * 59 + this.MoireCheck.GetHashCode(); if (this.DocumentPositionIndent != null) hashCode = hashCode * 59 + this.DocumentPositionIndent.GetHashCode(); return hashCode; diff --git a/src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs b/src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs index bfd113d..69a2684 100644 --- a/src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs +++ b/src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs @@ -91,7 +91,8 @@ protected ProcessParams() { } /// This parameter is used to enable authenticity checks. /// authParams. /// mrzDetectMode. - public ProcessParams(List lcidFilter = default(List), List lcidIgnoreFilter = default(List), bool oneShotIdentification = default(bool), bool useFaceApi = default(bool), FaceApi faceApi = default(FaceApi), bool doDetectCan = default(bool), int imageOutputMaxHeight = default(int), int imageOutputMaxWidth = default(int), string scenario = default(string), List resultTypeOutput = default(List), bool doublePageSpread = default(bool), bool generateDoublePageSpreadImage = default(bool), List fieldTypesFilter = default(List), string dateFormat = default(string), int measureSystem = default(int), int imageDpiOutMax = default(int), bool alreadyCropped = default(bool), Dictionary customParams = default(Dictionary), List config = default(List), bool log = default(bool), string logLevel = default(string), 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 respectImageQuality = default(bool), int forceDocFormat = default(int), 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 mrzFormatsFilter = default(List), bool forceReadMrzBeforeLocate = default(bool), bool parseBarcodes = default(bool), int convertCase = default(int), bool splitNames = default(bool), bool disablePerforationOCR = default(bool), List documentGroupFilter = default(List), long processAuth = default(long), int deviceId = default(int), int deviceType = default(int), string deviceTypeHex = default(string), bool ignoreDeviceIdFromImage = default(bool), List documentIdList = default(List), ProcessParamsRfid rfid = default(ProcessParamsRfid), bool checkAuth = default(bool), AuthParams authParams = default(AuthParams), MrzDetectModeEnum mrzDetectMode = default(MrzDetectModeEnum)) + /// This parameter is used to generate numeric representation for issuing state and nationality codes. + public ProcessParams(List lcidFilter = default(List), List lcidIgnoreFilter = default(List), bool oneShotIdentification = default(bool), bool useFaceApi = default(bool), FaceApi faceApi = default(FaceApi), bool doDetectCan = default(bool), int imageOutputMaxHeight = default(int), int imageOutputMaxWidth = default(int), string scenario = default(string), List resultTypeOutput = default(List), bool doublePageSpread = default(bool), bool generateDoublePageSpreadImage = default(bool), List fieldTypesFilter = default(List), string dateFormat = default(string), int measureSystem = default(int), int imageDpiOutMax = default(int), bool alreadyCropped = default(bool), Dictionary customParams = default(Dictionary), List config = default(List), bool log = default(bool), string logLevel = default(string), 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 respectImageQuality = default(bool), int forceDocFormat = default(int), 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 mrzFormatsFilter = default(List), bool forceReadMrzBeforeLocate = default(bool), bool parseBarcodes = default(bool), int convertCase = default(int), bool splitNames = default(bool), bool disablePerforationOCR = default(bool), List documentGroupFilter = default(List), long processAuth = default(long), int deviceId = default(int), int deviceType = default(int), string deviceTypeHex = default(string), bool ignoreDeviceIdFromImage = default(bool), List documentIdList = default(List), ProcessParamsRfid rfid = default(ProcessParamsRfid), bool checkAuth = default(bool), AuthParams authParams = default(AuthParams), MrzDetectModeEnum mrzDetectMode = default(MrzDetectModeEnum), bool generateNumericCodes = default(bool)) { // to ensure "scenario" is required (not null) if (scenario == null) @@ -155,6 +156,7 @@ protected ProcessParams() { } this.CheckAuth = checkAuth; this.AuthParams = authParams; this.MrzDetectMode = mrzDetectMode; + this.GenerateNumericCodes = generateNumericCodes; } /// @@ -518,6 +520,13 @@ protected ProcessParams() { } [DataMember(Name="mrzDetectMode", EmitDefaultValue=false)] public MrzDetectModeEnum MrzDetectMode { get; set; } + /// + /// This parameter is used to generate numeric representation for issuing state and nationality codes + /// + /// This parameter is used to generate numeric representation for issuing state and nationality codes + [DataMember(Name="generateNumericCodes", EmitDefaultValue=false)] + public bool GenerateNumericCodes { get; set; } + /// /// Returns the string presentation of the object /// @@ -579,6 +588,7 @@ public override string ToString() sb.Append(" CheckAuth: ").Append(CheckAuth).Append("\n"); sb.Append(" AuthParams: ").Append(AuthParams).Append("\n"); sb.Append(" MrzDetectMode: ").Append(MrzDetectMode).Append("\n"); + sb.Append(" GenerateNumericCodes: ").Append(GenerateNumericCodes).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -886,6 +896,11 @@ public bool Equals(ProcessParams input) this.MrzDetectMode == input.MrzDetectMode || (this.MrzDetectMode != null && this.MrzDetectMode.Equals(input.MrzDetectMode)) + ) && + ( + this.GenerateNumericCodes == input.GenerateNumericCodes || + (this.GenerateNumericCodes != null && + this.GenerateNumericCodes.Equals(input.GenerateNumericCodes)) ); } @@ -1004,6 +1019,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.AuthParams.GetHashCode(); if (this.MrzDetectMode != null) hashCode = hashCode * 59 + this.MrzDetectMode.GetHashCode(); + if (this.GenerateNumericCodes != null) + hashCode = hashCode * 59 + this.GenerateNumericCodes.GetHashCode(); return hashCode; } } diff --git a/src/Regula.DocumentReader.WebClient/Model/ProcessRequest.cs b/src/Regula.DocumentReader.WebClient/Model/ProcessRequest.cs index 6e90866..5fea77f 100644 --- a/src/Regula.DocumentReader.WebClient/Model/ProcessRequest.cs +++ b/src/Regula.DocumentReader.WebClient/Model/ProcessRequest.cs @@ -38,15 +38,17 @@ protected ProcessRequest() { } /// /// Initializes a new instance of the class. /// - /// session id. /// processParam (required). /// list. + /// Session ID. + /// Customer name. + /// Environment type. /// Live portrait photo. /// Portrait photo from an external source. /// containerList. /// systemInfo. /// Free-form object to be included in response. Must be object, not list or simple value. Do not affect document processing. Use it freely to pass your app params. Stored in process logs.. - public ProcessRequest(string tag = default(string), ProcessParams processParam = default(ProcessParams), List list = default(List), string livePortrait = default(string), string extPortrait = default(string), ContainerList containerList = default(ContainerList), ProcessSystemInfo systemInfo = default(ProcessSystemInfo), Dictionary passBackObject = default(Dictionary)) + public ProcessRequest(ProcessParams processParam = default(ProcessParams), List list = default(List), string tag = default(string), string tenant = default(string), string env = default(string), string livePortrait = default(string), string extPortrait = default(string), ContainerList containerList = default(ContainerList), ProcessSystemInfo systemInfo = default(ProcessSystemInfo), Dictionary passBackObject = default(Dictionary)) { // to ensure "processParam" is required (not null) if (processParam == null) @@ -58,8 +60,10 @@ protected ProcessRequest() { } this.ProcessParam = processParam; } - this.Tag = tag; this.List = list; + this.Tag = tag; + this.Tenant = tenant; + this.Env = env; this.LivePortrait = livePortrait; this.ExtPortrait = extPortrait; this.ContainerList = containerList; @@ -67,13 +71,6 @@ protected ProcessRequest() { } this.PassBackObject = passBackObject; } - /// - /// session id - /// - /// session id - [DataMember(Name="tag", EmitDefaultValue=false)] - public string Tag { get; set; } - /// /// Gets or Sets ProcessParam /// @@ -86,6 +83,27 @@ protected ProcessRequest() { } [DataMember(Name="List", EmitDefaultValue=false)] public List List { get; set; } + /// + /// Session ID + /// + /// Session ID + [DataMember(Name="tag", EmitDefaultValue=false)] + public string Tag { get; set; } + + /// + /// Customer name + /// + /// Customer name + [DataMember(Name="tenant", EmitDefaultValue=false)] + public string Tenant { get; set; } + + /// + /// Environment type + /// + /// Environment type + [DataMember(Name="env", EmitDefaultValue=false)] + public string Env { get; set; } + /// /// Live portrait photo /// @@ -127,9 +145,11 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ProcessRequest {\n"); - sb.Append(" Tag: ").Append(Tag).Append("\n"); sb.Append(" ProcessParam: ").Append(ProcessParam).Append("\n"); sb.Append(" List: ").Append(List).Append("\n"); + sb.Append(" Tag: ").Append(Tag).Append("\n"); + sb.Append(" Tenant: ").Append(Tenant).Append("\n"); + sb.Append(" Env: ").Append(Env).Append("\n"); sb.Append(" LivePortrait: ").Append(LivePortrait).Append("\n"); sb.Append(" ExtPortrait: ").Append(ExtPortrait).Append("\n"); sb.Append(" ContainerList: ").Append(ContainerList).Append("\n"); @@ -169,11 +189,6 @@ public bool Equals(ProcessRequest input) return false; return - ( - this.Tag == input.Tag || - (this.Tag != null && - this.Tag.Equals(input.Tag)) - ) && ( this.ProcessParam == input.ProcessParam || (this.ProcessParam != null && @@ -185,6 +200,21 @@ public bool Equals(ProcessRequest input) input.List != null && this.List.SequenceEqual(input.List) ) && + ( + this.Tag == input.Tag || + (this.Tag != null && + this.Tag.Equals(input.Tag)) + ) && + ( + this.Tenant == input.Tenant || + (this.Tenant != null && + this.Tenant.Equals(input.Tenant)) + ) && + ( + this.Env == input.Env || + (this.Env != null && + this.Env.Equals(input.Env)) + ) && ( this.LivePortrait == input.LivePortrait || (this.LivePortrait != null && @@ -222,12 +252,16 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.Tag != null) - hashCode = hashCode * 59 + this.Tag.GetHashCode(); if (this.ProcessParam != null) hashCode = hashCode * 59 + this.ProcessParam.GetHashCode(); if (this.List != null) hashCode = hashCode * 59 + this.List.GetHashCode(); + if (this.Tag != null) + hashCode = hashCode * 59 + this.Tag.GetHashCode(); + if (this.Tenant != null) + hashCode = hashCode * 59 + this.Tenant.GetHashCode(); + if (this.Env != null) + hashCode = hashCode * 59 + this.Env.GetHashCode(); if (this.LivePortrait != null) hashCode = hashCode * 59 + this.LivePortrait.GetHashCode(); if (this.ExtPortrait != null) diff --git a/src/Regula.DocumentReader.WebClient/Model/TransactionProcessRequest.cs b/src/Regula.DocumentReader.WebClient/Model/TransactionProcessRequest.cs index c411828..01234a4 100644 --- a/src/Regula.DocumentReader.WebClient/Model/TransactionProcessRequest.cs +++ b/src/Regula.DocumentReader.WebClient/Model/TransactionProcessRequest.cs @@ -39,7 +39,13 @@ protected TransactionProcessRequest() { } /// Initializes a new instance of the class. /// /// processParam (required). - public TransactionProcessRequest(TransactionScenarioRequest processParam = default(TransactionScenarioRequest)) + /// list. + /// Live portrait photo. + /// Portrait photo from an external source. + /// containerList. + /// systemInfo. + /// Free-form object to be included in response. Must be object, not list or simple value. Do not affect document processing. Use it freely to pass your app params. Stored in process logs.. + public TransactionProcessRequest(ProcessParams processParam = default(ProcessParams), List list = default(List), string livePortrait = default(string), string extPortrait = default(string), ContainerList containerList = default(ContainerList), ProcessSystemInfo systemInfo = default(ProcessSystemInfo), Dictionary passBackObject = default(Dictionary)) { // to ensure "processParam" is required (not null) if (processParam == null) @@ -51,13 +57,58 @@ protected TransactionProcessRequest() { } this.ProcessParam = processParam; } + this.List = list; + this.LivePortrait = livePortrait; + this.ExtPortrait = extPortrait; + this.ContainerList = containerList; + this.SystemInfo = systemInfo; + this.PassBackObject = passBackObject; } /// /// Gets or Sets ProcessParam /// [DataMember(Name="processParam", EmitDefaultValue=true)] - public TransactionScenarioRequest ProcessParam { get; set; } + public ProcessParams ProcessParam { get; set; } + + /// + /// Gets or Sets List + /// + [DataMember(Name="List", EmitDefaultValue=false)] + public List List { get; set; } + + /// + /// Live portrait photo + /// + /// Live portrait photo + [DataMember(Name="livePortrait", EmitDefaultValue=false)] + public string LivePortrait { get; set; } + + /// + /// Portrait photo from an external source + /// + /// Portrait photo from an external source + [DataMember(Name="extPortrait", EmitDefaultValue=false)] + public string ExtPortrait { get; set; } + + /// + /// Gets or Sets ContainerList + /// + [DataMember(Name="ContainerList", EmitDefaultValue=false)] + public ContainerList ContainerList { get; set; } + + /// + /// Gets or Sets SystemInfo + /// + [DataMember(Name="systemInfo", EmitDefaultValue=false)] + public ProcessSystemInfo SystemInfo { get; set; } + + /// + /// Free-form object to be included in response. Must be object, not list or simple value. Do not affect document processing. Use it freely to pass your app params. Stored in process logs. + /// + /// Free-form object to be included in response. Must be object, not list or simple value. Do not affect document processing. Use it freely to pass your app params. Stored in process logs. + [DataMember(Name="passBackObject", EmitDefaultValue=false)] + public Dictionary PassBackObject { get; set; } /// /// Returns the string presentation of the object @@ -68,6 +119,12 @@ public override string ToString() var sb = new StringBuilder(); sb.Append("class TransactionProcessRequest {\n"); sb.Append(" ProcessParam: ").Append(ProcessParam).Append("\n"); + sb.Append(" List: ").Append(List).Append("\n"); + sb.Append(" LivePortrait: ").Append(LivePortrait).Append("\n"); + sb.Append(" ExtPortrait: ").Append(ExtPortrait).Append("\n"); + sb.Append(" ContainerList: ").Append(ContainerList).Append("\n"); + sb.Append(" SystemInfo: ").Append(SystemInfo).Append("\n"); + sb.Append(" PassBackObject: ").Append(PassBackObject).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -106,6 +163,38 @@ public bool Equals(TransactionProcessRequest input) this.ProcessParam == input.ProcessParam || (this.ProcessParam != null && this.ProcessParam.Equals(input.ProcessParam)) + ) && + ( + this.List == input.List || + this.List != null && + input.List != null && + this.List.SequenceEqual(input.List) + ) && + ( + this.LivePortrait == input.LivePortrait || + (this.LivePortrait != null && + this.LivePortrait.Equals(input.LivePortrait)) + ) && + ( + this.ExtPortrait == input.ExtPortrait || + (this.ExtPortrait != null && + this.ExtPortrait.Equals(input.ExtPortrait)) + ) && + ( + this.ContainerList == input.ContainerList || + (this.ContainerList != null && + this.ContainerList.Equals(input.ContainerList)) + ) && + ( + this.SystemInfo == input.SystemInfo || + (this.SystemInfo != null && + this.SystemInfo.Equals(input.SystemInfo)) + ) && + ( + this.PassBackObject == input.PassBackObject || + this.PassBackObject != null && + input.PassBackObject != null && + this.PassBackObject.SequenceEqual(input.PassBackObject) ); } @@ -120,6 +209,18 @@ public override int GetHashCode() int hashCode = 41; if (this.ProcessParam != null) hashCode = hashCode * 59 + this.ProcessParam.GetHashCode(); + if (this.List != null) + hashCode = hashCode * 59 + this.List.GetHashCode(); + if (this.LivePortrait != null) + hashCode = hashCode * 59 + this.LivePortrait.GetHashCode(); + if (this.ExtPortrait != null) + hashCode = hashCode * 59 + this.ExtPortrait.GetHashCode(); + if (this.ContainerList != null) + hashCode = hashCode * 59 + this.ContainerList.GetHashCode(); + if (this.SystemInfo != null) + hashCode = hashCode * 59 + this.SystemInfo.GetHashCode(); + if (this.PassBackObject != null) + hashCode = hashCode * 59 + this.PassBackObject.GetHashCode(); return hashCode; } } From f648d1f0b76ae17631d43be1adb7308b3e0547fe Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 3 Sep 2024 16:08:18 +0300 Subject: [PATCH 04/12] Fix ci --- .../Model/Ext/RecognitionRequest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionRequest.cs b/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionRequest.cs index 7a3f23a..3e2c8e2 100644 --- a/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionRequest.cs +++ b/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionRequest.cs @@ -5,17 +5,17 @@ namespace Regula.DocumentReader.WebClient.Model.Ext public class RecognitionRequest : ProcessRequest { public RecognitionRequest(ProcessParams param, ProcessRequestImage image, string tag = null) - : base(tag, param, new List { image }) + : base(param, new List { image }, tag) { } public RecognitionRequest(ProcessParams param, byte[] image, string tag = null) - : base(tag, param, new List { new ProcessRequestImage(image) }) + : base( param, new List { new ProcessRequestImage(image) }, tag) { } public RecognitionRequest(ProcessParams param, List images, string tag = null) - : base(tag, param, images) + : base(param, images, tag) { } From 160ba0522152fb07c55b21ab5dfc11ef49b41bbc Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 3 Sep 2024 16:19:54 +0300 Subject: [PATCH 05/12] SP-17901: Update RestSharp package --- .../Regula.DocumentReader.WebClient.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Regula.DocumentReader.WebClient/Regula.DocumentReader.WebClient.csproj b/src/Regula.DocumentReader.WebClient/Regula.DocumentReader.WebClient.csproj index 4c9029b..e465315 100644 --- a/src/Regula.DocumentReader.WebClient/Regula.DocumentReader.WebClient.csproj +++ b/src/Regula.DocumentReader.WebClient/Regula.DocumentReader.WebClient.csproj @@ -16,7 +16,7 @@ - + From 408f3eb5fdcc55b05aed45cbff287726d3b96163 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 4 Sep 2024 10:22:28 +0000 Subject: [PATCH 06/12] update-clients --- src/Regula.DocumentReader.WebClient/Model/FiberResult.cs | 2 +- .../Model/OCRSecurityTextResult.cs | 2 +- src/Regula.DocumentReader.WebClient/Model/PhotoIdentResult.cs | 2 +- .../Model/SecurityFeatureResult.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Regula.DocumentReader.WebClient/Model/FiberResult.cs b/src/Regula.DocumentReader.WebClient/Model/FiberResult.cs index 1573b66..28e5056 100644 --- a/src/Regula.DocumentReader.WebClient/Model/FiberResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/FiberResult.cs @@ -47,7 +47,7 @@ protected FiberResult() { } /// Fibers length value for located areas (in pixels). /// Fibers value for areas (in pixels). /// Fibers color value. - public FiberResult(int rectCount = default(int), int expectedCount = default(int), int lightValue = default(int), int lightDisp = default(int), List rectArray = default(List), List width = default(List), List length = default(List), List area = default(List), List colorValues = default(List), int type = 0, int elementResult = default(int), int elementDiagnose = default(int)) : base(type, elementResult, elementDiagnose) + public FiberResult(int rectCount = default(int), int expectedCount = default(int), int lightValue = default(int), int lightDisp = default(int), List rectArray = default(List), List width = default(List), List length = default(List), List area = default(List), List colorValues = default(List), int type = 0, int elementResult = default(int), int elementDiagnose = default(int), int percentValue = default(int)) : base(type, elementResult, elementDiagnose, percentValue) { this.RectCount = rectCount; this.ExpectedCount = expectedCount; diff --git a/src/Regula.DocumentReader.WebClient/Model/OCRSecurityTextResult.cs b/src/Regula.DocumentReader.WebClient/Model/OCRSecurityTextResult.cs index 8a64067..1119507 100644 --- a/src/Regula.DocumentReader.WebClient/Model/OCRSecurityTextResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/OCRSecurityTextResult.cs @@ -48,7 +48,7 @@ protected OCRSecurityTextResult() { } /// etalonResultOCR. /// reserved1. /// reserved2. - public OCRSecurityTextResult(int criticalFlag = default(int), int lightType = default(int), RectangleCoordinates fieldRect = default(RectangleCoordinates), int etalonResultType = default(int), int etalonFieldType = default(int), int etalonLightType = default(int), string securityTextResultOCR = default(string), string etalonResultOCR = default(string), int reserved1 = default(int), int reserved2 = default(int), int type = 0, int elementResult = default(int), int elementDiagnose = default(int)) : base(type, elementResult, elementDiagnose) + public OCRSecurityTextResult(int criticalFlag = default(int), int lightType = default(int), RectangleCoordinates fieldRect = default(RectangleCoordinates), int etalonResultType = default(int), int etalonFieldType = default(int), int etalonLightType = default(int), string securityTextResultOCR = default(string), string etalonResultOCR = default(string), int reserved1 = default(int), int reserved2 = default(int), int type = 0, int elementResult = default(int), int elementDiagnose = default(int), int percentValue = default(int)) : base(type, elementResult, elementDiagnose, percentValue) { this.CriticalFlag = criticalFlag; this.LightType = lightType; diff --git a/src/Regula.DocumentReader.WebClient/Model/PhotoIdentResult.cs b/src/Regula.DocumentReader.WebClient/Model/PhotoIdentResult.cs index a602b56..4b3d55e 100644 --- a/src/Regula.DocumentReader.WebClient/Model/PhotoIdentResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/PhotoIdentResult.cs @@ -47,7 +47,7 @@ protected PhotoIdentResult() { } /// step. /// angle. /// reserved3. - public PhotoIdentResult(int lightIndex = default(int), RectangleCoordinates area = default(RectangleCoordinates), ImageData sourceImage = default(ImageData), RawImageContainerList resultImages = default(RawImageContainerList), int fieldTypesCount = default(int), List fieldTypesList = default(List), int step = default(int), int angle = default(int), int reserved3 = default(int), int type = 0, int elementResult = default(int), int elementDiagnose = default(int)) : base(type, elementResult, elementDiagnose) + public PhotoIdentResult(int lightIndex = default(int), RectangleCoordinates area = default(RectangleCoordinates), ImageData sourceImage = default(ImageData), RawImageContainerList resultImages = default(RawImageContainerList), int fieldTypesCount = default(int), List fieldTypesList = default(List), int step = default(int), int angle = default(int), int reserved3 = default(int), int type = 0, int elementResult = default(int), int elementDiagnose = default(int), int percentValue = default(int)) : base(type, elementResult, elementDiagnose, percentValue) { this.LightIndex = lightIndex; this.Area = area; diff --git a/src/Regula.DocumentReader.WebClient/Model/SecurityFeatureResult.cs b/src/Regula.DocumentReader.WebClient/Model/SecurityFeatureResult.cs index 5ce28d0..ffbc6f3 100644 --- a/src/Regula.DocumentReader.WebClient/Model/SecurityFeatureResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/SecurityFeatureResult.cs @@ -44,7 +44,7 @@ protected SecurityFeatureResult() { } /// criticalFlag. /// areaList. /// reserved2. - public SecurityFeatureResult(int elementType = default(int), RectangleCoordinates elementRect = default(RectangleCoordinates), int visibility = default(int), int criticalFlag = default(int), AreaContainer areaList = default(AreaContainer), int reserved2 = default(int), int type = 0, int elementResult = default(int), int elementDiagnose = default(int)) : base(type, elementResult, elementDiagnose) + public SecurityFeatureResult(int elementType = default(int), RectangleCoordinates elementRect = default(RectangleCoordinates), int visibility = default(int), int criticalFlag = default(int), AreaContainer areaList = default(AreaContainer), int reserved2 = default(int), int type = 0, int elementResult = default(int), int elementDiagnose = default(int), int percentValue = default(int)) : base(type, elementResult, elementDiagnose, percentValue) { this.ElementType = elementType; this.ElementRect = elementRect; From 6ccb90183f0c445e3495a8a2c77a1b4243cbc13d Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 4 Sep 2024 14:57:10 +0300 Subject: [PATCH 07/12] Add PercentValue --- .../Model/AuthenticityCheckResultItem.cs | 12 ++++++++++-- .../Model/Ext/RecognitionRequest.cs | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Regula.DocumentReader.WebClient/Model/AuthenticityCheckResultItem.cs b/src/Regula.DocumentReader.WebClient/Model/AuthenticityCheckResultItem.cs index c8e1f98..0cd1e9a 100644 --- a/src/Regula.DocumentReader.WebClient/Model/AuthenticityCheckResultItem.cs +++ b/src/Regula.DocumentReader.WebClient/Model/AuthenticityCheckResultItem.cs @@ -58,7 +58,8 @@ protected AuthenticityCheckResultItem() { } /// Same as authenticity result type, but used for safe parsing of not-described values. See authenticity result type (required) (default to 0). /// elementResult. /// elementDiagnose. - public AuthenticityCheckResultItem(int type = 0, int elementResult = default(int), int elementDiagnose = default(int)) + /// percentValue. + public AuthenticityCheckResultItem(int type = 0, int elementResult = default(int), int elementDiagnose = default(int), int percentValue = 0) { // to ensure "type" is required (not null) if (type == null) @@ -69,7 +70,7 @@ protected AuthenticityCheckResultItem() { } { this.Type = type; } - + this.PercentValue = percentValue; this.ElementResult = elementResult; this.ElementDiagnose = elementDiagnose; } @@ -81,6 +82,13 @@ protected AuthenticityCheckResultItem() { } [DataMember(Name="Type", EmitDefaultValue=true)] public int Type { get; set; } + /// + /// Gets or Sets PercentValue + /// + [DataMember(Name="PercentValue", EmitDefaultValue=false)] + public int PercentValue { get; set; } + + /// /// Gets or Sets ElementResult /// diff --git a/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionRequest.cs b/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionRequest.cs index 3e2c8e2..f24f2b2 100644 --- a/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionRequest.cs +++ b/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionRequest.cs @@ -24,6 +24,11 @@ public RecognitionRequest(ProcessParams param, ContainerList containerList, stri { } + public RecognitionRequest(ProcessParams param, List images, string extPortrait, string tag = null) + : base(param, images, tag, extPortrait:extPortrait) + { + } + public string Json => Newtonsoft.Json.JsonConvert.SerializeObject(this); } } From 9f9cd8b976b1707e7a71887740836305f48015a9 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 5 Sep 2024 11:14:44 +0000 Subject: [PATCH 08/12] update-clients --- .../Model/ListTransactionsByTagResponse.cs | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 src/Regula.DocumentReader.WebClient/Model/ListTransactionsByTagResponse.cs diff --git a/src/Regula.DocumentReader.WebClient/Model/ListTransactionsByTagResponse.cs b/src/Regula.DocumentReader.WebClient/Model/ListTransactionsByTagResponse.cs new file mode 100644 index 0000000..ce5be83 --- /dev/null +++ b/src/Regula.DocumentReader.WebClient/Model/ListTransactionsByTagResponse.cs @@ -0,0 +1,142 @@ +/* + * Regula Document Reader Web API + * + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 7.2.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; + +namespace Regula.DocumentReader.WebClient.Model +{ + /// + /// ListTransactionsByTagResponse + /// + [DataContract] + public partial class ListTransactionsByTagResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// items. + /// metadata. + public ListTransactionsByTagResponse(List items = default(List), Dictionary metadata = default(Dictionary)) + { + this.Items = items; + this.Metadata = metadata; + } + + /// + /// Gets or Sets Items + /// + [DataMember(Name="items", EmitDefaultValue=false)] + public List Items { get; set; } + + /// + /// Gets or Sets Metadata + /// + [DataMember(Name="metadata", EmitDefaultValue=false)] + public Dictionary Metadata { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ListTransactionsByTagResponse {\n"); + sb.Append(" Items: ").Append(Items).Append("\n"); + sb.Append(" Metadata: ").Append(Metadata).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListTransactionsByTagResponse); + } + + /// + /// Returns true if ListTransactionsByTagResponse instances are equal + /// + /// Instance of ListTransactionsByTagResponse to be compared + /// Boolean + public bool Equals(ListTransactionsByTagResponse input) + { + if (input == null) + return false; + + return + ( + this.Items == input.Items || + this.Items != null && + input.Items != null && + this.Items.SequenceEqual(input.Items) + ) && + ( + this.Metadata == input.Metadata || + this.Metadata != null && + input.Metadata != null && + this.Metadata.SequenceEqual(input.Metadata) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Items != null) + hashCode = hashCode * 59 + this.Items.GetHashCode(); + if (this.Metadata != null) + hashCode = hashCode * 59 + this.Metadata.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} From aa1449a4a8698a7eafcba992c2ce194faf85e993 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 11 Sep 2024 09:16:51 +0000 Subject: [PATCH 09/12] update-clients --- .../Model/BinaryDataResult.cs | 142 +++++++++++ .../Model/OriginalGraphicsResult.cs | 142 +++++++++++ .../Model/RawDataResult.cs | 142 +++++++++++ .../Model/TBinaryData.cs | 172 +++++++++++++ .../Model/TOriginalRFIDGraphics.cs | 236 ++++++++++++++++++ 5 files changed, 834 insertions(+) create mode 100644 src/Regula.DocumentReader.WebClient/Model/BinaryDataResult.cs create mode 100644 src/Regula.DocumentReader.WebClient/Model/OriginalGraphicsResult.cs create mode 100644 src/Regula.DocumentReader.WebClient/Model/RawDataResult.cs create mode 100644 src/Regula.DocumentReader.WebClient/Model/TBinaryData.cs create mode 100644 src/Regula.DocumentReader.WebClient/Model/TOriginalRFIDGraphics.cs diff --git a/src/Regula.DocumentReader.WebClient/Model/BinaryDataResult.cs b/src/Regula.DocumentReader.WebClient/Model/BinaryDataResult.cs new file mode 100644 index 0000000..b891483 --- /dev/null +++ b/src/Regula.DocumentReader.WebClient/Model/BinaryDataResult.cs @@ -0,0 +1,142 @@ +/* + * Regula Document Reader Web API + * + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 7.2.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; + +namespace Regula.DocumentReader.WebClient.Model +{ + /// + /// BinaryDataResult + /// + [DataContract] + public partial class BinaryDataResult : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Count of array fields. + /// pArrayFields. + public BinaryDataResult(int nFields = default(int), List pArrayFields = default(List)) + { + this.NFields = nFields; + this.PArrayFields = pArrayFields; + } + + /// + /// Count of array fields + /// + /// Count of array fields + [DataMember(Name="nFields", EmitDefaultValue=false)] + public int NFields { get; set; } + + /// + /// Gets or Sets PArrayFields + /// + [DataMember(Name="pArrayFields", EmitDefaultValue=false)] + public List PArrayFields { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class BinaryDataResult {\n"); + sb.Append(" NFields: ").Append(NFields).Append("\n"); + sb.Append(" PArrayFields: ").Append(PArrayFields).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BinaryDataResult); + } + + /// + /// Returns true if BinaryDataResult instances are equal + /// + /// Instance of BinaryDataResult to be compared + /// Boolean + public bool Equals(BinaryDataResult input) + { + if (input == null) + return false; + + return + ( + this.NFields == input.NFields || + (this.NFields != null && + this.NFields.Equals(input.NFields)) + ) && + ( + this.PArrayFields == input.PArrayFields || + this.PArrayFields != null && + input.PArrayFields != null && + this.PArrayFields.SequenceEqual(input.PArrayFields) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.NFields != null) + hashCode = hashCode * 59 + this.NFields.GetHashCode(); + if (this.PArrayFields != null) + hashCode = hashCode * 59 + this.PArrayFields.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Regula.DocumentReader.WebClient/Model/OriginalGraphicsResult.cs b/src/Regula.DocumentReader.WebClient/Model/OriginalGraphicsResult.cs new file mode 100644 index 0000000..bf0edf6 --- /dev/null +++ b/src/Regula.DocumentReader.WebClient/Model/OriginalGraphicsResult.cs @@ -0,0 +1,142 @@ +/* + * Regula Document Reader Web API + * + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 7.2.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; + +namespace Regula.DocumentReader.WebClient.Model +{ + /// + /// OriginalGraphicsResult + /// + [DataContract] + public partial class OriginalGraphicsResult : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Count of array fields. + /// pArrayFields. + public OriginalGraphicsResult(int nFields = default(int), List pArrayFields = default(List)) + { + this.NFields = nFields; + this.PArrayFields = pArrayFields; + } + + /// + /// Count of array fields + /// + /// Count of array fields + [DataMember(Name="nFields", EmitDefaultValue=false)] + public int NFields { get; set; } + + /// + /// Gets or Sets PArrayFields + /// + [DataMember(Name="pArrayFields", EmitDefaultValue=false)] + public List PArrayFields { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OriginalGraphicsResult {\n"); + sb.Append(" NFields: ").Append(NFields).Append("\n"); + sb.Append(" PArrayFields: ").Append(PArrayFields).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as OriginalGraphicsResult); + } + + /// + /// Returns true if OriginalGraphicsResult instances are equal + /// + /// Instance of OriginalGraphicsResult to be compared + /// Boolean + public bool Equals(OriginalGraphicsResult input) + { + if (input == null) + return false; + + return + ( + this.NFields == input.NFields || + (this.NFields != null && + this.NFields.Equals(input.NFields)) + ) && + ( + this.PArrayFields == input.PArrayFields || + this.PArrayFields != null && + input.PArrayFields != null && + this.PArrayFields.SequenceEqual(input.PArrayFields) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.NFields != null) + hashCode = hashCode * 59 + this.NFields.GetHashCode(); + if (this.PArrayFields != null) + hashCode = hashCode * 59 + this.PArrayFields.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Regula.DocumentReader.WebClient/Model/RawDataResult.cs b/src/Regula.DocumentReader.WebClient/Model/RawDataResult.cs new file mode 100644 index 0000000..09005b0 --- /dev/null +++ b/src/Regula.DocumentReader.WebClient/Model/RawDataResult.cs @@ -0,0 +1,142 @@ +/* + * Regula Document Reader Web API + * + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 7.2.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; + +namespace Regula.DocumentReader.WebClient.Model +{ + /// + /// RawDataResult + /// + [DataContract] + public partial class RawDataResult : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Count of array fields. + /// pArrayFields. + public RawDataResult(int nFields = default(int), List pArrayFields = default(List)) + { + this.NFields = nFields; + this.PArrayFields = pArrayFields; + } + + /// + /// Count of array fields + /// + /// Count of array fields + [DataMember(Name="nFields", EmitDefaultValue=false)] + public int NFields { get; set; } + + /// + /// Gets or Sets PArrayFields + /// + [DataMember(Name="pArrayFields", EmitDefaultValue=false)] + public List PArrayFields { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class RawDataResult {\n"); + sb.Append(" NFields: ").Append(NFields).Append("\n"); + sb.Append(" PArrayFields: ").Append(PArrayFields).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RawDataResult); + } + + /// + /// Returns true if RawDataResult instances are equal + /// + /// Instance of RawDataResult to be compared + /// Boolean + public bool Equals(RawDataResult input) + { + if (input == null) + return false; + + return + ( + this.NFields == input.NFields || + (this.NFields != null && + this.NFields.Equals(input.NFields)) + ) && + ( + this.PArrayFields == input.PArrayFields || + this.PArrayFields != null && + input.PArrayFields != null && + this.PArrayFields.SequenceEqual(input.PArrayFields) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.NFields != null) + hashCode = hashCode * 59 + this.NFields.GetHashCode(); + if (this.PArrayFields != null) + hashCode = hashCode * 59 + this.PArrayFields.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Regula.DocumentReader.WebClient/Model/TBinaryData.cs b/src/Regula.DocumentReader.WebClient/Model/TBinaryData.cs new file mode 100644 index 0000000..1e30237 --- /dev/null +++ b/src/Regula.DocumentReader.WebClient/Model/TBinaryData.cs @@ -0,0 +1,172 @@ +/* + * Regula Document Reader Web API + * + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 7.2.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; + +namespace Regula.DocumentReader.WebClient.Model +{ + /// + /// Container for extracted text fields. Fields are identified by type and language + /// + [DataContract] + public partial class TBinaryData : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// fieldType. + /// fieldName. + /// bufLength. + /// buffer. + public TBinaryData(int fieldType = default(int), string fieldName = default(string), int bufLength = default(int), byte[] buffer = default(byte[])) + { + this.FieldType = fieldType; + this.FieldName = fieldName; + this.BufLength = bufLength; + this.Buffer = buffer; + } + + /// + /// Gets or Sets FieldType + /// + [DataMember(Name="FieldType", EmitDefaultValue=false)] + public int FieldType { get; set; } + + /// + /// Gets or Sets FieldName + /// + [DataMember(Name="FieldName", EmitDefaultValue=false)] + public string FieldName { get; set; } + + /// + /// Gets or Sets BufLength + /// + [DataMember(Name="Buf_Length", EmitDefaultValue=false)] + public int BufLength { get; set; } + + /// + /// Gets or Sets Buffer + /// + [DataMember(Name="Buffer", EmitDefaultValue=false)] + public byte[] Buffer { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TBinaryData {\n"); + sb.Append(" FieldType: ").Append(FieldType).Append("\n"); + sb.Append(" FieldName: ").Append(FieldName).Append("\n"); + sb.Append(" BufLength: ").Append(BufLength).Append("\n"); + sb.Append(" Buffer: ").Append(Buffer).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TBinaryData); + } + + /// + /// Returns true if TBinaryData instances are equal + /// + /// Instance of TBinaryData to be compared + /// Boolean + public bool Equals(TBinaryData input) + { + if (input == null) + return false; + + return + ( + this.FieldType == input.FieldType || + (this.FieldType != null && + this.FieldType.Equals(input.FieldType)) + ) && + ( + this.FieldName == input.FieldName || + (this.FieldName != null && + this.FieldName.Equals(input.FieldName)) + ) && + ( + this.BufLength == input.BufLength || + (this.BufLength != null && + this.BufLength.Equals(input.BufLength)) + ) && + ( + this.Buffer == input.Buffer || + (this.Buffer != null && + this.Buffer.Equals(input.Buffer)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FieldType != null) + hashCode = hashCode * 59 + this.FieldType.GetHashCode(); + if (this.FieldName != null) + hashCode = hashCode * 59 + this.FieldName.GetHashCode(); + if (this.BufLength != null) + hashCode = hashCode * 59 + this.BufLength.GetHashCode(); + if (this.Buffer != null) + hashCode = hashCode * 59 + this.Buffer.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Regula.DocumentReader.WebClient/Model/TOriginalRFIDGraphics.cs b/src/Regula.DocumentReader.WebClient/Model/TOriginalRFIDGraphics.cs new file mode 100644 index 0000000..587b18b --- /dev/null +++ b/src/Regula.DocumentReader.WebClient/Model/TOriginalRFIDGraphics.cs @@ -0,0 +1,236 @@ +/* + * Regula Document Reader Web API + * + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 7.2.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; + +namespace Regula.DocumentReader.WebClient.Model +{ + /// + /// TOriginalRFIDGraphics + /// + [DataContract] + public partial class TOriginalRFIDGraphics : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// fieldType. + /// graphicsType. + /// rFIDOriginDG. + /// rFIDOriginDGTag. + /// rFIDOriginTagEntry. + /// rFIDOriginEntryView. + /// bufLength. + /// buffer. + public TOriginalRFIDGraphics(int fieldType = default(int), int graphicsType = default(int), int rFIDOriginDG = default(int), int rFIDOriginDGTag = default(int), int rFIDOriginTagEntry = default(int), int rFIDOriginEntryView = default(int), int bufLength = default(int), byte[] buffer = default(byte[])) + { + this.FieldType = fieldType; + this.GraphicsType = graphicsType; + this.RFIDOriginDG = rFIDOriginDG; + this.RFIDOriginDGTag = rFIDOriginDGTag; + this.RFIDOriginTagEntry = rFIDOriginTagEntry; + this.RFIDOriginEntryView = rFIDOriginEntryView; + this.BufLength = bufLength; + this.Buffer = buffer; + } + + /// + /// Gets or Sets FieldType + /// + [DataMember(Name="FieldType", EmitDefaultValue=false)] + public int FieldType { get; set; } + + /// + /// Gets or Sets GraphicsType + /// + [DataMember(Name="GraphicsType", EmitDefaultValue=false)] + public int GraphicsType { get; set; } + + /// + /// Gets or Sets RFIDOriginDG + /// + [DataMember(Name="RFID_OriginDG", EmitDefaultValue=false)] + public int RFIDOriginDG { get; set; } + + /// + /// Gets or Sets RFIDOriginDGTag + /// + [DataMember(Name="RFID_OriginDGTag", EmitDefaultValue=false)] + public int RFIDOriginDGTag { get; set; } + + /// + /// Gets or Sets RFIDOriginTagEntry + /// + [DataMember(Name="RFID_OriginTagEntry", EmitDefaultValue=false)] + public int RFIDOriginTagEntry { get; set; } + + /// + /// Gets or Sets RFIDOriginEntryView + /// + [DataMember(Name="RFID_OriginEntryView", EmitDefaultValue=false)] + public int RFIDOriginEntryView { get; set; } + + /// + /// Gets or Sets BufLength + /// + [DataMember(Name="Buf_Length", EmitDefaultValue=false)] + public int BufLength { get; set; } + + /// + /// Gets or Sets Buffer + /// + [DataMember(Name="Buffer", EmitDefaultValue=false)] + public byte[] Buffer { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TOriginalRFIDGraphics {\n"); + sb.Append(" FieldType: ").Append(FieldType).Append("\n"); + sb.Append(" GraphicsType: ").Append(GraphicsType).Append("\n"); + sb.Append(" RFIDOriginDG: ").Append(RFIDOriginDG).Append("\n"); + sb.Append(" RFIDOriginDGTag: ").Append(RFIDOriginDGTag).Append("\n"); + sb.Append(" RFIDOriginTagEntry: ").Append(RFIDOriginTagEntry).Append("\n"); + sb.Append(" RFIDOriginEntryView: ").Append(RFIDOriginEntryView).Append("\n"); + sb.Append(" BufLength: ").Append(BufLength).Append("\n"); + sb.Append(" Buffer: ").Append(Buffer).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TOriginalRFIDGraphics); + } + + /// + /// Returns true if TOriginalRFIDGraphics instances are equal + /// + /// Instance of TOriginalRFIDGraphics to be compared + /// Boolean + public bool Equals(TOriginalRFIDGraphics input) + { + if (input == null) + return false; + + return + ( + this.FieldType == input.FieldType || + (this.FieldType != null && + this.FieldType.Equals(input.FieldType)) + ) && + ( + this.GraphicsType == input.GraphicsType || + (this.GraphicsType != null && + this.GraphicsType.Equals(input.GraphicsType)) + ) && + ( + this.RFIDOriginDG == input.RFIDOriginDG || + (this.RFIDOriginDG != null && + this.RFIDOriginDG.Equals(input.RFIDOriginDG)) + ) && + ( + this.RFIDOriginDGTag == input.RFIDOriginDGTag || + (this.RFIDOriginDGTag != null && + this.RFIDOriginDGTag.Equals(input.RFIDOriginDGTag)) + ) && + ( + this.RFIDOriginTagEntry == input.RFIDOriginTagEntry || + (this.RFIDOriginTagEntry != null && + this.RFIDOriginTagEntry.Equals(input.RFIDOriginTagEntry)) + ) && + ( + this.RFIDOriginEntryView == input.RFIDOriginEntryView || + (this.RFIDOriginEntryView != null && + this.RFIDOriginEntryView.Equals(input.RFIDOriginEntryView)) + ) && + ( + this.BufLength == input.BufLength || + (this.BufLength != null && + this.BufLength.Equals(input.BufLength)) + ) && + ( + this.Buffer == input.Buffer || + (this.Buffer != null && + this.Buffer.Equals(input.Buffer)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FieldType != null) + hashCode = hashCode * 59 + this.FieldType.GetHashCode(); + if (this.GraphicsType != null) + hashCode = hashCode * 59 + this.GraphicsType.GetHashCode(); + if (this.RFIDOriginDG != null) + hashCode = hashCode * 59 + this.RFIDOriginDG.GetHashCode(); + if (this.RFIDOriginDGTag != null) + hashCode = hashCode * 59 + this.RFIDOriginDGTag.GetHashCode(); + if (this.RFIDOriginTagEntry != null) + hashCode = hashCode * 59 + this.RFIDOriginTagEntry.GetHashCode(); + if (this.RFIDOriginEntryView != null) + hashCode = hashCode * 59 + this.RFIDOriginEntryView.GetHashCode(); + if (this.BufLength != null) + hashCode = hashCode * 59 + this.BufLength.GetHashCode(); + if (this.Buffer != null) + hashCode = hashCode * 59 + this.Buffer.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} From 6145a434f4d33cb59f95b655323554cdd930d6c7 Mon Sep 17 00:00:00 2001 From: Sviataslau Dauhuchyts Date: Fri, 13 Sep 2024 10:13:56 +0300 Subject: [PATCH 10/12] Fix SAST scan vuln --- .github/workflows/sast.yaml | 2 +- docker-compose.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sast.yaml b/.github/workflows/sast.yaml index 1e29f13..2050a9f 100644 --- a/.github/workflows/sast.yaml +++ b/.github/workflows/sast.yaml @@ -16,7 +16,7 @@ env: # List of paths (space separated) to ignore # Supports PATTERNS # EXCLUDE_PATHS: 'foo bar/baz file.txt dir/*.yml' - EXCLUDE_PATHS: '' + EXCLUDE_PATHS: '*docker-compose.y*ml' # List of rules (space separated) to ignore # EXCLUDE_RULES: 'generic.secrets.security.detected-aws-account-id.detected-aws-account-id' # See https://github.com/semgrep/semgrep-rules for rules registry diff --git a/docker-compose.yml b/docker-compose.yml index db8827b..f15811b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: docreader: image: regulaforensics/docreader:latest volumes: - - ./regula.license:/app/extBin/unix_x64/regula.license + - ./regula.license:/app/extBin/unix_x64/regula.license nginx: image: nginx:alpine ports: @@ -13,4 +13,4 @@ services: - ./conf/nginx.conf:/etc/nginx/nginx.conf - ./conf/.htpasswd:/etc/nginx/.htpasswd depends_on: - - docreader \ No newline at end of file + - docreader From 2a9767c951533adce390702df9bbfe5b5c460240 Mon Sep 17 00:00:00 2001 From: Kiryl Kovaliov Date: Mon, 7 Oct 2024 14:54:23 +0200 Subject: [PATCH 11/12] SP-17454 update c# client and avoid extra serialization --- ...egula.DocumentReader.NetCoreExample.csproj | 2 +- .../Api/DocumentReaderApi.cs | 5 ++-- .../Api/ProcessApi.cs | 4 ++- .../Client/ApiResponse.cs | 14 +++++++++- .../Model/ContainerList.cs | 27 +++++++++++++++---- .../Model/Ext/RecognitionResponse.cs | 13 +++++---- .../Model/IdentResult.cs | 19 +------------ .../Model/ResultItem.cs | 6 ++--- .../Model/StatusResult.cs | 6 ----- 9 files changed, 53 insertions(+), 43 deletions(-) diff --git a/src/Regula.DocumentReader.NetCoreExample/Regula.DocumentReader.NetCoreExample.csproj b/src/Regula.DocumentReader.NetCoreExample/Regula.DocumentReader.NetCoreExample.csproj index 0bed26c..fd38b5b 100644 --- a/src/Regula.DocumentReader.NetCoreExample/Regula.DocumentReader.NetCoreExample.csproj +++ b/src/Regula.DocumentReader.NetCoreExample/Regula.DocumentReader.NetCoreExample.csproj @@ -3,7 +3,7 @@ Exe DocumentReader WebClient Example Regula.DocumentReader.NetCoreExampple - net7.0;net6.0 + net6.0;net7.0;net8.0 diff --git a/src/Regula.DocumentReader.WebClient/Api/DocumentReaderApi.cs b/src/Regula.DocumentReader.WebClient/Api/DocumentReaderApi.cs index 1691082..c1bdb62 100644 --- a/src/Regula.DocumentReader.WebClient/Api/DocumentReaderApi.cs +++ b/src/Regula.DocumentReader.WebClient/Api/DocumentReaderApi.cs @@ -51,10 +51,9 @@ public RecognitionResponse Process(ProcessRequest processRequest, Dictionary ProcessAsync(ProcessRequest processRequest) { return await ProcessAsync(processRequest, new Dictionary(), default(string)); @@ -77,7 +76,7 @@ public async Task ProcessAsync(ProcessRequest processReques else processRequest.SystemInfo.License = License; - var response = await this._processApi.ApiProcessAsync(processRequest, headers, xRequestID, cancellationToken); + var response = await this._processApi.ApiProcessWithHttpInfoAsync(processRequest, headers, xRequestID, cancellationToken); return new RecognitionResponse(response); } diff --git a/src/Regula.DocumentReader.WebClient/Api/ProcessApi.cs b/src/Regula.DocumentReader.WebClient/Api/ProcessApi.cs index 1ba00ce..7bc15df 100644 --- a/src/Regula.DocumentReader.WebClient/Api/ProcessApi.cs +++ b/src/Regula.DocumentReader.WebClient/Api/ProcessApi.cs @@ -258,9 +258,11 @@ public void AddDefaultHeader(string key, string value) if (exception != null) throw exception; } + var rawResponse = localVarResponse.Content; + return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionarySafe(x => x.Name, x => string.Join(",", x.Value)), - (ProcessResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ProcessResponse))); + (ProcessResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ProcessResponse)), rawResponse); } /// diff --git a/src/Regula.DocumentReader.WebClient/Client/ApiResponse.cs b/src/Regula.DocumentReader.WebClient/Client/ApiResponse.cs index 0da281b..fd876a7 100644 --- a/src/Regula.DocumentReader.WebClient/Client/ApiResponse.cs +++ b/src/Regula.DocumentReader.WebClient/Client/ApiResponse.cs @@ -35,6 +35,13 @@ public class ApiResponse /// /// The data. public T Data { get; private set; } + + + /// + /// Gets or sets the RawResponse + /// + /// The data. + public string RawResponse { get; private set; } /// /// Initializes a new instance of the class. @@ -42,11 +49,16 @@ public class ApiResponse /// HTTP status code. /// HTTP headers. /// Data (parsed HTTP body) - public ApiResponse(int statusCode, IDictionary headers, T data) + /// + public ApiResponse(int statusCode, + IDictionary headers, + T data, + string rawResponse = null) { this.StatusCode= statusCode; this.Headers = headers; this.Data = data; + this.RawResponse = rawResponse; } } diff --git a/src/Regula.DocumentReader.WebClient/Model/ContainerList.cs b/src/Regula.DocumentReader.WebClient/Model/ContainerList.cs index 19aa926..43a6d85 100644 --- a/src/Regula.DocumentReader.WebClient/Model/ContainerList.cs +++ b/src/Regula.DocumentReader.WebClient/Model/ContainerList.cs @@ -1,9 +1,9 @@ /* * Regula Document Reader Web API * - * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core * - * The version of the OpenAPI document: 5.2.0 + * The version of the OpenAPI document: 7.2.0 * * Generated by: https://github.com/openapitools/openapi-generator.git */ @@ -25,7 +25,7 @@ namespace Regula.DocumentReader.WebClient.Model { /// - /// list with result objects + /// List with various objects, containing processing results /// [DataContract] public partial class ContainerList : IEquatable, IValidatableObject @@ -38,8 +38,9 @@ protected ContainerList() { } /// /// Initializes a new instance of the class. /// + /// Length of list (Count for items). /// list (required). - public ContainerList(List list = default(List)) + public ContainerList(int count = default(int), List list = default(List)) { // to ensure "list" is required (not null) if (list == null) @@ -51,8 +52,16 @@ protected ContainerList() { } this.List = list; } + this.Count = count; } + /// + /// Length of list (Count for items) + /// + /// Length of list (Count for items) + [DataMember(Name="Count", EmitDefaultValue=false)] + public int Count { get; set; } + /// /// Gets or Sets List /// @@ -67,6 +76,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ContainerList {\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); sb.Append(" List: ").Append(List).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -78,7 +88,7 @@ public override string ToString() /// JSON string presentation of the object public virtual string ToJson() { - return JsonConvert.SerializeObject(this, Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// @@ -102,6 +112,11 @@ public bool Equals(ContainerList input) return false; return + ( + this.Count == input.Count || + (this.Count != null && + this.Count.Equals(input.Count)) + ) && ( this.List == input.List || this.List != null && @@ -119,6 +134,8 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; + if (this.Count != null) + hashCode = hashCode * 59 + this.Count.GetHashCode(); if (this.List != null) hashCode = hashCode * 59 + this.List.GetHashCode(); return hashCode; diff --git a/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionResponse.cs b/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionResponse.cs index 2a190e1..17af634 100644 --- a/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionResponse.cs +++ b/src/Regula.DocumentReader.WebClient/Model/Ext/RecognitionResponse.cs @@ -3,19 +3,22 @@ using System.IO; using System.Text; using ICSharpCode.SharpZipLib.Zip.Compression.Streams; +using Regula.DocumentReader.WebClient.Client; namespace Regula.DocumentReader.WebClient.Model.Ext { public class RecognitionResponse { - public RecognitionResponse(ProcessResponse originalResponse) + private readonly ApiResponse _apiResponse; + + public RecognitionResponse(ApiResponse apiResponse) { - OriginalResponse = originalResponse; + _apiResponse = apiResponse; } - - public ProcessResponse OriginalResponse { get; } - public string Json => Newtonsoft.Json.JsonConvert.SerializeObject(this.OriginalResponse); + public ProcessResponse OriginalResponse => this._apiResponse.Data; + + public string Json => this._apiResponse.RawResponse; public Status Status() { diff --git a/src/Regula.DocumentReader.WebClient/Model/IdentResult.cs b/src/Regula.DocumentReader.WebClient/Model/IdentResult.cs index 4b79ddf..bacec7f 100644 --- a/src/Regula.DocumentReader.WebClient/Model/IdentResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/IdentResult.cs @@ -43,16 +43,14 @@ protected IdentResult() { } /// area. /// image. /// etalonImage. - /// Probability percent for IMAGE_PATTERN check or element's visibility for IR_VISIBILITY. /// areaList. - public IdentResult(int elementType = default(int), int lightIndex = default(int), RectangleCoordinates area = default(RectangleCoordinates), ImageData image = default(ImageData), ImageData etalonImage = default(ImageData), int percentValue = default(int), AreaContainer areaList = default(AreaContainer), int type = 0, int elementResult = default(int), int elementDiagnose = default(int)) : base(type, elementResult, elementDiagnose) + public IdentResult(int elementType = default(int), int lightIndex = default(int), RectangleCoordinates area = default(RectangleCoordinates), ImageData image = default(ImageData), ImageData etalonImage = default(ImageData), AreaContainer areaList = default(AreaContainer), int type = 0, int elementResult = default(int), int elementDiagnose = default(int), int percentValue = default(int)) : base(type, elementResult, elementDiagnose, percentValue) { this.ElementType = elementType; this.LightIndex = lightIndex; this.Area = area; this.Image = image; this.EtalonImage = etalonImage; - this.PercentValue = percentValue; this.AreaList = areaList; } @@ -86,13 +84,6 @@ protected IdentResult() { } [DataMember(Name="EtalonImage", EmitDefaultValue=false)] public ImageData EtalonImage { get; set; } - /// - /// Probability percent for IMAGE_PATTERN check or element's visibility for IR_VISIBILITY - /// - /// Probability percent for IMAGE_PATTERN check or element's visibility for IR_VISIBILITY - [DataMember(Name="PercentValue", EmitDefaultValue=false)] - public int PercentValue { get; set; } - /// /// Gets or Sets AreaList /// @@ -113,7 +104,6 @@ public override string ToString() sb.Append(" Area: ").Append(Area).Append("\n"); sb.Append(" Image: ").Append(Image).Append("\n"); sb.Append(" EtalonImage: ").Append(EtalonImage).Append("\n"); - sb.Append(" PercentValue: ").Append(PercentValue).Append("\n"); sb.Append(" AreaList: ").Append(AreaList).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -174,11 +164,6 @@ public bool Equals(IdentResult input) (this.EtalonImage != null && this.EtalonImage.Equals(input.EtalonImage)) ) && base.Equals(input) && - ( - this.PercentValue == input.PercentValue || - (this.PercentValue != null && - this.PercentValue.Equals(input.PercentValue)) - ) && base.Equals(input) && ( this.AreaList == input.AreaList || (this.AreaList != null && @@ -205,8 +190,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.Image.GetHashCode(); if (this.EtalonImage != null) hashCode = hashCode * 59 + this.EtalonImage.GetHashCode(); - if (this.PercentValue != null) - hashCode = hashCode * 59 + this.PercentValue.GetHashCode(); if (this.AreaList != null) hashCode = hashCode * 59 + this.AreaList.GetHashCode(); return hashCode; diff --git a/src/Regula.DocumentReader.WebClient/Model/ResultItem.cs b/src/Regula.DocumentReader.WebClient/Model/ResultItem.cs index 64161d1..2103878 100644 --- a/src/Regula.DocumentReader.WebClient/Model/ResultItem.cs +++ b/src/Regula.DocumentReader.WebClient/Model/ResultItem.cs @@ -1,9 +1,9 @@ /* * Regula Document Reader Web API * - * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core * - * The version of the OpenAPI document: 5.2.0 + * The version of the OpenAPI document: 7.2.0 * * Generated by: https://github.com/openapitools/openapi-generator.git */ @@ -131,7 +131,7 @@ public override string ToString() /// JSON string presentation of the object public virtual string ToJson() { - return JsonConvert.SerializeObject(this, Formatting.Indented); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// diff --git a/src/Regula.DocumentReader.WebClient/Model/StatusResult.cs b/src/Regula.DocumentReader.WebClient/Model/StatusResult.cs index 1ea40e4..2aef481 100644 --- a/src/Regula.DocumentReader.WebClient/Model/StatusResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/StatusResult.cs @@ -9,18 +9,12 @@ */ using System; -using System.Linq; using System.IO; using System.Text; -using System.Text.RegularExpressions; -using System.Collections; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; -using Newtonsoft.Json.Converters; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; namespace Regula.DocumentReader.WebClient.Model { From bf644031614b0395ecb1f8b8d4b437a17630e185 Mon Sep 17 00:00:00 2001 From: Kiryl Kovaliov Date: Mon, 7 Oct 2024 14:55:17 +0200 Subject: [PATCH 12/12] SP-17454 update c# client and avoid extra serialization --- src/Regula.DocumentReader.WebClient/Model/StatusResult.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Regula.DocumentReader.WebClient/Model/StatusResult.cs b/src/Regula.DocumentReader.WebClient/Model/StatusResult.cs index 2aef481..1ea40e4 100644 --- a/src/Regula.DocumentReader.WebClient/Model/StatusResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/StatusResult.cs @@ -9,12 +9,18 @@ */ using System; +using System.Linq; using System.IO; using System.Text; +using System.Text.RegularExpressions; +using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Regula.DocumentReader.WebClient.Client.OpenAPIDateConverter; namespace Regula.DocumentReader.WebClient.Model {