@ -64,10 +64,10 @@ def generatePaths(cwd: str, parser: OpenApiParser):
|
|||||||
for p in paths:
|
for p in paths:
|
||||||
for method in paths[p]:
|
for method in paths[p]:
|
||||||
endpoint = paths[p][method]
|
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.
|
# Generate the path.
|
||||||
file_name = camel_to_snake(endpoint['operationId']) + '.py'
|
file_name = camel_to_snake(endpoint['operationId']) + '.py'
|
||||||
# Add the tag to the path if it exists.
|
# 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])
|
print(" endpoint: ", [endpoint])
|
||||||
f = open(file_path, "w")
|
f = open(file_path, "w")
|
||||||
|
|
||||||
endoint_refs = getEndpointRefs(endpoint)
|
endoint_refs = getEndpointRefs(endpoint, data)
|
||||||
parameter_refs = getParameterRefs(endpoint)
|
parameter_refs = getParameterRefs(endpoint)
|
||||||
request_body_refs = getRequestBodyRefs(endpoint)
|
request_body_refs = getRequestBodyRefs(endpoint)
|
||||||
|
|
||||||
@ -198,6 +198,22 @@ def generatePath(path: str, name: str, method: str, endpoint: dict):
|
|||||||
" = " +
|
" = " +
|
||||||
ref +
|
ref +
|
||||||
".from_dict(response.json())\n")
|
".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:
|
else:
|
||||||
f.write("\t\tresponse_" + response_code + " = None\n")
|
f.write("\t\tresponse_" + response_code + " = None\n")
|
||||||
|
|
||||||
@ -707,7 +723,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
f.write(
|
f.write(
|
||||||
"\t" +
|
"\t\t" +
|
||||||
property_name +
|
property_name +
|
||||||
" = d.pop(\"" +
|
" = d.pop(\"" +
|
||||||
property_name +
|
property_name +
|
||||||
@ -715,7 +731,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
f.write("\n")
|
f.write("\n")
|
||||||
elif property_type == 'integer':
|
elif property_type == 'integer':
|
||||||
f.write(
|
f.write(
|
||||||
"\t" +
|
"\t\t" +
|
||||||
property_name +
|
property_name +
|
||||||
" = d.pop(\"" +
|
" = d.pop(\"" +
|
||||||
property_name +
|
property_name +
|
||||||
@ -723,7 +739,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
f.write("\n")
|
f.write("\n")
|
||||||
elif property_type == 'number':
|
elif property_type == 'number':
|
||||||
f.write(
|
f.write(
|
||||||
"\t" +
|
"\t\t" +
|
||||||
property_name +
|
property_name +
|
||||||
" = d.pop(\"" +
|
" = d.pop(\"" +
|
||||||
property_name +
|
property_name +
|
||||||
@ -731,7 +747,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
f.write("\n")
|
f.write("\n")
|
||||||
elif property_type == 'boolean':
|
elif property_type == 'boolean':
|
||||||
f.write(
|
f.write(
|
||||||
"\t" +
|
"\t\t" +
|
||||||
property_name +
|
property_name +
|
||||||
" = d.pop(\"" +
|
" = d.pop(\"" +
|
||||||
property_name +
|
property_name +
|
||||||
@ -776,7 +792,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
f.write("\t\t)\n")
|
f.write("\t\t)\n")
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.write("\t\t" + camel_to_snake(name) + ".additional_properties = d\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.
|
# write the rest of the class.
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
@ -862,7 +878,7 @@ def getRefs(schema: dict) -> [str]:
|
|||||||
return refs
|
return refs
|
||||||
|
|
||||||
|
|
||||||
def getEndpointRefs(endpoint: dict) -> [str]:
|
def getEndpointRefs(endpoint: dict, data: dict) -> [str]:
|
||||||
refs = []
|
refs = []
|
||||||
|
|
||||||
responses = endpoint['responses']
|
responses = endpoint['responses']
|
||||||
@ -877,6 +893,18 @@ def getEndpointRefs(endpoint: dict) -> [str]:
|
|||||||
ref = json['$ref'].replace('#/components/schemas/', '')
|
ref = json['$ref'].replace('#/components/schemas/', '')
|
||||||
if ref not in refs:
|
if ref not in refs:
|
||||||
refs.append(ref)
|
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
|
return refs
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import httpx
|
|||||||
|
|
||||||
from ...client import Client
|
from ...client import Client
|
||||||
from ...models.file_conversion import FileConversion
|
from ...models.file_conversion import FileConversion
|
||||||
|
from ...models.error_message import ErrorMessage
|
||||||
from ...types import Response
|
from ...types import Response
|
||||||
|
|
||||||
def _get_kwargs(
|
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:
|
if response.status_code == 200:
|
||||||
response_200 = FileConversion.from_dict(response.json())
|
response_200 = FileConversion.from_dict(response.json())
|
||||||
return response_200
|
return response_200
|
||||||
if response.status_code == 401:
|
if response.status_code == 401:
|
||||||
response_401 = None
|
response_401 = ErrorMessage.from_dict(response.json())
|
||||||
return response_401
|
return response_401
|
||||||
if response.status_code == 403:
|
if response.status_code == 403:
|
||||||
response_403 = None
|
response_403 = ErrorMessage.from_dict(response.json())
|
||||||
return response_403
|
return response_403
|
||||||
if response.status_code == 404:
|
if response.status_code == 404:
|
||||||
response_404 = None
|
response_404 = ErrorMessage.from_dict(response.json())
|
||||||
return response_404
|
return response_404
|
||||||
if response.status_code == 406:
|
if response.status_code == 406:
|
||||||
response_406 = None
|
response_406 = ErrorMessage.from_dict(response.json())
|
||||||
return response_406
|
return response_406
|
||||||
if response.status_code == 500:
|
if response.status_code == 500:
|
||||||
response_500 = None
|
response_500 = ErrorMessage.from_dict(response.json())
|
||||||
return response_500
|
return response_500
|
||||||
return None
|
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(
|
return Response(
|
||||||
status_code=response.status_code,
|
status_code=response.status_code,
|
||||||
content=response.content,
|
content=response.content,
|
||||||
@ -59,7 +60,7 @@ def sync_detailed(
|
|||||||
id: str,
|
id: str,
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, FileConversion]]:
|
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
id=id,
|
id=id,
|
||||||
client=client,
|
client=client,
|
||||||
@ -77,7 +78,7 @@ def sync(
|
|||||||
id: str,
|
id: str,
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Optional[Union[Any, FileConversion]]:
|
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
|
||||||
""" Get the status and output of an async file conversion. """
|
""" Get the status and output of an async file conversion. """
|
||||||
|
|
||||||
return sync_detailed(
|
return sync_detailed(
|
||||||
@ -90,7 +91,7 @@ async def asyncio_detailed(
|
|||||||
id: str,
|
id: str,
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, FileConversion]]:
|
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
id=id,
|
id=id,
|
||||||
client=client,
|
client=client,
|
||||||
@ -106,7 +107,7 @@ async def asyncio(
|
|||||||
id: str,
|
id: str,
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Optional[Union[Any, FileConversion]]:
|
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
|
||||||
""" Get the status and output of an async file conversion. """
|
""" Get the status and output of an async file conversion. """
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -4,6 +4,7 @@ import httpx
|
|||||||
|
|
||||||
from ...client import Client
|
from ...client import Client
|
||||||
from ...models.file_conversion import FileConversion
|
from ...models.file_conversion import FileConversion
|
||||||
|
from ...models.error_message import ErrorMessage
|
||||||
from ...models.valid_source_file_format import ValidSourceFileFormat
|
from ...models.valid_source_file_format import ValidSourceFileFormat
|
||||||
from ...models.valid_output_file_format import ValidOutputFileFormat
|
from ...models.valid_output_file_format import ValidOutputFileFormat
|
||||||
from ...types import Response
|
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:
|
if response.status_code == 200:
|
||||||
response_200 = FileConversion.from_dict(response.json())
|
response_200 = FileConversion.from_dict(response.json())
|
||||||
return response_200
|
return response_200
|
||||||
@ -35,24 +36,24 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
|||||||
response_202 = FileConversion.from_dict(response.json())
|
response_202 = FileConversion.from_dict(response.json())
|
||||||
return response_202
|
return response_202
|
||||||
if response.status_code == 400:
|
if response.status_code == 400:
|
||||||
response_400 = None
|
response_400 = ErrorMessage.from_dict(response.json())
|
||||||
return response_400
|
return response_400
|
||||||
if response.status_code == 401:
|
if response.status_code == 401:
|
||||||
response_401 = None
|
response_401 = ErrorMessage.from_dict(response.json())
|
||||||
return response_401
|
return response_401
|
||||||
if response.status_code == 403:
|
if response.status_code == 403:
|
||||||
response_403 = None
|
response_403 = ErrorMessage.from_dict(response.json())
|
||||||
return response_403
|
return response_403
|
||||||
if response.status_code == 406:
|
if response.status_code == 406:
|
||||||
response_406 = None
|
response_406 = ErrorMessage.from_dict(response.json())
|
||||||
return response_406
|
return response_406
|
||||||
if response.status_code == 500:
|
if response.status_code == 500:
|
||||||
response_500 = None
|
response_500 = ErrorMessage.from_dict(response.json())
|
||||||
return response_500
|
return response_500
|
||||||
return None
|
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(
|
return Response(
|
||||||
status_code=response.status_code,
|
status_code=response.status_code,
|
||||||
content=response.content,
|
content=response.content,
|
||||||
@ -66,7 +67,7 @@ def sync_detailed(
|
|||||||
output_format: ValidOutputFileFormat,
|
output_format: ValidOutputFileFormat,
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, FileConversion]]:
|
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
source_format=source_format,
|
source_format=source_format,
|
||||||
output_format=output_format,
|
output_format=output_format,
|
||||||
@ -86,7 +87,7 @@ def sync(
|
|||||||
output_format: ValidOutputFileFormat,
|
output_format: ValidOutputFileFormat,
|
||||||
*,
|
*,
|
||||||
client: Client,
|
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. """
|
""" 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(
|
return sync_detailed(
|
||||||
@ -101,7 +102,7 @@ async def asyncio_detailed(
|
|||||||
output_format: ValidOutputFileFormat,
|
output_format: ValidOutputFileFormat,
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, FileConversion]]:
|
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
source_format=source_format,
|
source_format=source_format,
|
||||||
output_format=output_format,
|
output_format=output_format,
|
||||||
@ -119,7 +120,7 @@ async def asyncio(
|
|||||||
output_format: ValidOutputFileFormat,
|
output_format: ValidOutputFileFormat,
|
||||||
*,
|
*,
|
||||||
client: Client,
|
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. """
|
""" Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously. """
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -3,6 +3,7 @@ from typing import Any, Dict, Optional, Union
|
|||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
from ...client import Client
|
from ...client import Client
|
||||||
|
from ...models.error_message import ErrorMessage
|
||||||
from ...types import Response
|
from ...types import Response
|
||||||
|
|
||||||
def _get_kwargs(
|
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:
|
if response.status_code == 200:
|
||||||
return response_200
|
return response_200
|
||||||
if response.status_code == 401:
|
if response.status_code == 401:
|
||||||
response_401 = None
|
response_401 = ErrorMessage.from_dict(response.json())
|
||||||
return response_401
|
return response_401
|
||||||
if response.status_code == 403:
|
if response.status_code == 403:
|
||||||
response_403 = None
|
response_403 = ErrorMessage.from_dict(response.json())
|
||||||
return response_403
|
return response_403
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, ]]:
|
def _build_response(*, response: httpx.Response) -> Response[Union[Any, ErrorMessage]]:
|
||||||
return Response(
|
return Response(
|
||||||
status_code=response.status_code,
|
status_code=response.status_code,
|
||||||
content=response.content,
|
content=response.content,
|
||||||
@ -46,7 +47,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ]]:
|
|||||||
def sync_detailed(
|
def sync_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, ]]:
|
) -> Response[Union[Any, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
@ -62,7 +63,7 @@ def sync_detailed(
|
|||||||
def sync(
|
def sync(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
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. """
|
""" 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(
|
return sync_detailed(
|
||||||
@ -73,7 +74,7 @@ def sync(
|
|||||||
async def asyncio_detailed(
|
async def asyncio_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, ]]:
|
) -> Response[Union[Any, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
@ -87,7 +88,7 @@ async def asyncio_detailed(
|
|||||||
async def asyncio(
|
async def asyncio(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
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. """
|
""" 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 (
|
return (
|
||||||
|
@ -4,6 +4,7 @@ import httpx
|
|||||||
|
|
||||||
from ...client import Client
|
from ...client import Client
|
||||||
from ...models.file_conversion import FileConversion
|
from ...models.file_conversion import FileConversion
|
||||||
|
from ...models.error_message import ErrorMessage
|
||||||
from ...types import Response
|
from ...types import Response
|
||||||
|
|
||||||
def _get_kwargs(
|
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:
|
if response.status_code == 200:
|
||||||
response_200 = FileConversion.from_dict(response.json())
|
response_200 = FileConversion.from_dict(response.json())
|
||||||
return response_200
|
return response_200
|
||||||
if response.status_code == 401:
|
if response.status_code == 401:
|
||||||
response_401 = None
|
response_401 = ErrorMessage.from_dict(response.json())
|
||||||
return response_401
|
return response_401
|
||||||
if response.status_code == 403:
|
if response.status_code == 403:
|
||||||
response_403 = None
|
response_403 = ErrorMessage.from_dict(response.json())
|
||||||
return response_403
|
return response_403
|
||||||
if response.status_code == 404:
|
if response.status_code == 404:
|
||||||
response_404 = None
|
response_404 = ErrorMessage.from_dict(response.json())
|
||||||
return response_404
|
return response_404
|
||||||
return None
|
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(
|
return Response(
|
||||||
status_code=response.status_code,
|
status_code=response.status_code,
|
||||||
content=response.content,
|
content=response.content,
|
||||||
@ -51,7 +52,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConv
|
|||||||
def sync_detailed(
|
def sync_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, FileConversion]]:
|
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
@ -67,7 +68,7 @@ def sync_detailed(
|
|||||||
def sync(
|
def sync(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
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. """
|
""" Stop all async conversions that are currently running. This endpoint can only be used by specific KittyCAD employees. """
|
||||||
|
|
||||||
return sync_detailed(
|
return sync_detailed(
|
||||||
@ -78,7 +79,7 @@ def sync(
|
|||||||
async def asyncio_detailed(
|
async def asyncio_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, FileConversion]]:
|
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
@ -92,7 +93,7 @@ async def asyncio_detailed(
|
|||||||
async def asyncio(
|
async def asyncio(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
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. """
|
""" Stop all async conversions that are currently running. This endpoint can only be used by specific KittyCAD employees. """
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -4,6 +4,7 @@ import httpx
|
|||||||
|
|
||||||
from ...client import Client
|
from ...client import Client
|
||||||
from ...models.auth_session import AuthSession
|
from ...models.auth_session import AuthSession
|
||||||
|
from ...models.error_message import ErrorMessage
|
||||||
from ...types import Response
|
from ...types import Response
|
||||||
|
|
||||||
def _get_kwargs(
|
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:
|
if response.status_code == 200:
|
||||||
response_200 = AuthSession.from_dict(response.json())
|
response_200 = AuthSession.from_dict(response.json())
|
||||||
return response_200
|
return response_200
|
||||||
if response.status_code == 401:
|
if response.status_code == 401:
|
||||||
response_401 = None
|
response_401 = ErrorMessage.from_dict(response.json())
|
||||||
return response_401
|
return response_401
|
||||||
if response.status_code == 403:
|
if response.status_code == 403:
|
||||||
response_403 = None
|
response_403 = ErrorMessage.from_dict(response.json())
|
||||||
return response_403
|
return response_403
|
||||||
return None
|
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(
|
return Response(
|
||||||
status_code=response.status_code,
|
status_code=response.status_code,
|
||||||
content=response.content,
|
content=response.content,
|
||||||
@ -48,7 +49,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, AuthSess
|
|||||||
def sync_detailed(
|
def sync_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, AuthSession]]:
|
) -> Response[Union[Any, AuthSession, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
@ -64,7 +65,7 @@ def sync_detailed(
|
|||||||
def sync(
|
def sync(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Optional[Union[Any, AuthSession]]:
|
) -> Optional[Union[Any, AuthSession, ErrorMessage]]:
|
||||||
""" Get information about your API request session. This is primarily used for debugging. """
|
""" Get information about your API request session. This is primarily used for debugging. """
|
||||||
|
|
||||||
return sync_detailed(
|
return sync_detailed(
|
||||||
@ -75,7 +76,7 @@ def sync(
|
|||||||
async def asyncio_detailed(
|
async def asyncio_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, AuthSession]]:
|
) -> Response[Union[Any, AuthSession, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
@ -89,7 +90,7 @@ async def asyncio_detailed(
|
|||||||
async def asyncio(
|
async def asyncio(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Optional[Union[Any, AuthSession]]:
|
) -> Optional[Union[Any, AuthSession, ErrorMessage]]:
|
||||||
""" Get information about your API request session. This is primarily used for debugging. """
|
""" Get information about your API request session. This is primarily used for debugging. """
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -4,6 +4,7 @@ import httpx
|
|||||||
|
|
||||||
from ...client import Client
|
from ...client import Client
|
||||||
from ...models.instance import Instance
|
from ...models.instance import Instance
|
||||||
|
from ...models.error_message import ErrorMessage
|
||||||
from ...types import Response
|
from ...types import Response
|
||||||
|
|
||||||
def _get_kwargs(
|
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:
|
if response.status_code == 200:
|
||||||
response_200 = Instance.from_dict(response.json())
|
response_200 = Instance.from_dict(response.json())
|
||||||
return response_200
|
return response_200
|
||||||
if response.status_code == 401:
|
if response.status_code == 401:
|
||||||
response_401 = None
|
response_401 = ErrorMessage.from_dict(response.json())
|
||||||
return response_401
|
return response_401
|
||||||
if response.status_code == 403:
|
if response.status_code == 403:
|
||||||
response_403 = None
|
response_403 = ErrorMessage.from_dict(response.json())
|
||||||
return response_403
|
return response_403
|
||||||
return None
|
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(
|
return Response(
|
||||||
status_code=response.status_code,
|
status_code=response.status_code,
|
||||||
content=response.content,
|
content=response.content,
|
||||||
@ -48,7 +49,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, Instance
|
|||||||
def sync_detailed(
|
def sync_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, Instance]]:
|
) -> Response[Union[Any, Instance, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
@ -64,7 +65,7 @@ def sync_detailed(
|
|||||||
def sync(
|
def sync(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
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. """
|
""" Get information about this specific API server instance. This is primarily used for debugging. """
|
||||||
|
|
||||||
return sync_detailed(
|
return sync_detailed(
|
||||||
@ -75,7 +76,7 @@ def sync(
|
|||||||
async def asyncio_detailed(
|
async def asyncio_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, Instance]]:
|
) -> Response[Union[Any, Instance, ErrorMessage]]:
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
@ -89,7 +90,7 @@ async def asyncio_detailed(
|
|||||||
async def asyncio(
|
async def asyncio(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
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. """
|
""" Get information about this specific API server instance. This is primarily used for debugging. """
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -93,8 +93,6 @@ class AuthSession:
|
|||||||
)
|
)
|
||||||
|
|
||||||
auth_session.additional_properties = d
|
auth_session.additional_properties = d
|
||||||
|
|
||||||
|
|
||||||
return auth_session
|
return auth_session
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -49,8 +49,6 @@ class ErrorMessage:
|
|||||||
)
|
)
|
||||||
|
|
||||||
error_message.additional_properties = d
|
error_message.additional_properties = d
|
||||||
|
|
||||||
|
|
||||||
return error_message
|
return error_message
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -131,8 +131,6 @@ class FileConversion:
|
|||||||
)
|
)
|
||||||
|
|
||||||
file_conversion.additional_properties = d
|
file_conversion.additional_properties = d
|
||||||
|
|
||||||
|
|
||||||
return file_conversion
|
return file_conversion
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -63,8 +63,6 @@ class GPUDevice:
|
|||||||
)
|
)
|
||||||
|
|
||||||
gpu_device.additional_properties = d
|
gpu_device.additional_properties = d
|
||||||
|
|
||||||
|
|
||||||
return gpu_device
|
return gpu_device
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -113,8 +113,6 @@ class Instance:
|
|||||||
)
|
)
|
||||||
|
|
||||||
instance.additional_properties = d
|
instance.additional_properties = d
|
||||||
|
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -43,8 +43,6 @@ class PongMessage:
|
|||||||
)
|
)
|
||||||
|
|
||||||
pong_message.additional_properties = d
|
pong_message.additional_properties = d
|
||||||
|
|
||||||
|
|
||||||
return pong_message
|
return pong_message
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Reference in New Issue
Block a user