diff --git a/.release.json b/.release.json index 214ba4b..8a027d2 100644 --- a/.release.json +++ b/.release.json @@ -1,8 +1,8 @@ { "source": { "repo_url": "https://github.com/onfido/onfido-openapi-spec", - "short_sha": "d9d749d", - "long_sha": "d9d749dfbd3873524400efe236f7d398bb9e948e", + "short_sha": "ad80494", + "long_sha": "ad8049477731f42993257dd8cbbbd4a193f06c92", "version": "v6.2.0" }, "release": "v6.3.0" diff --git a/onfido/__init__.py b/onfido/__init__.py index 7b3c552..0a00ff0 100644 --- a/onfido/__init__.py +++ b/onfido/__init__.py @@ -46,8 +46,9 @@ "ApplicantsList", "BiometricToken", "BiometricTokenData", + "BiometricTokenResponse", "BiometricTokenUpdater", - "BiometricTokensList", + "BiometricTokensResponse", "Check", "CheckBuilder", "CheckRequest", @@ -216,9 +217,10 @@ "IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid", "IndiaPanReportAllOfProperties", "IndiaPanReportAllOfPropertiesDevice", + "InvalidatedBiometricTokenResponse", "InvalidatedBiometricTokenSummary", "InvalidatedBiometricTokenSummaryDeletedItems", - "InvalidatedBiometricTokensSummary", + "InvalidatedBiometricTokensResponse", "KnownFacesBreakdown", "KnownFacesBreakdownImageIntegrity", "KnownFacesBreakdownPreviouslySeenFaces", @@ -273,7 +275,7 @@ "Task", "TaskItem", "TimelineFileReference", - "UpdateBiometricToken200Response", + "UpdatedBiometricTokenResponse", "UsDrivingLicenceBreakdown", "UsDrivingLicenceBreakdownAddress", "UsDrivingLicenceBreakdownAddressBreakdown", @@ -379,8 +381,9 @@ from onfido.models.applicants_list import ApplicantsList as ApplicantsList from onfido.models.biometric_token import BiometricToken as BiometricToken from onfido.models.biometric_token_data import BiometricTokenData as BiometricTokenData +from onfido.models.biometric_token_response import BiometricTokenResponse as BiometricTokenResponse from onfido.models.biometric_token_updater import BiometricTokenUpdater as BiometricTokenUpdater -from onfido.models.biometric_tokens_list import BiometricTokensList as BiometricTokensList +from onfido.models.biometric_tokens_response import BiometricTokensResponse as BiometricTokensResponse from onfido.models.check import Check as Check from onfido.models.check_builder import CheckBuilder as CheckBuilder from onfido.models.check_request import CheckRequest as CheckRequest @@ -549,9 +552,10 @@ from onfido.models.india_pan_report_all_of_breakdown_device_breakdown_pan_valid import IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid as IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid from onfido.models.india_pan_report_all_of_properties import IndiaPanReportAllOfProperties as IndiaPanReportAllOfProperties from onfido.models.india_pan_report_all_of_properties_device import IndiaPanReportAllOfPropertiesDevice as IndiaPanReportAllOfPropertiesDevice +from onfido.models.invalidated_biometric_token_response import InvalidatedBiometricTokenResponse as InvalidatedBiometricTokenResponse from onfido.models.invalidated_biometric_token_summary import InvalidatedBiometricTokenSummary as InvalidatedBiometricTokenSummary from onfido.models.invalidated_biometric_token_summary_deleted_items import InvalidatedBiometricTokenSummaryDeletedItems as InvalidatedBiometricTokenSummaryDeletedItems -from onfido.models.invalidated_biometric_tokens_summary import InvalidatedBiometricTokensSummary as InvalidatedBiometricTokensSummary +from onfido.models.invalidated_biometric_tokens_response import InvalidatedBiometricTokensResponse as InvalidatedBiometricTokensResponse from onfido.models.known_faces_breakdown import KnownFacesBreakdown as KnownFacesBreakdown from onfido.models.known_faces_breakdown_image_integrity import KnownFacesBreakdownImageIntegrity as KnownFacesBreakdownImageIntegrity from onfido.models.known_faces_breakdown_previously_seen_faces import KnownFacesBreakdownPreviouslySeenFaces as KnownFacesBreakdownPreviouslySeenFaces @@ -606,7 +610,7 @@ from onfido.models.task import Task as Task from onfido.models.task_item import TaskItem as TaskItem from onfido.models.timeline_file_reference import TimelineFileReference as TimelineFileReference -from onfido.models.update_biometric_token200_response import UpdateBiometricToken200Response as UpdateBiometricToken200Response +from onfido.models.updated_biometric_token_response import UpdatedBiometricTokenResponse as UpdatedBiometricTokenResponse from onfido.models.us_driving_licence_breakdown import UsDrivingLicenceBreakdown as UsDrivingLicenceBreakdown from onfido.models.us_driving_licence_breakdown_address import UsDrivingLicenceBreakdownAddress as UsDrivingLicenceBreakdownAddress from onfido.models.us_driving_licence_breakdown_address_breakdown import UsDrivingLicenceBreakdownAddressBreakdown as UsDrivingLicenceBreakdownAddressBreakdown diff --git a/onfido/api/default_api.py b/onfido/api/default_api.py index 7e3935f..70c7c07 100644 --- a/onfido/api/default_api.py +++ b/onfido/api/default_api.py @@ -27,9 +27,9 @@ from onfido.models.applicant_consent import ApplicantConsent from onfido.models.applicant_updater import ApplicantUpdater from onfido.models.applicants_list import ApplicantsList -from onfido.models.biometric_token import BiometricToken +from onfido.models.biometric_token_response import BiometricTokenResponse from onfido.models.biometric_token_updater import BiometricTokenUpdater -from onfido.models.biometric_tokens_list import BiometricTokensList +from onfido.models.biometric_tokens_response import BiometricTokensResponse from onfido.models.check import Check from onfido.models.check_builder import CheckBuilder from onfido.models.checks_list import ChecksList @@ -40,8 +40,8 @@ from onfido.models.extraction import Extraction from onfido.models.id_photo import IdPhoto from onfido.models.id_photos_list import IdPhotosList -from onfido.models.invalidated_biometric_token_summary import InvalidatedBiometricTokenSummary -from onfido.models.invalidated_biometric_tokens_summary import InvalidatedBiometricTokensSummary +from onfido.models.invalidated_biometric_token_response import InvalidatedBiometricTokenResponse +from onfido.models.invalidated_biometric_tokens_response import InvalidatedBiometricTokensResponse from onfido.models.live_photo import LivePhoto from onfido.models.live_photos_list import LivePhotosList from onfido.models.live_video import LiveVideo @@ -63,7 +63,7 @@ from onfido.models.task import Task from onfido.models.task_item import TaskItem from onfido.models.timeline_file_reference import TimelineFileReference -from onfido.models.update_biometric_token200_response import UpdateBiometricToken200Response +from onfido.models.updated_biometric_token_response import UpdatedBiometricTokenResponse from onfido.models.watchlist_monitor import WatchlistMonitor from onfido.models.watchlist_monitor_builder import WatchlistMonitorBuilder from onfido.models.watchlist_monitor_matches_list import WatchlistMonitorMatchesList @@ -8990,7 +8990,7 @@ def find_biometric_token( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BiometricToken: + ) -> BiometricTokenResponse: """Retrieve biometric token Returns a biometric token's details. @@ -9031,7 +9031,7 @@ def find_biometric_token( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BiometricToken", + '200': "BiometricTokenResponse", } response_data = self.api_client.call_api( *_param, @@ -9061,7 +9061,7 @@ def find_biometric_token_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BiometricToken]: + ) -> ApiResponse[BiometricTokenResponse]: """Retrieve biometric token Returns a biometric token's details. @@ -9102,7 +9102,7 @@ def find_biometric_token_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BiometricToken", + '200': "BiometricTokenResponse", } response_data = self.api_client.call_api( *_param, @@ -9173,7 +9173,7 @@ def find_biometric_token_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BiometricToken", + '200': "BiometricTokenResponse", } response_data = self.api_client.call_api( *_param, @@ -13524,7 +13524,7 @@ def invalidate_biometric_token( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> InvalidatedBiometricTokenSummary: + ) -> InvalidatedBiometricTokenResponse: """Invalidate biometric token Invalidates a biometric token. @@ -13565,7 +13565,7 @@ def invalidate_biometric_token( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "InvalidatedBiometricTokenSummary", + '200': "InvalidatedBiometricTokenResponse", } response_data = self.api_client.call_api( *_param, @@ -13595,7 +13595,7 @@ def invalidate_biometric_token_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[InvalidatedBiometricTokenSummary]: + ) -> ApiResponse[InvalidatedBiometricTokenResponse]: """Invalidate biometric token Invalidates a biometric token. @@ -13636,7 +13636,7 @@ def invalidate_biometric_token_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "InvalidatedBiometricTokenSummary", + '200': "InvalidatedBiometricTokenResponse", } response_data = self.api_client.call_api( *_param, @@ -13707,7 +13707,7 @@ def invalidate_biometric_token_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "InvalidatedBiometricTokenSummary", + '200': "InvalidatedBiometricTokenResponse", } response_data = self.api_client.call_api( *_param, @@ -13800,7 +13800,7 @@ def invalidate_biometric_tokens( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> InvalidatedBiometricTokensSummary: + ) -> InvalidatedBiometricTokensResponse: """Invalidate biometric tokens Invalidates every biometric token associated with the supplied customer user ID. @@ -13838,7 +13838,7 @@ def invalidate_biometric_tokens( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "InvalidatedBiometricTokensSummary", + '200': "InvalidatedBiometricTokensResponse", } response_data = self.api_client.call_api( *_param, @@ -13867,7 +13867,7 @@ def invalidate_biometric_tokens_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[InvalidatedBiometricTokensSummary]: + ) -> ApiResponse[InvalidatedBiometricTokensResponse]: """Invalidate biometric tokens Invalidates every biometric token associated with the supplied customer user ID. @@ -13905,7 +13905,7 @@ def invalidate_biometric_tokens_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "InvalidatedBiometricTokensSummary", + '200': "InvalidatedBiometricTokensResponse", } response_data = self.api_client.call_api( *_param, @@ -13972,7 +13972,7 @@ def invalidate_biometric_tokens_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "InvalidatedBiometricTokensSummary", + '200': "InvalidatedBiometricTokensResponse", } response_data = self.api_client.call_api( *_param, @@ -14360,7 +14360,7 @@ def list_biometric_tokens( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BiometricTokensList: + ) -> BiometricTokensResponse: """List biometric tokens Returns the biometric tokens associated with the supplied customer user ID. @@ -14398,7 +14398,7 @@ def list_biometric_tokens( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BiometricTokensList", + '200': "BiometricTokensResponse", } response_data = self.api_client.call_api( *_param, @@ -14427,7 +14427,7 @@ def list_biometric_tokens_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BiometricTokensList]: + ) -> ApiResponse[BiometricTokensResponse]: """List biometric tokens Returns the biometric tokens associated with the supplied customer user ID. @@ -14465,7 +14465,7 @@ def list_biometric_tokens_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BiometricTokensList", + '200': "BiometricTokensResponse", } response_data = self.api_client.call_api( *_param, @@ -14532,7 +14532,7 @@ def list_biometric_tokens_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BiometricTokensList", + '200': "BiometricTokensResponse", } response_data = self.api_client.call_api( *_param, @@ -20577,7 +20577,7 @@ def update_biometric_token( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> UpdateBiometricToken200Response: + ) -> UpdatedBiometricTokenResponse: """Update biometric token Updates a biometric token's status. @@ -20621,7 +20621,7 @@ def update_biometric_token( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateBiometricToken200Response", + '200': "UpdatedBiometricTokenResponse", } response_data = self.api_client.call_api( *_param, @@ -20652,7 +20652,7 @@ def update_biometric_token_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[UpdateBiometricToken200Response]: + ) -> ApiResponse[UpdatedBiometricTokenResponse]: """Update biometric token Updates a biometric token's status. @@ -20696,7 +20696,7 @@ def update_biometric_token_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateBiometricToken200Response", + '200': "UpdatedBiometricTokenResponse", } response_data = self.api_client.call_api( *_param, @@ -20771,7 +20771,7 @@ def update_biometric_token_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateBiometricToken200Response", + '200': "UpdatedBiometricTokenResponse", } response_data = self.api_client.call_api( *_param, diff --git a/onfido/models/__init__.py b/onfido/models/__init__.py index f6939ed..0206a57 100644 --- a/onfido/models/__init__.py +++ b/onfido/models/__init__.py @@ -31,8 +31,9 @@ from onfido.models.applicants_list import ApplicantsList from onfido.models.biometric_token import BiometricToken from onfido.models.biometric_token_data import BiometricTokenData +from onfido.models.biometric_token_response import BiometricTokenResponse from onfido.models.biometric_token_updater import BiometricTokenUpdater -from onfido.models.biometric_tokens_list import BiometricTokensList +from onfido.models.biometric_tokens_response import BiometricTokensResponse from onfido.models.check import Check from onfido.models.check_builder import CheckBuilder from onfido.models.check_request import CheckRequest @@ -201,9 +202,10 @@ from onfido.models.india_pan_report_all_of_breakdown_device_breakdown_pan_valid import IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid from onfido.models.india_pan_report_all_of_properties import IndiaPanReportAllOfProperties from onfido.models.india_pan_report_all_of_properties_device import IndiaPanReportAllOfPropertiesDevice +from onfido.models.invalidated_biometric_token_response import InvalidatedBiometricTokenResponse from onfido.models.invalidated_biometric_token_summary import InvalidatedBiometricTokenSummary from onfido.models.invalidated_biometric_token_summary_deleted_items import InvalidatedBiometricTokenSummaryDeletedItems -from onfido.models.invalidated_biometric_tokens_summary import InvalidatedBiometricTokensSummary +from onfido.models.invalidated_biometric_tokens_response import InvalidatedBiometricTokensResponse from onfido.models.known_faces_breakdown import KnownFacesBreakdown from onfido.models.known_faces_breakdown_image_integrity import KnownFacesBreakdownImageIntegrity from onfido.models.known_faces_breakdown_previously_seen_faces import KnownFacesBreakdownPreviouslySeenFaces @@ -258,7 +260,7 @@ from onfido.models.task import Task from onfido.models.task_item import TaskItem from onfido.models.timeline_file_reference import TimelineFileReference -from onfido.models.update_biometric_token200_response import UpdateBiometricToken200Response +from onfido.models.updated_biometric_token_response import UpdatedBiometricTokenResponse from onfido.models.us_driving_licence_breakdown import UsDrivingLicenceBreakdown from onfido.models.us_driving_licence_breakdown_address import UsDrivingLicenceBreakdownAddress from onfido.models.us_driving_licence_breakdown_address_breakdown import UsDrivingLicenceBreakdownAddressBreakdown diff --git a/onfido/models/biometric_token.py b/onfido/models/biometric_token.py index 09a6985..b75da4b 100644 --- a/onfido/models/biometric_token.py +++ b/onfido/models/biometric_token.py @@ -17,18 +17,21 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List +from uuid import UUID +from onfido.models.biometric_token_data import BiometricTokenData from typing import Optional, Set from typing_extensions import Self class BiometricToken(BaseModel): """ - BiometricToken + Biometric token. """ # noqa: E501 - biometric_token: BiometricToken + uuid: UUID = Field(description="The biometric token's unique identifier.") + data: BiometricTokenData additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["biometric_token"] + __properties: ClassVar[List[str]] = ["uuid", "data"] model_config = ConfigDict( populate_by_name=True, @@ -71,9 +74,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of biometric_token - if self.biometric_token: - _dict['biometric_token'] = self.biometric_token.to_dict() + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() # 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(): @@ -91,7 +94,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "biometric_token": BiometricToken.from_dict(obj["biometric_token"]) if obj.get("biometric_token") is not None else None + "uuid": obj.get("uuid"), + "data": BiometricTokenData.from_dict(obj["data"]) if obj.get("data") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): @@ -100,6 +104,4 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return _obj -# TODO: Rewrite to not use raise_errors -BiometricToken.model_rebuild(raise_errors=False) diff --git a/onfido/models/update_biometric_token200_response.py b/onfido/models/biometric_token_response.py similarity index 92% rename from onfido/models/update_biometric_token200_response.py rename to onfido/models/biometric_token_response.py index 13b6f07..7637cdc 100644 --- a/onfido/models/update_biometric_token200_response.py +++ b/onfido/models/biometric_token_response.py @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class UpdateBiometricToken200Response(BaseModel): +class BiometricTokenResponse(BaseModel): """ - UpdateBiometricToken200Response + BiometricTokenResponse """ # noqa: E501 biometric_token: BiometricToken additional_properties: Dict[str, Any] = {} @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of UpdateBiometricToken200Response from a JSON string""" + """Create an instance of BiometricTokenResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of UpdateBiometricToken200Response from a dict""" + """Create an instance of BiometricTokenResponse from a dict""" if obj is None: return None diff --git a/onfido/models/biometric_tokens_list.py b/onfido/models/biometric_tokens_response.py similarity index 93% rename from onfido/models/biometric_tokens_list.py rename to onfido/models/biometric_tokens_response.py index 305a3fa..d8f9355 100644 --- a/onfido/models/biometric_tokens_list.py +++ b/onfido/models/biometric_tokens_response.py @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class BiometricTokensList(BaseModel): +class BiometricTokensResponse(BaseModel): """ - BiometricTokensList + BiometricTokensResponse """ # noqa: E501 biometric_tokens: List[BiometricToken] additional_properties: Dict[str, Any] = {} @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of BiometricTokensList from a JSON string""" + """Create an instance of BiometricTokensResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -88,7 +88,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of BiometricTokensList from a dict""" + """Create an instance of BiometricTokensResponse from a dict""" if obj is None: return None diff --git a/onfido/models/invalidated_biometric_token_response.py b/onfido/models/invalidated_biometric_token_response.py new file mode 100644 index 0000000..f704736 --- /dev/null +++ b/onfido/models/invalidated_biometric_token_response.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Onfido Public API v3.6 + + The Onfido Public 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 +from typing import Any, ClassVar, Dict, List +from onfido.models.invalidated_biometric_token_summary import InvalidatedBiometricTokenSummary +from typing import Optional, Set +from typing_extensions import Self + +class InvalidatedBiometricTokenResponse(BaseModel): + """ + InvalidatedBiometricTokenResponse + """ # noqa: E501 + biometric_token: InvalidatedBiometricTokenSummary + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["biometric_token"] + + 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 InvalidatedBiometricTokenResponse 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 biometric_token + if self.biometric_token: + _dict['biometric_token'] = self.biometric_token.to_dict() + # 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 InvalidatedBiometricTokenResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "biometric_token": InvalidatedBiometricTokenSummary.from_dict(obj["biometric_token"]) if obj.get("biometric_token") 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/invalidated_biometric_token_summary.py b/onfido/models/invalidated_biometric_token_summary.py index 9d16e3c..94aa481 100644 --- a/onfido/models/invalidated_biometric_token_summary.py +++ b/onfido/models/invalidated_biometric_token_summary.py @@ -19,16 +19,17 @@ from pydantic import BaseModel, ConfigDict from typing import Any, ClassVar, Dict, List +from onfido.models.invalidated_biometric_token_summary_deleted_items import InvalidatedBiometricTokenSummaryDeletedItems from typing import Optional, Set from typing_extensions import Self class InvalidatedBiometricTokenSummary(BaseModel): """ - InvalidatedBiometricTokenSummary + Invalidated biometric tokens response payload. """ # noqa: E501 - biometric_token: InvalidatedBiometricTokenSummary + deleted_items: InvalidatedBiometricTokenSummaryDeletedItems additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["biometric_token"] + __properties: ClassVar[List[str]] = ["deleted_items"] model_config = ConfigDict( populate_by_name=True, @@ -71,9 +72,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of biometric_token - if self.biometric_token: - _dict['biometric_token'] = self.biometric_token.to_dict() + # override the default output from pydantic by calling `to_dict()` of deleted_items + if self.deleted_items: + _dict['deleted_items'] = self.deleted_items.to_dict() # 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(): @@ -91,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "biometric_token": InvalidatedBiometricTokenSummary.from_dict(obj["biometric_token"]) if obj.get("biometric_token") is not None else None + "deleted_items": InvalidatedBiometricTokenSummaryDeletedItems.from_dict(obj["deleted_items"]) if obj.get("deleted_items") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): @@ -100,6 +101,4 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return _obj -# TODO: Rewrite to not use raise_errors -InvalidatedBiometricTokenSummary.model_rebuild(raise_errors=False) diff --git a/onfido/models/invalidated_biometric_tokens_summary.py b/onfido/models/invalidated_biometric_tokens_response.py similarity index 92% rename from onfido/models/invalidated_biometric_tokens_summary.py rename to onfido/models/invalidated_biometric_tokens_response.py index 13a20af..20db4fc 100644 --- a/onfido/models/invalidated_biometric_tokens_summary.py +++ b/onfido/models/invalidated_biometric_tokens_response.py @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class InvalidatedBiometricTokensSummary(BaseModel): +class InvalidatedBiometricTokensResponse(BaseModel): """ - InvalidatedBiometricTokensSummary + InvalidatedBiometricTokensResponse """ # noqa: E501 biometric_tokens: InvalidatedBiometricTokenSummary additional_properties: Dict[str, Any] = {} @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of InvalidatedBiometricTokensSummary from a JSON string""" + """Create an instance of InvalidatedBiometricTokensResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of InvalidatedBiometricTokensSummary from a dict""" + """Create an instance of InvalidatedBiometricTokensResponse from a dict""" if obj is None: return None diff --git a/onfido/models/updated_biometric_token_response.py b/onfido/models/updated_biometric_token_response.py new file mode 100644 index 0000000..cb24b60 --- /dev/null +++ b/onfido/models/updated_biometric_token_response.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Onfido Public API v3.6 + + The Onfido Public 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 +from typing import Any, ClassVar, Dict, List +from onfido.models.biometric_token import BiometricToken +from typing import Optional, Set +from typing_extensions import Self + +class UpdatedBiometricTokenResponse(BaseModel): + """ + UpdatedBiometricTokenResponse + """ # noqa: E501 + biometric_token: BiometricToken + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["biometric_token"] + + 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 UpdatedBiometricTokenResponse 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 biometric_token + if self.biometric_token: + _dict['biometric_token'] = self.biometric_token.to_dict() + # 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 UpdatedBiometricTokenResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "biometric_token": BiometricToken.from_dict(obj["biometric_token"]) if obj.get("biometric_token") 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/poetry.lock b/poetry.lock index ee9f933..d1183ec 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.2.0 and should not be changed by hand. [[package]] name = "annotated-types" @@ -383,15 +383,15 @@ files = [ [[package]] name = "filelock" -version = "3.29.4" +version = "3.29.6" description = "A platform independent file lock." optional = false python-versions = ">=3.10" groups = ["main", "dev"] markers = "python_version >= \"3.10\"" files = [ - {file = "filelock-3.29.4-py3-none-any.whl", hash = "sha256:dac1648087d5115554850d113e7dd8c83ab2d38e3435dde2d4f163847e57b767"}, - {file = "filelock-3.29.4.tar.gz", hash = "sha256:10cdb3656fc44541cdf30652a93fb10ec6b05325620eb316bd26893e4201538a"}, + {file = "filelock-3.29.6-py3-none-any.whl", hash = "sha256:14d5f5597d2e0c4dbd774cfb6d8132da1db44da83732aab679d54f7dcf97ab65"}, + {file = "filelock-3.29.6.tar.gz", hash = "sha256:895c532ef3f4ef04972b9446a8c4e2931a5c399ff3c4be4c9369f2639b80f793"}, ] [[package]] @@ -1095,14 +1095,14 @@ six = ">=1.5" [[package]] name = "python-discovery" -version = "1.4.2" +version = "1.4.3" description = "Python interpreter discovery" optional = false python-versions = ">=3.8" groups = ["main", "dev"] files = [ - {file = "python_discovery-1.4.2-py3-none-any.whl", hash = "sha256:475803f53b7b2ed6e490e27373f9d8340f7d2eebf9acdaf645d7d714c97bb500"}, - {file = "python_discovery-1.4.2.tar.gz", hash = "sha256:8f3746c4b4968d22afbb97d36e1a0e5b66e6c0f297290f2e95f05b9b8bf18690"}, + {file = "python_discovery-1.4.3-py3-none-any.whl", hash = "sha256:b6e1e4a7d9e3f6948c39746ffe8218225162d738ba39d05ab1d2f6c1cac4878c"}, + {file = "python_discovery-1.4.3.tar.gz", hash = "sha256:ad57d7045a862460d4a235986c33f13ed707d3aeb9153fa47eb7dfd0d4673289"}, ] [package.dependencies] @@ -1224,15 +1224,15 @@ virtualenv = ">=20.31.2" [[package]] name = "tox" -version = "4.56.1" +version = "4.56.2" description = "tox is a generic virtualenv management and test command line tool" optional = false python-versions = ">=3.10" groups = ["dev"] markers = "python_version >= \"3.10\"" files = [ - {file = "tox-4.56.1-py3-none-any.whl", hash = "sha256:4d06b925c4dd67872099b39c5a46fba79a2169c5f6e32060f95a8b1181f0ef55"}, - {file = "tox-4.56.1.tar.gz", hash = "sha256:db1c2610802553189cf40de251661d066a635ee0ed9bf2a60093b5f1a7f36ef8"}, + {file = "tox-4.56.2-py3-none-any.whl", hash = "sha256:245b60f2610e126070b289a862d6288401a387147e86a30c9316cb0ab276137b"}, + {file = "tox-4.56.2.tar.gz", hash = "sha256:346442f3982a5c1b792abcbc476a90f821031154251ea3506401c4c51c62cc2a"}, ] [package.dependencies] @@ -1346,14 +1346,14 @@ zstd = ["backports-zstd (>=1.0.0) ; python_version < \"3.14\""] [[package]] name = "virtualenv" -version = "21.5.1" +version = "21.6.0" description = "Virtual Python Environment builder" optional = false python-versions = ">=3.9" groups = ["main", "dev"] files = [ - {file = "virtualenv-21.5.1-py3-none-any.whl", hash = "sha256:55aa670b67bbfb991b03fda39bd3276d92c419d702376e98c5df1c9989a26783"}, - {file = "virtualenv-21.5.1.tar.gz", hash = "sha256:dca3bf98275a59c652b69d68e73433e597d977c2da9198882479d1a7188009c8"}, + {file = "virtualenv-21.6.0-py3-none-any.whl", hash = "sha256:bce9d097950fef9d81129b333babfb7767072850c2f1acce0ec536708401bfd1"}, + {file = "virtualenv-21.6.0.tar.gz", hash = "sha256:e18a4d750f2b64dea73e72ffde3922f3c52365fabdc8157ebd3da20d031c4734"}, ] [package.dependencies]