From 293dbe55236cffec86322c231050ecfcbb82bf32 Mon Sep 17 00:00:00 2001 From: dvacca-onfido <134616519+dvacca-onfido@users.noreply.github.com> Date: Fri, 24 May 2024 15:28:38 +0000 Subject: [PATCH] Upgrade after onfido-openapi-spec change dea7c46 --- onfido/__init__.py | 2 + onfido/api/default_api.py | 533 ++++++++++++++++++++++ onfido/models/__init__.py | 2 + onfido/models/timeline_file_reference.py | 102 +++++ onfido/models/timeline_file_reference1.py | 102 +++++ 5 files changed, 741 insertions(+) create mode 100644 onfido/models/timeline_file_reference.py create mode 100644 onfido/models/timeline_file_reference1.py diff --git a/onfido/__init__.py b/onfido/__init__.py index e075c2e..ac420bd 100644 --- a/onfido/__init__.py +++ b/onfido/__init__.py @@ -246,6 +246,8 @@ from onfido.models.sdk_token_response import SdkTokenResponse from onfido.models.task import Task from onfido.models.task_item import TaskItem +from onfido.models.timeline_file_reference import TimelineFileReference +from onfido.models.timeline_file_reference1 import TimelineFileReference1 from onfido.models.us_driving_licence_breakdown import UsDrivingLicenceBreakdown from onfido.models.us_driving_licence_breakdown_address import UsDrivingLicenceBreakdownAddress from onfido.models.us_driving_licence_breakdown_address_breakdown import UsDrivingLicenceBreakdownAddressBreakdown diff --git a/onfido/api/default_api.py b/onfido/api/default_api.py index 474045e..cd435b8 100644 --- a/onfido/api/default_api.py +++ b/onfido/api/default_api.py @@ -31,6 +31,7 @@ from onfido.models.complete_task_builder import CompleteTaskBuilder from onfido.models.document import Document from onfido.models.documents_list import DocumentsList +from onfido.models.error import Error from onfido.models.extract_request import ExtractRequest from onfido.models.extraction import Extraction from onfido.models.id_photos_list import IDPhotosList @@ -50,6 +51,7 @@ from onfido.models.sdk_token_builder import SdkTokenBuilder from onfido.models.task import Task from onfido.models.task_item import TaskItem +from onfido.models.timeline_file_reference import TimelineFileReference from onfido.models.watchlist_monitor import WatchlistMonitor from onfido.models.watchlist_monitor_builder import WatchlistMonitorBuilder from onfido.models.watchlist_monitor_matches_list import WatchlistMonitorMatchesList @@ -1182,6 +1184,264 @@ def _create_check_serialize( + @validate_call + def create_timeline_file( + self, + workflow_run_id: Annotated[StrictStr, Field(description="The unique identifier of the Workflow Run.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TimelineFileReference: + """Create Timeline File for Workflow Run + + Triggers the generation of the Timeline File for the designated Workflow Run. + + :param workflow_run_id: The unique identifier of the Workflow Run. (required) + :type workflow_run_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_timeline_file_serialize( + workflow_run_id=workflow_run_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "TimelineFileReference", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_timeline_file_with_http_info( + self, + workflow_run_id: Annotated[StrictStr, Field(description="The unique identifier of the Workflow Run.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TimelineFileReference]: + """Create Timeline File for Workflow Run + + Triggers the generation of the Timeline File for the designated Workflow Run. + + :param workflow_run_id: The unique identifier of the Workflow Run. (required) + :type workflow_run_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_timeline_file_serialize( + workflow_run_id=workflow_run_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "TimelineFileReference", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_timeline_file_without_preload_content( + self, + workflow_run_id: Annotated[StrictStr, Field(description="The unique identifier of the Workflow Run.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Timeline File for Workflow Run + + Triggers the generation of the Timeline File for the designated Workflow Run. + + :param workflow_run_id: The unique identifier of the Workflow Run. (required) + :type workflow_run_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_timeline_file_serialize( + workflow_run_id=workflow_run_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "TimelineFileReference", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_timeline_file_serialize( + self, + workflow_run_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if workflow_run_id is not None: + _path_params['workflow_run_id'] = workflow_run_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/workflow_runs/{workflow_run_id}/timeline_file', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def create_watchlist_monitor( self, @@ -8227,6 +8487,279 @@ def _find_task_serialize( + @validate_call + def find_timeline_file( + self, + workflow_run_id: Annotated[StrictStr, Field(description="The unique identifier of the Workflow Run.")], + timeline_file_id: Annotated[StrictStr, Field(description="The unique identifier for the Timefile File.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Error: + """Retrieve Timeline File for Workflow Run + + Retrieves the Timeline File for the designated Workflow Run. + + :param workflow_run_id: The unique identifier of the Workflow Run. (required) + :type workflow_run_id: str + :param timeline_file_id: The unique identifier for the Timefile File. (required) + :type timeline_file_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_timeline_file_serialize( + workflow_run_id=workflow_run_id, + timeline_file_id=timeline_file_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '302': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_timeline_file_with_http_info( + self, + workflow_run_id: Annotated[StrictStr, Field(description="The unique identifier of the Workflow Run.")], + timeline_file_id: Annotated[StrictStr, Field(description="The unique identifier for the Timefile File.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Error]: + """Retrieve Timeline File for Workflow Run + + Retrieves the Timeline File for the designated Workflow Run. + + :param workflow_run_id: The unique identifier of the Workflow Run. (required) + :type workflow_run_id: str + :param timeline_file_id: The unique identifier for the Timefile File. (required) + :type timeline_file_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_timeline_file_serialize( + workflow_run_id=workflow_run_id, + timeline_file_id=timeline_file_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '302': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_timeline_file_without_preload_content( + self, + workflow_run_id: Annotated[StrictStr, Field(description="The unique identifier of the Workflow Run.")], + timeline_file_id: Annotated[StrictStr, Field(description="The unique identifier for the Timefile File.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve Timeline File for Workflow Run + + Retrieves the Timeline File for the designated Workflow Run. + + :param workflow_run_id: The unique identifier of the Workflow Run. (required) + :type workflow_run_id: str + :param timeline_file_id: The unique identifier for the Timefile File. (required) + :type timeline_file_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_timeline_file_serialize( + workflow_run_id=workflow_run_id, + timeline_file_id=timeline_file_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '302': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_timeline_file_serialize( + self, + workflow_run_id, + timeline_file_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if workflow_run_id is not None: + _path_params['workflow_run_id'] = workflow_run_id + if timeline_file_id is not None: + _path_params['timeline_file_id'] = timeline_file_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/workflow_runs/{workflow_run_id}/timeline_file/{timeline_file_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def find_watchlist_monitor( self, diff --git a/onfido/models/__init__.py b/onfido/models/__init__.py index 68d55a0..a485bd1 100644 --- a/onfido/models/__init__.py +++ b/onfido/models/__init__.py @@ -229,6 +229,8 @@ from onfido.models.sdk_token_response import SdkTokenResponse from onfido.models.task import Task from onfido.models.task_item import TaskItem +from onfido.models.timeline_file_reference import TimelineFileReference +from onfido.models.timeline_file_reference1 import TimelineFileReference1 from onfido.models.us_driving_licence_breakdown import UsDrivingLicenceBreakdown from onfido.models.us_driving_licence_breakdown_address import UsDrivingLicenceBreakdownAddress from onfido.models.us_driving_licence_breakdown_address_breakdown import UsDrivingLicenceBreakdownAddressBreakdown diff --git a/onfido/models/timeline_file_reference.py b/onfido/models/timeline_file_reference.py new file mode 100644 index 0000000..4765eff --- /dev/null +++ b/onfido/models/timeline_file_reference.py @@ -0,0 +1,102 @@ +# 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 +from typing import Optional, Set +from typing_extensions import Self + +class TimelineFileReference(BaseModel): + """ + TimelineFileReference + """ # noqa: E501 + workflow_timeline_file_id: StrictStr = Field(description="The unique identifier for the Timefile File that will be created.") + href: StrictStr = Field(description="Link to access the Timefile File that will be created.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["workflow_timeline_file_id", "href"] + + 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 TimelineFileReference 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 TimelineFileReference from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "workflow_timeline_file_id": obj.get("workflow_timeline_file_id"), + "href": obj.get("href") + }) + # 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 + + diff --git a/onfido/models/timeline_file_reference1.py b/onfido/models/timeline_file_reference1.py new file mode 100644 index 0000000..5d0d7e4 --- /dev/null +++ b/onfido/models/timeline_file_reference1.py @@ -0,0 +1,102 @@ +# 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 +from typing import Optional, Set +from typing_extensions import Self + +class TimelineFileReference1(BaseModel): + """ + TimelineFileReference1 + """ # noqa: E501 + workflow_timeline_file_id: StrictStr = Field(description="The unique identifier for the Timefile File that will be created.") + href: StrictStr = Field(description="Link to access the Timefile File that will be created.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["workflow_timeline_file_id", "href"] + + 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 TimelineFileReference1 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 TimelineFileReference1 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "workflow_timeline_file_id": obj.get("workflow_timeline_file_id"), + "href": obj.get("href") + }) + # 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 + +