restpki-ng-python-client 0.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- restpki_ng_python_client/__init__.py +200 -0
- restpki_ng_python_client/api/__init__.py +17 -0
- restpki_ng_python_client/api/authentication_api.py +2041 -0
- restpki_ng_python_client/api/cades_signature_api.py +2376 -0
- restpki_ng_python_client/api/document_keys_api.py +1199 -0
- restpki_ng_python_client/api/documents_api.py +868 -0
- restpki_ng_python_client/api/pades_signature_api.py +1797 -0
- restpki_ng_python_client/api/pades_visual_positioning_presets_api.py +869 -0
- restpki_ng_python_client/api/pdf_api.py +334 -0
- restpki_ng_python_client/api/signature_api.py +624 -0
- restpki_ng_python_client/api/signature_inspection_api.py +337 -0
- restpki_ng_python_client/api/signature_sessions_api.py +891 -0
- restpki_ng_python_client/api/timestamp_api.py +654 -0
- restpki_ng_python_client/api/upload_api.py +1124 -0
- restpki_ng_python_client/api/xml_signature_api.py +1781 -0
- restpki_ng_python_client/api_client.py +741 -0
- restpki_ng_python_client/api_response.py +21 -0
- restpki_ng_python_client/configuration.py +426 -0
- restpki_ng_python_client/exceptions.py +166 -0
- restpki_ng_python_client/file_utils.py +122 -0
- restpki_ng_python_client/models/__init__.py +165 -0
- restpki_ng_python_client/models/allocate_document_key_batch_request.py +96 -0
- restpki_ng_python_client/models/allocate_document_key_request.py +93 -0
- restpki_ng_python_client/models/attribute_certificate_model.py +141 -0
- restpki_ng_python_client/models/audit_package_options.py +90 -0
- restpki_ng_python_client/models/authentication_failures.py +45 -0
- restpki_ng_python_client/models/authentication_get_response.py +92 -0
- restpki_ng_python_client/models/authentication_post_request.py +116 -0
- restpki_ng_python_client/models/authentication_post_response.py +98 -0
- restpki_ng_python_client/models/authentications_post_request.py +95 -0
- restpki_ng_python_client/models/authentications_post_response.py +114 -0
- restpki_ng_python_client/models/authentications_post_signed_bytes_request.py +99 -0
- restpki_ng_python_client/models/authentications_post_signed_bytes_response.py +98 -0
- restpki_ng_python_client/models/auto_positioning_horizontal_directions.py +45 -0
- restpki_ng_python_client/models/auto_positioning_vertical_directions.py +45 -0
- restpki_ng_python_client/models/blockchains.py +45 -0
- restpki_ng_python_client/models/cades_signature_model.py +123 -0
- restpki_ng_python_client/models/cades_signature_post_request_v1.py +137 -0
- restpki_ng_python_client/models/cades_signature_post_request_v2.py +152 -0
- restpki_ng_python_client/models/cades_signature_post_request_v3.py +149 -0
- restpki_ng_python_client/models/cades_signature_post_response.py +120 -0
- restpki_ng_python_client/models/cades_signature_post_signed_bytes_request.py +92 -0
- restpki_ng_python_client/models/cades_signature_post_signed_bytes_response.py +106 -0
- restpki_ng_python_client/models/cades_signer_model.py +159 -0
- restpki_ng_python_client/models/cades_timestamp_model.py +140 -0
- restpki_ng_python_client/models/certificate_model.py +197 -0
- restpki_ng_python_client/models/certificate_reference_model.py +99 -0
- restpki_ng_python_client/models/certificate_requirement.py +95 -0
- restpki_ng_python_client/models/certificate_requirement_types.py +45 -0
- restpki_ng_python_client/models/certificate_summary.py +142 -0
- restpki_ng_python_client/models/certified_attribute_model.py +94 -0
- restpki_ng_python_client/models/certified_attribute_types.py +44 -0
- restpki_ng_python_client/models/cms_content_types.py +50 -0
- restpki_ng_python_client/models/cms_signature_options.py +109 -0
- restpki_ng_python_client/models/color_model.py +98 -0
- restpki_ng_python_client/models/commitment_type_model.py +99 -0
- restpki_ng_python_client/models/complete_authentication_request.py +93 -0
- restpki_ng_python_client/models/complete_authentication_response.py +103 -0
- restpki_ng_python_client/models/complete_signature_request.py +95 -0
- restpki_ng_python_client/models/complete_signature_request_v2.py +91 -0
- restpki_ng_python_client/models/create_signature_session_request.py +161 -0
- restpki_ng_python_client/models/create_signature_session_response.py +95 -0
- restpki_ng_python_client/models/digest_algorithm_and_value_model.py +103 -0
- restpki_ng_python_client/models/digest_algorithms.py +49 -0
- restpki_ng_python_client/models/document_file_model.py +137 -0
- restpki_ng_python_client/models/document_key_model.py +100 -0
- restpki_ng_python_client/models/document_key_query_response.py +110 -0
- restpki_ng_python_client/models/document_key_summary.py +100 -0
- restpki_ng_python_client/models/document_model.py +150 -0
- restpki_ng_python_client/models/document_query_response.py +93 -0
- restpki_ng_python_client/models/document_status.py +47 -0
- restpki_ng_python_client/models/document_summary.py +128 -0
- restpki_ng_python_client/models/error_model_v2.py +120 -0
- restpki_ng_python_client/models/file_model.py +114 -0
- restpki_ng_python_client/models/file_reference_model.py +137 -0
- restpki_ng_python_client/models/full_xml_signature_post_request.py +136 -0
- restpki_ng_python_client/models/general_name_choices.py +52 -0
- restpki_ng_python_client/models/general_name_model.py +108 -0
- restpki_ng_python_client/models/holder_types.py +45 -0
- restpki_ng_python_client/models/inspect_signature_failures.py +44 -0
- restpki_ng_python_client/models/inspect_signature_request.py +127 -0
- restpki_ng_python_client/models/inspect_signature_response.py +131 -0
- restpki_ng_python_client/models/multipart_upload_begin_response.py +95 -0
- restpki_ng_python_client/models/multipart_upload_end_request.py +95 -0
- restpki_ng_python_client/models/name_model.py +205 -0
- restpki_ng_python_client/models/namespace_model.py +99 -0
- restpki_ng_python_client/models/open_cades_signature_request_model.py +147 -0
- restpki_ng_python_client/models/open_signature_request_model.py +145 -0
- restpki_ng_python_client/models/open_xml_signature_request_model.py +151 -0
- restpki_ng_python_client/models/other_name_model.py +107 -0
- restpki_ng_python_client/models/pades_certification_level.py +47 -0
- restpki_ng_python_client/models/pades_horizontal_align.py +46 -0
- restpki_ng_python_client/models/pades_measurement_units.py +45 -0
- restpki_ng_python_client/models/pades_page_optimization_model.py +98 -0
- restpki_ng_python_client/models/pades_signature_model.py +113 -0
- restpki_ng_python_client/models/pades_signature_post_request_v1.py +167 -0
- restpki_ng_python_client/models/pades_signature_post_request_v2.py +171 -0
- restpki_ng_python_client/models/pades_signature_post_response.py +120 -0
- restpki_ng_python_client/models/pades_signature_post_signed_bytes_request.py +92 -0
- restpki_ng_python_client/models/pades_signature_post_signed_bytes_response.py +106 -0
- restpki_ng_python_client/models/pades_signer_model.py +168 -0
- restpki_ng_python_client/models/pades_size_model.py +89 -0
- restpki_ng_python_client/models/pades_text_horizontal_align.py +45 -0
- restpki_ng_python_client/models/pades_vertical_align.py +46 -0
- restpki_ng_python_client/models/pades_visual_auto_positioning_model.py +106 -0
- restpki_ng_python_client/models/pades_visual_image_model.py +105 -0
- restpki_ng_python_client/models/pades_visual_positioning_model.py +109 -0
- restpki_ng_python_client/models/pades_visual_rectangle_model.py +127 -0
- restpki_ng_python_client/models/pades_visual_representation_model.py +103 -0
- restpki_ng_python_client/models/pades_visual_text_model.py +111 -0
- restpki_ng_python_client/models/page_orientations.py +46 -0
- restpki_ng_python_client/models/paper_sizes.py +56 -0
- restpki_ng_python_client/models/pdf_add_marks_request.py +117 -0
- restpki_ng_python_client/models/pdf_add_marks_response.py +91 -0
- restpki_ng_python_client/models/pdf_container_definition.py +208 -0
- restpki_ng_python_client/models/pdf_helper.py +43 -0
- restpki_ng_python_client/models/pdf_mark_element_model.py +230 -0
- restpki_ng_python_client/models/pdf_mark_element_type.py +46 -0
- restpki_ng_python_client/models/pdf_mark_image_model.py +98 -0
- restpki_ng_python_client/models/pdf_mark_model.py +168 -0
- restpki_ng_python_client/models/pdf_mark_page_options.py +47 -0
- restpki_ng_python_client/models/pdf_signature_options.py +101 -0
- restpki_ng_python_client/models/pdf_text_section_model.py +125 -0
- restpki_ng_python_client/models/pdf_text_style.py +46 -0
- restpki_ng_python_client/models/pki_brazil_certificate_model.py +159 -0
- restpki_ng_python_client/models/pki_brazil_certificate_types.py +54 -0
- restpki_ng_python_client/models/pki_italy_certificate_model.py +103 -0
- restpki_ng_python_client/models/pki_italy_certificate_types.py +46 -0
- restpki_ng_python_client/models/prepare_authentication_request.py +100 -0
- restpki_ng_python_client/models/prepare_authentication_response.py +99 -0
- restpki_ng_python_client/models/prepare_signature_failures.py +46 -0
- restpki_ng_python_client/models/prepare_signature_request.py +133 -0
- restpki_ng_python_client/models/prepare_signature_response.py +116 -0
- restpki_ng_python_client/models/resource_content_or_reference.py +107 -0
- restpki_ng_python_client/models/role_attribute_model.py +114 -0
- restpki_ng_python_client/models/session_completion_status.py +89 -0
- restpki_ng_python_client/models/signature_algorithm_and_value_model.py +106 -0
- restpki_ng_python_client/models/signature_algorithm_identifier.py +88 -0
- restpki_ng_python_client/models/signature_algorithms.py +48 -0
- restpki_ng_python_client/models/signature_b_stamp_model.py +135 -0
- restpki_ng_python_client/models/signature_policy_identifier_model.py +105 -0
- restpki_ng_python_client/models/signature_result_model.py +105 -0
- restpki_ng_python_client/models/signature_session_document_data.py +128 -0
- restpki_ng_python_client/models/signature_session_document_summary.py +138 -0
- restpki_ng_python_client/models/signature_session_model.py +126 -0
- restpki_ng_python_client/models/signature_session_status.py +49 -0
- restpki_ng_python_client/models/signature_types.py +46 -0
- restpki_ng_python_client/models/signer_b_stamp_model.py +132 -0
- restpki_ng_python_client/models/signer_model.py +187 -0
- restpki_ng_python_client/models/signer_summary.py +94 -0
- restpki_ng_python_client/models/timestamp_issue_response.py +99 -0
- restpki_ng_python_client/models/validation_item_model.py +111 -0
- restpki_ng_python_client/models/validation_item_types.py +91 -0
- restpki_ng_python_client/models/validation_results_model.py +131 -0
- restpki_ng_python_client/models/webhook_event_model.py +94 -0
- restpki_ng_python_client/models/webhook_event_types.py +44 -0
- restpki_ng_python_client/models/xml_attribute_model.py +107 -0
- restpki_ng_python_client/models/xml_element_location_model.py +111 -0
- restpki_ng_python_client/models/xml_element_model.py +115 -0
- restpki_ng_python_client/models/xml_element_signature_post_request.py +145 -0
- restpki_ng_python_client/models/xml_id_attribute_model.py +96 -0
- restpki_ng_python_client/models/xml_id_resolution_table_model.py +123 -0
- restpki_ng_python_client/models/xml_insertion_options.py +47 -0
- restpki_ng_python_client/models/xml_node_name_model.py +96 -0
- restpki_ng_python_client/models/xml_signature_model.py +154 -0
- restpki_ng_python_client/models/xml_signature_options.py +102 -0
- restpki_ng_python_client/models/xml_signature_post_response.py +120 -0
- restpki_ng_python_client/models/xml_signature_post_signed_bytes_request.py +92 -0
- restpki_ng_python_client/models/xml_signature_post_signed_bytes_response.py +106 -0
- restpki_ng_python_client/models/xml_signature_response_model.py +113 -0
- restpki_ng_python_client/models/xml_signature_types.py +47 -0
- restpki_ng_python_client/models/xml_signed_entity_types.py +46 -0
- restpki_ng_python_client/py.typed +0 -0
- restpki_ng_python_client/rest.py +231 -0
- restpki_ng_python_client/restpki_ng_client.py +458 -0
- restpki_ng_python_client/standard_signature_policies.py +24 -0
- restpki_ng_python_client/utils.py +80 -0
- restpki_ng_python_client-0.9.0.dist-info/METADATA +16 -0
- restpki_ng_python_client-0.9.0.dist-info/RECORD +181 -0
- restpki_ng_python_client-0.9.0.dist-info/WHEEL +5 -0
- restpki_ng_python_client-0.9.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rest PKI Core API
|
|
5
|
+
|
|
6
|
+
<b><i>Para Português, <a href=\"https://docs.lacunasoftware.com/pt-br/articles/rest-pki/core/integration/get-started\">clique aqui</a></i></b> <p> <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/core/\">Rest PKI Core</a> is an upcoming version of <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/\">Rest PKI</a> that will have extended compatibility with environments and databases. </p> <p> In addition to Windows Server (which is already supported by Rest PKI), Rest PKI Core will also run on <b>Linux</b> (Debian- and RedHat-based distributions) and on <b>Docker</b>. As for database servers, in addition to SQL Server, <b>PostgreSQL</b> will also be supported. </p> <p> <b>Before getting started, see the integration overview on the <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/core/integration/\">Integration Guide</a></b> </p> <p> For questions regarding the usage of this API, please reach us at <a href=\"https://lacuna.help/\">lacuna.help</a> </p> <h2>Parameters</h2> <p> You will need the following parameters: </p> <ul> <li><b>Endpoint</b>: address of the Rest PKI Core instance that will be used</li> <li><b>API Key</b>: authorization key for using the API</li> </ul> <p> The <span class=\"model\">endpoint</span> must be prefixed to all relative URLs mentioned here. As for the <span class=\"model\">API Key</span>, see how to use it below. </p> <h2>Authentication</h2> <p> The API key must be sent on the <span class=\"model\">X-Api-Key</span> header on each request: </p> <!-- unfortunately, class \"example microlight\" doesn't seem to work here --> <pre style=\"font-size: 12px; padding: 10px; border-radius: 4px; background: #41444e; font-weight: 600; color: #fff;\"> X-Api-Key: yourapp|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </pre> <h2>HTTP Codes</h2> <p> The APIs will return the following HTTP codes: </p> <table> <thead> <tr> <th>Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><strong class=\"model-title\">200 (OK)</strong></td> <td>Request processed successfully. The response is different for each API, please refer to the operation's documentation</td> </tr> <tr> <td><strong class=\"model-title\">400 (Bad Request)</strong></td> <td>Syntax error. For instance, when a required field was not provided</td> </tr> <tr> <td><strong class=\"model-title\">401 (Unauthorized)</strong></td> <td>API key not provided or invalid</td> </tr> <tr> <td><strong class=\"model-title\">403 (Forbidden)</strong></td> <td>API key is valid, but the application has insufficient permissions to complete the requested operation</td> </tr> <tr> <td><strong class=\"model-title\">422 (Unprocessable Entity)</strong></td> <td>API error. The response body is an <a href=\"#model-ErrorModelV2\" class=\"model\">ErrorModelV2</a> </tr> <tr> <td><strong class=\"model-title\">500 (Internal Server Error)</strong></td> <td>An unexpected error occurred. The <span class=\"model\">exceptionCode</span> contained on the response body may be of help for our support team during diagnostic.</td> </tr> </tbody> </table> <h3>Error Codes</h3> <p> Some of the error codes returned in the <span class=\"model\">code</span> field of an <a href=\"#model-ErrorModelV2\" class=\"model\">ErrorModelV2</a> (body of responses with HTTP status code 422) are provided below*: </p> <table> <thead> <tr> <th>Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class=\"model\">DocumentNotFound</td> <td>A referenced document was not found (check the document ID)</td> </tr> <tr> <td class=\"model\">SecurityContextNotFound</td> <td>A referenced security context was not found (check the security context ID)</td> </tr> <tr> <td class=\"model\">SignatureSessionNotFound</td> <td>A referenced signature session was not found (check the signature session ID)</td> </tr> <tr> <td class=\"model\">BadSignatureSessionOperation</td> <td>The operation is invalid for the current signature session or document status. For instance, trying to await the session's completion if it is still <span class=\"model\">Pending</span> results in this error</td> </tr> <tr> <td class=\"model\">BackgroundProcessing</td> <td>The operation cannot be completed at this time because the resource is being processed in background</td> </tr> <tr> <td class=\"model\">SignatureSessionTokenRequired</td> <td>The signature session token was not passed on the <span class=\"model\">X-Signature-Session-Token</span> request header</td> </tr> <tr> <td class=\"model\">BadSignatureSessionToken</td> <td>An invalid signature session token was passed on the <span class=\"model\">X-Signature-Session-Token</span> request header. Check your application for possible corruption of the session token, which may contain characters <span class=\"code\">-</span> (hyphen) and <span class=\"code\">_</span> (underscore)</td> </tr> <tr> <td class=\"model\">ExpiredSignatureSessionToken</td> <td>An expired signature session token was passed on the <span class=\"model\">X-Signature-Session-Token</span> request header. Signature session tokens are normally valid for 4 hours.</td> </tr> </tbody> </table> <p style=\"font-size: 0.9em\"> *The codes shown above are the most common error codes. Nonetheless, this list is not comprehensive. New codes may be added anytime without previous warning. </p> <h2>Culture / Internationalization (i18n)</h2> <p>The <span class=\"model\">Accept-Language</span> request header is observed by this API. The following cultures are supported:</p> <ul> <li><span class=\"code\">en-US</span> (or simply <span class=\"code\">en</span>)</li> <li><span class=\"code\">pt-BR</span> (or simply <span class=\"code\">pt</span>)</li> </ul> <p><i>Notice: error messages are not affected by this header and therefore should not be displayed to users, being better suited for logging.</i></p>
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.1.2
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from pydantic import BaseModel
|
|
23
|
+
from pydantic import Field
|
|
24
|
+
from restpki_ng_python_client.models.certificate_model import CertificateModel
|
|
25
|
+
from restpki_ng_python_client.models.commitment_type_model import CommitmentTypeModel
|
|
26
|
+
from restpki_ng_python_client.models.digest_algorithm_and_value_model import DigestAlgorithmAndValueModel
|
|
27
|
+
from restpki_ng_python_client.models.signature_algorithm_and_value_model import SignatureAlgorithmAndValueModel
|
|
28
|
+
from restpki_ng_python_client.models.signature_policy_identifier_model import SignaturePolicyIdentifierModel
|
|
29
|
+
from restpki_ng_python_client.models.signer_b_stamp_model import SignerBStampModel
|
|
30
|
+
from restpki_ng_python_client.models.validation_results_model import ValidationResultsModel
|
|
31
|
+
try:
|
|
32
|
+
from typing import Self
|
|
33
|
+
except ImportError:
|
|
34
|
+
from typing_extensions import Self
|
|
35
|
+
|
|
36
|
+
class CadesSignerModel(BaseModel):
|
|
37
|
+
"""
|
|
38
|
+
CadesSignerModel
|
|
39
|
+
""" # noqa: E501
|
|
40
|
+
message_digest: Optional[DigestAlgorithmAndValueModel] = Field(default=None, alias="messageDigest")
|
|
41
|
+
signature: Optional[SignatureAlgorithmAndValueModel] = None
|
|
42
|
+
signature_policy: Optional[SignaturePolicyIdentifierModel] = Field(default=None, alias="signaturePolicy")
|
|
43
|
+
certificate: Optional[CertificateModel] = None
|
|
44
|
+
signing_time: Optional[datetime] = Field(default=None, alias="signingTime")
|
|
45
|
+
certified_date_reference: Optional[datetime] = Field(default=None, alias="certifiedDateReference")
|
|
46
|
+
timestamps: Optional[List[CadesTimestampModel]] = None
|
|
47
|
+
validation_results: Optional[ValidationResultsModel] = Field(default=None, alias="validationResults")
|
|
48
|
+
commitment_type: Optional[CommitmentTypeModel] = Field(default=None, alias="commitmentType")
|
|
49
|
+
b_stamp: Optional[SignerBStampModel] = Field(default=None, alias="bStamp")
|
|
50
|
+
__properties: ClassVar[List[str]] = ["messageDigest", "signature", "signaturePolicy", "certificate", "signingTime", "certifiedDateReference", "timestamps", "validationResults", "commitmentType", "bStamp"]
|
|
51
|
+
|
|
52
|
+
model_config = {
|
|
53
|
+
"populate_by_name": True,
|
|
54
|
+
"validate_assignment": True
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
65
|
+
return json.dumps(self.to_dict())
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Self:
|
|
69
|
+
"""Create an instance of CadesSignerModel from a JSON string"""
|
|
70
|
+
return cls.from_dict(json.loads(json_str))
|
|
71
|
+
|
|
72
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
73
|
+
"""Return the dictionary representation of the model using alias.
|
|
74
|
+
|
|
75
|
+
This has the following differences from calling pydantic's
|
|
76
|
+
`self.model_dump(by_alias=True)`:
|
|
77
|
+
|
|
78
|
+
* `None` is only added to the output dict for nullable fields that
|
|
79
|
+
were set at model initialization. Other fields with value `None`
|
|
80
|
+
are ignored.
|
|
81
|
+
"""
|
|
82
|
+
_dict = self.model_dump(
|
|
83
|
+
by_alias=True,
|
|
84
|
+
exclude={
|
|
85
|
+
},
|
|
86
|
+
exclude_none=True,
|
|
87
|
+
)
|
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of message_digest
|
|
89
|
+
if self.message_digest:
|
|
90
|
+
_dict['messageDigest'] = self.message_digest.to_dict()
|
|
91
|
+
# override the default output from pydantic by calling `to_dict()` of signature
|
|
92
|
+
if self.signature:
|
|
93
|
+
_dict['signature'] = self.signature.to_dict()
|
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of signature_policy
|
|
95
|
+
if self.signature_policy:
|
|
96
|
+
_dict['signaturePolicy'] = self.signature_policy.to_dict()
|
|
97
|
+
# override the default output from pydantic by calling `to_dict()` of certificate
|
|
98
|
+
if self.certificate:
|
|
99
|
+
_dict['certificate'] = self.certificate.to_dict()
|
|
100
|
+
# override the default output from pydantic by calling `to_dict()` of each item in timestamps (list)
|
|
101
|
+
_items = []
|
|
102
|
+
if self.timestamps:
|
|
103
|
+
for _item in self.timestamps:
|
|
104
|
+
if _item:
|
|
105
|
+
_items.append(_item.to_dict())
|
|
106
|
+
_dict['timestamps'] = _items
|
|
107
|
+
# override the default output from pydantic by calling `to_dict()` of validation_results
|
|
108
|
+
if self.validation_results:
|
|
109
|
+
_dict['validationResults'] = self.validation_results.to_dict()
|
|
110
|
+
# override the default output from pydantic by calling `to_dict()` of commitment_type
|
|
111
|
+
if self.commitment_type:
|
|
112
|
+
_dict['commitmentType'] = self.commitment_type.to_dict()
|
|
113
|
+
# override the default output from pydantic by calling `to_dict()` of b_stamp
|
|
114
|
+
if self.b_stamp:
|
|
115
|
+
_dict['bStamp'] = self.b_stamp.to_dict()
|
|
116
|
+
# set to None if signing_time (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.signing_time is None and "signing_time" in self.model_fields_set:
|
|
119
|
+
_dict['signingTime'] = None
|
|
120
|
+
|
|
121
|
+
# set to None if certified_date_reference (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.certified_date_reference is None and "certified_date_reference" in self.model_fields_set:
|
|
124
|
+
_dict['certifiedDateReference'] = None
|
|
125
|
+
|
|
126
|
+
# set to None if timestamps (nullable) is None
|
|
127
|
+
# and model_fields_set contains the field
|
|
128
|
+
if self.timestamps is None and "timestamps" in self.model_fields_set:
|
|
129
|
+
_dict['timestamps'] = None
|
|
130
|
+
|
|
131
|
+
return _dict
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def from_dict(cls, obj: Dict) -> Self:
|
|
135
|
+
"""Create an instance of CadesSignerModel from a dict"""
|
|
136
|
+
if obj is None:
|
|
137
|
+
return None
|
|
138
|
+
|
|
139
|
+
if not isinstance(obj, dict):
|
|
140
|
+
return cls.model_validate(obj)
|
|
141
|
+
|
|
142
|
+
_obj = cls.model_validate({
|
|
143
|
+
"messageDigest": DigestAlgorithmAndValueModel.from_dict(obj.get("messageDigest")) if obj.get("messageDigest") is not None else None,
|
|
144
|
+
"signature": SignatureAlgorithmAndValueModel.from_dict(obj.get("signature")) if obj.get("signature") is not None else None,
|
|
145
|
+
"signaturePolicy": SignaturePolicyIdentifierModel.from_dict(obj.get("signaturePolicy")) if obj.get("signaturePolicy") is not None else None,
|
|
146
|
+
"certificate": CertificateModel.from_dict(obj.get("certificate")) if obj.get("certificate") is not None else None,
|
|
147
|
+
"signingTime": obj.get("signingTime"),
|
|
148
|
+
"certifiedDateReference": obj.get("certifiedDateReference"),
|
|
149
|
+
"timestamps": [CadesTimestampModel.from_dict(_item) for _item in obj.get("timestamps")] if obj.get("timestamps") is not None else None,
|
|
150
|
+
"validationResults": ValidationResultsModel.from_dict(obj.get("validationResults")) if obj.get("validationResults") is not None else None,
|
|
151
|
+
"commitmentType": CommitmentTypeModel.from_dict(obj.get("commitmentType")) if obj.get("commitmentType") is not None else None,
|
|
152
|
+
"bStamp": SignerBStampModel.from_dict(obj.get("bStamp")) if obj.get("bStamp") is not None else None
|
|
153
|
+
})
|
|
154
|
+
return _obj
|
|
155
|
+
|
|
156
|
+
from restpki_ng_python_client.models.cades_timestamp_model import CadesTimestampModel
|
|
157
|
+
# TODO: Rewrite to not use raise_errors
|
|
158
|
+
CadesSignerModel.model_rebuild(raise_errors=False)
|
|
159
|
+
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rest PKI Core API
|
|
5
|
+
|
|
6
|
+
<b><i>Para Português, <a href=\"https://docs.lacunasoftware.com/pt-br/articles/rest-pki/core/integration/get-started\">clique aqui</a></i></b> <p> <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/core/\">Rest PKI Core</a> is an upcoming version of <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/\">Rest PKI</a> that will have extended compatibility with environments and databases. </p> <p> In addition to Windows Server (which is already supported by Rest PKI), Rest PKI Core will also run on <b>Linux</b> (Debian- and RedHat-based distributions) and on <b>Docker</b>. As for database servers, in addition to SQL Server, <b>PostgreSQL</b> will also be supported. </p> <p> <b>Before getting started, see the integration overview on the <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/core/integration/\">Integration Guide</a></b> </p> <p> For questions regarding the usage of this API, please reach us at <a href=\"https://lacuna.help/\">lacuna.help</a> </p> <h2>Parameters</h2> <p> You will need the following parameters: </p> <ul> <li><b>Endpoint</b>: address of the Rest PKI Core instance that will be used</li> <li><b>API Key</b>: authorization key for using the API</li> </ul> <p> The <span class=\"model\">endpoint</span> must be prefixed to all relative URLs mentioned here. As for the <span class=\"model\">API Key</span>, see how to use it below. </p> <h2>Authentication</h2> <p> The API key must be sent on the <span class=\"model\">X-Api-Key</span> header on each request: </p> <!-- unfortunately, class \"example microlight\" doesn't seem to work here --> <pre style=\"font-size: 12px; padding: 10px; border-radius: 4px; background: #41444e; font-weight: 600; color: #fff;\"> X-Api-Key: yourapp|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </pre> <h2>HTTP Codes</h2> <p> The APIs will return the following HTTP codes: </p> <table> <thead> <tr> <th>Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><strong class=\"model-title\">200 (OK)</strong></td> <td>Request processed successfully. The response is different for each API, please refer to the operation's documentation</td> </tr> <tr> <td><strong class=\"model-title\">400 (Bad Request)</strong></td> <td>Syntax error. For instance, when a required field was not provided</td> </tr> <tr> <td><strong class=\"model-title\">401 (Unauthorized)</strong></td> <td>API key not provided or invalid</td> </tr> <tr> <td><strong class=\"model-title\">403 (Forbidden)</strong></td> <td>API key is valid, but the application has insufficient permissions to complete the requested operation</td> </tr> <tr> <td><strong class=\"model-title\">422 (Unprocessable Entity)</strong></td> <td>API error. The response body is an <a href=\"#model-ErrorModelV2\" class=\"model\">ErrorModelV2</a> </tr> <tr> <td><strong class=\"model-title\">500 (Internal Server Error)</strong></td> <td>An unexpected error occurred. The <span class=\"model\">exceptionCode</span> contained on the response body may be of help for our support team during diagnostic.</td> </tr> </tbody> </table> <h3>Error Codes</h3> <p> Some of the error codes returned in the <span class=\"model\">code</span> field of an <a href=\"#model-ErrorModelV2\" class=\"model\">ErrorModelV2</a> (body of responses with HTTP status code 422) are provided below*: </p> <table> <thead> <tr> <th>Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class=\"model\">DocumentNotFound</td> <td>A referenced document was not found (check the document ID)</td> </tr> <tr> <td class=\"model\">SecurityContextNotFound</td> <td>A referenced security context was not found (check the security context ID)</td> </tr> <tr> <td class=\"model\">SignatureSessionNotFound</td> <td>A referenced signature session was not found (check the signature session ID)</td> </tr> <tr> <td class=\"model\">BadSignatureSessionOperation</td> <td>The operation is invalid for the current signature session or document status. For instance, trying to await the session's completion if it is still <span class=\"model\">Pending</span> results in this error</td> </tr> <tr> <td class=\"model\">BackgroundProcessing</td> <td>The operation cannot be completed at this time because the resource is being processed in background</td> </tr> <tr> <td class=\"model\">SignatureSessionTokenRequired</td> <td>The signature session token was not passed on the <span class=\"model\">X-Signature-Session-Token</span> request header</td> </tr> <tr> <td class=\"model\">BadSignatureSessionToken</td> <td>An invalid signature session token was passed on the <span class=\"model\">X-Signature-Session-Token</span> request header. Check your application for possible corruption of the session token, which may contain characters <span class=\"code\">-</span> (hyphen) and <span class=\"code\">_</span> (underscore)</td> </tr> <tr> <td class=\"model\">ExpiredSignatureSessionToken</td> <td>An expired signature session token was passed on the <span class=\"model\">X-Signature-Session-Token</span> request header. Signature session tokens are normally valid for 4 hours.</td> </tr> </tbody> </table> <p style=\"font-size: 0.9em\"> *The codes shown above are the most common error codes. Nonetheless, this list is not comprehensive. New codes may be added anytime without previous warning. </p> <h2>Culture / Internationalization (i18n)</h2> <p>The <span class=\"model\">Accept-Language</span> request header is observed by this API. The following cultures are supported:</p> <ul> <li><span class=\"code\">en-US</span> (or simply <span class=\"code\">en</span>)</li> <li><span class=\"code\">pt-BR</span> (or simply <span class=\"code\">pt</span>)</li> </ul> <p><i>Notice: error messages are not affected by this header and therefore should not be displayed to users, being better suited for logging.</i></p>
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.1.2
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from pydantic import BaseModel, StrictBool, StrictStr
|
|
23
|
+
from pydantic import Field
|
|
24
|
+
from restpki_ng_python_client.models.cms_content_types import CmsContentTypes
|
|
25
|
+
from restpki_ng_python_client.models.digest_algorithm_and_value_model import DigestAlgorithmAndValueModel
|
|
26
|
+
from restpki_ng_python_client.models.file_model import FileModel
|
|
27
|
+
from restpki_ng_python_client.models.signature_b_stamp_model import SignatureBStampModel
|
|
28
|
+
try:
|
|
29
|
+
from typing import Self
|
|
30
|
+
except ImportError:
|
|
31
|
+
from typing_extensions import Self
|
|
32
|
+
|
|
33
|
+
class CadesTimestampModel(BaseModel):
|
|
34
|
+
"""
|
|
35
|
+
CadesTimestampModel
|
|
36
|
+
""" # noqa: E501
|
|
37
|
+
gen_time: Optional[datetime] = Field(default=None, alias="genTime")
|
|
38
|
+
serial_number: Optional[StrictStr] = Field(default=None, alias="serialNumber")
|
|
39
|
+
message_imprint: Optional[DigestAlgorithmAndValueModel] = Field(default=None, alias="messageImprint")
|
|
40
|
+
encapsulated_content_type: Optional[CmsContentTypes] = Field(default=None, alias="encapsulatedContentType")
|
|
41
|
+
has_encapsulated_content: Optional[StrictBool] = Field(default=None, alias="hasEncapsulatedContent")
|
|
42
|
+
signers: Optional[List[CadesSignerModel]] = None
|
|
43
|
+
encapsulated_content: Optional[FileModel] = Field(default=None, alias="encapsulatedContent")
|
|
44
|
+
audit_package: Optional[FileModel] = Field(default=None, alias="auditPackage")
|
|
45
|
+
b_stamp: Optional[SignatureBStampModel] = Field(default=None, alias="bStamp")
|
|
46
|
+
__properties: ClassVar[List[str]] = ["genTime", "serialNumber", "messageImprint", "encapsulatedContentType", "hasEncapsulatedContent", "signers", "encapsulatedContent", "auditPackage", "bStamp"]
|
|
47
|
+
|
|
48
|
+
model_config = {
|
|
49
|
+
"populate_by_name": True,
|
|
50
|
+
"validate_assignment": True
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_str(self) -> str:
|
|
55
|
+
"""Returns the string representation of the model using alias"""
|
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
57
|
+
|
|
58
|
+
def to_json(self) -> str:
|
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
|
60
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
61
|
+
return json.dumps(self.to_dict())
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Self:
|
|
65
|
+
"""Create an instance of CadesTimestampModel from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
_dict = self.model_dump(
|
|
79
|
+
by_alias=True,
|
|
80
|
+
exclude={
|
|
81
|
+
},
|
|
82
|
+
exclude_none=True,
|
|
83
|
+
)
|
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of message_imprint
|
|
85
|
+
if self.message_imprint:
|
|
86
|
+
_dict['messageImprint'] = self.message_imprint.to_dict()
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of each item in signers (list)
|
|
88
|
+
_items = []
|
|
89
|
+
if self.signers:
|
|
90
|
+
for _item in self.signers:
|
|
91
|
+
if _item:
|
|
92
|
+
_items.append(_item.to_dict())
|
|
93
|
+
_dict['signers'] = _items
|
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of encapsulated_content
|
|
95
|
+
if self.encapsulated_content:
|
|
96
|
+
_dict['encapsulatedContent'] = self.encapsulated_content.to_dict()
|
|
97
|
+
# override the default output from pydantic by calling `to_dict()` of audit_package
|
|
98
|
+
if self.audit_package:
|
|
99
|
+
_dict['auditPackage'] = self.audit_package.to_dict()
|
|
100
|
+
# override the default output from pydantic by calling `to_dict()` of b_stamp
|
|
101
|
+
if self.b_stamp:
|
|
102
|
+
_dict['bStamp'] = self.b_stamp.to_dict()
|
|
103
|
+
# set to None if serial_number (nullable) is None
|
|
104
|
+
# and model_fields_set contains the field
|
|
105
|
+
if self.serial_number is None and "serial_number" in self.model_fields_set:
|
|
106
|
+
_dict['serialNumber'] = None
|
|
107
|
+
|
|
108
|
+
# set to None if signers (nullable) is None
|
|
109
|
+
# and model_fields_set contains the field
|
|
110
|
+
if self.signers is None and "signers" in self.model_fields_set:
|
|
111
|
+
_dict['signers'] = None
|
|
112
|
+
|
|
113
|
+
return _dict
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def from_dict(cls, obj: Dict) -> Self:
|
|
117
|
+
"""Create an instance of CadesTimestampModel from a dict"""
|
|
118
|
+
if obj is None:
|
|
119
|
+
return None
|
|
120
|
+
|
|
121
|
+
if not isinstance(obj, dict):
|
|
122
|
+
return cls.model_validate(obj)
|
|
123
|
+
|
|
124
|
+
_obj = cls.model_validate({
|
|
125
|
+
"genTime": obj.get("genTime"),
|
|
126
|
+
"serialNumber": obj.get("serialNumber"),
|
|
127
|
+
"messageImprint": DigestAlgorithmAndValueModel.from_dict(obj.get("messageImprint")) if obj.get("messageImprint") is not None else None,
|
|
128
|
+
"encapsulatedContentType": obj.get("encapsulatedContentType"),
|
|
129
|
+
"hasEncapsulatedContent": obj.get("hasEncapsulatedContent"),
|
|
130
|
+
"signers": [CadesSignerModel.from_dict(_item) for _item in obj.get("signers")] if obj.get("signers") is not None else None,
|
|
131
|
+
"encapsulatedContent": FileModel.from_dict(obj.get("encapsulatedContent")) if obj.get("encapsulatedContent") is not None else None,
|
|
132
|
+
"auditPackage": FileModel.from_dict(obj.get("auditPackage")) if obj.get("auditPackage") is not None else None,
|
|
133
|
+
"bStamp": SignatureBStampModel.from_dict(obj.get("bStamp")) if obj.get("bStamp") is not None else None
|
|
134
|
+
})
|
|
135
|
+
return _obj
|
|
136
|
+
|
|
137
|
+
from restpki_ng_python_client.models.cades_signer_model import CadesSignerModel
|
|
138
|
+
# TODO: Rewrite to not use raise_errors
|
|
139
|
+
CadesTimestampModel.model_rebuild(raise_errors=False)
|
|
140
|
+
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rest PKI Core API
|
|
5
|
+
|
|
6
|
+
<b><i>Para Português, <a href=\"https://docs.lacunasoftware.com/pt-br/articles/rest-pki/core/integration/get-started\">clique aqui</a></i></b> <p> <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/core/\">Rest PKI Core</a> is an upcoming version of <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/\">Rest PKI</a> that will have extended compatibility with environments and databases. </p> <p> In addition to Windows Server (which is already supported by Rest PKI), Rest PKI Core will also run on <b>Linux</b> (Debian- and RedHat-based distributions) and on <b>Docker</b>. As for database servers, in addition to SQL Server, <b>PostgreSQL</b> will also be supported. </p> <p> <b>Before getting started, see the integration overview on the <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/core/integration/\">Integration Guide</a></b> </p> <p> For questions regarding the usage of this API, please reach us at <a href=\"https://lacuna.help/\">lacuna.help</a> </p> <h2>Parameters</h2> <p> You will need the following parameters: </p> <ul> <li><b>Endpoint</b>: address of the Rest PKI Core instance that will be used</li> <li><b>API Key</b>: authorization key for using the API</li> </ul> <p> The <span class=\"model\">endpoint</span> must be prefixed to all relative URLs mentioned here. As for the <span class=\"model\">API Key</span>, see how to use it below. </p> <h2>Authentication</h2> <p> The API key must be sent on the <span class=\"model\">X-Api-Key</span> header on each request: </p> <!-- unfortunately, class \"example microlight\" doesn't seem to work here --> <pre style=\"font-size: 12px; padding: 10px; border-radius: 4px; background: #41444e; font-weight: 600; color: #fff;\"> X-Api-Key: yourapp|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </pre> <h2>HTTP Codes</h2> <p> The APIs will return the following HTTP codes: </p> <table> <thead> <tr> <th>Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><strong class=\"model-title\">200 (OK)</strong></td> <td>Request processed successfully. The response is different for each API, please refer to the operation's documentation</td> </tr> <tr> <td><strong class=\"model-title\">400 (Bad Request)</strong></td> <td>Syntax error. For instance, when a required field was not provided</td> </tr> <tr> <td><strong class=\"model-title\">401 (Unauthorized)</strong></td> <td>API key not provided or invalid</td> </tr> <tr> <td><strong class=\"model-title\">403 (Forbidden)</strong></td> <td>API key is valid, but the application has insufficient permissions to complete the requested operation</td> </tr> <tr> <td><strong class=\"model-title\">422 (Unprocessable Entity)</strong></td> <td>API error. The response body is an <a href=\"#model-ErrorModelV2\" class=\"model\">ErrorModelV2</a> </tr> <tr> <td><strong class=\"model-title\">500 (Internal Server Error)</strong></td> <td>An unexpected error occurred. The <span class=\"model\">exceptionCode</span> contained on the response body may be of help for our support team during diagnostic.</td> </tr> </tbody> </table> <h3>Error Codes</h3> <p> Some of the error codes returned in the <span class=\"model\">code</span> field of an <a href=\"#model-ErrorModelV2\" class=\"model\">ErrorModelV2</a> (body of responses with HTTP status code 422) are provided below*: </p> <table> <thead> <tr> <th>Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class=\"model\">DocumentNotFound</td> <td>A referenced document was not found (check the document ID)</td> </tr> <tr> <td class=\"model\">SecurityContextNotFound</td> <td>A referenced security context was not found (check the security context ID)</td> </tr> <tr> <td class=\"model\">SignatureSessionNotFound</td> <td>A referenced signature session was not found (check the signature session ID)</td> </tr> <tr> <td class=\"model\">BadSignatureSessionOperation</td> <td>The operation is invalid for the current signature session or document status. For instance, trying to await the session's completion if it is still <span class=\"model\">Pending</span> results in this error</td> </tr> <tr> <td class=\"model\">BackgroundProcessing</td> <td>The operation cannot be completed at this time because the resource is being processed in background</td> </tr> <tr> <td class=\"model\">SignatureSessionTokenRequired</td> <td>The signature session token was not passed on the <span class=\"model\">X-Signature-Session-Token</span> request header</td> </tr> <tr> <td class=\"model\">BadSignatureSessionToken</td> <td>An invalid signature session token was passed on the <span class=\"model\">X-Signature-Session-Token</span> request header. Check your application for possible corruption of the session token, which may contain characters <span class=\"code\">-</span> (hyphen) and <span class=\"code\">_</span> (underscore)</td> </tr> <tr> <td class=\"model\">ExpiredSignatureSessionToken</td> <td>An expired signature session token was passed on the <span class=\"model\">X-Signature-Session-Token</span> request header. Signature session tokens are normally valid for 4 hours.</td> </tr> </tbody> </table> <p style=\"font-size: 0.9em\"> *The codes shown above are the most common error codes. Nonetheless, this list is not comprehensive. New codes may be added anytime without previous warning. </p> <h2>Culture / Internationalization (i18n)</h2> <p>The <span class=\"model\">Accept-Language</span> request header is observed by this API. The following cultures are supported:</p> <ul> <li><span class=\"code\">en-US</span> (or simply <span class=\"code\">en</span>)</li> <li><span class=\"code\">pt-BR</span> (or simply <span class=\"code\">pt</span>)</li> </ul> <p><i>Notice: error messages are not affected by this header and therefore should not be displayed to users, being better suited for logging.</i></p>
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.1.2
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from pydantic import BaseModel, StrictBytes, StrictStr
|
|
23
|
+
from pydantic import Field
|
|
24
|
+
from restpki_ng_python_client.models.name_model import NameModel
|
|
25
|
+
from restpki_ng_python_client.models.pki_brazil_certificate_model import PkiBrazilCertificateModel
|
|
26
|
+
from restpki_ng_python_client.models.pki_italy_certificate_model import PkiItalyCertificateModel
|
|
27
|
+
try:
|
|
28
|
+
from typing import Self
|
|
29
|
+
except ImportError:
|
|
30
|
+
from typing_extensions import Self
|
|
31
|
+
|
|
32
|
+
class CertificateModel(BaseModel):
|
|
33
|
+
"""
|
|
34
|
+
CertificateModel
|
|
35
|
+
""" # noqa: E501
|
|
36
|
+
subject_name: Optional[NameModel] = Field(default=None, alias="subjectName")
|
|
37
|
+
issuer_name: Optional[NameModel] = Field(default=None, alias="issuerName")
|
|
38
|
+
issuer_display_name: Optional[StrictStr] = Field(default=None, alias="issuerDisplayName")
|
|
39
|
+
serial_number: Optional[StrictStr] = Field(default=None, alias="serialNumber")
|
|
40
|
+
validity_start: Optional[datetime] = Field(default=None, alias="validityStart")
|
|
41
|
+
validity_end: Optional[datetime] = Field(default=None, alias="validityEnd")
|
|
42
|
+
issuer: Optional[CertificateModel] = None
|
|
43
|
+
pki_brazil: Optional[PkiBrazilCertificateModel] = Field(default=None, alias="pkiBrazil")
|
|
44
|
+
pki_italy: Optional[PkiItalyCertificateModel] = Field(default=None, alias="pkiItaly")
|
|
45
|
+
binary_thumbprint_sha256: Optional[Union[StrictBytes, StrictStr]] = Field(default=None, alias="binaryThumbprintSHA256")
|
|
46
|
+
thumbprint: Optional[StrictStr] = None
|
|
47
|
+
thumbprint_sha256: Optional[StrictStr] = Field(default=None, alias="thumbprintSHA256")
|
|
48
|
+
subject_common_name: Optional[StrictStr] = Field(default=None, alias="subjectCommonName")
|
|
49
|
+
subject_display_name: Optional[StrictStr] = Field(default=None, alias="subjectDisplayName")
|
|
50
|
+
subject_identifier: Optional[StrictStr] = Field(default=None, alias="subjectIdentifier")
|
|
51
|
+
email_address: Optional[StrictStr] = Field(default=None, alias="emailAddress")
|
|
52
|
+
organization: Optional[StrictStr] = None
|
|
53
|
+
organization_identifier: Optional[StrictStr] = Field(default=None, alias="organizationIdentifier")
|
|
54
|
+
__properties: ClassVar[List[str]] = ["subjectName", "issuerName", "issuerDisplayName", "serialNumber", "validityStart", "validityEnd", "issuer", "pkiBrazil", "pkiItaly", "binaryThumbprintSHA256", "thumbprint", "thumbprintSHA256", "subjectCommonName", "subjectDisplayName", "subjectIdentifier", "emailAddress", "organization", "organizationIdentifier"]
|
|
55
|
+
|
|
56
|
+
model_config = {
|
|
57
|
+
"populate_by_name": True,
|
|
58
|
+
"validate_assignment": True
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def to_str(self) -> str:
|
|
63
|
+
"""Returns the string representation of the model using alias"""
|
|
64
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
65
|
+
|
|
66
|
+
def to_json(self) -> str:
|
|
67
|
+
"""Returns the JSON representation of the model using alias"""
|
|
68
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
69
|
+
return json.dumps(self.to_dict())
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_json(cls, json_str: str) -> Self:
|
|
73
|
+
"""Create an instance of CertificateModel from a JSON string"""
|
|
74
|
+
return cls.from_dict(json.loads(json_str))
|
|
75
|
+
|
|
76
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
77
|
+
"""Return the dictionary representation of the model using alias.
|
|
78
|
+
|
|
79
|
+
This has the following differences from calling pydantic's
|
|
80
|
+
`self.model_dump(by_alias=True)`:
|
|
81
|
+
|
|
82
|
+
* `None` is only added to the output dict for nullable fields that
|
|
83
|
+
were set at model initialization. Other fields with value `None`
|
|
84
|
+
are ignored.
|
|
85
|
+
"""
|
|
86
|
+
_dict = self.model_dump(
|
|
87
|
+
by_alias=True,
|
|
88
|
+
exclude={
|
|
89
|
+
},
|
|
90
|
+
exclude_none=True,
|
|
91
|
+
)
|
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of subject_name
|
|
93
|
+
if self.subject_name:
|
|
94
|
+
_dict['subjectName'] = self.subject_name.to_dict()
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of issuer_name
|
|
96
|
+
if self.issuer_name:
|
|
97
|
+
_dict['issuerName'] = self.issuer_name.to_dict()
|
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of issuer
|
|
99
|
+
if self.issuer:
|
|
100
|
+
_dict['issuer'] = self.issuer.to_dict()
|
|
101
|
+
# override the default output from pydantic by calling `to_dict()` of pki_brazil
|
|
102
|
+
if self.pki_brazil:
|
|
103
|
+
_dict['pkiBrazil'] = self.pki_brazil.to_dict()
|
|
104
|
+
# override the default output from pydantic by calling `to_dict()` of pki_italy
|
|
105
|
+
if self.pki_italy:
|
|
106
|
+
_dict['pkiItaly'] = self.pki_italy.to_dict()
|
|
107
|
+
# set to None if issuer_display_name (nullable) is None
|
|
108
|
+
# and model_fields_set contains the field
|
|
109
|
+
if self.issuer_display_name is None and "issuer_display_name" in self.model_fields_set:
|
|
110
|
+
_dict['issuerDisplayName'] = None
|
|
111
|
+
|
|
112
|
+
# set to None if serial_number (nullable) is None
|
|
113
|
+
# and model_fields_set contains the field
|
|
114
|
+
if self.serial_number is None and "serial_number" in self.model_fields_set:
|
|
115
|
+
_dict['serialNumber'] = None
|
|
116
|
+
|
|
117
|
+
# set to None if binary_thumbprint_sha256 (nullable) is None
|
|
118
|
+
# and model_fields_set contains the field
|
|
119
|
+
if self.binary_thumbprint_sha256 is None and "binary_thumbprint_sha256" in self.model_fields_set:
|
|
120
|
+
_dict['binaryThumbprintSHA256'] = None
|
|
121
|
+
|
|
122
|
+
# set to None if thumbprint (nullable) is None
|
|
123
|
+
# and model_fields_set contains the field
|
|
124
|
+
if self.thumbprint is None and "thumbprint" in self.model_fields_set:
|
|
125
|
+
_dict['thumbprint'] = None
|
|
126
|
+
|
|
127
|
+
# set to None if thumbprint_sha256 (nullable) is None
|
|
128
|
+
# and model_fields_set contains the field
|
|
129
|
+
if self.thumbprint_sha256 is None and "thumbprint_sha256" in self.model_fields_set:
|
|
130
|
+
_dict['thumbprintSHA256'] = None
|
|
131
|
+
|
|
132
|
+
# set to None if subject_common_name (nullable) is None
|
|
133
|
+
# and model_fields_set contains the field
|
|
134
|
+
if self.subject_common_name is None and "subject_common_name" in self.model_fields_set:
|
|
135
|
+
_dict['subjectCommonName'] = None
|
|
136
|
+
|
|
137
|
+
# set to None if subject_display_name (nullable) is None
|
|
138
|
+
# and model_fields_set contains the field
|
|
139
|
+
if self.subject_display_name is None and "subject_display_name" in self.model_fields_set:
|
|
140
|
+
_dict['subjectDisplayName'] = None
|
|
141
|
+
|
|
142
|
+
# set to None if subject_identifier (nullable) is None
|
|
143
|
+
# and model_fields_set contains the field
|
|
144
|
+
if self.subject_identifier is None and "subject_identifier" in self.model_fields_set:
|
|
145
|
+
_dict['subjectIdentifier'] = None
|
|
146
|
+
|
|
147
|
+
# set to None if email_address (nullable) is None
|
|
148
|
+
# and model_fields_set contains the field
|
|
149
|
+
if self.email_address is None and "email_address" in self.model_fields_set:
|
|
150
|
+
_dict['emailAddress'] = None
|
|
151
|
+
|
|
152
|
+
# set to None if organization (nullable) is None
|
|
153
|
+
# and model_fields_set contains the field
|
|
154
|
+
if self.organization is None and "organization" in self.model_fields_set:
|
|
155
|
+
_dict['organization'] = None
|
|
156
|
+
|
|
157
|
+
# set to None if organization_identifier (nullable) is None
|
|
158
|
+
# and model_fields_set contains the field
|
|
159
|
+
if self.organization_identifier is None and "organization_identifier" in self.model_fields_set:
|
|
160
|
+
_dict['organizationIdentifier'] = None
|
|
161
|
+
|
|
162
|
+
return _dict
|
|
163
|
+
|
|
164
|
+
@classmethod
|
|
165
|
+
def from_dict(cls, obj: Dict) -> Self:
|
|
166
|
+
"""Create an instance of CertificateModel from a dict"""
|
|
167
|
+
if obj is None:
|
|
168
|
+
return None
|
|
169
|
+
|
|
170
|
+
if not isinstance(obj, dict):
|
|
171
|
+
return cls.model_validate(obj)
|
|
172
|
+
|
|
173
|
+
_obj = cls.model_validate({
|
|
174
|
+
"subjectName": NameModel.from_dict(obj.get("subjectName")) if obj.get("subjectName") is not None else None,
|
|
175
|
+
"issuerName": NameModel.from_dict(obj.get("issuerName")) if obj.get("issuerName") is not None else None,
|
|
176
|
+
"issuerDisplayName": obj.get("issuerDisplayName"),
|
|
177
|
+
"serialNumber": obj.get("serialNumber"),
|
|
178
|
+
"validityStart": obj.get("validityStart"),
|
|
179
|
+
"validityEnd": obj.get("validityEnd"),
|
|
180
|
+
"issuer": CertificateModel.from_dict(obj.get("issuer")) if obj.get("issuer") is not None else None,
|
|
181
|
+
"pkiBrazil": PkiBrazilCertificateModel.from_dict(obj.get("pkiBrazil")) if obj.get("pkiBrazil") is not None else None,
|
|
182
|
+
"pkiItaly": PkiItalyCertificateModel.from_dict(obj.get("pkiItaly")) if obj.get("pkiItaly") is not None else None,
|
|
183
|
+
"binaryThumbprintSHA256": obj.get("binaryThumbprintSHA256"),
|
|
184
|
+
"thumbprint": obj.get("thumbprint"),
|
|
185
|
+
"thumbprintSHA256": obj.get("thumbprintSHA256"),
|
|
186
|
+
"subjectCommonName": obj.get("subjectCommonName"),
|
|
187
|
+
"subjectDisplayName": obj.get("subjectDisplayName"),
|
|
188
|
+
"subjectIdentifier": obj.get("subjectIdentifier"),
|
|
189
|
+
"emailAddress": obj.get("emailAddress"),
|
|
190
|
+
"organization": obj.get("organization"),
|
|
191
|
+
"organizationIdentifier": obj.get("organizationIdentifier")
|
|
192
|
+
})
|
|
193
|
+
return _obj
|
|
194
|
+
|
|
195
|
+
# TODO: Rewrite to not use raise_errors
|
|
196
|
+
CertificateModel.model_rebuild(raise_errors=False)
|
|
197
|
+
|