onfido-python 5.6.0__py3-none-any.whl → 5.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
onfido/api_client.py CHANGED
@@ -90,7 +90,7 @@ class ApiClient:
90
90
  self.default_headers[header_name] = header_value
91
91
  self.cookie = cookie
92
92
  # Set default User-Agent.
93
- self.user_agent = 'onfido-python/5.6.0'
93
+ self.user_agent = 'onfido-python/5.7.0'
94
94
  self.client_side_validation = configuration.client_side_validation
95
95
 
96
96
  def __enter__(self):
onfido/configuration.py CHANGED
@@ -501,7 +501,7 @@ conf = onfido.Configuration(
501
501
  "OS: {env}\n"\
502
502
  "Python Version: {pyversion}\n"\
503
503
  "Version of the API: v3.6\n"\
504
- "SDK Package Version: 5.6.0".\
504
+ "SDK Package Version: 5.7.0".\
505
505
  format(env=sys.platform, pyversion=sys.version)
506
506
 
507
507
  def get_host_settings(self) -> List[HostSetting]:
onfido/models/__init__.py CHANGED
@@ -215,6 +215,9 @@ from onfido.models.location_builder import LocationBuilder
215
215
  from onfido.models.location_shared import LocationShared
216
216
  from onfido.models.motion_capture import MotionCapture
217
217
  from onfido.models.motion_captures_list import MotionCapturesList
218
+ from onfido.models.passkey import Passkey
219
+ from onfido.models.passkey_updater import PasskeyUpdater
220
+ from onfido.models.passkeys_list import PasskeysList
218
221
  from onfido.models.photo_auto_reasons import PhotoAutoReasons
219
222
  from onfido.models.photo_reasons import PhotoReasons
220
223
  from onfido.models.proof_of_address_breakdown import ProofOfAddressBreakdown
@@ -243,6 +246,10 @@ from onfido.models.sdk_token import SdkToken
243
246
  from onfido.models.sdk_token_builder import SdkTokenBuilder
244
247
  from onfido.models.sdk_token_request import SdkTokenRequest
245
248
  from onfido.models.sdk_token_response import SdkTokenResponse
249
+ from onfido.models.signing_document import SigningDocument
250
+ from onfido.models.signing_document_response import SigningDocumentResponse
251
+ from onfido.models.signing_document_shared import SigningDocumentShared
252
+ from onfido.models.signing_documents_list import SigningDocumentsList
246
253
  from onfido.models.task import Task
247
254
  from onfido.models.task_item import TaskItem
248
255
  from onfido.models.timeline_file_reference import TimelineFileReference
@@ -47,6 +47,7 @@ class DocumentProperties(BaseModel):
47
47
  nationality: Optional[StrictStr] = None
48
48
  issuing_state: Optional[StrictStr] = None
49
49
  issuing_date: Optional[date] = None
50
+ valid_from: Optional[date] = None
50
51
  categorisation: Optional[StrictStr] = None
51
52
  mrz_line1: Optional[StrictStr] = None
52
53
  mrz_line2: Optional[StrictStr] = None
@@ -80,7 +81,7 @@ class DocumentProperties(BaseModel):
80
81
  document_classification: Optional[DocumentPropertiesDocumentClassification] = None
81
82
  extracted_data: Optional[DocumentPropertiesExtractedData] = None
82
83
  additional_properties: Dict[str, Any] = {}
83
- __properties: ClassVar[List[str]] = ["date_of_birth", "date_of_expiry", "personal_number", "document_numbers", "document_type", "first_name", "middle_name", "last_name", "gender", "issuing_country", "nationality", "issuing_state", "issuing_date", "categorisation", "mrz_line1", "mrz_line2", "mrz_line3", "address", "place_of_birth", "spouse_name", "widow_name", "alias_name", "issuing_authority", "remarks", "civil_state", "expatriation", "father_name", "mother_name", "religion", "type_of_permit", "version_number", "document_subtype", "profession", "security_document_number", "tax_number", "nist_identity_evidence_strength", "has_issuance_confirmation", "real_id_compliance", "security_tier", "address_lines", "barcode", "nfc", "driving_licence_information", "document_classification", "extracted_data"]
84
+ __properties: ClassVar[List[str]] = ["date_of_birth", "date_of_expiry", "personal_number", "document_numbers", "document_type", "first_name", "middle_name", "last_name", "gender", "issuing_country", "nationality", "issuing_state", "issuing_date", "valid_from", "categorisation", "mrz_line1", "mrz_line2", "mrz_line3", "address", "place_of_birth", "spouse_name", "widow_name", "alias_name", "issuing_authority", "remarks", "civil_state", "expatriation", "father_name", "mother_name", "religion", "type_of_permit", "version_number", "document_subtype", "profession", "security_document_number", "tax_number", "nist_identity_evidence_strength", "has_issuance_confirmation", "real_id_compliance", "security_tier", "address_lines", "barcode", "nfc", "driving_licence_information", "document_classification", "extracted_data"]
84
85
 
85
86
  @field_validator('nist_identity_evidence_strength')
86
87
  def nist_identity_evidence_strength_validate_enum(cls, value):
@@ -216,6 +217,7 @@ class DocumentProperties(BaseModel):
216
217
  "nationality": obj.get("nationality"),
217
218
  "issuing_state": obj.get("issuing_state"),
218
219
  "issuing_date": obj.get("issuing_date"),
220
+ "valid_from": obj.get("valid_from"),
219
221
  "categorisation": obj.get("categorisation"),
220
222
  "mrz_line1": obj.get("mrz_line1"),
221
223
  "mrz_line2": obj.get("mrz_line2"),
@@ -49,6 +49,7 @@ class DocumentWithDriverVerificationReportAllOfProperties(BaseModel):
49
49
  nationality: Optional[StrictStr] = None
50
50
  issuing_state: Optional[StrictStr] = None
51
51
  issuing_date: Optional[date] = None
52
+ valid_from: Optional[date] = None
52
53
  categorisation: Optional[StrictStr] = None
53
54
  mrz_line1: Optional[StrictStr] = None
54
55
  mrz_line2: Optional[StrictStr] = None
@@ -89,7 +90,7 @@ class DocumentWithDriverVerificationReportAllOfProperties(BaseModel):
89
90
  vehicle_class_details: Optional[List[DocumentWithDriverVerificationReportAllOfPropertiesAllOfVehicleClassDetailsInner]] = Field(default=None, description="Detailed classes/categories information")
90
91
  passenger_vehicle: Optional[DocumentWithDriverVerificationReportAllOfPropertiesAllOfPassengerVehicle] = None
91
92
  additional_properties: Dict[str, Any] = {}
92
- __properties: ClassVar[List[str]] = ["date_of_birth", "date_of_expiry", "personal_number", "document_numbers", "document_type", "first_name", "middle_name", "last_name", "gender", "issuing_country", "nationality", "issuing_state", "issuing_date", "categorisation", "mrz_line1", "mrz_line2", "mrz_line3", "address", "place_of_birth", "spouse_name", "widow_name", "alias_name", "issuing_authority", "remarks", "civil_state", "expatriation", "father_name", "mother_name", "religion", "type_of_permit", "version_number", "document_subtype", "profession", "security_document_number", "tax_number", "nist_identity_evidence_strength", "has_issuance_confirmation", "real_id_compliance", "security_tier", "address_lines", "barcode", "nfc", "driving_licence_information", "document_classification", "extracted_data", "drivers_licence", "restricted_licence", "raw_licence_category", "raw_vehicle_classes", "manual_transmission_restriction", "vehicle_class_details", "passenger_vehicle"]
93
+ __properties: ClassVar[List[str]] = ["date_of_birth", "date_of_expiry", "personal_number", "document_numbers", "document_type", "first_name", "middle_name", "last_name", "gender", "issuing_country", "nationality", "issuing_state", "issuing_date", "valid_from", "categorisation", "mrz_line1", "mrz_line2", "mrz_line3", "address", "place_of_birth", "spouse_name", "widow_name", "alias_name", "issuing_authority", "remarks", "civil_state", "expatriation", "father_name", "mother_name", "religion", "type_of_permit", "version_number", "document_subtype", "profession", "security_document_number", "tax_number", "nist_identity_evidence_strength", "has_issuance_confirmation", "real_id_compliance", "security_tier", "address_lines", "barcode", "nfc", "driving_licence_information", "document_classification", "extracted_data", "drivers_licence", "restricted_licence", "raw_licence_category", "raw_vehicle_classes", "manual_transmission_restriction", "vehicle_class_details", "passenger_vehicle"]
93
94
 
94
95
  @field_validator('nist_identity_evidence_strength')
95
96
  def nist_identity_evidence_strength_validate_enum(cls, value):
@@ -235,6 +236,7 @@ class DocumentWithDriverVerificationReportAllOfProperties(BaseModel):
235
236
  "nationality": obj.get("nationality"),
236
237
  "issuing_state": obj.get("issuing_state"),
237
238
  "issuing_date": obj.get("issuing_date"),
239
+ "valid_from": obj.get("valid_from"),
238
240
  "categorisation": obj.get("categorisation"),
239
241
  "mrz_line1": obj.get("mrz_line1"),
240
242
  "mrz_line2": obj.get("mrz_line2"),
@@ -0,0 +1,116 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Onfido Public API v3.6
5
+
6
+ The Onfido Public 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 datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class Passkey(BaseModel):
27
+ """
28
+ Passkey
29
+ """ # noqa: E501
30
+ id: StrictStr = Field(description="Passkey identifier.")
31
+ application_domain: StrictStr = Field(description="domain that the passkey is registered to, the rpId.")
32
+ state: StrictStr = Field(description="Current passkey state.")
33
+ created_at: datetime = Field(description="Timestamp when the passkey was created.")
34
+ last_used_at: Optional[datetime] = Field(default=None, description="Timestamp when the passkey was last used.")
35
+ additional_properties: Dict[str, Any] = {}
36
+ __properties: ClassVar[List[str]] = ["id", "application_domain", "state", "created_at", "last_used_at"]
37
+
38
+ @field_validator('state')
39
+ def state_validate_enum(cls, value):
40
+ """Validates the enum"""
41
+ if value not in set(['ACTIVE', 'INACTIVE', 'unknown_default_open_api']):
42
+ raise ValueError("must be one of enum values ('ACTIVE', 'INACTIVE', 'unknown_default_open_api')")
43
+ return value
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of Passkey from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ * Fields in `self.additional_properties` are added to the output dict.
76
+ """
77
+ excluded_fields: Set[str] = set([
78
+ "additional_properties",
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # puts key-value pairs in additional_properties in the top level
87
+ if self.additional_properties is not None:
88
+ for _key, _value in self.additional_properties.items():
89
+ _dict[_key] = _value
90
+
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of Passkey from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate({
103
+ "id": obj.get("id"),
104
+ "application_domain": obj.get("application_domain"),
105
+ "state": obj.get("state"),
106
+ "created_at": obj.get("created_at"),
107
+ "last_used_at": obj.get("last_used_at")
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,0 +1,107 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Onfido Public API v3.6
5
+
6
+ The Onfido Public 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, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class PasskeyUpdater(BaseModel):
26
+ """
27
+ PasskeyUpdater
28
+ """ # noqa: E501
29
+ state: StrictStr = Field(description="Desired passkey state value.")
30
+ additional_properties: Dict[str, Any] = {}
31
+ __properties: ClassVar[List[str]] = ["state"]
32
+
33
+ @field_validator('state')
34
+ def state_validate_enum(cls, value):
35
+ """Validates the enum"""
36
+ if value not in set(['ACTIVE', 'INACTIVE', 'unknown_default_open_api']):
37
+ raise ValueError("must be one of enum values ('ACTIVE', 'INACTIVE', 'unknown_default_open_api')")
38
+ return value
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of PasskeyUpdater from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ * Fields in `self.additional_properties` are added to the output dict.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ "additional_properties",
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # puts key-value pairs in additional_properties in the top level
82
+ if self.additional_properties is not None:
83
+ for _key, _value in self.additional_properties.items():
84
+ _dict[_key] = _value
85
+
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of PasskeyUpdater from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "state": obj.get("state")
99
+ })
100
+ # store additional fields in additional_properties
101
+ for _key in obj.keys():
102
+ if _key not in cls.__properties:
103
+ _obj.additional_properties[_key] = obj.get(_key)
104
+
105
+ return _obj
106
+
107
+
@@ -0,0 +1,108 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Onfido Public API v3.6
5
+
6
+ The Onfido Public 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
22
+ from onfido.models.passkey import Passkey
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PasskeysList(BaseModel):
27
+ """
28
+ PasskeysList
29
+ """ # noqa: E501
30
+ passkeys: List[Passkey]
31
+ additional_properties: Dict[str, Any] = {}
32
+ __properties: ClassVar[List[str]] = ["passkeys"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of PasskeysList from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ * Fields in `self.additional_properties` are added to the output dict.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ "additional_properties",
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of each item in passkeys (list)
76
+ _items = []
77
+ if self.passkeys:
78
+ for _item_passkeys in self.passkeys:
79
+ if _item_passkeys:
80
+ _items.append(_item_passkeys.to_dict())
81
+ _dict['passkeys'] = _items
82
+ # puts key-value pairs in additional_properties in the top level
83
+ if self.additional_properties is not None:
84
+ for _key, _value in self.additional_properties.items():
85
+ _dict[_key] = _value
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of PasskeysList from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "passkeys": [Passkey.from_dict(_item) for _item in obj["passkeys"]] if obj.get("passkeys") is not None else None
100
+ })
101
+ # store additional fields in additional_properties
102
+ for _key in obj.keys():
103
+ if _key not in cls.__properties:
104
+ _obj.additional_properties[_key] = obj.get(_key)
105
+
106
+ return _obj
107
+
108
+
@@ -0,0 +1,115 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Onfido Public API v3.6
5
+
6
+ The Onfido Public 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 datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class SigningDocument(BaseModel):
27
+ """
28
+ SigningDocument
29
+ """ # noqa: E501
30
+ applicant_id: Optional[StrictStr] = Field(default=None, description="The ID of the applicant whose signing document is being uploaded.")
31
+ id: StrictStr = Field(description="The unique identifier for the signing document")
32
+ created_at: Optional[datetime] = Field(default=None, description="The date and time at which the signing document was uploaded")
33
+ href: Optional[StrictStr] = Field(default=None, description="The uri of this resource")
34
+ download_href: Optional[StrictStr] = Field(default=None, description="The uri that can be used to download the signing document")
35
+ file_type: Optional[StrictStr] = Field(default=None, description="The file type of the uploaded file")
36
+ file_name: Optional[StrictStr] = Field(default=None, description="The name of the uploaded file")
37
+ file_size: Optional[StrictInt] = Field(default=None, description="The size of the file in bytes")
38
+ additional_properties: Dict[str, Any] = {}
39
+ __properties: ClassVar[List[str]] = ["applicant_id", "id", "created_at", "href", "download_href", "file_type", "file_name", "file_size"]
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of SigningDocument from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ * Fields in `self.additional_properties` are added to the output dict.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ "additional_properties",
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ # puts key-value pairs in additional_properties in the top level
83
+ if self.additional_properties is not None:
84
+ for _key, _value in self.additional_properties.items():
85
+ _dict[_key] = _value
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of SigningDocument from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "applicant_id": obj.get("applicant_id"),
100
+ "id": obj.get("id"),
101
+ "created_at": obj.get("created_at"),
102
+ "href": obj.get("href"),
103
+ "download_href": obj.get("download_href"),
104
+ "file_type": obj.get("file_type"),
105
+ "file_name": obj.get("file_name"),
106
+ "file_size": obj.get("file_size")
107
+ })
108
+ # store additional fields in additional_properties
109
+ for _key in obj.keys():
110
+ if _key not in cls.__properties:
111
+ _obj.additional_properties[_key] = obj.get(_key)
112
+
113
+ return _obj
114
+
115
+
@@ -0,0 +1,113 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Onfido Public API v3.6
5
+
6
+ The Onfido Public 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 datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class SigningDocumentResponse(BaseModel):
27
+ """
28
+ SigningDocumentResponse
29
+ """ # noqa: E501
30
+ id: StrictStr = Field(description="The unique identifier for the signing document")
31
+ created_at: Optional[datetime] = Field(default=None, description="The date and time at which the signing document was uploaded")
32
+ href: Optional[StrictStr] = Field(default=None, description="The uri of this resource")
33
+ download_href: Optional[StrictStr] = Field(default=None, description="The uri that can be used to download the signing document")
34
+ file_type: Optional[StrictStr] = Field(default=None, description="The file type of the uploaded file")
35
+ file_name: Optional[StrictStr] = Field(default=None, description="The name of the uploaded file")
36
+ file_size: Optional[StrictInt] = Field(default=None, description="The size of the file in bytes")
37
+ additional_properties: Dict[str, Any] = {}
38
+ __properties: ClassVar[List[str]] = ["id", "created_at", "href", "download_href", "file_type", "file_name", "file_size"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of SigningDocumentResponse from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ * Fields in `self.additional_properties` are added to the output dict.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ "additional_properties",
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # puts key-value pairs in additional_properties in the top level
82
+ if self.additional_properties is not None:
83
+ for _key, _value in self.additional_properties.items():
84
+ _dict[_key] = _value
85
+
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of SigningDocumentResponse from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "id": obj.get("id"),
99
+ "created_at": obj.get("created_at"),
100
+ "href": obj.get("href"),
101
+ "download_href": obj.get("download_href"),
102
+ "file_type": obj.get("file_type"),
103
+ "file_name": obj.get("file_name"),
104
+ "file_size": obj.get("file_size")
105
+ })
106
+ # store additional fields in additional_properties
107
+ for _key in obj.keys():
108
+ if _key not in cls.__properties:
109
+ _obj.additional_properties[_key] = obj.get(_key)
110
+
111
+ return _obj
112
+
113
+