diff --git a/.github/workflows/sast.yaml b/.github/workflows/sast.yaml new file mode 100644 index 0000000..2050a9f --- /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: '*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 + 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 + 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 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/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/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/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; + } + } + +} 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/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/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; + } + } + +}