Skip to content

Commit d009779

Browse files
committed
SP-19086 add custom headers example
1 parent 94bae3e commit d009779

File tree

7 files changed

+55
-46
lines changed

7 files changed

+55
-46
lines changed

.openapi-generator-ignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ README.md
1111
.gitignore
1212
setup.py
1313
regula/documentreader/webclient/__init__.py
14-
15-
regula/documentreader/webclient/gen/models/container_list.py
16-
regula/documentreader/webclient/gen/models/authenticity_check_result.py

.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ regula/documentreader/webclient/gen/models/area_array.py
1313
regula/documentreader/webclient/gen/models/area_container.py
1414
regula/documentreader/webclient/gen/models/auth_params.py
1515
regula/documentreader/webclient/gen/models/authenticity_check_list.py
16+
regula/documentreader/webclient/gen/models/authenticity_check_result.py
1617
regula/documentreader/webclient/gen/models/authenticity_check_result_item.py
1718
regula/documentreader/webclient/gen/models/authenticity_result.py
1819
regula/documentreader/webclient/gen/models/authenticity_result_all_of.py
@@ -24,6 +25,7 @@ regula/documentreader/webclient/gen/models/check_result.py
2425
regula/documentreader/webclient/gen/models/chosen_document_type.py
2526
regula/documentreader/webclient/gen/models/chosen_document_type_result.py
2627
regula/documentreader/webclient/gen/models/chosen_document_type_result_all_of.py
28+
regula/documentreader/webclient/gen/models/container_list.py
2729
regula/documentreader/webclient/gen/models/critical.py
2830
regula/documentreader/webclient/gen/models/cross_source_value_comparison.py
2931
regula/documentreader/webclient/gen/models/data_module.py

example/example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222

2323
with DocumentReaderApi(host) as api:
2424
api.license = regula_license
25-
25+
api.api_client.default_headers = {
26+
"X-CLIENT-KEY": "123",
27+
"Authorization": "Bearer 123"
28+
}
2629
params = ProcessParams(
2730
scenario=Scenario.FULL_PROCESS,
2831
result_type_output=[

regula/documentreader/webclient/gen/models/authenticity_check_result.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
from regula.documentreader.webclient.gen.models import *
1515

1616

17+
"""
18+
19+
"""
1720
class AuthenticityCheckResult(object):
1821
"""NOTE: This class is auto generated by OpenAPI Generator.
1922
Ref: https://openapi-generator.tech
@@ -29,7 +32,7 @@ class AuthenticityCheckResult(object):
2932
and the value is json key in definition.
3033
"""
3134
openapi_types = {
32-
'type': 'SecurityFeatureType',
35+
'type': 'AuthenticityResultType',
3336
'result': 'CheckResult',
3437
'list': 'list[AuthenticityCheckResultItem]'
3538
}
@@ -61,7 +64,7 @@ def type(self):
6164
6265
6366
:return: The type of this AuthenticityCheckResult. # noqa: E501
64-
:rtype: SecurityFeatureType
67+
:rtype: AuthenticityResultType
6568
"""
6669
return self._type
6770

@@ -71,7 +74,7 @@ def type(self, type):
7174
7275
7376
:param type: The type of this AuthenticityCheckResult. # noqa: E501
74-
:type type: SecurityFeatureType
77+
:type type: AuthenticityResultType
7578
"""
7679
if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501
7780
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501

regula/documentreader/webclient/gen/models/container_list.py

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
# coding: utf-8
22

33
"""
4-
Regula Document Reader Web API
5-
6-
Regula Document Reader Web API # noqa: E501
7-
8-
The version of the OpenAPI document: 5.1.0
94
Generated by: https://openapi-generator.tech
105
"""
116

12-
137
import pprint
148
import re # noqa: F401
159

1610
import six
1711

1812
from regula.documentreader.webclient.gen.configuration import Configuration
13+
# this line was added to enable pycharm type hinting
14+
from regula.documentreader.webclient.gen.models import *
1915

2016

17+
"""
18+
List with various objects, containing processing results
19+
"""
2120
class ContainerList(object):
2221
"""NOTE: This class is auto generated by OpenAPI Generator.
2322
Ref: https://openapi-generator.tech
@@ -33,31 +32,59 @@ class ContainerList(object):
3332
and the value is json key in definition.
3433
"""
3534
openapi_types = {
35+
'count': 'int',
3636
'list': 'list[ResultItem]'
3737
}
3838

3939
attribute_map = {
40+
'count': 'Count',
4041
'list': 'List'
4142
}
4243

43-
def __init__(self, list=None, local_vars_configuration=None): # noqa: E501
44+
def __init__(self, count=None, list=None, local_vars_configuration=None): # noqa: E501
4445
"""ContainerList - a model defined in OpenAPI""" # noqa: E501
4546
if local_vars_configuration is None:
4647
local_vars_configuration = Configuration()
4748
self.local_vars_configuration = local_vars_configuration
4849

50+
self._count = None
4951
self._list = None
5052
self.discriminator = None
5153

54+
if count is not None:
55+
self.count = count
5256
self.list = list
5357

58+
@property
59+
def count(self):
60+
"""Gets the count of this ContainerList. # noqa: E501
61+
62+
Length of list (Count for items) # noqa: E501
63+
64+
:return: The count of this ContainerList. # noqa: E501
65+
:rtype: int
66+
"""
67+
return self._count
68+
69+
@count.setter
70+
def count(self, count):
71+
"""Sets the count of this ContainerList.
72+
73+
Length of list (Count for items) # noqa: E501
74+
75+
:param count: The count of this ContainerList. # noqa: E501
76+
:type count: int
77+
"""
78+
79+
self._count = count
80+
5481
@property
5582
def list(self):
5683
"""Gets the list of this ContainerList. # noqa: E501
5784
5885
5986
:return: The list of this ContainerList. # noqa: E501
60-
:rtype: list[AnyOfRawImageResultTextResultStatusResultTextDataResultGraphicsResultLexicalAnalysisResultChosenDocumentTypeResultDocumentTypesCandidatesResultImagesResult]
87+
:rtype: list[ResultItem]
6188
"""
6289
return self._list
6390

@@ -67,7 +94,7 @@ def list(self, list):
6794
6895
6996
:param list: The list of this ContainerList. # noqa: E501
70-
:type list: list[AnyOfRawImageResultTextResultStatusResultTextDataResultGraphicsResultLexicalAnalysisResultChosenDocumentTypeResultDocumentTypesCandidatesResultImagesResult]
97+
:type list: list[ResultItem]
7198
"""
7299
if self.local_vars_configuration.client_side_validation and list is None: # noqa: E501
73100
raise ValueError("Invalid value for `list`, must not be `None`") # noqa: E501

regula/documentreader/webclient/gen/models/process_params.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class ProcessParams(object):
7070
'return_uncropped_image': 'bool',
7171
'mrz_formats_filter': 'list[MRZFormat]',
7272
'force_read_mrz_before_locate': 'bool',
73-
'force_barcode_checks': 'bool',
7473
'parse_barcodes': 'bool',
7574
'convert_case': 'TextPostProcessing',
7675
'split_names': 'bool',
@@ -128,7 +127,6 @@ class ProcessParams(object):
128127
'return_uncropped_image': 'returnUncroppedImage',
129128
'mrz_formats_filter': 'mrzFormatsFilter',
130129
'force_read_mrz_before_locate': 'forceReadMrzBeforeLocate',
131-
'force_barcode_checks': 'forceBarcodeChecks',
132130
'parse_barcodes': 'parseBarcodes',
133131
'convert_case': 'convertCase',
134132
'split_names': 'splitNames',
@@ -147,7 +145,7 @@ class ProcessParams(object):
147145
'generate_numeric_codes': 'generateNumericCodes'
148146
}
149147

150-
def __init__(self, lcid_filter=None, lcid_ignore_filter=None, one_shot_identification=None, use_face_api=None, face_api=None, do_detect_can=None, image_output_max_height=None, image_output_max_width=None, scenario=None, result_type_output=None, double_page_spread=None, generate_double_page_spread_image=None, field_types_filter=None, date_format=None, measure_system=None, image_dpi_out_max=None, already_cropped=None, custom_params=None, config=None, log=None, log_level=None, force_doc_id=None, match_text_field_mask=None, fast_doc_detect=None, update_ocr_validity_by_glare=None, check_required_text_fields=None, return_cropped_barcode=None, image_qa=None, respect_image_quality=None, force_doc_format=None, no_graphics=None, depersonalize_log=None, multi_doc_on_image=None, shift_expiry_date=None, minimal_holder_age=None, return_uncropped_image=None, mrz_formats_filter=None, force_read_mrz_before_locate=None, force_barcode_checks=None, parse_barcodes=None, convert_case=None, split_names=None, disable_perforation_ocr=None, document_group_filter=None, process_auth=None, device_id=None, device_type=None, device_type_hex=None, ignore_device_id_from_image=None, document_id_list=None, rfid=None, check_auth=None, auth_params=None, mrz_detect_mode=None, generate_numeric_codes=None, local_vars_configuration=None): # noqa: E501
148+
def __init__(self, lcid_filter=None, lcid_ignore_filter=None, one_shot_identification=None, use_face_api=None, face_api=None, do_detect_can=None, image_output_max_height=None, image_output_max_width=None, scenario=None, result_type_output=None, double_page_spread=None, generate_double_page_spread_image=None, field_types_filter=None, date_format=None, measure_system=None, image_dpi_out_max=None, already_cropped=None, custom_params=None, config=None, log=None, log_level=None, force_doc_id=None, match_text_field_mask=None, fast_doc_detect=None, update_ocr_validity_by_glare=None, check_required_text_fields=None, return_cropped_barcode=None, image_qa=None, respect_image_quality=None, force_doc_format=None, no_graphics=None, depersonalize_log=None, multi_doc_on_image=None, shift_expiry_date=None, minimal_holder_age=None, return_uncropped_image=None, mrz_formats_filter=None, force_read_mrz_before_locate=None, parse_barcodes=None, convert_case=None, split_names=None, disable_perforation_ocr=None, document_group_filter=None, process_auth=None, device_id=None, device_type=None, device_type_hex=None, ignore_device_id_from_image=None, document_id_list=None, rfid=None, check_auth=None, auth_params=None, mrz_detect_mode=None, generate_numeric_codes=None, local_vars_configuration=None): # noqa: E501
151149
"""ProcessParams - a model defined in OpenAPI""" # noqa: E501
152150
if local_vars_configuration is None:
153151
local_vars_configuration = Configuration()
@@ -191,7 +189,6 @@ def __init__(self, lcid_filter=None, lcid_ignore_filter=None, one_shot_identific
191189
self._return_uncropped_image = None
192190
self._mrz_formats_filter = None
193191
self._force_read_mrz_before_locate = None
194-
self._force_barcode_checks = None
195192
self._parse_barcodes = None
196193
self._convert_case = None
197194
self._split_names = None
@@ -285,8 +282,6 @@ def __init__(self, lcid_filter=None, lcid_ignore_filter=None, one_shot_identific
285282
self.mrz_formats_filter = mrz_formats_filter
286283
if force_read_mrz_before_locate is not None:
287284
self.force_read_mrz_before_locate = force_read_mrz_before_locate
288-
if force_barcode_checks is not None:
289-
self.force_barcode_checks = force_barcode_checks
290285
if parse_barcodes is not None:
291286
self.parse_barcodes = parse_barcodes
292287
if convert_case is not None:
@@ -1184,29 +1179,6 @@ def force_read_mrz_before_locate(self, force_read_mrz_before_locate):
11841179

11851180
self._force_read_mrz_before_locate = force_read_mrz_before_locate
11861181

1187-
@property
1188-
def force_barcode_checks(self):
1189-
"""Gets the force_barcode_checks of this ProcessParams. # noqa: E501
1190-
1191-
Allows you to fail both the Barcode format check and overall statuses of the document if the Digital signature check is not performed # noqa: E501
1192-
1193-
:return: The force_barcode_checks of this ProcessParams. # noqa: E501
1194-
:rtype: bool
1195-
"""
1196-
return self._force_barcode_checks
1197-
1198-
@force_barcode_checks.setter
1199-
def force_barcode_checks(self, force_barcode_checks):
1200-
"""Sets the force_barcode_checks of this ProcessParams.
1201-
1202-
Allows you to fail both the Barcode format check and overall statuses of the document if the Digital signature check is not performed # noqa: E501
1203-
1204-
:param force_barcode_checks: The force_barcode_checks of this ProcessParams. # noqa: E501
1205-
:type force_barcode_checks: bool
1206-
"""
1207-
1208-
self._force_barcode_checks = force_barcode_checks
1209-
12101182
@property
12111183
def parse_barcodes(self):
12121184
"""Gets the parse_barcodes of this ProcessParams. # noqa: E501

update-models.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ DOCS_DEFINITION_FOLDER="${PWD}/../DocumentReader-web-openapi" \
55
&& docker run --user "$(id -u):$(id -g)" --rm -v "${PWD}:/client" -v "$DOCS_DEFINITION_FOLDER:/definitions" \
66
openapitools/openapi-generator-cli:v5.0.0 generate -g python-legacy \
77
-i /definitions/index.yml -o /client -c /client/generator-config.json \
8-
-t /client/generator-templates
8+
-t /client/generator-templates \
9+
--type-mappings AnyOfDocVisualExtendedFieldRectDocVisualExtendedFieldRfid=DocVisualExtendedField \
10+
--type-mappings AnyOfSecurityFeatureResultIdentResultFiberResultOCRSecurityTextResultPhotoIdentResult=AuthenticityCheckResultItem \
11+
--type-mappings AnyOfGraphicFieldRectGraphicFieldRfid=GraphicField \
12+
--type-mappings AnyOfStatusResultTextResultDocumentImageResultImagesResultChosenDocumentTypeResultDocumentTypesCandidatesResultTextDataResultGraphicsResultLexicalAnalysisResultAuthenticityResultImageQualityResultDocumentPositionResultDocBarCodeInfoLicenseResultEncryptedRCLResultDocumentBinaryInfoResult=ResultItem \
13+
--type-mappings AnyOfStatusResultTextResultDocumentImageResultImagesResultChosenDocumentTypeResultDocumentTypesCandidatesResultTextDataResultGraphicsResultLexicalAnalysisResultAuthenticityResultImageQualityResultDocumentPositionResultDocBarCodeInfoLicenseResultEncryptedRCLResult=ResultItem

0 commit comments

Comments
 (0)