@ -175,6 +175,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
|||||||
f.write("from ...client import Client\n")
|
f.write("from ...client import Client\n")
|
||||||
# Import our references for responses.
|
# Import our references for responses.
|
||||||
for ref in endoint_refs:
|
for ref in endoint_refs:
|
||||||
|
if ref.startswith('[') and ref.endswith(']'):
|
||||||
|
ref = ref.replace('[', '').replace(']', '')
|
||||||
f.write(
|
f.write(
|
||||||
"from ...models." +
|
"from ...models." +
|
||||||
camel_to_snake(ref) +
|
camel_to_snake(ref) +
|
||||||
@ -1041,6 +1043,19 @@ def getEndpointRefs(endpoint: dict, data: 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 'type' in json:
|
||||||
|
if json['type'] == 'array':
|
||||||
|
items = json['items']
|
||||||
|
if '$ref' in items:
|
||||||
|
ref = items['$ref'].replace(
|
||||||
|
'#/components/schemas/', '')
|
||||||
|
refs.append('[' + ref + ']')
|
||||||
|
else:
|
||||||
|
raise Exception("Unknown array type")
|
||||||
|
else:
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
else:
|
||||||
|
raise Exception("Unknown type")
|
||||||
elif '$ref' in response:
|
elif '$ref' in response:
|
||||||
schema_name = response['$ref'].replace(
|
schema_name = response['$ref'].replace(
|
||||||
'#/components/responses/', '')
|
'#/components/responses/', '')
|
||||||
|
@ -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.gpu_device import GPUDevice
|
||||||
from ...models.error_message import ErrorMessage
|
from ...models.error_message import ErrorMessage
|
||||||
from ...types import Response
|
from ...types import Response
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ def _get_kwargs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, ErrorMessage]]:
|
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, [GPUDevice], ErrorMessage]]:
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
response_200 = [
|
response_200 = [
|
||||||
GPUDevice.from_dict(item)
|
GPUDevice.from_dict(item)
|
||||||
@ -39,7 +40,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, ErrorMes
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, ErrorMessage]]:
|
def _build_response(*, response: httpx.Response) -> Response[Union[Any, [GPUDevice], 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, ErrorMes
|
|||||||
def sync_detailed(
|
def sync_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, ErrorMessage]]:
|
) -> Response[Union[Any, [GPUDevice], 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, ErrorMessage]]:
|
) -> Optional[Union[Any, [GPUDevice], 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(
|
||||||
@ -78,7 +79,7 @@ def sync(
|
|||||||
async def asyncio_detailed(
|
async def asyncio_detailed(
|
||||||
*,
|
*,
|
||||||
client: Client,
|
client: Client,
|
||||||
) -> Response[Union[Any, ErrorMessage]]:
|
) -> Response[Union[Any, [GPUDevice], 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, ErrorMessage]]:
|
) -> Optional[Union[Any, [GPUDevice], 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 (
|
||||||
|
@ -411,7 +411,7 @@
|
|||||||
"libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#InternalService.GPUDevices"
|
"libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#InternalService.GPUDevices"
|
||||||
},
|
},
|
||||||
"x-python": {
|
"x-python": {
|
||||||
"example": "from kittycad.models import ErrorMessage\nfrom kittycad.api.internal import gpu_devices\nfrom kittycad.types import Response\n\nfc: ErrorMessage = gpu_devices.sync(client=client)\n\n# OR if you need more info (e.g. status_code)\nresponse: Response[ErrorMessage] = gpu_devices.sync_detailed(client=client)\n\n# OR run async\nfc: ErrorMessage = await gpu_devices.asyncio(client=client)\n\n# OR run async with more info\nresponse: Response[ErrorMessage] = await gpu_devices.asyncio_detailed(client=client)",
|
"example": "from kittycad.models import [GPUDevice]\nfrom kittycad.api.internal import gpu_devices\nfrom kittycad.types import Response\n\nfc: [GPUDevice] = gpu_devices.sync(client=client)\n\n# OR if you need more info (e.g. status_code)\nresponse: Response[[GPUDevice]] = gpu_devices.sync_detailed(client=client)\n\n# OR run async\nfc: [GPUDevice] = await gpu_devices.asyncio(client=client)\n\n# OR run async with more info\nresponse: Response[[GPUDevice]] = await gpu_devices.asyncio_detailed(client=client)",
|
||||||
"libDocsLink": "https://python.api.docs.kittycad.io/modules/kittycad.api.internal.gpu_devices.html"
|
"libDocsLink": "https://python.api.docs.kittycad.io/modules/kittycad.api.internal.gpu_devices.html"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user