Skip to content

Commit 9d6207a

Browse files
Merge pull request #86 from onfido/release-upgrade
Refresh onfido-python after onfido-openapi-spec update (4b15a26)
2 parents 568afd3 + 931dbcb commit 9d6207a

20 files changed

+307
-73
lines changed

.markdownlint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"MD024": false
3+
}

.release.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"source": {
33
"repo_url": "https://github.com/onfido/onfido-openapi-spec",
4-
"short_sha": "1f90650",
5-
"long_sha": "1f906509f36a1f5056df0c74b774795f8754e4ca",
6-
"version": ""
4+
"short_sha": "4b15a26",
5+
"long_sha": "4b15a26d432dcb9c3788cece0a46b5157b2e8b99",
6+
"version": "v5.1.0"
77
},
88
"release": "v5.1.0"
99
}

onfido/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@
5959
from onfido.models.country_codes import CountryCodes
6060
from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown
6161
from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown
62-
from onfido.models.device_intelligence_breakdown_breakdown_device import DeviceIntelligenceBreakdownBreakdownDevice
63-
from onfido.models.device_intelligence_breakdown_breakdown_device_breakdown import DeviceIntelligenceBreakdownBreakdownDeviceBreakdown
62+
from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice
63+
from onfido.models.device_intelligence_breakdown_device_breakdown import DeviceIntelligenceBreakdownDeviceBreakdown
6464
from onfido.models.device_intelligence_breakdown_properties import DeviceIntelligenceBreakdownProperties
6565
from onfido.models.device_intelligence_breakdown_properties_device import DeviceIntelligenceBreakdownPropertiesDevice
6666
from onfido.models.device_intelligence_breakdown_properties_geolocation import DeviceIntelligenceBreakdownPropertiesGeolocation
6767
from onfido.models.device_intelligence_breakdown_properties_ip import DeviceIntelligenceBreakdownPropertiesIp
68+
from onfido.models.device_intelligence_properties import DeviceIntelligenceProperties
6869
from onfido.models.device_intelligence_report import DeviceIntelligenceReport
6970
from onfido.models.document import Document
7071
from onfido.models.document_breakdown import DocumentBreakdown
@@ -110,7 +111,7 @@
110111
from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner
111112
from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification
112113
from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner
113-
from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation
114+
from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem
114115
from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData
115116
from onfido.models.document_properties_nfc import DocumentPropertiesNfc
116117
from onfido.models.document_report import DocumentReport

onfido/models/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@
4242
from onfido.models.country_codes import CountryCodes
4343
from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown
4444
from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown
45-
from onfido.models.device_intelligence_breakdown_breakdown_device import DeviceIntelligenceBreakdownBreakdownDevice
46-
from onfido.models.device_intelligence_breakdown_breakdown_device_breakdown import DeviceIntelligenceBreakdownBreakdownDeviceBreakdown
45+
from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice
46+
from onfido.models.device_intelligence_breakdown_device_breakdown import DeviceIntelligenceBreakdownDeviceBreakdown
4747
from onfido.models.device_intelligence_breakdown_properties import DeviceIntelligenceBreakdownProperties
4848
from onfido.models.device_intelligence_breakdown_properties_device import DeviceIntelligenceBreakdownPropertiesDevice
4949
from onfido.models.device_intelligence_breakdown_properties_geolocation import DeviceIntelligenceBreakdownPropertiesGeolocation
5050
from onfido.models.device_intelligence_breakdown_properties_ip import DeviceIntelligenceBreakdownPropertiesIp
51+
from onfido.models.device_intelligence_properties import DeviceIntelligenceProperties
5152
from onfido.models.device_intelligence_report import DeviceIntelligenceReport
5253
from onfido.models.document import Document
5354
from onfido.models.document_breakdown import DocumentBreakdown
@@ -93,7 +94,7 @@
9394
from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner
9495
from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification
9596
from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner
96-
from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation
97+
from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem
9798
from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData
9899
from onfido.models.document_properties_nfc import DocumentPropertiesNfc
99100
from onfido.models.document_report import DocumentReport

onfido/models/device_intelligence_breakdown.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from pydantic import BaseModel, ConfigDict
2121
from typing import Any, ClassVar, Dict, List, Optional
2222
from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown
23+
from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice
2324
from onfido.models.device_intelligence_breakdown_properties import DeviceIntelligenceBreakdownProperties
2425
from typing import Optional, Set
2526
from typing_extensions import Self
@@ -28,10 +29,11 @@ class DeviceIntelligenceBreakdown(BaseModel):
2829
"""
2930
DeviceIntelligenceBreakdown
3031
""" # noqa: E501
32+
device: Optional[DeviceIntelligenceBreakdownDevice] = None
3133
breakdown: Optional[DeviceIntelligenceBreakdownBreakdown] = None
3234
properties: Optional[DeviceIntelligenceBreakdownProperties] = None
3335
additional_properties: Dict[str, Any] = {}
34-
__properties: ClassVar[List[str]] = ["breakdown", "properties"]
36+
__properties: ClassVar[List[str]] = ["device", "breakdown", "properties"]
3537

3638
model_config = ConfigDict(
3739
populate_by_name=True,
@@ -74,6 +76,9 @@ def to_dict(self) -> Dict[str, Any]:
7476
exclude=excluded_fields,
7577
exclude_none=True,
7678
)
79+
# override the default output from pydantic by calling `to_dict()` of device
80+
if self.device:
81+
_dict['device'] = self.device.to_dict()
7782
# override the default output from pydantic by calling `to_dict()` of breakdown
7883
if self.breakdown:
7984
_dict['breakdown'] = self.breakdown.to_dict()
@@ -97,6 +102,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97102
return cls.model_validate(obj)
98103

99104
_obj = cls.model_validate({
105+
"device": DeviceIntelligenceBreakdownDevice.from_dict(obj["device"]) if obj.get("device") is not None else None,
100106
"breakdown": DeviceIntelligenceBreakdownBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None,
101107
"properties": DeviceIntelligenceBreakdownProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None
102108
})

onfido/models/device_intelligence_breakdown_breakdown.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
from pydantic import BaseModel, ConfigDict
2121
from typing import Any, ClassVar, Dict, List, Optional
22-
from onfido.models.device_intelligence_breakdown_breakdown_device import DeviceIntelligenceBreakdownBreakdownDevice
22+
from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice
2323
from typing import Optional, Set
2424
from typing_extensions import Self
2525

2626
class DeviceIntelligenceBreakdownBreakdown(BaseModel):
2727
"""
2828
DeviceIntelligenceBreakdownBreakdown
2929
""" # noqa: E501
30-
device: Optional[DeviceIntelligenceBreakdownBreakdownDevice] = None
30+
device: Optional[DeviceIntelligenceBreakdownDevice] = None
3131
additional_properties: Dict[str, Any] = {}
3232
__properties: ClassVar[List[str]] = ["device"]
3333

@@ -92,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
9292
return cls.model_validate(obj)
9393

9494
_obj = cls.model_validate({
95-
"device": DeviceIntelligenceBreakdownBreakdownDevice.from_dict(obj["device"]) if obj.get("device") is not None else None
95+
"device": DeviceIntelligenceBreakdownDevice.from_dict(obj["device"]) if obj.get("device") is not None else None
9696
})
9797
# store additional fields in additional_properties
9898
for _key in obj.keys():

onfido/models/device_intelligence_breakdown_breakdown_device.py renamed to onfido/models/device_intelligence_breakdown_device.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
from pydantic import BaseModel, ConfigDict
2121
from typing import Any, ClassVar, Dict, List, Optional
22-
from onfido.models.device_intelligence_breakdown_breakdown_device_breakdown import DeviceIntelligenceBreakdownBreakdownDeviceBreakdown
22+
from onfido.models.device_intelligence_breakdown_device_breakdown import DeviceIntelligenceBreakdownDeviceBreakdown
2323
from typing import Optional, Set
2424
from typing_extensions import Self
2525

26-
class DeviceIntelligenceBreakdownBreakdownDevice(BaseModel):
26+
class DeviceIntelligenceBreakdownDevice(BaseModel):
2727
"""
2828
Asserts whether the device used to upload the media is trustworthy, i.e. it is a real, physical device.
2929
""" # noqa: E501
30-
breakdown: Optional[DeviceIntelligenceBreakdownBreakdownDeviceBreakdown] = None
30+
breakdown: Optional[DeviceIntelligenceBreakdownDeviceBreakdown] = None
3131
additional_properties: Dict[str, Any] = {}
3232
__properties: ClassVar[List[str]] = ["breakdown"]
3333

@@ -49,7 +49,7 @@ def to_json(self) -> str:
4949

5050
@classmethod
5151
def from_json(cls, json_str: str) -> Optional[Self]:
52-
"""Create an instance of DeviceIntelligenceBreakdownBreakdownDevice from a JSON string"""
52+
"""Create an instance of DeviceIntelligenceBreakdownDevice from a JSON string"""
5353
return cls.from_dict(json.loads(json_str))
5454

5555
def to_dict(self) -> Dict[str, Any]:
@@ -84,15 +84,15 @@ def to_dict(self) -> Dict[str, Any]:
8484

8585
@classmethod
8686
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87-
"""Create an instance of DeviceIntelligenceBreakdownBreakdownDevice from a dict"""
87+
"""Create an instance of DeviceIntelligenceBreakdownDevice from a dict"""
8888
if obj is None:
8989
return None
9090

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

9494
_obj = cls.model_validate({
95-
"breakdown": DeviceIntelligenceBreakdownBreakdownDeviceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None
95+
"breakdown": DeviceIntelligenceBreakdownDeviceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None
9696
})
9797
# store additional fields in additional_properties
9898
for _key in obj.keys():

onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.py renamed to onfido/models/device_intelligence_breakdown_device_breakdown.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
from typing import Optional, Set
2424
from typing_extensions import Self
2525

26-
class DeviceIntelligenceBreakdownBreakdownDeviceBreakdown(BaseModel):
26+
class DeviceIntelligenceBreakdownDeviceBreakdown(BaseModel):
2727
"""
28-
DeviceIntelligenceBreakdownBreakdownDeviceBreakdown
28+
DeviceIntelligenceBreakdownDeviceBreakdown
2929
""" # noqa: E501
3030
application_authenticity: Optional[DocumentBreakdownDataComparisonBreakdownIssuingCountry] = None
3131
device_integrity: Optional[DocumentBreakdownDataComparisonBreakdownIssuingCountry] = None
@@ -51,7 +51,7 @@ def to_json(self) -> str:
5151

5252
@classmethod
5353
def from_json(cls, json_str: str) -> Optional[Self]:
54-
"""Create an instance of DeviceIntelligenceBreakdownBreakdownDeviceBreakdown from a JSON string"""
54+
"""Create an instance of DeviceIntelligenceBreakdownDeviceBreakdown from a JSON string"""
5555
return cls.from_dict(json.loads(json_str))
5656

5757
def to_dict(self) -> Dict[str, Any]:
@@ -92,7 +92,7 @@ def to_dict(self) -> Dict[str, Any]:
9292

9393
@classmethod
9494
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95-
"""Create an instance of DeviceIntelligenceBreakdownBreakdownDeviceBreakdown from a dict"""
95+
"""Create an instance of DeviceIntelligenceBreakdownDeviceBreakdown from a dict"""
9696
if obj is None:
9797
return None
9898

onfido/models/device_intelligence_breakdown_properties_device.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import re # noqa: F401
1818
import json
1919

20-
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
21-
from typing import Any, ClassVar, Dict, List, Optional
20+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
21+
from typing import Any, ClassVar, Dict, List, Optional, Union
2222
from typing import Optional, Set
2323
from typing_extensions import Self
2424

@@ -36,7 +36,7 @@ class DeviceIntelligenceBreakdownPropertiesDevice(BaseModel):
3636
randomized_device: Optional[StrictBool] = Field(default=None, description="Whether the device is providing false randomized device and network information.")
3737
fake_network_request: Optional[StrictBool] = Field(default=None, description="Whether device is using stolen security tokens to send the network information.")
3838
ip_reputation: Optional[StrictStr] = Field(default=None, description="Whether there is highly suspicious traffic related to the IP address. The risk depends on the overall ratio of clear checks on a given IP.")
39-
device_fingerprint_reuse: Optional[StrictInt] = Field(default=None, description="The number of times the device was used to create a report for a new applicant. A value greater than 1 indicates potential device reuse.")
39+
device_fingerprint_reuse: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of times the device was used to create a report for a new applicant. A value greater than 1 indicates potential device reuse.")
4040
single_device_used: Optional[StrictBool] = Field(default=None, description="Whether the document or biometric media were uploaded from a single device.")
4141
document_capture: Optional[StrictStr] = Field(default=None, description="Whether the document media were live captured from the device camera.")
4242
biometric_capture: Optional[StrictStr] = Field(default=None, description="Whether the biometric media were live captured from the device camera.")
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# coding: utf-8
2+
3+
"""
4+
Onfido API v3.6
5+
6+
The Onfido API (v3.6)
7+
8+
The version of the OpenAPI document: v3.6
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
from pydantic import BaseModel, ConfigDict
21+
from typing import Any, ClassVar, Dict, List, Optional
22+
from onfido.models.device_intelligence_breakdown_properties_device import DeviceIntelligenceBreakdownPropertiesDevice
23+
from onfido.models.device_intelligence_breakdown_properties_geolocation import DeviceIntelligenceBreakdownPropertiesGeolocation
24+
from onfido.models.device_intelligence_breakdown_properties_ip import DeviceIntelligenceBreakdownPropertiesIp
25+
from typing import Optional, Set
26+
from typing_extensions import Self
27+
28+
class DeviceIntelligenceProperties(BaseModel):
29+
"""
30+
DeviceIntelligenceProperties
31+
""" # noqa: E501
32+
device: Optional[DeviceIntelligenceBreakdownPropertiesDevice] = None
33+
ip: Optional[DeviceIntelligenceBreakdownPropertiesIp] = None
34+
geolocation: Optional[DeviceIntelligenceBreakdownPropertiesGeolocation] = None
35+
additional_properties: Dict[str, Any] = {}
36+
__properties: ClassVar[List[str]] = ["device", "ip", "geolocation"]
37+
38+
model_config = ConfigDict(
39+
populate_by_name=True,
40+
validate_assignment=True,
41+
protected_namespaces=(),
42+
)
43+
44+
45+
def to_str(self) -> str:
46+
"""Returns the string representation of the model using alias"""
47+
return pprint.pformat(self.model_dump(by_alias=True))
48+
49+
def to_json(self) -> str:
50+
"""Returns the JSON representation of the model using alias"""
51+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52+
return json.dumps(self.to_dict())
53+
54+
@classmethod
55+
def from_json(cls, json_str: str) -> Optional[Self]:
56+
"""Create an instance of DeviceIntelligenceProperties from a JSON string"""
57+
return cls.from_dict(json.loads(json_str))
58+
59+
def to_dict(self) -> Dict[str, Any]:
60+
"""Return the dictionary representation of the model using alias.
61+
62+
This has the following differences from calling pydantic's
63+
`self.model_dump(by_alias=True)`:
64+
65+
* `None` is only added to the output dict for nullable fields that
66+
were set at model initialization. Other fields with value `None`
67+
are ignored.
68+
* Fields in `self.additional_properties` are added to the output dict.
69+
"""
70+
excluded_fields: Set[str] = set([
71+
"additional_properties",
72+
])
73+
74+
_dict = self.model_dump(
75+
by_alias=True,
76+
exclude=excluded_fields,
77+
exclude_none=True,
78+
)
79+
# override the default output from pydantic by calling `to_dict()` of device
80+
if self.device:
81+
_dict['device'] = self.device.to_dict()
82+
# override the default output from pydantic by calling `to_dict()` of ip
83+
if self.ip:
84+
_dict['ip'] = self.ip.to_dict()
85+
# override the default output from pydantic by calling `to_dict()` of geolocation
86+
if self.geolocation:
87+
_dict['geolocation'] = self.geolocation.to_dict()
88+
# puts key-value pairs in additional_properties in the top level
89+
if self.additional_properties is not None:
90+
for _key, _value in self.additional_properties.items():
91+
_dict[_key] = _value
92+
93+
return _dict
94+
95+
@classmethod
96+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97+
"""Create an instance of DeviceIntelligenceProperties from a dict"""
98+
if obj is None:
99+
return None
100+
101+
if not isinstance(obj, dict):
102+
return cls.model_validate(obj)
103+
104+
_obj = cls.model_validate({
105+
"device": DeviceIntelligenceBreakdownPropertiesDevice.from_dict(obj["device"]) if obj.get("device") is not None else None,
106+
"ip": DeviceIntelligenceBreakdownPropertiesIp.from_dict(obj["ip"]) if obj.get("ip") is not None else None,
107+
"geolocation": DeviceIntelligenceBreakdownPropertiesGeolocation.from_dict(obj["geolocation"]) if obj.get("geolocation") is not None else None
108+
})
109+
# store additional fields in additional_properties
110+
for _key in obj.keys():
111+
if _key not in cls.__properties:
112+
_obj.additional_properties[_key] = obj.get(_key)
113+
114+
return _obj
115+
116+

0 commit comments

Comments
 (0)