onfido-python 3.4.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.
- onfido/__init__.py +311 -0
- onfido/api/__init__.py +5 -0
- onfido/api/default_api.py +17488 -0
- onfido/api_client.py +770 -0
- onfido/api_response.py +21 -0
- onfido/configuration.py +460 -0
- onfido/exceptions.py +199 -0
- onfido/models/__init__.py +291 -0
- onfido/models/address.py +169 -0
- onfido/models/address_builder.py +169 -0
- onfido/models/address_shared.py +169 -0
- onfido/models/addresses_list.py +108 -0
- onfido/models/applicant.py +162 -0
- onfido/models/applicant_builder.py +152 -0
- onfido/models/applicant_create.py +117 -0
- onfido/models/applicant_request.py +116 -0
- onfido/models/applicant_response.py +146 -0
- onfido/models/applicant_shared.py +115 -0
- onfido/models/applicant_update.py +123 -0
- onfido/models/applicant_updater.py +158 -0
- onfido/models/applicants_list.py +108 -0
- onfido/models/check.py +147 -0
- onfido/models/check_builder.py +127 -0
- onfido/models/check_request.py +119 -0
- onfido/models/check_response.py +137 -0
- onfido/models/check_shared.py +108 -0
- onfido/models/checks_list.py +108 -0
- onfido/models/complete_task_builder.py +104 -0
- onfido/models/complete_task_data_builder.py +143 -0
- onfido/models/consent_item.py +109 -0
- onfido/models/consents_builder.py +98 -0
- onfido/models/country_codes.py +285 -0
- onfido/models/device_intelligence_breakdown.py +110 -0
- onfido/models/device_intelligence_breakdown_breakdown.py +104 -0
- onfido/models/device_intelligence_breakdown_breakdown_device.py +104 -0
- onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.py +114 -0
- onfido/models/device_intelligence_breakdown_properties.py +116 -0
- onfido/models/device_intelligence_breakdown_properties_device.py +189 -0
- onfido/models/device_intelligence_breakdown_properties_geolocation.py +105 -0
- onfido/models/device_intelligence_breakdown_properties_ip.py +106 -0
- onfido/models/device_intelligence_report.py +135 -0
- onfido/models/document.py +142 -0
- onfido/models/document_breakdown.py +152 -0
- onfido/models/document_breakdown_age_validation.py +106 -0
- onfido/models/document_breakdown_age_validation_breakdown.py +104 -0
- onfido/models/document_breakdown_compromised_document.py +106 -0
- onfido/models/document_breakdown_compromised_document_breakdown.py +109 -0
- onfido/models/document_breakdown_data_comparison.py +106 -0
- onfido/models/document_breakdown_data_comparison_breakdown.py +139 -0
- onfido/models/document_breakdown_data_comparison_breakdown_issuing_country.py +102 -0
- onfido/models/document_breakdown_data_consistency.py +106 -0
- onfido/models/document_breakdown_data_consistency_breakdown.py +149 -0
- onfido/models/document_breakdown_data_validation.py +106 -0
- onfido/models/document_breakdown_data_validation_breakdown.py +136 -0
- onfido/models/document_breakdown_data_validation_breakdown_document_expiration.py +102 -0
- onfido/models/document_breakdown_data_validation_breakdown_expiry_date.py +102 -0
- onfido/models/document_breakdown_image_integrity.py +106 -0
- onfido/models/document_breakdown_image_integrity_breakdown.py +122 -0
- onfido/models/document_breakdown_image_integrity_breakdown_colour_picture.py +102 -0
- onfido/models/document_breakdown_image_integrity_breakdown_conclusive_document_quality.py +106 -0
- onfido/models/document_breakdown_image_integrity_breakdown_image_quality.py +106 -0
- onfido/models/document_breakdown_image_integrity_breakdown_supported_document.py +102 -0
- onfido/models/document_breakdown_issuing_authority.py +106 -0
- onfido/models/document_breakdown_issuing_authority_breakdown.py +110 -0
- onfido/models/document_breakdown_issuing_authority_breakdown_nfc_active_authentication.py +102 -0
- onfido/models/document_breakdown_issuing_authority_breakdown_nfc_passive_authentication.py +102 -0
- onfido/models/document_breakdown_police_record.py +100 -0
- onfido/models/document_breakdown_visual_authenticity.py +106 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown.py +146 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown_digital_tampering.py +102 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown_face_detection.py +102 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown_fonts.py +102 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown_original_document_present.py +106 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown_other.py +102 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown_picture_face_integrity.py +102 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown_security_features.py +102 -0
- onfido/models/document_breakdown_visual_authenticity_breakdown_template.py +102 -0
- onfido/models/document_cdq_reasons.py +114 -0
- onfido/models/document_iq_reasons.py +118 -0
- onfido/models/document_odp_reasons.py +106 -0
- onfido/models/document_properties.py +255 -0
- onfido/models/document_properties_address_lines.py +110 -0
- onfido/models/document_properties_barcode_inner.py +135 -0
- onfido/models/document_properties_document_classification.py +104 -0
- onfido/models/document_properties_document_numbers_inner.py +102 -0
- onfido/models/document_properties_driving_licence_information.py +107 -0
- onfido/models/document_properties_extracted_data.py +141 -0
- onfido/models/document_properties_nfc.py +125 -0
- onfido/models/document_report.py +141 -0
- onfido/models/document_response.py +111 -0
- onfido/models/document_shared.py +129 -0
- onfido/models/document_types.py +60 -0
- onfido/models/document_video_report.py +141 -0
- onfido/models/document_video_with_address_information_report.py +141 -0
- onfido/models/document_with_address_information_report.py +141 -0
- onfido/models/document_with_driver_verification_report.py +141 -0
- onfido/models/document_with_driver_verification_report_all_of_properties.py +279 -0
- onfido/models/document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle.py +105 -0
- onfido/models/document_with_driver_verification_report_all_of_properties_all_of_vehicle_class_details_inner.py +107 -0
- onfido/models/document_with_driving_licence_information_report.py +141 -0
- onfido/models/documents_list.py +108 -0
- onfido/models/error.py +104 -0
- onfido/models/error1.py +106 -0
- onfido/models/error_properties.py +104 -0
- onfido/models/error_properties1.py +102 -0
- onfido/models/extract_request.py +100 -0
- onfido/models/extraction.py +112 -0
- onfido/models/extraction_document_classification.py +120 -0
- onfido/models/extraction_extracted_data.py +176 -0
- onfido/models/facial_similarity_motion_breakdown.py +116 -0
- onfido/models/facial_similarity_motion_breakdown_face_comparison.py +106 -0
- onfido/models/facial_similarity_motion_breakdown_image_integrity.py +106 -0
- onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown.py +110 -0
- onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_face_detected.py +102 -0
- onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_source_integrity.py +106 -0
- onfido/models/facial_similarity_motion_breakdown_visual_authenticity.py +106 -0
- onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown.py +110 -0
- onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection.py +106 -0
- onfido/models/facial_similarity_motion_properties.py +100 -0
- onfido/models/facial_similarity_motion_report.py +141 -0
- onfido/models/facial_similarity_photo_breakdown.py +116 -0
- onfido/models/facial_similarity_photo_breakdown_face_comparison.py +106 -0
- onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown.py +104 -0
- onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match.py +106 -0
- onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match_properties.py +102 -0
- onfido/models/facial_similarity_photo_breakdown_image_integrity.py +106 -0
- onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown.py +110 -0
- onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_face_detected.py +102 -0
- onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_source_integrity.py +106 -0
- onfido/models/facial_similarity_photo_breakdown_visual_authenticity.py +106 -0
- onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown.py +104 -0
- onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection.py +106 -0
- onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection_properties.py +100 -0
- onfido/models/facial_similarity_photo_fully_auto_breakdown.py +116 -0
- onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity.py +106 -0
- onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown.py +110 -0
- onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity.py +106 -0
- onfido/models/facial_similarity_photo_fully_auto_properties.py +100 -0
- onfido/models/facial_similarity_photo_fully_auto_report.py +141 -0
- onfido/models/facial_similarity_photo_properties.py +100 -0
- onfido/models/facial_similarity_photo_report.py +141 -0
- onfido/models/facial_similarity_video_breakdown.py +116 -0
- onfido/models/facial_similarity_video_breakdown_face_comparison.py +106 -0
- onfido/models/facial_similarity_video_breakdown_image_integrity.py +106 -0
- onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown.py +110 -0
- onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_face_detected.py +102 -0
- onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_source_integrity.py +106 -0
- onfido/models/facial_similarity_video_breakdown_visual_authenticity.py +106 -0
- onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown.py +110 -0
- onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected.py +102 -0
- onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection.py +106 -0
- onfido/models/facial_similarity_video_properties.py +100 -0
- onfido/models/facial_similarity_video_report.py +141 -0
- onfido/models/id_number.py +114 -0
- onfido/models/id_photo.py +113 -0
- onfido/models/id_photo_response.py +113 -0
- onfido/models/id_photos_list.py +108 -0
- onfido/models/identity_enhanced_breakdown.py +122 -0
- onfido/models/identity_enhanced_breakdown_address.py +106 -0
- onfido/models/identity_enhanced_breakdown_address_breakdown.py +116 -0
- onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies.py +106 -0
- onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies_properties.py +100 -0
- onfido/models/identity_enhanced_breakdown_address_breakdown_telephone_database.py +102 -0
- onfido/models/identity_enhanced_breakdown_address_breakdown_voting_register.py +102 -0
- onfido/models/identity_enhanced_breakdown_date_of_birth.py +106 -0
- onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown.py +110 -0
- onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_credit_agencies.py +102 -0
- onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_voting_register.py +102 -0
- onfido/models/identity_enhanced_breakdown_mortality.py +100 -0
- onfido/models/identity_enhanced_breakdown_sources.py +106 -0
- onfido/models/identity_enhanced_breakdown_sources_breakdown.py +104 -0
- onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources.py +106 -0
- onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources_properties.py +100 -0
- onfido/models/identity_enhanced_properties.py +110 -0
- onfido/models/identity_enhanced_properties_matched_addresses_inner.py +102 -0
- onfido/models/identity_enhanced_report.py +141 -0
- onfido/models/india_pan_report.py +141 -0
- onfido/models/india_pan_report_all_of_breakdown.py +104 -0
- onfido/models/india_pan_report_all_of_breakdown_device.py +104 -0
- onfido/models/india_pan_report_all_of_breakdown_device_breakdown.py +109 -0
- onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid.py +100 -0
- onfido/models/india_pan_report_all_of_properties.py +104 -0
- onfido/models/india_pan_report_all_of_properties_device.py +102 -0
- onfido/models/known_faces_breakdown.py +110 -0
- onfido/models/known_faces_breakdown_image_integrity.py +100 -0
- onfido/models/known_faces_breakdown_previously_seen_faces.py +100 -0
- onfido/models/known_faces_properties.py +108 -0
- onfido/models/known_faces_properties_matches_inner.py +108 -0
- onfido/models/known_faces_report.py +141 -0
- onfido/models/live_photo.py +113 -0
- onfido/models/live_photo_response.py +113 -0
- onfido/models/live_photos_list.py +108 -0
- onfido/models/live_video.py +115 -0
- onfido/models/live_videos_list.py +108 -0
- onfido/models/location.py +103 -0
- onfido/models/location_builder.py +103 -0
- onfido/models/location_shared.py +103 -0
- onfido/models/motion_capture.py +113 -0
- onfido/models/motion_captures_list.py +108 -0
- onfido/models/photo_auto_reasons.py +108 -0
- onfido/models/photo_reasons.py +108 -0
- onfido/models/proof_of_address_breakdown.py +116 -0
- onfido/models/proof_of_address_breakdown_data_comparison.py +106 -0
- onfido/models/proof_of_address_breakdown_data_comparison_breakdown.py +114 -0
- onfido/models/proof_of_address_breakdown_document_classification.py +106 -0
- onfido/models/proof_of_address_breakdown_document_classification_breakdown.py +104 -0
- onfido/models/proof_of_address_breakdown_image_integrity.py +106 -0
- onfido/models/proof_of_address_breakdown_image_integrity_breakdown.py +104 -0
- onfido/models/proof_of_address_properties.py +125 -0
- onfido/models/proof_of_address_report.py +141 -0
- onfido/models/repeat_attempts_list.py +117 -0
- onfido/models/repeat_attempts_list_repeat_attempts_inner.py +143 -0
- onfido/models/report.py +621 -0
- onfido/models/report_document.py +100 -0
- onfido/models/report_name.py +56 -0
- onfido/models/report_result.py +38 -0
- onfido/models/report_shared.py +129 -0
- onfido/models/report_status.py +40 -0
- onfido/models/report_sub_result.py +39 -0
- onfido/models/reports_list.py +108 -0
- onfido/models/results_feedback.py +116 -0
- onfido/models/sdk_token.py +100 -0
- onfido/models/sdk_token_builder.py +106 -0
- onfido/models/sdk_token_request.py +106 -0
- onfido/models/sdk_token_response.py +100 -0
- onfido/models/task.py +146 -0
- onfido/models/task_item.py +128 -0
- onfido/models/timeline_file_reference.py +102 -0
- onfido/models/us_driving_licence_breakdown.py +116 -0
- onfido/models/us_driving_licence_breakdown_address.py +106 -0
- onfido/models/us_driving_licence_breakdown_address_breakdown.py +129 -0
- onfido/models/us_driving_licence_breakdown_document.py +106 -0
- onfido/models/us_driving_licence_breakdown_document_breakdown.py +119 -0
- onfido/models/us_driving_licence_breakdown_personal.py +106 -0
- onfido/models/us_driving_licence_breakdown_personal_breakdown.py +164 -0
- onfido/models/us_driving_licence_builder.py +185 -0
- onfido/models/us_driving_licence_report.py +141 -0
- onfido/models/us_driving_licence_shared.py +185 -0
- onfido/models/video_reasons.py +106 -0
- onfido/models/watchlist_aml_breakdown.py +122 -0
- onfido/models/watchlist_aml_breakdown_adverse_media.py +100 -0
- onfido/models/watchlist_aml_breakdown_legal_and_regulatory_warnings.py +100 -0
- onfido/models/watchlist_aml_breakdown_politically_exposed_person.py +100 -0
- onfido/models/watchlist_aml_breakdown_sanction.py +100 -0
- onfido/models/watchlist_aml_properties.py +100 -0
- onfido/models/watchlist_aml_report.py +141 -0
- onfido/models/watchlist_enhanced_breakdown.py +122 -0
- onfido/models/watchlist_enhanced_properties.py +100 -0
- onfido/models/watchlist_enhanced_report.py +141 -0
- onfido/models/watchlist_monitor.py +120 -0
- onfido/models/watchlist_monitor_builder.py +111 -0
- onfido/models/watchlist_monitor_match.py +102 -0
- onfido/models/watchlist_monitor_matches_list.py +108 -0
- onfido/models/watchlist_monitor_matches_updater.py +102 -0
- onfido/models/watchlist_monitor_response.py +107 -0
- onfido/models/watchlist_monitor_shared.py +111 -0
- onfido/models/watchlist_monitors_list.py +108 -0
- onfido/models/watchlist_peps_only_report.py +141 -0
- onfido/models/watchlist_sanctions_only_report.py +141 -0
- onfido/models/watchlist_standard_breakdown.py +116 -0
- onfido/models/watchlist_standard_properties.py +100 -0
- onfido/models/watchlist_standard_report.py +141 -0
- onfido/models/webhook.py +115 -0
- onfido/models/webhook_builder.py +109 -0
- onfido/models/webhook_create.py +100 -0
- onfido/models/webhook_event.py +104 -0
- onfido/models/webhook_event_payload.py +111 -0
- onfido/models/webhook_event_payload_object.py +109 -0
- onfido/models/webhook_event_type.py +52 -0
- onfido/models/webhook_resend.py +108 -0
- onfido/models/webhook_response.py +106 -0
- onfido/models/webhook_shared.py +107 -0
- onfido/models/webhook_update.py +100 -0
- onfido/models/webhook_updater.py +109 -0
- onfido/models/webhooks_list.py +108 -0
- onfido/models/webhooks_resend_item.py +103 -0
- onfido/models/workflow_run.py +158 -0
- onfido/models/workflow_run_builder.py +125 -0
- onfido/models/workflow_run_request.py +100 -0
- onfido/models/workflow_run_response.py +133 -0
- onfido/models/workflow_run_response_error.py +102 -0
- onfido/models/workflow_run_shared.py +123 -0
- onfido/models/workflow_run_shared_link.py +119 -0
- onfido/py.typed +0 -0
- onfido/rest.py +258 -0
- onfido/webhook_event_verifier.py +27 -0
- onfido_python-3.4.0.dist-info/LICENSE +21 -0
- onfido_python-3.4.0.dist-info/METADATA +18 -0
- onfido_python-3.4.0.dist-info/RECORD +291 -0
- onfido_python-3.4.0.dist-info/WHEEL +5 -0
- onfido_python-3.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Onfido API v3.6
|
|
5
|
+
|
|
6
|
+
The Onfido API (v3.6)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v3.6
|
|
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 pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from onfido.models.country_codes import CountryCodes
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class AddressShared(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
AddressShared
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
flat_number: Optional[StrictStr] = Field(default=None, description="The flat number of this address")
|
|
32
|
+
building_number: Optional[StrictStr] = Field(default=None, description="The building number of this address")
|
|
33
|
+
building_name: Optional[StrictStr] = Field(default=None, description="The building name of this address")
|
|
34
|
+
street: Optional[StrictStr] = Field(default=None, description="The street of the applicant's address")
|
|
35
|
+
sub_street: Optional[StrictStr] = Field(default=None, description="The sub-street of the applicant's address")
|
|
36
|
+
town: Optional[StrictStr] = Field(default=None, description="The town of the applicant's address")
|
|
37
|
+
postcode: StrictStr = Field(description="The postcode or ZIP of the applicant's address")
|
|
38
|
+
country: CountryCodes = Field(description="The 3 character ISO country code of this address. For example, GBR is the country code for the United Kingdom")
|
|
39
|
+
state: Optional[StrictStr] = Field(default=None, description="The address state. US states must use the USPS abbreviation (see also ISO 3166-2:US), for example AK, CA, or TX.")
|
|
40
|
+
line1: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Line 1 of the applicant's address")
|
|
41
|
+
line2: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Line 2 of the applicant's address")
|
|
42
|
+
line3: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Line 3 of the applicant's address")
|
|
43
|
+
additional_properties: Dict[str, Any] = {}
|
|
44
|
+
__properties: ClassVar[List[str]] = ["flat_number", "building_number", "building_name", "street", "sub_street", "town", "postcode", "country", "state", "line1", "line2", "line3"]
|
|
45
|
+
|
|
46
|
+
@field_validator('line1')
|
|
47
|
+
def line1_validate_regular_expression(cls, value):
|
|
48
|
+
"""Validates the regular expression"""
|
|
49
|
+
if value is None:
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
if not re.match(r"^[^!$%^*=<>]*$", value):
|
|
53
|
+
raise ValueError(r"must validate the regular expression /^[^!$%^*=<>]*$/")
|
|
54
|
+
return value
|
|
55
|
+
|
|
56
|
+
@field_validator('line2')
|
|
57
|
+
def line2_validate_regular_expression(cls, value):
|
|
58
|
+
"""Validates the regular expression"""
|
|
59
|
+
if value is None:
|
|
60
|
+
return value
|
|
61
|
+
|
|
62
|
+
if not re.match(r"^[^!$%^*=<>]*$", value):
|
|
63
|
+
raise ValueError(r"must validate the regular expression /^[^!$%^*=<>]*$/")
|
|
64
|
+
return value
|
|
65
|
+
|
|
66
|
+
@field_validator('line3')
|
|
67
|
+
def line3_validate_regular_expression(cls, value):
|
|
68
|
+
"""Validates the regular expression"""
|
|
69
|
+
if value is None:
|
|
70
|
+
return value
|
|
71
|
+
|
|
72
|
+
if not re.match(r"^[^!$%^*=<>]*$", value):
|
|
73
|
+
raise ValueError(r"must validate the regular expression /^[^!$%^*=<>]*$/")
|
|
74
|
+
return value
|
|
75
|
+
|
|
76
|
+
model_config = ConfigDict(
|
|
77
|
+
populate_by_name=True,
|
|
78
|
+
validate_assignment=True,
|
|
79
|
+
protected_namespaces=(),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def to_str(self) -> str:
|
|
84
|
+
"""Returns the string representation of the model using alias"""
|
|
85
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
86
|
+
|
|
87
|
+
def to_json(self) -> str:
|
|
88
|
+
"""Returns the JSON representation of the model using alias"""
|
|
89
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
90
|
+
return json.dumps(self.to_dict())
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
94
|
+
"""Create an instance of AddressShared from a JSON string"""
|
|
95
|
+
return cls.from_dict(json.loads(json_str))
|
|
96
|
+
|
|
97
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
98
|
+
"""Return the dictionary representation of the model using alias.
|
|
99
|
+
|
|
100
|
+
This has the following differences from calling pydantic's
|
|
101
|
+
`self.model_dump(by_alias=True)`:
|
|
102
|
+
|
|
103
|
+
* `None` is only added to the output dict for nullable fields that
|
|
104
|
+
were set at model initialization. Other fields with value `None`
|
|
105
|
+
are ignored.
|
|
106
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
107
|
+
"""
|
|
108
|
+
excluded_fields: Set[str] = set([
|
|
109
|
+
"additional_properties",
|
|
110
|
+
])
|
|
111
|
+
|
|
112
|
+
_dict = self.model_dump(
|
|
113
|
+
by_alias=True,
|
|
114
|
+
exclude=excluded_fields,
|
|
115
|
+
exclude_none=True,
|
|
116
|
+
)
|
|
117
|
+
# puts key-value pairs in additional_properties in the top level
|
|
118
|
+
if self.additional_properties is not None:
|
|
119
|
+
for _key, _value in self.additional_properties.items():
|
|
120
|
+
_dict[_key] = _value
|
|
121
|
+
|
|
122
|
+
# set to None if line1 (nullable) is None
|
|
123
|
+
# and model_fields_set contains the field
|
|
124
|
+
if self.line1 is None and "line1" in self.model_fields_set:
|
|
125
|
+
_dict['line1'] = None
|
|
126
|
+
|
|
127
|
+
# set to None if line2 (nullable) is None
|
|
128
|
+
# and model_fields_set contains the field
|
|
129
|
+
if self.line2 is None and "line2" in self.model_fields_set:
|
|
130
|
+
_dict['line2'] = None
|
|
131
|
+
|
|
132
|
+
# set to None if line3 (nullable) is None
|
|
133
|
+
# and model_fields_set contains the field
|
|
134
|
+
if self.line3 is None and "line3" in self.model_fields_set:
|
|
135
|
+
_dict['line3'] = None
|
|
136
|
+
|
|
137
|
+
return _dict
|
|
138
|
+
|
|
139
|
+
@classmethod
|
|
140
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
141
|
+
"""Create an instance of AddressShared from a dict"""
|
|
142
|
+
if obj is None:
|
|
143
|
+
return None
|
|
144
|
+
|
|
145
|
+
if not isinstance(obj, dict):
|
|
146
|
+
return cls.model_validate(obj)
|
|
147
|
+
|
|
148
|
+
_obj = cls.model_validate({
|
|
149
|
+
"flat_number": obj.get("flat_number"),
|
|
150
|
+
"building_number": obj.get("building_number"),
|
|
151
|
+
"building_name": obj.get("building_name"),
|
|
152
|
+
"street": obj.get("street"),
|
|
153
|
+
"sub_street": obj.get("sub_street"),
|
|
154
|
+
"town": obj.get("town"),
|
|
155
|
+
"postcode": obj.get("postcode"),
|
|
156
|
+
"country": obj.get("country"),
|
|
157
|
+
"state": obj.get("state"),
|
|
158
|
+
"line1": obj.get("line1"),
|
|
159
|
+
"line2": obj.get("line2"),
|
|
160
|
+
"line3": obj.get("line3")
|
|
161
|
+
})
|
|
162
|
+
# store additional fields in additional_properties
|
|
163
|
+
for _key in obj.keys():
|
|
164
|
+
if _key not in cls.__properties:
|
|
165
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
166
|
+
|
|
167
|
+
return _obj
|
|
168
|
+
|
|
169
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Onfido API v3.6
|
|
5
|
+
|
|
6
|
+
The Onfido API (v3.6)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v3.6
|
|
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 pydantic import BaseModel, ConfigDict
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from onfido.models.address import Address
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class AddressesList(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
AddressesList
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
addresses: Optional[List[Address]] = None
|
|
31
|
+
additional_properties: Dict[str, Any] = {}
|
|
32
|
+
__properties: ClassVar[List[str]] = ["addresses"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of AddressesList from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
"additional_properties",
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in addresses (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.addresses:
|
|
78
|
+
for _item in self.addresses:
|
|
79
|
+
if _item:
|
|
80
|
+
_items.append(_item.to_dict())
|
|
81
|
+
_dict['addresses'] = _items
|
|
82
|
+
# puts key-value pairs in additional_properties in the top level
|
|
83
|
+
if self.additional_properties is not None:
|
|
84
|
+
for _key, _value in self.additional_properties.items():
|
|
85
|
+
_dict[_key] = _value
|
|
86
|
+
|
|
87
|
+
return _dict
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
91
|
+
"""Create an instance of AddressesList from a dict"""
|
|
92
|
+
if obj is None:
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
if not isinstance(obj, dict):
|
|
96
|
+
return cls.model_validate(obj)
|
|
97
|
+
|
|
98
|
+
_obj = cls.model_validate({
|
|
99
|
+
"addresses": [Address.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None
|
|
100
|
+
})
|
|
101
|
+
# store additional fields in additional_properties
|
|
102
|
+
for _key in obj.keys():
|
|
103
|
+
if _key not in cls.__properties:
|
|
104
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
105
|
+
|
|
106
|
+
return _obj
|
|
107
|
+
|
|
108
|
+
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Onfido API v3.6
|
|
5
|
+
|
|
6
|
+
The Onfido API (v3.6)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v3.6
|
|
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 date, datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from onfido.models.address import Address
|
|
25
|
+
from onfido.models.id_number import IdNumber
|
|
26
|
+
from onfido.models.location import Location
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
class Applicant(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
Applicant
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
email: Optional[StrictStr] = Field(default=None, description="The applicant's email address. Required if doing a US check, or a UK check for which `applicant_provides_data` is `true`.")
|
|
35
|
+
dob: Optional[date] = Field(default=None, description="The applicant's date of birth")
|
|
36
|
+
id_numbers: Optional[List[IdNumber]] = None
|
|
37
|
+
phone_number: Optional[StrictStr] = Field(default=None, description="The applicant's phone number")
|
|
38
|
+
first_name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The applicant's first name")
|
|
39
|
+
last_name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The applicant's surname")
|
|
40
|
+
id: StrictStr = Field(description="The unique identifier for the applicant.")
|
|
41
|
+
created_at: Optional[datetime] = Field(default=None, description="The date and time when this applicant was created.")
|
|
42
|
+
delete_at: Optional[datetime] = Field(default=None, description="The date and time when this applicant is scheduled to be deleted.")
|
|
43
|
+
href: Optional[StrictStr] = Field(default=None, description="The uri of this resource.")
|
|
44
|
+
sandbox: Optional[StrictBool] = None
|
|
45
|
+
address: Optional[Address] = None
|
|
46
|
+
location: Optional[Location] = None
|
|
47
|
+
additional_properties: Dict[str, Any] = {}
|
|
48
|
+
__properties: ClassVar[List[str]] = ["email", "dob", "id_numbers", "phone_number", "first_name", "last_name", "id", "created_at", "delete_at", "href", "sandbox", "address", "location"]
|
|
49
|
+
|
|
50
|
+
@field_validator('first_name')
|
|
51
|
+
def first_name_validate_regular_expression(cls, value):
|
|
52
|
+
"""Validates the regular expression"""
|
|
53
|
+
if value is None:
|
|
54
|
+
return value
|
|
55
|
+
|
|
56
|
+
if not re.match(r"^[^!#$%*=<>;{}\"]*$", value):
|
|
57
|
+
raise ValueError(r"must validate the regular expression /^[^!#$%*=<>;{}\"]*$/")
|
|
58
|
+
return value
|
|
59
|
+
|
|
60
|
+
@field_validator('last_name')
|
|
61
|
+
def last_name_validate_regular_expression(cls, value):
|
|
62
|
+
"""Validates the regular expression"""
|
|
63
|
+
if value is None:
|
|
64
|
+
return value
|
|
65
|
+
|
|
66
|
+
if not re.match(r"^[^!#$%*=<>;{}\"]*$", value):
|
|
67
|
+
raise ValueError(r"must validate the regular expression /^[^!#$%*=<>;{}\"]*$/")
|
|
68
|
+
return value
|
|
69
|
+
|
|
70
|
+
model_config = ConfigDict(
|
|
71
|
+
populate_by_name=True,
|
|
72
|
+
validate_assignment=True,
|
|
73
|
+
protected_namespaces=(),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def to_str(self) -> str:
|
|
78
|
+
"""Returns the string representation of the model using alias"""
|
|
79
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
80
|
+
|
|
81
|
+
def to_json(self) -> str:
|
|
82
|
+
"""Returns the JSON representation of the model using alias"""
|
|
83
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
84
|
+
return json.dumps(self.to_dict())
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
88
|
+
"""Create an instance of Applicant from a JSON string"""
|
|
89
|
+
return cls.from_dict(json.loads(json_str))
|
|
90
|
+
|
|
91
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
92
|
+
"""Return the dictionary representation of the model using alias.
|
|
93
|
+
|
|
94
|
+
This has the following differences from calling pydantic's
|
|
95
|
+
`self.model_dump(by_alias=True)`:
|
|
96
|
+
|
|
97
|
+
* `None` is only added to the output dict for nullable fields that
|
|
98
|
+
were set at model initialization. Other fields with value `None`
|
|
99
|
+
are ignored.
|
|
100
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
101
|
+
"""
|
|
102
|
+
excluded_fields: Set[str] = set([
|
|
103
|
+
"additional_properties",
|
|
104
|
+
])
|
|
105
|
+
|
|
106
|
+
_dict = self.model_dump(
|
|
107
|
+
by_alias=True,
|
|
108
|
+
exclude=excluded_fields,
|
|
109
|
+
exclude_none=True,
|
|
110
|
+
)
|
|
111
|
+
# override the default output from pydantic by calling `to_dict()` of each item in id_numbers (list)
|
|
112
|
+
_items = []
|
|
113
|
+
if self.id_numbers:
|
|
114
|
+
for _item in self.id_numbers:
|
|
115
|
+
if _item:
|
|
116
|
+
_items.append(_item.to_dict())
|
|
117
|
+
_dict['id_numbers'] = _items
|
|
118
|
+
# override the default output from pydantic by calling `to_dict()` of address
|
|
119
|
+
if self.address:
|
|
120
|
+
_dict['address'] = self.address.to_dict()
|
|
121
|
+
# override the default output from pydantic by calling `to_dict()` of location
|
|
122
|
+
if self.location:
|
|
123
|
+
_dict['location'] = self.location.to_dict()
|
|
124
|
+
# puts key-value pairs in additional_properties in the top level
|
|
125
|
+
if self.additional_properties is not None:
|
|
126
|
+
for _key, _value in self.additional_properties.items():
|
|
127
|
+
_dict[_key] = _value
|
|
128
|
+
|
|
129
|
+
return _dict
|
|
130
|
+
|
|
131
|
+
@classmethod
|
|
132
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
133
|
+
"""Create an instance of Applicant from a dict"""
|
|
134
|
+
if obj is None:
|
|
135
|
+
return None
|
|
136
|
+
|
|
137
|
+
if not isinstance(obj, dict):
|
|
138
|
+
return cls.model_validate(obj)
|
|
139
|
+
|
|
140
|
+
_obj = cls.model_validate({
|
|
141
|
+
"email": obj.get("email"),
|
|
142
|
+
"dob": obj.get("dob"),
|
|
143
|
+
"id_numbers": [IdNumber.from_dict(_item) for _item in obj["id_numbers"]] if obj.get("id_numbers") is not None else None,
|
|
144
|
+
"phone_number": obj.get("phone_number"),
|
|
145
|
+
"first_name": obj.get("first_name"),
|
|
146
|
+
"last_name": obj.get("last_name"),
|
|
147
|
+
"id": obj.get("id"),
|
|
148
|
+
"created_at": obj.get("created_at"),
|
|
149
|
+
"delete_at": obj.get("delete_at"),
|
|
150
|
+
"href": obj.get("href"),
|
|
151
|
+
"sandbox": obj.get("sandbox"),
|
|
152
|
+
"address": Address.from_dict(obj["address"]) if obj.get("address") is not None else None,
|
|
153
|
+
"location": Location.from_dict(obj["location"]) if obj.get("location") is not None else None
|
|
154
|
+
})
|
|
155
|
+
# store additional fields in additional_properties
|
|
156
|
+
for _key in obj.keys():
|
|
157
|
+
if _key not in cls.__properties:
|
|
158
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
159
|
+
|
|
160
|
+
return _obj
|
|
161
|
+
|
|
162
|
+
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Onfido API v3.6
|
|
5
|
+
|
|
6
|
+
The Onfido API (v3.6)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v3.6
|
|
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 date
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from onfido.models.address_builder import AddressBuilder
|
|
25
|
+
from onfido.models.consents_builder import ConsentsBuilder
|
|
26
|
+
from onfido.models.id_number import IdNumber
|
|
27
|
+
from onfido.models.location_builder import LocationBuilder
|
|
28
|
+
from typing import Optional, Set
|
|
29
|
+
from typing_extensions import Self
|
|
30
|
+
|
|
31
|
+
class ApplicantBuilder(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
ApplicantBuilder
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
email: Optional[StrictStr] = Field(default=None, description="The applicant's email address. Required if doing a US check, or a UK check for which `applicant_provides_data` is `true`.")
|
|
36
|
+
dob: Optional[date] = Field(default=None, description="The applicant's date of birth")
|
|
37
|
+
id_numbers: Optional[List[IdNumber]] = None
|
|
38
|
+
phone_number: Optional[StrictStr] = Field(default=None, description="The applicant's phone number")
|
|
39
|
+
consents: Optional[ConsentsBuilder] = None
|
|
40
|
+
address: Optional[AddressBuilder] = None
|
|
41
|
+
location: Optional[LocationBuilder] = None
|
|
42
|
+
first_name: Annotated[str, Field(strict=True)] = Field(description="The applicant's first name")
|
|
43
|
+
last_name: Annotated[str, Field(strict=True)] = Field(description="The applicant's surname")
|
|
44
|
+
additional_properties: Dict[str, Any] = {}
|
|
45
|
+
__properties: ClassVar[List[str]] = ["email", "dob", "id_numbers", "phone_number", "consents", "address", "location", "first_name", "last_name"]
|
|
46
|
+
|
|
47
|
+
@field_validator('first_name')
|
|
48
|
+
def first_name_validate_regular_expression(cls, value):
|
|
49
|
+
"""Validates the regular expression"""
|
|
50
|
+
if not re.match(r"^[^!#$%*=<>;{}\"]*$", value):
|
|
51
|
+
raise ValueError(r"must validate the regular expression /^[^!#$%*=<>;{}\"]*$/")
|
|
52
|
+
return value
|
|
53
|
+
|
|
54
|
+
@field_validator('last_name')
|
|
55
|
+
def last_name_validate_regular_expression(cls, value):
|
|
56
|
+
"""Validates the regular expression"""
|
|
57
|
+
if not re.match(r"^[^!#$%*=<>;{}\"]*$", value):
|
|
58
|
+
raise ValueError(r"must validate the regular expression /^[^!#$%*=<>;{}\"]*$/")
|
|
59
|
+
return value
|
|
60
|
+
|
|
61
|
+
model_config = ConfigDict(
|
|
62
|
+
populate_by_name=True,
|
|
63
|
+
validate_assignment=True,
|
|
64
|
+
protected_namespaces=(),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def to_str(self) -> str:
|
|
69
|
+
"""Returns the string representation of the model using alias"""
|
|
70
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
71
|
+
|
|
72
|
+
def to_json(self) -> str:
|
|
73
|
+
"""Returns the JSON representation of the model using alias"""
|
|
74
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
75
|
+
return json.dumps(self.to_dict())
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of ApplicantBuilder from a JSON string"""
|
|
80
|
+
return cls.from_dict(json.loads(json_str))
|
|
81
|
+
|
|
82
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
83
|
+
"""Return the dictionary representation of the model using alias.
|
|
84
|
+
|
|
85
|
+
This has the following differences from calling pydantic's
|
|
86
|
+
`self.model_dump(by_alias=True)`:
|
|
87
|
+
|
|
88
|
+
* `None` is only added to the output dict for nullable fields that
|
|
89
|
+
were set at model initialization. Other fields with value `None`
|
|
90
|
+
are ignored.
|
|
91
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
92
|
+
"""
|
|
93
|
+
excluded_fields: Set[str] = set([
|
|
94
|
+
"additional_properties",
|
|
95
|
+
])
|
|
96
|
+
|
|
97
|
+
_dict = self.model_dump(
|
|
98
|
+
by_alias=True,
|
|
99
|
+
exclude=excluded_fields,
|
|
100
|
+
exclude_none=True,
|
|
101
|
+
)
|
|
102
|
+
# override the default output from pydantic by calling `to_dict()` of each item in id_numbers (list)
|
|
103
|
+
_items = []
|
|
104
|
+
if self.id_numbers:
|
|
105
|
+
for _item in self.id_numbers:
|
|
106
|
+
if _item:
|
|
107
|
+
_items.append(_item.to_dict())
|
|
108
|
+
_dict['id_numbers'] = _items
|
|
109
|
+
# override the default output from pydantic by calling `to_dict()` of consents
|
|
110
|
+
if self.consents:
|
|
111
|
+
_dict['consents'] = self.consents.to_dict()
|
|
112
|
+
# override the default output from pydantic by calling `to_dict()` of address
|
|
113
|
+
if self.address:
|
|
114
|
+
_dict['address'] = self.address.to_dict()
|
|
115
|
+
# override the default output from pydantic by calling `to_dict()` of location
|
|
116
|
+
if self.location:
|
|
117
|
+
_dict['location'] = self.location.to_dict()
|
|
118
|
+
# puts key-value pairs in additional_properties in the top level
|
|
119
|
+
if self.additional_properties is not None:
|
|
120
|
+
for _key, _value in self.additional_properties.items():
|
|
121
|
+
_dict[_key] = _value
|
|
122
|
+
|
|
123
|
+
return _dict
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
127
|
+
"""Create an instance of ApplicantBuilder from a dict"""
|
|
128
|
+
if obj is None:
|
|
129
|
+
return None
|
|
130
|
+
|
|
131
|
+
if not isinstance(obj, dict):
|
|
132
|
+
return cls.model_validate(obj)
|
|
133
|
+
|
|
134
|
+
_obj = cls.model_validate({
|
|
135
|
+
"email": obj.get("email"),
|
|
136
|
+
"dob": obj.get("dob"),
|
|
137
|
+
"id_numbers": [IdNumber.from_dict(_item) for _item in obj["id_numbers"]] if obj.get("id_numbers") is not None else None,
|
|
138
|
+
"phone_number": obj.get("phone_number"),
|
|
139
|
+
"consents": ConsentsBuilder.from_dict(obj["consents"]) if obj.get("consents") is not None else None,
|
|
140
|
+
"address": AddressBuilder.from_dict(obj["address"]) if obj.get("address") is not None else None,
|
|
141
|
+
"location": LocationBuilder.from_dict(obj["location"]) if obj.get("location") is not None else None,
|
|
142
|
+
"first_name": obj.get("first_name"),
|
|
143
|
+
"last_name": obj.get("last_name")
|
|
144
|
+
})
|
|
145
|
+
# store additional fields in additional_properties
|
|
146
|
+
for _key in obj.keys():
|
|
147
|
+
if _key not in cls.__properties:
|
|
148
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
149
|
+
|
|
150
|
+
return _obj
|
|
151
|
+
|
|
152
|
+
|