diff --git a/.release.json b/.release.json index e6a0583..c184dba 100644 --- a/.release.json +++ b/.release.json @@ -1,9 +1,9 @@ { "source": { "repo_url": "https://github.com/onfido/onfido-openapi-spec", - "short_sha": "d180edd", - "long_sha": "d180eddd168dd95bf84bf7c8fe9f8c7e3c0c5494", - "version": "v4.1.0" + "short_sha": "c72181c", + "long_sha": "c72181cc5e450bf727fc5eae2639c58ba45831ac", + "version": "v4.2.0" }, - "release": "v4.1.0" + "release": "v4.2.0" } diff --git a/onfido/__init__.py b/onfido/__init__.py index 82cf40f..0e2b78f 100644 --- a/onfido/__init__.py +++ b/onfido/__init__.py @@ -14,7 +14,7 @@ """ # noqa: E501 -__version__ = "4.1.0" +__version__ = "4.2.0" # import apis into sdk package from onfido.api.default_api import DefaultApi @@ -165,6 +165,8 @@ from onfido.models.facial_similarity_photo_fully_auto_report import FacialSimilarityPhotoFullyAutoReport from onfido.models.facial_similarity_photo_properties import FacialSimilarityPhotoProperties from onfido.models.facial_similarity_photo_report import FacialSimilarityPhotoReport +from onfido.models.facial_similarity_report_media import FacialSimilarityReportMedia +from onfido.models.facial_similarity_report_shared import FacialSimilarityReportShared from onfido.models.facial_similarity_video_breakdown import FacialSimilarityVideoBreakdown from onfido.models.facial_similarity_video_breakdown_face_comparison import FacialSimilarityVideoBreakdownFaceComparison from onfido.models.facial_similarity_video_breakdown_image_integrity import FacialSimilarityVideoBreakdownImageIntegrity diff --git a/onfido/api_client.py b/onfido/api_client.py index bb08722..e5e0c80 100644 --- a/onfido/api_client.py +++ b/onfido/api_client.py @@ -90,7 +90,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'onfido-python/4.1.0' + self.user_agent = 'onfido-python/4.2.0' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/onfido/configuration.py b/onfido/configuration.py index 419ecb7..2c70c7d 100644 --- a/onfido/configuration.py +++ b/onfido/configuration.py @@ -394,7 +394,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: v3.6\n"\ - "SDK Package Version: 4.1.0".\ + "SDK Package Version: 4.2.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/onfido/models/__init__.py b/onfido/models/__init__.py index 4505141..ca34bf2 100644 --- a/onfido/models/__init__.py +++ b/onfido/models/__init__.py @@ -148,6 +148,8 @@ from onfido.models.facial_similarity_photo_fully_auto_report import FacialSimilarityPhotoFullyAutoReport from onfido.models.facial_similarity_photo_properties import FacialSimilarityPhotoProperties from onfido.models.facial_similarity_photo_report import FacialSimilarityPhotoReport +from onfido.models.facial_similarity_report_media import FacialSimilarityReportMedia +from onfido.models.facial_similarity_report_shared import FacialSimilarityReportShared from onfido.models.facial_similarity_video_breakdown import FacialSimilarityVideoBreakdown from onfido.models.facial_similarity_video_breakdown_face_comparison import FacialSimilarityVideoBreakdownFaceComparison from onfido.models.facial_similarity_video_breakdown_image_integrity import FacialSimilarityVideoBreakdownImageIntegrity diff --git a/onfido/models/document_types.py b/onfido/models/document_types.py index 5cf6ddf..b87c0b2 100644 --- a/onfido/models/document_types.py +++ b/onfido/models/document_types.py @@ -56,6 +56,52 @@ class DocumentTypes(str, Enum): VEHICLE_REGISTRATION_CERTIFICATE = 'vehicle_registration_certificate' FORM_FOR_AFFIXING_THE_VISA = 'form_for_affixing_the_visa' IDENTIFICATION_NUMBER_DOCUMENT = 'identification_number_document' + ADOPTION_CERTIFICATE = 'adoption_certificate' + BANK_BUILDING_SOCIETY_STATEMENT = 'bank_building_society_statement' + BANK_STATEMENT = 'bank_statement' + BENEFIT_LETTERS = 'benefit_letters' + CBT = 'cbt' + CERTIFICATE_OF_SPONSORSHIP = 'certificate_of_sponsorship' + CHARACTER_REFERENCE = 'character_reference' + CIVIL_PARTNERSHIP_CERTIFICATE = 'civil_partnership_certificate' + COUNCIL_TAX = 'council_tax' + CREDIT_CARD_STATEMENT = 'credit_card_statement' + DEED_POLL = 'deed_poll' + DIVORCE_ABSOLUTE_DECREE = 'divorce_absolute_decree' + EDUCATIONAL_STATEMENT = 'educational_statement' + ELECTRICITY_BILL = 'electricity_bill' + GAS_BILL = 'gas_bill' + GOVERNMENT_LETTER = 'government_letter' + INTERNET_BILL = 'internet_bill' + MARRIAGE_CERTIFICATE = 'marriage_certificate' + MOTORCYCLE_INSURANCE = 'motorcycle_insurance' + NATIONAL_INSURANCE_CARD = 'national_insurance_card' + NATURALISATION_CERTIFICATE = 'naturalisation_certificate' + NON_UK_DRIVING_LICENCE = 'non_uk_driving_licence' + P45_P60 = 'p45_p60' + PAYSLIP = 'payslip' + PHONE_BILL = 'phone_bill' + PROFESSIONAL_IDENTIFICATION_CARD = 'professional_identification_card' + RIGHT_TO_WORK_SHARE_CODE_RESULT = 'right_to_work_share_code_result' + STATEMENT_FACT = 'statement_fact' + T4_STUDENT_UNIVERSITY_TERM_DATES_EVIDENCE = 't4_student_university_term_dates_evidence' + UK_BIOMETRIC_RESIDENCE_PERMIT = 'uk_biometric_residence_permit' + UK_DRIVING_LICENCE = 'uk_driving_licence' + UNKNOWN = 'unknown' + UTILITY_BILL = 'utility_bill' + UTILITY_BILL_ELECTRIC = 'utility_bill_electric' + UTILITY_BILL_GAS = 'utility_bill_gas' + UTILITY_BILL_OTHER = 'utility_bill_other' + WATER_BILL = 'water_bill' + ADDRESS_CERTIFICATE = 'address_certificate' + GENERAL_LETTER = 'general_letter' + INSURANCE_STATEMENT = 'insurance_statement' + PENSION_PROPERTY_STATEMENT_LETTER = 'pension_property_statement_letter' + MORTGAGE_STATEMENT = 'mortgage_statement' + MOBILE_PHONE_BILL = 'mobile_phone_bill' + IDENTITY_DOCUMENT_WITH_ADDRESS = 'identity_document_with_address' + EXCHANGE_HOUSE_STATEMENT = 'exchange_house_statement' + ACCOMMODATION_TENANCY_CERTIFICATE = 'accommodation_tenancy_certificate' @classmethod def from_json(cls, json_str: str) -> Self: diff --git a/onfido/models/facial_similarity_motion_report.py b/onfido/models/facial_similarity_motion_report.py index 5e99d94..1a3d908 100644 --- a/onfido/models/facial_similarity_motion_report.py +++ b/onfido/models/facial_similarity_motion_report.py @@ -22,6 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional from onfido.models.facial_similarity_motion_breakdown import FacialSimilarityMotionBreakdown from onfido.models.facial_similarity_motion_properties import FacialSimilarityMotionProperties +from onfido.models.facial_similarity_report_media import FacialSimilarityReportMedia from onfido.models.report_document import ReportDocument from onfido.models.report_name import ReportName from onfido.models.report_result import ReportResult @@ -43,10 +44,14 @@ class FacialSimilarityMotionReport(BaseModel): check_id: Optional[StrictStr] = Field(default=None, description="The ID of the check to which the report belongs. Read-only.") documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS]") name: ReportName + live_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live photo ids that were used in the Onfido engine.") + live_videos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live video ids that were used in the Onfido engine.") + motion_captures: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with motion capture ids that were used in the Onfido engine.") + id_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with id photo ids that were used in the Onfido engine.") breakdown: Optional[FacialSimilarityMotionBreakdown] = None properties: Optional[FacialSimilarityMotionProperties] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "breakdown", "properties"] + __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "live_photos", "live_videos", "motion_captures", "id_photos", "breakdown", "properties"] model_config = ConfigDict( populate_by_name=True, @@ -96,6 +101,34 @@ def to_dict(self) -> Dict[str, Any]: if _item_documents: _items.append(_item_documents.to_dict()) _dict['documents'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_photos (list) + _items = [] + if self.live_photos: + for _item_live_photos in self.live_photos: + if _item_live_photos: + _items.append(_item_live_photos.to_dict()) + _dict['live_photos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_videos (list) + _items = [] + if self.live_videos: + for _item_live_videos in self.live_videos: + if _item_live_videos: + _items.append(_item_live_videos.to_dict()) + _dict['live_videos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in motion_captures (list) + _items = [] + if self.motion_captures: + for _item_motion_captures in self.motion_captures: + if _item_motion_captures: + _items.append(_item_motion_captures.to_dict()) + _dict['motion_captures'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in id_photos (list) + _items = [] + if self.id_photos: + for _item_id_photos in self.id_photos: + if _item_id_photos: + _items.append(_item_id_photos.to_dict()) + _dict['id_photos'] = _items # override the default output from pydantic by calling `to_dict()` of breakdown if self.breakdown: _dict['breakdown'] = self.breakdown.to_dict() @@ -128,6 +161,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "check_id": obj.get("check_id"), "documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None, "name": obj.get("name"), + "live_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_photos"]] if obj.get("live_photos") is not None else None, + "live_videos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_videos"]] if obj.get("live_videos") is not None else None, + "motion_captures": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["motion_captures"]] if obj.get("motion_captures") is not None else None, + "id_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["id_photos"]] if obj.get("id_photos") is not None else None, "breakdown": FacialSimilarityMotionBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None, "properties": FacialSimilarityMotionProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None }) diff --git a/onfido/models/facial_similarity_photo_fully_auto_report.py b/onfido/models/facial_similarity_photo_fully_auto_report.py index 3984e10..3d481b0 100644 --- a/onfido/models/facial_similarity_photo_fully_auto_report.py +++ b/onfido/models/facial_similarity_photo_fully_auto_report.py @@ -22,6 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional from onfido.models.facial_similarity_photo_fully_auto_breakdown import FacialSimilarityPhotoFullyAutoBreakdown from onfido.models.facial_similarity_photo_fully_auto_properties import FacialSimilarityPhotoFullyAutoProperties +from onfido.models.facial_similarity_report_media import FacialSimilarityReportMedia from onfido.models.report_document import ReportDocument from onfido.models.report_name import ReportName from onfido.models.report_result import ReportResult @@ -43,10 +44,14 @@ class FacialSimilarityPhotoFullyAutoReport(BaseModel): check_id: Optional[StrictStr] = Field(default=None, description="The ID of the check to which the report belongs. Read-only.") documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS]") name: ReportName + live_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live photo ids that were used in the Onfido engine.") + live_videos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live video ids that were used in the Onfido engine.") + motion_captures: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with motion capture ids that were used in the Onfido engine.") + id_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with id photo ids that were used in the Onfido engine.") breakdown: Optional[FacialSimilarityPhotoFullyAutoBreakdown] = None properties: Optional[FacialSimilarityPhotoFullyAutoProperties] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "breakdown", "properties"] + __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "live_photos", "live_videos", "motion_captures", "id_photos", "breakdown", "properties"] model_config = ConfigDict( populate_by_name=True, @@ -96,6 +101,34 @@ def to_dict(self) -> Dict[str, Any]: if _item_documents: _items.append(_item_documents.to_dict()) _dict['documents'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_photos (list) + _items = [] + if self.live_photos: + for _item_live_photos in self.live_photos: + if _item_live_photos: + _items.append(_item_live_photos.to_dict()) + _dict['live_photos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_videos (list) + _items = [] + if self.live_videos: + for _item_live_videos in self.live_videos: + if _item_live_videos: + _items.append(_item_live_videos.to_dict()) + _dict['live_videos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in motion_captures (list) + _items = [] + if self.motion_captures: + for _item_motion_captures in self.motion_captures: + if _item_motion_captures: + _items.append(_item_motion_captures.to_dict()) + _dict['motion_captures'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in id_photos (list) + _items = [] + if self.id_photos: + for _item_id_photos in self.id_photos: + if _item_id_photos: + _items.append(_item_id_photos.to_dict()) + _dict['id_photos'] = _items # override the default output from pydantic by calling `to_dict()` of breakdown if self.breakdown: _dict['breakdown'] = self.breakdown.to_dict() @@ -128,6 +161,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "check_id": obj.get("check_id"), "documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None, "name": obj.get("name"), + "live_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_photos"]] if obj.get("live_photos") is not None else None, + "live_videos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_videos"]] if obj.get("live_videos") is not None else None, + "motion_captures": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["motion_captures"]] if obj.get("motion_captures") is not None else None, + "id_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["id_photos"]] if obj.get("id_photos") is not None else None, "breakdown": FacialSimilarityPhotoFullyAutoBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None, "properties": FacialSimilarityPhotoFullyAutoProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None }) diff --git a/onfido/models/facial_similarity_photo_report.py b/onfido/models/facial_similarity_photo_report.py index 5895817..1e798c9 100644 --- a/onfido/models/facial_similarity_photo_report.py +++ b/onfido/models/facial_similarity_photo_report.py @@ -22,6 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional from onfido.models.facial_similarity_photo_breakdown import FacialSimilarityPhotoBreakdown from onfido.models.facial_similarity_photo_properties import FacialSimilarityPhotoProperties +from onfido.models.facial_similarity_report_media import FacialSimilarityReportMedia from onfido.models.report_document import ReportDocument from onfido.models.report_name import ReportName from onfido.models.report_result import ReportResult @@ -43,10 +44,14 @@ class FacialSimilarityPhotoReport(BaseModel): check_id: Optional[StrictStr] = Field(default=None, description="The ID of the check to which the report belongs. Read-only.") documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS]") name: ReportName + live_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live photo ids that were used in the Onfido engine.") + live_videos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live video ids that were used in the Onfido engine.") + motion_captures: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with motion capture ids that were used in the Onfido engine.") + id_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with id photo ids that were used in the Onfido engine.") breakdown: Optional[FacialSimilarityPhotoBreakdown] = None properties: Optional[FacialSimilarityPhotoProperties] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "breakdown", "properties"] + __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "live_photos", "live_videos", "motion_captures", "id_photos", "breakdown", "properties"] model_config = ConfigDict( populate_by_name=True, @@ -96,6 +101,34 @@ def to_dict(self) -> Dict[str, Any]: if _item_documents: _items.append(_item_documents.to_dict()) _dict['documents'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_photos (list) + _items = [] + if self.live_photos: + for _item_live_photos in self.live_photos: + if _item_live_photos: + _items.append(_item_live_photos.to_dict()) + _dict['live_photos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_videos (list) + _items = [] + if self.live_videos: + for _item_live_videos in self.live_videos: + if _item_live_videos: + _items.append(_item_live_videos.to_dict()) + _dict['live_videos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in motion_captures (list) + _items = [] + if self.motion_captures: + for _item_motion_captures in self.motion_captures: + if _item_motion_captures: + _items.append(_item_motion_captures.to_dict()) + _dict['motion_captures'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in id_photos (list) + _items = [] + if self.id_photos: + for _item_id_photos in self.id_photos: + if _item_id_photos: + _items.append(_item_id_photos.to_dict()) + _dict['id_photos'] = _items # override the default output from pydantic by calling `to_dict()` of breakdown if self.breakdown: _dict['breakdown'] = self.breakdown.to_dict() @@ -128,6 +161,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "check_id": obj.get("check_id"), "documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None, "name": obj.get("name"), + "live_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_photos"]] if obj.get("live_photos") is not None else None, + "live_videos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_videos"]] if obj.get("live_videos") is not None else None, + "motion_captures": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["motion_captures"]] if obj.get("motion_captures") is not None else None, + "id_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["id_photos"]] if obj.get("id_photos") is not None else None, "breakdown": FacialSimilarityPhotoBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None, "properties": FacialSimilarityPhotoProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None }) diff --git a/onfido/models/facial_similarity_report_media.py b/onfido/models/facial_similarity_report_media.py new file mode 100644 index 0000000..8611559 --- /dev/null +++ b/onfido/models/facial_similarity_report_media.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Onfido API v3.6 + + The Onfido API (v3.6) + + The version of the OpenAPI document: v3.6 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class FacialSimilarityReportMedia(BaseModel): + """ + FacialSimilarityReportMedia + """ # noqa: E501 + id: StrictStr = Field(description="ID of uploaded biometric media to use.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FacialSimilarityReportMedia from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FacialSimilarityReportMedia from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/onfido/models/facial_similarity_report_shared.py b/onfido/models/facial_similarity_report_shared.py new file mode 100644 index 0000000..61b60f2 --- /dev/null +++ b/onfido/models/facial_similarity_report_shared.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Onfido API v3.6 + + The Onfido API (v3.6) + + The version of the OpenAPI document: v3.6 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from onfido.models.facial_similarity_report_media import FacialSimilarityReportMedia +from typing import Optional, Set +from typing_extensions import Self + +class FacialSimilarityReportShared(BaseModel): + """ + FacialSimilarityReportShared + """ # noqa: E501 + live_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live photo ids that were used in the Onfido engine.") + live_videos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live video ids that were used in the Onfido engine.") + motion_captures: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with motion capture ids that were used in the Onfido engine.") + id_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with id photo ids that were used in the Onfido engine.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["live_photos", "live_videos", "motion_captures", "id_photos"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FacialSimilarityReportShared from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in live_photos (list) + _items = [] + if self.live_photos: + for _item_live_photos in self.live_photos: + if _item_live_photos: + _items.append(_item_live_photos.to_dict()) + _dict['live_photos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_videos (list) + _items = [] + if self.live_videos: + for _item_live_videos in self.live_videos: + if _item_live_videos: + _items.append(_item_live_videos.to_dict()) + _dict['live_videos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in motion_captures (list) + _items = [] + if self.motion_captures: + for _item_motion_captures in self.motion_captures: + if _item_motion_captures: + _items.append(_item_motion_captures.to_dict()) + _dict['motion_captures'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in id_photos (list) + _items = [] + if self.id_photos: + for _item_id_photos in self.id_photos: + if _item_id_photos: + _items.append(_item_id_photos.to_dict()) + _dict['id_photos'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FacialSimilarityReportShared from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "live_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_photos"]] if obj.get("live_photos") is not None else None, + "live_videos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_videos"]] if obj.get("live_videos") is not None else None, + "motion_captures": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["motion_captures"]] if obj.get("motion_captures") is not None else None, + "id_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["id_photos"]] if obj.get("id_photos") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/onfido/models/facial_similarity_video_report.py b/onfido/models/facial_similarity_video_report.py index eff365d..f24747b 100644 --- a/onfido/models/facial_similarity_video_report.py +++ b/onfido/models/facial_similarity_video_report.py @@ -20,6 +20,7 @@ from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from onfido.models.facial_similarity_report_media import FacialSimilarityReportMedia from onfido.models.facial_similarity_video_breakdown import FacialSimilarityVideoBreakdown from onfido.models.facial_similarity_video_properties import FacialSimilarityVideoProperties from onfido.models.report_document import ReportDocument @@ -43,10 +44,14 @@ class FacialSimilarityVideoReport(BaseModel): check_id: Optional[StrictStr] = Field(default=None, description="The ID of the check to which the report belongs. Read-only.") documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS]") name: ReportName + live_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live photo ids that were used in the Onfido engine.") + live_videos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with live video ids that were used in the Onfido engine.") + motion_captures: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with motion capture ids that were used in the Onfido engine.") + id_photos: Optional[List[FacialSimilarityReportMedia]] = Field(default=None, description="Array of objects with id photo ids that were used in the Onfido engine.") breakdown: Optional[FacialSimilarityVideoBreakdown] = None properties: Optional[FacialSimilarityVideoProperties] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "breakdown", "properties"] + __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "live_photos", "live_videos", "motion_captures", "id_photos", "breakdown", "properties"] model_config = ConfigDict( populate_by_name=True, @@ -96,6 +101,34 @@ def to_dict(self) -> Dict[str, Any]: if _item_documents: _items.append(_item_documents.to_dict()) _dict['documents'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_photos (list) + _items = [] + if self.live_photos: + for _item_live_photos in self.live_photos: + if _item_live_photos: + _items.append(_item_live_photos.to_dict()) + _dict['live_photos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in live_videos (list) + _items = [] + if self.live_videos: + for _item_live_videos in self.live_videos: + if _item_live_videos: + _items.append(_item_live_videos.to_dict()) + _dict['live_videos'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in motion_captures (list) + _items = [] + if self.motion_captures: + for _item_motion_captures in self.motion_captures: + if _item_motion_captures: + _items.append(_item_motion_captures.to_dict()) + _dict['motion_captures'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in id_photos (list) + _items = [] + if self.id_photos: + for _item_id_photos in self.id_photos: + if _item_id_photos: + _items.append(_item_id_photos.to_dict()) + _dict['id_photos'] = _items # override the default output from pydantic by calling `to_dict()` of breakdown if self.breakdown: _dict['breakdown'] = self.breakdown.to_dict() @@ -128,6 +161,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "check_id": obj.get("check_id"), "documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None, "name": obj.get("name"), + "live_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_photos"]] if obj.get("live_photos") is not None else None, + "live_videos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["live_videos"]] if obj.get("live_videos") is not None else None, + "motion_captures": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["motion_captures"]] if obj.get("motion_captures") is not None else None, + "id_photos": [FacialSimilarityReportMedia.from_dict(_item) for _item in obj["id_photos"]] if obj.get("id_photos") is not None else None, "breakdown": FacialSimilarityVideoBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None, "properties": FacialSimilarityVideoProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None }) diff --git a/poetry.lock b/poetry.lock index 57a5c45..a5d80b8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -279,13 +279,13 @@ files = [ [[package]] name = "packaging" -version = "24.1" +version = "24.2" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, - {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, ] [[package]] @@ -551,13 +551,13 @@ files = [ [[package]] name = "tomli" -version = "2.0.2" +version = "2.1.0" description = "A lil' TOML parser" optional = false python-versions = ">=3.8" files = [ - {file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"}, - {file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"}, + {file = "tomli-2.1.0-py3-none-any.whl", hash = "sha256:a5c57c3d1c56f5ccdf89f6523458f60ef716e210fc47c4cfb188c5ba473e0391"}, + {file = "tomli-2.1.0.tar.gz", hash = "sha256:3f646cae2aec94e17d04973e4249548320197cfabdf130015d023de4b74d8ab8"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index c112d53..2cb7a30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "onfido-python" -version = "4.1.0" +version = "4.2.0" description = "Python library for the Onfido API" authors = ["OpenAPI Generator Community "] license = "MIT" diff --git a/setup.py b/setup.py index b3ea6d9..0822fbc 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "onfido-python" -VERSION = "4.1.0" +VERSION = "4.2.0" PYTHON_REQUIRES = ">= 3.8" REQUIRES = [ "urllib3 >= 1.25.3, < 3.0.0",