initial fixing

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2022-06-11 17:26:20 -07:00
parent 4631ca24cb
commit 9dc390a64d
58 changed files with 9685 additions and 6732 deletions

View File

@ -16,12 +16,13 @@ generate: docker-image ## Generate the api client.
--disable-content-trust \
-v $(CURDIR):/usr/src \
--workdir /usr/src \
$(DOCKER_IMAGE_NAME) sh -c 'poetry run python generate/generate.py && poetry run autopep8 --in-place --aggressive --aggressive kittycad/models/*.py && poetry run autopep8 --in-place --aggressive --aggressive kittycad/api/*.py && poetry run autopep8 --in-place --aggressive --aggressive kittycad/*.py && poetry run autopep8 --in-place --aggressive --aggressive generate/*.py'
$(DOCKER_IMAGE_NAME) ./generate/run.sh
.PHONY: shell
shell: docker-image ## Pop into a shell in the docker image.
docker run --rm -i $(DOCKER_FLAGS) \
--name python-generator-shell \
--disable-content-trust \
-v $(CURDIR):/usr/src \
--workdir /usr/src \
$(DOCKER_IMAGE_NAME) /bin/bash

View File

@ -82,6 +82,9 @@ def generatePaths(cwd: str, parser: dict) -> dict:
paths = data['paths']
for p in paths:
for method in paths[p]:
print('METHOD: ', method.upper())
# Skip OPTIONS.
if method.upper() != 'OPTIONS':
endpoint = paths[p][method]
data = generatePath(path, p, method, endpoint, data)
@ -650,6 +653,7 @@ def generateTypes(cwd: str, parser: dict):
schemas = data['components']['schemas']
for key in schemas:
schema = schemas[key]
print("generating schema: ", key)
generateType(path, key, schema)
f.write("from ." + camel_to_snake(key) + " import " + key + "\n")
@ -658,14 +662,114 @@ def generateTypes(cwd: str, parser: dict):
def generateType(path: str, name: str, schema: dict):
file_path = path
if path.endswith(".py") is False:
# Generate the type.
file_name = camel_to_snake(name) + '.py'
file_path = os.path.join(path, file_name)
if 'type' in schema:
type_name = schema['type']
print("generating type: ", name, " at: ", file_path)
print(" schema: ", [schema])
f = open(file_path, "w")
if type_name == 'object':
generateObjectType(file_path, name, schema, type_name)
elif type_name == 'string' and 'enum' in schema:
generateEnumType(file_path, name, schema, type_name)
elif type_name == 'integer':
generateIntegerType(file_path, name, schema, type_name)
elif type_name == 'string':
generateStringType(file_path, name, schema, type_name)
else:
print(" unsupported type: ", type_name)
raise Exception(" unsupported type: ", type_name)
elif '$ref' in schema:
# Skip it since we will already have generated it.
return
elif 'oneOf' in schema:
generateOneOfType(file_path, name, schema)
else:
print(" schema: ", [schema])
print(" unsupported type: ", name)
raise Exception(" unsupported type: ", name)
def generateOneOfType(path: str, name: str, schema: dict):
print("generating type: ", name, " at: ", path)
print(" schema: ", [schema])
f = open(path, "w")
for t in schema['oneOf']:
# Get the name for the reference.
if '$ref' in t:
name = t['$ref'].replace('#/components/schemas/', '')
generateType(path, name, t)
else:
print(" schema: ", [t])
print(" oneOf must be a ref: ", name)
raise Exception(" oneOf must be a ref ", name)
# Close the file.
f.close()
def generateStringType(path: str, name: str, schema: dict, type_name: str):
print("generating type: ", name, " at: ", path)
print(" schema: ", [schema])
f = open(path, "w")
f.write("class " + name + "(str):\n")
f.write("\n")
f.write("\tdef __str__(self) -> str:\n")
f.write("\t\treturn self\n")
# Close the file.
f.close()
def generateIntegerType(path: str, name: str, schema: dict, type_name: str):
print("generating type: ", name, " at: ", path)
print(" schema: ", [schema])
f = open(path, "w")
f.write("class " + name + "(int):\n")
f.write("\n")
f.write("\tdef __int__(self) -> int:\n")
f.write("\t\treturn self\n")
# Close the file.
f.close()
def generateEnumType(path: str, name: str, schema: dict, type_name: str):
print("generating type: ", name, " at: ", path)
print(" schema: ", [schema])
f = open(path, "w")
f.write("from enum import Enum\n")
f.write("\n")
f.write("class " + name + "(str, Enum):\n")
# Iterate over the properties.
for value in schema['enum']:
f.write(
"\t" +
camel_to_screaming_snake(value) +
" = '" +
value +
"'\n")
# close the enum.
f.write("\n")
f.write("\tdef __str__(self) -> str:\n")
f.write("\t\treturn str(self.value)\n")
# Close the file.
f.close()
def generateObjectType(path: str, name: str, schema: dict, type_name: str):
print("generating type: ", name, " at: ", path)
print(" schema: ", [schema])
f = open(path, "w")
has_date_time = hasDateTime(schema)
if has_date_time:
f.write("import datetime\n")
@ -1135,36 +1239,6 @@ def generateType(path: str, name: str, schema: dict):
f.write("\n")
f.write("\tdef __contains__(self, key: str) -> bool:\n")
f.write("\t\treturn key in self.additional_properties\n")
elif type_name == 'string' and 'enum' in schema:
f.write("from enum import Enum\n")
f.write("\n")
f.write("class " + name + "(str, Enum):\n")
# Iterate over the properties.
for value in schema['enum']:
f.write(
"\t" +
camel_to_screaming_snake(value) +
" = '" +
value +
"'\n")
# close the enum.
f.write("\n")
f.write("\tdef __str__(self) -> str:\n")
f.write("\t\treturn str(self.value)\n")
elif type_name == 'integer':
f.write("class " + name + "(int):\n")
f.write("\n")
f.write("\tdef __int__(self) -> int:\n")
f.write("\t\treturn self\n")
elif type_name == 'string':
f.write("class " + name + "(str):\n")
f.write("\n")
f.write("\tdef __str__(self) -> str:\n")
f.write("\t\treturn self\n")
else:
print(" unsupported type: ", type_name)
raise Exception(" unsupported type: ", type_name)
# Close the file.
f.close()
@ -1176,6 +1250,7 @@ def hasDateTime(schema: dict) -> bool:
type_name = schema['type']
if type_name == 'object':
# Iternate over the properties.
if 'properties' in schema:
for property_name in schema['properties']:
property_schema = schema['properties'][property_name]
has_date_time = hasDateTime(property_schema)

14
generate/run.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
set -o pipefail
# Cleanup old stuff.
rm -rf kittycad/models
rm -rf kittycad/api
# Generate new.
poetry run python generate/generate.py
poetry run autopep8 --in-place --aggressive --aggressive kittycad/models/*.py
poetry run autopep8 --in-place --aggressive --aggressive kittycad/api/*.py
poetry run autopep8 --in-place --aggressive --aggressive kittycad/*.py
poetry run autopep8 --in-place --aggressive --aggressive generate/*.py

View File

@ -0,0 +1,115 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.async_api_call_output import AsyncApiCallOutput
from ...models.error import Error
from ...types import Response
def _get_kwargs(
id: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/async/operations/{id}".format(client.base_url, id=id)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
if response.status_code == 200:
response_200 = AsyncApiCallOutput.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
""" Get the status and output of an async operation.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested async operation for the user.
If the user is not authenticated to view the specified async operation, then it is not returned.
Only KittyCAD employees with the proper access can view async operations for other users. """
return sync_detailed(
id=id,
client=client,
).parsed
async def asyncio_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
""" Get the status and output of an async operation.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested async operation for the user.
If the user is not authenticated to view the specified async operation, then it is not returned.
Only KittyCAD employees with the proper access can view async operations for other users. """
return (
await asyncio_detailed(
id=id,
client=client,
)
).parsed

View File

@ -0,0 +1 @@
""" Contains methods for accessing the beta API paths: Beta API endpoints. We will not charge for these endpoints while they are in beta. """

View File

@ -3,15 +3,15 @@ from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_conversion_with_output import FileConversionWithOutput
from ...models.file_conversion import FileConversion
from ...models.error import Error
from ...models.file_conversion_output_format import FileConversionOutputFormat
from ...models.file_conversion_source_format import FileConversionSourceFormat
from ...models.file_output_format import FileOutputFormat
from ...models.file_source_format import FileSourceFormat
from ...types import Response
def _get_kwargs(
output_format: FileConversionOutputFormat,
src_format: FileConversionSourceFormat,
output_format: FileOutputFormat,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
@ -30,9 +30,9 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, Error]]:
if response.status_code == 201:
response_201 = FileConversionWithOutput.from_dict(response.json())
response_201 = FileConversion.from_dict(response.json())
return response_201
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
@ -43,7 +43,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversionWithOutput, Error]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -53,12 +53,12 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConv
def sync_detailed(
output_format: FileConversionOutputFormat,
src_format: FileConversionSourceFormat,
output_format: FileOutputFormat,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, FileConversionWithOutput, Error]]:
) -> Response[Union[Any, FileConversion, Error]]:
kwargs = _get_kwargs(
output_format=output_format,
src_format=src_format,
@ -75,15 +75,15 @@ def sync_detailed(
def sync(
output_format: FileConversionOutputFormat,
src_format: FileConversionSourceFormat,
output_format: FileOutputFormat,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
) -> Optional[Union[Any, FileConversion, Error]]:
""" Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously.
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
If the conversion is performed asynchronously, the `id` of the conversion will be returned. You can use the `id` returned from the request to get status information about the async conversion from the `/file/conversions/{id}` endpoint. """
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
return sync_detailed(
output_format=output_format,
@ -94,12 +94,12 @@ If the conversion is performed asynchronously, the `id` of the conversion will b
async def asyncio_detailed(
output_format: FileConversionOutputFormat,
src_format: FileConversionSourceFormat,
output_format: FileOutputFormat,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, FileConversionWithOutput, Error]]:
) -> Response[Union[Any, FileConversion, Error]]:
kwargs = _get_kwargs(
output_format=output_format,
src_format=src_format,
@ -114,15 +114,15 @@ async def asyncio_detailed(
async def asyncio(
output_format: FileConversionOutputFormat,
src_format: FileConversionSourceFormat,
output_format: FileOutputFormat,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
) -> Optional[Union[Any, FileConversion, Error]]:
""" Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously.
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
If the conversion is performed asynchronously, the `id` of the conversion will be returned. You can use the `id` returned from the request to get status information about the async conversion from the `/file/conversions/{id}` endpoint. """
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
return (
await asyncio_detailed(

View File

@ -1,59 +0,0 @@
from typing import Any, Dict, Optional, Union
import base64
import httpx
from ...client import Client
from ...models import Error
from ...models import FileConversionWithOutput
from ...models import FileConversionSourceFormat
from ...models import FileConversionOutputFormat
from ...types import Response
from ...api.file.create_file_conversion import sync as fc_sync, asyncio as fc_asyncio
def sync(
src_format: FileConversionSourceFormat,
output_format: FileConversionOutputFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""
encoded = base64.b64encode(body)
fc = fc_sync(
src_format=src_format,
output_format=output_format,
body=encoded,
client=client,
)
if isinstance(fc, FileConversionWithOutput) and fc.output != "":
fc.output = base64.b64decode(fc.output)
return fc
async def asyncio(
src_format: FileConversionSourceFormat,
output_format: FileConversionOutputFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""
encoded = base64.b64encode(body)
fc = await fc_asyncio(
src_format=src_format,
output_format=output_format,
body=encoded,
client=client,
)
if isinstance(fc, FileConversionWithOutput) and fc.output != "":
fc.output = base64.b64decode(fc.output)
return fc

View File

@ -0,0 +1,127 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.code_output import CodeOutput
from ...models.error import Error
from ...models.code_language import CodeLanguage
from ...types import Response
def _get_kwargs(
lang: CodeLanguage,
output: str,
body: bytes,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/file/execute/{lang}".format(client.base_url, lang=lang, output=output)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, CodeOutput, Error]]:
if response.status_code == 200:
response_200 = CodeOutput.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, CodeOutput, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
lang: CodeLanguage,
output: str,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, CodeOutput, Error]]:
kwargs = _get_kwargs(
lang=lang,
output=output,
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
lang: CodeLanguage,
output: str,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, CodeOutput, Error]]:
return sync_detailed(
lang=lang,
output=output,
body=body,
client=client,
).parsed
async def asyncio_detailed(
lang: CodeLanguage,
output: str,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, CodeOutput, Error]]:
kwargs = _get_kwargs(
lang=lang,
output=output,
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
lang: CodeLanguage,
output: str,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, CodeOutput, Error]]:
return (
await asyncio_detailed(
lang=lang,
output=output,
body=body,
client=client,
)
).parsed

View File

@ -0,0 +1,131 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_mass import FileMass
from ...models.error import Error
from ...models.file_source_format import FileSourceFormat
from ...types import Response
def _get_kwargs(
material_density: number,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/file/mass".format(client.base_url, material_density=material_density, src_format=src_format)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileMass, Error]]:
if response.status_code == 201:
response_201 = FileMass.from_dict(response.json())
return response_201
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileMass, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
material_density: number,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, FileMass, Error]]:
kwargs = _get_kwargs(
material_density=material_density,
src_format=src_format,
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
material_density: number,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileMass, Error]]:
""" Get the mass of an object in a CAD file. If the file is larger than 30MB, it will be performed asynchronously.
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
return sync_detailed(
material_density=material_density,
src_format=src_format,
body=body,
client=client,
).parsed
async def asyncio_detailed(
material_density: number,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, FileMass, Error]]:
kwargs = _get_kwargs(
material_density=material_density,
src_format=src_format,
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
material_density: number,
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileMass, Error]]:
""" Get the mass of an object in a CAD file. If the file is larger than 30MB, it will be performed asynchronously.
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
return (
await asyncio_detailed(
material_density=material_density,
src_format=src_format,
body=body,
client=client,
)
).parsed

View File

@ -0,0 +1,122 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_volume import FileVolume
from ...models.error import Error
from ...models.file_source_format import FileSourceFormat
from ...types import Response
def _get_kwargs(
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/file/volume".format(client.base_url, src_format=src_format)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileVolume, Error]]:
if response.status_code == 201:
response_201 = FileVolume.from_dict(response.json())
return response_201
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileVolume, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, FileVolume, Error]]:
kwargs = _get_kwargs(
src_format=src_format,
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileVolume, Error]]:
""" Get the volume of an object in a CAD file. If the file is larger than 30MB, it will be performed asynchronously.
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
return sync_detailed(
src_format=src_format,
body=body,
client=client,
).parsed
async def asyncio_detailed(
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, FileVolume, Error]]:
kwargs = _get_kwargs(
src_format=src_format,
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
src_format: FileSourceFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileVolume, Error]]:
""" Get the volume of an object in a CAD file. If the file is larger than 30MB, it will be performed asynchronously.
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
return (
await asyncio_detailed(
src_format=src_format,
body=body,
client=client,
)
).parsed

View File

@ -3,7 +3,7 @@ from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_conversion_with_output import FileConversionWithOutput
from ...models.async_api_call_output import AsyncApiCallOutput
from ...models.error import Error
from ...types import Response
@ -25,9 +25,9 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
if response.status_code == 200:
response_200 = FileConversionWithOutput.from_dict(response.json())
response_200 = AsyncApiCallOutput.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
@ -38,7 +38,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversionWithOutput, Error]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -51,7 +51,7 @@ def sync_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversionWithOutput, Error]]:
) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
@ -69,7 +69,7 @@ def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
""" Get the status and output of an async file conversion.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.
If the user is not authenticated to view the specified file conversion, then it is not returned.
@ -85,7 +85,7 @@ async def asyncio_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversionWithOutput, Error]]:
) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
@ -101,7 +101,7 @@ async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
""" Get the status and output of an async file conversion.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.
If the user is not authenticated to view the specified file conversion, then it is not returned.

View File

@ -3,7 +3,7 @@ from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_conversion_with_output import FileConversionWithOutput
from ...models.async_api_call_output import AsyncApiCallOutput
from ...models.error import Error
from ...types import Response
@ -25,9 +25,9 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
if response.status_code == 200:
response_200 = FileConversionWithOutput.from_dict(response.json())
response_200 = AsyncApiCallOutput.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
@ -38,7 +38,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversionWithOutput, Error]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -51,7 +51,7 @@ def sync_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversionWithOutput, Error]]:
) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
@ -69,7 +69,7 @@ def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
""" Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """
@ -83,7 +83,7 @@ async def asyncio_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversionWithOutput, Error]]:
) -> Response[Union[Any, AsyncApiCallOutput, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
@ -99,7 +99,7 @@ async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
) -> Optional[Union[Any, AsyncApiCallOutput, Error]]:
""" Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """

View File

@ -1,46 +0,0 @@
from typing import Any, Dict, Optional, Union
import base64
import httpx
from ...client import Client
from ...models import Error
from ...models.file_conversion import FileConversionWithOutput
from ...types import Response
from ...api.file.get_file_conversion import sync as fc_sync, asyncio as fc_asyncio
def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
fc = fc_sync(
id=id,
client=client,
)
if isinstance(fc, FileConversionWithOutput) and fc.output != "":
fc.output = base64.b64decode(fc.output)
return fc
async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversionWithOutput, Error]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
fc = await fc_asyncio(
id=id,
client=client,
)
if isinstance(fc, FileConversionWithOutput) and fc.output != "":
fc.output = base64.b64decode(fc.output)
return fc

View File

@ -1,140 +0,0 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_conversion_results_page import FileConversionResultsPage
from ...models.error import Error
from ...models.created_at_sort_mode import CreatedAtSortMode
from ...models.file_conversion_status import FileConversionStatus
from ...types import Response
def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/file/conversions".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by, status=status)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversionResultsPage, Error]]:
if response.status_code == 200:
response_200 = FileConversionResultsPage.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversionResultsPage, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Response[Union[Any, FileConversionResultsPage, Error]]:
kwargs = _get_kwargs(
limit=limit,
page_token=page_token,
sort_by=sort_by,
status=status,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Optional[Union[Any, FileConversionResultsPage, Error]]:
""" This endpoint does not return the contents of the converted file (`output`). To get the contents use the `/file/conversions/{id}` endpoint.
This endpoint requires authentication by a KittyCAD employee. """
return sync_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
status=status,
client=client,
).parsed
async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Response[Union[Any, FileConversionResultsPage, Error]]:
kwargs = _get_kwargs(
limit=limit,
page_token=page_token,
sort_by=sort_by,
status=status,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Optional[Union[Any, FileConversionResultsPage, Error]]:
""" This endpoint does not return the contents of the converted file (`output`). To get the contents use the `/file/conversions/{id}` endpoint.
This endpoint requires authentication by a KittyCAD employee. """
return (
await asyncio_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
status=status,
client=client,
)
).parsed

View File

@ -1,132 +0,0 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_conversion_results_page import FileConversionResultsPage
from ...models.error import Error
from ...models.created_at_sort_mode import CreatedAtSortMode
from ...types import Response
def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/file/conversions".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversionResultsPage, Error]]:
if response.status_code == 200:
response_200 = FileConversionResultsPage.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversionResultsPage, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
*,
client: Client,
) -> Response[Union[Any, FileConversionResultsPage, Error]]:
kwargs = _get_kwargs(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
*,
client: Client,
) -> Optional[Union[Any, FileConversionResultsPage, Error]]:
""" This endpoint does not return the contents of the converted file (`output`). To get the contents use the `/file/conversions/{id}` endpoint.
This endpoint requires authentication by any KittyCAD user. It returns the API tokens for the authenticated user.
The file conversions are returned in order of creation, with the most recently created file conversions first. """
return sync_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
).parsed
async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
*,
client: Client,
) -> Response[Union[Any, FileConversionResultsPage, Error]]:
kwargs = _get_kwargs(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
*,
client: Client,
) -> Optional[Union[Any, FileConversionResultsPage, Error]]:
""" This endpoint does not return the contents of the converted file (`output`). To get the contents use the `/file/conversions/{id}` endpoint.
This endpoint requires authentication by any KittyCAD user. It returns the API tokens for the authenticated user.
The file conversions are returned in order of creation, with the most recently created file conversions first. """
return (
await asyncio_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
).parsed

View File

@ -0,0 +1 @@
""" Contains methods for accessing the hidden API paths: Hidden API endpoints that should not show up in the docs. """

View File

@ -0,0 +1,108 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.error import Error
from ...models.login_params import LoginParams
from ...types import Response
def _get_kwargs(
body: LoginParams,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/login".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Error]]:
if response.status_code == 204:
response_204 = None
return response_204
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
body: LoginParams,
*,
client: Client,
) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
body: LoginParams,
*,
client: Client,
) -> Optional[Union[Any, Error]]:
return sync_detailed(
body=body,
client=client,
).parsed
async def asyncio_detailed(
body: LoginParams,
*,
client: Client,
) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
body: LoginParams,
*,
client: Client,
) -> Optional[Union[Any, Error]]:
return (
await asyncio_detailed(
body=body,
client=client,
)
).parsed

View File

@ -0,0 +1 @@
""" Contains methods for accessing the payments API paths: Operations around payments and billing. """

View File

@ -0,0 +1,113 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.customer import Customer
from ...models.error import Error
from ...models.billing_info import BillingInfo
from ...types import Response
def _get_kwargs(
body: BillingInfo,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/payment".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Customer, Error]]:
if response.status_code == 201:
response_201 = Customer.from_dict(response.json())
return response_201
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Customer, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
body: BillingInfo,
*,
client: Client,
) -> Response[Union[Any, Customer, Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
body: BillingInfo,
*,
client: Client,
) -> Optional[Union[Any, Customer, Error]]:
""" This includes billing address, phone, and name.
This endpoint requires authentication by any KittyCAD user. It creates the payment information for the authenticated user. """
return sync_detailed(
body=body,
client=client,
).parsed
async def asyncio_detailed(
body: BillingInfo,
*,
client: Client,
) -> Response[Union[Any, Customer, Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
body: BillingInfo,
*,
client: Client,
) -> Optional[Union[Any, Customer, Error]]:
""" This includes billing address, phone, and name.
This endpoint requires authentication by any KittyCAD user. It creates the payment information for the authenticated user. """
return (
await asyncio_detailed(
body=body,
client=client,
)
).parsed

View File

@ -0,0 +1,100 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.payment_intent import PaymentIntent
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/payment/intent".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, PaymentIntent, Error]]:
if response.status_code == 201:
response_201 = PaymentIntent.from_dict(response.json())
return response_201
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, PaymentIntent, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, PaymentIntent, Error]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[Any, PaymentIntent, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It creates a new payment intent for the authenticated user. """
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, PaymentIntent, Error]]:
kwargs = _get_kwargs(
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, PaymentIntent, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It creates a new payment intent for the authenticated user. """
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -0,0 +1,101 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/payment".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Error]]:
if response.status_code == 204:
response_204 = None
return response_204
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.delete(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[Any, Error]]:
""" This includes billing address, phone, and name.
This endpoint requires authentication by any KittyCAD user. It deletes the payment information for the authenticated user. """
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs(
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.delete(**kwargs)
return _build_response(response=response)
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, Error]]:
""" This includes billing address, phone, and name.
This endpoint requires authentication by any KittyCAD user. It deletes the payment information for the authenticated user. """
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -0,0 +1,108 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.error import Error
from ...types import Response
def _get_kwargs(
id: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/payment/methods/{id}".format(client.base_url, id=id)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Error]]:
if response.status_code == 204:
response_204 = None
return response_204
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
)
response = httpx.delete(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It deletes the specified payment method for the authenticated user. """
return sync_detailed(
id=id,
client=client,
).parsed
async def asyncio_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.delete(**kwargs)
return _build_response(response=response)
async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It deletes the specified payment method for the authenticated user. """
return (
await asyncio_detailed(
id=id,
client=client,
)
).parsed

View File

@ -0,0 +1,102 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.customer import Customer
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/payment".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Customer, Error]]:
if response.status_code == 200:
response_200 = Customer.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Customer, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, Customer, Error]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[Any, Customer, Error]]:
""" This includes billing address, phone, and name.
This endpoint requires authentication by any KittyCAD user. It gets the payment information for the authenticated user. """
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, Customer, Error]]:
kwargs = _get_kwargs(
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, Customer, Error]]:
""" This includes billing address, phone, and name.
This endpoint requires authentication by any KittyCAD user. It gets the payment information for the authenticated user. """
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -0,0 +1,103 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.invoice import Invoice
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/payment/invoices".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, [Invoice], Error]]:
if response.status_code == 200:
response_200 = [
Invoice.from_dict(item)
for item in response.json()
]
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, [Invoice], Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, [Invoice], Error]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[Any, [Invoice], Error]]:
""" This endpoint requires authentication by any KittyCAD user. It lists invoices for the authenticated user. """
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, [Invoice], Error]]:
kwargs = _get_kwargs(
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, [Invoice], Error]]:
""" This endpoint requires authentication by any KittyCAD user. It lists invoices for the authenticated user. """
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -0,0 +1,103 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.payment_method import PaymentMethod
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/payment/methods".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, [PaymentMethod], Error]]:
if response.status_code == 200:
response_200 = [
PaymentMethod.from_dict(item)
for item in response.json()
]
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, [PaymentMethod], Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, [PaymentMethod], Error]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[Any, [PaymentMethod], Error]]:
""" This endpoint requires authentication by any KittyCAD user. It lists payment methods for the authenticated user. """
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, [PaymentMethod], Error]]:
kwargs = _get_kwargs(
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, [PaymentMethod], Error]]:
""" This endpoint requires authentication by any KittyCAD user. It lists payment methods for the authenticated user. """
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -0,0 +1,113 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.customer import Customer
from ...models.error import Error
from ...models.billing_info import BillingInfo
from ...types import Response
def _get_kwargs(
body: BillingInfo,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/payment".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Customer, Error]]:
if response.status_code == 200:
response_200 = Customer.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Customer, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
body: BillingInfo,
*,
client: Client,
) -> Response[Union[Any, Customer, Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
response = httpx.put(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
body: BillingInfo,
*,
client: Client,
) -> Optional[Union[Any, Customer, Error]]:
""" This includes billing address, phone, and name.
This endpoint requires authentication by any KittyCAD user. It updates the payment information for the authenticated user. """
return sync_detailed(
body=body,
client=client,
).parsed
async def asyncio_detailed(
body: BillingInfo,
*,
client: Client,
) -> Response[Union[Any, Customer, Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.put(**kwargs)
return _build_response(response=response)
async def asyncio(
body: BillingInfo,
*,
client: Client,
) -> Optional[Union[Any, Customer, Error]]:
""" This includes billing address, phone, and name.
This endpoint requires authentication by any KittyCAD user. It updates the payment information for the authenticated user. """
return (
await asyncio_detailed(
body=body,
client=client,
)
).parsed

View File

@ -0,0 +1,111 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.user import User
from ...models.error import Error
from ...models.update_user import UpdateUser
from ...types import Response
def _get_kwargs(
body: UpdateUser,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, User, Error]]:
if response.status_code == 200:
response_200 = User.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, User, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
body: UpdateUser,
*,
client: Client,
) -> Response[Union[Any, User, Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
response = httpx.put(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
body: UpdateUser,
*,
client: Client,
) -> Optional[Union[Any, User, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It updates information about the authenticated user. """
return sync_detailed(
body=body,
client=client,
).parsed
async def asyncio_detailed(
body: UpdateUser,
*,
client: Client,
) -> Response[Union[Any, User, Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.put(**kwargs)
return _build_response(response=response)
async def asyncio(
body: UpdateUser,
*,
client: Client,
) -> Optional[Union[Any, User, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It updates information about the authenticated user. """
return (
await asyncio_detailed(
body=body,
client=client,
)
).parsed

View File

@ -1,38 +1,57 @@
""" Contains all the data models used in inputs/outputs """
from .api_call_status import APICallStatus
from .address import Address
from .api_call_query_group import ApiCallQueryGroup
from .api_call_query_group_by import ApiCallQueryGroupBy
from .api_call_with_price import ApiCallWithPrice
from .api_call_with_price_results_page import ApiCallWithPriceResultsPage
from .api_token import ApiToken
from .api_token_results_page import ApiTokenResultsPage
from .async_api_call_output import AsyncApiCallOutput
from .billing_info import BillingInfo
from .cache_metadata import CacheMetadata
from .card_details import CardDetails
from .cluster import Cluster
from .code_language import CodeLanguage
from .code_output import CodeOutput
from .connection import Connection
from .created_at_sort_mode import CreatedAtSortMode
from .currency import Currency
from .customer import Customer
from .duration import Duration
from .engine_metadata import EngineMetadata
from .environment import Environment
from .error import Error
from .extended_user import ExtendedUser
from .extended_user_results_page import ExtendedUserResultsPage
from .file_conversion import FileConversion
from .file_conversion_output_format import FileConversionOutputFormat
from .file_conversion_results_page import FileConversionResultsPage
from .file_conversion_source_format import FileConversionSourceFormat
from .file_conversion_status import FileConversionStatus
from .file_conversion_with_output import FileConversionWithOutput
from .file_mass import FileMass
from .file_output_format import FileOutputFormat
from .file_source_format import FileSourceFormat
from .file_system_metadata import FileSystemMetadata
from .file_volume import FileVolume
from .gateway import Gateway
from .invoice import Invoice
from .invoice_line_item import InvoiceLineItem
from .invoice_status import InvoiceStatus
from .jetstream import Jetstream
from .jetstream_api_stats import JetstreamApiStats
from .jetstream_config import JetstreamConfig
from .jetstream_stats import JetstreamStats
from .leaf_node import LeafNode
from .login_params import LoginParams
from .meta_cluster_info import MetaClusterInfo
from .metadata import Metadata
from .method import Method
from .nats_connection import NatsConnection
from .payment_intent import PaymentIntent
from .payment_method import PaymentMethod
from .payment_method_card_checks import PaymentMethodCardChecks
from .payment_method_type import PaymentMethodType
from .pong import Pong
from .session import Session
from .status_code import StatusCode
from .update_user import UpdateUser
from .user import User
from .user_results_page import UserResultsPage
from .uuid import Uuid

141
kittycad/models/address.py Normal file
View File

@ -0,0 +1,141 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..types import UNSET, Unset
T = TypeVar("T", bound="Address")
@attr.s(auto_attribs=True)
class Address:
""" """
city: Union[Unset, str] = UNSET
country: Union[Unset, str] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
id: Union[Unset, Uuid] = UNSET
state: Union[Unset, str] = UNSET
street1: Union[Unset, str] = UNSET
street2: Union[Unset, str] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
zip: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
city = self.city
country = self.country
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
id: Union[Unset, str] = UNSET
if not isinstance(self.id, Unset):
id = self.id.value
state = self.state
street1 = self.street1
street2 = self.street2
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
zip = self.zip
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if city is not UNSET:
field_dict['city'] = city
if country is not UNSET:
field_dict['country'] = country
if created_at is not UNSET:
field_dict['created_at'] = created_at
if id is not UNSET:
field_dict['id'] = id
if state is not UNSET:
field_dict['state'] = state
if street1 is not UNSET:
field_dict['street1'] = street1
if street2 is not UNSET:
field_dict['street2'] = street2
if updated_at is not UNSET:
field_dict['updated_at'] = updated_at
if user_id is not UNSET:
field_dict['user_id'] = user_id
if zip is not UNSET:
field_dict['zip'] = zip
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
city = d.pop("city", UNSET)
country = d.pop("country", UNSET)
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]
if isinstance(_created_at, Unset):
created_at = UNSET
else:
created_at = isoparse(_created_at)
_id = d.pop("id", UNSET)
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
else:
id = Uuid(_id)
state = d.pop("state", UNSET)
street1 = d.pop("street1", UNSET)
street2 = d.pop("street2", UNSET)
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
zip = d.pop("zip", UNSET)
address = cls(
city=city,
country=country,
created_at=created_at,
id=id,
state=state,
street1=street1,
street2=street2,
updated_at=updated_at,
user_id=user_id,
zip=zip,
)
address.additional_properties = d
return address
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,7 +1,7 @@
from enum import Enum
class FileConversionStatus(str, Enum):
class APICallStatus(str, Enum):
QUEUED = 'Queued'
UPLOADED = 'Uploaded'
IN_PROGRESS = 'In Progress'

View File

View File

@ -0,0 +1,76 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.address import Address
from ..types import UNSET, Unset
T = TypeVar("T", bound="BillingInfo")
@attr.s(auto_attribs=True)
class BillingInfo:
""" """
address: Union[Unset, Address] = UNSET
name: Union[Unset, str] = UNSET
phone: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
address: Union[Unset, str] = UNSET
if not isinstance(self.address, Unset):
address = self.address.value
name = self.name
phone = self.phone
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if address is not UNSET:
field_dict['address'] = address
if name is not UNSET:
field_dict['name'] = name
if phone is not UNSET:
field_dict['phone'] = phone
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
_address = d.pop("address", UNSET)
address: Union[Unset, Address]
if isinstance(_address, Unset):
address = UNSET
else:
address = Address(_address)
name = d.pop("name", UNSET)
phone = d.pop("phone", UNSET)
billing_info = cls(
address=address,
name=name,
phone=phone,
)
billing_info.additional_properties = d
return billing_info
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,54 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="CacheMetadata")
@attr.s(auto_attribs=True)
class CacheMetadata:
""" """
ok: Union[Unset, bool] = False
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
ok = self.ok
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if ok is not UNSET:
field_dict['ok'] = ok
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
ok = d.pop("ok", UNSET)
cache_metadata = cls(
ok=ok,
)
cache_metadata.additional_properties = d
return cache_metadata
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,111 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.payment_method_card_checks import PaymentMethodCardChecks
from ..types import UNSET, Unset
T = TypeVar("T", bound="CardDetails")
@attr.s(auto_attribs=True)
class CardDetails:
""" """
brand: Union[Unset, str] = UNSET
checks: Union[Unset, PaymentMethodCardChecks] = UNSET
country: Union[Unset, str] = UNSET
exp_month: Union[Unset, int] = UNSET
exp_year: Union[Unset, int] = UNSET
fingerprint: Union[Unset, str] = UNSET
funding: Union[Unset, str] = UNSET
last4: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
brand = self.brand
checks: Union[Unset, str] = UNSET
if not isinstance(self.checks, Unset):
checks = self.checks.value
country = self.country
exp_month = self.exp_month
exp_year = self.exp_year
fingerprint = self.fingerprint
funding = self.funding
last4 = self.last4
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if brand is not UNSET:
field_dict['brand'] = brand
if checks is not UNSET:
field_dict['checks'] = checks
if country is not UNSET:
field_dict['country'] = country
if exp_month is not UNSET:
field_dict['exp_month'] = exp_month
if exp_year is not UNSET:
field_dict['exp_year'] = exp_year
if fingerprint is not UNSET:
field_dict['fingerprint'] = fingerprint
if funding is not UNSET:
field_dict['funding'] = funding
if last4 is not UNSET:
field_dict['last4'] = last4
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
brand = d.pop("brand", UNSET)
_checks = d.pop("checks", UNSET)
checks: Union[Unset, PaymentMethodCardChecks]
if isinstance(_checks, Unset):
checks = UNSET
else:
checks = PaymentMethodCardChecks(_checks)
country = d.pop("country", UNSET)
exp_month = d.pop("exp_month", UNSET)
exp_year = d.pop("exp_year", UNSET)
fingerprint = d.pop("fingerprint", UNSET)
funding = d.pop("funding", UNSET)
last4 = d.pop("last4", UNSET)
card_details = cls(
brand=brand,
checks=checks,
country=country,
exp_month=exp_month,
exp_year=exp_year,
fingerprint=fingerprint,
funding=funding,
last4=last4,
)
card_details.additional_properties = d
return card_details
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,11 @@
from enum import Enum
class CodeLanguage(str, Enum):
GO = 'go'
RUST = 'rust'
PYTHON = 'python'
NODE = 'node'
def __str__(self) -> str:
return str(self.value)

View File

@ -4,50 +4,52 @@ import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="FileConversionResultsPage")
T = TypeVar("T", bound="CodeOutput")
@attr.s(auto_attribs=True)
class FileConversionResultsPage:
class CodeOutput:
""" """
from ..models import FileConversion
items: Union[Unset, List[FileConversion]] = UNSET
next_page: Union[Unset, str] = UNSET
output: Union[Unset, str] = UNSET
stderr: Union[Unset, str] = UNSET
stdout: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models import FileConversion
items: Union[Unset, List[FileConversion]] = UNSET
if not isinstance(self.items, Unset):
items = self.items
next_page = self.next_page
output = self.output
stderr = self.stderr
stdout = self.stdout
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if items is not UNSET:
field_dict['items'] = items
if next_page is not UNSET:
field_dict['next_page'] = next_page
if output is not UNSET:
field_dict['output'] = output
if stderr is not UNSET:
field_dict['stderr'] = stderr
if stdout is not UNSET:
field_dict['stdout'] = stdout
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
from ..models import FileConversion
items = cast(List[FileConversion], d.pop("items", UNSET))
output = d.pop("output", UNSET)
next_page = d.pop("next_page", UNSET)
stderr = d.pop("stderr", UNSET)
file_conversion_results_page = cls(
items=items,
next_page=next_page,
stdout = d.pop("stdout", UNSET)
code_output = cls(
output=output,
stderr=stderr,
stdout=stdout,
)
file_conversion_results_page.additional_properties = d
return file_conversion_results_page
code_output.additional_properties = d
return code_output
@property
def additional_keys(self) -> List[str]:

View File

@ -11,18 +11,18 @@ from ..models.leaf_node import LeafNode
from ..models.duration import Duration
from ..types import UNSET, Unset
T = TypeVar("T", bound="NatsConnection")
T = TypeVar("T", bound="Connection")
@attr.s(auto_attribs=True)
class NatsConnection:
class Connection:
""" """
auth_timeout: Union[Unset, int] = UNSET
cluster: Union[Unset, Cluster] = UNSET
config_load_time: Union[Unset, datetime.datetime] = UNSET
connections: Union[Unset, int] = UNSET
cores: Union[Unset, int] = UNSET
cpu: Union[Unset, int] = UNSET
cpu: Union[Unset, float] = UNSET
gateway: Union[Unset, Gateway] = UNSET
git_commit: Union[Unset, str] = UNSET
go: Union[Unset, str] = UNSET

146
kittycad/models/currency.py Normal file
View File

@ -0,0 +1,146 @@
from enum import Enum
class Currency(str, Enum):
AED = 'aed'
AFN = 'afn'
ALL = 'all'
AMD = 'amd'
ANG = 'ang'
AOA = 'aoa'
ARS = 'ars'
AUD = 'aud'
AWG = 'awg'
AZN = 'azn'
BAM = 'bam'
BBD = 'bbd'
BDT = 'bdt'
BGN = 'bgn'
BIF = 'bif'
BMD = 'bmd'
BND = 'bnd'
BOB = 'bob'
BRL = 'brl'
BSD = 'bsd'
BWP = 'bwp'
BZD = 'bzd'
CAD = 'cad'
CDF = 'cdf'
CHF = 'chf'
CLP = 'clp'
CNY = 'cny'
COP = 'cop'
CRC = 'crc'
CVE = 'cve'
CZK = 'czk'
DJF = 'djf'
DKK = 'dkk'
DOP = 'dop'
DZD = 'dzd'
EEK = 'eek'
EGP = 'egp'
ETB = 'etb'
EUR = 'eur'
FJD = 'fjd'
FKP = 'fkp'
GBP = 'gbp'
GEL = 'gel'
GIP = 'gip'
GMD = 'gmd'
GNF = 'gnf'
GTQ = 'gtq'
GYD = 'gyd'
HKD = 'hkd'
HNL = 'hnl'
HRK = 'hrk'
HTG = 'htg'
HUF = 'huf'
IDR = 'idr'
ILS = 'ils'
INR = 'inr'
ISK = 'isk'
JMD = 'jmd'
JPY = 'jpy'
KES = 'kes'
KGS = 'kgs'
KHR = 'khr'
KMF = 'kmf'
KRW = 'krw'
KYD = 'kyd'
KZT = 'kzt'
LAK = 'lak'
LBP = 'lbp'
LKR = 'lkr'
LRD = 'lrd'
LSL = 'lsl'
LTL = 'ltl'
LVL = 'lvl'
MAD = 'mad'
MDL = 'mdl'
MGA = 'mga'
MKD = 'mkd'
MNT = 'mnt'
MOP = 'mop'
MRO = 'mro'
MUR = 'mur'
MVR = 'mvr'
MWK = 'mwk'
MXN = 'mxn'
MYR = 'myr'
MZN = 'mzn'
NAD = 'nad'
NGN = 'ngn'
NIO = 'nio'
NOK = 'nok'
NPR = 'npr'
NZD = 'nzd'
PAB = 'pab'
PEN = 'pen'
PGK = 'pgk'
PHP = 'php'
PKR = 'pkr'
PLN = 'pln'
PYG = 'pyg'
QAR = 'qar'
RON = 'ron'
RSD = 'rsd'
RUB = 'rub'
RWF = 'rwf'
SAR = 'sar'
SBD = 'sbd'
SCR = 'scr'
SEK = 'sek'
SGD = 'sgd'
SHP = 'shp'
SLL = 'sll'
SOS = 'sos'
SRD = 'srd'
STD = 'std'
SVC = 'svc'
SZL = 'szl'
THB = 'thb'
TJS = 'tjs'
TOP = 'top'
TRY = 'try'
TTD = 'ttd'
TWD = 'twd'
TZS = 'tzs'
UAH = 'uah'
UGX = 'ugx'
USD = 'usd'
UYU = 'uyu'
UZS = 'uzs'
VEF = 'vef'
VND = 'vnd'
VUV = 'vuv'
WST = 'wst'
XAF = 'xaf'
XCD = 'xcd'
XOF = 'xof'
XPF = 'xpf'
YER = 'yer'
ZAR = 'zar'
ZMW = 'zmw'
def __str__(self) -> str:
return str(self.value)

View File

@ -0,0 +1,23 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.address import Address
from ..models.currency import Currency
from ..types import UNSET, Unset
T = TypeVar("T", bound="Customer")
@attr.s(auto_attribs=True)
class Customer:
""" """
address: Union[Unset, Address] = UNSET
balance: Union[Unset, int] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
currency: Union[Unset, Currency] = UNSET
delinquent: Union[Unset, bool] = False
email: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET

View File

@ -3,7 +3,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.file_system_metadata import FileSystemMetadata
from ..models.nats_connection import NatsConnection
from ..models.connection import Connection
from ..types import UNSET, Unset
T = TypeVar("T", bound="EngineMetadata")
@ -15,7 +15,7 @@ class EngineMetadata:
async_jobs_running: Union[Unset, bool] = False
fs: Union[Unset, FileSystemMetadata] = UNSET
git_hash: Union[Unset, str] = UNSET
nats: Union[Unset, NatsConnection] = UNSET
pubsub: Union[Unset, Connection] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
@ -25,9 +25,9 @@ class EngineMetadata:
if not isinstance(self.fs, Unset):
fs = self.fs.value
git_hash = self.git_hash
nats: Union[Unset, str] = UNSET
if not isinstance(self.nats, Unset):
nats = self.nats.value
pubsub: Union[Unset, str] = UNSET
if not isinstance(self.pubsub, Unset):
pubsub = self.pubsub.value
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
@ -38,8 +38,8 @@ class EngineMetadata:
field_dict['fs'] = fs
if git_hash is not UNSET:
field_dict['git_hash'] = git_hash
if nats is not UNSET:
field_dict['nats'] = nats
if pubsub is not UNSET:
field_dict['pubsub'] = pubsub
return field_dict
@ -57,18 +57,18 @@ class EngineMetadata:
git_hash = d.pop("git_hash", UNSET)
_nats = d.pop("nats", UNSET)
nats: Union[Unset, NatsConnection]
if isinstance(_nats, Unset):
nats = UNSET
_pubsub = d.pop("pubsub", UNSET)
pubsub: Union[Unset, Connection]
if isinstance(_pubsub, Unset):
pubsub = UNSET
else:
nats = NatsConnection(_nats)
pubsub = Connection(_pubsub)
engine_metadata = cls(
async_jobs_running=async_jobs_running,
fs=fs,
git_hash=git_hash,
nats=nats,
pubsub=pubsub,
)
engine_metadata.additional_properties = d

View File

@ -0,0 +1,10 @@
from enum import Enum
class Environment(str, Enum):
DEVELOPMENT = 'DEVELOPMENT'
PREVIEW = 'PREVIEW'
PRODUCTION = 'PRODUCTION'
def __str__(self) -> str:
return str(self.value)

View File

@ -5,9 +5,9 @@ import attr
from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..models.file_conversion_output_format import FileConversionOutputFormat
from ..models.file_conversion_source_format import FileConversionSourceFormat
from ..models.file_conversion_status import FileConversionStatus
from ..models.file_output_format import FileOutputFormat
from ..models.file_source_format import FileSourceFormat
from ..models.api_call_status import APICallStatus
from ..types import UNSET, Unset
T = TypeVar("T", bound="FileConversion")
@ -19,15 +19,13 @@ class FileConversion:
completed_at: Union[Unset, datetime.datetime] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
id: Union[Unset, Uuid] = UNSET
output_file_link: Union[Unset, str] = UNSET
output_format: Union[Unset, FileConversionOutputFormat] = UNSET
src_file_link: Union[Unset, str] = UNSET
src_format: Union[Unset, FileConversionSourceFormat] = UNSET
output: Union[Unset, str] = UNSET
output_format: Union[Unset, FileOutputFormat] = UNSET
src_format: Union[Unset, FileSourceFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, FileConversionStatus] = UNSET
status: Union[Unset, APICallStatus] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
worker: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
@ -41,11 +39,10 @@ class FileConversion:
id: Union[Unset, str] = UNSET
if not isinstance(self.id, Unset):
id = self.id.value
output_file_link = self.output_file_link
output = self.output
output_format: Union[Unset, str] = UNSET
if not isinstance(self.output_format, Unset):
output_format = self.output_format.value
src_file_link = self.src_file_link
src_format: Union[Unset, str] = UNSET
if not isinstance(self.src_format, Unset):
src_format = self.src_format.value
@ -59,7 +56,6 @@ class FileConversion:
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
worker = self.worker
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
@ -70,12 +66,10 @@ class FileConversion:
field_dict['created_at'] = created_at
if id is not UNSET:
field_dict['id'] = id
if output_file_link is not UNSET:
field_dict['output_file_link'] = output_file_link
if output is not UNSET:
field_dict['output'] = output
if output_format is not UNSET:
field_dict['output_format'] = output_format
if src_file_link is not UNSET:
field_dict['src_file_link'] = src_file_link
if src_format is not UNSET:
field_dict['src_format'] = src_format
if started_at is not UNSET:
@ -86,8 +80,6 @@ class FileConversion:
field_dict['updated_at'] = updated_at
if user_id is not UNSET:
field_dict['user_id'] = user_id
if worker is not UNSET:
field_dict['worker'] = worker
return field_dict
@ -115,23 +107,21 @@ class FileConversion:
else:
id = Uuid(_id)
output_file_link = d.pop("output_file_link", UNSET)
output = d.pop("output", UNSET)
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, FileConversionOutputFormat]
output_format: Union[Unset, FileOutputFormat]
if isinstance(_output_format, Unset):
output_format = UNSET
else:
output_format = FileConversionOutputFormat(_output_format)
src_file_link = d.pop("src_file_link", UNSET)
output_format = FileOutputFormat(_output_format)
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileConversionSourceFormat]
src_format: Union[Unset, FileSourceFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
else:
src_format = FileConversionSourceFormat(_src_format)
src_format = FileSourceFormat(_src_format)
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
@ -141,11 +131,11 @@ class FileConversion:
started_at = isoparse(_started_at)
_status = d.pop("status", UNSET)
status: Union[Unset, FileConversionStatus]
status: Union[Unset, APICallStatus]
if isinstance(_status, Unset):
status = UNSET
else:
status = FileConversionStatus(_status)
status = APICallStatus(_status)
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
@ -156,21 +146,17 @@ class FileConversion:
user_id = d.pop("user_id", UNSET)
worker = d.pop("worker", UNSET)
file_conversion = cls(
completed_at=completed_at,
created_at=created_at,
id=id,
output_file_link=output_file_link,
output=output,
output_format=output_format,
src_file_link=src_file_link,
src_format=src_format,
started_at=started_at,
status=status,
updated_at=updated_at,
user_id=user_id,
worker=worker,
)
file_conversion.additional_properties = d

View File

@ -5,25 +5,25 @@ import attr
from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..models.file_conversion_output_format import FileConversionOutputFormat
from ..models.file_conversion_source_format import FileConversionSourceFormat
from ..models.file_conversion_status import FileConversionStatus
from ..models.file_source_format import FileSourceFormat
from ..models.api_call_status import APICallStatus
from ..types import UNSET, Unset
T = TypeVar("T", bound="FileConversionWithOutput")
T = TypeVar("T", bound="FileMass")
@attr.s(auto_attribs=True)
class FileConversionWithOutput:
class FileMass:
""" """
completed_at: Union[Unset, datetime.datetime] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
id: Union[Unset, Uuid] = UNSET
output: Union[Unset, str] = UNSET
output_format: Union[Unset, FileConversionOutputFormat] = UNSET
src_format: Union[Unset, FileConversionSourceFormat] = UNSET
mass: Union[Unset, float] = UNSET
material_density: Union[Unset, float] = UNSET
src_format: Union[Unset, FileSourceFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, FileConversionStatus] = UNSET
status: Union[Unset, APICallStatus] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
@ -36,13 +36,12 @@ class FileConversionWithOutput:
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
error = self.error
id: Union[Unset, str] = UNSET
if not isinstance(self.id, Unset):
id = self.id.value
output = self.output
output_format: Union[Unset, str] = UNSET
if not isinstance(self.output_format, Unset):
output_format = self.output_format.value
mass = self.mass
material_density = self.material_density
src_format: Union[Unset, str] = UNSET
if not isinstance(self.src_format, Unset):
src_format = self.src_format.value
@ -64,12 +63,14 @@ class FileConversionWithOutput:
field_dict['completed_at'] = completed_at
if created_at is not UNSET:
field_dict['created_at'] = created_at
if error is not UNSET:
field_dict['error'] = error
if id is not UNSET:
field_dict['id'] = id
if output is not UNSET:
field_dict['output'] = output
if output_format is not UNSET:
field_dict['output_format'] = output_format
if mass is not UNSET:
field_dict['mass'] = mass
if material_density is not UNSET:
field_dict['material_density'] = material_density
if src_format is not UNSET:
field_dict['src_format'] = src_format
if started_at is not UNSET:
@ -100,6 +101,8 @@ class FileConversionWithOutput:
else:
created_at = isoparse(_created_at)
error = d.pop("error", UNSET)
_id = d.pop("id", UNSET)
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
@ -107,21 +110,16 @@ class FileConversionWithOutput:
else:
id = Uuid(_id)
output = d.pop("output", UNSET)
mass = d.pop("mass", UNSET)
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, FileConversionOutputFormat]
if isinstance(_output_format, Unset):
output_format = UNSET
else:
output_format = FileConversionOutputFormat(_output_format)
material_density = d.pop("material_density", UNSET)
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileConversionSourceFormat]
src_format: Union[Unset, FileSourceFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
else:
src_format = FileConversionSourceFormat(_src_format)
src_format = FileSourceFormat(_src_format)
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
@ -131,11 +129,11 @@ class FileConversionWithOutput:
started_at = isoparse(_started_at)
_status = d.pop("status", UNSET)
status: Union[Unset, FileConversionStatus]
status: Union[Unset, APICallStatus]
if isinstance(_status, Unset):
status = UNSET
else:
status = FileConversionStatus(_status)
status = APICallStatus(_status)
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
@ -146,12 +144,13 @@ class FileConversionWithOutput:
user_id = d.pop("user_id", UNSET)
file_conversion_with_output = cls(
file_mass = cls(
completed_at=completed_at,
created_at=created_at,
error=error,
id=id,
output=output,
output_format=output_format,
mass=mass,
material_density=material_density,
src_format=src_format,
started_at=started_at,
status=status,
@ -159,8 +158,8 @@ class FileConversionWithOutput:
user_id=user_id,
)
file_conversion_with_output.additional_properties = d
return file_conversion_with_output
file_mass.additional_properties = d
return file_mass
@property
def additional_keys(self) -> List[str]:

View File

@ -1,7 +1,7 @@
from enum import Enum
class FileConversionOutputFormat(str, Enum):
class FileOutputFormat(str, Enum):
STL = 'stl'
OBJ = 'obj'
DAE = 'dae'

View File

@ -1,7 +1,7 @@
from enum import Enum
class FileConversionSourceFormat(str, Enum):
class FileSourceFormat(str, Enum):
STL = 'stl'
OBJ = 'obj'
DAE = 'dae'

View File

@ -0,0 +1,171 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..models.file_source_format import FileSourceFormat
from ..models.api_call_status import APICallStatus
from ..types import UNSET, Unset
T = TypeVar("T", bound="FileVolume")
@attr.s(auto_attribs=True)
class FileVolume:
""" """
completed_at: Union[Unset, datetime.datetime] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
id: Union[Unset, Uuid] = UNSET
src_format: Union[Unset, FileSourceFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, APICallStatus] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
volume: Union[Unset, float] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
completed_at: Union[Unset, str] = UNSET
if not isinstance(self.completed_at, Unset):
completed_at = self.completed_at.isoformat()
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
error = self.error
id: Union[Unset, str] = UNSET
if not isinstance(self.id, Unset):
id = self.id.value
src_format: Union[Unset, str] = UNSET
if not isinstance(self.src_format, Unset):
src_format = self.src_format.value
started_at: Union[Unset, str] = UNSET
if not isinstance(self.started_at, Unset):
started_at = self.started_at.isoformat()
status: Union[Unset, str] = UNSET
if not isinstance(self.status, Unset):
status = self.status.value
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
volume = self.volume
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if completed_at is not UNSET:
field_dict['completed_at'] = completed_at
if created_at is not UNSET:
field_dict['created_at'] = created_at
if error is not UNSET:
field_dict['error'] = error
if id is not UNSET:
field_dict['id'] = id
if src_format is not UNSET:
field_dict['src_format'] = src_format
if started_at is not UNSET:
field_dict['started_at'] = started_at
if status is not UNSET:
field_dict['status'] = status
if updated_at is not UNSET:
field_dict['updated_at'] = updated_at
if user_id is not UNSET:
field_dict['user_id'] = user_id
if volume is not UNSET:
field_dict['volume'] = volume
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
if isinstance(_completed_at, Unset):
completed_at = UNSET
else:
completed_at = isoparse(_completed_at)
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]
if isinstance(_created_at, Unset):
created_at = UNSET
else:
created_at = isoparse(_created_at)
error = d.pop("error", UNSET)
_id = d.pop("id", UNSET)
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
else:
id = Uuid(_id)
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileSourceFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
else:
src_format = FileSourceFormat(_src_format)
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
if isinstance(_started_at, Unset):
started_at = UNSET
else:
started_at = isoparse(_started_at)
_status = d.pop("status", UNSET)
status: Union[Unset, APICallStatus]
if isinstance(_status, Unset):
status = UNSET
else:
status = APICallStatus(_status)
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
volume = d.pop("volume", UNSET)
file_volume = cls(
completed_at=completed_at,
created_at=created_at,
error=error,
id=id,
src_format=src_format,
started_at=started_at,
status=status,
updated_at=updated_at,
user_id=user_id,
volume=volume,
)
file_volume.additional_properties = d
return file_volume
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,4 +0,0 @@
class http_req_stats(int):
def __int__(self) -> int:
return self

View File

@ -0,0 +1,29 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.currency import Currency
from ..models.invoice_status import InvoiceStatus
from ..types import UNSET, Unset
T = TypeVar("T", bound="Invoice")
@attr.s(auto_attribs=True)
class Invoice:
""" """
amount_due: Union[Unset, int] = UNSET
amount_paid: Union[Unset, int] = UNSET
amount_remaining: Union[Unset, int] = UNSET
attempt_count: Union[Unset, int] = UNSET
attempted: Union[Unset, bool] = False
created_at: Union[Unset, datetime.datetime] = UNSET
currency: Union[Unset, Currency] = UNSET
description: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
invoice_pdf: Union[Unset, str] = UNSET
invoice_url: Union[Unset, str] = UNSET
from ..models import InvoiceLineItem
lines: Union[Unset, List[InvoiceLineItem]] = UNSET

View File

@ -0,0 +1,18 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.currency import Currency
from ..types import UNSET, Unset
T = TypeVar("T", bound="InvoiceLineItem")
@attr.s(auto_attribs=True)
class InvoiceLineItem:
""" """
amount: Union[Unset, int] = UNSET
currency: Union[Unset, Currency] = UNSET
description: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
invoice_item: Union[Unset, str] = UNSET

View File

@ -0,0 +1,13 @@
from enum import Enum
class InvoiceStatus(str, Enum):
DELETED = 'deleted'
DRAFT = 'draft'
OPEN = 'open'
PAID = 'paid'
UNCOLLECTIBLE = 'uncollectible'
VOID = 'void'
def __str__(self) -> str:
return str(self.value)

View File

@ -0,0 +1,54 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="LoginParams")
@attr.s(auto_attribs=True)
class LoginParams:
""" """
session: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
session = self.session
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if session is not UNSET:
field_dict['session'] = session
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
session = d.pop("session", UNSET)
login_params = cls(
session=session,
)
login_params.additional_properties = d
return login_params
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -2,9 +2,11 @@ from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.cache_metadata import CacheMetadata
from ..models.engine_metadata import EngineMetadata
from ..models.environment import Environment
from ..models.file_system_metadata import FileSystemMetadata
from ..models.nats_connection import NatsConnection
from ..models.connection import Connection
from ..types import UNSET, Unset
T = TypeVar("T", bound="Metadata")
@ -13,42 +15,61 @@ T = TypeVar("T", bound="Metadata")
@attr.s(auto_attribs=True)
class Metadata:
""" """
cache: Union[Unset, CacheMetadata] = UNSET
engine: Union[Unset, EngineMetadata] = UNSET
environment: Union[Unset, Environment] = UNSET
fs: Union[Unset, FileSystemMetadata] = UNSET
git_hash: Union[Unset, str] = UNSET
nats: Union[Unset, NatsConnection] = UNSET
pubsub: Union[Unset, Connection] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
cache: Union[Unset, str] = UNSET
if not isinstance(self.cache, Unset):
cache = self.cache.value
engine: Union[Unset, str] = UNSET
if not isinstance(self.engine, Unset):
engine = self.engine.value
environment: Union[Unset, str] = UNSET
if not isinstance(self.environment, Unset):
environment = self.environment.value
fs: Union[Unset, str] = UNSET
if not isinstance(self.fs, Unset):
fs = self.fs.value
git_hash = self.git_hash
nats: Union[Unset, str] = UNSET
if not isinstance(self.nats, Unset):
nats = self.nats.value
pubsub: Union[Unset, str] = UNSET
if not isinstance(self.pubsub, Unset):
pubsub = self.pubsub.value
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if cache is not UNSET:
field_dict['cache'] = cache
if engine is not UNSET:
field_dict['engine'] = engine
if environment is not UNSET:
field_dict['environment'] = environment
if fs is not UNSET:
field_dict['fs'] = fs
if git_hash is not UNSET:
field_dict['git_hash'] = git_hash
if nats is not UNSET:
field_dict['nats'] = nats
if pubsub is not UNSET:
field_dict['pubsub'] = pubsub
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
_cache = d.pop("cache", UNSET)
cache: Union[Unset, CacheMetadata]
if isinstance(_cache, Unset):
cache = UNSET
else:
cache = CacheMetadata(_cache)
_engine = d.pop("engine", UNSET)
engine: Union[Unset, EngineMetadata]
if isinstance(_engine, Unset):
@ -56,6 +77,13 @@ class Metadata:
else:
engine = EngineMetadata(_engine)
_environment = d.pop("environment", UNSET)
environment: Union[Unset, Environment]
if isinstance(_environment, Unset):
environment = UNSET
else:
environment = Environment(_environment)
_fs = d.pop("fs", UNSET)
fs: Union[Unset, FileSystemMetadata]
if isinstance(_fs, Unset):
@ -65,18 +93,20 @@ class Metadata:
git_hash = d.pop("git_hash", UNSET)
_nats = d.pop("nats", UNSET)
nats: Union[Unset, NatsConnection]
if isinstance(_nats, Unset):
nats = UNSET
_pubsub = d.pop("pubsub", UNSET)
pubsub: Union[Unset, Connection]
if isinstance(_pubsub, Unset):
pubsub = UNSET
else:
nats = NatsConnection(_nats)
pubsub = Connection(_pubsub)
metadata = cls(
cache=cache,
engine=engine,
environment=environment,
fs=fs,
git_hash=git_hash,
nats=nats,
pubsub=pubsub,
)
metadata.additional_properties = d

View File

@ -0,0 +1,54 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="PaymentIntent")
@attr.s(auto_attribs=True)
class PaymentIntent:
""" """
client_secret: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
client_secret = self.client_secret
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if client_secret is not UNSET:
field_dict['client_secret'] = client_secret
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
client_secret = d.pop("client_secret", UNSET)
payment_intent = cls(
client_secret=client_secret,
)
payment_intent.additional_properties = d
return payment_intent
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,21 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.billing_info import BillingInfo
from ..models.card_details import CardDetails
from ..models.payment_method_type import PaymentMethodType
from ..types import UNSET, Unset
T = TypeVar("T", bound="PaymentMethod")
@attr.s(auto_attribs=True)
class PaymentMethod:
""" """
billing_info: Union[Unset, BillingInfo] = UNSET
card: Union[Unset, CardDetails] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
id: Union[Unset, str] = UNSET

View File

@ -0,0 +1,68 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="PaymentMethodCardChecks")
@attr.s(auto_attribs=True)
class PaymentMethodCardChecks:
""" """
address_line1_check: Union[Unset, str] = UNSET
address_postal_code_check: Union[Unset, str] = UNSET
cvc_check: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
address_line1_check = self.address_line1_check
address_postal_code_check = self.address_postal_code_check
cvc_check = self.cvc_check
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if address_line1_check is not UNSET:
field_dict['address_line1_check'] = address_line1_check
if address_postal_code_check is not UNSET:
field_dict['address_postal_code_check'] = address_postal_code_check
if cvc_check is not UNSET:
field_dict['cvc_check'] = cvc_check
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
address_line1_check = d.pop("address_line1_check", UNSET)
address_postal_code_check = d.pop("address_postal_code_check", UNSET)
cvc_check = d.pop("cvc_check", UNSET)
payment_method_card_checks = cls(
address_line1_check=address_line1_check,
address_postal_code_check=address_postal_code_check,
cvc_check=cvc_check,
)
payment_method_card_checks.additional_properties = d
return payment_method_card_checks
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,8 @@
from enum import Enum
class PaymentMethodType(str, Enum):
CARD = 'card'
def __str__(self) -> str:
return str(self.value)

View File

@ -0,0 +1,89 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="UpdateUser")
@attr.s(auto_attribs=True)
class UpdateUser:
""" """
company: Union[Unset, str] = UNSET
discord: Union[Unset, str] = UNSET
first_name: Union[Unset, str] = UNSET
github: Union[Unset, str] = UNSET
last_name: Union[Unset, str] = UNSET
phone: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
company = self.company
discord = self.discord
first_name = self.first_name
github = self.github
last_name = self.last_name
phone = self.phone
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if company is not UNSET:
field_dict['company'] = company
if discord is not UNSET:
field_dict['discord'] = discord
if first_name is not UNSET:
field_dict['first_name'] = first_name
if github is not UNSET:
field_dict['github'] = github
if last_name is not UNSET:
field_dict['last_name'] = last_name
if phone is not UNSET:
field_dict['phone'] = phone
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
company = d.pop("company", UNSET)
discord = d.pop("discord", UNSET)
first_name = d.pop("first_name", UNSET)
github = d.pop("github", UNSET)
last_name = d.pop("last_name", UNSET)
phone = d.pop("phone", UNSET)
update_user = cls(
company=company,
discord=discord,
first_name=first_name,
github=github,
last_name=last_name,
phone=phone,
)
update_user.additional_properties = d
return update_user
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

1401
spec.json

File diff suppressed because it is too large Load Diff