Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .release.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"source": {
"repo_url": "https://github.com/onfido/onfido-openapi-spec",
"short_sha": "be823e7",
"long_sha": "be823e7815c93bfbfc3fb764c0548f57cb851fe9",
"version": "v4.6.0"
"short_sha": "0eec622",
"long_sha": "0eec6225e66b9f905dac23fe4eb18a1584517f64",
"version": ""
},
"release": "v4.6.0"
"release": "v5.0.0"
}
3 changes: 2 additions & 1 deletion onfido/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
""" # noqa: E501


__version__ = "4.6.0"
__version__ = "5.0.0"

# import apis into sdk package
from onfido.api.default_api import DefaultApi
Expand Down Expand Up @@ -113,6 +113,7 @@
from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData
from onfido.models.document_properties_nfc import DocumentPropertiesNfc
from onfido.models.document_report import DocumentReport
from onfido.models.document_report_shared import DocumentReportShared
from onfido.models.document_response import DocumentResponse
from onfido.models.document_shared import DocumentShared
from onfido.models.document_types import DocumentTypes
Expand Down
279 changes: 279 additions & 0 deletions onfido/api/default_api.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion onfido/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.0'
self.user_agent = 'onfido-python/5.0.0'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
Expand Down
2 changes: 1 addition & 1 deletion onfido/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.0".\
"SDK Package Version: 5.0.0".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
1 change: 1 addition & 0 deletions onfido/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData
from onfido.models.document_properties_nfc import DocumentPropertiesNfc
from onfido.models.document_report import DocumentReport
from onfido.models.document_report_shared import DocumentReportShared
from onfido.models.document_response import DocumentResponse
from onfido.models.document_shared import DocumentShared
from onfido.models.document_types import DocumentTypes
Expand Down
12 changes: 1 addition & 11 deletions onfido/models/device_intelligence_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown
from onfido.models.report_document import ReportDocument
from onfido.models.report_name import ReportName
from onfido.models.report_result import ReportResult
from onfido.models.report_status import ReportStatus
Expand All @@ -40,11 +39,10 @@ class DeviceIntelligenceReport(BaseModel):
result: Optional[ReportResult] = None
sub_result: Optional[ReportSubResult] = None
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
breakdown: Optional[DeviceIntelligenceBreakdown] = None
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "breakdown"]
__properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "name", "breakdown"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -87,13 +85,6 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in documents (list)
_items = []
if self.documents:
for _item_documents in self.documents:
if _item_documents:
_items.append(_item_documents.to_dict())
_dict['documents'] = _items
# override the default output from pydantic by calling `to_dict()` of breakdown
if self.breakdown:
_dict['breakdown'] = self.breakdown.to_dict()
Expand Down Expand Up @@ -121,7 +112,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"result": obj.get("result"),
"sub_result": obj.get("sub_result"),
"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"),
"breakdown": DeviceIntelligenceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None
})
Expand Down
10 changes: 0 additions & 10 deletions onfido/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ class Document(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["file_type", "type", "side", "issuing_country", "applicant_id", "id", "created_at", "href", "download_href", "file_name", "file_size"]

@field_validator('file_type')
def file_type_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value

if value not in set(['jpg', 'jpeg', 'png', 'pdf']):
raise ValueError("must be one of enum values ('jpg', 'jpeg', 'png', 'pdf')")
return value

@field_validator('side')
def side_validate_enum(cls, value):
"""Validates the enum"""
Expand Down
6 changes: 3 additions & 3 deletions onfido/models/document_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class DocumentReport(BaseModel):
result: Optional[ReportResult] = None
sub_result: Optional[ReportSubResult] = None
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
documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine.")
breakdown: Optional[DocumentBreakdown] = None
properties: Optional[DocumentProperties] = 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", "name", "documents", "breakdown", "properties"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -126,8 +126,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"result": obj.get("result"),
"sub_result": obj.get("sub_result"),
"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"),
"documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None,
"breakdown": DocumentBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None,
"properties": DocumentProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None
})
Expand Down
108 changes: 108 additions & 0 deletions onfido/models/document_report_shared.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# 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.report_document import ReportDocument
from typing import Optional, Set
from typing_extensions import Self

class DocumentReportShared(BaseModel):
"""
DocumentReportShared
""" # noqa: E501
documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine.")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["documents"]

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 DocumentReportShared 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 documents (list)
_items = []
if self.documents:
for _item_documents in self.documents:
if _item_documents:
_items.append(_item_documents.to_dict())
_dict['documents'] = _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 DocumentReportShared from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({
"documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") 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


10 changes: 0 additions & 10 deletions onfido/models/document_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ class DocumentShared(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["file_type", "type", "side", "issuing_country", "applicant_id"]

@field_validator('file_type')
def file_type_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value

if value not in set(['jpg', 'jpeg', 'png', 'pdf']):
raise ValueError("must be one of enum values ('jpg', 'jpeg', 'png', 'pdf')")
return value

@field_validator('side')
def side_validate_enum(cls, value):
"""Validates the enum"""
Expand Down
6 changes: 3 additions & 3 deletions onfido/models/document_video_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class DocumentVideoReport(BaseModel):
result: Optional[ReportResult] = None
sub_result: Optional[ReportSubResult] = None
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
documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine.")
breakdown: Optional[DocumentBreakdown] = None
properties: Optional[DocumentProperties] = 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", "name", "documents", "breakdown", "properties"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -126,8 +126,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"result": obj.get("result"),
"sub_result": obj.get("sub_result"),
"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"),
"documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None,
"breakdown": DocumentBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None,
"properties": DocumentProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class DocumentVideoWithAddressInformationReport(BaseModel):
result: Optional[ReportResult] = None
sub_result: Optional[ReportSubResult] = None
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
documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine.")
breakdown: Optional[DocumentBreakdown] = None
properties: Optional[DocumentProperties] = 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", "name", "documents", "breakdown", "properties"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -126,8 +126,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"result": obj.get("result"),
"sub_result": obj.get("sub_result"),
"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"),
"documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None,
"breakdown": DocumentBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None,
"properties": DocumentProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None
})
Expand Down
6 changes: 3 additions & 3 deletions onfido/models/document_with_address_information_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class DocumentWithAddressInformationReport(BaseModel):
result: Optional[ReportResult] = None
sub_result: Optional[ReportSubResult] = None
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
documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine.")
breakdown: Optional[DocumentBreakdown] = None
properties: Optional[DocumentProperties] = 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", "name", "documents", "breakdown", "properties"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -126,8 +126,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"result": obj.get("result"),
"sub_result": obj.get("sub_result"),
"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"),
"documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None,
"breakdown": DocumentBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None,
"properties": DocumentProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None
})
Expand Down
6 changes: 3 additions & 3 deletions onfido/models/document_with_driver_verification_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class DocumentWithDriverVerificationReport(BaseModel):
result: Optional[ReportResult] = None
sub_result: Optional[ReportSubResult] = None
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
documents: Optional[List[ReportDocument]] = Field(default=None, description="Array of objects with document ids that were used in the Onfido engine.")
breakdown: Optional[DocumentBreakdown] = None
properties: Optional[DocumentWithDriverVerificationReportAllOfProperties] = 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", "name", "documents", "breakdown", "properties"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -126,8 +126,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"result": obj.get("result"),
"sub_result": obj.get("sub_result"),
"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"),
"documents": [ReportDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None,
"breakdown": DocumentBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None,
"properties": DocumentWithDriverVerificationReportAllOfProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None
})
Expand Down
Loading