Compare commits

..

25 Commits

Author SHA1 Message Date
01a73859d4 Update api spec (#140)
* YOYO NEW API SPEC!

* bump version

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* I have generated the latest API!

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-06 11:27:00 -07:00
f63509a1eb Bump pytest from 7.3.1 to 7.4.1 (#138)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.4.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.3.1...7.4.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-06 11:04:43 -07:00
7cb8d5327f Bump jsonpatch from 1.32 to 1.33 (#137)
Bumps [jsonpatch](https://github.com/stefankoegl/python-json-patch) from 1.32 to 1.33.
- [Commits](https://github.com/stefankoegl/python-json-patch/compare/v1.32...v1.33)

---
updated-dependencies:
- dependency-name: jsonpatch
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-06 11:01:18 -07:00
1f9a787c15 Bump types-python-dateutil from 2.8.19.12 to 2.8.19.14 (#134)
Bumps [types-python-dateutil](https://github.com/python/typeshed) from 2.8.19.12 to 2.8.19.14.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-python-dateutil
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-06 10:58:42 -07:00
3e2c9450dc Bump pytest-cov from 4.0.0 to 4.1.0 (#136)
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 4.0.0 to 4.1.0.
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v4.0.0...v4.1.0)

---
updated-dependencies:
- dependency-name: pytest-cov
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-06 10:51:02 -07:00
eb8d1b77bb Bump actions/checkout from 3 to 4 (#139)
* Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* I have generated the latest API!

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-06 10:47:43 -07:00
d5184bf172 Bump pytest-asyncio from 0.21.0 to 0.21.1 (#133)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.21.0 to 0.21.1.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.21.0...v0.21.1)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-06 10:47:22 -07:00
3cad86c5a3 updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-30 18:39:19 -07:00
63824cd04f Update api spec (#132)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-30 18:30:23 -07:00
816904419e Bump tornado from 6.3.1 to 6.3.3 (#130)
Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.3.1 to 6.3.3.
- [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst)
- [Commits](https://github.com/tornadoweb/tornado/compare/v6.3.1...v6.3.3)

---
updated-dependencies:
- dependency-name: tornado
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-30 18:30:12 -07:00
e68857f4c9 Bump certifi from 2022.12.7 to 2023.7.22 (#131)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.12.7 to 2023.7.22.
- [Commits](https://github.com/certifi/python-certifi/compare/2022.12.07...2023.07.22)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-30 18:30:00 -07:00
db1bd33c79 fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-30 16:59:35 -07:00
dea0d637fe fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-30 16:24:09 -07:00
2e1c75769f updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-30 16:18:39 -07:00
8162fa1964 Update api spec (#127)
* YOYO NEW API SPEC!

* bump version

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* some fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes #128

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* mypy fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-30 15:59:51 -07:00
d737fb4e8f Update ruff requirement from ^0.0.284 to ^0.0.286 (#129)
Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/BREAKING_CHANGES.md)
- [Commits](https://github.com/astral-sh/ruff/compare/v0.0.284...v0.0.286)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-30 12:24:05 -07:00
686ec0cb36 bump versino
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-17 14:39:54 -07:00
f522911d7b Update api spec (#125)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-17 14:30:53 -07:00
1e693890ef fix
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-17 14:13:56 -07:00
755a4fd789 Revert "fixes"
This reverts commit 581c06a943.
2023-08-17 14:02:51 -07:00
581c06a943 fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-17 14:01:41 -07:00
3ce38b0b26 Delete .DS_Store 2023-08-17 13:36:24 -07:00
d8a3120db3 Delete .DS_Store 2023-08-17 13:35:43 -07:00
968e8bbefd fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-17 13:34:47 -07:00
9921f5a9f3 Update api spec (#124)
* YOYO NEW API SPEC!

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* tuples

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* I have generated the latest API!

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-17 12:48:13 -07:00
166 changed files with 13074 additions and 984 deletions

View File

@ -15,7 +15,7 @@ jobs:
black: black:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4

View File

@ -22,7 +22,7 @@ jobs:
python-version: [3.8, 3.9] python-version: [3.8, 3.9]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:

View File

@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:

View File

@ -16,7 +16,7 @@ jobs:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
ref: ${{ github.event.pull_request.head.ref }} ref: ${{ github.event.pull_request.head.ref }}
- name: Run generate - name: Run generate

View File

@ -8,7 +8,7 @@ jobs:
name: make-release name: make-release
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: '3.x' python-version: '3.x'

View File

@ -15,7 +15,7 @@ jobs:
mypy: mypy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4

View File

@ -15,7 +15,7 @@ jobs:
ruff: ruff:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4

View File

@ -15,7 +15,7 @@ jobs:
name: update-spec name: update-spec
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: make generate - name: make generate
shell: bash shell: bash
run: | run: |
@ -34,7 +34,7 @@ jobs:
echo "No files changed, proceeding"; echo "No files changed, proceeding";
fi fi
# Checkout the docs repo since we will want to update the files there. # Checkout the docs repo since we will want to update the files there.
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
repository: 'kittycad/website' repository: 'kittycad/website'
path: 'docs' path: 'docs'

1
.gitignore vendored
View File

@ -22,7 +22,6 @@ dmypy.json
/coverage.xml /coverage.xml
/.coverage /.coverage
poetry.lock
testing testing
# Sphinx documentation # Sphinx documentation

1939
assets/ORIGINALVOXEL-3.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -61,10 +61,19 @@ client = ClientFromEnv()
# Create the json patch document. # Create the json patch document.
patch = jsonpatch.make_patch(original, data) patch = jsonpatch.make_patch(original, data)
# Convert this to a dict.
patch = json.loads(patch.to_string())
new_patch = []
# Make sure we aren't changing any components/schemas.
for index, p in enumerate(patch):
if not p["path"].startswith("/components"):
new_patch.append(p)
# Rewrite the spec back out. # Rewrite the spec back out.
patch_file = os.path.join(cwd, "kittycad.py.patch.json") patch_file = os.path.join(cwd, "kittycad.py.patch.json")
f = open(patch_file, "w") f = open(patch_file, "w")
f.write(patch.to_string()) f.write(json.dumps(new_patch, indent=2))
f.close() f.close()
# Write all the examples to a file. # Write all the examples to a file.
@ -379,9 +388,6 @@ def generatePath(path: str, name: str, method: str, endpoint: dict, data: dict)
else: else:
success_type = endpoint_refs[0] success_type = endpoint_refs[0]
if fn_name == "get_file_conversion" or fn_name == "create_file_conversion":
fn_name += "_with_base64_helper"
example_imports = ( example_imports = (
""" """
from kittycad.client import ClientFromEnv from kittycad.client import ClientFromEnv
@ -394,15 +400,6 @@ from kittycad.types import Response
""" """
) )
if fn_name.endswith("_with_base64_helper"):
example_imports += (
"""from kittycad.api."""
+ tag_name
+ """ import """
+ fn_name.replace("_with_base64_helper", "")
+ "\n"
)
# Iterate over the parameters. # Iterate over the parameters.
params_str = "" params_str = ""
if "parameters" in endpoint: if "parameters" in endpoint:
@ -472,8 +469,9 @@ from kittycad.types import Response
+ "\n" + "\n"
) )
example_imports = ( example_imports = (
example_imports + "from typing import Union, Any, Optional, List\n" example_imports + "from typing import Union, Any, Optional, List, Tuple\n"
) )
example_variable = "result: " + response_type + " = " example_variable = "result: " + response_type + " = "
example_imports = example_imports + "from kittycad.types import Response\n" example_imports = example_imports + "from kittycad.types import Response\n"
@ -505,6 +503,8 @@ from kittycad.types import Response
and success_type != "None" and success_type != "None"
and success_type != "" and success_type != ""
): ):
example_success_type = success_type
short_sync_example = short_sync_example + ( short_sync_example = short_sync_example + (
""" """
if isinstance(result, Error) or result == None: if isinstance(result, Error) or result == None:
@ -512,7 +512,7 @@ from kittycad.types import Response
raise Exception("Error in response") raise Exception("Error in response")
body: """ body: """
+ success_type + example_success_type
+ """ = result + """ = result
print(body) print(body)
@ -525,7 +525,7 @@ from kittycad.types import Response
# OR if you need more info (e.g. status_code) # OR if you need more info (e.g. status_code)
""" """
+ example_variable_response + example_variable_response
+ fn_name.replace("_with_base64_helper", "") + fn_name
+ """.sync_detailed(client=client,\n""" + """.sync_detailed(client=client,\n"""
+ params_str + params_str
+ """) + """)
@ -551,7 +551,7 @@ async def test_"""
""" """
+ example_variable_response + example_variable_response
+ "await " + "await "
+ fn_name.replace("_with_base64_helper", "") + fn_name
+ """.asyncio_detailed(client=client,\n""" + """.asyncio_detailed(client=client,\n"""
+ params_str + params_str
+ """)""" + """)"""
@ -749,7 +749,7 @@ async def test_"""
"\t\t\t" "\t\t\t"
+ option_name + option_name
+ " = " + " = "
+ ref + snake_to_title(ref)
+ ".from_dict(data)\n" + ".from_dict(data)\n"
) )
parse_response.write( parse_response.write(
@ -947,6 +947,13 @@ def generateTypes(cwd: str, parser: dict):
generateType(path, key, schema, data) generateType(path, key, schema, data)
f.write("from ." + camel_to_snake(key) + " import " + key + "\n") f.write("from ." + camel_to_snake(key) + " import " + key + "\n")
# This is a hot fix for the empty type.
# We likely need a better way to handle this.
f.write("from .empty import Empty\n")
# Add the Base64Data type.
f.write("from .base64data import Base64Data\n")
# Close the file. # Close the file.
f.close() f.close()
@ -978,6 +985,8 @@ def generateType(path: str, name: str, schema: dict, data: dict):
return return
elif "oneOf" in schema: elif "oneOf" in schema:
generateOneOfType(file_path, name, schema, data) generateOneOfType(file_path, name, schema, data)
elif "anyOf" in schema:
generateAnyOfType(file_path, name, schema, data)
else: else:
logging.error("schema: ", [schema]) logging.error("schema: ", [schema])
logging.error("unsupported type: ", name) logging.error("unsupported type: ", name)
@ -1083,6 +1092,123 @@ def generateEnumTypeCode(
return value return value
def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
logging.info("generating type: ", name, " at: ", path)
if isEnumWithDocsOneOf(schema):
additional_docs = []
enum = []
# We want to treat this as an enum with additional docs.
for any_of in schema["anyOf"]:
enum.append(any_of["enum"][0])
if "description" in any_of:
additional_docs.append(any_of["description"])
else:
additional_docs.append("")
# Write the enum.
schema["enum"] = enum
schema["type"] = "string"
generateEnumType(path, name, schema, "string", additional_docs)
# return early.
return
# Open our file.
f = open(path, "w")
# Import the refs if there are any.
all_options = []
for any_of in schema["anyOf"]:
if "allOf" in any_of:
for all_of in any_of["allOf"]:
if "$ref" in all_of:
ref = all_of["$ref"]
ref_name = ref[ref.rfind("/") + 1 :]
f.write(
"from ."
+ camel_to_snake(ref_name)
+ " import "
+ ref_name
+ "\n"
)
all_options.append(ref_name)
if "$ref" in any_of:
ref = any_of["$ref"]
ref_name = ref[ref.rfind("/") + 1 :]
f.write("from ." + camel_to_snake(ref_name) + " import " + ref_name + "\n")
all_options.append(ref_name)
if isNestedObjectOneOf(schema):
# We want to write each of the nested objects.
for any_of in schema["anyOf"]:
# Get the nested object.
if "properties" in any_of:
for prop_name in any_of["properties"]:
nested_object = any_of["properties"][prop_name]
if nested_object == {}:
f.write("from typing import Any\n")
f.write(prop_name + " = Any\n")
f.write("\n")
all_options.append(prop_name)
elif "$ref" in nested_object:
ref = nested_object["$ref"]
ref_name = ref[ref.rfind("/") + 1 :]
f.write(
"from ."
+ camel_to_snake(ref_name)
+ " import "
+ ref_name
+ "\n"
)
f.write("\n")
if prop_name != ref_name:
f.write(prop_name + " = " + ref_name + "\n")
f.write("\n")
all_options.append(prop_name)
else:
object_code = generateObjectTypeCode(
prop_name, nested_object, "object", data, None
)
f.write(object_code)
f.write("\n")
all_options.append(prop_name)
elif "type" in any_of and any_of["type"] == "string":
enum_code = generateEnumTypeCode(
any_of["enum"][0], any_of, "string", []
)
f.write(enum_code)
f.write("\n")
all_options.append(any_of["enum"][0])
# Check if each any_of has the same enum of one.
tag = getTagAnyOf(schema)
if tag is not None:
# Generate each of the options from the tag.
for any_of in schema["anyOf"]:
# Get the value of the tag.
object_name = any_of["properties"][tag]["enum"][0]
object_code = generateObjectTypeCode(
object_name, any_of, "object", data, tag
)
f.write(object_code)
f.write("\n")
all_options.append(object_name)
# Write the sum type.
f.write("from typing import Union\n")
f.write(name + " = Union[")
for num, option in enumerate(all_options, start=0):
if num == 0:
f.write(option)
else:
f.write(", " + option + "")
f.write("]\n")
# Close the file.
f.close()
def generateOneOfType(path: str, name: str, schema: dict, data: dict): def generateOneOfType(path: str, name: str, schema: dict, data: dict):
logging.info("generating type: ", name, " at: ", path) logging.info("generating type: ", name, " at: ", path)
@ -1112,8 +1238,14 @@ def generateOneOfType(path: str, name: str, schema: dict, data: dict):
if "$ref" in one_of: if "$ref" in one_of:
ref = one_of["$ref"] ref = one_of["$ref"]
ref_name = ref[ref.rfind("/") + 1 :] ref_name = ref[ref.rfind("/") + 1 :]
f.write("from ." + camel_to_snake(ref_name) + " import " + ref_name + "\n") f.write(
all_options.append(ref_name) "from ."
+ camel_to_snake(ref_name)
+ " import "
+ snake_to_title(ref_name)
+ "\n"
)
all_options.append(snake_to_title(ref_name))
if isNestedObjectOneOf(schema): if isNestedObjectOneOf(schema):
# We want to write each of the nested objects. # We want to write each of the nested objects.
@ -1173,13 +1305,19 @@ def generateOneOfType(path: str, name: str, schema: dict, data: dict):
all_options.append(object_name) all_options.append(object_name)
# Write the sum type. # Write the sum type.
f.write(name + " = Union[") if name == "SnakeCaseResult":
for num, option in enumerate(all_options, start=0): f.write("from typing import Any\n")
if num == 0: f.write(name + " = Any")
f.write(option) else:
else: f.write("from typing import Union\n")
f.write(", " + option + "") f.write(name + " = Union[")
f.write("]\n")
for num, option in enumerate(all_options, start=0):
if num == 0:
f.write(option)
else:
f.write(", " + option + "")
f.write("]\n")
# Close the file. # Close the file.
f.close() f.close()
@ -1191,8 +1329,11 @@ def generateObjectTypeCode(
f = io.StringIO() f = io.StringIO()
has_date_time = hasDateTime(schema) has_date_time = hasDateTime(schema)
has_base_64 = hasBase64(schema)
if has_date_time: if has_date_time:
f.write("import datetime\n") f.write("import datetime\n")
if has_base_64:
f.write("from ..models.base64data import Base64Data\n")
f.write( f.write(
"from typing import Any, Dict, List, Type, TypeVar, Union, cast, deprecated\n" "from typing import Any, Dict, List, Type, TypeVar, Union, cast, deprecated\n"
) )
@ -1379,6 +1520,22 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
) )
# return early # return early
return return
elif property_schema["format"] == "byte":
f.write("\t\t" + property_name + ": Union[Unset, str] = UNSET\n")
f.write(
"\t\tif not isinstance(self."
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write(
"\t\t\t"
+ clean_parameter_name(property_name)
+ " = self."
+ clean_parameter_name(property_name)
+ ".get_encoded()\n"
)
# return early
return
f.write( f.write(
"\t\t" "\t\t"
@ -1411,6 +1568,79 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
+ clean_parameter_name(property_name) + clean_parameter_name(property_name)
+ "\n" + "\n"
) )
elif "additionalProperties" in property_schema and property_type == "object":
if "$ref" in property_schema["additionalProperties"]:
ref = property_schema["additionalProperties"]["$ref"].replace(
"#/components/schemas/", ""
)
f.write(
"\t\t" + property_name + ": Union[Unset, Dict[str, Any]] = UNSET\n"
)
f.write(
"\t\tif not isinstance(self."
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write("\t\t\tnew_dict: Dict[str, Any] = {}\n")
f.write(
"\t\t\tfor key, value in self."
+ clean_parameter_name(property_name)
+ ".items():\n"
)
f.write("\t\t\t\tnew_dict[key] = value.to_dict()\n")
f.write(
"\t\t\t" + clean_parameter_name(property_name) + " = new_dict\n"
)
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "integer"
):
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ " = self."
+ clean_parameter_name(property_name)
+ "\n"
)
f.write("\n")
elif (
"format" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["format"] == "byte"
):
f.write(
"\t\t" + property_name + ": Union[Unset, Dict[str, str]] = UNSET\n"
)
f.write(
"\t\tif not isinstance(self."
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write("\t\t\tnew_dict: Dict[str, str] = {}\n")
f.write(
"\t\t\tfor key, value in self."
+ clean_parameter_name(property_name)
+ ".items():\n"
)
f.write("\t\t\t\tnew_dict[key] = value.get_encoded()\n")
f.write(
"\t\t\t" + clean_parameter_name(property_name) + " = new_dict\n"
)
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "string"
):
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ " = self."
+ clean_parameter_name(property_name)
+ "\n"
)
f.write("\n")
else:
# Throw an error.
print("property: ", property_schema)
raise Exception("Unknown property type")
elif property_type == "array": elif property_type == "array":
if "items" in property_schema: if "items" in property_schema:
if "$ref" in property_schema["items"]: if "$ref" in property_schema["items"]:
@ -1426,6 +1656,8 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
elif "type" in property_schema["items"]: elif "type" in property_schema["items"]:
if property_schema["items"]["type"] == "string": if property_schema["items"]["type"] == "string":
property_type = "str" property_type = "str"
elif property_schema["items"]["type"] == "integer":
property_type = "int"
elif property_schema["items"]["type"] == "number": elif property_schema["items"]["type"] == "number":
property_type = "float" property_type = "float"
elif property_schema["items"]["type"] == "array": elif property_schema["items"]["type"] == "array":
@ -1441,7 +1673,7 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
logging.error("property: ", property_schema) logging.error("property: ", property_schema)
raise Exception("Unknown property type") raise Exception("Unknown property type")
else: else:
logging.error("property: ", property_schema) print("property: ", property_schema)
raise Exception("Unknown property type") raise Exception("Unknown property type")
else: else:
logging.error("array: ", [property_schema]) logging.error("array: ", [property_schema])
@ -1543,9 +1775,59 @@ def renderTypeInit(f, property_name: str, property_schema: dict, data: dict):
) )
# Return early. # Return early.
return return
elif property_schema["format"] == "byte":
f.write(
"\t" + property_name + ": Union[Unset, Base64Data] = UNSET\n"
)
# Return early.
return
f.write("\t" + property_name + ": Union[Unset, str] = UNSET\n") f.write("\t" + property_name + ": Union[Unset, str] = UNSET\n")
elif "additionalProperties" in property_schema and property_type == "object":
if "$ref" in property_schema["additionalProperties"]:
ref = property_schema["additionalProperties"]["$ref"].replace(
"#/components/schemas/", ""
)
# Make sure we import the model.
f.write(
"\tfrom ..models." + camel_to_snake(ref) + " import " + ref + "\n"
)
f.write(
"\t"
+ property_name
+ ": Union[Unset, Dict[str, "
+ ref
+ "]] = UNSET\n"
)
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "integer"
):
f.write(
"\t" + property_name + ": Union[Unset, Dict[str, int]] = UNSET\n"
)
elif (
"format" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["format"] == "byte"
):
f.write(
"\t"
+ property_name
+ ": Union[Unset, Dict[str, Base64Data]] = UNSET\n"
)
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "string"
):
f.write(
"\t" + property_name + ": Union[Unset, Dict[str, str]] = UNSET\n"
)
else:
# Throw an error.
print("property: ", property_schema)
raise Exception("Unknown property type")
elif property_type == "object": elif property_type == "object":
# TODO: we need to get the name of the object
f.write("\t" + property_name + ": Union[Unset, Any] = UNSET\n") f.write("\t" + property_name + ": Union[Unset, Any] = UNSET\n")
elif property_type == "integer": elif property_type == "integer":
f.write("\t" + property_name + ": Union[Unset, int] = UNSET\n") f.write("\t" + property_name + ": Union[Unset, int] = UNSET\n")
@ -1570,6 +1852,8 @@ def renderTypeInit(f, property_name: str, property_schema: dict, data: dict):
property_type = "str" property_type = "str"
elif property_schema["items"]["type"] == "number": elif property_schema["items"]["type"] == "number":
property_type = "float" property_type = "float"
elif property_schema["items"]["type"] == "integer":
property_type = "int"
elif property_schema["items"]["type"] == "array": elif property_schema["items"]["type"] == "array":
if "items" in property_schema["items"]: if "items" in property_schema["items"]:
if property_schema["items"]["items"]["type"] == "string": if property_schema["items"]["items"]["type"] == "string":
@ -1583,7 +1867,7 @@ def renderTypeInit(f, property_name: str, property_schema: dict, data: dict):
logging.error("property: ", property_schema) logging.error("property: ", property_schema)
raise Exception("Unknown property type") raise Exception("Unknown property type")
else: else:
logging.error("property: ", property_schema) print("property: ", property_schema)
raise Exception("Unknown property type") raise Exception("Unknown property type")
else: else:
logging.error("array: ", [property_schema]) logging.error("array: ", [property_schema])
@ -1600,7 +1884,7 @@ def renderTypeInit(f, property_name: str, property_schema: dict, data: dict):
else: else:
raise Exception("Unknown array type") raise Exception("Unknown array type")
else: else:
logging.error("property type: ", property_type) logging.error("property type: ", property_schema)
raise Exception("unknown type: ", property_type) raise Exception("unknown type: ", property_type)
elif "$ref" in property_schema: elif "$ref" in property_schema:
ref = property_schema["$ref"].replace("#/components/schemas/", "") ref = property_schema["$ref"].replace("#/components/schemas/", "")
@ -1662,6 +1946,38 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
f.write("\n") f.write("\n")
# Return early. # Return early.
return return
elif property_schema["format"] == "byte":
f.write(
"\t\t_"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ ": Union[Unset, Base64Data]\n"
)
f.write(
"\t\tif isinstance(_"
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write(
"\t\t\t" + clean_parameter_name(property_name) + " = UNSET\n"
)
f.write("\t\telse:\n")
f.write(
"\t\t\t"
+ clean_parameter_name(property_name)
+ " = Base64Data(bytes(_"
+ clean_parameter_name(property_name)
+ ", 'utf-8'))\n"
)
f.write("\n")
# Return early.
return
f.write( f.write(
"\t\t" "\t\t"
@ -1698,6 +2014,90 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
+ '", UNSET)\n' + '", UNSET)\n'
) )
f.write("\n") f.write("\n")
elif "additionalProperties" in property_schema and property_type == "object":
if "$ref" in property_schema["additionalProperties"]:
ref = property_schema["additionalProperties"]["$ref"].replace(
"#/components/schemas/", ""
)
f.write(
"\t\t_"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write(
"\t\tif isinstance(_"
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write("\t\t\t" + clean_parameter_name(property_name) + " = UNSET\n")
f.write("\t\telse:\n")
f.write(
"\t\t\tnew_map: Dict[str, "
+ ref
+ "] = {}\n\t\t\tfor k, v in _"
+ clean_parameter_name(property_name)
+ ".items():\n\t\t\t\tnew_map[k] = "
+ ref
+ ".from_dict(v) # type: ignore\n\t\t\t"
+ clean_parameter_name(property_name)
+ " = new_map # type: ignore\n"
)
f.write("\n")
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "integer"
):
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write("\n")
elif (
"format" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["format"] == "byte"
):
f.write(
"\t\t_"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write(
"\t\tif isinstance(_"
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write("\t\t\t" + clean_parameter_name(property_name) + " = UNSET\n")
f.write(
"\t\telse:\n\t\t\tnew_map: Dict[str, Base64Data] = {}\n\t\t\tfor k, v in _"
+ clean_parameter_name(property_name)
+ ".items():\n\t\t\t\tnew_map[k] = Base64Data(bytes(v, 'utf-8'))\n\t\t\t"
+ clean_parameter_name(property_name)
+ " = new_map # type: ignore\n"
)
f.write("\n")
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "string"
):
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write("\n")
else:
# Throw an error.
print("property: ", property_schema)
raise Exception("Unknown property type")
elif property_type == "array": elif property_type == "array":
if "items" in property_schema: if "items" in property_schema:
if "$ref" in property_schema["items"]: if "$ref" in property_schema["items"]:
@ -1715,6 +2115,8 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
property_type = "str" property_type = "str"
elif property_schema["items"]["type"] == "number": elif property_schema["items"]["type"] == "number":
property_type = "float" property_type = "float"
elif property_schema["items"]["type"] == "integer":
property_type = "int"
elif property_schema["items"]["type"] == "array": elif property_schema["items"]["type"] == "array":
if "items" in property_schema["items"]: if "items" in property_schema["items"]:
if property_schema["items"]["items"]["type"] == "string": if property_schema["items"]["items"]["type"] == "string":
@ -1827,6 +2229,27 @@ def hasDateTime(schema: dict) -> bool:
return False return False
def hasBase64(schema: dict) -> bool:
# Generate the type.
if "type" in schema:
type_name = schema["type"]
if type_name == "object":
if "additionalProperties" in schema:
return hasBase64(schema["additionalProperties"])
# Iternate over the properties.
if "properties" in schema:
for property_name in schema["properties"]:
property_schema = schema["properties"][property_name]
has_base64 = hasBase64(property_schema)
if has_base64:
return True
elif type_name == "string" and "format" in schema:
if schema["format"] == "byte":
return True
return False
def getRefs(schema: dict) -> List[str]: def getRefs(schema: dict) -> List[str]:
refs = [] refs = []
if "$ref" in schema: if "$ref" in schema:
@ -1878,13 +2301,13 @@ def getEndpointRefs(endpoint: dict, data: dict) -> List[str]:
ref = json["$ref"].replace("#/components/schemas/", "") ref = json["$ref"].replace("#/components/schemas/", "")
schema = data["components"]["schemas"][ref] schema = data["components"]["schemas"][ref]
if isNestedObjectOneOf(schema) or isEnumWithDocsOneOf(schema): if isNestedObjectOneOf(schema) or isEnumWithDocsOneOf(schema):
if ref not in refs: if snake_to_title(ref) not in refs:
refs.append(ref) refs.append(snake_to_title(ref))
elif isTypedObjectOneOf(schema): elif isTypedObjectOneOf(schema):
for t in schema["oneOf"]: for t in schema["oneOf"]:
ref = getOneOfRefType(t) ref = getOneOfRefType(t)
if ref not in refs: if snake_to_title(ref) not in refs:
refs.append(ref) refs.append(snake_to_title(ref))
else: else:
if ref not in refs: if ref not in refs:
refs.append(ref) refs.append(ref)
@ -1925,8 +2348,8 @@ def getEndpointRefs(endpoint: dict, data: dict) -> List[str]:
json = content[content_type]["schema"] json = content[content_type]["schema"]
if "$ref" in json: if "$ref" in json:
ref = json["$ref"].replace("#/components/schemas/", "") ref = json["$ref"].replace("#/components/schemas/", "")
if ref not in refs: if snake_to_title(ref) not in refs:
refs.append(ref) refs.append(snake_to_title(ref))
return refs return refs
@ -2038,6 +2461,11 @@ def camel_to_screaming_snake(name: str):
) )
# Change `file_conversion` to `FileConversion`
def snake_to_title(name: str):
return name.title().replace("_", "").replace("3D", "3d")
def get_function_parameters( def get_function_parameters(
endpoint: dict, request_body_type: Optional[str] endpoint: dict, request_body_type: Optional[str]
) -> List[str]: ) -> List[str]:
@ -2082,8 +2510,12 @@ def isNestedObjectOneOf(schema: dict) -> bool:
is_nested_object = False is_nested_object = False
for one_of in schema["oneOf"]: for one_of in schema["oneOf"]:
# Check if each are an object with properties. # Check if each are an object w 1 property in it.
if one_of["type"] == "object" and "properties" in one_of: if (
one_of["type"] == "object"
and "properties" in one_of
and len(one_of["properties"]) == 1
):
for prop_name in one_of["properties"]: for prop_name in one_of["properties"]:
nested_object = one_of["properties"][prop_name] nested_object = one_of["properties"][prop_name]
if "type" in nested_object and nested_object["type"] == "object": if "type" in nested_object and nested_object["type"] == "object":
@ -2102,6 +2534,34 @@ def isNestedObjectOneOf(schema: dict) -> bool:
return is_nested_object return is_nested_object
def getTagAnyOf(schema: dict) -> Optional[str]:
tag = None
for any_of in schema["anyOf"]:
has_tag = False
# Check if each are an object w 1 property in it.
if "type" in any_of and any_of["type"] == "object" and "properties" in any_of:
for prop_name in any_of["properties"]:
prop = any_of["properties"][prop_name]
if (
"type" in prop
and prop["type"] == "string"
and "enum" in prop
and len(prop["enum"]) == 1
):
if tag is not None and tag != prop_name:
has_tag = False
break
else:
has_tag = True
tag = prop_name
if has_tag is False:
tag = None
break
return tag
def getTagOneOf(schema: dict) -> Optional[str]: def getTagOneOf(schema: dict) -> Optional[str]:
tag = None tag = None
for one_of in schema["oneOf"]: for one_of in schema["oneOf"]:

View File

@ -5,10 +5,14 @@ set -o pipefail
# Fix for ci. # Fix for ci.
git config --global --add safe.directory /home/user/src git config --global --add safe.directory /home/user/src
git add kittycad/models/base64data.py
git add kittycad/models/empty.py
# Cleanup old stuff. # Cleanup old stuff.
rm -rf kittycad/models rm -rf kittycad/models
rm -rf kittycad/api rm -rf kittycad/api
git checkout kittycad/api/file/*_with_base64_helper.py &>/dev/null git checkout kittycad/models/base64data.py
git checkout kittycad/models/empty.py
# Generate new. # Generate new.
poetry run python generate/generate.py poetry run python generate/generate.py

File diff suppressed because one or more lines are too long

View File

@ -1,60 +0,0 @@
import base64
from typing import Any, Optional, Union
from ...api.file.create_file_conversion import asyncio as fc_asyncio, sync as fc_sync
from ...client import Client
from ...models import Error, FileConversion, FileExportFormat, FileImportFormat
def sync(
src_format: FileImportFormat,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, 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, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "=" * (-len(fc.output) % 4))
# decode the bytes to a string
fc.output = b.decode("utf-8")
return fc
async def asyncio(
src_format: FileImportFormat,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, 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, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "=" * (-len(fc.output) % 4))
# decode the bytes to a string
fc.output = b.decode("utf-8")
return fc

View File

@ -1,49 +0,0 @@
import base64
from typing import Any, Optional, Union
from ...api.api_calls.get_async_operation import asyncio as fc_asyncio, sync as fc_sync
from ...client import Client
from ...models import Error
from ...models.file_conversion import FileConversion
def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, 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, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "=" * (-len(fc.output) % 4))
# decode the bytes to a string
fc.output = b.decode("utf-8")
return fc
async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, 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, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "=" * (-len(fc.output) % 4))
# decode the bytes to a string
fc.output = b.decode("utf-8")
return fc

View File

@ -3,8 +3,28 @@ from typing import Any, Dict, Optional, Union
import httpx import httpx
from ...client import Client from ...client import Client
from ...models.curve_get_control_points import CurveGetControlPoints
from ...models.curve_get_type import CurveGetType
from ...models.empty import Empty
from ...models.entity_get_all_child_uuids import EntityGetAllChildUuids
from ...models.entity_get_child_uuid import EntityGetChildUuid
from ...models.entity_get_num_children import EntityGetNumChildren
from ...models.entity_get_parent_id import EntityGetParentId
from ...models.error import Error from ...models.error import Error
from ...models.export import Export
from ...models.get_entity_type import GetEntityType
from ...models.highlight_set_entity import HighlightSetEntity
from ...models.modeling_cmd_req import ModelingCmdReq from ...models.modeling_cmd_req import ModelingCmdReq
from ...models.mouse_click import MouseClick
from ...models.path_get_info import PathGetInfo
from ...models.select_get import SelectGet
from ...models.select_with_point import SelectWithPoint
from ...models.solid3d_get_all_edge_faces import Solid3dGetAllEdgeFaces
from ...models.solid3d_get_all_opposite_edges import Solid3dGetAllOppositeEdges
from ...models.solid3d_get_next_adjacent_edge import Solid3dGetNextAdjacentEdge
from ...models.solid3d_get_opposite_edge import Solid3dGetOppositeEdge
from ...models.solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
from ...models.take_snapshot import TakeSnapshot
from ...types import Response from ...types import Response
@ -29,10 +49,221 @@ def _get_kwargs(
} }
def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]: def _parse_response(
*, response: httpx.Response
) -> Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]:
if response.status_code == 200: if response.status_code == 200:
response_200 = response.json() data = response.json()
return response_200 try:
if not isinstance(data, dict):
raise TypeError()
option_empty = Empty.from_dict(data)
return option_empty
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_export = Export.from_dict(data)
return option_export
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_select_with_point = SelectWithPoint.from_dict(data)
return option_select_with_point
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_highlight_set_entity = HighlightSetEntity.from_dict(data)
return option_highlight_set_entity
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_entity_get_child_uuid = EntityGetChildUuid.from_dict(data)
return option_entity_get_child_uuid
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_entity_get_num_children = EntityGetNumChildren.from_dict(data)
return option_entity_get_num_children
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_entity_get_parent_id = EntityGetParentId.from_dict(data)
return option_entity_get_parent_id
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_entity_get_all_child_uuids = EntityGetAllChildUuids.from_dict(data)
return option_entity_get_all_child_uuids
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_select_get = SelectGet.from_dict(data)
return option_select_get
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_get_entity_type = GetEntityType.from_dict(data)
return option_get_entity_type
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_all_edge_faces = Solid3dGetAllEdgeFaces.from_dict(data)
return option_solid3d_get_all_edge_faces
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_all_opposite_edges = (
Solid3dGetAllOppositeEdges.from_dict(data)
)
return option_solid3d_get_all_opposite_edges
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_opposite_edge = Solid3dGetOppositeEdge.from_dict(data)
return option_solid3d_get_opposite_edge
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_prev_adjacent_edge = (
Solid3dGetPrevAdjacentEdge.from_dict(data)
)
return option_solid3d_get_prev_adjacent_edge
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_next_adjacent_edge = (
Solid3dGetNextAdjacentEdge.from_dict(data)
)
return option_solid3d_get_next_adjacent_edge
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_mouse_click = MouseClick.from_dict(data)
return option_mouse_click
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_curve_get_type = CurveGetType.from_dict(data)
return option_curve_get_type
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_curve_get_control_points = CurveGetControlPoints.from_dict(data)
return option_curve_get_control_points
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_take_snapshot = TakeSnapshot.from_dict(data)
return option_take_snapshot
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_path_get_info = PathGetInfo.from_dict(data)
return option_path_get_info
except ValueError:
raise
except TypeError:
raise
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error.from_dict(response.json())
return response_4XX return response_4XX
@ -44,7 +275,33 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]
def _build_response( def _build_response(
*, response: httpx.Response *, response: httpx.Response
) -> Response[Optional[Union[dict, Error]]]: ) -> Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
]:
return Response( return Response(
status_code=response.status_code, status_code=response.status_code,
content=response.content, content=response.content,
@ -57,7 +314,33 @@ def sync_detailed(
body: ModelingCmdReq, body: ModelingCmdReq,
*, *,
client: Client, client: Client,
) -> Response[Optional[Union[dict, Error]]]: ) -> Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
body=body, body=body,
client=client, client=client,
@ -75,7 +358,31 @@ def sync(
body: ModelingCmdReq, body: ModelingCmdReq,
*, *,
client: Client, client: Client,
) -> Optional[Union[dict, Error]]: ) -> Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]:
"""Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.""" # noqa: E501 """Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.""" # noqa: E501
return sync_detailed( return sync_detailed(
@ -88,7 +395,33 @@ async def asyncio_detailed(
body: ModelingCmdReq, body: ModelingCmdReq,
*, *,
client: Client, client: Client,
) -> Response[Optional[Union[dict, Error]]]: ) -> Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
body=body, body=body,
client=client, client=client,
@ -104,7 +437,31 @@ async def asyncio(
body: ModelingCmdReq, body: ModelingCmdReq,
*, *,
client: Client, client: Client,
) -> Optional[Union[dict, Error]]: ) -> Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]:
"""Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.""" # noqa: E501 """Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.""" # noqa: E501
return ( return (

View File

@ -14,7 +14,7 @@ def _get_kwargs(
*, *,
client: Client, client: Client,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/modeling/cmd_batch".format( url = "{}/modeling/cmd-batch".format(
client.base_url, client.base_url,
) # noqa: E501 ) # noqa: E501

View File

@ -12,6 +12,7 @@ def _get_kwargs(
unlocked_framerate: bool, unlocked_framerate: bool,
video_res_height: int, video_res_height: int,
video_res_width: int, video_res_width: int,
webrtc: bool,
*, *,
client: Client, client: Client,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
@ -41,6 +42,12 @@ def _get_kwargs(
else: else:
url = url + "?video_res_width=" + str(video_res_width) url = url + "?video_res_width=" + str(video_res_width)
if webrtc is not None:
if "?" in url:
url = url + "&webrtc=" + str(webrtc)
else:
url = url + "?webrtc=" + str(webrtc)
headers: Dict[str, Any] = client.get_headers() headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies() cookies: Dict[str, Any] = client.get_cookies()
@ -57,6 +64,7 @@ def sync(
unlocked_framerate: bool, unlocked_framerate: bool,
video_res_height: int, video_res_height: int,
video_res_width: int, video_res_width: int,
webrtc: bool,
*, *,
client: Client, client: Client,
) -> ClientConnection: ) -> ClientConnection:
@ -67,6 +75,7 @@ def sync(
unlocked_framerate=unlocked_framerate, unlocked_framerate=unlocked_framerate,
video_res_height=video_res_height, video_res_height=video_res_height,
video_res_width=video_res_width, video_res_width=video_res_width,
webrtc=webrtc,
client=client, client=client,
) )
@ -85,6 +94,7 @@ async def asyncio(
unlocked_framerate: bool, unlocked_framerate: bool,
video_res_height: int, video_res_height: int,
video_res_width: int, video_res_width: int,
webrtc: bool,
*, *,
client: Client, client: Client,
) -> WebSocketClientProtocol: ) -> WebSocketClientProtocol:
@ -95,6 +105,7 @@ async def asyncio(
unlocked_framerate=unlocked_framerate, unlocked_framerate=unlocked_framerate,
video_res_height=video_res_height, video_res_height=video_res_height,
video_res_width=video_res_width, video_res_width=video_res_width,
webrtc=webrtc,
client=client, client=client,
) )

View File

@ -1,20 +1,17 @@
import os import os
from typing import Union from typing import Dict, Optional, Union
import pytest import pytest
from .api.api_tokens import list_api_tokens_for_user from .api.api_tokens import list_api_tokens_for_user
from .api.file import ( from .api.file import create_file_conversion, create_file_mass, create_file_volume
create_file_conversion_with_base64_helper,
create_file_mass,
create_file_volume,
)
from .api.meta import ping from .api.meta import ping
from .api.users import get_user_self, list_users_extended from .api.users import get_user_self, list_users_extended
from .client import ClientFromEnv from .client import ClientFromEnv
from .models import ( from .models import (
ApiCallStatus, ApiCallStatus,
ApiTokenResultsPage, ApiTokenResultsPage,
Base64Data,
CreatedAtSortMode, CreatedAtSortMode,
Error, Error,
ExtendedUserResultsPage, ExtendedUserResultsPage,
@ -29,6 +26,7 @@ from .models import (
UnitVolume, UnitVolume,
User, User,
) )
from .types import Unset
def test_get_session(): def test_get_session():
@ -106,9 +104,7 @@ def test_file_convert_stl():
file.close() file.close()
# Get the fc. # Get the fc.
result: Union[ result: Optional[Union[FileConversion, Error]] = create_file_conversion.sync(
FileConversion, Error, None
] = create_file_conversion_with_base64_helper.sync(
client=client, client=client,
body=content, body=content,
src_format=FileImportFormat.STL, src_format=FileImportFormat.STL,
@ -122,11 +118,17 @@ def test_file_convert_stl():
print(f"FileConversion: {fc}") print(f"FileConversion: {fc}")
assert fc.id is not None assert fc.id is not None
assert fc.status == ApiCallStatus.COMPLETED assert fc.status == ApiCallStatus.COMPLETED
print(f"FileConversion: {fc}") print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset)
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty.
for key, value in outputs.items():
assert len(value.get_decoded()) > 0
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_file_convert_stl_async(): async def test_file_convert_stl_async():
@ -139,9 +141,9 @@ async def test_file_convert_stl_async():
file.close() file.close()
# Get the fc. # Get the fc.
result: Union[ result: Optional[
FileConversion, Error, None Union[FileConversion, Error]
] = await create_file_conversion_with_base64_helper.asyncio( ] = await create_file_conversion.asyncio(
client=client, client=client,
body=content, body=content,
src_format=FileImportFormat.STL, src_format=FileImportFormat.STL,
@ -155,9 +157,56 @@ async def test_file_convert_stl_async():
print(f"FileConversion: {fc}") print(f"FileConversion: {fc}")
assert fc.id is not None assert fc.id is not None
assert fc.status == ApiCallStatus.COMPLETED
print(f"FileConversion: {fc}") print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset)
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty.
for key, value in outputs.items():
assert len(value.get_decoded()) > 0
@pytest.mark.asyncio
async def test_file_convert_obj_async():
# Create our client.
client = ClientFromEnv()
dir_path = os.path.dirname(os.path.realpath(__file__))
file = open(os.path.join(dir_path, "../assets/ORIGINALVOXEL-3.obj"), "rb")
content = file.read()
file.close()
# Get the fc.
result: Optional[
Union[FileConversion, Error]
] = await create_file_conversion.asyncio(
client=client,
body=content,
src_format=FileImportFormat.OBJ,
output_format=FileExportFormat.STL,
)
assert isinstance(result, FileConversion)
fc: FileConversion = result
print(f"FileConversion: {fc}")
assert fc.id is not None
assert fc.status == ApiCallStatus.COMPLETED
print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset)
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty.
for key, value in outputs.items():
assert len(value.get_decoded()) > 0
def test_file_mass(): def test_file_mass():
# Create our client. # Create our client.

View File

@ -28,7 +28,6 @@ from kittycad.api.executor import create_executor_term, create_file_execution
from kittycad.api.file import ( from kittycad.api.file import (
create_file_center_of_mass, create_file_center_of_mass,
create_file_conversion, create_file_conversion,
create_file_conversion_with_base64_helper,
create_file_density, create_file_density,
create_file_mass, create_file_mass,
create_file_surface_area, create_file_surface_area,
@ -94,9 +93,17 @@ from kittycad.models import (
AppClientInfo, AppClientInfo,
AsyncApiCallResultsPage, AsyncApiCallResultsPage,
CodeOutput, CodeOutput,
CurveGetControlPoints,
CurveGetType,
Customer, Customer,
CustomerBalance, CustomerBalance,
Empty,
EntityGetAllChildUuids,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
Error, Error,
Export,
ExtendedUser, ExtendedUser,
ExtendedUserResultsPage, ExtendedUserResultsPage,
FileCenterOfMass, FileCenterOfMass,
@ -105,15 +112,27 @@ from kittycad.models import (
FileMass, FileMass,
FileSurfaceArea, FileSurfaceArea,
FileVolume, FileVolume,
GetEntityType,
HighlightSetEntity,
Invoice, Invoice,
Mesh, Mesh,
Metadata, Metadata,
ModelingOutcomes, ModelingOutcomes,
MouseClick,
Onboarding, Onboarding,
PathGetInfo,
PaymentIntent, PaymentIntent,
PaymentMethod, PaymentMethod,
Pong, Pong,
SelectGet,
SelectWithPoint,
Session, Session,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetNextAdjacentEdge,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
TakeSnapshot,
UnitAngleConversion, UnitAngleConversion,
UnitAreaConversion, UnitAreaConversion,
UnitCurrentConversion, UnitCurrentConversion,
@ -289,7 +308,7 @@ def test_create_image_to_3d():
result: Optional[Union[Mesh, Error]] = create_image_to_3d.sync( result: Optional[Union[Mesh, Error]] = create_image_to_3d.sync(
client=client, client=client,
input_format=ImageType.PNG, input_format=ImageType.PNG,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -304,7 +323,7 @@ def test_create_image_to_3d():
response: Response[Optional[Union[Mesh, Error]]] = create_image_to_3d.sync_detailed( response: Response[Optional[Union[Mesh, Error]]] = create_image_to_3d.sync_detailed(
client=client, client=client,
input_format=ImageType.PNG, input_format=ImageType.PNG,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -319,7 +338,7 @@ async def test_create_image_to_3d_async():
result: Optional[Union[Mesh, Error]] = await create_image_to_3d.asyncio( result: Optional[Union[Mesh, Error]] = await create_image_to_3d.asyncio(
client=client, client=client,
input_format=ImageType.PNG, input_format=ImageType.PNG,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -329,7 +348,7 @@ async def test_create_image_to_3d_async():
] = await create_image_to_3d.asyncio_detailed( ] = await create_image_to_3d.asyncio_detailed(
client=client, client=client,
input_format=ImageType.PNG, input_format=ImageType.PNG,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -341,7 +360,7 @@ def test_create_text_to_3d():
result: Optional[Union[Mesh, Error]] = create_text_to_3d.sync( result: Optional[Union[Mesh, Error]] = create_text_to_3d.sync(
client=client, client=client,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
prompt="<string>", prompt="<string>",
) )
@ -355,7 +374,7 @@ def test_create_text_to_3d():
# OR if you need more info (e.g. status_code) # OR if you need more info (e.g. status_code)
response: Response[Optional[Union[Mesh, Error]]] = create_text_to_3d.sync_detailed( response: Response[Optional[Union[Mesh, Error]]] = create_text_to_3d.sync_detailed(
client=client, client=client,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
prompt="<string>", prompt="<string>",
) )
@ -369,7 +388,7 @@ async def test_create_text_to_3d_async():
result: Optional[Union[Mesh, Error]] = await create_text_to_3d.asyncio( result: Optional[Union[Mesh, Error]] = await create_text_to_3d.asyncio(
client=client, client=client,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
prompt="<string>", prompt="<string>",
) )
@ -378,7 +397,7 @@ async def test_create_text_to_3d_async():
Optional[Union[Mesh, Error]] Optional[Union[Mesh, Error]]
] = await create_text_to_3d.asyncio_detailed( ] = await create_text_to_3d.asyncio_detailed(
client=client, client=client,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
prompt="<string>", prompt="<string>",
) )
@ -932,7 +951,7 @@ def test_create_file_center_of_mass():
result: Optional[Union[FileCenterOfMass, Error]] = create_file_center_of_mass.sync( result: Optional[Union[FileCenterOfMass, Error]] = create_file_center_of_mass.sync(
client=client, client=client,
output_unit=UnitLength.CM, output_unit=UnitLength.CM,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -949,7 +968,7 @@ def test_create_file_center_of_mass():
] = create_file_center_of_mass.sync_detailed( ] = create_file_center_of_mass.sync_detailed(
client=client, client=client,
output_unit=UnitLength.CM, output_unit=UnitLength.CM,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -966,7 +985,7 @@ async def test_create_file_center_of_mass_async():
] = await create_file_center_of_mass.asyncio( ] = await create_file_center_of_mass.asyncio(
client=client, client=client,
output_unit=UnitLength.CM, output_unit=UnitLength.CM,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -976,22 +995,20 @@ async def test_create_file_center_of_mass_async():
] = await create_file_center_of_mass.asyncio_detailed( ] = await create_file_center_of_mass.asyncio_detailed(
client=client, client=client,
output_unit=UnitLength.CM, output_unit=UnitLength.CM,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@pytest.mark.skip @pytest.mark.skip
def test_create_file_conversion_with_base64_helper(): def test_create_file_conversion():
# Create our client. # Create our client.
client = ClientFromEnv() client = ClientFromEnv()
result: Optional[ result: Optional[Union[FileConversion, Error]] = create_file_conversion.sync(
Union[FileConversion, Error]
] = create_file_conversion_with_base64_helper.sync(
client=client, client=client,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1007,8 +1024,8 @@ def test_create_file_conversion_with_base64_helper():
Optional[Union[FileConversion, Error]] Optional[Union[FileConversion, Error]]
] = create_file_conversion.sync_detailed( ] = create_file_conversion.sync_detailed(
client=client, client=client,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1016,16 +1033,16 @@ def test_create_file_conversion_with_base64_helper():
# OR run async # OR run async
@pytest.mark.asyncio @pytest.mark.asyncio
@pytest.mark.skip @pytest.mark.skip
async def test_create_file_conversion_with_base64_helper_async(): async def test_create_file_conversion_async():
# Create our client. # Create our client.
client = ClientFromEnv() client = ClientFromEnv()
result: Optional[ result: Optional[
Union[FileConversion, Error] Union[FileConversion, Error]
] = await create_file_conversion_with_base64_helper.asyncio( ] = await create_file_conversion.asyncio(
client=client, client=client,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1034,8 +1051,8 @@ async def test_create_file_conversion_with_base64_helper_async():
Optional[Union[FileConversion, Error]] Optional[Union[FileConversion, Error]]
] = await create_file_conversion.asyncio_detailed( ] = await create_file_conversion.asyncio_detailed(
client=client, client=client,
output_format=FileExportFormat.GLTF, output_format=FileExportFormat.FBX,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1050,7 +1067,7 @@ def test_create_file_density():
material_mass=3.14, material_mass=3.14,
material_mass_unit=UnitMass.G, material_mass_unit=UnitMass.G,
output_unit=UnitDensity.LB_FT3, output_unit=UnitDensity.LB_FT3,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1069,7 +1086,7 @@ def test_create_file_density():
material_mass=3.14, material_mass=3.14,
material_mass_unit=UnitMass.G, material_mass_unit=UnitMass.G,
output_unit=UnitDensity.LB_FT3, output_unit=UnitDensity.LB_FT3,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1086,7 +1103,7 @@ async def test_create_file_density_async():
material_mass=3.14, material_mass=3.14,
material_mass_unit=UnitMass.G, material_mass_unit=UnitMass.G,
output_unit=UnitDensity.LB_FT3, output_unit=UnitDensity.LB_FT3,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1098,7 +1115,7 @@ async def test_create_file_density_async():
material_mass=3.14, material_mass=3.14,
material_mass_unit=UnitMass.G, material_mass_unit=UnitMass.G,
output_unit=UnitDensity.LB_FT3, output_unit=UnitDensity.LB_FT3,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1168,7 +1185,7 @@ def test_create_file_mass():
material_density=3.14, material_density=3.14,
material_density_unit=UnitDensity.LB_FT3, material_density_unit=UnitDensity.LB_FT3,
output_unit=UnitMass.G, output_unit=UnitMass.G,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1187,7 +1204,7 @@ def test_create_file_mass():
material_density=3.14, material_density=3.14,
material_density_unit=UnitDensity.LB_FT3, material_density_unit=UnitDensity.LB_FT3,
output_unit=UnitMass.G, output_unit=UnitMass.G,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1204,7 +1221,7 @@ async def test_create_file_mass_async():
material_density=3.14, material_density=3.14,
material_density_unit=UnitDensity.LB_FT3, material_density_unit=UnitDensity.LB_FT3,
output_unit=UnitMass.G, output_unit=UnitMass.G,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1216,7 +1233,7 @@ async def test_create_file_mass_async():
material_density=3.14, material_density=3.14,
material_density_unit=UnitDensity.LB_FT3, material_density_unit=UnitDensity.LB_FT3,
output_unit=UnitMass.G, output_unit=UnitMass.G,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1229,7 +1246,7 @@ def test_create_file_surface_area():
result: Optional[Union[FileSurfaceArea, Error]] = create_file_surface_area.sync( result: Optional[Union[FileSurfaceArea, Error]] = create_file_surface_area.sync(
client=client, client=client,
output_unit=UnitArea.CM2, output_unit=UnitArea.CM2,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1246,7 +1263,7 @@ def test_create_file_surface_area():
] = create_file_surface_area.sync_detailed( ] = create_file_surface_area.sync_detailed(
client=client, client=client,
output_unit=UnitArea.CM2, output_unit=UnitArea.CM2,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1263,7 +1280,7 @@ async def test_create_file_surface_area_async():
] = await create_file_surface_area.asyncio( ] = await create_file_surface_area.asyncio(
client=client, client=client,
output_unit=UnitArea.CM2, output_unit=UnitArea.CM2,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1273,7 +1290,7 @@ async def test_create_file_surface_area_async():
] = await create_file_surface_area.asyncio_detailed( ] = await create_file_surface_area.asyncio_detailed(
client=client, client=client,
output_unit=UnitArea.CM2, output_unit=UnitArea.CM2,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1286,7 +1303,7 @@ def test_create_file_volume():
result: Optional[Union[FileVolume, Error]] = create_file_volume.sync( result: Optional[Union[FileVolume, Error]] = create_file_volume.sync(
client=client, client=client,
output_unit=UnitVolume.CM3, output_unit=UnitVolume.CM3,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1303,7 +1320,7 @@ def test_create_file_volume():
] = create_file_volume.sync_detailed( ] = create_file_volume.sync_detailed(
client=client, client=client,
output_unit=UnitVolume.CM3, output_unit=UnitVolume.CM3,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1318,7 +1335,7 @@ async def test_create_file_volume_async():
result: Optional[Union[FileVolume, Error]] = await create_file_volume.asyncio( result: Optional[Union[FileVolume, Error]] = await create_file_volume.asyncio(
client=client, client=client,
output_unit=UnitVolume.CM3, output_unit=UnitVolume.CM3,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1328,7 +1345,7 @@ async def test_create_file_volume_async():
] = await create_file_volume.asyncio_detailed( ] = await create_file_volume.asyncio_detailed(
client=client, client=client,
output_unit=UnitVolume.CM3, output_unit=UnitVolume.CM3,
src_format=FileImportFormat.GLTF, src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"), body=bytes("some bytes", "utf-8"),
) )
@ -1377,7 +1394,31 @@ def test_cmd():
# Create our client. # Create our client.
client = ClientFromEnv() client = ClientFromEnv()
cmd.sync( result: Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
] = cmd.sync(
client=client, client=client,
body=ModelingCmdReq( body=ModelingCmdReq(
cmd=move_path_pen( cmd=move_path_pen(
@ -1392,8 +1433,62 @@ def test_cmd():
), ),
) )
if isinstance(result, Error) or result is None:
print(result)
raise Exception("Error in response")
body: Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
] = result
print(body)
# OR if you need more info (e.g. status_code) # OR if you need more info (e.g. status_code)
cmd.sync_detailed( response: Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
] = cmd.sync_detailed(
client=client, client=client,
body=ModelingCmdReq( body=ModelingCmdReq(
cmd=move_path_pen( cmd=move_path_pen(
@ -1416,7 +1511,31 @@ async def test_cmd_async():
# Create our client. # Create our client.
client = ClientFromEnv() client = ClientFromEnv()
await cmd.asyncio( result: Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
] = await cmd.asyncio(
client=client, client=client,
body=ModelingCmdReq( body=ModelingCmdReq(
cmd=move_path_pen( cmd=move_path_pen(
@ -1432,7 +1551,33 @@ async def test_cmd_async():
) )
# OR run async with more info # OR run async with more info
await cmd.asyncio_detailed( response: Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
] = await cmd.asyncio_detailed(
client=client, client=client,
body=ModelingCmdReq( body=ModelingCmdReq(
cmd=move_path_pen( cmd=move_path_pen(
@ -3798,6 +3943,7 @@ def test_modeling_commands_ws():
unlocked_framerate=False, unlocked_framerate=False,
video_res_height=10, video_res_height=10,
video_res_width=10, video_res_width=10,
webrtc=False,
) )
# Send a message. # Send a message.
@ -3822,6 +3968,7 @@ async def test_modeling_commands_ws_async():
unlocked_framerate=False, unlocked_framerate=False,
video_res_height=10, video_res_height=10,
video_res_width=10, video_res_width=10,
webrtc=False,
) )
# Send a message. # Send a message.

View File

@ -19,6 +19,7 @@ from .api_call_query_group_by import ApiCallQueryGroupBy
from .api_call_status import ApiCallStatus from .api_call_status import ApiCallStatus
from .api_call_with_price import ApiCallWithPrice from .api_call_with_price import ApiCallWithPrice
from .api_call_with_price_results_page import ApiCallWithPriceResultsPage from .api_call_with_price_results_page import ApiCallWithPriceResultsPage
from .api_error import ApiError
from .api_token import ApiToken from .api_token import ApiToken
from .api_token_results_page import ApiTokenResultsPage from .api_token_results_page import ApiTokenResultsPage
from .app_client_info import AppClientInfo from .app_client_info import AppClientInfo
@ -28,6 +29,7 @@ from .async_api_call_results_page import AsyncApiCallResultsPage
from .async_api_call_type import AsyncApiCallType from .async_api_call_type import AsyncApiCallType
from .axis import Axis from .axis import Axis
from .axis_direction_pair import AxisDirectionPair from .axis_direction_pair import AxisDirectionPair
from .base64data import Base64Data
from .billing_info import BillingInfo from .billing_info import BillingInfo
from .cache_metadata import CacheMetadata from .cache_metadata import CacheMetadata
from .camera_drag_interaction_type import CameraDragInteractionType from .camera_drag_interaction_type import CameraDragInteractionType
@ -42,6 +44,9 @@ from .country_code import CountryCode
from .coupon import Coupon from .coupon import Coupon
from .created_at_sort_mode import CreatedAtSortMode from .created_at_sort_mode import CreatedAtSortMode
from .currency import Currency from .currency import Currency
from .curve_get_control_points import CurveGetControlPoints
from .curve_get_type import CurveGetType
from .curve_type import CurveType
from .customer import Customer from .customer import Customer
from .customer_balance import CustomerBalance from .customer_balance import CustomerBalance
from .device_access_token_request_form import DeviceAccessTokenRequestForm from .device_access_token_request_form import DeviceAccessTokenRequestForm
@ -51,14 +56,23 @@ from .direction import Direction
from .discount import Discount from .discount import Discount
from .docker_system_info import DockerSystemInfo from .docker_system_info import DockerSystemInfo
from .email_authentication_form import EmailAuthenticationForm from .email_authentication_form import EmailAuthenticationForm
from .empty import Empty
from .engine_metadata import EngineMetadata from .engine_metadata import EngineMetadata
from .entity_get_all_child_uuids import EntityGetAllChildUuids
from .entity_get_child_uuid import EntityGetChildUuid
from .entity_get_num_children import EntityGetNumChildren
from .entity_get_parent_id import EntityGetParentId
from .entity_type import EntityType from .entity_type import EntityType
from .environment import Environment from .environment import Environment
from .error import Error from .error import Error
from .error_code import ErrorCode
from .executor_metadata import ExecutorMetadata from .executor_metadata import ExecutorMetadata
from .export import Export
from .export_file import ExportFile from .export_file import ExportFile
from .extended_user import ExtendedUser from .extended_user import ExtendedUser
from .extended_user_results_page import ExtendedUserResultsPage from .extended_user_results_page import ExtendedUserResultsPage
from .failure_web_socket_response import FailureWebSocketResponse
from .fbx_storage import FbxStorage
from .file_center_of_mass import FileCenterOfMass from .file_center_of_mass import FileCenterOfMass
from .file_conversion import FileConversion from .file_conversion import FileConversion
from .file_density import FileDensity from .file_density import FileDensity
@ -69,6 +83,12 @@ from .file_surface_area import FileSurfaceArea
from .file_system_metadata import FileSystemMetadata from .file_system_metadata import FileSystemMetadata
from .file_volume import FileVolume from .file_volume import FileVolume
from .gateway import Gateway from .gateway import Gateway
from .get_entity_type import GetEntityType
from .gltf_presentation import GltfPresentation
from .gltf_storage import GltfStorage
from .highlight_set_entity import HighlightSetEntity
from .ice_server import IceServer
from .image_format import ImageFormat
from .image_type import ImageType from .image_type import ImageType
from .index_info import IndexInfo from .index_info import IndexInfo
from .input_format import InputFormat from .input_format import InputFormat
@ -91,33 +111,53 @@ from .modeling_cmd_req_batch import ModelingCmdReqBatch
from .modeling_error import ModelingError from .modeling_error import ModelingError
from .modeling_outcome import ModelingOutcome from .modeling_outcome import ModelingOutcome
from .modeling_outcomes import ModelingOutcomes from .modeling_outcomes import ModelingOutcomes
from .mouse_click import MouseClick
from .new_address import NewAddress from .new_address import NewAddress
from .o_auth2_client_info import OAuth2ClientInfo from .o_auth2_client_info import OAuth2ClientInfo
from .o_auth2_grant_type import OAuth2GrantType from .o_auth2_grant_type import OAuth2GrantType
from .ok_modeling_cmd_response import OkModelingCmdResponse from .ok_modeling_cmd_response import OkModelingCmdResponse
from .ok_web_socket_response_data import OkWebSocketResponseData
from .onboarding import Onboarding from .onboarding import Onboarding
from .output_file import OutputFile from .output_file import OutputFile
from .output_format import OutputFormat from .output_format import OutputFormat
from .path_command import PathCommand
from .path_get_info import PathGetInfo
from .path_segment import PathSegment from .path_segment import PathSegment
from .path_segment_info import PathSegmentInfo
from .payment_intent import PaymentIntent from .payment_intent import PaymentIntent
from .payment_method import PaymentMethod from .payment_method import PaymentMethod
from .payment_method_card_checks import PaymentMethodCardChecks from .payment_method_card_checks import PaymentMethodCardChecks
from .payment_method_type import PaymentMethodType from .payment_method_type import PaymentMethodType
from .plugins_info import PluginsInfo from .plugins_info import PluginsInfo
from .ply_storage import PlyStorage
from .point2d import Point2d from .point2d import Point2d
from .point3d import Point3d from .point3d import Point3d
from .point_e_metadata import PointEMetadata from .point_e_metadata import PointEMetadata
from .pong import Pong from .pong import Pong
from .raw_file import RawFile
from .registry_service_config import RegistryServiceConfig from .registry_service_config import RegistryServiceConfig
from .rtc_ice_candidate_init import RtcIceCandidateInit
from .rtc_sdp_type import RtcSdpType
from .rtc_session_description import RtcSessionDescription
from .runtime import Runtime from .runtime import Runtime
from .scene_selection_type import SceneSelectionType from .scene_selection_type import SceneSelectionType
from .scene_tool_type import SceneToolType
from .select_get import SelectGet
from .select_with_point import SelectWithPoint
from .session import Session from .session import Session
from .storage import Storage from .solid3d_get_all_edge_faces import Solid3dGetAllEdgeFaces
from .solid3d_get_all_opposite_edges import Solid3dGetAllOppositeEdges
from .solid3d_get_next_adjacent_edge import Solid3dGetNextAdjacentEdge
from .solid3d_get_opposite_edge import Solid3dGetOppositeEdge
from .solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
from .stl_storage import StlStorage
from .success_web_socket_response import SuccessWebSocketResponse
from .system import System from .system import System
from .system_info_cgroup_driver_enum import SystemInfoCgroupDriverEnum from .system_info_cgroup_driver_enum import SystemInfoCgroupDriverEnum
from .system_info_cgroup_version_enum import SystemInfoCgroupVersionEnum from .system_info_cgroup_version_enum import SystemInfoCgroupVersionEnum
from .system_info_default_address_pools import SystemInfoDefaultAddressPools from .system_info_default_address_pools import SystemInfoDefaultAddressPools
from .system_info_isolation_enum import SystemInfoIsolationEnum from .system_info_isolation_enum import SystemInfoIsolationEnum
from .take_snapshot import TakeSnapshot
from .unit_angle import UnitAngle from .unit_angle import UnitAngle
from .unit_angle_conversion import UnitAngleConversion from .unit_angle_conversion import UnitAngleConversion
from .unit_area import UnitArea from .unit_area import UnitArea
@ -150,3 +190,5 @@ from .user import User
from .user_results_page import UserResultsPage from .user_results_page import UserResultsPage
from .uuid import Uuid from .uuid import Uuid
from .verification_token import VerificationToken from .verification_token import VerificationToken
from .web_socket_request import WebSocketRequest
from .web_socket_response import WebSocketResponse

View File

@ -5,15 +5,15 @@ class ApiCallStatus(str, Enum):
"""The status of an async API call.""" # noqa: E501 """The status of an async API call.""" # noqa: E501
"""# The async API call is queued. """ # noqa: E501 """# The async API call is queued. """ # noqa: E501
QUEUED = "Queued" QUEUED = "queued"
"""# The async API call was uploaded to be converted. """ # noqa: E501 """# The async API call was uploaded to be converted. """ # noqa: E501
UPLOADED = "Uploaded" UPLOADED = "uploaded"
"""# The async API call is in progress. """ # noqa: E501 """# The async API call is in progress. """ # noqa: E501
IN_PROGRESS = "In Progress" IN_PROGRESS = "in_progress"
"""# The async API call has completed. """ # noqa: E501 """# The async API call has completed. """ # noqa: E501
COMPLETED = "Completed" COMPLETED = "completed"
"""# The async API call has failed. """ # noqa: E501 """# The async API call has failed. """ # noqa: E501
FAILED = "Failed" FAILED = "failed"
def __str__(self) -> str: def __str__(self) -> str:
return str(self.value) return str(self.value)

View File

@ -0,0 +1,69 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.error_code import ErrorCode
from ..types import UNSET, Unset
HX = TypeVar("HX", bound="ApiError")
@attr.s(auto_attribs=True)
class ApiError:
"""An error.""" # noqa: E501
error_code: Union[Unset, ErrorCode] = UNSET
message: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.error_code, Unset):
error_code = self.error_code
message = self.message
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if error_code is not UNSET:
field_dict["error_code"] = error_code
if message is not UNSET:
field_dict["message"] = message
return field_dict
@classmethod
def from_dict(cls: Type[HX], src_dict: Dict[str, Any]) -> HX:
d = src_dict.copy()
_error_code = d.pop("error_code", UNSET)
error_code: Union[Unset, ErrorCode]
if isinstance(_error_code, Unset):
error_code = UNSET
else:
error_code = _error_code # type: ignore[arg-type]
message = d.pop("message", UNSET)
api_error = cls(
error_code=error_code,
message=message,
)
api_error.additional_properties = d
return api_error
@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

@ -7,7 +7,7 @@ from dateutil.parser import isoparse
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
HX = TypeVar("HX", bound="ApiToken") LB = TypeVar("LB", bound="ApiToken")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -56,7 +56,7 @@ class ApiToken:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[HX], src_dict: Dict[str, Any]) -> HX: def from_dict(cls: Type[LB], src_dict: Dict[str, Any]) -> LB:
d = src_dict.copy() d = src_dict.copy()
_created_at = d.pop("created_at", UNSET) _created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime] created_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
LB = TypeVar("LB", bound="ApiTokenResultsPage") NE = TypeVar("NE", bound="ApiTokenResultsPage")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class ApiTokenResultsPage:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[LB], src_dict: Dict[str, Any]) -> LB: def from_dict(cls: Type[NE], src_dict: Dict[str, Any]) -> NE:
d = src_dict.copy() d = src_dict.copy()
from ..models.api_token import ApiToken from ..models.api_token import ApiToken

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
NE = TypeVar("NE", bound="AppClientInfo") TL = TypeVar("TL", bound="AppClientInfo")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -27,7 +27,7 @@ class AppClientInfo:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[NE], src_dict: Dict[str, Any]) -> NE: def from_dict(cls: Type[TL], src_dict: Dict[str, Any]) -> TL:
d = src_dict.copy() d = src_dict.copy()
url = d.pop("url", UNSET) url = d.pop("url", UNSET)

View File

@ -9,7 +9,7 @@ from ..models.async_api_call_type import AsyncApiCallType
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
TL = TypeVar("TL", bound="AsyncApiCall") MN = TypeVar("MN", bound="AsyncApiCall")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -86,7 +86,7 @@ class AsyncApiCall:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[TL], src_dict: Dict[str, Any]) -> TL: def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]

View File

@ -5,6 +5,7 @@ import attr
from dateutil.parser import isoparse from dateutil.parser import isoparse
from ..models.api_call_status import ApiCallStatus from ..models.api_call_status import ApiCallStatus
from ..models.base64data import Base64Data
from ..models.file_export_format import FileExportFormat from ..models.file_export_format import FileExportFormat
from ..models.file_import_format import FileImportFormat from ..models.file_import_format import FileImportFormat
from ..models.input_format import InputFormat from ..models.input_format import InputFormat
@ -18,26 +19,25 @@ from ..models.unit_volume import UnitVolume
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
MN = TypeVar("MN", bound="FileConversion") JV = TypeVar("JV", bound="file_conversion")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
class FileConversion: class file_conversion:
"""A file conversion.""" # noqa: E501 """A file conversion.""" # noqa: E501
completed_at: Union[Unset, datetime.datetime] = UNSET completed_at: Union[Unset, datetime.datetime] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET error: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET id: Union[Unset, str] = UNSET
output: Union[Unset, str] = UNSET
output_format: Union[Unset, FileExportFormat] = UNSET output_format: Union[Unset, FileExportFormat] = UNSET
output_format_options: Union[Unset, OutputFormat] = UNSET output_format_options: Union[Unset, OutputFormat] = UNSET
outputs: Union[Unset, Any] = UNSET outputs: Union[Unset, Dict[str, Base64Data]] = UNSET
src_format: Union[Unset, FileImportFormat] = UNSET src_format: Union[Unset, FileImportFormat] = UNSET
src_format_options: Union[Unset, InputFormat] = UNSET src_format_options: Union[Unset, InputFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET status: Union[Unset, ApiCallStatus] = UNSET
type: str = "FileConversion" type: str = "file_conversion"
updated_at: Union[Unset, datetime.datetime] = UNSET updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET user_id: Union[Unset, str] = UNSET
@ -52,12 +52,16 @@ class FileConversion:
created_at = self.created_at.isoformat() created_at = self.created_at.isoformat()
error = self.error error = self.error
id = self.id id = self.id
output = self.output
if not isinstance(self.output_format, Unset): if not isinstance(self.output_format, Unset):
output_format = self.output_format output_format = self.output_format
if not isinstance(self.output_format_options, Unset): if not isinstance(self.output_format_options, Unset):
output_format_options = self.output_format_options output_format_options = self.output_format_options
outputs = self.outputs outputs: Union[Unset, Dict[str, str]] = UNSET
if not isinstance(self.outputs, Unset):
new_dict: Dict[str, str] = {}
for key, value in self.outputs.items():
new_dict[key] = value.get_encoded()
outputs = new_dict
if not isinstance(self.src_format, Unset): if not isinstance(self.src_format, Unset):
src_format = self.src_format src_format = self.src_format
if not isinstance(self.src_format_options, Unset): if not isinstance(self.src_format_options, Unset):
@ -84,8 +88,6 @@ class FileConversion:
field_dict["error"] = error field_dict["error"] = error
if id is not UNSET: if id is not UNSET:
field_dict["id"] = id field_dict["id"] = id
if output is not UNSET:
field_dict["output"] = output
if output_format is not UNSET: if output_format is not UNSET:
field_dict["output_format"] = output_format field_dict["output_format"] = output_format
if output_format_options is not UNSET: if output_format_options is not UNSET:
@ -109,7 +111,7 @@ class FileConversion:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN: def from_dict(cls: Type[JV], src_dict: Dict[str, Any]) -> JV:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]
@ -134,8 +136,6 @@ class FileConversion:
else: else:
id = _id # type: ignore[arg-type] id = _id # type: ignore[arg-type]
output = d.pop("output", UNSET)
_output_format = d.pop("output_format", UNSET) _output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, FileExportFormat] output_format: Union[Unset, FileExportFormat]
if isinstance(_output_format, Unset): if isinstance(_output_format, Unset):
@ -150,7 +150,15 @@ class FileConversion:
else: else:
output_format_options = _output_format_options # type: ignore[arg-type] output_format_options = _output_format_options # type: ignore[arg-type]
outputs = d.pop("outputs", UNSET) _outputs = d.pop("outputs", UNSET)
if isinstance(_outputs, Unset):
outputs = UNSET
else:
new_map: Dict[str, Base64Data] = {}
for k, v in _outputs.items():
new_map[k] = Base64Data(bytes(v, "utf-8"))
outputs = new_map # type: ignore
_src_format = d.pop("src_format", UNSET) _src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat] src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset): if isinstance(_src_format, Unset):
@ -195,7 +203,6 @@ class FileConversion:
created_at=created_at, created_at=created_at,
error=error, error=error,
id=id, id=id,
output=output,
output_format=output_format, output_format=output_format,
output_format_options=output_format_options, output_format_options=output_format_options,
outputs=outputs, outputs=outputs,
@ -228,11 +235,11 @@ class FileConversion:
return key in self.additional_properties return key in self.additional_properties
JV = TypeVar("JV", bound="FileCenterOfMass") IO = TypeVar("IO", bound="file_center_of_mass")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
class FileCenterOfMass: class file_center_of_mass:
"""File center of mass.""" # noqa: E501 """File center of mass.""" # noqa: E501
center_of_mass: Union[Unset, Point3d] = UNSET center_of_mass: Union[Unset, Point3d] = UNSET
@ -244,7 +251,7 @@ class FileCenterOfMass:
src_format: Union[Unset, FileImportFormat] = UNSET src_format: Union[Unset, FileImportFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET status: Union[Unset, ApiCallStatus] = UNSET
type: str = "FileCenterOfMass" type: str = "file_center_of_mass"
updated_at: Union[Unset, datetime.datetime] = UNSET updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET user_id: Union[Unset, str] = UNSET
@ -306,7 +313,7 @@ class FileCenterOfMass:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[JV], src_dict: Dict[str, Any]) -> JV: def from_dict(cls: Type[IO], src_dict: Dict[str, Any]) -> IO:
d = src_dict.copy() d = src_dict.copy()
_center_of_mass = d.pop("center_of_mass", UNSET) _center_of_mass = d.pop("center_of_mass", UNSET)
center_of_mass: Union[Unset, Point3d] center_of_mass: Union[Unset, Point3d]
@ -412,11 +419,11 @@ class FileCenterOfMass:
return key in self.additional_properties return key in self.additional_properties
IO = TypeVar("IO", bound="FileMass") FV = TypeVar("FV", bound="file_mass")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
class FileMass: class file_mass:
"""A file mass.""" # noqa: E501 """A file mass.""" # noqa: E501
completed_at: Union[Unset, datetime.datetime] = UNSET completed_at: Union[Unset, datetime.datetime] = UNSET
@ -430,7 +437,7 @@ class FileMass:
src_format: Union[Unset, FileImportFormat] = UNSET src_format: Union[Unset, FileImportFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET status: Union[Unset, ApiCallStatus] = UNSET
type: str = "FileMass" type: str = "file_mass"
updated_at: Union[Unset, datetime.datetime] = UNSET updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET user_id: Union[Unset, str] = UNSET
@ -498,7 +505,7 @@ class FileMass:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[IO], src_dict: Dict[str, Any]) -> IO: def from_dict(cls: Type[FV], src_dict: Dict[str, Any]) -> FV:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]
@ -610,11 +617,11 @@ class FileMass:
return key in self.additional_properties return key in self.additional_properties
FV = TypeVar("FV", bound="FileVolume") LE = TypeVar("LE", bound="file_volume")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
class FileVolume: class file_volume:
"""A file volume.""" # noqa: E501 """A file volume.""" # noqa: E501
completed_at: Union[Unset, datetime.datetime] = UNSET completed_at: Union[Unset, datetime.datetime] = UNSET
@ -625,7 +632,7 @@ class FileVolume:
src_format: Union[Unset, FileImportFormat] = UNSET src_format: Union[Unset, FileImportFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET status: Union[Unset, ApiCallStatus] = UNSET
type: str = "FileVolume" type: str = "file_volume"
updated_at: Union[Unset, datetime.datetime] = UNSET updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET user_id: Union[Unset, str] = UNSET
volume: Union[Unset, float] = UNSET volume: Union[Unset, float] = UNSET
@ -687,7 +694,7 @@ class FileVolume:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[FV], src_dict: Dict[str, Any]) -> FV: def from_dict(cls: Type[LE], src_dict: Dict[str, Any]) -> LE:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]
@ -788,11 +795,11 @@ class FileVolume:
return key in self.additional_properties return key in self.additional_properties
LE = TypeVar("LE", bound="FileDensity") OY = TypeVar("OY", bound="file_density")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
class FileDensity: class file_density:
"""A file density.""" # noqa: E501 """A file density.""" # noqa: E501
completed_at: Union[Unset, datetime.datetime] = UNSET completed_at: Union[Unset, datetime.datetime] = UNSET
@ -806,7 +813,7 @@ class FileDensity:
src_format: Union[Unset, FileImportFormat] = UNSET src_format: Union[Unset, FileImportFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET status: Union[Unset, ApiCallStatus] = UNSET
type: str = "FileDensity" type: str = "file_density"
updated_at: Union[Unset, datetime.datetime] = UNSET updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET user_id: Union[Unset, str] = UNSET
@ -874,7 +881,7 @@ class FileDensity:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[LE], src_dict: Dict[str, Any]) -> LE: def from_dict(cls: Type[OY], src_dict: Dict[str, Any]) -> OY:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]
@ -986,11 +993,11 @@ class FileDensity:
return key in self.additional_properties return key in self.additional_properties
OY = TypeVar("OY", bound="FileSurfaceArea") HO = TypeVar("HO", bound="file_surface_area")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
class FileSurfaceArea: class file_surface_area:
"""A file surface area.""" # noqa: E501 """A file surface area.""" # noqa: E501
completed_at: Union[Unset, datetime.datetime] = UNSET completed_at: Union[Unset, datetime.datetime] = UNSET
@ -1002,7 +1009,7 @@ class FileSurfaceArea:
started_at: Union[Unset, datetime.datetime] = UNSET started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET status: Union[Unset, ApiCallStatus] = UNSET
surface_area: Union[Unset, float] = UNSET surface_area: Union[Unset, float] = UNSET
type: str = "FileSurfaceArea" type: str = "file_surface_area"
updated_at: Union[Unset, datetime.datetime] = UNSET updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET user_id: Union[Unset, str] = UNSET
@ -1063,7 +1070,7 @@ class FileSurfaceArea:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[OY], src_dict: Dict[str, Any]) -> OY: def from_dict(cls: Type[HO], src_dict: Dict[str, Any]) -> HO:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]
@ -1165,5 +1172,10 @@ class FileSurfaceArea:
AsyncApiCallOutput = Union[ AsyncApiCallOutput = Union[
FileConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea file_conversion,
file_center_of_mass,
file_mass,
file_volume,
file_density,
file_surface_area,
] ]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
HO = TypeVar("HO", bound="AsyncApiCallResultsPage") TM = TypeVar("TM", bound="AsyncApiCallResultsPage")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class AsyncApiCallResultsPage:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[HO], src_dict: Dict[str, Any]) -> HO: def from_dict(cls: Type[TM], src_dict: Dict[str, Any]) -> TM:
d = src_dict.copy() d = src_dict.copy()
from ..models.async_api_call import AsyncApiCall from ..models.async_api_call import AsyncApiCall

View File

@ -5,17 +5,17 @@ class AsyncApiCallType(str, Enum):
"""The type of async API call.""" # noqa: E501 """The type of async API call.""" # noqa: E501
"""# File conversion. """ # noqa: E501 """# File conversion. """ # noqa: E501
FILE_CONVERSION = "FileConversion" FILE_CONVERSION = "file_conversion"
"""# File volume. """ # noqa: E501 """# File volume. """ # noqa: E501
FILE_VOLUME = "FileVolume" FILE_VOLUME = "file_volume"
"""# File center of mass. """ # noqa: E501 """# File center of mass. """ # noqa: E501
FILE_CENTER_OF_MASS = "FileCenterOfMass" FILE_CENTER_OF_MASS = "file_center_of_mass"
"""# File mass. """ # noqa: E501 """# File mass. """ # noqa: E501
FILE_MASS = "FileMass" FILE_MASS = "file_mass"
"""# File density. """ # noqa: E501 """# File density. """ # noqa: E501
FILE_DENSITY = "FileDensity" FILE_DENSITY = "file_density"
"""# File surface area. """ # noqa: E501 """# File surface area. """ # noqa: E501
FILE_SURFACE_AREA = "FileSurfaceArea" FILE_SURFACE_AREA = "file_surface_area"
def __str__(self) -> str: def __str__(self) -> str:
return str(self.value) return str(self.value)

View File

@ -6,7 +6,7 @@ from ..models.axis import Axis
from ..models.direction import Direction from ..models.direction import Direction
from ..types import UNSET, Unset from ..types import UNSET, Unset
TM = TypeVar("TM", bound="AxisDirectionPair") BS = TypeVar("BS", bound="AxisDirectionPair")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class AxisDirectionPair:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[TM], src_dict: Dict[str, Any]) -> TM: def from_dict(cls: Type[BS], src_dict: Dict[str, Any]) -> BS:
d = src_dict.copy() d = src_dict.copy()
_axis = d.pop("axis", UNSET) _axis = d.pop("axis", UNSET)
axis: Union[Unset, Axis] axis: Union[Unset, Axis]

View File

@ -0,0 +1,35 @@
import base64
import binascii
class Base64Data:
def __init__(self, data: bytes):
"""
Initializes the object.
If the provided data is already in base64 encoded format, it will store it.
If the data is a regular byte string, it will encode and then store it.
"""
if self.is_base64(data):
self._data = str(data, "utf-8")
else:
encoded = base64.b64encode(data)
self._data = str(encoded, "utf-8")
@staticmethod
def is_base64(data: bytes) -> bool:
"""Checks if given data is base64 encoded."""
try:
str_data = str(data, "utf-8")
_ = base64.urlsafe_b64decode(str_data.strip("=") + "===")
return True
except binascii.Error:
return False
def get_encoded(self) -> str:
"""Returns the stored base64 encoded data."""
return self._data
def get_decoded(self) -> bytes:
"""Returns the decoded byte string."""
return base64.urlsafe_b64decode(self._data.strip("=") + "===")

View File

@ -5,7 +5,7 @@ import attr
from ..models.new_address import NewAddress from ..models.new_address import NewAddress
from ..types import UNSET, Unset from ..types import UNSET, Unset
BS = TypeVar("BS", bound="BillingInfo") AH = TypeVar("AH", bound="BillingInfo")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class BillingInfo:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[BS], src_dict: Dict[str, Any]) -> BS: def from_dict(cls: Type[AH], src_dict: Dict[str, Any]) -> AH:
d = src_dict.copy() d = src_dict.copy()
_address = d.pop("address", UNSET) _address = d.pop("address", UNSET)
address: Union[Unset, NewAddress] address: Union[Unset, NewAddress]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
AH = TypeVar("AH", bound="CacheMetadata") EG = TypeVar("EG", bound="CacheMetadata")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -29,7 +29,7 @@ class CacheMetadata:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[AH], src_dict: Dict[str, Any]) -> AH: def from_dict(cls: Type[EG], src_dict: Dict[str, Any]) -> EG:
d = src_dict.copy() d = src_dict.copy()
ok = d.pop("ok", UNSET) ok = d.pop("ok", UNSET)

View File

@ -5,7 +5,7 @@ import attr
from ..models.payment_method_card_checks import PaymentMethodCardChecks from ..models.payment_method_card_checks import PaymentMethodCardChecks
from ..types import UNSET, Unset from ..types import UNSET, Unset
EG = TypeVar("EG", bound="CardDetails") JR = TypeVar("JR", bound="CardDetails")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -57,7 +57,7 @@ class CardDetails:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[EG], src_dict: Dict[str, Any]) -> EG: def from_dict(cls: Type[JR], src_dict: Dict[str, Any]) -> JR:
d = src_dict.copy() d = src_dict.copy()
brand = d.pop("brand", UNSET) brand = d.pop("brand", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
JR = TypeVar("JR", bound="Cluster") LY = TypeVar("LY", bound="Cluster")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -49,7 +49,7 @@ class Cluster:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[JR], src_dict: Dict[str, Any]) -> JR: def from_dict(cls: Type[LY], src_dict: Dict[str, Any]) -> LY:
d = src_dict.copy() d = src_dict.copy()
addr = d.pop("addr", UNSET) addr = d.pop("addr", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
LY = TypeVar("LY", bound="CodeOutput") HK = TypeVar("HK", bound="CodeOutput")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -41,7 +41,7 @@ class CodeOutput:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[LY], src_dict: Dict[str, Any]) -> LY: def from_dict(cls: Type[HK], src_dict: Dict[str, Any]) -> HK:
d = src_dict.copy() d = src_dict.copy()
from ..models.output_file import OutputFile from ..models.output_file import OutputFile

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
HK = TypeVar("HK", bound="Color") VR = TypeVar("VR", bound="Color")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class Color:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[HK], src_dict: Dict[str, Any]) -> HK: def from_dict(cls: Type[VR], src_dict: Dict[str, Any]) -> VR:
d = src_dict.copy() d = src_dict.copy()
a = d.pop("a", UNSET) a = d.pop("a", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
VR = TypeVar("VR", bound="Commit") ON = TypeVar("ON", bound="Commit")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -31,7 +31,7 @@ class Commit:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[VR], src_dict: Dict[str, Any]) -> VR: def from_dict(cls: Type[ON], src_dict: Dict[str, Any]) -> ON:
d = src_dict.copy() d = src_dict.copy()
expected = d.pop("expected", UNSET) expected = d.pop("expected", UNSET)

View File

@ -10,7 +10,7 @@ from ..models.jetstream import Jetstream
from ..models.leaf_node import LeafNode from ..models.leaf_node import LeafNode
from ..types import UNSET, Unset from ..types import UNSET, Unset
ON = TypeVar("ON", bound="Connection") PC = TypeVar("PC", bound="Connection")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -33,7 +33,7 @@ class Connection:
http_base_path: Union[Unset, str] = UNSET http_base_path: Union[Unset, str] = UNSET
http_host: Union[Unset, str] = UNSET http_host: Union[Unset, str] = UNSET
http_port: Union[Unset, int] = UNSET http_port: Union[Unset, int] = UNSET
http_req_stats: Union[Unset, Any] = UNSET http_req_stats: Union[Unset, Dict[str, int]] = UNSET
https_port: Union[Unset, int] = UNSET https_port: Union[Unset, int] = UNSET
in_bytes: Union[Unset, int] = UNSET in_bytes: Union[Unset, int] = UNSET
in_msgs: Union[Unset, int] = UNSET in_msgs: Union[Unset, int] = UNSET
@ -88,6 +88,7 @@ class Connection:
http_host = self.http_host http_host = self.http_host
http_port = self.http_port http_port = self.http_port
http_req_stats = self.http_req_stats http_req_stats = self.http_req_stats
https_port = self.https_port https_port = self.https_port
in_bytes = self.in_bytes in_bytes = self.in_bytes
in_msgs = self.in_msgs in_msgs = self.in_msgs
@ -225,7 +226,7 @@ class Connection:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[ON], src_dict: Dict[str, Any]) -> ON: def from_dict(cls: Type[PC], src_dict: Dict[str, Any]) -> PC:
d = src_dict.copy() d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET) auth_timeout = d.pop("auth_timeout", UNSET)
@ -271,6 +272,7 @@ class Connection:
http_port = d.pop("http_port", UNSET) http_port = d.pop("http_port", UNSET)
http_req_stats = d.pop("http_req_stats", UNSET) http_req_stats = d.pop("http_req_stats", UNSET)
https_port = d.pop("https_port", UNSET) https_port = d.pop("https_port", UNSET)
in_bytes = d.pop("in_bytes", UNSET) in_bytes = d.pop("in_bytes", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
PC = TypeVar("PC", bound="Coupon") US = TypeVar("US", bound="Coupon")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class Coupon:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[PC], src_dict: Dict[str, Any]) -> PC: def from_dict(cls: Type[US], src_dict: Dict[str, Any]) -> US:
d = src_dict.copy() d = src_dict.copy()
amount_off = d.pop("amount_off", UNSET) amount_off = d.pop("amount_off", UNSET)

View File

@ -6,10 +6,10 @@ class CreatedAtSortMode(str, Enum):
Currently, we only support scanning in ascending order.""" # noqa: E501 Currently, we only support scanning in ascending order.""" # noqa: E501
"""# sort in increasing order of "created_at" """ # noqa: E501 """# Sort in increasing order of "created_at". """ # noqa: E501
CREATED_AT_ASCENDING = "created-at-ascending" CREATED_AT_ASCENDING = "created_at_ascending"
"""# sort in decreasing order of "created_at" """ # noqa: E501 """# Sort in decreasing order of "created_at". """ # noqa: E501
CREATED_AT_DESCENDING = "created-at-descending" CREATED_AT_DESCENDING = "created_at_descending"
def __str__(self) -> str: def __str__(self) -> str:
return str(self.value) return str(self.value)

View File

@ -0,0 +1,63 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
KQ = TypeVar("KQ", bound="CurveGetControlPoints")
@attr.s(auto_attribs=True)
class CurveGetControlPoints:
"""The response from the `CurveGetControlPoints` command.""" # noqa: E501
from ..models.point3d import Point3d
control_points: Union[Unset, List[Point3d]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.point3d import Point3d
control_points: Union[Unset, List[Point3d]] = UNSET
if not isinstance(self.control_points, Unset):
control_points = self.control_points
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if control_points is not UNSET:
field_dict["control_points"] = control_points
return field_dict
@classmethod
def from_dict(cls: Type[KQ], src_dict: Dict[str, Any]) -> KQ:
d = src_dict.copy()
from ..models.point3d import Point3d
control_points = cast(List[Point3d], d.pop("control_points", UNSET))
curve_get_control_points = cls(
control_points=control_points,
)
curve_get_control_points.additional_properties = d
return curve_get_control_points
@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,62 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.curve_type import CurveType
from ..types import UNSET, Unset
FH = TypeVar("FH", bound="CurveGetType")
@attr.s(auto_attribs=True)
class CurveGetType:
"""The response from the `CurveGetType` command.""" # noqa: E501
curve_type: Union[Unset, CurveType] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.curve_type, Unset):
curve_type = self.curve_type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if curve_type is not UNSET:
field_dict["curve_type"] = curve_type
return field_dict
@classmethod
def from_dict(cls: Type[FH], src_dict: Dict[str, Any]) -> FH:
d = src_dict.copy()
_curve_type = d.pop("curve_type", UNSET)
curve_type: Union[Unset, CurveType]
if isinstance(_curve_type, Unset):
curve_type = UNSET
else:
curve_type = _curve_type # type: ignore[arg-type]
curve_get_type = cls(
curve_type=curve_type,
)
curve_get_type.additional_properties = d
return curve_get_type
@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 CurveType(str, Enum):
"""The type of Curve (embedded within path)""" # noqa: E501
LINE = "line"
NURBS = "nurbs"
def __str__(self) -> str:
return str(self.value)

View File

@ -8,7 +8,7 @@ from ..models.currency import Currency
from ..models.new_address import NewAddress from ..models.new_address import NewAddress
from ..types import UNSET, Unset from ..types import UNSET, Unset
US = TypeVar("US", bound="Customer") NH = TypeVar("NH", bound="Customer")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -22,7 +22,7 @@ class Customer:
delinquent: Union[Unset, bool] = False delinquent: Union[Unset, bool] = False
email: Union[Unset, str] = UNSET email: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET id: Union[Unset, str] = UNSET
metadata: Union[Unset, Any] = UNSET metadata: Union[Unset, Dict[str, str]] = UNSET
name: Union[Unset, str] = UNSET name: Union[Unset, str] = UNSET
phone: Union[Unset, str] = UNSET phone: Union[Unset, str] = UNSET
@ -41,6 +41,7 @@ class Customer:
email = self.email email = self.email
id = self.id id = self.id
metadata = self.metadata metadata = self.metadata
name = self.name name = self.name
phone = self.phone phone = self.phone
@ -71,7 +72,7 @@ class Customer:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[US], src_dict: Dict[str, Any]) -> US: def from_dict(cls: Type[NH], src_dict: Dict[str, Any]) -> NH:
d = src_dict.copy() d = src_dict.copy()
_address = d.pop("address", UNSET) _address = d.pop("address", UNSET)
address: Union[Unset, NewAddress] address: Union[Unset, NewAddress]
@ -103,6 +104,7 @@ class Customer:
id = d.pop("id", UNSET) id = d.pop("id", UNSET)
metadata = d.pop("metadata", UNSET) metadata = d.pop("metadata", UNSET)
name = d.pop("name", UNSET) name = d.pop("name", UNSET)
phone = d.pop("phone", UNSET) phone = d.pop("phone", UNSET)

View File

@ -7,7 +7,7 @@ from dateutil.parser import isoparse
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
KQ = TypeVar("KQ", bound="CustomerBalance") BB = TypeVar("BB", bound="CustomerBalance")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -64,7 +64,7 @@ class CustomerBalance:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[KQ], src_dict: Dict[str, Any]) -> KQ: def from_dict(cls: Type[BB], src_dict: Dict[str, Any]) -> BB:
d = src_dict.copy() d = src_dict.copy()
_created_at = d.pop("created_at", UNSET) _created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime] created_at: Union[Unset, datetime.datetime]

View File

@ -5,7 +5,7 @@ import attr
from ..models.o_auth2_grant_type import OAuth2GrantType from ..models.o_auth2_grant_type import OAuth2GrantType
from ..types import UNSET, Unset from ..types import UNSET, Unset
FH = TypeVar("FH", bound="DeviceAccessTokenRequestForm") PJ = TypeVar("PJ", bound="DeviceAccessTokenRequestForm")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class DeviceAccessTokenRequestForm:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[FH], src_dict: Dict[str, Any]) -> FH: def from_dict(cls: Type[PJ], src_dict: Dict[str, Any]) -> PJ:
d = src_dict.copy() d = src_dict.copy()
client_id = d.pop("client_id", UNSET) client_id = d.pop("client_id", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
NH = TypeVar("NH", bound="DeviceAuthRequestForm") TV = TypeVar("TV", bound="DeviceAuthRequestForm")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -27,7 +27,7 @@ class DeviceAuthRequestForm:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[NH], src_dict: Dict[str, Any]) -> NH: def from_dict(cls: Type[TV], src_dict: Dict[str, Any]) -> TV:
d = src_dict.copy() d = src_dict.copy()
client_id = d.pop("client_id", UNSET) client_id = d.pop("client_id", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
BB = TypeVar("BB", bound="DeviceAuthVerifyParams") CR = TypeVar("CR", bound="DeviceAuthVerifyParams")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -27,7 +27,7 @@ class DeviceAuthVerifyParams:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[BB], src_dict: Dict[str, Any]) -> BB: def from_dict(cls: Type[CR], src_dict: Dict[str, Any]) -> CR:
d = src_dict.copy() d = src_dict.copy()
user_code = d.pop("user_code", UNSET) user_code = d.pop("user_code", UNSET)

View File

@ -5,7 +5,7 @@ import attr
from ..models.coupon import Coupon from ..models.coupon import Coupon
from ..types import UNSET, Unset from ..types import UNSET, Unset
PJ = TypeVar("PJ", bound="Discount") CE = TypeVar("CE", bound="Discount")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -29,7 +29,7 @@ class Discount:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[PJ], src_dict: Dict[str, Any]) -> PJ: def from_dict(cls: Type[CE], src_dict: Dict[str, Any]) -> CE:
d = src_dict.copy() d = src_dict.copy()
_coupon = d.pop("coupon", UNSET) _coupon = d.pop("coupon", UNSET)
coupon: Union[Unset, Coupon] coupon: Union[Unset, Coupon]

View File

@ -5,12 +5,13 @@ import attr
from ..models.commit import Commit from ..models.commit import Commit
from ..models.plugins_info import PluginsInfo from ..models.plugins_info import PluginsInfo
from ..models.registry_service_config import RegistryServiceConfig from ..models.registry_service_config import RegistryServiceConfig
from ..models.runtime import Runtime
from ..models.system_info_cgroup_driver_enum import SystemInfoCgroupDriverEnum from ..models.system_info_cgroup_driver_enum import SystemInfoCgroupDriverEnum
from ..models.system_info_cgroup_version_enum import SystemInfoCgroupVersionEnum from ..models.system_info_cgroup_version_enum import SystemInfoCgroupVersionEnum
from ..models.system_info_isolation_enum import SystemInfoIsolationEnum from ..models.system_info_isolation_enum import SystemInfoIsolationEnum
from ..types import UNSET, Unset from ..types import UNSET, Unset
TV = TypeVar("TV", bound="DockerSystemInfo") MS = TypeVar("MS", bound="DockerSystemInfo")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -73,7 +74,9 @@ class DockerSystemInfo:
product_license: Union[Unset, str] = UNSET product_license: Union[Unset, str] = UNSET
registry_config: Union[Unset, RegistryServiceConfig] = UNSET registry_config: Union[Unset, RegistryServiceConfig] = UNSET
runc_commit: Union[Unset, Commit] = UNSET runc_commit: Union[Unset, Commit] = UNSET
runtimes: Union[Unset, Any] = UNSET from ..models.runtime import Runtime
runtimes: Union[Unset, Dict[str, Runtime]] = UNSET
security_options: Union[Unset, List[str]] = UNSET security_options: Union[Unset, List[str]] = UNSET
server_version: Union[Unset, str] = UNSET server_version: Union[Unset, str] = UNSET
swap_limit: Union[Unset, bool] = False swap_limit: Union[Unset, bool] = False
@ -155,7 +158,12 @@ class DockerSystemInfo:
registry_config = self.registry_config registry_config = self.registry_config
if not isinstance(self.runc_commit, Unset): if not isinstance(self.runc_commit, Unset):
runc_commit = self.runc_commit runc_commit = self.runc_commit
runtimes = self.runtimes runtimes: Union[Unset, Dict[str, Any]] = UNSET
if not isinstance(self.runtimes, Unset):
new_dict: Dict[str, Any] = {}
for key, value in self.runtimes.items():
new_dict[key] = value.to_dict()
runtimes = new_dict
security_options: Union[Unset, List[str]] = UNSET security_options: Union[Unset, List[str]] = UNSET
if not isinstance(self.security_options, Unset): if not isinstance(self.security_options, Unset):
security_options = self.security_options security_options = self.security_options
@ -293,7 +301,7 @@ class DockerSystemInfo:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[TV], src_dict: Dict[str, Any]) -> TV: def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS:
d = src_dict.copy() d = src_dict.copy()
architecture = d.pop("architecture", UNSET) architecture = d.pop("architecture", UNSET)
@ -449,7 +457,15 @@ class DockerSystemInfo:
else: else:
runc_commit = _runc_commit # type: ignore[arg-type] runc_commit = _runc_commit # type: ignore[arg-type]
runtimes = d.pop("runtimes", UNSET) _runtimes = d.pop("runtimes", UNSET)
if isinstance(_runtimes, Unset):
runtimes = UNSET
else:
new_map: Dict[str, Runtime] = {}
for k, v in _runtimes.items():
new_map[k] = Runtime.from_dict(v) # type: ignore
runtimes = new_map # type: ignore
security_options = cast(List[str], d.pop("security_options", UNSET)) security_options = cast(List[str], d.pop("security_options", UNSET))
server_version = d.pop("server_version", UNSET) server_version = d.pop("server_version", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
CR = TypeVar("CR", bound="EmailAuthenticationForm") LT = TypeVar("LT", bound="EmailAuthenticationForm")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -31,7 +31,7 @@ class EmailAuthenticationForm:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[CR], src_dict: Dict[str, Any]) -> CR: def from_dict(cls: Type[LT], src_dict: Dict[str, Any]) -> LT:
d = src_dict.copy() d = src_dict.copy()
callback_url = d.pop("callback_url", UNSET) callback_url = d.pop("callback_url", UNSET)

15
kittycad/models/empty.py Normal file
View File

@ -0,0 +1,15 @@
from typing import Any, Dict, Type, TypeVar
import attr
VI = TypeVar("VI", bound="Empty")
@attr.s(auto_attribs=True)
class Empty:
def __str__(self) -> str:
return ""
@classmethod
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> Any:
return {}

View File

@ -8,7 +8,7 @@ from ..models.environment import Environment
from ..models.file_system_metadata import FileSystemMetadata from ..models.file_system_metadata import FileSystemMetadata
from ..types import UNSET, Unset from ..types import UNSET, Unset
CE = TypeVar("CE", bound="EngineMetadata") ED = TypeVar("ED", bound="EngineMetadata")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -57,7 +57,7 @@ class EngineMetadata:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[CE], src_dict: Dict[str, Any]) -> CE: def from_dict(cls: Type[ED], src_dict: Dict[str, Any]) -> ED:
d = src_dict.copy() d = src_dict.copy()
async_jobs_running = d.pop("async_jobs_running", UNSET) async_jobs_running = d.pop("async_jobs_running", UNSET)

View File

@ -0,0 +1,57 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
YY = TypeVar("YY", bound="EntityGetAllChildUuids")
@attr.s(auto_attribs=True)
class EntityGetAllChildUuids:
"""The response from the `EntityGetAllChildUuids` command.""" # noqa: E501
entity_ids: Union[Unset, List[str]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entity_ids: Union[Unset, List[str]] = UNSET
if not isinstance(self.entity_ids, Unset):
entity_ids = self.entity_ids
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_ids is not UNSET:
field_dict["entity_ids"] = entity_ids
return field_dict
@classmethod
def from_dict(cls: Type[YY], src_dict: Dict[str, Any]) -> YY:
d = src_dict.copy()
entity_ids = cast(List[str], d.pop("entity_ids", UNSET))
entity_get_all_child_uuids = cls(
entity_ids=entity_ids,
)
entity_get_all_child_uuids.additional_properties = d
return entity_get_all_child_uuids
@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,55 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
DO = TypeVar("DO", bound="EntityGetChildUuid")
@attr.s(auto_attribs=True)
class EntityGetChildUuid:
"""The response from the `EntityGetChildUuid` command.""" # noqa: E501
entity_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entity_id = self.entity_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_id is not UNSET:
field_dict["entity_id"] = entity_id
return field_dict
@classmethod
def from_dict(cls: Type[DO], src_dict: Dict[str, Any]) -> DO:
d = src_dict.copy()
entity_id = d.pop("entity_id", UNSET)
entity_get_child_uuid = cls(
entity_id=entity_id,
)
entity_get_child_uuid.additional_properties = d
return entity_get_child_uuid
@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,55 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
FZ = TypeVar("FZ", bound="EntityGetNumChildren")
@attr.s(auto_attribs=True)
class EntityGetNumChildren:
"""The response from the `EntityGetNumChildren` command.""" # noqa: E501
num: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
num = self.num
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if num is not UNSET:
field_dict["num"] = num
return field_dict
@classmethod
def from_dict(cls: Type[FZ], src_dict: Dict[str, Any]) -> FZ:
d = src_dict.copy()
num = d.pop("num", UNSET)
entity_get_num_children = cls(
num=num,
)
entity_get_num_children.additional_properties = d
return entity_get_num_children
@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,55 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
GL = TypeVar("GL", bound="EntityGetParentId")
@attr.s(auto_attribs=True)
class EntityGetParentId:
"""The response from the `EntityGetParentId` command.""" # noqa: E501
entity_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entity_id = self.entity_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_id is not UNSET:
field_dict["entity_id"] = entity_id
return field_dict
@classmethod
def from_dict(cls: Type[GL], src_dict: Dict[str, Any]) -> GL:
d = src_dict.copy()
entity_id = d.pop("entity_id", UNSET)
entity_get_parent_id = cls(
entity_id=entity_id,
)
entity_get_parent_id.additional_properties = d
return entity_get_parent_id
@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

@ -12,6 +12,7 @@ class EntityType(str, Enum):
SOLID3D = "solid3d" SOLID3D = "solid3d"
EDGE = "edge" EDGE = "edge"
FACE = "face" FACE = "face"
PLANE = "plane"
def __str__(self) -> str: def __str__(self) -> str:
return str(self.value) return str(self.value)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
MS = TypeVar("MS", bound="Error") NN = TypeVar("NN", bound="Error")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class Error:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS: def from_dict(cls: Type[NN], src_dict: Dict[str, Any]) -> NN:
d = src_dict.copy() d = src_dict.copy()
error_code = d.pop("error_code", UNSET) error_code = d.pop("error_code", UNSET)

View File

@ -0,0 +1,23 @@
from enum import Enum
class ErrorCode(str, Enum):
"""The type of error sent by the KittyCAD API.""" # noqa: E501
"""# Graphics engine failed to complete request, consider retrying """ # noqa: E501
INTERNAL_ENGINE = "internal_engine"
"""# API failed to complete request, consider retrying """ # noqa: E501
INTERNAL_API = "internal_api"
"""# User requested something geometrically or graphically impossible. Don't retry this request, as it's inherently impossible. Instead, read the error message and change your request. """ # noqa: E501
BAD_REQUEST = "bad_request"
"""# Client sent invalid JSON. """ # noqa: E501
INVALID_JSON = "invalid_json"
"""# Problem sending data between client and KittyCAD API. """ # noqa: E501
CONNECTION_PROBLEM = "connection_problem"
"""# Client sent a Websocket message type which the KittyCAD API does not handle. """ # noqa: E501
MESSAGE_TYPE_NOT_ACCEPTED = "message_type_not_accepted"
"""# Client sent a Websocket message intended for WebRTC but it was configured as a WebRTC connection. """ # noqa: E501
MESSAGE_TYPE_NOT_ACCEPTED_FOR_WEB_R_T_C = "message_type_not_accepted_for_web_r_t_c"
def __str__(self) -> str:
return str(self.value)

View File

@ -6,7 +6,7 @@ from ..models.docker_system_info import DockerSystemInfo
from ..models.environment import Environment from ..models.environment import Environment
from ..types import UNSET, Unset from ..types import UNSET, Unset
LT = TypeVar("LT", bound="ExecutorMetadata") OH = TypeVar("OH", bound="ExecutorMetadata")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -41,7 +41,7 @@ class ExecutorMetadata:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[LT], src_dict: Dict[str, Any]) -> LT: def from_dict(cls: Type[OH], src_dict: Dict[str, Any]) -> OH:
d = src_dict.copy() d = src_dict.copy()
_docker_info = d.pop("docker_info", UNSET) _docker_info = d.pop("docker_info", UNSET)
docker_info: Union[Unset, DockerSystemInfo] docker_info: Union[Unset, DockerSystemInfo]

63
kittycad/models/export.py Normal file
View File

@ -0,0 +1,63 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
VI = TypeVar("VI", bound="Export")
@attr.s(auto_attribs=True)
class Export:
"""The response from the `Export` endpoint.""" # noqa: E501
from ..models.export_file import ExportFile
files: Union[Unset, List[ExportFile]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.export_file import ExportFile
files: Union[Unset, List[ExportFile]] = UNSET
if not isinstance(self.files, Unset):
files = self.files
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if files is not UNSET:
field_dict["files"] = files
return field_dict
@classmethod
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> VI:
d = src_dict.copy()
from ..models.export_file import ExportFile
files = cast(List[ExportFile], d.pop("files", UNSET))
export = cls(
files=files,
)
export.additional_properties = d
return export
@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,22 +2,25 @@ from typing import Any, Dict, List, Type, TypeVar, Union
import attr import attr
from ..models.base64data import Base64Data
from ..types import UNSET, Unset from ..types import UNSET, Unset
ED = TypeVar("ED", bound="ExportFile") ET = TypeVar("ET", bound="ExportFile")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
class ExportFile: class ExportFile:
"""A file to be exported to the client.""" # noqa: E501 """A file to be exported to the client.""" # noqa: E501
contents: Union[Unset, str] = UNSET contents: Union[Unset, Base64Data] = UNSET
name: Union[Unset, str] = UNSET name: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
contents = self.contents contents: Union[Unset, str] = UNSET
if not isinstance(self.contents, Unset):
contents = self.contents.get_encoded()
name = self.name name = self.name
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
@ -31,9 +34,14 @@ class ExportFile:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[ED], src_dict: Dict[str, Any]) -> ED: def from_dict(cls: Type[ET], src_dict: Dict[str, Any]) -> ET:
d = src_dict.copy() d = src_dict.copy()
contents = d.pop("contents", UNSET) _contents = d.pop("contents", UNSET)
contents: Union[Unset, Base64Data]
if isinstance(_contents, Unset):
contents = UNSET
else:
contents = Base64Data(bytes(_contents, "utf-8"))
name = d.pop("name", UNSET) name = d.pop("name", UNSET)

View File

@ -6,7 +6,7 @@ from dateutil.parser import isoparse
from ..types import UNSET, Unset from ..types import UNSET, Unset
YY = TypeVar("YY", bound="ExtendedUser") QF = TypeVar("QF", bound="ExtendedUser")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -98,7 +98,7 @@ class ExtendedUser:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[YY], src_dict: Dict[str, Any]) -> YY: def from_dict(cls: Type[QF], src_dict: Dict[str, Any]) -> QF:
d = src_dict.copy() d = src_dict.copy()
company = d.pop("company", UNSET) company = d.pop("company", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
DO = TypeVar("DO", bound="ExtendedUserResultsPage") DI = TypeVar("DI", bound="ExtendedUserResultsPage")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class ExtendedUserResultsPage:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[DO], src_dict: Dict[str, Any]) -> DO: def from_dict(cls: Type[DI], src_dict: Dict[str, Any]) -> DI:
d = src_dict.copy() d = src_dict.copy()
from ..models.extended_user import ExtendedUser from ..models.extended_user import ExtendedUser

View File

@ -0,0 +1,77 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
OJ = TypeVar("OJ", bound="FailureWebSocketResponse")
@attr.s(auto_attribs=True)
class FailureWebSocketResponse:
"""Unsuccessful Websocket response.""" # noqa: E501
from ..models.api_error import ApiError
errors: Union[Unset, List[ApiError]] = UNSET
request_id: Union[Unset, str] = UNSET
success: Union[Unset, bool] = False
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.api_error import ApiError
errors: Union[Unset, List[ApiError]] = UNSET
if not isinstance(self.errors, Unset):
errors = self.errors
request_id = self.request_id
success = self.success
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if errors is not UNSET:
field_dict["errors"] = errors
if request_id is not UNSET:
field_dict["request_id"] = request_id
if success is not UNSET:
field_dict["success"] = success
return field_dict
@classmethod
def from_dict(cls: Type[OJ], src_dict: Dict[str, Any]) -> OJ:
d = src_dict.copy()
from ..models.api_error import ApiError
errors = cast(List[ApiError], d.pop("errors", UNSET))
request_id = d.pop("request_id", UNSET)
success = d.pop("success", UNSET)
failure_web_socket_response = cls(
errors=errors,
request_id=request_id,
success=success,
)
failure_web_socket_response.additional_properties = d
return failure_web_socket_response
@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,13 @@
from enum import Enum
class FbxStorage(str, Enum):
"""Describes the storage format of an FBX file.""" # noqa: E501
"""# ASCII FBX encoding. """ # noqa: E501
ASCII = "ascii"
"""# Binary FBX encoding. """ # noqa: E501
BINARY = "binary"
def __str__(self) -> str:
return str(self.value)

View File

@ -11,7 +11,7 @@ from ..models.unit_length import UnitLength
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
FZ = TypeVar("FZ", bound="FileCenterOfMass") UF = TypeVar("UF", bound="FileCenterOfMass")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -86,7 +86,7 @@ class FileCenterOfMass:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[FZ], src_dict: Dict[str, Any]) -> FZ: def from_dict(cls: Type[UF], src_dict: Dict[str, Any]) -> UF:
d = src_dict.copy() d = src_dict.copy()
_center_of_mass = d.pop("center_of_mass", UNSET) _center_of_mass = d.pop("center_of_mass", UNSET)
center_of_mass: Union[Unset, Point3d] center_of_mass: Union[Unset, Point3d]

View File

@ -5,6 +5,7 @@ import attr
from dateutil.parser import isoparse from dateutil.parser import isoparse
from ..models.api_call_status import ApiCallStatus from ..models.api_call_status import ApiCallStatus
from ..models.base64data import Base64Data
from ..models.file_export_format import FileExportFormat from ..models.file_export_format import FileExportFormat
from ..models.file_import_format import FileImportFormat from ..models.file_import_format import FileImportFormat
from ..models.input_format import InputFormat from ..models.input_format import InputFormat
@ -12,7 +13,7 @@ from ..models.output_format import OutputFormat
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
GL = TypeVar("GL", bound="FileConversion") YF = TypeVar("YF", bound="FileConversion")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -23,10 +24,9 @@ class FileConversion:
created_at: Union[Unset, datetime.datetime] = UNSET created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET error: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET id: Union[Unset, str] = UNSET
output: Union[Unset, str] = UNSET
output_format: Union[Unset, FileExportFormat] = UNSET output_format: Union[Unset, FileExportFormat] = UNSET
output_format_options: Union[Unset, OutputFormat] = UNSET output_format_options: Union[Unset, OutputFormat] = UNSET
outputs: Union[Unset, Any] = UNSET outputs: Union[Unset, Dict[str, Base64Data]] = UNSET
src_format: Union[Unset, FileImportFormat] = UNSET src_format: Union[Unset, FileImportFormat] = UNSET
src_format_options: Union[Unset, InputFormat] = UNSET src_format_options: Union[Unset, InputFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET started_at: Union[Unset, datetime.datetime] = UNSET
@ -45,12 +45,16 @@ class FileConversion:
created_at = self.created_at.isoformat() created_at = self.created_at.isoformat()
error = self.error error = self.error
id = self.id id = self.id
output = self.output
if not isinstance(self.output_format, Unset): if not isinstance(self.output_format, Unset):
output_format = self.output_format output_format = self.output_format
if not isinstance(self.output_format_options, Unset): if not isinstance(self.output_format_options, Unset):
output_format_options = self.output_format_options output_format_options = self.output_format_options
outputs = self.outputs outputs: Union[Unset, Dict[str, str]] = UNSET
if not isinstance(self.outputs, Unset):
new_dict: Dict[str, str] = {}
for key, value in self.outputs.items():
new_dict[key] = value.get_encoded()
outputs = new_dict
if not isinstance(self.src_format, Unset): if not isinstance(self.src_format, Unset):
src_format = self.src_format src_format = self.src_format
if not isinstance(self.src_format_options, Unset): if not isinstance(self.src_format_options, Unset):
@ -76,8 +80,6 @@ class FileConversion:
field_dict["error"] = error field_dict["error"] = error
if id is not UNSET: if id is not UNSET:
field_dict["id"] = id field_dict["id"] = id
if output is not UNSET:
field_dict["output"] = output
if output_format is not UNSET: if output_format is not UNSET:
field_dict["output_format"] = output_format field_dict["output_format"] = output_format
if output_format_options is not UNSET: if output_format_options is not UNSET:
@ -100,7 +102,7 @@ class FileConversion:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[GL], src_dict: Dict[str, Any]) -> GL: def from_dict(cls: Type[YF], src_dict: Dict[str, Any]) -> YF:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]
@ -125,8 +127,6 @@ class FileConversion:
else: else:
id = _id # type: ignore[arg-type] id = _id # type: ignore[arg-type]
output = d.pop("output", UNSET)
_output_format = d.pop("output_format", UNSET) _output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, FileExportFormat] output_format: Union[Unset, FileExportFormat]
if isinstance(_output_format, Unset): if isinstance(_output_format, Unset):
@ -141,7 +141,15 @@ class FileConversion:
else: else:
output_format_options = _output_format_options # type: ignore[arg-type] output_format_options = _output_format_options # type: ignore[arg-type]
outputs = d.pop("outputs", UNSET) _outputs = d.pop("outputs", UNSET)
if isinstance(_outputs, Unset):
outputs = UNSET
else:
new_map: Dict[str, Base64Data] = {}
for k, v in _outputs.items():
new_map[k] = Base64Data(bytes(v, "utf-8"))
outputs = new_map # type: ignore
_src_format = d.pop("src_format", UNSET) _src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat] src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset): if isinstance(_src_format, Unset):
@ -184,7 +192,6 @@ class FileConversion:
created_at=created_at, created_at=created_at,
error=error, error=error,
id=id, id=id,
output=output,
output_format=output_format, output_format=output_format,
output_format_options=output_format_options, output_format_options=output_format_options,
outputs=outputs, outputs=outputs,

View File

@ -11,7 +11,7 @@ from ..models.unit_mass import UnitMass
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
NN = TypeVar("NN", bound="FileDensity") PY = TypeVar("PY", bound="FileDensity")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -94,7 +94,7 @@ class FileDensity:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[NN], src_dict: Dict[str, Any]) -> NN: def from_dict(cls: Type[PY], src_dict: Dict[str, Any]) -> PY:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,21 @@ from enum import Enum
class FileExportFormat(str, Enum): class FileExportFormat(str, Enum):
"""The valid types of output file formats.""" # noqa: E501 """The valid types of output file formats.""" # noqa: E501
"""# glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). """ # noqa: E501 """# Autodesk Filmbox (FBX) format. <https://en.wikipedia.org/wiki/FBX> """ # noqa: E501
FBX = "fbx"
"""# Binary glTF 2.0.
This is a single binary with .glb extension.
This is better if you want a compressed format as opposed to the human readable glTF that lacks compression. """ # noqa: E501
GLB = "glb"
"""# glTF 2.0. Embedded glTF 2.0 (pretty printed).
Single JSON file with .gltf extension binary data encoded as base64 data URIs.
The JSON contents are pretty printed.
It is human readable, single file, and you can view the diff easily in a git commit. """ # noqa: E501
GLTF = "gltf" GLTF = "gltf"
"""# The OBJ file format. <https://en.wikipedia.org/wiki/Wavefront_.obj_file> It may or may not have an an attached material (mtl // mtllib) within the file, but we interact with it as if it does not. """ # noqa: E501 """# The OBJ file format. <https://en.wikipedia.org/wiki/Wavefront_.obj_file> It may or may not have an an attached material (mtl // mtllib) within the file, but we interact with it as if it does not. """ # noqa: E501
OBJ = "obj" OBJ = "obj"

View File

@ -4,12 +4,16 @@ from enum import Enum
class FileImportFormat(str, Enum): class FileImportFormat(str, Enum):
"""The valid types of source file formats.""" # noqa: E501 """The valid types of source file formats.""" # noqa: E501
"""# Autodesk Filmbox (FBX) format. <https://en.wikipedia.org/wiki/FBX> """ # noqa: E501
FBX = "fbx"
"""# glTF 2.0. """ # noqa: E501 """# glTF 2.0. """ # noqa: E501
GLTF = "gltf" GLTF = "gltf"
"""# The OBJ file format. <https://en.wikipedia.org/wiki/Wavefront_.obj_file> It may or may not have an an attached material (mtl // mtllib) within the file, but we interact with it as if it does not. """ # noqa: E501 """# The OBJ file format. <https://en.wikipedia.org/wiki/Wavefront_.obj_file> It may or may not have an an attached material (mtl // mtllib) within the file, but we interact with it as if it does not. """ # noqa: E501
OBJ = "obj" OBJ = "obj"
"""# The PLY file format. <https://en.wikipedia.org/wiki/PLY_(file_format)> """ # noqa: E501 """# The PLY file format. <https://en.wikipedia.org/wiki/PLY_(file_format)> """ # noqa: E501
PLY = "ply" PLY = "ply"
"""# SolidWorks part (SLDPRT) format. """ # noqa: E501
SLDPRT = "sldprt"
"""# The STEP file format. <https://en.wikipedia.org/wiki/ISO_10303-21> """ # noqa: E501 """# The STEP file format. <https://en.wikipedia.org/wiki/ISO_10303-21> """ # noqa: E501
STEP = "step" STEP = "step"
"""# The STL file format. <https://en.wikipedia.org/wiki/STL_(file_format)> """ # noqa: E501 """# The STL file format. <https://en.wikipedia.org/wiki/STL_(file_format)> """ # noqa: E501

View File

@ -11,7 +11,7 @@ from ..models.unit_mass import UnitMass
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
OH = TypeVar("OH", bound="FileMass") LK = TypeVar("LK", bound="FileMass")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -94,7 +94,7 @@ class FileMass:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[OH], src_dict: Dict[str, Any]) -> OH: def from_dict(cls: Type[LK], src_dict: Dict[str, Any]) -> LK:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]

View File

@ -10,7 +10,7 @@ from ..models.unit_area import UnitArea
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
VI = TypeVar("VI", bound="FileSurfaceArea") AR = TypeVar("AR", bound="FileSurfaceArea")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -84,7 +84,7 @@ class FileSurfaceArea:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> VI: def from_dict(cls: Type[AR], src_dict: Dict[str, Any]) -> AR:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
ET = TypeVar("ET", bound="FileSystemMetadata") WB = TypeVar("WB", bound="FileSystemMetadata")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -29,7 +29,7 @@ class FileSystemMetadata:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[ET], src_dict: Dict[str, Any]) -> ET: def from_dict(cls: Type[WB], src_dict: Dict[str, Any]) -> WB:
d = src_dict.copy() d = src_dict.copy()
ok = d.pop("ok", UNSET) ok = d.pop("ok", UNSET)

View File

@ -10,7 +10,7 @@ from ..models.unit_volume import UnitVolume
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset from ..types import UNSET, Unset
QF = TypeVar("QF", bound="FileVolume") KK = TypeVar("KK", bound="FileVolume")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -84,7 +84,7 @@ class FileVolume:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[QF], src_dict: Dict[str, Any]) -> QF: def from_dict(cls: Type[KK], src_dict: Dict[str, Any]) -> KK:
d = src_dict.copy() d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET) _completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime] completed_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
DI = TypeVar("DI", bound="Gateway") HC = TypeVar("HC", bound="Gateway")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -43,7 +43,7 @@ class Gateway:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[DI], src_dict: Dict[str, Any]) -> DI: def from_dict(cls: Type[HC], src_dict: Dict[str, Any]) -> HC:
d = src_dict.copy() d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET) auth_timeout = d.pop("auth_timeout", UNSET)

View File

@ -0,0 +1,62 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.entity_type import EntityType
from ..types import UNSET, Unset
FM = TypeVar("FM", bound="GetEntityType")
@attr.s(auto_attribs=True)
class GetEntityType:
"""The response from the `GetEntityType` command.""" # noqa: E501
entity_type: Union[Unset, EntityType] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.entity_type, Unset):
entity_type = self.entity_type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_type is not UNSET:
field_dict["entity_type"] = entity_type
return field_dict
@classmethod
def from_dict(cls: Type[FM], src_dict: Dict[str, Any]) -> FM:
d = src_dict.copy()
_entity_type = d.pop("entity_type", UNSET)
entity_type: Union[Unset, EntityType]
if isinstance(_entity_type, Unset):
entity_type = UNSET
else:
entity_type = _entity_type # type: ignore[arg-type]
get_entity_type = cls(
entity_type=entity_type,
)
get_entity_type.additional_properties = d
return get_entity_type
@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,15 @@
from enum import Enum
class GltfPresentation(str, Enum):
"""Describes the presentation style of the glTF JSON.""" # noqa: E501
"""# Condense the JSON into the smallest possible size. """ # noqa: E501
COMPACT = "compact"
"""# Expand the JSON into a more human readable format.
This is the default setting. """ # noqa: E501
PRETTY = "pretty"
def __str__(self) -> str:
return str(self.value)

View File

@ -1,14 +1,12 @@
from enum import Enum from enum import Enum
class Storage(str, Enum): class GltfStorage(str, Enum):
"""Describes the storage format of a glTF 2.0 scene.""" # noqa: E501 """Describes the storage format of a glTF 2.0 scene.""" # noqa: E501
"""# Binary glTF 2.0. """# Binary glTF 2.0.
This is a single binary with .glb extension. This is a single binary with .glb extension. """ # noqa: E501
This is the default setting. """ # noqa: E501
BINARY = "binary" BINARY = "binary"
"""# Standard glTF 2.0. """# Standard glTF 2.0.
@ -16,7 +14,9 @@ This is a JSON file with .gltf extension paired with a separate binary blob file
STANDARD = "standard" STANDARD = "standard"
"""# Embedded glTF 2.0. """# Embedded glTF 2.0.
Single JSON file with .gltf extension binary data encoded as base64 data URIs. """ # noqa: E501 Single JSON file with .gltf extension binary data encoded as base64 data URIs.
This is the default setting. """ # noqa: E501
EMBEDDED = "embedded" EMBEDDED = "embedded"
def __str__(self) -> str: def __str__(self) -> str:

View File

@ -0,0 +1,62 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
PV = TypeVar("PV", bound="HighlightSetEntity")
@attr.s(auto_attribs=True)
class HighlightSetEntity:
"""The response from the `HighlightSetEntity` command.""" # noqa: E501
entity_id: Union[Unset, str] = UNSET
sequence: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entity_id = self.entity_id
sequence = self.sequence
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_id is not UNSET:
field_dict["entity_id"] = entity_id
if sequence is not UNSET:
field_dict["sequence"] = sequence
return field_dict
@classmethod
def from_dict(cls: Type[PV], src_dict: Dict[str, Any]) -> PV:
d = src_dict.copy()
entity_id = d.pop("entity_id", UNSET)
sequence = d.pop("sequence", UNSET)
highlight_set_entity = cls(
entity_id=entity_id,
sequence=sequence,
)
highlight_set_entity.additional_properties = d
return highlight_set_entity
@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,71 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
QI = TypeVar("QI", bound="IceServer")
@attr.s(auto_attribs=True)
class IceServer:
"""Representation of an ICE server used for STUN/TURN Used to initiate WebRTC connections based on <https://developer.mozilla.org/en-US/docs/Web/API/RTCIceServer>""" # noqa: E501
credential: Union[Unset, str] = UNSET
urls: Union[Unset, List[str]] = UNSET
username: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
credential = self.credential
urls: Union[Unset, List[str]] = UNSET
if not isinstance(self.urls, Unset):
urls = self.urls
username = self.username
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if credential is not UNSET:
field_dict["credential"] = credential
if urls is not UNSET:
field_dict["urls"] = urls
if username is not UNSET:
field_dict["username"] = username
return field_dict
@classmethod
def from_dict(cls: Type[QI], src_dict: Dict[str, Any]) -> QI:
d = src_dict.copy()
credential = d.pop("credential", UNSET)
urls = cast(List[str], d.pop("urls", UNSET))
username = d.pop("username", UNSET)
ice_server = cls(
credential=credential,
urls=urls,
username=username,
)
ice_server.additional_properties = d
return ice_server
@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,13 @@
from enum import Enum
class ImageFormat(str, Enum):
"""Enum containing the variety of image formats snapshots may be exported to.""" # noqa: E501
"""# .png format """ # noqa: E501
PNG = "png"
"""# .jpeg format """ # noqa: E501
JPEG = "jpeg"
def __str__(self) -> str:
return str(self.value)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
OJ = TypeVar("OJ", bound="IndexInfo") TP = TypeVar("TP", bound="IndexInfo")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -41,7 +41,7 @@ class IndexInfo:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[OJ], src_dict: Dict[str, Any]) -> OJ: def from_dict(cls: Type[TP], src_dict: Dict[str, Any]) -> TP:
d = src_dict.copy() d = src_dict.copy()
mirrors = cast(List[str], d.pop("mirrors", UNSET)) mirrors = cast(List[str], d.pop("mirrors", UNSET))

View File

@ -6,7 +6,57 @@ from ..models.system import System
from ..models.unit_length import UnitLength from ..models.unit_length import UnitLength
from ..types import UNSET, Unset from ..types import UNSET, Unset
UF = TypeVar("UF", bound="gltf") CF = TypeVar("CF", bound="fbx")
@attr.s(auto_attribs=True)
class fbx:
"""Autodesk Filmbox (FBX) format.""" # noqa: E501
type: str = "fbx"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[CF], src_dict: Dict[str, Any]) -> CF:
d = src_dict.copy()
type = d.pop("type", UNSET)
fbx = cls(
type=type,
)
fbx.additional_properties = d
return fbx
@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
OM = TypeVar("OM", bound="gltf")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -28,7 +78,7 @@ class gltf:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[UF], src_dict: Dict[str, Any]) -> UF: def from_dict(cls: Type[OM], src_dict: Dict[str, Any]) -> OM:
d = src_dict.copy() d = src_dict.copy()
type = d.pop("type", UNSET) type = d.pop("type", UNSET)
@ -56,57 +106,7 @@ class gltf:
return key in self.additional_properties return key in self.additional_properties
YF = TypeVar("YF", bound="step") EN = TypeVar("EN", bound="obj")
@attr.s(auto_attribs=True)
class step:
"""ISO 10303-21 (STEP) format.""" # noqa: E501
type: str = "step"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[YF], src_dict: Dict[str, Any]) -> YF:
d = src_dict.copy()
type = d.pop("type", UNSET)
step = cls(
type=type,
)
step.additional_properties = d
return step
@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
PY = TypeVar("PY", bound="obj")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -138,7 +138,7 @@ class obj:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[PY], src_dict: Dict[str, Any]) -> PY: def from_dict(cls: Type[EN], src_dict: Dict[str, Any]) -> EN:
d = src_dict.copy() d = src_dict.copy()
_coords = d.pop("coords", UNSET) _coords = d.pop("coords", UNSET)
coords: Union[Unset, System] coords: Union[Unset, System]
@ -182,7 +182,7 @@ class obj:
return key in self.additional_properties return key in self.additional_properties
LK = TypeVar("LK", bound="ply") RS = TypeVar("RS", bound="ply")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -214,7 +214,7 @@ class ply:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[LK], src_dict: Dict[str, Any]) -> LK: def from_dict(cls: Type[RS], src_dict: Dict[str, Any]) -> RS:
d = src_dict.copy() d = src_dict.copy()
_coords = d.pop("coords", UNSET) _coords = d.pop("coords", UNSET)
coords: Union[Unset, System] coords: Union[Unset, System]
@ -258,7 +258,107 @@ class ply:
return key in self.additional_properties return key in self.additional_properties
AR = TypeVar("AR", bound="stl") LR = TypeVar("LR", bound="sldprt")
@attr.s(auto_attribs=True)
class sldprt:
"""SolidWorks part (SLDPRT) format.""" # noqa: E501
type: str = "sldprt"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[LR], src_dict: Dict[str, Any]) -> LR:
d = src_dict.copy()
type = d.pop("type", UNSET)
sldprt = cls(
type=type,
)
sldprt.additional_properties = d
return sldprt
@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
MP = TypeVar("MP", bound="step")
@attr.s(auto_attribs=True)
class step:
"""ISO 10303-21 (STEP) format.""" # noqa: E501
type: str = "step"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[MP], src_dict: Dict[str, Any]) -> MP:
d = src_dict.copy()
type = d.pop("type", UNSET)
step = cls(
type=type,
)
step.additional_properties = d
return step
@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
WF = TypeVar("WF", bound="stl")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -290,7 +390,7 @@ class stl:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[AR], src_dict: Dict[str, Any]) -> AR: def from_dict(cls: Type[WF], src_dict: Dict[str, Any]) -> WF:
d = src_dict.copy() d = src_dict.copy()
_coords = d.pop("coords", UNSET) _coords = d.pop("coords", UNSET)
coords: Union[Unset, System] coords: Union[Unset, System]
@ -334,4 +434,4 @@ class stl:
return key in self.additional_properties return key in self.additional_properties
InputFormat = Union[gltf, step, obj, ply, stl] InputFormat = Union[fbx, gltf, obj, ply, sldprt, step, stl]

View File

@ -8,7 +8,7 @@ from ..models.currency import Currency
from ..models.invoice_status import InvoiceStatus from ..models.invoice_status import InvoiceStatus
from ..types import UNSET, Unset from ..types import UNSET, Unset
WB = TypeVar("WB", bound="Invoice") RO = TypeVar("RO", bound="Invoice")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -33,7 +33,7 @@ class Invoice:
from ..models.invoice_line_item import InvoiceLineItem from ..models.invoice_line_item import InvoiceLineItem
lines: Union[Unset, List[InvoiceLineItem]] = UNSET lines: Union[Unset, List[InvoiceLineItem]] = UNSET
metadata: Union[Unset, Any] = UNSET metadata: Union[Unset, Dict[str, str]] = UNSET
number: Union[Unset, str] = UNSET number: Union[Unset, str] = UNSET
paid: Union[Unset, bool] = False paid: Union[Unset, bool] = False
pdf: Union[Unset, str] = UNSET pdf: Union[Unset, str] = UNSET
@ -74,6 +74,7 @@ class Invoice:
if not isinstance(self.lines, Unset): if not isinstance(self.lines, Unset):
lines = self.lines lines = self.lines
metadata = self.metadata metadata = self.metadata
number = self.number number = self.number
paid = self.paid paid = self.paid
pdf = self.pdf pdf = self.pdf
@ -143,7 +144,7 @@ class Invoice:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[WB], src_dict: Dict[str, Any]) -> WB: def from_dict(cls: Type[RO], src_dict: Dict[str, Any]) -> RO:
d = src_dict.copy() d = src_dict.copy()
amount_due = d.pop("amount_due", UNSET) amount_due = d.pop("amount_due", UNSET)
@ -188,6 +189,7 @@ class Invoice:
lines = cast(List[InvoiceLineItem], d.pop("lines", UNSET)) lines = cast(List[InvoiceLineItem], d.pop("lines", UNSET))
metadata = d.pop("metadata", UNSET) metadata = d.pop("metadata", UNSET)
number = d.pop("number", UNSET) number = d.pop("number", UNSET)
paid = d.pop("paid", UNSET) paid = d.pop("paid", UNSET)

View File

@ -5,7 +5,7 @@ import attr
from ..models.currency import Currency from ..models.currency import Currency
from ..types import UNSET, Unset from ..types import UNSET, Unset
KK = TypeVar("KK", bound="InvoiceLineItem") DN = TypeVar("DN", bound="InvoiceLineItem")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -17,7 +17,7 @@ class InvoiceLineItem:
description: Union[Unset, str] = UNSET description: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET id: Union[Unset, str] = UNSET
invoice_item: Union[Unset, str] = UNSET invoice_item: Union[Unset, str] = UNSET
metadata: Union[Unset, Any] = UNSET metadata: Union[Unset, Dict[str, str]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
@ -49,7 +49,7 @@ class InvoiceLineItem:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[KK], src_dict: Dict[str, Any]) -> KK: def from_dict(cls: Type[DN], src_dict: Dict[str, Any]) -> DN:
d = src_dict.copy() d = src_dict.copy()
amount = d.pop("amount", UNSET) amount = d.pop("amount", UNSET)

View File

@ -7,7 +7,7 @@ from ..models.jetstream_stats import JetstreamStats
from ..models.meta_cluster_info import MetaClusterInfo from ..models.meta_cluster_info import MetaClusterInfo
from ..types import UNSET, Unset from ..types import UNSET, Unset
HC = TypeVar("HC", bound="Jetstream") BA = TypeVar("BA", bound="Jetstream")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -41,7 +41,7 @@ class Jetstream:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[HC], src_dict: Dict[str, Any]) -> HC: def from_dict(cls: Type[BA], src_dict: Dict[str, Any]) -> BA:
d = src_dict.copy() d = src_dict.copy()
_config = d.pop("config", UNSET) _config = d.pop("config", UNSET)
config: Union[Unset, JetstreamConfig] config: Union[Unset, JetstreamConfig]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
FM = TypeVar("FM", bound="JetstreamApiStats") OR = TypeVar("OR", bound="JetstreamApiStats")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class JetstreamApiStats:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[FM], src_dict: Dict[str, Any]) -> FM: def from_dict(cls: Type[OR], src_dict: Dict[str, Any]) -> OR:
d = src_dict.copy() d = src_dict.copy()
errors = d.pop("errors", UNSET) errors = d.pop("errors", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
PV = TypeVar("PV", bound="JetstreamConfig") CB = TypeVar("CB", bound="JetstreamConfig")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class JetstreamConfig:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[PV], src_dict: Dict[str, Any]) -> PV: def from_dict(cls: Type[CB], src_dict: Dict[str, Any]) -> CB:
d = src_dict.copy() d = src_dict.copy()
domain = d.pop("domain", UNSET) domain = d.pop("domain", UNSET)

View File

@ -5,7 +5,7 @@ import attr
from ..models.jetstream_api_stats import JetstreamApiStats from ..models.jetstream_api_stats import JetstreamApiStats
from ..types import UNSET, Unset from ..types import UNSET, Unset
QI = TypeVar("QI", bound="JetstreamStats") LC = TypeVar("LC", bound="JetstreamStats")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -53,7 +53,7 @@ class JetstreamStats:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[QI], src_dict: Dict[str, Any]) -> QI: def from_dict(cls: Type[LC], src_dict: Dict[str, Any]) -> LC:
d = src_dict.copy() d = src_dict.copy()
accounts = d.pop("accounts", UNSET) accounts = d.pop("accounts", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
TP = TypeVar("TP", bound="LeafNode") TO = TypeVar("TO", bound="LeafNode")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class LeafNode:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[TP], src_dict: Dict[str, Any]) -> TP: def from_dict(cls: Type[TO], src_dict: Dict[str, Any]) -> TO:
d = src_dict.copy() d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET) auth_timeout = d.pop("auth_timeout", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
CF = TypeVar("CF", bound="Mesh") ZP = TypeVar("ZP", bound="Mesh")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -25,7 +25,7 @@ class Mesh:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[CF], src_dict: Dict[str, Any]) -> CF: def from_dict(cls: Type[ZP], src_dict: Dict[str, Any]) -> ZP:
d = src_dict.copy() d = src_dict.copy()
mesh = d.pop("mesh", UNSET) mesh = d.pop("mesh", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
OM = TypeVar("OM", bound="MetaClusterInfo") EO = TypeVar("EO", bound="MetaClusterInfo")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class MetaClusterInfo:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[OM], src_dict: Dict[str, Any]) -> OM: def from_dict(cls: Type[EO], src_dict: Dict[str, Any]) -> EO:
d = src_dict.copy() d = src_dict.copy()
cluster_size = d.pop("cluster_size", UNSET) cluster_size = d.pop("cluster_size", UNSET)

View File

@ -11,7 +11,7 @@ from ..models.file_system_metadata import FileSystemMetadata
from ..models.point_e_metadata import PointEMetadata from ..models.point_e_metadata import PointEMetadata
from ..types import UNSET, Unset from ..types import UNSET, Unset
EN = TypeVar("EN", bound="Metadata") NY = TypeVar("NY", bound="Metadata")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -71,7 +71,7 @@ class Metadata:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[EN], src_dict: Dict[str, Any]) -> EN: def from_dict(cls: Type[NY], src_dict: Dict[str, Any]) -> NY:
d = src_dict.copy() d = src_dict.copy()
_cache = d.pop("cache", UNSET) _cache = d.pop("cache", UNSET)
cache: Union[Unset, CacheMetadata] cache: Union[Unset, CacheMetadata]

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ from ..models.modeling_cmd import ModelingCmd
from ..models.modeling_cmd_id import ModelingCmdId from ..models.modeling_cmd_id import ModelingCmdId
from ..types import UNSET, Unset from ..types import UNSET, Unset
ZG = TypeVar("ZG", bound="ModelingCmdReq") ZX = TypeVar("ZX", bound="ModelingCmdReq")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class ModelingCmdReq:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[ZG], src_dict: Dict[str, Any]) -> ZG: def from_dict(cls: Type[ZX], src_dict: Dict[str, Any]) -> ZX:
d = src_dict.copy() d = src_dict.copy()
_cmd = d.pop("cmd", UNSET) _cmd = d.pop("cmd", UNSET)
cmd: Union[Unset, ModelingCmd] cmd: Union[Unset, ModelingCmd]

View File

@ -2,21 +2,29 @@ from typing import Any, Dict, List, Type, TypeVar, Union
import attr import attr
from ..models.modeling_cmd_req import ModelingCmdReq
from ..types import UNSET, Unset from ..types import UNSET, Unset
LF = TypeVar("LF", bound="ModelingCmdReqBatch") FT = TypeVar("FT", bound="ModelingCmdReqBatch")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
class ModelingCmdReqBatch: class ModelingCmdReqBatch:
"""A batch set of graphics commands submitted to the KittyCAD engine via the Modeling API.""" # noqa: E501 """A batch set of graphics commands submitted to the KittyCAD engine via the Modeling API.""" # noqa: E501
cmds: Union[Unset, Any] = UNSET from ..models.modeling_cmd_req import ModelingCmdReq
cmds: Union[Unset, Dict[str, ModelingCmdReq]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
cmds = self.cmds cmds: Union[Unset, Dict[str, Any]] = UNSET
if not isinstance(self.cmds, Unset):
new_dict: Dict[str, Any] = {}
for key, value in self.cmds.items():
new_dict[key] = value.to_dict()
cmds = new_dict
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties) field_dict.update(self.additional_properties)
@ -27,9 +35,16 @@ class ModelingCmdReqBatch:
return field_dict return field_dict
@classmethod @classmethod
def from_dict(cls: Type[LF], src_dict: Dict[str, Any]) -> LF: def from_dict(cls: Type[FT], src_dict: Dict[str, Any]) -> FT:
d = src_dict.copy() d = src_dict.copy()
cmds = d.pop("cmds", UNSET) _cmds = d.pop("cmds", UNSET)
if isinstance(_cmds, Unset):
cmds = UNSET
else:
new_map: Dict[str, ModelingCmdReq] = {}
for k, v in _cmds.items():
new_map[k] = ModelingCmdReq.from_dict(v) # type: ignore
cmds = new_map # type: ignore
modeling_cmd_req_batch = cls( modeling_cmd_req_batch = cls(
cmds=cmds, cmds=cmds,

Some files were not shown because too many files have changed in this diff Show More