Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2022-02-27 21:34:21 -08:00
parent 0b9c32e6bf
commit 9c18ba2350
13 changed files with 205 additions and 183 deletions

View File

@ -64,10 +64,10 @@ def generatePaths(cwd: str, parser: OpenApiParser):
for p in paths:
for method in paths[p]:
endpoint = paths[p][method]
generatePath(path, p, method, endpoint)
generatePath(path, p, method, endpoint, data)
def generatePath(path: str, name: str, method: str, endpoint: dict):
def generatePath(path: str, name: str, method: str, endpoint: dict, data: dict):
# Generate the path.
file_name = camel_to_snake(endpoint['operationId']) + '.py'
# Add the tag to the path if it exists.
@ -79,7 +79,7 @@ def generatePath(path: str, name: str, method: str, endpoint: dict):
print(" endpoint: ", [endpoint])
f = open(file_path, "w")
endoint_refs = getEndpointRefs(endpoint)
endoint_refs = getEndpointRefs(endpoint, data)
parameter_refs = getParameterRefs(endpoint)
request_body_refs = getRequestBodyRefs(endpoint)
@ -198,6 +198,22 @@ def generatePath(path: str, name: str, method: str, endpoint: dict):
" = " +
ref +
".from_dict(response.json())\n")
elif '$ref' in response:
schema_name = response['$ref'].replace('#/components/responses/', '')
schema = data['components']['responses'][schema_name]
if 'content' in schema:
content = schema['content']
for content_type in content:
if content_type == 'application/json':
json = content[content_type]['schema']
if '$ref' in json:
ref = json['$ref'].replace('#/components/schemas/', '')
f.write(
"\t\tresponse_" +
response_code +
" = " +
ref +
".from_dict(response.json())\n")
else:
f.write("\t\tresponse_" + response_code + " = None\n")
@ -707,7 +723,7 @@ def generateType(path: str, name: str, schema: dict):
continue
f.write(
"\t" +
"\t\t" +
property_name +
" = d.pop(\"" +
property_name +
@ -715,7 +731,7 @@ def generateType(path: str, name: str, schema: dict):
f.write("\n")
elif property_type == 'integer':
f.write(
"\t" +
"\t\t" +
property_name +
" = d.pop(\"" +
property_name +
@ -723,7 +739,7 @@ def generateType(path: str, name: str, schema: dict):
f.write("\n")
elif property_type == 'number':
f.write(
"\t" +
"\t\t" +
property_name +
" = d.pop(\"" +
property_name +
@ -731,7 +747,7 @@ def generateType(path: str, name: str, schema: dict):
f.write("\n")
elif property_type == 'boolean':
f.write(
"\t" +
"\t\t" +
property_name +
" = d.pop(\"" +
property_name +
@ -776,7 +792,7 @@ def generateType(path: str, name: str, schema: dict):
f.write("\t\t)\n")
f.write("\n")
f.write("\t\t" + camel_to_snake(name) + ".additional_properties = d\n")
f.write("return " + camel_to_snake(name) + "\n")
f.write("\t\treturn " + camel_to_snake(name) + "\n")
# write the rest of the class.
f.write("\n")
@ -862,7 +878,7 @@ def getRefs(schema: dict) -> [str]:
return refs
def getEndpointRefs(endpoint: dict) -> [str]:
def getEndpointRefs(endpoint: dict, data: dict) -> [str]:
refs = []
responses = endpoint['responses']
@ -877,6 +893,18 @@ def getEndpointRefs(endpoint: dict) -> [str]:
ref = json['$ref'].replace('#/components/schemas/', '')
if ref not in refs:
refs.append(ref)
elif '$ref' in response:
schema_name = response['$ref'].replace('#/components/responses/', '')
schema = data['components']['responses'][schema_name]
if 'content' in schema:
content = schema['content']
for content_type in content:
if content_type == 'application/json':
json = content[content_type]['schema']
if '$ref' in json:
ref = json['$ref'].replace('#/components/schemas/', '')
if ref not in refs:
refs.append(ref)
return refs

View File

@ -4,6 +4,7 @@ import httpx
from ...client import Client
from ...models.file_conversion import FileConversion
from ...models.error_message import ErrorMessage
from ...types import Response
def _get_kwargs(
@ -24,29 +25,29 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
if response.status_code == 200:
response_200 = FileConversion.from_dict(response.json())
return response_200
if response.status_code == 401:
response_401 = None
response_401 = ErrorMessage.from_dict(response.json())
return response_401
if response.status_code == 403:
response_403 = None
response_403 = ErrorMessage.from_dict(response.json())
return response_403
if response.status_code == 404:
response_404 = None
response_404 = ErrorMessage.from_dict(response.json())
return response_404
if response.status_code == 406:
response_406 = None
response_406 = ErrorMessage.from_dict(response.json())
return response_406
if response.status_code == 500:
response_500 = None
response_500 = ErrorMessage.from_dict(response.json())
return response_500
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, ErrorMessage]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -59,7 +60,7 @@ def sync_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversion]]:
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
kwargs = _get_kwargs(
id=id,
client=client,
@ -77,7 +78,7 @@ def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
""" Get the status and output of an async file conversion. """
return sync_detailed(
@ -90,7 +91,7 @@ async def asyncio_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversion]]:
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
kwargs = _get_kwargs(
id=id,
client=client,
@ -106,7 +107,7 @@ async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
""" Get the status and output of an async file conversion. """
return (

View File

@ -4,6 +4,7 @@ import httpx
from ...client import Client
from ...models.file_conversion import FileConversion
from ...models.error_message import ErrorMessage
from ...models.valid_source_file_format import ValidSourceFileFormat
from ...models.valid_output_file_format import ValidOutputFileFormat
from ...types import Response
@ -27,7 +28,7 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
if response.status_code == 200:
response_200 = FileConversion.from_dict(response.json())
return response_200
@ -35,24 +36,24 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
response_202 = FileConversion.from_dict(response.json())
return response_202
if response.status_code == 400:
response_400 = None
response_400 = ErrorMessage.from_dict(response.json())
return response_400
if response.status_code == 401:
response_401 = None
response_401 = ErrorMessage.from_dict(response.json())
return response_401
if response.status_code == 403:
response_403 = None
response_403 = ErrorMessage.from_dict(response.json())
return response_403
if response.status_code == 406:
response_406 = None
response_406 = ErrorMessage.from_dict(response.json())
return response_406
if response.status_code == 500:
response_500 = None
response_500 = ErrorMessage.from_dict(response.json())
return response_500
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, ErrorMessage]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -66,7 +67,7 @@ def sync_detailed(
output_format: ValidOutputFileFormat,
*,
client: Client,
) -> Response[Union[Any, FileConversion]]:
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
kwargs = _get_kwargs(
source_format=source_format,
output_format=output_format,
@ -86,7 +87,7 @@ def sync(
output_format: ValidOutputFileFormat,
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
""" Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously. """
return sync_detailed(
@ -101,7 +102,7 @@ async def asyncio_detailed(
output_format: ValidOutputFileFormat,
*,
client: Client,
) -> Response[Union[Any, FileConversion]]:
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
kwargs = _get_kwargs(
source_format=source_format,
output_format=output_format,
@ -119,7 +120,7 @@ async def asyncio(
output_format: ValidOutputFileFormat,
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
""" Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously. """
return (

View File

@ -3,6 +3,7 @@ from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.error_message import ErrorMessage
from ...types import Response
def _get_kwargs(
@ -22,19 +23,19 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, ]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, ErrorMessage]]:
if response.status_code == 200:
return response_200
if response.status_code == 401:
response_401 = None
response_401 = ErrorMessage.from_dict(response.json())
return response_401
if response.status_code == 403:
response_403 = None
response_403 = ErrorMessage.from_dict(response.json())
return response_403
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, ]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, ErrorMessage]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -46,7 +47,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ]]:
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, ]]:
) -> Response[Union[Any, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -62,7 +63,7 @@ def sync_detailed(
def sync(
*,
client: Client,
) -> Optional[Union[Any, ]]:
) -> Optional[Union[Any, ErrorMessage]]:
""" Get information about GPU devices on this server. This is primarily used for debugging. This endpoint can only be used by specific KittyCAD employees. """
return sync_detailed(
@ -73,7 +74,7 @@ def sync(
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, ]]:
) -> Response[Union[Any, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -87,7 +88,7 @@ async def asyncio_detailed(
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, ]]:
) -> Optional[Union[Any, ErrorMessage]]:
""" Get information about GPU devices on this server. This is primarily used for debugging. This endpoint can only be used by specific KittyCAD employees. """
return (

View File

@ -4,6 +4,7 @@ import httpx
from ...client import Client
from ...models.file_conversion import FileConversion
from ...models.error_message import ErrorMessage
from ...types import Response
def _get_kwargs(
@ -23,23 +24,23 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
if response.status_code == 200:
response_200 = FileConversion.from_dict(response.json())
return response_200
if response.status_code == 401:
response_401 = None
response_401 = ErrorMessage.from_dict(response.json())
return response_401
if response.status_code == 403:
response_403 = None
response_403 = ErrorMessage.from_dict(response.json())
return response_403
if response.status_code == 404:
response_404 = None
response_404 = ErrorMessage.from_dict(response.json())
return response_404
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, ErrorMessage]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -51,7 +52,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConv
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, FileConversion]]:
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -67,7 +68,7 @@ def sync_detailed(
def sync(
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
""" Stop all async conversions that are currently running. This endpoint can only be used by specific KittyCAD employees. """
return sync_detailed(
@ -78,7 +79,7 @@ def sync(
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, FileConversion]]:
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -92,7 +93,7 @@ async def asyncio_detailed(
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
""" Stop all async conversions that are currently running. This endpoint can only be used by specific KittyCAD employees. """
return (

View File

@ -4,6 +4,7 @@ import httpx
from ...client import Client
from ...models.auth_session import AuthSession
from ...models.error_message import ErrorMessage
from ...types import Response
def _get_kwargs(
@ -23,20 +24,20 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, AuthSession]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, AuthSession, ErrorMessage]]:
if response.status_code == 200:
response_200 = AuthSession.from_dict(response.json())
return response_200
if response.status_code == 401:
response_401 = None
response_401 = ErrorMessage.from_dict(response.json())
return response_401
if response.status_code == 403:
response_403 = None
response_403 = ErrorMessage.from_dict(response.json())
return response_403
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, AuthSession]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, AuthSession, ErrorMessage]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -48,7 +49,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, AuthSess
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, AuthSession]]:
) -> Response[Union[Any, AuthSession, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -64,7 +65,7 @@ def sync_detailed(
def sync(
*,
client: Client,
) -> Optional[Union[Any, AuthSession]]:
) -> Optional[Union[Any, AuthSession, ErrorMessage]]:
""" Get information about your API request session. This is primarily used for debugging. """
return sync_detailed(
@ -75,7 +76,7 @@ def sync(
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, AuthSession]]:
) -> Response[Union[Any, AuthSession, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -89,7 +90,7 @@ async def asyncio_detailed(
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, AuthSession]]:
) -> Optional[Union[Any, AuthSession, ErrorMessage]]:
""" Get information about your API request session. This is primarily used for debugging. """
return (

View File

@ -4,6 +4,7 @@ import httpx
from ...client import Client
from ...models.instance import Instance
from ...models.error_message import ErrorMessage
from ...types import Response
def _get_kwargs(
@ -23,20 +24,20 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Instance]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Instance, ErrorMessage]]:
if response.status_code == 200:
response_200 = Instance.from_dict(response.json())
return response_200
if response.status_code == 401:
response_401 = None
response_401 = ErrorMessage.from_dict(response.json())
return response_401
if response.status_code == 403:
response_403 = None
response_403 = ErrorMessage.from_dict(response.json())
return response_403
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Instance]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Instance, ErrorMessage]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -48,7 +49,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, Instance
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, Instance]]:
) -> Response[Union[Any, Instance, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -64,7 +65,7 @@ def sync_detailed(
def sync(
*,
client: Client,
) -> Optional[Union[Any, Instance]]:
) -> Optional[Union[Any, Instance, ErrorMessage]]:
""" Get information about this specific API server instance. This is primarily used for debugging. """
return sync_detailed(
@ -75,7 +76,7 @@ def sync(
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, Instance]]:
) -> Response[Union[Any, Instance, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -89,7 +90,7 @@ async def asyncio_detailed(
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, Instance]]:
) -> Optional[Union[Any, Instance, ErrorMessage]]:
""" Get information about this specific API server instance. This is primarily used for debugging. """
return (

View File

@ -35,10 +35,10 @@ class AuthSession:
token = self.token
user_id = self.user_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if created_at is not UNSET:
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if created_at is not UNSET:
field_dict['created_at'] = created_at
if email is not UNSET:
field_dict['email'] = email
@ -67,38 +67,36 @@ class AuthSession:
else:
created_at = isoparse(_created_at)
email = d.pop("email", UNSET)
email = d.pop("email", UNSET)
id = d.pop("id", UNSET)
id = d.pop("id", UNSET)
image = d.pop("image", UNSET)
image = d.pop("image", UNSET)
ip_address = d.pop("ip_address", UNSET)
ip_address = d.pop("ip_address", UNSET)
is_valid = d.pop("is_valid", UNSET)
is_valid = d.pop("is_valid", UNSET)
token = d.pop("token", UNSET)
token = d.pop("token", UNSET)
user_id = d.pop("user_id", UNSET)
user_id = d.pop("user_id", UNSET)
auth_session = cls(
created_at=created_at,
email=email,
id=id,
image=image,
ip_address=ip_address,
is_valid=is_valid,
token=token,
user_id=user_id,
)
auth_session = cls(
created_at=created_at,
email=email,
id=id,
image=image,
ip_address=ip_address,
is_valid=is_valid,
token=token,
user_id=user_id,
)
auth_session.additional_properties = d
auth_session.additional_properties = d
return auth_session
return auth_session
@property
def additional_keys(self) -> List[str]:
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:

View File

@ -21,10 +21,10 @@ class ErrorMessage:
message = self.message
status = self.status
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if code is not UNSET:
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if code is not UNSET:
field_dict['code'] = code
if message is not UNSET:
field_dict['message'] = message
@ -36,25 +36,23 @@ class ErrorMessage:
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
code = d.pop("code", UNSET)
code = d.pop("code", UNSET)
message = d.pop("message", UNSET)
message = d.pop("message", UNSET)
status = d.pop("status", UNSET)
status = d.pop("status", UNSET)
error_message = cls(
code=code,
message=message,
status=status,
)
error_message = cls(
code=code,
message=message,
status=status,
)
error_message.additional_properties = d
error_message.additional_properties = d
return error_message
return error_message
@property
def additional_keys(self) -> List[str]:
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:

View File

@ -87,12 +87,12 @@ class FileConversion:
else:
created_at = isoparse(_created_at)
id = d.pop("id", UNSET)
id = d.pop("id", UNSET)
output = d.pop("output", UNSET)
output = d.pop("output", UNSET)
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, ValidOutputFileFormat]
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, ValidOutputFileFormat]
if not isinstance(_output_format, Unset):
output_format = UNSET
else:
@ -131,12 +131,10 @@ class FileConversion:
)
file_conversion.additional_properties = d
return file_conversion
return file_conversion
@property
def additional_keys(self) -> List[str]:
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:

View File

@ -25,10 +25,10 @@ class GPUDevice:
name = self.name
peak_memory_bandwidth = self.peak_memory_bandwidth
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if id is not UNSET:
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if id is not UNSET:
field_dict['id'] = id
if memory_bus_width is not UNSET:
field_dict['memory_bus_width'] = memory_bus_width
@ -44,31 +44,29 @@ class GPUDevice:
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
id = d.pop("id", UNSET)
id = d.pop("id", UNSET)
memory_bus_width = d.pop("memory_bus_width", UNSET)
memory_bus_width = d.pop("memory_bus_width", UNSET)
memory_clock_rate = d.pop("memory_clock_rate", UNSET)
memory_clock_rate = d.pop("memory_clock_rate", UNSET)
name = d.pop("name", UNSET)
name = d.pop("name", UNSET)
peak_memory_bandwidth = d.pop("peak_memory_bandwidth", UNSET)
peak_memory_bandwidth = d.pop("peak_memory_bandwidth", UNSET)
gpu_device = cls(
id=id,
memory_bus_width=memory_bus_width,
memory_clock_rate=memory_clock_rate,
name=name,
peak_memory_bandwidth=peak_memory_bandwidth,
)
gpu_device = cls(
id=id,
memory_bus_width=memory_bus_width,
memory_clock_rate=memory_clock_rate,
name=name,
peak_memory_bandwidth=peak_memory_bandwidth,
)
gpu_device.additional_properties = d
gpu_device.additional_properties = d
return gpu_device
return gpu_device
@property
def additional_keys(self) -> List[str]:
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:

View File

@ -28,9 +28,9 @@ class Instance:
def to_dict(self) -> Dict[str, Any]:
cpu_platform = self.cpu_platform
description = self.description
environment: Union[Unset, str] = UNSET
if not isinstance(self.environment, Unset):
environment = self.environment.value
environment: Union[Unset, str] = UNSET
if not isinstance(self.environment, Unset):
environment = self.environment.value
git_hash = self.git_hash
hostname = self.hostname
id = self.id
@ -40,10 +40,10 @@ class Instance:
name = self.name
zone = self.zone
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if cpu_platform is not UNSET:
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if cpu_platform is not UNSET:
field_dict['cpu_platform'] = cpu_platform
if description is not UNSET:
field_dict['description'] = description
@ -71,54 +71,52 @@ class Instance:
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
cpu_platform = d.pop("cpu_platform", UNSET)
cpu_platform = d.pop("cpu_platform", UNSET)
description = d.pop("description", UNSET)
description = d.pop("description", UNSET)
_environment = d.pop("environment", UNSET)
environment: Union[Unset, ServerEnv]
_environment = d.pop("environment", UNSET)
environment: Union[Unset, ServerEnv]
if not isinstance(_environment, Unset):
environment = UNSET
else:
environment = ServerEnv(_environment)
git_hash = d.pop("git_hash", UNSET)
git_hash = d.pop("git_hash", UNSET)
hostname = d.pop("hostname", UNSET)
hostname = d.pop("hostname", UNSET)
id = d.pop("id", UNSET)
id = d.pop("id", UNSET)
image = d.pop("image", UNSET)
image = d.pop("image", UNSET)
ip_address = d.pop("ip_address", UNSET)
ip_address = d.pop("ip_address", UNSET)
machine_type = d.pop("machine_type", UNSET)
machine_type = d.pop("machine_type", UNSET)
name = d.pop("name", UNSET)
name = d.pop("name", UNSET)
zone = d.pop("zone", UNSET)
zone = d.pop("zone", UNSET)
instance = cls(
cpu_platform=cpu_platform,
description=description,
environment=environment,
git_hash=git_hash,
hostname=hostname,
id=id,
image=image,
ip_address=ip_address,
machine_type=machine_type,
name=name,
zone=zone,
)
instance = cls(
cpu_platform=cpu_platform,
description=description,
environment=environment,
git_hash=git_hash,
hostname=hostname,
id=id,
image=image,
ip_address=ip_address,
machine_type=machine_type,
name=name,
zone=zone,
)
instance.additional_properties = d
instance.additional_properties = d
return instance
return instance
@property
def additional_keys(self) -> List[str]:
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:

View File

@ -43,12 +43,10 @@ class PongMessage:
)
pong_message.additional_properties = d
return pong_message
return pong_message
@property
def additional_keys(self) -> List[str]:
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any: