Skip to content

Commit

Permalink
Upgrade after onfido-openapi-spec change 47c86fa
Browse files Browse the repository at this point in the history
  • Loading branch information
dvacca-onfido authored and github-actions[bot] committed Jun 13, 2024
1 parent 062758d commit d9048f3
Show file tree
Hide file tree
Showing 16 changed files with 480 additions and 16 deletions.
9 changes: 9 additions & 0 deletions .release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"source": {
"repo_url": "https://github.com/onfido/onfido-openapi-spec",
"short_sha": "47c86fa",
"long_sha": "47c86fa6e15fe0a5d60afd54988a59fdcb5e2135",
"version": ""
},
"release": "v3.0.0-pre"
}
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ Webhook events payload needs to be verified before it can be accessed. Library a
pass
```

### Recommendations

#### Do not use additional properties

Retain from using `additional_properties` dictionary to access not defined properties to avoid breaking changes when these fields will appear.

## Contributing

This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) - version: 7.6.0; therefore all the contributions, except tests files, should target [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository.
This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) (version: 7.6.0); therefore all the contributions, except tests files, should target [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository.

For contributions to the tests instead, please follow the steps below:

Expand All @@ -121,11 +127,28 @@ For contributions to the tests instead, please follow the steps below:
5. Push to the branch (`git push origin my-new-feature`)
6. Create a new Pull Request

## Versioning policy

[Semantic Versioning](https://semver.org) policy is used for library versioning, following guidelines and limitations below:

- MAJOR versions (x.0.0) might:
- target a new API version
- include non-backward compatible change
- MINOR versions (0.x.0) might:
- add a new functionality, non-mandatory parameter or property
- deprecate an old functionality
- include non-backward compatible change to a functionality which is:
- labelled as alpha or beta
- completely broken and not usable
- PATCH version (0.0.x) might:
- fix a bug
- include backward compatible changes only

## More documentation

More documentation and code examples can be found at <https://documentation.onfido.com>.

## Support

Should you encounter any technical issues during integration, please contact Onfido's Customer Support team
via the [Customer Experience Portal](https://public.support.onfido.com/) which also includes support documentation.
Should you encounter any technical issues during integration, please contact Onfido's Customer Support team via the [Customer Experience Portal](https://public.support.onfido.com/) which also includes support documentation.

6 changes: 5 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.0.0"
__version__ = "3.0.0-pre"

# import apis into sdk package
from onfido.api.default_api import DefaultApi
Expand Down Expand Up @@ -141,6 +141,7 @@
from onfido.models.facial_similarity_motion_breakdown_visual_authenticity import FacialSimilarityMotionBreakdownVisualAuthenticity
from onfido.models.facial_similarity_motion_breakdown_visual_authenticity_breakdown import FacialSimilarityMotionBreakdownVisualAuthenticityBreakdown
from onfido.models.facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection import FacialSimilarityMotionBreakdownVisualAuthenticityBreakdownSpoofingDetection
from onfido.models.facial_similarity_motion_properties import FacialSimilarityMotionProperties
from onfido.models.facial_similarity_motion_report import FacialSimilarityMotionReport
from onfido.models.facial_similarity_photo_breakdown import FacialSimilarityPhotoBreakdown
from onfido.models.facial_similarity_photo_breakdown_face_comparison import FacialSimilarityPhotoBreakdownFaceComparison
Expand All @@ -159,7 +160,9 @@
from onfido.models.facial_similarity_photo_fully_auto_breakdown_image_integrity import FacialSimilarityPhotoFullyAutoBreakdownImageIntegrity
from onfido.models.facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown import FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdown
from onfido.models.facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity import FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdownSourceIntegrity
from onfido.models.facial_similarity_photo_fully_auto_properties import FacialSimilarityPhotoFullyAutoProperties
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_video_breakdown import FacialSimilarityVideoBreakdown
from onfido.models.facial_similarity_video_breakdown_face_comparison import FacialSimilarityVideoBreakdownFaceComparison
Expand All @@ -171,6 +174,7 @@
from onfido.models.facial_similarity_video_breakdown_visual_authenticity_breakdown import FacialSimilarityVideoBreakdownVisualAuthenticityBreakdown
from onfido.models.facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected import FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownLivenessDetected
from onfido.models.facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection import FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownSpoofingDetection
from onfido.models.facial_similarity_video_properties import FacialSimilarityVideoProperties
from onfido.models.facial_similarity_video_report import FacialSimilarityVideoReport
from onfido.models.id_number import IdNumber
from onfido.models.id_photo import IdPhoto
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.0.0'
self.user_agent = 'onfido-python/3.0.0-pre'
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.0.0".\
"SDK Package Version: 3.0.0-pre".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
4 changes: 4 additions & 0 deletions onfido/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
from onfido.models.facial_similarity_motion_breakdown_visual_authenticity import FacialSimilarityMotionBreakdownVisualAuthenticity
from onfido.models.facial_similarity_motion_breakdown_visual_authenticity_breakdown import FacialSimilarityMotionBreakdownVisualAuthenticityBreakdown
from onfido.models.facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection import FacialSimilarityMotionBreakdownVisualAuthenticityBreakdownSpoofingDetection
from onfido.models.facial_similarity_motion_properties import FacialSimilarityMotionProperties
from onfido.models.facial_similarity_motion_report import FacialSimilarityMotionReport
from onfido.models.facial_similarity_photo_breakdown import FacialSimilarityPhotoBreakdown
from onfido.models.facial_similarity_photo_breakdown_face_comparison import FacialSimilarityPhotoBreakdownFaceComparison
Expand All @@ -142,7 +143,9 @@
from onfido.models.facial_similarity_photo_fully_auto_breakdown_image_integrity import FacialSimilarityPhotoFullyAutoBreakdownImageIntegrity
from onfido.models.facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown import FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdown
from onfido.models.facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity import FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdownSourceIntegrity
from onfido.models.facial_similarity_photo_fully_auto_properties import FacialSimilarityPhotoFullyAutoProperties
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_video_breakdown import FacialSimilarityVideoBreakdown
from onfido.models.facial_similarity_video_breakdown_face_comparison import FacialSimilarityVideoBreakdownFaceComparison
Expand All @@ -154,6 +157,7 @@
from onfido.models.facial_similarity_video_breakdown_visual_authenticity_breakdown import FacialSimilarityVideoBreakdownVisualAuthenticityBreakdown
from onfido.models.facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected import FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownLivenessDetected
from onfido.models.facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection import FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownSpoofingDetection
from onfido.models.facial_similarity_video_properties import FacialSimilarityVideoProperties
from onfido.models.facial_similarity_video_report import FacialSimilarityVideoReport
from onfido.models.id_number import IdNumber
from onfido.models.id_photo import IdPhoto
Expand Down
100 changes: 100 additions & 0 deletions onfido/models/facial_similarity_motion_properties.py
Original file line number Diff line number Diff line change
@@ -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, StrictFloat, StrictInt
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self

class FacialSimilarityMotionProperties(BaseModel):
"""
FacialSimilarityMotionProperties
""" # noqa: E501
score: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="A floating point number between 0 and 1. The closer the score is to 0, the more likely it is to be a spoof (i.e. videos of digital screens, masks or print-outs). Conversely, the closer it is to 1, the less likely it is to be a spoof. ")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["score"]

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 FacialSimilarityMotionProperties 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 FacialSimilarityMotionProperties from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate({
"score": obj.get("score")
})
# 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: 8 additions & 2 deletions onfido/models/facial_similarity_motion_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from pydantic import BaseModel, ConfigDict, Field, StrictStr
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.report_document import ReportDocument
from onfido.models.report_name import ReportName
from onfido.models.report_result import ReportResult
Expand All @@ -43,8 +44,9 @@ class FacialSimilarityMotionReport(BaseModel):
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[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: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "documents", "name", "breakdown", "properties"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -97,6 +99,9 @@ def to_dict(self) -> Dict[str, Any]:
# override the default output from pydantic by calling `to_dict()` of breakdown
if self.breakdown:
_dict['breakdown'] = self.breakdown.to_dict()
# override the default output from pydantic by calling `to_dict()` of properties
if self.properties:
_dict['properties'] = self.properties.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():
Expand All @@ -123,7 +128,8 @@ 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"),
"breakdown": FacialSimilarityMotionBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") 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
})
# store additional fields in additional_properties
for _key in obj.keys():
Expand Down
100 changes: 100 additions & 0 deletions onfido/models/facial_similarity_photo_fully_auto_properties.py
Original file line number Diff line number Diff line change
@@ -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, StrictFloat, StrictInt
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self

class FacialSimilarityPhotoFullyAutoProperties(BaseModel):
"""
FacialSimilarityPhotoFullyAutoProperties
""" # noqa: E501
score: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="A floating point number between 0 and 1. The closer the score is to 0, the more likely it is to be a spoof (i.e. photos of printed photos, or photos of digital screens). Conversely, the closer it is to 1, the less likely it is to be a spoof. ")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["score"]

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 FacialSimilarityPhotoFullyAutoProperties 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 FacialSimilarityPhotoFullyAutoProperties from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate({
"score": obj.get("score")
})
# 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 d9048f3

Please sign in to comment.