Skip to content

Commit b7c236a

Browse files
authored
feat: Serialize datetime in Job Create DTO into JSON (#5)
1 parent 7a265de commit b7c236a

File tree

7 files changed

+16
-6
lines changed

7 files changed

+16
-6
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Please, include the `User-Agent` header with the name of your application or pro
1313
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
1414

1515
- API version: Latest
16-
- Package version: 0.3.0
16+
- Package version: 0.3.1
1717
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1818

1919
## Requirements.

phrasetms_client/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"""
1515

1616

17-
__version__ = "0.3.0"
17+
__version__ = "0.3.1"
1818

1919
# import apis into sdk package
2020
from phrasetms_client.api.additional_workflow_step_api import AdditionalWorkflowStepApi

phrasetms_client/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def to_debug_report(self):
423423
"OS: {env}\n"
424424
"Python Version: {pyversion}\n"
425425
"Version of the API: Latest\n"
426-
"SDK Package Version: 0.3.0".format(env=sys.platform, pyversion=sys.version)
426+
"SDK Package Version: 0.3.1".format(env=sys.platform, pyversion=sys.version)
427427
)
428428

429429
def get_host_settings(self):

phrasetms_client/models/job_create_request_dto.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from phrasetms_client.models.providers_per_language import ProvidersPerLanguage
2626
from phrasetms_client.models.uid_reference import UidReference
2727
from phrasetms_client.models.workflow_step_configuration import WorkflowStepConfiguration
28+
from phrasetms_client.utils import DateTimeEncoder
2829

2930
class JobCreateRequestDto(BaseModel):
3031
"""
@@ -54,7 +55,7 @@ def to_str(self) -> str:
5455

5556
def to_json(self) -> str:
5657
"""Returns the JSON representation of the model using alias"""
57-
return json.dumps(self.to_dict())
58+
return json.dumps(self.to_dict(), cls=DateTimeEncoder)
5859

5960
@classmethod
6061
def from_json(cls, json_str: str) -> JobCreateRequestDto:

phrasetms_client/utils.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from datetime import datetime
2+
import json
3+
4+
class DateTimeEncoder(json.JSONEncoder):
5+
def default(self, o):
6+
if isinstance(o, datetime):
7+
return o.isoformat()
8+
9+
return super().default(o)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "phrasetms_client"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "Phrase TMS API"
55
authors = ["Martin Chrástek"]
66
license = "NoLicense"

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# prerequisite: setuptools
2222
# http://pypi.python.org/pypi/setuptools
2323
NAME = "phrasetms-client"
24-
VERSION = "0.3.0"
24+
VERSION = "0.3.1"
2525
PYTHON_REQUIRES = ">=3.7"
2626
REQUIRES = ["urllib3 >= 1.25.3", "python-dateutil", "pydantic >= 1.10.5, < 2", "aenum"]
2727

0 commit comments

Comments
 (0)