Compare commits

..

13 Commits

Author SHA1 Message Date
493991edd1 updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-10 18:36:19 -07:00
29003eae80 Update api spec (#211)
YOYO NEW API SPEC!

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-10 18:00:02 -07:00
79b977a55a fix test
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-05 13:30:47 -07:00
df9083c3e2 bump version
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-05 13:13:34 -07:00
f3e7f4f229 fix new spec bs
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-05 13:12:19 -07:00
12864cdb44 Merge remote-tracking branch 'origin/update-spec'
* origin/update-spec:
  YOYO NEW API SPEC!
2024-04-05 12:58:43 -07:00
671a0a8391 Bump softprops/action-gh-release from 1 to 2 (#209)
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-05 12:58:12 -07:00
553b1c1fcd YOYO NEW API SPEC! 2024-04-04 20:49:25 +00:00
f040c6454d Update api spec (#205)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-04 13:08:49 -08:00
f0599f6d54 bump
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-03-04 12:54:35 -08:00
042bb964e5 Update api spec (#202)
* YOYO NEW API SPEC!

* updates

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

* updates

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>

* 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>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
2024-03-04 12:53:31 -08:00
a3089ef956 Bump pytest from 7.4.2 to 8.1.0 (#204)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.2 to 8.1.0.
- [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.4.2...8.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-04 12:35:37 -08:00
0683a11b78 Bump attrs from 23.1.0 to 23.2.0 (#201)
Bumps [attrs](https://github.com/sponsors/hynek) from 23.1.0 to 23.2.0.
- [Commits](https://github.com/sponsors/hynek/commits)

---
updated-dependencies:
- dependency-name: attrs
  dependency-type: direct:production
  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>
2024-03-04 12:31:21 -08:00
83 changed files with 4912 additions and 5535 deletions

View File

@ -28,4 +28,4 @@ jobs:
# TODO: generate a nice little doc for the release text like we do for the # TODO: generate a nice little doc for the release text like we do for the
# cli repo. # cli repo.
- name: Create a Release - name: Create a Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v2

View File

@ -35,4 +35,4 @@ jobs:
- name: Run ruff - name: Run ruff
shell: bash shell: bash
run: | run: |
poetry run ruff check --format=github . poetry run ruff check --output-format=github .

View File

@ -154,10 +154,19 @@ class WebSocket:
self.ws = sync( self.ws = sync(
{% for arg in args %} {% for arg in args %}
{% if arg.in_query %} {% if arg.in_query %}
{% if arg.is_optional == False %}
{{arg.name}}, {{arg.name}},
{% endif %} {% endif %}
{% endif %}
{% endfor %} {% endfor %}
client=client, client=client,
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional %}
{{arg.name}}={{arg.name}},
{% endif %}
{% endif %}
{% endfor %}
) )
def __enter__(self, def __enter__(self,

View File

@ -478,6 +478,11 @@ from kittycad.types import Response
for endpoint_ref in endpoint_refs: for endpoint_ref in endpoint_refs:
if endpoint_ref == "Error": if endpoint_ref == "Error":
continue continue
# For some reason, PrivacySettings is showing up twice so we want to skip
# it here. Obviously this is a hack and we should fix the root cause.
# When this happens again with another struct there might be a more obvious
# solution, but alas, I am lazy.
if endpoint_ref != "PrivacySettings" and endpoint_ref != "List[str]":
example_imports = example_imports + ( example_imports = example_imports + (
"""from kittycad.models import """ """from kittycad.models import """
+ endpoint_ref.replace("List[", "").replace("]", "") + endpoint_ref.replace("List[", "").replace("]", "")
@ -841,6 +846,20 @@ async def test_"""
"\t\t\tfor item in response.json()\n" "\t\t\tfor item in response.json()\n"
) )
parse_response.write("\t\t]\n") parse_response.write("\t\t]\n")
elif "type" in items:
if items["type"] == "string":
parse_response.write(
"\t\tresponse_"
+ response_code
+ " = [\n"
)
parse_response.write("\t\t\tstr(**item)\n")
parse_response.write(
"\t\t\tfor item in response.json()\n"
)
parse_response.write("\t\t]\n")
else:
raise Exception("Unknown array type", items)
else: else:
raise Exception("Unknown array type") raise Exception("Unknown array type")
elif json["type"] == "string": elif json["type"] == "string":
@ -1577,7 +1596,7 @@ def generateObjectTypeCode(
description = "" description = ""
if "description" in schema: if "description" in schema:
description = schema["description"] description = schema["description"].replace('"', '\\"')
imports = [] imports = []
refs = getRefs(schema) refs = getRefs(schema)
@ -1677,8 +1696,9 @@ def getRefs(schema: dict) -> List[str]:
# do nothing # do nothing
pass pass
else: else:
logging.error("unsupported type: ", schema) # This is likely an empty object like above but with a description
raise Exception("unsupported type: ", schema) # so we will just skip it.
pass
elif type_name == "array": elif type_name == "array":
if "items" in schema: if "items" in schema:
schema_refs = getRefs(schema["items"]) schema_refs = getRefs(schema["items"])
@ -1722,8 +1742,13 @@ def getEndpointRefs(endpoint: dict, data: dict) -> List[str]:
if "$ref" in items: if "$ref" in items:
ref = items["$ref"].replace("#/components/schemas/", "") ref = items["$ref"].replace("#/components/schemas/", "")
refs.append("List[" + ref + "]") refs.append("List[" + ref + "]")
elif "type" in items:
if items["type"] == "string":
refs.append("List[str]")
else: else:
raise Exception("Unknown array type") raise Exception("Unknown array type", items)
else:
raise Exception("Unknown array type", items)
elif json["type"] == "string": elif json["type"] == "string":
refs.append("str") refs.append("str")
elif ( elif (
@ -1801,6 +1826,11 @@ def getRequestBodyRefs(endpoint: dict) -> List[str]:
if "$ref" in form: if "$ref" in form:
ref = form["$ref"].replace("#/components/schemas/", "") ref = form["$ref"].replace("#/components/schemas/", "")
refs.append(ref) refs.append(ref)
elif content_type == "multipart/form-data":
form = content[content_type]["schema"]
if "$ref" in form:
ref = form["$ref"].replace("#/components/schemas/", "")
refs.append(ref)
else: else:
# Throw an error for an unsupported content type. # Throw an error for an unsupported content type.
logging.error("content: ", content) logging.error("content: ", content)
@ -1839,6 +1869,15 @@ def getRequestBodyTypeSchema(
elif form != {}: elif form != {}:
logging.error("not a ref: ", form) logging.error("not a ref: ", form)
raise Exception("not a ref") raise Exception("not a ref")
elif content_type == "multipart/form-data":
form = content[content_type]["schema"]
if "$ref" in form:
ref = form["$ref"].replace("#/components/schemas/", "")
type_schema = data["components"]["schemas"][ref]
return ref, type_schema
elif form != {}:
type_schema = form
return None, type_schema
else: else:
logging.error("unsupported content type: ", content_type) logging.error("unsupported content type: ", content_type)
raise Exception("unsupported content type") raise Exception("unsupported content type")

File diff suppressed because it is too large Load Diff

View File

@ -79,6 +79,7 @@ def sync(
*, *,
client: Client, client: Client,
) -> Optional[Union[KclCodeCompletionResponse, Error]]: ) -> Optional[Union[KclCodeCompletionResponse, Error]]:
return sync_detailed( return sync_detailed(
body=body, body=body,
client=client, client=client,
@ -106,6 +107,7 @@ async def asyncio(
*, *,
client: Client, client: Client,
) -> Optional[Union[KclCodeCompletionResponse, Error]]: ) -> Optional[Union[KclCodeCompletionResponse, Error]]:
return ( return (
await asyncio_detailed( await asyncio_detailed(
body=body, body=body,

View File

@ -20,6 +20,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if feedback is not None: if feedback is not None:
if "?" in url: if "?" in url:
url = url + "&feedback=" + str(feedback) url = url + "&feedback=" + str(feedback)
else: else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -22,24 +22,28 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:
url = url + "?sort_by=" + str(sort_by) url = url + "?sort_by=" + str(sort_by)
if no_models is not None: if no_models is not None:
if "?" in url: if "?" in url:
url = url + "&no_models=" + str(no_models) url = url + "&no_models=" + str(no_models)
else: else:

View File

@ -19,6 +19,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if group_by is not None: if group_by is not None:
if "?" in url: if "?" in url:
url = url + "&group_by=" + str(group_by) url = url + "&group_by=" + str(group_by)
else: else:

View File

@ -35,9 +35,7 @@ def _get_kwargs(
} }
def _parse_response( def _parse_response(*, response: httpx.Response) -> Optional[
*, response: httpx.Response
) -> Optional[
Union[ Union[
FileConversion, FileConversion,
FileCenterOfMass, FileCenterOfMass,
@ -123,9 +121,7 @@ def _parse_response(
return Error(**response.json()) return Error(**response.json())
def _build_response( def _build_response(*, response: httpx.Response) -> Response[
*, response: httpx.Response
) -> Response[
Optional[ Optional[
Union[ Union[
FileConversion, FileConversion,

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -23,18 +23,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -23,24 +23,28 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:
url = url + "?sort_by=" + str(sort_by) url = url + "?sort_by=" + str(sort_by)
if status is not None: if status is not None:
if "?" in url: if "?" in url:
url = url + "&status=" + str(status) url = url + "&status=" + str(status)
else: else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -18,6 +18,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if label is not None: if label is not None:
if "?" in url: if "?" in url:
url = url + "&label=" + str(label) url = url + "&label=" + str(label)
else: else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -22,6 +22,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if output is not None: if output is not None:
if "?" in url: if "?" in url:
url = url + "&output=" + str(output) url = url + "&output=" + str(output)
else: else:
@ -40,9 +41,9 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[CodeOutput, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[CodeOutput, Error]]:
if response.status_code == 200: if response.status_code == 201:
response_200 = CodeOutput(**response.json()) response_201 = CodeOutput(**response.json())
return response_200 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error(**response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
@ -92,6 +93,7 @@ def sync(
client: Client, client: Client,
output: Optional[str] = None, output: Optional[str] = None,
) -> Optional[Union[CodeOutput, Error]]: ) -> Optional[Union[CodeOutput, Error]]:
return sync_detailed( return sync_detailed(
lang=lang, lang=lang,
output=output, output=output,
@ -127,6 +129,7 @@ async def asyncio(
client: Client, client: Client,
output: Optional[str] = None, output: Optional[str] = None,
) -> Optional[Union[CodeOutput, Error]]: ) -> Optional[Union[CodeOutput, Error]]:
return ( return (
await asyncio_detailed( await asyncio_detailed(
lang=lang, lang=lang,

View File

@ -22,12 +22,14 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if output_unit is not None: if output_unit is not None:
if "?" in url: if "?" in url:
url = url + "&output_unit=" + str(output_unit) url = url + "&output_unit=" + str(output_unit)
else: else:
url = url + "?output_unit=" + str(output_unit) url = url + "?output_unit=" + str(output_unit)
if src_format is not None: if src_format is not None:
if "?" in url: if "?" in url:
url = url + "&src_format=" + str(src_format) url = url + "&src_format=" + str(src_format)
else: else:

View File

@ -25,24 +25,28 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if material_mass is not None: if material_mass is not None:
if "?" in url: if "?" in url:
url = url + "&material_mass=" + str(material_mass) url = url + "&material_mass=" + str(material_mass)
else: else:
url = url + "?material_mass=" + str(material_mass) url = url + "?material_mass=" + str(material_mass)
if material_mass_unit is not None: if material_mass_unit is not None:
if "?" in url: if "?" in url:
url = url + "&material_mass_unit=" + str(material_mass_unit) url = url + "&material_mass_unit=" + str(material_mass_unit)
else: else:
url = url + "?material_mass_unit=" + str(material_mass_unit) url = url + "?material_mass_unit=" + str(material_mass_unit)
if output_unit is not None: if output_unit is not None:
if "?" in url: if "?" in url:
url = url + "&output_unit=" + str(output_unit) url = url + "&output_unit=" + str(output_unit)
else: else:
url = url + "?output_unit=" + str(output_unit) url = url + "?output_unit=" + str(output_unit)
if src_format is not None: if src_format is not None:
if "?" in url: if "?" in url:
url = url + "&src_format=" + str(src_format) url = url + "&src_format=" + str(src_format)
else: else:

View File

@ -25,24 +25,28 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if material_density is not None: if material_density is not None:
if "?" in url: if "?" in url:
url = url + "&material_density=" + str(material_density) url = url + "&material_density=" + str(material_density)
else: else:
url = url + "?material_density=" + str(material_density) url = url + "?material_density=" + str(material_density)
if material_density_unit is not None: if material_density_unit is not None:
if "?" in url: if "?" in url:
url = url + "&material_density_unit=" + str(material_density_unit) url = url + "&material_density_unit=" + str(material_density_unit)
else: else:
url = url + "?material_density_unit=" + str(material_density_unit) url = url + "?material_density_unit=" + str(material_density_unit)
if output_unit is not None: if output_unit is not None:
if "?" in url: if "?" in url:
url = url + "&output_unit=" + str(output_unit) url = url + "&output_unit=" + str(output_unit)
else: else:
url = url + "?output_unit=" + str(output_unit) url = url + "?output_unit=" + str(output_unit)
if src_format is not None: if src_format is not None:
if "?" in url: if "?" in url:
url = url + "&src_format=" + str(src_format) url = url + "&src_format=" + str(src_format)
else: else:

View File

@ -22,12 +22,14 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if output_unit is not None: if output_unit is not None:
if "?" in url: if "?" in url:
url = url + "&output_unit=" + str(output_unit) url = url + "&output_unit=" + str(output_unit)
else: else:
url = url + "?output_unit=" + str(output_unit) url = url + "?output_unit=" + str(output_unit)
if src_format is not None: if src_format is not None:
if "?" in url: if "?" in url:
url = url + "&src_format=" + str(src_format) url = url + "&src_format=" + str(src_format)
else: else:

View File

@ -22,12 +22,14 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if output_unit is not None: if output_unit is not None:
if "?" in url: if "?" in url:
url = url + "&output_unit=" + str(output_unit) url = url + "&output_unit=" + str(output_unit)
else: else:
url = url + "?output_unit=" + str(output_unit) url = url + "?output_unit=" + str(output_unit)
if src_format is not None: if src_format is not None:
if "?" in url: if "?" in url:
url = url + "&src_format=" + str(src_format) url = url + "&src_format=" + str(src_format)
else: else:

View File

@ -79,6 +79,7 @@ def sync(
*, *,
client: Client, client: Client,
) -> Optional[Union[VerificationTokenResponse, Error]]: ) -> Optional[Union[VerificationTokenResponse, Error]]:
return sync_detailed( return sync_detailed(
body=body, body=body,
client=client, client=client,
@ -106,6 +107,7 @@ async def asyncio(
*, *,
client: Client, client: Client,
) -> Optional[Union[VerificationTokenResponse, Error]]: ) -> Optional[Union[VerificationTokenResponse, Error]]:
return ( return (
await asyncio_detailed( await asyncio_detailed(
body=body, body=body,

View File

@ -19,18 +19,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if callback_url is not None: if callback_url is not None:
if "?" in url: if "?" in url:
url = url + "&callback_url=" + str(callback_url) url = url + "&callback_url=" + str(callback_url)
else: else:
url = url + "?callback_url=" + str(callback_url) url = url + "?callback_url=" + str(callback_url)
if email is not None: if email is not None:
if "?" in url: if "?" in url:
url = url + "&email=" + str(email) url = url + "&email=" + str(email)
else: else:
url = url + "?email=" + str(email) url = url + "?email=" + str(email)
if token is not None: if token is not None:
if "?" in url: if "?" in url:
url = url + "&token=" + str(token) url = url + "&token=" + str(token)
else: else:
@ -96,6 +99,7 @@ def sync(
client: Client, client: Client,
callback_url: Optional[str] = None, callback_url: Optional[str] = None,
) -> Optional[Error]: ) -> Optional[Error]:
return sync_detailed( return sync_detailed(
callback_url=callback_url, callback_url=callback_url,
email=email, email=email,
@ -131,6 +135,7 @@ async def asyncio(
client: Client, client: Client,
callback_url: Optional[str] = None, callback_url: Optional[str] = None,
) -> Optional[Error]: ) -> Optional[Error]:
return ( return (
await asyncio_detailed( await asyncio_detailed(
callback_url=callback_url, callback_url=callback_url,

View File

@ -20,6 +20,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if callback_url is not None: if callback_url is not None:
if "?" in url: if "?" in url:
url = url + "&callback_url=" + str(callback_url) url = url + "&callback_url=" + str(callback_url)
else: else:

View File

@ -77,6 +77,7 @@ def sync(
*, *,
client: Client, client: Client,
) -> Optional[Error]: ) -> Optional[Error]:
return sync_detailed( return sync_detailed(
provider_id=provider_id, provider_id=provider_id,
body=body, body=body,
@ -108,6 +109,7 @@ async def asyncio(
*, *,
client: Client, client: Client,
) -> Optional[Error]: ) -> Optional[Error]:
return ( return (
await asyncio_detailed( await asyncio_detailed(
provider_id=provider_id, provider_id=provider_id,

View File

@ -0,0 +1,104 @@
from typing import Any, Dict, List, Optional, Union
import httpx
from ...client import Client
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/debug/uploads".format(
client.base_url,
) # noqa: E501
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[List[str], Error]]:
if response.status_code == 201:
response_201 = [str(**item) for item in response.json()]
return response_201
if response.status_code == 400:
response_4XX = Error(**response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error(**response.json())
return response_5XX
return Error(**response.json())
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[List[str], Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Optional[Union[List[str], Error]]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[List[str], Error]]:
"""Do NOT send files here that you don't want to be public.""" # noqa: E501
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Optional[Union[List[str], Error]]]:
kwargs = _get_kwargs(
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
*,
client: Client,
) -> Optional[Union[List[str], Error]]:
"""Do NOT send files here that you don't want to be public.""" # noqa: E501
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -0,0 +1,111 @@
from typing import Any, Dict, Optional
import httpx
from ...client import Client
from ...models.error import Error
from ...models.event import Event
from ...types import Response
def _get_kwargs(
body: Event,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/events".format(
client.base_url,
) # noqa: E501
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body.model_dump_json(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None
if response.status_code == 400:
response_4XX = Error(**response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error(**response.json())
return response_5XX
return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
body: Event,
*,
client: Client,
) -> Response[Optional[Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
body: Event,
*,
client: Client,
) -> Optional[Error]:
"""We collect anonymous telemetry data for improving our product.""" # noqa: E501
return sync_detailed(
body=body,
client=client,
).parsed
async def asyncio_detailed(
body: Event,
*,
client: Client,
) -> Response[Optional[Error]]:
kwargs = _get_kwargs(
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
body: Event,
*,
client: Client,
) -> Optional[Error]:
"""We collect anonymous telemetry data for improving our product.""" # noqa: E501
return (
await asyncio_detailed(
body=body,
client=client,
)
).parsed

View File

@ -71,6 +71,7 @@ def sync(
*, *,
client: Client, client: Client,
) -> Optional[Union[IpAddrInfo, Error]]: ) -> Optional[Union[IpAddrInfo, Error]]:
return sync_detailed( return sync_detailed(
client=client, client=client,
).parsed ).parsed
@ -94,6 +95,7 @@ async def asyncio(
*, *,
client: Client, client: Client,
) -> Optional[Union[IpAddrInfo, Error]]: ) -> Optional[Union[IpAddrInfo, Error]]:
return ( return (
await asyncio_detailed( await asyncio_detailed(
client=client, client=client,

View File

@ -70,6 +70,7 @@ def sync(
*, *,
client: Client, client: Client,
) -> Optional[Union[dict, Error]]: ) -> Optional[Union[dict, Error]]:
return sync_detailed( return sync_detailed(
client=client, client=client,
).parsed ).parsed
@ -93,6 +94,7 @@ async def asyncio(
*, *,
client: Client, client: Client,
) -> Optional[Union[dict, Error]]: ) -> Optional[Union[dict, Error]]:
return ( return (
await asyncio_detailed( await asyncio_detailed(
client=client, client=client,

View File

@ -71,6 +71,7 @@ def sync(
*, *,
client: Client, client: Client,
) -> Optional[Union[Pong, Error]]: ) -> Optional[Union[Pong, Error]]:
return sync_detailed( return sync_detailed(
client=client, client=client,
).parsed ).parsed
@ -94,6 +95,7 @@ async def asyncio(
*, *,
client: Client, client: Client,
) -> Optional[Union[Pong, Error]]: ) -> Optional[Union[Pong, Error]]:
return ( return (
await asyncio_detailed( await asyncio_detailed(
client=client, client=client,

View File

@ -1,51 +1,73 @@
import json import json
from typing import Any, Dict, Iterator from typing import Any, Dict, Iterator, Optional
import bson import bson
from websockets.client import WebSocketClientProtocol, connect as ws_connect_async from websockets.client import WebSocketClientProtocol, connect as ws_connect_async
from websockets.sync.client import ClientConnection, connect as ws_connect from websockets.sync.client import ClientConnection, connect as ws_connect
from ...client import Client from ...client import Client
from ...models.post_effect_type import PostEffectType
from ...models.web_socket_request import WebSocketRequest from ...models.web_socket_request import WebSocketRequest
from ...models.web_socket_response import WebSocketResponse from ...models.web_socket_response import WebSocketResponse
def _get_kwargs( def _get_kwargs(
fps: int, fps: int,
post_effect: PostEffectType,
unlocked_framerate: bool, unlocked_framerate: bool,
video_res_height: int, video_res_height: int,
video_res_width: int, video_res_width: int,
webrtc: bool, webrtc: bool,
*, *,
client: Client, client: Client,
pool: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/ws/modeling/commands".format(client.base_url) # noqa: E501 url = "{}/ws/modeling/commands".format(client.base_url) # noqa: E501
if fps is not None: if fps is not None:
if "?" in url: if "?" in url:
url = url + "&fps=" + str(fps) url = url + "&fps=" + str(fps)
else: else:
url = url + "?fps=" + str(fps) url = url + "?fps=" + str(fps)
if pool is not None:
if "?" in url:
url = url + "&pool=" + str(pool)
else:
url = url + "?pool=" + str(pool)
if post_effect is not None:
if "?" in url:
url = url + "&post_effect=" + str(post_effect)
else:
url = url + "?post_effect=" + str(post_effect)
if unlocked_framerate is not None: if unlocked_framerate is not None:
if "?" in url: if "?" in url:
url = url + "&unlocked_framerate=" + str(unlocked_framerate).lower() url = url + "&unlocked_framerate=" + str(unlocked_framerate).lower()
else: else:
url = url + "?unlocked_framerate=" + str(unlocked_framerate).lower() url = url + "?unlocked_framerate=" + str(unlocked_framerate).lower()
if video_res_height is not None: if video_res_height is not None:
if "?" in url: if "?" in url:
url = url + "&video_res_height=" + str(video_res_height) url = url + "&video_res_height=" + str(video_res_height)
else: else:
url = url + "?video_res_height=" + str(video_res_height) url = url + "?video_res_height=" + str(video_res_height)
if video_res_width is not None: if video_res_width is not None:
if "?" in url: if "?" in url:
url = url + "&video_res_width=" + str(video_res_width) url = url + "&video_res_width=" + str(video_res_width)
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 webrtc is not None:
if "?" in url: if "?" in url:
url = url + "&webrtc=" + str(webrtc).lower() url = url + "&webrtc=" + str(webrtc).lower()
else: else:
@ -64,17 +86,21 @@ def _get_kwargs(
def sync( def sync(
fps: int, fps: int,
post_effect: PostEffectType,
unlocked_framerate: bool, unlocked_framerate: bool,
video_res_height: int, video_res_height: int,
video_res_width: int, video_res_width: int,
webrtc: bool, webrtc: bool,
*, *,
client: Client, client: Client,
pool: Optional[str] = None,
) -> ClientConnection: ) -> ClientConnection:
"""Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.""" # noqa: E501 """Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.""" # noqa: E501
kwargs = _get_kwargs( kwargs = _get_kwargs(
fps=fps, fps=fps,
pool=pool,
post_effect=post_effect,
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,
@ -87,17 +113,21 @@ def sync(
async def asyncio( async def asyncio(
fps: int, fps: int,
post_effect: PostEffectType,
unlocked_framerate: bool, unlocked_framerate: bool,
video_res_height: int, video_res_height: int,
video_res_width: int, video_res_width: int,
webrtc: bool, webrtc: bool,
*, *,
client: Client, client: Client,
pool: Optional[str] = None,
) -> WebSocketClientProtocol: ) -> WebSocketClientProtocol:
"""Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.""" # noqa: E501 """Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.""" # noqa: E501
kwargs = _get_kwargs( kwargs = _get_kwargs(
fps=fps, fps=fps,
pool=pool,
post_effect=post_effect,
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,
@ -121,19 +151,23 @@ class WebSocket:
def __init__( def __init__(
self, self,
fps: int, fps: int,
post_effect: PostEffectType,
unlocked_framerate: bool, unlocked_framerate: bool,
video_res_height: int, video_res_height: int,
video_res_width: int, video_res_width: int,
webrtc: bool, webrtc: bool,
client: Client, client: Client,
pool: Optional[str] = None,
): ):
self.ws = sync( self.ws = sync(
fps, fps,
post_effect,
unlocked_framerate, unlocked_framerate,
video_res_height, video_res_height,
video_res_width, video_res_width,
webrtc, webrtc,
client=client, client=client,
pool=pool,
) )
def __enter__( def __enter__(

View File

@ -23,24 +23,28 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:
url = url + "?sort_by=" + str(sort_by) url = url + "?sort_by=" + str(sort_by)
if role is not None: if role is not None:
if "?" in url: if "?" in url:
url = url + "&role=" + str(role) url = url + "&role=" + str(role)
else: else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -18,6 +18,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if label is not None: if label is not None:
if "?" in url: if "?" in url:
url = url + "&label=" + str(label) url = url + "&label=" + str(label)
else: else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if value is not None: if value is not None:
if "?" in url: if "?" in url:
url = url + "&value=" + str(value) url = url + "&value=" + str(value)
else: else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501 ) # noqa: E501
if limit is not None: if limit is not None:
if "?" in url: if "?" in url:
url = url + "&limit=" + str(limit) url = url + "&limit=" + str(limit)
else: else:
url = url + "?limit=" + str(limit) url = url + "?limit=" + str(limit)
if page_token is not None: if page_token is not None:
if "?" in url: if "?" in url:
url = url + "&page_token=" + str(page_token) url = url + "&page_token=" + str(page_token)
else: else:
url = url + "?page_token=" + str(page_token) url = url + "?page_token=" + str(page_token)
if sort_by is not None: if sort_by is not None:
if "?" in url: if "?" in url:
url = url + "&sort_by=" + str(sort_by) url = url + "&sort_by=" + str(sort_by)
else: else:

View File

@ -39,6 +39,7 @@ from .models import (
ModelingCmd, ModelingCmd,
ModelingCmdId, ModelingCmdId,
Pong, Pong,
PostEffectType,
System, System,
TextToCad, TextToCad,
TextToCadCreateBody, TextToCadCreateBody,
@ -173,14 +174,14 @@ async def test_file_convert_stl_async():
file.close() file.close()
# Get the fc. # Get the fc.
result: Optional[ result: Optional[Union[FileConversion, Error]] = (
Union[FileConversion, Error] await create_file_conversion.asyncio(
] = await create_file_conversion.asyncio(
client=client, client=client,
body=content, body=content,
src_format=FileImportFormat.STL, src_format=FileImportFormat.STL,
output_format=FileExportFormat.OBJ, output_format=FileExportFormat.OBJ,
) )
)
assert isinstance(result, FileConversion) assert isinstance(result, FileConversion)
@ -212,14 +213,14 @@ async def test_file_convert_obj_async():
file.close() file.close()
# Get the fc. # Get the fc.
result: Optional[ result: Optional[Union[FileConversion, Error]] = (
Union[FileConversion, Error] await create_file_conversion.asyncio(
] = await create_file_conversion.asyncio(
client=client, client=client,
body=content, body=content,
src_format=FileImportFormat.OBJ, src_format=FileImportFormat.OBJ,
output_format=FileExportFormat.STL, output_format=FileExportFormat.STL,
) )
)
assert isinstance(result, FileConversion) assert isinstance(result, FileConversion)
@ -356,6 +357,7 @@ def test_ws_simple():
with modeling_commands_ws.WebSocket( with modeling_commands_ws.WebSocket(
client=client, client=client,
fps=30, fps=30,
post_effect=PostEffectType.NOEFFECT,
unlocked_framerate=False, unlocked_framerate=False,
video_res_height=360, video_res_height=360,
video_res_width=480, video_res_width=480,
@ -383,6 +385,7 @@ def test_ws_import():
with modeling_commands_ws.WebSocket( with modeling_commands_ws.WebSocket(
client=client, client=client,
fps=30, fps=30,
post_effect=PostEffectType.NOEFFECT,
unlocked_framerate=False, unlocked_framerate=False,
video_res_height=360, video_res_height=360,
video_res_width=480, video_res_width=480,
@ -556,12 +559,12 @@ def test_text_to_cad():
while ( while (
body.status == ApiCallStatus.IN_PROGRESS or body.status == ApiCallStatus.QUEUED body.status == ApiCallStatus.IN_PROGRESS or body.status == ApiCallStatus.QUEUED
) and time.time() - start_time < 120: ) and time.time() - start_time < 120:
result_status: Optional[ result_status: Optional[Union[TextToCad, Error]] = (
Union[TextToCad, Error] get_text_to_cad_model_for_user.sync(
] = get_text_to_cad_model_for_user.sync(
client=client, client=client,
id=body.id, id=body.id,
) )
)
if isinstance(result_status, Error) or result_status is None: if isinstance(result_status, Error) or result_status is None:
print(result_status) print(result_status)

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,10 @@ from .axis_direction_pair import AxisDirectionPair
from .billing_info import BillingInfo from .billing_info import BillingInfo
from .block_reason import BlockReason from .block_reason import BlockReason
from .cache_metadata import CacheMetadata from .cache_metadata import CacheMetadata
from .camera_drag_end import CameraDragEnd
from .camera_drag_interaction_type import CameraDragInteractionType from .camera_drag_interaction_type import CameraDragInteractionType
from .camera_drag_move import CameraDragMove
from .camera_settings import CameraSettings
from .card_details import CardDetails from .card_details import CardDetails
from .center_of_mass import CenterOfMass from .center_of_mass import CenterOfMass
from .client_metrics import ClientMetrics from .client_metrics import ClientMetrics
@ -53,6 +56,9 @@ from .curve_get_type import CurveGetType
from .curve_type import CurveType from .curve_type import CurveType
from .customer import Customer from .customer import Customer
from .customer_balance import CustomerBalance from .customer_balance import CustomerBalance
from .default_camera_focus_on import DefaultCameraFocusOn
from .default_camera_get_settings import DefaultCameraGetSettings
from .default_camera_zoom import DefaultCameraZoom
from .density import Density from .density import Density
from .der_encoded_key_pair import DerEncodedKeyPair from .der_encoded_key_pair import DerEncodedKeyPair
from .device_access_token_request_form import DeviceAccessTokenRequestForm from .device_access_token_request_form import DeviceAccessTokenRequestForm
@ -75,12 +81,16 @@ 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 .error_code import ErrorCode
from .event import Event
from .export import Export 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 .extrusion_face_cap_type import ExtrusionFaceCapType from .extrusion_face_cap_type import ExtrusionFaceCapType
from .extrusion_face_info import ExtrusionFaceInfo from .extrusion_face_info import ExtrusionFaceInfo
from .face_get_gradient import FaceGetGradient
from .face_get_position import FaceGetPosition
from .face_is_planar import FaceIsPlanar
from .failure_web_socket_response import FailureWebSocketResponse from .failure_web_socket_response import FailureWebSocketResponse
from .fbx_storage import FbxStorage from .fbx_storage import FbxStorage
from .file_center_of_mass import FileCenterOfMass from .file_center_of_mass import FileCenterOfMass
@ -94,6 +104,7 @@ 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 .get_entity_type import GetEntityType
from .get_num_objects import GetNumObjects
from .get_sketch_mode_plane import GetSketchModePlane from .get_sketch_mode_plane import GetSketchModePlane
from .global_axis import GlobalAxis from .global_axis import GlobalAxis
from .gltf_presentation import GltfPresentation from .gltf_presentation import GltfPresentation
@ -104,6 +115,7 @@ from .idp_metadata_source import IdpMetadataSource
from .image_format import ImageFormat from .image_format import ImageFormat
from .import_file import ImportFile from .import_file import ImportFile
from .import_files import ImportFiles from .import_files import ImportFiles
from .imported_geometry import ImportedGeometry
from .input_format import InputFormat from .input_format import InputFormat
from .invoice import Invoice from .invoice import Invoice
from .invoice_line_item import InvoiceLineItem from .invoice_line_item import InvoiceLineItem
@ -122,6 +134,7 @@ from .mass import Mass
from .meta_cluster_info import MetaClusterInfo from .meta_cluster_info import MetaClusterInfo
from .metadata import Metadata from .metadata import Metadata
from .method import Method from .method import Method
from .modeling_app_event_type import ModelingAppEventType
from .modeling_app_individual_subscription_tier import ( from .modeling_app_individual_subscription_tier import (
ModelingAppIndividualSubscriptionTier, ModelingAppIndividualSubscriptionTier,
) )
@ -166,6 +179,7 @@ from .ply_storage import PlyStorage
from .point2d import Point2d from .point2d import Point2d
from .point3d import Point3d from .point3d import Point3d
from .pong import Pong from .pong import Pong
from .post_effect_type import PostEffectType
from .privacy_settings import PrivacySettings from .privacy_settings import PrivacySettings
from .raw_file import RawFile from .raw_file import RawFile
from .rtc_ice_candidate_init import RtcIceCandidateInit from .rtc_ice_candidate_init import RtcIceCandidateInit

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings
class CameraDragEnd(BaseModel):
"""The response from the `CameraDragEnd` command."""
settings: CameraSettings
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings
class CameraDragMove(BaseModel):
"""The response from the `CameraDragMove` command. Note this is an \"unreliable\" channel message, so this data may need more data like a \"sequence\" """
settings: CameraSettings
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,23 @@
from typing import Optional
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d
class CameraSettings(BaseModel):
"""Camera settings including position, center, fov etc"""
center: Point3d
fov_y: Optional[float] = None
ortho: bool
ortho_scale: Optional[float] = None
pos: Point3d
up: Point3d
model_config = ConfigDict(protected_namespaces=())

View File

@ -10,7 +10,7 @@ class CodeOutput(BaseModel):
<details><summary>JSON schema</summary> <details><summary>JSON schema</summary>
```json { "description": "Output of the code being executed.", "type": "object", "properties": { "output_files": { "description": "The contents of the files requested if they were passed.", "type": "array", "items": { "$ref": "#/components/schemas/OutputFile" } }, "stderr": { "description": "The stderr of the code.", "default": "", "type": "string" }, "stdout": { "description": "The stdout of the code.", "default": "", "type": "string" } } } ``` </details> ```json { \"description\": \"Output of the code being executed.\", \"type\": \"object\", \"properties\": { \"output_files\": { \"description\": \"The contents of the files requested if they were passed.\", \"type\": \"array\", \"items\": { \"$ref\": \"#/components/schemas/OutputFile\" } }, \"stderr\": { \"description\": \"The stderr of the code.\", \"default\": \"\", \"type\": \"string\" }, \"stdout\": { \"description\": \"The stdout of the code.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>
""" """
output_files: Optional[List[OutputFile]] = None output_files: Optional[List[OutputFile]] = None

View File

@ -8,7 +8,7 @@ from ..models.currency import Currency
class Customer(BaseModel): class Customer(BaseModel):
"""The resource representing a payment "Customer".""" """The resource representing a payment \"Customer\"."""
address: Optional[AddressDetails] = None address: Optional[AddressDetails] = None

View File

@ -0,0 +1,9 @@
from pydantic import BaseModel, ConfigDict
class DefaultCameraFocusOn(BaseModel):
"""The response from the `DefaultCameraFocusOn` command."""
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings
class DefaultCameraGetSettings(BaseModel):
"""The response from the `DefaultCameraGetSettings` command."""
settings: CameraSettings
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings
class DefaultCameraZoom(BaseModel):
"""The response from the `DefaultCameraZoom` command."""
settings: CameraSettings
model_config = ConfigDict(protected_namespaces=())

34
kittycad/models/event.py Normal file
View File

@ -0,0 +1,34 @@
import datetime
from typing import Literal, Optional, Union
from pydantic import BaseModel, ConfigDict, Field, RootModel
from typing_extensions import Annotated
from ..models.modeling_app_event_type import ModelingAppEventType
class modeling_app_event(BaseModel):
"""An event related to modeling app files"""
attachment_uri: Optional[str] = None
created_at: datetime.datetime
event_type: ModelingAppEventType
last_compiled_at: Optional[datetime.datetime] = None
project_description: Optional[str] = None
project_name: str
source_id: str
type: Literal["modeling_app_event"] = "modeling_app_event"
user_id: str
model_config = ConfigDict(protected_namespaces=())
Event = RootModel[Annotated[Union[modeling_app_event,], Field(discriminator="type")]]

View File

@ -0,0 +1,16 @@
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d
class FaceGetGradient(BaseModel):
"""The gradient (dFdu, dFdv) + normal vector on a brep face"""
df_du: Point3d
df_dv: Point3d
normal: Point3d
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d
class FaceGetPosition(BaseModel):
"""The 3D position on the surface that was evaluated"""
pos: Point3d
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,19 @@
from typing import Optional
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d
class FaceIsPlanar(BaseModel):
"""Surface-local planar axes (if available)"""
origin: Optional[Point3d] = None
x_axis: Optional[Point3d] = None
y_axis: Optional[Point3d] = None
z_axis: Optional[Point3d] = None
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,11 @@
from pydantic import BaseModel, ConfigDict
class GetNumObjects(BaseModel):
"""The response from the `GetNumObjects` command."""
num_objects: int
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,14 @@
from typing import List
from pydantic import BaseModel, ConfigDict
class ImportedGeometry(BaseModel):
"""Data from importing the files"""
id: str
value: List[str]
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,11 @@
from enum import Enum
class ModelingAppEventType(str, Enum):
"""Type for modeling-app events""" # noqa: E501
"""# This event is sent before the modeling app or project is closed. The attachment should contain the contents of the most recent successful compile. """ # noqa: E501
SUCCESSFUL_COMPILE_BEFORE_CLOSE = "successful_compile_before_close"
def __str__(self) -> str:
return str(self.value)

View File

@ -3,6 +3,7 @@ from typing import List, Literal, Optional, Union
from pydantic import BaseModel, ConfigDict, Field, RootModel from pydantic import BaseModel, ConfigDict, Field, RootModel
from typing_extensions import Annotated from typing_extensions import Annotated
from ..models.angle import Angle
from ..models.annotation_options import AnnotationOptions from ..models.annotation_options import AnnotationOptions
from ..models.annotation_type import AnnotationType from ..models.annotation_type import AnnotationType
from ..models.camera_drag_interaction_type import CameraDragInteractionType from ..models.camera_drag_interaction_type import CameraDragInteractionType
@ -39,7 +40,7 @@ class start_path(BaseModel):
class move_path_pen(BaseModel): class move_path_pen(BaseModel):
"""Move the path's "pen".""" """Move the path's \"pen\"."""
path: ModelingCmdId path: ModelingCmdId
@ -51,7 +52,7 @@ class move_path_pen(BaseModel):
class extend_path(BaseModel): class extend_path(BaseModel):
"""Extend a path by adding a new segment which starts at the path's "pen". If no "pen" location has been set before (via `MovePen`), then the pen is at the origin.""" """Extend a path by adding a new segment which starts at the path's \"pen\". If no \"pen\" location has been set before (via `MovePen`), then the pen is at the origin."""
path: ModelingCmdId path: ModelingCmdId
@ -63,7 +64,7 @@ class extend_path(BaseModel):
class extrude(BaseModel): class extrude(BaseModel):
"""Command for extruding a solid.""" """Command for extruding a solid 2d."""
cap: bool cap: bool
@ -76,6 +77,42 @@ class extrude(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class revolve(BaseModel):
"""Command for revolving a solid 2d."""
angle: Angle
axis: Point3d
axis_is_2d: bool
origin: Point3d
target: ModelingCmdId
tolerance: LengthUnit
type: Literal["revolve"] = "revolve"
model_config = ConfigDict(protected_namespaces=())
class revolve_about_edge(BaseModel):
"""Command for revolving a solid 2d about a brep edge"""
angle: Angle
edge_id: str
target: ModelingCmdId
tolerance: LengthUnit
type: Literal["revolve_about_edge"] = "revolve_about_edge"
model_config = ConfigDict(protected_namespaces=())
class close_path(BaseModel): class close_path(BaseModel):
"""Closes a path, converting it to a 2D solid.""" """Closes a path, converting it to a 2D solid."""
@ -124,6 +161,14 @@ class camera_drag_end(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class default_camera_get_settings(BaseModel):
"""Gets the default camera's camera settings"""
type: Literal["default_camera_get_settings"] = "default_camera_get_settings"
model_config = ConfigDict(protected_namespaces=())
class default_camera_look_at(BaseModel): class default_camera_look_at(BaseModel):
"""Change what the default camera is looking at.""" """Change what the default camera is looking at."""
@ -149,9 +194,9 @@ class default_camera_perspective_settings(BaseModel):
sequence: Optional[int] = None sequence: Optional[int] = None
type: Literal[ type: Literal["default_camera_perspective_settings"] = (
"default_camera_perspective_settings" "default_camera_perspective_settings"
] = "default_camera_perspective_settings" )
up: Point3d up: Point3d
@ -185,9 +230,9 @@ class default_camera_enable_sketch_mode(BaseModel):
ortho: bool ortho: bool
type: Literal[ type: Literal["default_camera_enable_sketch_mode"] = (
"default_camera_enable_sketch_mode" "default_camera_enable_sketch_mode"
] = "default_camera_enable_sketch_mode" )
x_axis: Point3d x_axis: Point3d
@ -199,9 +244,9 @@ class default_camera_enable_sketch_mode(BaseModel):
class default_camera_disable_sketch_mode(BaseModel): class default_camera_disable_sketch_mode(BaseModel):
"""Disable sketch mode, from the default camera.""" """Disable sketch mode, from the default camera."""
type: Literal[ type: Literal["default_camera_disable_sketch_mode"] = (
"default_camera_disable_sketch_mode" "default_camera_disable_sketch_mode"
] = "default_camera_disable_sketch_mode" )
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
@ -213,8 +258,6 @@ class export(BaseModel):
format: OutputFormat format: OutputFormat
source_unit: UnitLength
type: Literal["export"] = "export" type: Literal["export"] = "export"
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
@ -277,7 +320,7 @@ class entity_get_distance(BaseModel):
class entity_linear_pattern(BaseModel): class entity_linear_pattern(BaseModel):
"""Create a linear pattern using this entity (currently only valid for 3D solids).""" """Create a linear pattern using this entity."""
axis: Point3d axis: Point3d
@ -293,7 +336,7 @@ class entity_linear_pattern(BaseModel):
class entity_circular_pattern(BaseModel): class entity_circular_pattern(BaseModel):
"""Create a circular pattern using this entity (currently only valid for 3D solids).""" """Create a circular pattern using this entity."""
arc_degrees: float arc_degrees: float
@ -312,6 +355,24 @@ class entity_circular_pattern(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class entity_make_helix(BaseModel):
"""Create a helix using the input cylinder and other specified parameters."""
cylinder_id: str
is_clockwise: bool
length: LengthUnit
revolutions: float
start_angle: Angle
type: Literal["entity_make_helix"] = "entity_make_helix"
model_config = ConfigDict(protected_namespaces=())
class edit_mode_enter(BaseModel): class edit_mode_enter(BaseModel):
"""Enter edit mode""" """Enter edit mode"""
@ -323,7 +384,7 @@ class edit_mode_enter(BaseModel):
class select_with_point(BaseModel): class select_with_point(BaseModel):
"""Modifies the selection by simulating a "mouse click" at the given x,y window coordinate Returns ID of whatever was selected.""" """Modifies the selection by simulating a \"mouse click\" at the given x,y window coordinate Returns ID of whatever was selected."""
selected_at_window: Point2d selected_at_window: Point2d
@ -354,6 +415,14 @@ class select_remove(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class scene_clear_all(BaseModel):
"""Removes all of the Objects in the scene"""
type: Literal["scene_clear_all"] = "scene_clear_all"
model_config = ConfigDict(protected_namespaces=())
class select_replace(BaseModel): class select_replace(BaseModel):
"""Replaces current selection with these entities (by UUID).""" """Replaces current selection with these entities (by UUID)."""
@ -551,11 +620,47 @@ class solid3d_fillet_edge(BaseModel):
radius: LengthUnit radius: LengthUnit
tolerance: LengthUnit
type: Literal["solid3d_fillet_edge"] = "solid3d_fillet_edge" type: Literal["solid3d_fillet_edge"] = "solid3d_fillet_edge"
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class face_is_planar(BaseModel):
"""Determines whether a brep face is planar and returns its surface-local planar axes if so"""
object_id: str
type: Literal["face_is_planar"] = "face_is_planar"
model_config = ConfigDict(protected_namespaces=())
class face_get_position(BaseModel):
"""Determines a position on a brep face evaluated by parameters u,v"""
object_id: str
type: Literal["face_get_position"] = "face_get_position"
uv: Point2d
model_config = ConfigDict(protected_namespaces=())
class face_get_gradient(BaseModel):
"""Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v"""
object_id: str
type: Literal["face_get_gradient"] = "face_get_gradient"
uv: Point2d
model_config = ConfigDict(protected_namespaces=())
class send_object(BaseModel): class send_object(BaseModel):
"""Send object to front or back.""" """Send object to front or back."""
@ -720,6 +825,36 @@ class enable_sketch_mode(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class set_background_color(BaseModel):
"""Set the background color of the scene."""
color: Color
type: Literal["set_background_color"] = "set_background_color"
model_config = ConfigDict(protected_namespaces=())
class set_current_tool_properties(BaseModel):
"""Set the properties of the tool lines for the scene."""
color: Optional[Color] = None
type: Literal["set_current_tool_properties"] = "set_current_tool_properties"
model_config = ConfigDict(protected_namespaces=())
class set_default_system_properties(BaseModel):
"""Set the default system properties used when a specific property isn't set."""
color: Optional[Color] = None
type: Literal["set_default_system_properties"] = "set_default_system_properties"
model_config = ConfigDict(protected_namespaces=())
class curve_get_type(BaseModel): class curve_get_type(BaseModel):
"""Get type of the given curve.""" """Get type of the given curve."""
@ -777,9 +912,9 @@ class path_get_curve_uuids_for_vertices(BaseModel):
path_id: str path_id: str
type: Literal[ type: Literal["path_get_curve_uuids_for_vertices"] = (
"path_get_curve_uuids_for_vertices" "path_get_curve_uuids_for_vertices"
] = "path_get_curve_uuids_for_vertices" )
vertex_ids: List[str] vertex_ids: List[str]
@ -907,8 +1042,6 @@ class mass(BaseModel):
output_unit: UnitMass output_unit: UnitMass
source_unit: UnitLength
type: Literal["mass"] = "mass" type: Literal["mass"] = "mass"
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
@ -925,8 +1058,6 @@ class density(BaseModel):
output_unit: UnitDensity output_unit: UnitDensity
source_unit: UnitLength
type: Literal["density"] = "density" type: Literal["density"] = "density"
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
@ -939,8 +1070,6 @@ class volume(BaseModel):
output_unit: UnitVolume output_unit: UnitVolume
source_unit: UnitLength
type: Literal["volume"] = "volume" type: Literal["volume"] = "volume"
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
@ -953,8 +1082,6 @@ class center_of_mass(BaseModel):
output_unit: UnitLength output_unit: UnitLength
source_unit: UnitLength
type: Literal["center_of_mass"] = "center_of_mass" type: Literal["center_of_mass"] = "center_of_mass"
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
@ -967,8 +1094,6 @@ class surface_area(BaseModel):
output_unit: UnitArea output_unit: UnitArea
source_unit: UnitLength
type: Literal["surface_area"] = "surface_area" type: Literal["surface_area"] = "surface_area"
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
@ -1058,6 +1183,14 @@ class select_get(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class get_num_objects(BaseModel):
"""Get the number of objects in the scene"""
type: Literal["get_num_objects"] = "get_num_objects"
model_config = ConfigDict(protected_namespaces=())
ModelingCmd = RootModel[ ModelingCmd = RootModel[
Annotated[ Annotated[
Union[ Union[
@ -1065,10 +1198,13 @@ ModelingCmd = RootModel[
move_path_pen, move_path_pen,
extend_path, extend_path,
extrude, extrude,
revolve,
revolve_about_edge,
close_path, close_path,
camera_drag_start, camera_drag_start,
camera_drag_move, camera_drag_move,
camera_drag_end, camera_drag_end,
default_camera_get_settings,
default_camera_look_at, default_camera_look_at,
default_camera_perspective_settings, default_camera_perspective_settings,
default_camera_zoom, default_camera_zoom,
@ -1082,10 +1218,12 @@ ModelingCmd = RootModel[
entity_get_distance, entity_get_distance,
entity_linear_pattern, entity_linear_pattern,
entity_circular_pattern, entity_circular_pattern,
entity_make_helix,
edit_mode_enter, edit_mode_enter,
select_with_point, select_with_point,
select_add, select_add,
select_remove, select_remove,
scene_clear_all,
select_replace, select_replace,
highlight_set_entity, highlight_set_entity,
highlight_set_entities, highlight_set_entities,
@ -1102,6 +1240,9 @@ ModelingCmd = RootModel[
solid3d_get_next_adjacent_edge, solid3d_get_next_adjacent_edge,
solid3d_get_prev_adjacent_edge, solid3d_get_prev_adjacent_edge,
solid3d_fillet_edge, solid3d_fillet_edge,
face_is_planar,
face_get_position,
face_get_gradient,
send_object, send_object,
entity_set_opacity, entity_set_opacity,
entity_fade, entity_fade,
@ -1115,6 +1256,9 @@ ModelingCmd = RootModel[
get_sketch_mode_plane, get_sketch_mode_plane,
curve_set_constraint, curve_set_constraint,
enable_sketch_mode, enable_sketch_mode,
set_background_color,
set_current_tool_properties,
set_default_system_properties,
curve_get_type, curve_get_type,
curve_get_control_points, curve_get_control_points,
take_snapshot, take_snapshot,
@ -1145,6 +1289,7 @@ ModelingCmd = RootModel[
edit_mode_exit, edit_mode_exit,
select_clear, select_clear,
select_get, select_get,
get_num_objects,
], ],
Field(discriminator="type"), Field(discriminator="type"),
] ]

View File

@ -3,10 +3,15 @@ from typing import Literal, Union
from pydantic import BaseModel, ConfigDict, Field, RootModel from pydantic import BaseModel, ConfigDict, Field, RootModel
from typing_extensions import Annotated from typing_extensions import Annotated
from ..models.camera_drag_end import CameraDragEnd
from ..models.camera_drag_move import CameraDragMove
from ..models.center_of_mass import CenterOfMass from ..models.center_of_mass import CenterOfMass
from ..models.curve_get_control_points import CurveGetControlPoints from ..models.curve_get_control_points import CurveGetControlPoints
from ..models.curve_get_end_points import CurveGetEndPoints from ..models.curve_get_end_points import CurveGetEndPoints
from ..models.curve_get_type import CurveGetType from ..models.curve_get_type import CurveGetType
from ..models.default_camera_focus_on import DefaultCameraFocusOn
from ..models.default_camera_get_settings import DefaultCameraGetSettings
from ..models.default_camera_zoom import DefaultCameraZoom
from ..models.density import Density from ..models.density import Density
from ..models.entity_circular_pattern import EntityCircularPattern from ..models.entity_circular_pattern import EntityCircularPattern
from ..models.entity_get_all_child_uuids import EntityGetAllChildUuids from ..models.entity_get_all_child_uuids import EntityGetAllChildUuids
@ -17,10 +22,15 @@ from ..models.entity_get_parent_id import EntityGetParentId
from ..models.entity_linear_pattern import EntityLinearPattern from ..models.entity_linear_pattern import EntityLinearPattern
from ..models.export import Export from ..models.export import Export
from ..models.extrusion_face_info import ExtrusionFaceInfo from ..models.extrusion_face_info import ExtrusionFaceInfo
from ..models.face_get_gradient import FaceGetGradient
from ..models.face_get_position import FaceGetPosition
from ..models.face_is_planar import FaceIsPlanar
from ..models.get_entity_type import GetEntityType from ..models.get_entity_type import GetEntityType
from ..models.get_num_objects import GetNumObjects
from ..models.get_sketch_mode_plane import GetSketchModePlane from ..models.get_sketch_mode_plane import GetSketchModePlane
from ..models.highlight_set_entity import HighlightSetEntity from ..models.highlight_set_entity import HighlightSetEntity
from ..models.import_files import ImportFiles from ..models.import_files import ImportFiles
from ..models.imported_geometry import ImportedGeometry
from ..models.mass import Mass from ..models.mass import Mass
from ..models.mouse_click import MouseClick from ..models.mouse_click import MouseClick
from ..models.path_get_curve_uuids_for_vertices import PathGetCurveUuidsForVertices from ..models.path_get_curve_uuids_for_vertices import PathGetCurveUuidsForVertices
@ -119,6 +129,66 @@ class entity_get_all_child_uuids(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class camera_drag_move(BaseModel):
"""The response to the 'CameraDragMove' endpoint"""
data: CameraDragMove
type: Literal["camera_drag_move"] = "camera_drag_move"
model_config = ConfigDict(protected_namespaces=())
class camera_drag_end(BaseModel):
"""The response to the 'CameraDragEnd' endpoint"""
data: CameraDragEnd
type: Literal["camera_drag_end"] = "camera_drag_end"
model_config = ConfigDict(protected_namespaces=())
class default_camera_get_settings(BaseModel):
"""The response to the 'DefaultCameraGetSettings' endpoint"""
data: DefaultCameraGetSettings
type: Literal["default_camera_get_settings"] = "default_camera_get_settings"
model_config = ConfigDict(protected_namespaces=())
class default_camera_zoom(BaseModel):
"""The response to the 'DefaultCameraZoom' endpoint"""
data: DefaultCameraZoom
type: Literal["default_camera_zoom"] = "default_camera_zoom"
model_config = ConfigDict(protected_namespaces=())
class get_num_objects(BaseModel):
"""The response to the 'GetNumObjects' endpoint"""
data: GetNumObjects
type: Literal["get_num_objects"] = "get_num_objects"
model_config = ConfigDict(protected_namespaces=())
class default_camera_focus_on(BaseModel):
"""The response to the 'DefaultCameraFocusOn' endpoint"""
data: DefaultCameraFocusOn
type: Literal["default_camera_focus_on"] = "default_camera_focus_on"
model_config = ConfigDict(protected_namespaces=())
class select_get(BaseModel): class select_get(BaseModel):
"""The response to the 'SelectGet' endpoint""" """The response to the 'SelectGet' endpoint"""
@ -254,9 +324,9 @@ class path_get_curve_uuids_for_vertices(BaseModel):
data: PathGetCurveUuidsForVertices data: PathGetCurveUuidsForVertices
type: Literal[ type: Literal["path_get_curve_uuids_for_vertices"] = (
"path_get_curve_uuids_for_vertices" "path_get_curve_uuids_for_vertices"
] = "path_get_curve_uuids_for_vertices" )
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
@ -281,6 +351,36 @@ class curve_get_end_points(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class face_is_planar(BaseModel):
"""The response to the 'FaceIsPlanar' endpoint"""
data: FaceIsPlanar
type: Literal["face_is_planar"] = "face_is_planar"
model_config = ConfigDict(protected_namespaces=())
class face_get_position(BaseModel):
"""The response to the 'FaceGetPosition' endpoint"""
data: FaceGetPosition
type: Literal["face_get_position"] = "face_get_position"
model_config = ConfigDict(protected_namespaces=())
class face_get_gradient(BaseModel):
"""The response to the 'FaceGetGradient' endpoint"""
data: FaceGetGradient
type: Literal["face_get_gradient"] = "face_get_gradient"
model_config = ConfigDict(protected_namespaces=())
class plane_intersect_and_project(BaseModel): class plane_intersect_and_project(BaseModel):
"""The response to the 'PlaneIntersectAndProject' endpoint""" """The response to the 'PlaneIntersectAndProject' endpoint"""
@ -301,6 +401,16 @@ class import_files(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class imported_geometry(BaseModel):
"""The response to the 'ImportedGeometry' endpoint"""
data: ImportedGeometry
type: Literal["imported_geometry"] = "imported_geometry"
model_config = ConfigDict(protected_namespaces=())
class mass(BaseModel): class mass(BaseModel):
"""The response to the 'Mass' endpoint""" """The response to the 'Mass' endpoint"""
@ -422,6 +532,12 @@ OkModelingCmdResponse = RootModel[
entity_get_num_children, entity_get_num_children,
entity_get_parent_id, entity_get_parent_id,
entity_get_all_child_uuids, entity_get_all_child_uuids,
camera_drag_move,
camera_drag_end,
default_camera_get_settings,
default_camera_zoom,
get_num_objects,
default_camera_focus_on,
select_get, select_get,
solid3d_get_all_edge_faces, solid3d_get_all_edge_faces,
solid3d_get_all_opposite_edges, solid3d_get_all_opposite_edges,
@ -438,8 +554,12 @@ OkModelingCmdResponse = RootModel[
path_get_curve_uuids_for_vertices, path_get_curve_uuids_for_vertices,
path_get_vertex_uuids, path_get_vertex_uuids,
curve_get_end_points, curve_get_end_points,
face_is_planar,
face_get_position,
face_get_gradient,
plane_intersect_and_project, plane_intersect_and_project,
import_files, import_files,
imported_geometry,
mass, mass,
volume, volume,
density, density,

View File

@ -116,6 +116,22 @@ class metrics_request(BaseModel):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class PongData(BaseModel):
""""""
model_config = ConfigDict(protected_namespaces=())
class pong(BaseModel):
"""Pong response to a Ping message."""
data: PongData
type: Literal["pong"] = "pong"
model_config = ConfigDict(protected_namespaces=())
OkWebSocketResponseData = RootModel[ OkWebSocketResponseData = RootModel[
Annotated[ Annotated[
Union[ Union[
@ -125,6 +141,7 @@ OkWebSocketResponseData = RootModel[
modeling, modeling,
export, export,
metrics_request, metrics_request,
pong,
], ],
Field(discriminator="type"), Field(discriminator="type"),
] ]

View File

@ -9,7 +9,7 @@ class OutputFile(BaseModel):
<details><summary>JSON schema</summary> <details><summary>JSON schema</summary>
```json { "description": "Output file contents.", "type": "object", "properties": { "contents": { "description": "The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON.", "type": "string" }, "name": { "description": "The name of the file.", "default": "", "type": "string" } } } ``` </details> ```json { \"description\": \"Output file contents.\", \"type\": \"object\", \"properties\": { \"contents\": { \"description\": \"The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON.\", \"type\": \"string\" }, \"name\": { \"description\": \"The name of the file.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>
""" """
contents: Optional[str] = None contents: Optional[str] = None

View File

@ -10,7 +10,7 @@ from ..models.point3d import Point3d
class line(BaseModel): class line(BaseModel):
"""A straight line segment. Goes from the current path "pen" to the given endpoint.""" """A straight line segment. Goes from the current path \"pen\" to the given endpoint."""
end: Point3d end: Point3d

View File

@ -0,0 +1,12 @@
from enum import Enum
class PostEffectType(str, Enum):
"""Post effect type""" # noqa: E501
PHOSPHOR = "phosphor"
SSAO = "ssao"
NOEFFECT = "noeffect"
def __str__(self) -> str:
return str(self.value)

View File

@ -2,7 +2,6 @@ import datetime
from pydantic import BaseModel, ConfigDict from pydantic import BaseModel, ConfigDict
from ..models.uuid import Uuid
class Session(BaseModel): class Session(BaseModel):
@ -10,14 +9,12 @@ class Session(BaseModel):
created_at: datetime.datetime created_at: datetime.datetime
expires: datetime.datetime expires_at: datetime.datetime
id: Uuid token: str
session_token: Uuid
updated_at: datetime.datetime updated_at: datetime.datetime
user_id: Uuid user_id: str
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())

View File

@ -1,4 +1,4 @@
from typing import List, Literal, Union from typing import List, Literal, Optional, Union
from pydantic import BaseModel, ConfigDict, Field, RootModel from pydantic import BaseModel, ConfigDict, Field, RootModel
from typing_extensions import Annotated from typing_extensions import Annotated
@ -46,8 +46,12 @@ class modeling_cmd_req(BaseModel):
class modeling_cmd_batch_req(BaseModel): class modeling_cmd_batch_req(BaseModel):
"""A sequence of modeling requests. If any request fails, following requests will not be tried.""" """A sequence of modeling requests. If any request fails, following requests will not be tried."""
batch_id: ModelingCmdId
requests: List[ModelingCmdReq] requests: List[ModelingCmdReq]
responses: Optional[bool] = None
type: Literal["modeling_cmd_batch_req"] = "modeling_cmd_batch_req" type: Literal["modeling_cmd_batch_req"] = "modeling_cmd_batch_req"
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())

View File

@ -1,4 +1,5 @@
""" Contains some shared types for properties """ """ Contains some shared types for properties """
from typing import ( from typing import (
BinaryIO, BinaryIO,
Generic, Generic,

2723
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "kittycad" name = "kittycad"
version = "0.6.7" version = "0.6.11"
description = "A client library for accessing KittyCAD" description = "A client library for accessing KittyCAD"
authors = [] authors = []
@ -11,6 +11,10 @@ packages = [
] ]
include = ["CHANGELOG.md", "kittycad/py.typed"] include = ["CHANGELOG.md", "kittycad/py.typed"]
[[tool.poetry.source]]
name = "pypi-public"
url = "https://pypi.org/simple/"
[tool.poetry.dependencies] [tool.poetry.dependencies]
attrs = ">=20.1.0,<24.0.0" attrs = ">=20.1.0,<24.0.0"
httpx = ">=0.15.4,<0.26.0" httpx = ">=0.15.4,<0.26.0"
@ -23,7 +27,7 @@ pydantic-extra-types = "^2.1.0"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
autoclasstoc = "^1.6.0" autoclasstoc = "^1.6.0"
black = "^23.12.1" black = "^24.2.0"
isort = "^5.12.0" isort = "^5.12.0"
jinja2 = "^3.1.3" jinja2 = "^3.1.3"
jsonpatch = "^1.33" jsonpatch = "^1.33"
@ -32,10 +36,10 @@ openapi-parser = "^0.2.6"
openapi-spec-validator = "^0.6.0" openapi-spec-validator = "^0.6.0"
prance = "^23.6.21" prance = "^23.6.21"
pyenchant = "^3.2.2" pyenchant = "^3.2.2"
pytest = "^7.4.2" pytest = "^8.0.2"
pytest-asyncio = "^0.21.1" pytest-asyncio = "^0.21.1"
pytest-cov = "^4.1.0" pytest-cov = "^4.1.0"
ruff = "^0.2.2" ruff = "^0.3.0"
Sphinx = "^7.1.2" Sphinx = "^7.1.2"
sphinx-autoapi = "^2.0.1" sphinx-autoapi = "^2.0.1"
sphinx-autodoc-typehints = "^1.24.0" sphinx-autodoc-typehints = "^1.24.0"

1380
spec.json

File diff suppressed because it is too large Load Diff