Skip to content

Commit

Permalink
Merge pull request #71 from onfido/release-upgrade
Browse files Browse the repository at this point in the history
Refresh onfido-python after onfido-openapi-spec update (08508b9)
  • Loading branch information
dvacca-onfido authored Sep 20, 2024
2 parents f9f79df + 1422f1d commit 6aa96ab
Show file tree
Hide file tree
Showing 17 changed files with 947 additions and 14 deletions.
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": "f941ec8",
"long_sha": "f941ec84c3aeb0d3fcceea537991ba7e1ac96414",
"version": "v3.3.0"
"short_sha": "08508b9",
"long_sha": "08508b9517238b3becb4265130633a418a8ee319",
"version": "v3.5.0"
},
"release": "v3.4.0"
"release": "v3.5.0"
}
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## v3.4.0 24th July 2024

- Release based on Onfido OpenAPI spec version [v3.3.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v3.3.0):
- Expose `customer_user_id` in `workflow_runs`
- Add `sdk_token` to workflow run schema
- Expose `customer_user_id` in `workflow_runs`
- Add `sdk_token` to workflow run schema

## v3.3.0 17th July 2024

Expand Down
10 changes: 9 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__ = "3.4.0"
__version__ = "3.5.0"

# import apis into sdk package
from onfido.api.default_api import DefaultApi
Expand Down Expand Up @@ -271,6 +271,14 @@
from onfido.models.watchlist_aml_report import WatchlistAmlReport
from onfido.models.watchlist_enhanced_breakdown import WatchlistEnhancedBreakdown
from onfido.models.watchlist_enhanced_properties import WatchlistEnhancedProperties
from onfido.models.watchlist_enhanced_properties_records_inner import WatchlistEnhancedPropertiesRecordsInner
from onfido.models.watchlist_enhanced_properties_records_inner_address_inner import WatchlistEnhancedPropertiesRecordsInnerAddressInner
from onfido.models.watchlist_enhanced_properties_records_inner_alias_inner import WatchlistEnhancedPropertiesRecordsInnerAliasInner
from onfido.models.watchlist_enhanced_properties_records_inner_associate_inner import WatchlistEnhancedPropertiesRecordsInnerAssociateInner
from onfido.models.watchlist_enhanced_properties_records_inner_attribute_inner import WatchlistEnhancedPropertiesRecordsInnerAttributeInner
from onfido.models.watchlist_enhanced_properties_records_inner_event_inner import WatchlistEnhancedPropertiesRecordsInnerEventInner
from onfido.models.watchlist_enhanced_properties_records_inner_event_inner_source import WatchlistEnhancedPropertiesRecordsInnerEventInnerSource
from onfido.models.watchlist_enhanced_properties_records_inner_source_inner import WatchlistEnhancedPropertiesRecordsInnerSourceInner
from onfido.models.watchlist_enhanced_report import WatchlistEnhancedReport
from onfido.models.watchlist_monitor import WatchlistMonitor
from onfido.models.watchlist_monitor_builder import WatchlistMonitorBuilder
Expand Down
2 changes: 1 addition & 1 deletion onfido/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'onfido-python/3.4.0'
self.user_agent = 'onfido-python/3.5.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 @@ -383,7 +383,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: v3.6\n"\
"SDK Package Version: 3.4.0".\
"SDK Package Version: 3.5.0".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
8 changes: 8 additions & 0 deletions onfido/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@
from onfido.models.watchlist_aml_report import WatchlistAmlReport
from onfido.models.watchlist_enhanced_breakdown import WatchlistEnhancedBreakdown
from onfido.models.watchlist_enhanced_properties import WatchlistEnhancedProperties
from onfido.models.watchlist_enhanced_properties_records_inner import WatchlistEnhancedPropertiesRecordsInner
from onfido.models.watchlist_enhanced_properties_records_inner_address_inner import WatchlistEnhancedPropertiesRecordsInnerAddressInner
from onfido.models.watchlist_enhanced_properties_records_inner_alias_inner import WatchlistEnhancedPropertiesRecordsInnerAliasInner
from onfido.models.watchlist_enhanced_properties_records_inner_associate_inner import WatchlistEnhancedPropertiesRecordsInnerAssociateInner
from onfido.models.watchlist_enhanced_properties_records_inner_attribute_inner import WatchlistEnhancedPropertiesRecordsInnerAttributeInner
from onfido.models.watchlist_enhanced_properties_records_inner_event_inner import WatchlistEnhancedPropertiesRecordsInnerEventInner
from onfido.models.watchlist_enhanced_properties_records_inner_event_inner_source import WatchlistEnhancedPropertiesRecordsInnerEventInnerSource
from onfido.models.watchlist_enhanced_properties_records_inner_source_inner import WatchlistEnhancedPropertiesRecordsInnerSourceInner
from onfido.models.watchlist_enhanced_report import WatchlistEnhancedReport
from onfido.models.watchlist_monitor import WatchlistMonitor
from onfido.models.watchlist_monitor_builder import WatchlistMonitorBuilder
Expand Down
14 changes: 11 additions & 3 deletions onfido/models/watchlist_enhanced_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from pydantic import BaseModel, ConfigDict, Field
from typing import Any, ClassVar, Dict, List, Optional
from onfido.models.watchlist_enhanced_properties_records_inner import WatchlistEnhancedPropertiesRecordsInner
from typing import Optional, Set
from typing_extensions import Self

class WatchlistEnhancedProperties(BaseModel):
"""
WatchlistEnhancedProperties
""" # noqa: E501
records: Optional[List[StrictStr]] = Field(default=None, description="Returns any matches including, but not limited to, name and date of birth of match, aliases and associates, and relevant events and sources.")
records: Optional[List[WatchlistEnhancedPropertiesRecordsInner]] = Field(default=None, description="Returns any matches including, but not limited to, name and date of birth of match, aliases and associates, and relevant events and sources.")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["records"]

Expand Down Expand Up @@ -71,6 +72,13 @@ 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 records (list)
_items = []
if self.records:
for _item in self.records:
if _item:
_items.append(_item.to_dict())
_dict['records'] = _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():
Expand All @@ -88,7 +96,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
return cls.model_validate(obj)

_obj = cls.model_validate({
"records": obj.get("records")
"records": [WatchlistEnhancedPropertiesRecordsInner.from_dict(_item) for _item in obj["records"]] if obj.get("records") is not None else None
})
# store additional fields in additional_properties
for _key in obj.keys():
Expand Down
164 changes: 164 additions & 0 deletions onfido/models/watchlist_enhanced_properties_records_inner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# 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, Optional
from onfido.models.watchlist_enhanced_properties_records_inner_address_inner import WatchlistEnhancedPropertiesRecordsInnerAddressInner
from onfido.models.watchlist_enhanced_properties_records_inner_alias_inner import WatchlistEnhancedPropertiesRecordsInnerAliasInner
from onfido.models.watchlist_enhanced_properties_records_inner_associate_inner import WatchlistEnhancedPropertiesRecordsInnerAssociateInner
from onfido.models.watchlist_enhanced_properties_records_inner_attribute_inner import WatchlistEnhancedPropertiesRecordsInnerAttributeInner
from onfido.models.watchlist_enhanced_properties_records_inner_event_inner import WatchlistEnhancedPropertiesRecordsInnerEventInner
from onfido.models.watchlist_enhanced_properties_records_inner_source_inner import WatchlistEnhancedPropertiesRecordsInnerSourceInner
from typing import Optional, Set
from typing_extensions import Self

class WatchlistEnhancedPropertiesRecordsInner(BaseModel):
"""
WatchlistEnhancedPropertiesRecordsInner
""" # noqa: E501
address: Optional[List[WatchlistEnhancedPropertiesRecordsInnerAddressInner]] = Field(default=None, description="All addresses on file.")
alias: Optional[List[WatchlistEnhancedPropertiesRecordsInnerAliasInner]] = Field(default=None, description="Any names that the person is also known as.")
associate: Optional[List[WatchlistEnhancedPropertiesRecordsInnerAssociateInner]] = Field(default=None, description="Any linked persons, for example family relatives or business partners.")
attribute: Optional[List[WatchlistEnhancedPropertiesRecordsInnerAttributeInner]] = Field(default=None, description="Information about the person, for example hair color or nationality.")
date_of_birth: Optional[List[StrictStr]] = Field(default=None, description="All the date of births on file.")
event: Optional[List[WatchlistEnhancedPropertiesRecordsInnerEventInner]] = Field(default=None, description="Information about events that have occurred to the person, for example deportation or arrest.")
full_name: Optional[StrictStr] = Field(default=None, description="The name on file")
position: Optional[List[StrictStr]] = Field(default=None, description="The role, country and date of each position.")
source: Optional[List[WatchlistEnhancedPropertiesRecordsInnerSourceInner]] = Field(default=None, description="Details about where the information was obtained.")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["address", "alias", "associate", "attribute", "date_of_birth", "event", "full_name", "position", "source"]

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 WatchlistEnhancedPropertiesRecordsInner 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 address (list)
_items = []
if self.address:
for _item in self.address:
if _item:
_items.append(_item.to_dict())
_dict['address'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in alias (list)
_items = []
if self.alias:
for _item in self.alias:
if _item:
_items.append(_item.to_dict())
_dict['alias'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in associate (list)
_items = []
if self.associate:
for _item in self.associate:
if _item:
_items.append(_item.to_dict())
_dict['associate'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in attribute (list)
_items = []
if self.attribute:
for _item in self.attribute:
if _item:
_items.append(_item.to_dict())
_dict['attribute'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in event (list)
_items = []
if self.event:
for _item in self.event:
if _item:
_items.append(_item.to_dict())
_dict['event'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in source (list)
_items = []
if self.source:
for _item in self.source:
if _item:
_items.append(_item.to_dict())
_dict['source'] = _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 WatchlistEnhancedPropertiesRecordsInner from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate({
"address": [WatchlistEnhancedPropertiesRecordsInnerAddressInner.from_dict(_item) for _item in obj["address"]] if obj.get("address") is not None else None,
"alias": [WatchlistEnhancedPropertiesRecordsInnerAliasInner.from_dict(_item) for _item in obj["alias"]] if obj.get("alias") is not None else None,
"associate": [WatchlistEnhancedPropertiesRecordsInnerAssociateInner.from_dict(_item) for _item in obj["associate"]] if obj.get("associate") is not None else None,
"attribute": [WatchlistEnhancedPropertiesRecordsInnerAttributeInner.from_dict(_item) for _item in obj["attribute"]] if obj.get("attribute") is not None else None,
"date_of_birth": obj.get("date_of_birth"),
"event": [WatchlistEnhancedPropertiesRecordsInnerEventInner.from_dict(_item) for _item in obj["event"]] if obj.get("event") is not None else None,
"full_name": obj.get("full_name"),
"position": obj.get("position"),
"source": [WatchlistEnhancedPropertiesRecordsInnerSourceInner.from_dict(_item) for _item in obj["source"]] if obj.get("source") 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


Loading

0 comments on commit 6aa96ab

Please sign in to comment.