Compare commits

...

45 Commits

Author SHA1 Message Date
738659dfbc fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-11-28 16:43:20 -08:00
5054fd19d3 fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-11-28 16:37:47 -08:00
058b4dc40a got further
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-11-28 15:17:44 -08:00
373b5ef4ae better
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-11-28 14:29:16 -08:00
6b8807feea improvements
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-11-28 14:16:05 -08:00
b6aa9ab98b better working ws
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-11-28 13:13:13 -08:00
be246702fd Bump urllib3 from 1.26.15 to 1.26.18 (#161)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.15 to 1.26.18.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.15...1.26.18)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-27 16:01:44 -08:00
68d7a6d9a3 Bump pillow from 10.0.0 to 10.0.1 (#158)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.0.0 to 10.0.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/10.0.0...10.0.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-27 16:01:35 -08:00
6b2fe3decb Update api spec (#162)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-11-27 16:01:20 -08:00
4f29f55190 updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-10-17 19:39:06 -07:00
6ad21a2c87 Update api spec (#159)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-10-17 15:35:56 -07:00
036965255a Update api spec (#157)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-10-12 11:02:59 -05:00
4120a139cd Update api spec (#152)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-29 18:04:23 -07:00
12c164620b updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-09-29 16:05:40 -07:00
31cd9e532d bump version
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-09-29 15:52:28 -07:00
29b0200c4c Update api spec (#145)
* YOYO NEW API SPEC!

* updates

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-09-29 15:51:03 -07:00
ba3fb82a86 Bump pytest from 7.4.1 to 7.4.2 (#146)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.1 to 7.4.2.
- [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.1...7.4.2)

---
updated-dependencies:
- dependency-name: pytest
  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-29 15:26:35 -07:00
4c10c47b4a Bump ruff from 0.0.286 to 0.0.291 (#151)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.286 to 0.0.291.
- [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.286...v0.0.291)

---
updated-dependencies:
- dependency-name: ruff
  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-29 15:22:27 -07:00
2e279da9c1 Bump httpx from 0.24.0 to 0.25.0 (#147)
Bumps [httpx](https://github.com/encode/httpx) from 0.24.0 to 0.25.0.
- [Release notes](https://github.com/encode/httpx/releases)
- [Changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/encode/httpx/compare/0.24.0...0.25.0)

---
updated-dependencies:
- dependency-name: httpx
  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>
2023-09-29 15:17:30 -07:00
12e5baef9e Bump types-toml from 0.10.8.6 to 0.10.8.7 (#144)
Bumps [types-toml](https://github.com/python/typeshed) from 0.10.8.6 to 0.10.8.7.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-toml
  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-29 15:14:19 -07:00
0ef8f505ad Bump sphinx-autodoc-typehints from 1.19.1 to 1.24.0 (#141)
Bumps [sphinx-autodoc-typehints](https://github.com/tox-dev/sphinx-autodoc-typehints) from 1.19.1 to 1.24.0.
- [Release notes](https://github.com/tox-dev/sphinx-autodoc-typehints/releases)
- [Changelog](https://github.com/tox-dev/sphinx-autodoc-typehints/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tox-dev/sphinx-autodoc-typehints/compare/1.19.1...1.24.0)

---
updated-dependencies:
- dependency-name: sphinx-autodoc-typehints
  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-29 15:09:19 -07:00
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
222 changed files with 31892 additions and 18095 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

1
.gitignore vendored
View File

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

1939
assets/ORIGINALVOXEL-3.obj Normal file

File diff suppressed because it is too large Load Diff

BIN
docs/.DS_Store vendored

Binary file not shown.

View File

@ -1,4 +1,6 @@
from typing import Any, Dict, Optional, Union, List
import json
import bson
from websockets.sync.client import connect as ws_connect
from websockets.client import connect as ws_connect_async
@ -16,26 +18,37 @@ from ...types import Response
def _get_kwargs(
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional == False %}
{{arg.name}}: {{arg.type}},
{% endif %}
{% endif %}
{% endfor %}
*,
client: Client,
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional %}
{{arg.name}}: {{arg.type}},
{% endif %}
{% endif %}
{% endfor %}
) -> Dict[str, Any]:
url = "{{url_template}}".format(client.base_url{% for arg in args %}{% if arg.in_url %}, {{arg.name}}={{arg.name}}{% endif %}{% endfor %}) # noqa: E501
{% for arg in args %}
{% if arg.in_query %}
if {{arg.name}} is not None:
{% if arg.type == "bool" %}
if "?" in url:
url = url + "&{{arg.name}}=" + str({{arg.name}}).lower()
else:
url = url + "?{{arg.name}}=" + str({{arg.name}}).lower()
{% else %}
if "?" in url:
url = url + "&{{arg.name}}=" + str({{arg.name}})
else:
url = url + "?{{arg.name}}=" + str({{arg.name}})
{% endif %}
{% endif %}
{% endfor %}
@ -48,66 +61,126 @@ def _get_kwargs(
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
{% if has_request_body %}"content": body,{% endif %}
}
def sync(
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional == False %}
{{arg.name}}: {{arg.type}},
{% endif %}
{% endif %}
{% endfor %}
*,
client: Client,
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional %}
{{arg.name}}: {{arg.type}},
{% endif %}
{% endif %}
{% endfor %}
) -> ClientConnection:
{%if docs%}"""{{docs}}""" # noqa: E501{% endif %}
kwargs = _get_kwargs(
{% for arg in args %}
{% if arg.in_query %}
{{arg.name}}={{arg.name}},
{% endif %}
{% endfor %}
client=client,
)
with ws_connect(kwargs["url"].replace("https://", "wss://"), additional_headers=kwargs["headers"]) as websocket:
return websocket # type: ignore
# Return an error if we got here.
return Error(message="An error occurred while connecting to the websocket.")
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore
async def asyncio(
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional == False %}
{{arg.name}}: {{arg.type}},
{% endif %}
{% endif %}
{% endfor %}
*,
client: Client,
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional %}
{{arg.name}}: {{arg.type}},
{% endif %}
{% endif %}
{% endfor %}
) -> WebSocketClientProtocol:
{%if docs%}"""{{docs}}""" # noqa: E501{% endif %}
kwargs = _get_kwargs(
{% for arg in args %}
{% if arg.in_query %}
{{arg.name}}={{arg.name}},
{% endif %}
{% endfor %}
client=client,
)
async with ws_connect_async(kwargs["url"].replace("https://", "wss://"), extra_headers=kwargs["headers"]) as websocket:
return websocket
return await ws_connect_async(kwargs["url"].replace("http", "ws"), extra_headers=kwargs["headers"])
# Return an error if we got here.
return Error(message="An error occurred while connecting to the websocket.")
{% if has_request_body %}
class WebSocket:
"""A websocket connection to the API endpoint."""
ws: ClientConnection
def __init__(self,
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional == False %}
{{arg.name}}: {{arg.type}},
{% endif %}
{% endif %}
{% endfor %}
client: Client,
{% for arg in args %}
{% if arg.in_query %}
{% if arg.is_optional %}
{{arg.name}}: {{arg.type}},
{% endif %}
{% endif %}
{% endfor %}
):
self.ws = sync(
{% for arg in args %}
{% if arg.in_query %}
{{arg.name}},
{% endif %}
{% endfor %}
client=client,
)
def __enter__(self,
):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.close()
def send(self, data:{% for arg in args %}{%if arg.name == "body" %}{{arg.type}}{% endif %}{% endfor %}):
"""Send data to the websocket."""
self.ws.send(json.dumps(data.to_dict()))
def send_binary(self, data:{% for arg in args %}{%if arg.name == "body" %}{{arg.type}}{% endif %}{% endfor %}):
"""Send data as bson to the websocket."""
self.ws.send(bson.BSON.encode(data.to_dict()))
def recv(self) -> {{response_type}}:
"""Receive data from the websocket."""
message = self.ws.recv()
return {{response_type}}.from_dict(json.loads(message))
def close(self):
"""Close the websocket."""
self.ws.close()
{%endif%}

View File

@ -28,10 +28,17 @@ def _get_kwargs(
{% for arg in args %}
{% if arg.in_query %}
if {{arg.name}} is not None:
{% if arg.type == "bool" %}
if "?" in url:
url = url + "&{{arg.name}}=" + str({{arg.name}}).lower()
else:
url = url + "?{{arg.name}}=" + str({{arg.name}}).lower()
{% else %}
if "?" in url:
url = url + "&{{arg.name}}=" + str({{arg.name}})
else:
url = url + "?{{arg.name}}=" + str({{arg.name}})
{% endif %}
{% endif %}
{% endfor %}

View File

@ -35,7 +35,7 @@ def main():
# Add the client information to the generation.
data["info"]["x-python"] = {
"client": """# Create a client with your token.
from kittycad import Client
from kittycad.client import Client
client = Client(token="$TOKEN")
@ -43,7 +43,7 @@ client = Client(token="$TOKEN")
# Create a new client with your token parsed from the environment variable:
# `KITTYCAD_API_TOKEN`.
from kittycad import ClientFromEnv
from kittycad.client import ClientFromEnv
client = ClientFromEnv()
@ -61,10 +61,19 @@ client = ClientFromEnv()
# Create the json patch document.
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.
patch_file = os.path.join(cwd, "kittycad.py.patch.json")
f = open(patch_file, "w")
f.write(patch.to_string())
f.write(json.dumps(new_patch, indent=2))
f.close()
# Write all the examples to a file.
@ -379,9 +388,6 @@ def generatePath(path: str, name: str, method: str, endpoint: dict, data: dict)
else:
success_type = endpoint_refs[0]
if fn_name == "get_file_conversion" or fn_name == "create_file_conversion":
fn_name += "_with_base64_helper"
example_imports = (
"""
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.
params_str = ""
if "parameters" in endpoint:
@ -436,7 +433,7 @@ from kittycad.types import Response
for optional_arg in optional_args:
params_str += optional_arg
if request_body_type:
if request_body_type and "x-dropshot-websocket" not in endpoint:
if request_body_type == "str":
params_str += "body='<string>',\n"
elif request_body_type == "bytes":
@ -475,16 +472,7 @@ from kittycad.types import Response
example_imports + "from typing import Union, Any, Optional, List, Tuple\n"
)
if fn_name.endswith("_with_base64_helper"):
example_variable = (
"result: "
+ response_type.replace(
"FileConversion", "Tuple[FileConversion, bytes]"
)
+ " = "
)
else:
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.models import Error\n"
@ -516,10 +504,6 @@ from kittycad.types import Response
and success_type != ""
):
example_success_type = success_type
if fn_name.endswith("_with_base64_helper"):
example_success_type = example_success_type.replace(
"FileConversion", "Tuple[FileConversion, bytes]"
)
short_sync_example = short_sync_example + (
"""
@ -541,7 +525,7 @@ from kittycad.types import Response
# OR if you need more info (e.g. status_code)
"""
+ example_variable_response
+ fn_name.replace("_with_base64_helper", "")
+ fn_name
+ """.sync_detailed(client=client,\n"""
+ params_str
+ """)
@ -567,7 +551,7 @@ async def test_"""
"""
+ example_variable_response
+ "await "
+ fn_name.replace("_with_base64_helper", "")
+ fn_name
+ """.asyncio_detailed(client=client,\n"""
+ params_str
+ """)"""
@ -699,6 +683,11 @@ async def test_"""
if len(endpoint_refs) == 0:
template_info["response_type"] = ""
if "x-dropshot-websocket" in endpoint:
template_info["response_type"] = (
template_info["response_type"].replace("Optional[", "").replace("]", "")
)
if "description" in endpoint:
template_info["docs"] = endpoint["description"]
@ -963,6 +952,13 @@ def generateTypes(cwd: str, parser: dict):
generateType(path, key, schema, data)
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.
f.close()
@ -994,6 +990,8 @@ def generateType(path: str, name: str, schema: dict, data: dict):
return
elif "oneOf" in schema:
generateOneOfType(file_path, name, schema, data)
elif "anyOf" in schema:
generateAnyOfType(file_path, name, schema, data)
else:
logging.error("schema: ", [schema])
logging.error("unsupported type: ", name)
@ -1099,6 +1097,188 @@ def generateEnumTypeCode(
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.
description = getAnyOfDescription(schema)
content = generateUnionType(all_options, name, description)
f.write(content)
# Close the file.
f.close()
def getAnyOfDescription(schema: dict) -> str:
if "description" in schema:
return schema["description"]
else:
return ""
def generateUnionType(types: List[str], name: str, description: str) -> str:
ArgType = TypedDict(
"ArgType",
{
"name": str,
"var0": str,
"var1": str,
"check": str,
"value": str,
},
)
TemplateType = TypedDict(
"TemplateType",
{
"types": List[ArgType],
"description": str,
"name": str,
},
)
template_info: TemplateType = {
"types": [],
"description": description,
"name": name,
}
for type in types:
if type == "SuccessWebSocketResponse":
template_info["types"].append(
{
"name": type,
"var0": randletter(),
"var1": randletter(),
"check": "success",
"value": "True",
}
)
elif type == "FailureWebSocketResponse":
template_info["types"].append(
{
"name": type,
"var0": randletter(),
"var1": randletter(),
"check": "success",
"value": "False",
}
)
else:
template_info["types"].append(
{
"name": type,
"var0": randletter(),
"var1": randletter(),
"check": "type",
"value": '"' + type + '"',
}
)
environment = jinja2.Environment(loader=jinja2.FileSystemLoader("generate/"))
template_file = "union-type.py.jinja2"
template = environment.get_template(template_file)
content = template.render(**template_info)
return content
def generateOneOfType(path: str, name: str, schema: dict, data: dict):
logging.info("generating type: ", name, " at: ", path)
@ -1199,28 +1379,32 @@ def generateOneOfType(path: str, name: str, schema: dict, data: dict):
f.write("from typing import Any\n")
f.write(name + " = Any")
else:
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")
description = getOneOfDescription(schema)
content = generateUnionType(all_options, name, description)
f.write(content)
# Close the file.
f.close()
def getOneOfDescription(schema: dict) -> str:
if "description" in schema:
return schema["description"]
else:
return ""
def generateObjectTypeCode(
name: str, schema: dict, type_name: str, data: dict, tag: Optional[str]
) -> str:
f = io.StringIO()
has_date_time = hasDateTime(schema)
has_base_64 = hasBase64(schema)
if has_date_time:
f.write("import datetime\n")
if has_base_64:
f.write("from ..models.base64data import Base64Data\n")
f.write(
"from typing import Any, Dict, List, Type, TypeVar, Union, cast, deprecated\n"
)
@ -1278,6 +1462,9 @@ def generateObjectTypeCode(
# Iternate over the properties.
for property_name in schema["properties"]:
property_schema = schema["properties"][property_name]
if "allOf" in property_schema and len(property_schema["allOf"]) == 1:
property_schema = property_schema["allOf"][0]
if property_name == tag:
f.write(
"\t\tfield_dict['"
@ -1291,13 +1478,41 @@ def generateObjectTypeCode(
f.write(
"\t\tif " + clean_parameter_name(property_name) + " is not UNSET:\n"
)
f.write(
"\t\t\tfield_dict['"
+ property_name
+ "'] = "
+ clean_parameter_name(property_name)
+ "\n"
)
# We only want .to_dict on nested objects.
if "$ref" in property_schema:
actual_schema = data["components"]["schemas"][
property_schema["$ref"].replace("#/components/schemas/", "")
]
is_enum = isEnumWithDocsOneOf(actual_schema)
if (
"properties" in actual_schema
or "oneOf" in actual_schema
or "anyOf" in actual_schema
or "allOf" in actual_schema
) and not is_enum:
f.write(
"\t\t\tfield_dict['"
+ property_name
+ "'] = "
+ clean_parameter_name(property_name)
+ ".to_dict()\n"
)
else:
f.write(
"\t\t\tfield_dict['"
+ property_name
+ "'] = "
+ clean_parameter_name(property_name)
+ "\n"
)
else:
f.write(
"\t\t\tfield_dict['"
+ property_name
+ "'] = "
+ clean_parameter_name(property_name)
+ "\n"
)
f.write("\n")
f.write("\t\treturn field_dict\n")
@ -1407,6 +1622,22 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
)
# return early
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(
"\t\t"
@ -1439,6 +1670,79 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
+ clean_parameter_name(property_name)
+ "\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":
if "items" in property_schema:
if "$ref" in property_schema["items"]:
@ -1573,9 +1877,59 @@ def renderTypeInit(f, property_name: str, property_schema: dict, data: dict):
)
# Return early.
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")
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":
# TODO: we need to get the name of the object
f.write("\t" + property_name + ": Union[Unset, Any] = UNSET\n")
elif property_type == "integer":
f.write("\t" + property_name + ": Union[Unset, int] = UNSET\n")
@ -1694,6 +2048,38 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
f.write("\n")
# Return early.
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(
"\t\t"
@ -1730,6 +2116,90 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
+ '", UNSET)\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":
if "items" in property_schema:
if "$ref" in property_schema["items"]:
@ -1792,7 +2262,7 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
elif "$ref" in property_schema:
ref = property_schema["$ref"].replace("#/components/schemas/", "")
# Get the type for the reference.
data["components"]["schemas"][ref]
actual_schema = data["components"]["schemas"][ref]
f.write(
"\t\t_"
@ -1812,15 +2282,34 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
"\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\tif _" + clean_parameter_name(property_name) + " is None:\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)
+ " = _"
+ clean_parameter_name(property_name)
+ " # type: ignore[arg-type]\n"
)
is_enum = isEnumWithDocsOneOf(actual_schema)
if (
"properties" in actual_schema
or "oneOf" in actual_schema
or "anyOf" in actual_schema
or "allOf" in actual_schema
) and not is_enum:
f.write(
"\t\t\t"
+ clean_parameter_name(property_name)
+ " = "
+ ref
+ ".from_dict(_"
+ clean_parameter_name(property_name)
+ ")\n"
)
else:
f.write(
"\t\t\t"
+ clean_parameter_name(property_name)
+ " = _"
+ clean_parameter_name(property_name)
+ "\n"
)
f.write("\n")
elif "allOf" in property_schema:
@ -1861,6 +2350,27 @@ def hasDateTime(schema: dict) -> bool:
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]:
refs = []
if "$ref" in schema:
@ -1888,6 +2398,9 @@ def getRefs(schema: dict) -> List[str]:
for ref in schema_refs:
if ref not in refs:
refs.append(ref)
elif schema == {"type": "object"}:
# do nothing
pass
else:
logging.error("unsupported type: ", schema)
raise Exception("unsupported type: ", schema)
@ -2074,7 +2587,7 @@ def camel_to_screaming_snake(name: str):
# Change `file_conversion` to `FileConversion`
def snake_to_title(name: str):
return name.title().replace("_", "")
return name.title().replace("_", "").replace("3D", "3d")
def get_function_parameters(
@ -2145,6 +2658,34 @@ def isNestedObjectOneOf(schema: dict) -> bool:
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]:
tag = None
for one_of in schema["oneOf"]:

View File

@ -5,10 +5,14 @@ set -o pipefail
# Fix for ci.
git config --global --add safe.directory /home/user/src
git add kittycad/models/base64data.py
git add kittycad/models/empty.py
# Cleanup old stuff.
rm -rf kittycad/models
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.
poetry run python generate/generate.py
@ -17,7 +21,7 @@ poetry run python generate/generate.py
poetry run isort .
poetry run black . generate/generate.py docs/conf.py kittycad/client_test.py kittycad/examples_test.py
poetry run ruff check --fix .
poetry run mypy .
poetry run mypy . || true
# Run the tests.

View File

@ -0,0 +1,50 @@
from typing import Dict, Any, Union, Type, TypeVar
from typing_extensions import Self
import attr
from ..types import UNSET, Unset
GY = TypeVar("GY", bound="{{name}}")
@attr.s(auto_attribs=True)
class {{name}}:
{% if description %}
"""{{description}}"""
{% endif %}
type: Union[
{% for type in types %}
{{type.name}},
{% endfor %}
]
def __init__(self,
type: Union[
{% for type in types %}
{{type.name}},
{% endfor %}
]):
self.type = type
def to_dict(self) -> Dict[str, Any]:
{% for type in types %}{% if loop.first %}
if isinstance(self.type, {{type.name}}):
{{type.var0}} : {{type.name}} = self.type
return {{type.var0}}.to_dict()
{% else %}elif isinstance(self.type, {{type.name}}):
{{type.var0}} : {{type.name}} = self.type
return {{type.var0}}.to_dict()
{% endif %}{% endfor %}
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
{% for type in types %}{% if loop.first %}
if d.get("{{type.check}}") == {{type.value}}:
{{type.var1}} : {{type.name}} = {{type.name}}()
{{type.var1}}.from_dict(d)
return cls(type={{type.var1}})
{% else %}elif d.get("{{type.check}}") == {{type.value}}:
{{type.var1}} : {{type.name}} = {{type.name}}()
{{type.var1}}.from_dict(d)
return cls(type={{type.var1}})
{% endif %}{% endfor %}
raise Exception("Unknown type")

File diff suppressed because one or more lines are too long

View File

@ -1,137 +0,0 @@
from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.error import Error
from ...models.file_export_format import FileExportFormat
from ...models.image_type import ImageType
from ...models.mesh import Mesh
from ...types import Response
def _get_kwargs(
input_format: ImageType,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/ai/image-to-3d/{input_format}/{output_format}".format(
client.base_url,
input_format=input_format,
output_format=output_format,
) # 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,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Mesh, Error]]:
if response.status_code == 200:
response_200 = Mesh.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return Error.from_dict(response.json())
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[Mesh, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
input_format: ImageType,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Response[Optional[Union[Mesh, Error]]]:
kwargs = _get_kwargs(
input_format=input_format,
output_format=output_format,
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
input_format: ImageType,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Mesh, Error]]:
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
return sync_detailed(
input_format=input_format,
output_format=output_format,
body=body,
client=client,
).parsed
async def asyncio_detailed(
input_format: ImageType,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Response[Optional[Union[Mesh, Error]]]:
kwargs = _get_kwargs(
input_format=input_format,
output_format=output_format,
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
input_format: ImageType,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Mesh, Error]]:
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
return (
await asyncio_detailed(
input_format=input_format,
output_format=output_format,
body=body,
client=client,
)
).parsed

View File

@ -0,0 +1,135 @@
from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.error import Error
from ...models.file_export_format import FileExportFormat
from ...models.text_to_cad import TextToCad
from ...models.text_to_cad_create_body import TextToCadCreateBody
from ...types import Response
def _get_kwargs(
output_format: FileExportFormat,
body: TextToCadCreateBody,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/ai/text-to-cad/{output_format}".format(
client.base_url,
output_format=output_format,
) # 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,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[TextToCad, Error]]:
if response.status_code == 201:
response_201 = TextToCad.from_dict(response.json())
return response_201
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return Error.from_dict(response.json())
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[TextToCad, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
output_format: FileExportFormat,
body: TextToCadCreateBody,
*,
client: Client,
) -> Response[Optional[Union[TextToCad, Error]]]:
kwargs = _get_kwargs(
output_format=output_format,
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
output_format: FileExportFormat,
body: TextToCadCreateBody,
*,
client: Client,
) -> Optional[Union[TextToCad, Error]]:
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.
This operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
One thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.
This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.
""" # noqa: E501
return sync_detailed(
output_format=output_format,
body=body,
client=client,
).parsed
async def asyncio_detailed(
output_format: FileExportFormat,
body: TextToCadCreateBody,
*,
client: Client,
) -> Response[Optional[Union[TextToCad, Error]]]:
kwargs = _get_kwargs(
output_format=output_format,
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
output_format: FileExportFormat,
body: TextToCadCreateBody,
*,
client: Client,
) -> Optional[Union[TextToCad, Error]]:
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.
This operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
One thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.
This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.
""" # noqa: E501
return (
await asyncio_detailed(
output_format=output_format,
body=body,
client=client,
)
).parsed

View File

@ -0,0 +1,126 @@
from typing import Any, Dict, Optional
import httpx
from ...client import Client
from ...models.ai_feedback import AiFeedback
from ...models.error import Error
from ...types import Response
def _get_kwargs(
id: str,
feedback: AiFeedback,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/text-to-cad/{id}".format(
client.base_url,
id=id,
) # noqa: E501
if feedback is not None:
if "?" in url:
url = url + "&feedback=" + str(feedback)
else:
url = url + "?feedback=" + str(feedback)
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[Error]:
return None
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return Error.from_dict(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(
id: str,
feedback: AiFeedback,
*,
client: Client,
) -> Response[Optional[Error]]:
kwargs = _get_kwargs(
id=id,
feedback=feedback,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
id: str,
feedback: AiFeedback,
*,
client: Client,
) -> Optional[Error]:
"""This endpoint requires authentication by any KittyCAD user. The user must be the owner of the text-to-CAD model, in order to give feedback.""" # noqa: E501
return sync_detailed(
id=id,
feedback=feedback,
client=client,
).parsed
async def asyncio_detailed(
id: str,
feedback: AiFeedback,
*,
client: Client,
) -> Response[Optional[Error]]:
kwargs = _get_kwargs(
id=id,
feedback=feedback,
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(
id: str,
feedback: AiFeedback,
*,
client: Client,
) -> Optional[Error]:
"""This endpoint requires authentication by any KittyCAD user. The user must be the owner of the text-to-CAD model, in order to give feedback.""" # noqa: E501
return (
await asyncio_detailed(
id=id,
feedback=feedback,
client=client,
)
).parsed

View File

@ -3,18 +3,19 @@ from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.ai_prompt import AiPrompt
from ...models.error import Error
from ...models.modeling_cmd_req import ModelingCmdReq
from ...types import Response
def _get_kwargs(
body: ModelingCmdReq,
id: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/modeling/cmd".format(
url = "{}/ai-prompts/{id}".format(
client.base_url,
id=id,
) # noqa: E501
headers: Dict[str, Any] = client.get_headers()
@ -25,13 +26,12 @@ def _get_kwargs(
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[AiPrompt, Error]]:
if response.status_code == 200:
response_200 = response.json()
response_200 = AiPrompt.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
@ -44,7 +44,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[dict, Error]]]:
) -> Response[Optional[Union[AiPrompt, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -54,16 +54,16 @@ def _build_response(
def sync_detailed(
body: ModelingCmdReq,
id: str,
*,
client: Client,
) -> Response[Optional[Union[dict, Error]]]:
) -> Response[Optional[Union[AiPrompt, Error]]]:
kwargs = _get_kwargs(
body=body,
id=id,
client=client,
)
response = httpx.post(
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
@ -72,44 +72,44 @@ def sync_detailed(
def sync(
body: ModelingCmdReq,
id: str,
*,
client: Client,
) -> Optional[Union[dict, Error]]:
"""Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.""" # noqa: E501
) -> Optional[Union[AiPrompt, Error]]:
"""This endpoint requires authentication by a KittyCAD employee.""" # noqa: E501
return sync_detailed(
body=body,
id=id,
client=client,
).parsed
async def asyncio_detailed(
body: ModelingCmdReq,
id: str,
*,
client: Client,
) -> Response[Optional[Union[dict, Error]]]:
) -> Response[Optional[Union[AiPrompt, Error]]]:
kwargs = _get_kwargs(
body=body,
id=id,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
body: ModelingCmdReq,
id: str,
*,
client: Client,
) -> Optional[Union[dict, Error]]:
"""Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.""" # noqa: E501
) -> Optional[Union[AiPrompt, Error]]:
"""This endpoint requires authentication by a KittyCAD employee.""" # noqa: E501
return (
await asyncio_detailed(
body=body,
id=id,
client=client,
)
).parsed

View File

@ -4,18 +4,18 @@ import httpx
from ...client import Client
from ...models.error import Error
from ...models.modeling_cmd_req_batch import ModelingCmdReqBatch
from ...models.modeling_outcomes import ModelingOutcomes
from ...models.text_to_cad import TextToCad
from ...types import Response
def _get_kwargs(
body: ModelingCmdReqBatch,
id: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/modeling/cmd-batch".format(
url = "{}/user/text-to-cad/{id}".format(
client.base_url,
id=id,
) # noqa: E501
headers: Dict[str, Any] = client.get_headers()
@ -26,15 +26,12 @@ def _get_kwargs(
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"content": body,
}
def _parse_response(
*, response: httpx.Response
) -> Optional[Union[ModelingOutcomes, Error]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[TextToCad, Error]]:
if response.status_code == 200:
response_200 = ModelingOutcomes.from_dict(response.json())
response_200 = TextToCad.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
@ -47,7 +44,7 @@ def _parse_response(
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[ModelingOutcomes, Error]]]:
) -> Response[Optional[Union[TextToCad, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -57,16 +54,16 @@ def _build_response(
def sync_detailed(
body: ModelingCmdReqBatch,
id: str,
*,
client: Client,
) -> Response[Optional[Union[ModelingOutcomes, Error]]]:
) -> Response[Optional[Union[TextToCad, Error]]]:
kwargs = _get_kwargs(
body=body,
id=id,
client=client,
)
response = httpx.post(
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
@ -75,40 +72,44 @@ def sync_detailed(
def sync(
body: ModelingCmdReqBatch,
id: str,
*,
client: Client,
) -> Optional[Union[ModelingOutcomes, Error]]:
) -> Optional[Union[TextToCad, Error]]:
"""This endpoint requires authentication by any KittyCAD user. The user must be the owner of the text-to-CAD model.""" # noqa: E501
return sync_detailed(
body=body,
id=id,
client=client,
).parsed
async def asyncio_detailed(
body: ModelingCmdReqBatch,
id: str,
*,
client: Client,
) -> Response[Optional[Union[ModelingOutcomes, Error]]]:
) -> Response[Optional[Union[TextToCad, Error]]]:
kwargs = _get_kwargs(
body=body,
id=id,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
body: ModelingCmdReqBatch,
id: str,
*,
client: Client,
) -> Optional[Union[ModelingOutcomes, Error]]:
) -> Optional[Union[TextToCad, Error]]:
"""This endpoint requires authentication by any KittyCAD user. The user must be the owner of the text-to-CAD model.""" # noqa: E501
return (
await asyncio_detailed(
body=body,
id=id,
client=client,
)
).parsed

View File

@ -0,0 +1,159 @@
from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.ai_prompt_results_page import AiPromptResultsPage
from ...models.created_at_sort_mode import CreatedAtSortMode
from ...models.error import Error
from ...types import Response
def _get_kwargs(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]:
url = "{}/ai-prompts".format(
client.base_url,
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:
url = url + "?sort_by=" + str(sort_by)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(
*, response: httpx.Response
) -> Optional[Union[AiPromptResultsPage, Error]]:
if response.status_code == 200:
response_200 = AiPromptResultsPage.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return Error.from_dict(response.json())
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[AiPromptResultsPage, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Optional[Union[AiPromptResultsPage, Error]]]:
kwargs = _get_kwargs(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[AiPromptResultsPage, Error]]:
"""For text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.
This endpoint requires authentication by a KittyCAD employee.
The AI prompts are returned in order of creation, with the most recently created AI prompts first.
""" # noqa: E501
return sync_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
).parsed
async def asyncio_detailed(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Optional[Union[AiPromptResultsPage, Error]]]:
kwargs = _get_kwargs(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[AiPromptResultsPage, Error]]:
"""For text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.
This endpoint requires authentication by a KittyCAD employee.
The AI prompts are returned in order of creation, with the most recently created AI prompts first.
""" # noqa: E501
return (
await asyncio_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
).parsed

View File

@ -0,0 +1,159 @@
from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.created_at_sort_mode import CreatedAtSortMode
from ...models.error import Error
from ...models.text_to_cad_results_page import TextToCadResultsPage
from ...types import Response
def _get_kwargs(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]:
url = "{}/user/text-to-cad".format(
client.base_url,
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:
url = url + "?sort_by=" + str(sort_by)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(
*, response: httpx.Response
) -> Optional[Union[TextToCadResultsPage, Error]]:
if response.status_code == 200:
response_200 = TextToCadResultsPage.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return Error.from_dict(response.json())
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[TextToCadResultsPage, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Optional[Union[TextToCadResultsPage, Error]]]:
kwargs = _get_kwargs(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[TextToCadResultsPage, Error]]:
"""This will always return the STEP file contents as well as the format the user originally requested.
This endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.
The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.
""" # noqa: E501
return sync_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
).parsed
async def asyncio_detailed(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Optional[Union[TextToCadResultsPage, Error]]]:
kwargs = _get_kwargs(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
sort_by: CreatedAtSortMode,
*,
client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[TextToCadResultsPage, Error]]:
"""This will always return the STEP file contents as well as the format the user originally requested.
This endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.
The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.
""" # noqa: E501
return (
await asyncio_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
client=client,
)
).parsed

View File

@ -10,6 +10,7 @@ from ...models.file_density import FileDensity
from ...models.file_mass import FileMass
from ...models.file_surface_area import FileSurfaceArea
from ...models.file_volume import FileVolume
from ...models.text_to_cad import TextToCad
from ...types import Response
@ -44,6 +45,7 @@ def _parse_response(
FileVolume,
FileDensity,
FileSurfaceArea,
TextToCad,
Error,
]
]:
@ -99,6 +101,15 @@ def _parse_response(
raise TypeError()
option_file_surface_area = FileSurfaceArea.from_dict(data)
return option_file_surface_area
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_text_to_cad = TextToCad.from_dict(data)
return option_text_to_cad
except ValueError:
raise
except TypeError:
@ -123,6 +134,7 @@ def _build_response(
FileVolume,
FileDensity,
FileSurfaceArea,
TextToCad,
Error,
]
]
@ -148,6 +160,7 @@ def sync_detailed(
FileVolume,
FileDensity,
FileSurfaceArea,
TextToCad,
Error,
]
]
@ -177,6 +190,7 @@ def sync(
FileVolume,
FileDensity,
FileSurfaceArea,
TextToCad,
Error,
]
]:
@ -205,6 +219,7 @@ async def asyncio_detailed(
FileVolume,
FileDensity,
FileSurfaceArea,
TextToCad,
Error,
]
]
@ -232,6 +247,7 @@ async def asyncio(
FileVolume,
FileDensity,
FileSurfaceArea,
TextToCad,
Error,
]
]:

View File

@ -4,7 +4,6 @@ from websockets.client import WebSocketClientProtocol, connect as ws_connect_asy
from websockets.sync.client import ClientConnection, connect as ws_connect
from ...client import Client
from ...models.error import Error
def _get_kwargs(
@ -34,14 +33,7 @@ def sync(
client=client,
)
with ws_connect(
kwargs["url"].replace("https://", "wss://"),
additional_headers=kwargs["headers"],
) as websocket:
return websocket # type: ignore
# Return an error if we got here.
return Error(message="An error occurred while connecting to the websocket.")
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore
async def asyncio(
@ -54,10 +46,6 @@ async def asyncio(
client=client,
)
async with ws_connect_async(
kwargs["url"].replace("https://", "wss://"), extra_headers=kwargs["headers"]
) as websocket:
return websocket
# Return an error if we got here.
return Error(message="An error occurred while connecting to the websocket.")
return await ws_connect_async(
kwargs["url"].replace("http", "ws"), extra_headers=kwargs["headers"]
)

View File

@ -101,7 +101,7 @@ def sync(
client: Client,
) -> Optional[Union[FileCenterOfMass, Error]]:
"""We assume any file given to us has one consistent unit throughout. We also assume the file is at the proper scale.
This endpoint returns the cartesian co-ordinate in world space measure units.
This endpoint returns the cartesian coordinate in world space measure units.
In the future, we will use the units inside the file if they are given and do any conversions if necessary for the calculation. But currently, that is not supported.
Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
@ -143,7 +143,7 @@ async def asyncio(
client: Client,
) -> Optional[Union[FileCenterOfMass, Error]]:
"""We assume any file given to us has one consistent unit throughout. We also assume the file is at the proper scale.
This endpoint returns the cartesian co-ordinate in world space measure units.
This endpoint returns the cartesian coordinate in world space measure units.
In the future, we will use the units inside the file if they are given and do any conversions if necessary for the calculation. But currently, that is not supported.
Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.

View File

@ -1,58 +0,0 @@
import base64
from typing import Any, Optional, Tuple, 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, Tuple[FileConversion, bytes], 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 + "===")
return (fc, b)
return fc
async def asyncio(
src_format: FileImportFormat,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, Tuple[FileConversion, bytes], 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 + "===")
return (fc, b)
return fc

View File

@ -1,47 +0,0 @@
import base64
from typing import Any, Optional, Tuple, 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, Tuple[FileConversion, bytes], 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 + "===")
return (fc, b)
return fc
async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, Tuple[FileConversion, bytes], 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 + "===")
return (fc, b)
return fc

View File

@ -3,29 +3,21 @@ from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.api_token import ApiToken
from ...models.error import Error
from ...models.file_export_format import FileExportFormat
from ...models.mesh import Mesh
from ...types import Response
def _get_kwargs(
output_format: FileExportFormat,
prompt: str,
discord_id: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/ai/text-to-3d/{output_format}".format(
url = "{}/internal/discord/api-token/{discord_id}".format(
client.base_url,
output_format=output_format,
discord_id=discord_id,
) # noqa: E501
if prompt is not None:
if "?" in url:
url = url + "&prompt=" + str(prompt)
else:
url = url + "?prompt=" + str(prompt)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
@ -37,9 +29,9 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Mesh, Error]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[ApiToken, Error]]:
if response.status_code == 200:
response_200 = Mesh.from_dict(response.json())
response_200 = ApiToken.from_dict(response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
@ -52,7 +44,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Mesh, Error]]
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[Mesh, Error]]]:
) -> Response[Optional[Union[ApiToken, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -62,18 +54,16 @@ def _build_response(
def sync_detailed(
output_format: FileExportFormat,
prompt: str,
discord_id: str,
*,
client: Client,
) -> Response[Optional[Union[Mesh, Error]]]:
) -> Response[Optional[Union[ApiToken, Error]]]:
kwargs = _get_kwargs(
output_format=output_format,
prompt=prompt,
discord_id=discord_id,
client=client,
)
response = httpx.post(
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
@ -82,50 +72,46 @@ def sync_detailed(
def sync(
output_format: FileExportFormat,
prompt: str,
discord_id: str,
*,
client: Client,
) -> Optional[Union[Mesh, Error]]:
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
) -> Optional[Union[ApiToken, Error]]:
"""This endpoint allows us to run API calls from our discord bot on behalf of a user. The user must have a discord account linked to their KittyCAD Account via oauth2 for this to work.
You must be a KittyCAD employee to use this endpoint.""" # noqa: E501
return sync_detailed(
output_format=output_format,
prompt=prompt,
discord_id=discord_id,
client=client,
).parsed
async def asyncio_detailed(
output_format: FileExportFormat,
prompt: str,
discord_id: str,
*,
client: Client,
) -> Response[Optional[Union[Mesh, Error]]]:
) -> Response[Optional[Union[ApiToken, Error]]]:
kwargs = _get_kwargs(
output_format=output_format,
prompt=prompt,
discord_id=discord_id,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
output_format: FileExportFormat,
prompt: str,
discord_id: str,
*,
client: Client,
) -> Optional[Union[Mesh, Error]]:
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
) -> Optional[Union[ApiToken, Error]]:
"""This endpoint allows us to run API calls from our discord bot on behalf of a user. The user must have a discord account linked to their KittyCAD Account via oauth2 for this to work.
You must be a KittyCAD employee to use this endpoint.""" # noqa: E501
return (
await asyncio_detailed(
output_format=output_format,
prompt=prompt,
discord_id=discord_id,
client=client,
)
).parsed

View File

@ -1,10 +1,13 @@
import json
from typing import Any, Dict
import bson
from websockets.client import WebSocketClientProtocol, connect as ws_connect_async
from websockets.sync.client import ClientConnection, connect as ws_connect
from ...client import Client
from ...models.error import Error
from ...models.web_socket_request import WebSocketRequest
from ...models.web_socket_response import WebSocketResponse
def _get_kwargs(
@ -12,6 +15,7 @@ def _get_kwargs(
unlocked_framerate: bool,
video_res_height: int,
video_res_width: int,
webrtc: bool,
*,
client: Client,
) -> Dict[str, Any]:
@ -25,9 +29,9 @@ def _get_kwargs(
if unlocked_framerate is not None:
if "?" in url:
url = url + "&unlocked_framerate=" + str(unlocked_framerate)
url = url + "&unlocked_framerate=" + str(unlocked_framerate).lower()
else:
url = url + "?unlocked_framerate=" + str(unlocked_framerate)
url = url + "?unlocked_framerate=" + str(unlocked_framerate).lower()
if video_res_height is not None:
if "?" in url:
@ -41,6 +45,12 @@ def _get_kwargs(
else:
url = url + "?video_res_width=" + str(video_res_width)
if webrtc is not None:
if "?" in url:
url = url + "&webrtc=" + str(webrtc).lower()
else:
url = url + "?webrtc=" + str(webrtc).lower()
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
@ -57,6 +67,7 @@ def sync(
unlocked_framerate: bool,
video_res_height: int,
video_res_width: int,
webrtc: bool,
*,
client: Client,
) -> ClientConnection:
@ -67,17 +78,11 @@ def sync(
unlocked_framerate=unlocked_framerate,
video_res_height=video_res_height,
video_res_width=video_res_width,
webrtc=webrtc,
client=client,
)
with ws_connect(
kwargs["url"].replace("https://", "wss://"),
additional_headers=kwargs["headers"],
) as websocket:
return websocket # type: ignore
# Return an error if we got here.
return Error(message="An error occurred while connecting to the websocket.")
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore
async def asyncio(
@ -85,6 +90,7 @@ async def asyncio(
unlocked_framerate: bool,
video_res_height: int,
video_res_width: int,
webrtc: bool,
*,
client: Client,
) -> WebSocketClientProtocol:
@ -95,13 +101,59 @@ async def asyncio(
unlocked_framerate=unlocked_framerate,
video_res_height=video_res_height,
video_res_width=video_res_width,
webrtc=webrtc,
client=client,
)
async with ws_connect_async(
kwargs["url"].replace("https://", "wss://"), extra_headers=kwargs["headers"]
) as websocket:
return websocket
return await ws_connect_async(
kwargs["url"].replace("http", "ws"), extra_headers=kwargs["headers"]
)
# Return an error if we got here.
return Error(message="An error occurred while connecting to the websocket.")
class WebSocket:
"""A websocket connection to the API endpoint."""
ws: ClientConnection
def __init__(
self,
fps: int,
unlocked_framerate: bool,
video_res_height: int,
video_res_width: int,
webrtc: bool,
client: Client,
):
self.ws = sync(
fps,
unlocked_framerate,
video_res_height,
video_res_width,
webrtc,
client=client,
)
def __enter__(
self,
):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.close()
def send(self, data: WebSocketRequest):
"""Send data to the websocket."""
self.ws.send(json.dumps(data.to_dict()))
def send_binary(self, data: WebSocketRequest):
"""Send data as bson to the websocket."""
self.ws.send(bson.BSON.encode(data.to_dict()))
def recv(self) -> WebSocketResponse:
"""Receive data from the websocket."""
message = self.ws.recv()
return WebSocketResponse.from_dict(json.loads(message))
def close(self):
"""Close the websocket."""
self.ws.close()

View File

@ -38,6 +38,10 @@ class Client:
"""Get a new client matching this one with a new timeout (in seconds)"""
return attr.evolve(self, timeout=timeout)
def with_base_url(self, url: str) -> "Client":
"""Get a new client matching this one with a new base url"""
return attr.evolve(self, base_url=url)
@attr.s(auto_attribs=True)
class ClientFromEnv(Client):

View File

@ -1,20 +1,20 @@
import json
import os
from typing import Tuple, Union
import uuid
from typing import Dict, Optional, Union
import pytest
from .api.api_tokens import list_api_tokens_for_user
from .api.file import (
create_file_conversion_with_base64_helper,
create_file_mass,
create_file_volume,
)
from .api.file import create_file_conversion, create_file_mass, create_file_volume
from .api.meta import ping
from .api.modeling import modeling_commands_ws
from .api.users import get_user_self, list_users_extended
from .client import ClientFromEnv
from .models import (
ApiCallStatus,
ApiTokenResultsPage,
Base64Data,
CreatedAtSortMode,
Error,
ExtendedUserResultsPage,
@ -23,12 +23,18 @@ from .models import (
FileImportFormat,
FileMass,
FileVolume,
ModelingCmd,
ModelingCmdId,
Pong,
UnitDensity,
UnitMass,
UnitVolume,
User,
WebSocketRequest,
)
from .models.modeling_cmd import start_path
from .models.web_socket_request import modeling_cmd_req
from .types import Unset
def test_get_session():
@ -106,19 +112,16 @@ def test_file_convert_stl():
file.close()
# Get the fc.
result: Union[
Tuple[FileConversion, bytes], Error, None
] = create_file_conversion_with_base64_helper.sync(
result: Optional[Union[FileConversion, Error]] = create_file_conversion.sync(
client=client,
body=content,
src_format=FileImportFormat.STL,
output_format=FileExportFormat.OBJ,
)
r: Tuple[FileConversion, bytes] = result # type: ignore
assert isinstance(result, FileConversion)
b: bytes = r[1]
fc: FileConversion = r[0]
fc: FileConversion = result
print(f"FileConversion: {fc}")
@ -127,8 +130,12 @@ def test_file_convert_stl():
print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset)
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty.
assert len(b) > 0
for key, value in outputs.items():
assert len(value.get_decoded()) > 0
@pytest.mark.asyncio
@ -142,19 +149,18 @@ async def test_file_convert_stl_async():
file.close()
# Get the fc.
result: Union[
Tuple[FileConversion, bytes], Error, None
] = await create_file_conversion_with_base64_helper.asyncio(
result: Optional[
Union[FileConversion, Error]
] = await create_file_conversion.asyncio(
client=client,
body=content,
src_format=FileImportFormat.STL,
output_format=FileExportFormat.OBJ,
)
r: Tuple[FileConversion, bytes] = result # type: ignore
assert isinstance(result, FileConversion)
b: bytes = r[1]
fc: FileConversion = r[0]
fc: FileConversion = result
print(f"FileConversion: {fc}")
@ -163,8 +169,51 @@ async def test_file_convert_stl_async():
print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset)
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty.
assert len(b) > 0
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():
@ -242,3 +291,30 @@ def test_list_users():
assert isinstance(response, ExtendedUserResultsPage)
print(f"ExtendedUserResultsPage: {response}")
def test_ws():
# Create our client.
client = ClientFromEnv()
# Connect to the websocket.
with modeling_commands_ws.WebSocket(
client=client,
fps=30,
unlocked_framerate=False,
video_res_height=360,
video_res_width=480,
webrtc=False,
) as websocket:
# Send a message.
id = uuid.uuid4()
req = WebSocketRequest(
modeling_cmd_req(cmd=ModelingCmd(start_path()), cmd_id=ModelingCmdId(id))
)
json.dumps(req.to_dict())
websocket.send(req)
# Get the messages.
while True:
websocket.recv()
break

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,17 @@
""" Contains all the data models used in inputs/outputs """
from .account_provider import AccountProvider
from .ai_feedback import AiFeedback
from .ai_plugin_api import AiPluginApi
from .ai_plugin_api_type import AiPluginApiType
from .ai_plugin_auth import AiPluginAuth
from .ai_plugin_auth_type import AiPluginAuthType
from .ai_plugin_http_auth_type import AiPluginHttpAuthType
from .ai_plugin_manifest import AiPluginManifest
from .ai_prompt import AiPrompt
from .ai_prompt_results_page import AiPromptResultsPage
from .ai_prompt_type import AiPromptType
from .angle import Angle
from .annotation_line_end import AnnotationLineEnd
from .annotation_line_end_options import AnnotationLineEndOptions
from .annotation_options import AnnotationOptions
@ -19,6 +24,7 @@ from .api_call_query_group_by import ApiCallQueryGroupBy
from .api_call_status import ApiCallStatus
from .api_call_with_price import ApiCallWithPrice
from .api_call_with_price_results_page import ApiCallWithPriceResultsPage
from .api_error import ApiError
from .api_token import ApiToken
from .api_token_results_page import ApiTokenResultsPage
from .app_client_info import AppClientInfo
@ -28,39 +34,50 @@ from .async_api_call_results_page import AsyncApiCallResultsPage
from .async_api_call_type import AsyncApiCallType
from .axis import Axis
from .axis_direction_pair import AxisDirectionPair
from .base64data import Base64Data
from .billing_info import BillingInfo
from .cache_metadata import CacheMetadata
from .camera_drag_interaction_type import CameraDragInteractionType
from .card_details import CardDetails
from .center_of_mass import CenterOfMass
from .client_metrics import ClientMetrics
from .cluster import Cluster
from .code_language import CodeLanguage
from .code_output import CodeOutput
from .color import Color
from .commit import Commit
from .connection import Connection
from .country_code import CountryCode
from .coupon import Coupon
from .created_at_sort_mode import CreatedAtSortMode
from .currency import Currency
from .curve_get_control_points import CurveGetControlPoints
from .curve_get_end_points import CurveGetEndPoints
from .curve_get_type import CurveGetType
from .curve_type import CurveType
from .customer import Customer
from .customer_balance import CustomerBalance
from .density import Density
from .device_access_token_request_form import DeviceAccessTokenRequestForm
from .device_auth_request_form import DeviceAuthRequestForm
from .device_auth_verify_params import DeviceAuthVerifyParams
from .direction import Direction
from .discount import Discount
from .docker_system_info import DockerSystemInfo
from .email_authentication_form import EmailAuthenticationForm
from .engine_metadata import EngineMetadata
from .empty import Empty
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 .environment import Environment
from .error import Error
from .error_code import ErrorCode
from .error_response import ErrorResponse
from .executor_metadata import ExecutorMetadata
from .export import Export
from .export_file import ExportFile
from .extended_user import ExtendedUser
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_conversion import FileConversion
from .file_density import FileDensity
@ -71,9 +88,15 @@ from .file_surface_area import FileSurfaceArea
from .file_system_metadata import FileSystemMetadata
from .file_volume import FileVolume
from .gateway import Gateway
from .get_entity_type import GetEntityType
from .get_sketch_mode_plane import GetSketchModePlane
from .gltf_presentation import GltfPresentation
from .gltf_storage import GltfStorage
from .highlight_set_entity import HighlightSetEntity
from .ice_server import IceServer
from .image_type import ImageType
from .index_info import IndexInfo
from .image_format import ImageFormat
from .import_file import ImportFile
from .import_files import ImportFiles
from .input_format import InputFormat
from .invoice import Invoice
from .invoice_line_item import InvoiceLineItem
@ -83,52 +106,62 @@ from .jetstream_api_stats import JetstreamApiStats
from .jetstream_config import JetstreamConfig
from .jetstream_stats import JetstreamStats
from .leaf_node import LeafNode
from .mesh import Mesh
from .mass import Mass
from .meta_cluster_info import MetaClusterInfo
from .metadata import Metadata
from .method import Method
from .modeling_cmd import ModelingCmd
from .modeling_cmd_id import ModelingCmdId
from .modeling_cmd_req import ModelingCmdReq
from .modeling_cmd_req_batch import ModelingCmdReqBatch
from .modeling_error import ModelingError
from .modeling_outcome import ModelingOutcome
from .modeling_outcomes import ModelingOutcomes
from .mouse_click import MouseClick
from .new_address import NewAddress
from .o_auth2_client_info import OAuth2ClientInfo
from .o_auth2_grant_type import OAuth2GrantType
from .ok_modeling_cmd_response import OkModelingCmdResponse
from .ok_web_socket_response_data import OkWebSocketResponseData
from .onboarding import Onboarding
from .output_file import OutputFile
from .output_format import OutputFormat
from .path_command import PathCommand
from .path_component_constraint_bound import PathComponentConstraintBound
from .path_component_constraint_type import PathComponentConstraintType
from .path_get_curve_uuids_for_vertices import PathGetCurveUuidsForVertices
from .path_get_info import PathGetInfo
from .path_get_vertex_uuids import PathGetVertexUuids
from .path_segment import PathSegment
from .path_segment_info import PathSegmentInfo
from .payment_intent import PaymentIntent
from .payment_method import PaymentMethod
from .payment_method_card_checks import PaymentMethodCardChecks
from .payment_method_type import PaymentMethodType
from .plugins_info import PluginsInfo
from .plane_intersect_and_project import PlaneIntersectAndProject
from .ply_storage import PlyStorage
from .point2d import Point2d
from .point3d import Point3d
from .point_e_metadata import PointEMetadata
from .pong import Pong
from .raw_file import RawFile
from .registry_service_config import RegistryServiceConfig
from .rtc_ice_candidate import RtcIceCandidate
from .rtc_ice_candidate_init import RtcIceCandidateInit
from .rtc_ice_candidate_type import RtcIceCandidateType
from .rtc_ice_protocol import RtcIceProtocol
from .rtc_sdp_type import RtcSdpType
from .rtc_session_description import RtcSessionDescription
from .runtime import Runtime
from .scene_selection_type import SceneSelectionType
from .scene_tool_type import SceneToolType
from .select_get import SelectGet
from .select_with_point import SelectWithPoint
from .selection import Selection
from .session import Session
from .snake_case_result import SnakeCaseResult
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 .surface_area import SurfaceArea
from .system import System
from .system_info_cgroup_driver_enum import SystemInfoCgroupDriverEnum
from .system_info_cgroup_version_enum import SystemInfoCgroupVersionEnum
from .system_info_default_address_pools import SystemInfoDefaultAddressPools
from .system_info_isolation_enum import SystemInfoIsolationEnum
from .take_snapshot import TakeSnapshot
from .text_to_cad import TextToCad
from .text_to_cad_create_body import TextToCadCreateBody
from .text_to_cad_results_page import TextToCadResultsPage
from .unit_angle import UnitAngle
from .unit_angle_conversion import UnitAngleConversion
from .unit_area import UnitArea
@ -160,6 +193,8 @@ from .update_user import UpdateUser
from .user import User
from .user_results_page import UserResultsPage
from .uuid import Uuid
from .uuid_binary import UuidBinary
from .verification_token import VerificationToken
from .web_socket_messages import WebSocketMessages
from .web_socket_responses import WebSocketResponses
from .volume import Volume
from .web_socket_request import WebSocketRequest
from .web_socket_response import WebSocketResponse

View File

@ -4,6 +4,8 @@ from enum import Enum
class AccountProvider(str, Enum):
"""An account provider.""" # noqa: E501
"""# The Discord account provider. """ # noqa: E501
DISCORD = "discord"
"""# The Google account provider. """ # noqa: E501
GOOGLE = "google"
"""# The GitHub account provider. """ # noqa: E501

View File

@ -0,0 +1,13 @@
from enum import Enum
class AiFeedback(str, Enum):
"""Human feedback on an AI response.""" # noqa: E501
"""# Thumbs up. """ # noqa: E501
THUMBS_UP = "thumbs_up"
"""# Thumbs down. """ # noqa: E501
THUMBS_DOWN = "thumbs_down"
def __str__(self) -> str:
return str(self.value)

View File

@ -45,8 +45,10 @@ class AiPluginApi:
type: Union[Unset, AiPluginApiType]
if isinstance(_type, Unset):
type = UNSET
if _type is None:
type = UNSET
else:
type = _type # type: ignore[arg-type]
type = _type
url = d.pop("url", UNSET)

View File

@ -41,15 +41,19 @@ class AiPluginAuth:
authorization_type: Union[Unset, AiPluginHttpAuthType]
if isinstance(_authorization_type, Unset):
authorization_type = UNSET
if _authorization_type is None:
authorization_type = UNSET
else:
authorization_type = _authorization_type # type: ignore[arg-type]
authorization_type = _authorization_type
_type = d.pop("type", UNSET)
type: Union[Unset, AiPluginAuthType]
if isinstance(_type, Unset):
type = UNSET
if _type is None:
type = UNSET
else:
type = _type # type: ignore[arg-type]
type = _type
ai_plugin_auth = cls(
authorization_type=authorization_type,

View File

@ -47,9 +47,9 @@ class AiPluginManifest:
field_dict.update(self.additional_properties)
field_dict.update({})
if api is not UNSET:
field_dict["api"] = api
field_dict["api"] = api.to_dict()
if auth is not UNSET:
field_dict["auth"] = auth
field_dict["auth"] = auth.to_dict()
if contact_email is not UNSET:
field_dict["contact_email"] = contact_email
if description_for_human is not UNSET:
@ -76,15 +76,19 @@ class AiPluginManifest:
api: Union[Unset, AiPluginApi]
if isinstance(_api, Unset):
api = UNSET
if _api is None:
api = UNSET
else:
api = _api # type: ignore[arg-type]
api = AiPluginApi.from_dict(_api)
_auth = d.pop("auth", UNSET)
auth: Union[Unset, AiPluginAuth]
if isinstance(_auth, Unset):
auth = UNSET
if _auth is None:
auth = UNSET
else:
auth = _auth # type: ignore[arg-type]
auth = AiPluginAuth.from_dict(_auth)
contact_email = d.pop("contact_email", UNSET)

View File

@ -0,0 +1,219 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from dateutil.parser import isoparse
from ..models.ai_feedback import AiFeedback
from ..models.ai_prompt_type import AiPromptType
from ..models.api_call_status import ApiCallStatus
from ..models.uuid import Uuid
from ..models.uuid_binary import UuidBinary
from ..types import UNSET, Unset
GO = TypeVar("GO", bound="AiPrompt")
@attr.s(auto_attribs=True)
class AiPrompt:
"""An AI prompt.""" # noqa: E501
completed_at: Union[Unset, datetime.datetime] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
feedback: Union[Unset, AiFeedback] = UNSET
id: Union[Unset, UuidBinary] = UNSET
metadata: Union[Unset, Any] = UNSET
model_version: Union[Unset, str] = UNSET
output_file: Union[Unset, str] = UNSET
prompt: Union[Unset, str] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET
type: Union[Unset, AiPromptType] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
completed_at: Union[Unset, str] = UNSET
if not isinstance(self.completed_at, Unset):
completed_at = self.completed_at.isoformat()
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
error = self.error
if not isinstance(self.feedback, Unset):
feedback = self.feedback
if not isinstance(self.id, Unset):
id = self.id
metadata = self.metadata
model_version = self.model_version
output_file = self.output_file
prompt = self.prompt
started_at: Union[Unset, str] = UNSET
if not isinstance(self.started_at, Unset):
started_at = self.started_at.isoformat()
if not isinstance(self.status, Unset):
status = self.status
if not isinstance(self.type, Unset):
type = self.type
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if completed_at is not UNSET:
field_dict["completed_at"] = completed_at
if created_at is not UNSET:
field_dict["created_at"] = created_at
if error is not UNSET:
field_dict["error"] = error
if feedback is not UNSET:
field_dict["feedback"] = feedback
if id is not UNSET:
field_dict["id"] = id
if metadata is not UNSET:
field_dict["metadata"] = metadata
if model_version is not UNSET:
field_dict["model_version"] = model_version
if output_file is not UNSET:
field_dict["output_file"] = output_file
if prompt is not UNSET:
field_dict["prompt"] = prompt
if started_at is not UNSET:
field_dict["started_at"] = started_at
if status is not UNSET:
field_dict["status"] = status
if type is not UNSET:
field_dict["type"] = type
if updated_at is not UNSET:
field_dict["updated_at"] = updated_at
if user_id is not UNSET:
field_dict["user_id"] = user_id
return field_dict
@classmethod
def from_dict(cls: Type[GO], src_dict: Dict[str, Any]) -> GO:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
if isinstance(_completed_at, Unset):
completed_at = UNSET
else:
completed_at = isoparse(_completed_at)
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]
if isinstance(_created_at, Unset):
created_at = UNSET
else:
created_at = isoparse(_created_at)
error = d.pop("error", UNSET)
_feedback = d.pop("feedback", UNSET)
feedback: Union[Unset, AiFeedback]
if isinstance(_feedback, Unset):
feedback = UNSET
if _feedback is None:
feedback = UNSET
else:
feedback = _feedback
_id = d.pop("id", UNSET)
id: Union[Unset, UuidBinary]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id
metadata = d.pop("metadata", UNSET)
model_version = d.pop("model_version", UNSET)
output_file = d.pop("output_file", UNSET)
prompt = d.pop("prompt", UNSET)
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
if isinstance(_started_at, Unset):
started_at = UNSET
else:
started_at = isoparse(_started_at)
_status = d.pop("status", UNSET)
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status
_type = d.pop("type", UNSET)
type: Union[Unset, AiPromptType]
if isinstance(_type, Unset):
type = UNSET
if _type is None:
type = UNSET
else:
type = _type
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
ai_prompt = cls(
completed_at=completed_at,
created_at=created_at,
error=error,
feedback=feedback,
id=id,
metadata=metadata,
model_version=model_version,
output_file=output_file,
prompt=prompt,
started_at=started_at,
status=status,
type=type,
updated_at=updated_at,
user_id=user_id,
)
ai_prompt.additional_properties = d
return ai_prompt
@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,70 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
PI = TypeVar("PI", bound="AiPromptResultsPage")
@attr.s(auto_attribs=True)
class AiPromptResultsPage:
"""A single page of results""" # noqa: E501
from ..models.ai_prompt import AiPrompt
items: Union[Unset, List[AiPrompt]] = UNSET
next_page: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.ai_prompt import AiPrompt
items: Union[Unset, List[AiPrompt]] = UNSET
if not isinstance(self.items, Unset):
items = self.items
next_page = self.next_page
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if items is not UNSET:
field_dict["items"] = items
if next_page is not UNSET:
field_dict["next_page"] = next_page
return field_dict
@classmethod
def from_dict(cls: Type[PI], src_dict: Dict[str, Any]) -> PI:
d = src_dict.copy()
from ..models.ai_prompt import AiPrompt
items = cast(List[AiPrompt], d.pop("items", UNSET))
next_page = d.pop("next_page", UNSET)
ai_prompt_results_page = cls(
items=items,
next_page=next_page,
)
ai_prompt_results_page.additional_properties = d
return ai_prompt_results_page
@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 AiPromptType(str, Enum):
"""A type of AI prompt.""" # noqa: E501
"""# Text to CAD. """ # noqa: E501
TEXT_TO_CAD = "text_to_cad"
def __str__(self) -> str:
return str(self.value)

71
kittycad/models/angle.py Normal file
View File

@ -0,0 +1,71 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.unit_angle import UnitAngle
from ..types import UNSET, Unset
UZ = TypeVar("UZ", bound="Angle")
@attr.s(auto_attribs=True)
class Angle:
"""An angle, with a specific unit.""" # noqa: E501
unit: Union[Unset, UnitAngle] = UNSET
value: Union[Unset, float] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.unit, Unset):
unit = self.unit
value = self.value
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if unit is not UNSET:
field_dict["unit"] = unit
if value is not UNSET:
field_dict["value"] = value
return field_dict
@classmethod
def from_dict(cls: Type[UZ], src_dict: Dict[str, Any]) -> UZ:
d = src_dict.copy()
_unit = d.pop("unit", UNSET)
unit: Union[Unset, UnitAngle]
if isinstance(_unit, Unset):
unit = UNSET
if _unit is None:
unit = UNSET
else:
unit = _unit
value = d.pop("value", UNSET)
angle = cls(
unit=unit,
value=value,
)
angle.additional_properties = d
return angle
@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

@ -5,7 +5,7 @@ import attr
from ..models.annotation_line_end import AnnotationLineEnd
from ..types import UNSET, Unset
GO = TypeVar("GO", bound="AnnotationLineEndOptions")
FB = TypeVar("FB", bound="AnnotationLineEndOptions")
@attr.s(auto_attribs=True)
@ -34,21 +34,25 @@ class AnnotationLineEndOptions:
return field_dict
@classmethod
def from_dict(cls: Type[GO], src_dict: Dict[str, Any]) -> GO:
def from_dict(cls: Type[FB], src_dict: Dict[str, Any]) -> FB:
d = src_dict.copy()
_end = d.pop("end", UNSET)
end: Union[Unset, AnnotationLineEnd]
if isinstance(_end, Unset):
end = UNSET
if _end is None:
end = UNSET
else:
end = _end # type: ignore[arg-type]
end = _end
_start = d.pop("start", UNSET)
start: Union[Unset, AnnotationLineEnd]
if isinstance(_start, Unset):
start = UNSET
if _start is None:
start = UNSET
else:
start = _start # type: ignore[arg-type]
start = _start
annotation_line_end_options = cls(
end=end,

View File

@ -8,7 +8,7 @@ from ..models.color import Color
from ..models.point3d import Point3d
from ..types import UNSET, Unset
PI = TypeVar("PI", bound="AnnotationOptions")
QP = TypeVar("QP", bound="AnnotationOptions")
@attr.s(auto_attribs=True)
@ -38,34 +38,38 @@ class AnnotationOptions:
field_dict.update(self.additional_properties)
field_dict.update({})
if color is not UNSET:
field_dict["color"] = color
field_dict["color"] = color.to_dict()
if line_ends is not UNSET:
field_dict["line_ends"] = line_ends
field_dict["line_ends"] = line_ends.to_dict()
if line_width is not UNSET:
field_dict["line_width"] = line_width
if position is not UNSET:
field_dict["position"] = position
field_dict["position"] = position.to_dict()
if text is not UNSET:
field_dict["text"] = text
field_dict["text"] = text.to_dict()
return field_dict
@classmethod
def from_dict(cls: Type[PI], src_dict: Dict[str, Any]) -> PI:
def from_dict(cls: Type[QP], src_dict: Dict[str, Any]) -> QP:
d = src_dict.copy()
_color = d.pop("color", UNSET)
color: Union[Unset, Color]
if isinstance(_color, Unset):
color = UNSET
if _color is None:
color = UNSET
else:
color = _color # type: ignore[arg-type]
color = Color.from_dict(_color)
_line_ends = d.pop("line_ends", UNSET)
line_ends: Union[Unset, AnnotationLineEndOptions]
if isinstance(_line_ends, Unset):
line_ends = UNSET
if _line_ends is None:
line_ends = UNSET
else:
line_ends = _line_ends # type: ignore[arg-type]
line_ends = AnnotationLineEndOptions.from_dict(_line_ends)
line_width = d.pop("line_width", UNSET)
@ -73,15 +77,19 @@ class AnnotationOptions:
position: Union[Unset, Point3d]
if isinstance(_position, Unset):
position = UNSET
if _position is None:
position = UNSET
else:
position = _position # type: ignore[arg-type]
position = Point3d.from_dict(_position)
_text = d.pop("text", UNSET)
text: Union[Unset, AnnotationTextOptions]
if isinstance(_text, Unset):
text = UNSET
if _text is None:
text = UNSET
else:
text = _text # type: ignore[arg-type]
text = AnnotationTextOptions.from_dict(_text)
annotation_options = cls(
color=color,

View File

@ -2,7 +2,7 @@ from enum import Enum
class AnnotationTextAlignmentX(str, Enum):
"""Horizontal Text aligment""" # noqa: E501
"""Horizontal Text alignment""" # noqa: E501
LEFT = "left"
CENTER = "center"

View File

@ -2,7 +2,7 @@ from enum import Enum
class AnnotationTextAlignmentY(str, Enum):
"""Vertical Text aligment""" # noqa: E501
"""Vertical Text alignment""" # noqa: E501
BOTTOM = "bottom"
CENTER = "center"

View File

@ -6,7 +6,7 @@ from ..models.annotation_text_alignment_x import AnnotationTextAlignmentX
from ..models.annotation_text_alignment_y import AnnotationTextAlignmentY
from ..types import UNSET, Unset
UZ = TypeVar("UZ", bound="AnnotationTextOptions")
KC = TypeVar("KC", bound="AnnotationTextOptions")
@attr.s(auto_attribs=True)
@ -43,7 +43,7 @@ class AnnotationTextOptions:
return field_dict
@classmethod
def from_dict(cls: Type[UZ], src_dict: Dict[str, Any]) -> UZ:
def from_dict(cls: Type[KC], src_dict: Dict[str, Any]) -> KC:
d = src_dict.copy()
point_size = d.pop("point_size", UNSET)
@ -53,15 +53,19 @@ class AnnotationTextOptions:
x: Union[Unset, AnnotationTextAlignmentX]
if isinstance(_x, Unset):
x = UNSET
if _x is None:
x = UNSET
else:
x = _x # type: ignore[arg-type]
x = _x
_y = d.pop("y", UNSET)
y: Union[Unset, AnnotationTextAlignmentY]
if isinstance(_y, Unset):
y = UNSET
if _y is None:
y = UNSET
else:
y = _y # type: ignore[arg-type]
y = _y
annotation_text_options = cls(
point_size=point_size,

View File

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

View File

@ -8,7 +8,7 @@ from ..models.method import Method
from ..models.uuid import Uuid
from ..types import UNSET, Unset
QP = TypeVar("QP", bound="ApiCallWithPrice")
LB = TypeVar("LB", bound="ApiCallWithPrice")
@attr.s(auto_attribs=True)
@ -126,7 +126,7 @@ class ApiCallWithPrice:
return field_dict
@classmethod
def from_dict(cls: Type[QP], src_dict: Dict[str, Any]) -> QP:
def from_dict(cls: Type[LB], src_dict: Dict[str, Any]) -> LB:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -152,8 +152,10 @@ class ApiCallWithPrice:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
id = _id
ip_address = d.pop("ip_address", UNSET)
@ -163,8 +165,10 @@ class ApiCallWithPrice:
method: Union[Unset, Method]
if isinstance(_method, Unset):
method = UNSET
if _method is None:
method = UNSET
else:
method = _method # type: ignore[arg-type]
method = _method
minutes = d.pop("minutes", UNSET)
@ -193,8 +197,10 @@ class ApiCallWithPrice:
token: Union[Unset, Uuid]
if isinstance(_token, Unset):
token = UNSET
if _token is None:
token = UNSET
else:
token = _token # type: ignore[arg-type]
token = _token
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
@ -205,7 +211,14 @@ class ApiCallWithPrice:
user_agent = d.pop("user_agent", UNSET)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
api_call_with_price = cls(
completed_at=completed_at,

View File

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

View File

@ -0,0 +1,71 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.error_code import ErrorCode
from ..types import UNSET, Unset
TL = TypeVar("TL", 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[TL], src_dict: Dict[str, Any]) -> TL:
d = src_dict.copy()
_error_code = d.pop("error_code", UNSET)
error_code: Union[Unset, ErrorCode]
if isinstance(_error_code, Unset):
error_code = UNSET
if _error_code is None:
error_code = UNSET
else:
error_code = _error_code
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 ..types import UNSET, Unset
HX = TypeVar("HX", bound="ApiToken")
MN = TypeVar("MN", bound="ApiToken")
@attr.s(auto_attribs=True)
@ -56,7 +56,7 @@ class ApiToken:
return field_dict
@classmethod
def from_dict(cls: Type[HX], src_dict: Dict[str, Any]) -> HX:
def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN:
d = src_dict.copy()
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]
@ -65,7 +65,14 @@ class ApiToken:
else:
created_at = isoparse(_created_at)
id = d.pop("id", UNSET)
_id = d.pop("id", UNSET)
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id
is_valid = d.pop("is_valid", UNSET)
@ -73,8 +80,10 @@ class ApiToken:
token: Union[Unset, Uuid]
if isinstance(_token, Unset):
token = UNSET
if _token is None:
token = UNSET
else:
token = _token # type: ignore[arg-type]
token = _token
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
@ -83,7 +92,14 @@ class ApiToken:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
api_token = cls(
created_at=created_at,

View File

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

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
NE = TypeVar("NE", bound="AppClientInfo")
IO = TypeVar("IO", bound="AppClientInfo")
@attr.s(auto_attribs=True)
@ -27,7 +27,7 @@ class AppClientInfo:
return field_dict
@classmethod
def from_dict(cls: Type[NE], src_dict: Dict[str, Any]) -> NE:
def from_dict(cls: Type[IO], src_dict: Dict[str, Any]) -> IO:
d = src_dict.copy()
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 ..types import UNSET, Unset
TL = TypeVar("TL", bound="AsyncApiCall")
FV = TypeVar("FV", bound="AsyncApiCall")
@attr.s(auto_attribs=True)
@ -86,7 +86,7 @@ class AsyncApiCall:
return field_dict
@classmethod
def from_dict(cls: Type[TL], src_dict: Dict[str, Any]) -> TL:
def from_dict(cls: Type[FV], src_dict: Dict[str, Any]) -> FV:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -108,8 +108,10 @@ class AsyncApiCall:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
id = _id
input = d.pop("input", UNSET)
output = d.pop("output", UNSET)
@ -124,15 +126,19 @@ class AsyncApiCall:
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status # type: ignore[arg-type]
status = _status
_type = d.pop("type", UNSET)
type: Union[Unset, AsyncApiCallType]
if isinstance(_type, Unset):
type = UNSET
if _type is None:
type = UNSET
else:
type = _type # type: ignore[arg-type]
type = _type
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
@ -141,7 +147,14 @@ class AsyncApiCall:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
worker = d.pop("worker", UNSET)

View File

@ -4,7 +4,9 @@ from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from dateutil.parser import isoparse
from ..models.ai_feedback import AiFeedback
from ..models.api_call_status import ApiCallStatus
from ..models.base64data import Base64Data
from ..models.file_export_format import FileExportFormat
from ..models.file_import_format import FileImportFormat
from ..models.input_format import InputFormat
@ -18,7 +20,7 @@ from ..models.unit_volume import UnitVolume
from ..models.uuid import Uuid
from ..types import UNSET, Unset
MN = TypeVar("MN", bound="file_conversion")
LE = TypeVar("LE", bound="file_conversion")
@attr.s(auto_attribs=True)
@ -29,10 +31,9 @@ class file_conversion:
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
output: Union[Unset, str] = UNSET
output_format: Union[Unset, FileExportFormat] = 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_options: Union[Unset, InputFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
@ -52,12 +53,16 @@ class file_conversion:
created_at = self.created_at.isoformat()
error = self.error
id = self.id
output = self.output
if not isinstance(self.output_format, Unset):
output_format = self.output_format
if not isinstance(self.output_format_options, Unset):
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):
src_format = self.src_format
if not isinstance(self.src_format_options, Unset):
@ -84,18 +89,16 @@ class file_conversion:
field_dict["error"] = error
if id is not UNSET:
field_dict["id"] = id
if output is not UNSET:
field_dict["output"] = output
if output_format is not UNSET:
field_dict["output_format"] = output_format
if output_format_options is not UNSET:
field_dict["output_format_options"] = output_format_options
field_dict["output_format_options"] = output_format_options.to_dict()
if outputs is not UNSET:
field_dict["outputs"] = outputs
if src_format is not UNSET:
field_dict["src_format"] = src_format
if src_format_options is not UNSET:
field_dict["src_format_options"] = src_format_options
field_dict["src_format_options"] = src_format_options.to_dict()
if started_at is not UNSET:
field_dict["started_at"] = started_at
if status is not UNSET:
@ -109,7 +112,7 @@ class file_conversion:
return field_dict
@classmethod
def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN:
def from_dict(cls: Type[LE], src_dict: Dict[str, Any]) -> LE:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -131,39 +134,55 @@ class file_conversion:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
output = d.pop("output", UNSET)
id = _id
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, FileExportFormat]
if isinstance(_output_format, Unset):
output_format = UNSET
if _output_format is None:
output_format = UNSET
else:
output_format = _output_format # type: ignore[arg-type]
output_format = _output_format
_output_format_options = d.pop("output_format_options", UNSET)
output_format_options: Union[Unset, OutputFormat]
if isinstance(_output_format_options, Unset):
output_format_options = UNSET
if _output_format_options is None:
output_format_options = UNSET
else:
output_format_options = _output_format_options # type: ignore[arg-type]
output_format_options = OutputFormat.from_dict(_output_format_options)
_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
outputs = d.pop("outputs", UNSET)
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
if _src_format is None:
src_format = UNSET
else:
src_format = _src_format # type: ignore[arg-type]
src_format = _src_format
_src_format_options = d.pop("src_format_options", UNSET)
src_format_options: Union[Unset, InputFormat]
if isinstance(_src_format_options, Unset):
src_format_options = UNSET
if _src_format_options is None:
src_format_options = UNSET
else:
src_format_options = _src_format_options # type: ignore[arg-type]
src_format_options = InputFormat.from_dict(_src_format_options)
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
@ -176,8 +195,10 @@ class file_conversion:
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status # type: ignore[arg-type]
status = _status
type = d.pop("type", UNSET)
@ -188,14 +209,20 @@ class file_conversion:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
file_conversion = cls(
completed_at=completed_at,
created_at=created_at,
error=error,
id=id,
output=output,
output_format=output_format,
output_format_options=output_format_options,
outputs=outputs,
@ -228,7 +255,7 @@ class file_conversion:
return key in self.additional_properties
JV = TypeVar("JV", bound="file_center_of_mass")
OY = TypeVar("OY", bound="file_center_of_mass")
@attr.s(auto_attribs=True)
@ -280,7 +307,7 @@ class file_center_of_mass:
field_dict.update(self.additional_properties)
field_dict.update({})
if center_of_mass is not UNSET:
field_dict["center_of_mass"] = center_of_mass
field_dict["center_of_mass"] = center_of_mass.to_dict()
if completed_at is not UNSET:
field_dict["completed_at"] = completed_at
if created_at is not UNSET:
@ -306,14 +333,16 @@ class file_center_of_mass:
return field_dict
@classmethod
def from_dict(cls: Type[JV], src_dict: Dict[str, Any]) -> JV:
def from_dict(cls: Type[OY], src_dict: Dict[str, Any]) -> OY:
d = src_dict.copy()
_center_of_mass = d.pop("center_of_mass", UNSET)
center_of_mass: Union[Unset, Point3d]
if isinstance(_center_of_mass, Unset):
center_of_mass = UNSET
if _center_of_mass is None:
center_of_mass = UNSET
else:
center_of_mass = _center_of_mass # type: ignore[arg-type]
center_of_mass = Point3d.from_dict(_center_of_mass)
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -335,22 +364,28 @@ class file_center_of_mass:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
id = _id
_output_unit = d.pop("output_unit", UNSET)
output_unit: Union[Unset, UnitLength]
if isinstance(_output_unit, Unset):
output_unit = UNSET
if _output_unit is None:
output_unit = UNSET
else:
output_unit = _output_unit # type: ignore[arg-type]
output_unit = _output_unit
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
if _src_format is None:
src_format = UNSET
else:
src_format = _src_format # type: ignore[arg-type]
src_format = _src_format
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
@ -363,8 +398,10 @@ class file_center_of_mass:
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status # type: ignore[arg-type]
status = _status
type = d.pop("type", UNSET)
@ -375,7 +412,14 @@ class file_center_of_mass:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
file_center_of_mass = cls(
center_of_mass=center_of_mass,
@ -412,7 +456,7 @@ class file_center_of_mass:
return key in self.additional_properties
IO = TypeVar("IO", bound="file_mass")
HO = TypeVar("HO", bound="file_mass")
@attr.s(auto_attribs=True)
@ -498,7 +542,7 @@ class file_mass:
return field_dict
@classmethod
def from_dict(cls: Type[IO], src_dict: Dict[str, Any]) -> IO:
def from_dict(cls: Type[HO], src_dict: Dict[str, Any]) -> HO:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -520,8 +564,10 @@ class file_mass:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
id = _id
mass = d.pop("mass", UNSET)
@ -531,22 +577,28 @@ class file_mass:
material_density_unit: Union[Unset, UnitDensity]
if isinstance(_material_density_unit, Unset):
material_density_unit = UNSET
if _material_density_unit is None:
material_density_unit = UNSET
else:
material_density_unit = _material_density_unit # type: ignore[arg-type]
material_density_unit = _material_density_unit
_output_unit = d.pop("output_unit", UNSET)
output_unit: Union[Unset, UnitMass]
if isinstance(_output_unit, Unset):
output_unit = UNSET
if _output_unit is None:
output_unit = UNSET
else:
output_unit = _output_unit # type: ignore[arg-type]
output_unit = _output_unit
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
if _src_format is None:
src_format = UNSET
else:
src_format = _src_format # type: ignore[arg-type]
src_format = _src_format
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
@ -559,8 +611,10 @@ class file_mass:
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status # type: ignore[arg-type]
status = _status
type = d.pop("type", UNSET)
@ -571,7 +625,14 @@ class file_mass:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
file_mass = cls(
completed_at=completed_at,
@ -610,7 +671,7 @@ class file_mass:
return key in self.additional_properties
FV = TypeVar("FV", bound="file_volume")
TM = TypeVar("TM", bound="file_volume")
@attr.s(auto_attribs=True)
@ -687,7 +748,7 @@ class file_volume:
return field_dict
@classmethod
def from_dict(cls: Type[FV], src_dict: Dict[str, Any]) -> FV:
def from_dict(cls: Type[TM], src_dict: Dict[str, Any]) -> TM:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -709,22 +770,28 @@ class file_volume:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
id = _id
_output_unit = d.pop("output_unit", UNSET)
output_unit: Union[Unset, UnitVolume]
if isinstance(_output_unit, Unset):
output_unit = UNSET
if _output_unit is None:
output_unit = UNSET
else:
output_unit = _output_unit # type: ignore[arg-type]
output_unit = _output_unit
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
if _src_format is None:
src_format = UNSET
else:
src_format = _src_format # type: ignore[arg-type]
src_format = _src_format
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
@ -737,8 +804,10 @@ class file_volume:
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status # type: ignore[arg-type]
status = _status
type = d.pop("type", UNSET)
@ -749,7 +818,14 @@ class file_volume:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
volume = d.pop("volume", UNSET)
@ -788,7 +864,7 @@ class file_volume:
return key in self.additional_properties
LE = TypeVar("LE", bound="file_density")
BS = TypeVar("BS", bound="file_density")
@attr.s(auto_attribs=True)
@ -874,7 +950,7 @@ class file_density:
return field_dict
@classmethod
def from_dict(cls: Type[LE], src_dict: Dict[str, Any]) -> LE:
def from_dict(cls: Type[BS], src_dict: Dict[str, Any]) -> BS:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -898,8 +974,10 @@ class file_density:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
id = _id
material_mass = d.pop("material_mass", UNSET)
@ -907,22 +985,28 @@ class file_density:
material_mass_unit: Union[Unset, UnitMass]
if isinstance(_material_mass_unit, Unset):
material_mass_unit = UNSET
if _material_mass_unit is None:
material_mass_unit = UNSET
else:
material_mass_unit = _material_mass_unit # type: ignore[arg-type]
material_mass_unit = _material_mass_unit
_output_unit = d.pop("output_unit", UNSET)
output_unit: Union[Unset, UnitDensity]
if isinstance(_output_unit, Unset):
output_unit = UNSET
if _output_unit is None:
output_unit = UNSET
else:
output_unit = _output_unit # type: ignore[arg-type]
output_unit = _output_unit
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
if _src_format is None:
src_format = UNSET
else:
src_format = _src_format # type: ignore[arg-type]
src_format = _src_format
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
@ -935,8 +1019,10 @@ class file_density:
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status # type: ignore[arg-type]
status = _status
type = d.pop("type", UNSET)
@ -947,7 +1033,14 @@ class file_density:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
file_density = cls(
completed_at=completed_at,
@ -986,7 +1079,7 @@ class file_density:
return key in self.additional_properties
OY = TypeVar("OY", bound="file_surface_area")
AH = TypeVar("AH", bound="file_surface_area")
@attr.s(auto_attribs=True)
@ -1063,7 +1156,7 @@ class file_surface_area:
return field_dict
@classmethod
def from_dict(cls: Type[OY], src_dict: Dict[str, Any]) -> OY:
def from_dict(cls: Type[AH], src_dict: Dict[str, Any]) -> AH:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -1085,22 +1178,28 @@ class file_surface_area:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
id = _id
_output_unit = d.pop("output_unit", UNSET)
output_unit: Union[Unset, UnitArea]
if isinstance(_output_unit, Unset):
output_unit = UNSET
if _output_unit is None:
output_unit = UNSET
else:
output_unit = _output_unit # type: ignore[arg-type]
output_unit = _output_unit
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
if _src_format is None:
src_format = UNSET
else:
src_format = _src_format # type: ignore[arg-type]
src_format = _src_format
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
@ -1113,8 +1212,10 @@ class file_surface_area:
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status # type: ignore[arg-type]
status = _status
surface_area = d.pop("surface_area", UNSET)
@ -1127,7 +1228,14 @@ class file_surface_area:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
file_surface_area = cls(
completed_at=completed_at,
@ -1164,11 +1272,311 @@ class file_surface_area:
return key in self.additional_properties
AsyncApiCallOutput = Union[
file_conversion,
file_center_of_mass,
file_mass,
file_volume,
file_density,
file_surface_area,
]
EG = TypeVar("EG", bound="text_to_cad")
@attr.s(auto_attribs=True)
class text_to_cad:
"""Text to CAD.""" # noqa: E501
completed_at: Union[Unset, datetime.datetime] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
feedback: Union[Unset, AiFeedback] = UNSET
id: Union[Unset, str] = UNSET
model_version: Union[Unset, str] = UNSET
output_format: Union[Unset, FileExportFormat] = UNSET
outputs: Union[Unset, Dict[str, Base64Data]] = UNSET
prompt: Union[Unset, str] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET
type: str = "text_to_cad"
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
completed_at: Union[Unset, str] = UNSET
if not isinstance(self.completed_at, Unset):
completed_at = self.completed_at.isoformat()
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
error = self.error
if not isinstance(self.feedback, Unset):
feedback = self.feedback
id = self.id
model_version = self.model_version
if not isinstance(self.output_format, Unset):
output_format = self.output_format
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
prompt = self.prompt
started_at: Union[Unset, str] = UNSET
if not isinstance(self.started_at, Unset):
started_at = self.started_at.isoformat()
if not isinstance(self.status, Unset):
status = self.status
type = self.type
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if completed_at is not UNSET:
field_dict["completed_at"] = completed_at
if created_at is not UNSET:
field_dict["created_at"] = created_at
if error is not UNSET:
field_dict["error"] = error
if feedback is not UNSET:
field_dict["feedback"] = feedback
if id is not UNSET:
field_dict["id"] = id
if model_version is not UNSET:
field_dict["model_version"] = model_version
if output_format is not UNSET:
field_dict["output_format"] = output_format
if outputs is not UNSET:
field_dict["outputs"] = outputs
if prompt is not UNSET:
field_dict["prompt"] = prompt
if started_at is not UNSET:
field_dict["started_at"] = started_at
if status is not UNSET:
field_dict["status"] = status
field_dict["type"] = type
if updated_at is not UNSET:
field_dict["updated_at"] = updated_at
if user_id is not UNSET:
field_dict["user_id"] = user_id
return field_dict
@classmethod
def from_dict(cls: Type[EG], src_dict: Dict[str, Any]) -> EG:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
if isinstance(_completed_at, Unset):
completed_at = UNSET
else:
completed_at = isoparse(_completed_at)
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]
if isinstance(_created_at, Unset):
created_at = UNSET
else:
created_at = isoparse(_created_at)
error = d.pop("error", UNSET)
_feedback = d.pop("feedback", UNSET)
feedback: Union[Unset, AiFeedback]
if isinstance(_feedback, Unset):
feedback = UNSET
if _feedback is None:
feedback = UNSET
else:
feedback = _feedback
_id = d.pop("id", UNSET)
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id
model_version = d.pop("model_version", UNSET)
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, FileExportFormat]
if isinstance(_output_format, Unset):
output_format = UNSET
if _output_format is None:
output_format = UNSET
else:
output_format = _output_format
_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
prompt = d.pop("prompt", UNSET)
_started_at = d.pop("started_at", UNSET)
started_at: Union[Unset, datetime.datetime]
if isinstance(_started_at, Unset):
started_at = UNSET
else:
started_at = isoparse(_started_at)
_status = d.pop("status", UNSET)
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status
type = d.pop("type", UNSET)
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
text_to_cad = cls(
completed_at=completed_at,
created_at=created_at,
error=error,
feedback=feedback,
id=id,
model_version=model_version,
output_format=output_format,
outputs=outputs,
prompt=prompt,
started_at=started_at,
status=status,
type=type,
updated_at=updated_at,
user_id=user_id,
)
text_to_cad.additional_properties = d
return text_to_cad
@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
GY = TypeVar("GY", bound="AsyncApiCallOutput")
@attr.s(auto_attribs=True)
class AsyncApiCallOutput:
"""The output from the async API call."""
type: Union[
file_conversion,
file_center_of_mass,
file_mass,
file_volume,
file_density,
file_surface_area,
text_to_cad,
]
def __init__(
self,
type: Union[
file_conversion,
file_center_of_mass,
file_mass,
file_volume,
file_density,
file_surface_area,
text_to_cad,
],
):
self.type = type
def to_dict(self) -> Dict[str, Any]:
if isinstance(self.type, file_conversion):
JR: file_conversion = self.type
return JR.to_dict()
elif isinstance(self.type, file_center_of_mass):
HK: file_center_of_mass = self.type
return HK.to_dict()
elif isinstance(self.type, file_mass):
ON: file_mass = self.type
return ON.to_dict()
elif isinstance(self.type, file_volume):
US: file_volume = self.type
return US.to_dict()
elif isinstance(self.type, file_density):
FH: file_density = self.type
return FH.to_dict()
elif isinstance(self.type, file_surface_area):
BB: file_surface_area = self.type
return BB.to_dict()
elif isinstance(self.type, text_to_cad):
TV: text_to_cad = self.type
return TV.to_dict()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "file_conversion":
LY: file_conversion = file_conversion()
LY.from_dict(d)
return cls(type=LY)
elif d.get("type") == "file_center_of_mass":
VR: file_center_of_mass = file_center_of_mass()
VR.from_dict(d)
return cls(type=VR)
elif d.get("type") == "file_mass":
PC: file_mass = file_mass()
PC.from_dict(d)
return cls(type=PC)
elif d.get("type") == "file_volume":
KQ: file_volume = file_volume()
KQ.from_dict(d)
return cls(type=KQ)
elif d.get("type") == "file_density":
NH: file_density = file_density()
NH.from_dict(d)
return cls(type=NH)
elif d.get("type") == "file_surface_area":
PJ: file_surface_area = file_surface_area()
PJ.from_dict(d)
return cls(type=PJ)
elif d.get("type") == "text_to_cad":
CR: text_to_cad = text_to_cad()
CR.from_dict(d)
return cls(type=CR)
raise Exception("Unknown type")

View File

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

View File

@ -16,6 +16,8 @@ class AsyncApiCallType(str, Enum):
FILE_DENSITY = "file_density"
"""# File surface area. """ # noqa: E501
FILE_SURFACE_AREA = "file_surface_area"
"""# Text to CAD. """ # noqa: E501
TEXT_TO_CAD = "text_to_cad"
def __str__(self) -> str:
return str(self.value)

View File

@ -6,7 +6,7 @@ from ..models.axis import Axis
from ..models.direction import Direction
from ..types import UNSET, Unset
TM = TypeVar("TM", bound="AxisDirectionPair")
MS = TypeVar("MS", bound="AxisDirectionPair")
@attr.s(auto_attribs=True)
@ -35,21 +35,25 @@ class AxisDirectionPair:
return field_dict
@classmethod
def from_dict(cls: Type[TM], src_dict: Dict[str, Any]) -> TM:
def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS:
d = src_dict.copy()
_axis = d.pop("axis", UNSET)
axis: Union[Unset, Axis]
if isinstance(_axis, Unset):
axis = UNSET
if _axis is None:
axis = UNSET
else:
axis = _axis # type: ignore[arg-type]
axis = _axis
_direction = d.pop("direction", UNSET)
direction: Union[Unset, Direction]
if isinstance(_direction, Unset):
direction = UNSET
if _direction is None:
direction = UNSET
else:
direction = _direction # type: ignore[arg-type]
direction = _direction
axis_direction_pair = cls(
axis=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 ..types import UNSET, Unset
BS = TypeVar("BS", bound="BillingInfo")
LT = TypeVar("LT", bound="BillingInfo")
@attr.s(auto_attribs=True)
@ -28,7 +28,7 @@ class BillingInfo:
field_dict.update(self.additional_properties)
field_dict.update({})
if address is not UNSET:
field_dict["address"] = address
field_dict["address"] = address.to_dict()
if name is not UNSET:
field_dict["name"] = name
if phone is not UNSET:
@ -37,14 +37,16 @@ class BillingInfo:
return field_dict
@classmethod
def from_dict(cls: Type[BS], src_dict: Dict[str, Any]) -> BS:
def from_dict(cls: Type[LT], src_dict: Dict[str, Any]) -> LT:
d = src_dict.copy()
_address = d.pop("address", UNSET)
address: Union[Unset, NewAddress]
if isinstance(_address, Unset):
address = UNSET
if _address is None:
address = UNSET
else:
address = _address # type: ignore[arg-type]
address = NewAddress.from_dict(_address)
name = d.pop("name", UNSET)

View File

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

View File

@ -5,7 +5,7 @@ import attr
from ..models.payment_method_card_checks import PaymentMethodCardChecks
from ..types import UNSET, Unset
EG = TypeVar("EG", bound="CardDetails")
YY = TypeVar("YY", bound="CardDetails")
@attr.s(auto_attribs=True)
@ -40,7 +40,7 @@ class CardDetails:
if brand is not UNSET:
field_dict["brand"] = brand
if checks is not UNSET:
field_dict["checks"] = checks
field_dict["checks"] = checks.to_dict()
if country is not UNSET:
field_dict["country"] = country
if exp_month is not UNSET:
@ -57,7 +57,7 @@ class CardDetails:
return field_dict
@classmethod
def from_dict(cls: Type[EG], src_dict: Dict[str, Any]) -> EG:
def from_dict(cls: Type[YY], src_dict: Dict[str, Any]) -> YY:
d = src_dict.copy()
brand = d.pop("brand", UNSET)
@ -65,8 +65,10 @@ class CardDetails:
checks: Union[Unset, PaymentMethodCardChecks]
if isinstance(_checks, Unset):
checks = UNSET
if _checks is None:
checks = UNSET
else:
checks = _checks # type: ignore[arg-type]
checks = PaymentMethodCardChecks.from_dict(_checks)
country = d.pop("country", UNSET)

View File

@ -0,0 +1,80 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.point3d import Point3d
from ..models.unit_length import UnitLength
from ..types import UNSET, Unset
DO = TypeVar("DO", bound="CenterOfMass")
@attr.s(auto_attribs=True)
class CenterOfMass:
"""The center of mass response.""" # noqa: E501
center_of_mass: Union[Unset, Point3d] = UNSET
output_unit: Union[Unset, UnitLength] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.center_of_mass, Unset):
center_of_mass = self.center_of_mass
if not isinstance(self.output_unit, Unset):
output_unit = self.output_unit
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if center_of_mass is not UNSET:
field_dict["center_of_mass"] = center_of_mass.to_dict()
if output_unit is not UNSET:
field_dict["output_unit"] = output_unit
return field_dict
@classmethod
def from_dict(cls: Type[DO], src_dict: Dict[str, Any]) -> DO:
d = src_dict.copy()
_center_of_mass = d.pop("center_of_mass", UNSET)
center_of_mass: Union[Unset, Point3d]
if isinstance(_center_of_mass, Unset):
center_of_mass = UNSET
if _center_of_mass is None:
center_of_mass = UNSET
else:
center_of_mass = Point3d.from_dict(_center_of_mass)
_output_unit = d.pop("output_unit", UNSET)
output_unit: Union[Unset, UnitLength]
if isinstance(_output_unit, Unset):
output_unit = UNSET
if _output_unit is None:
output_unit = UNSET
else:
output_unit = _output_unit
center_of_mass = cls(
center_of_mass=center_of_mass,
output_unit=output_unit,
)
center_of_mass.additional_properties = d
return center_of_mass
@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,106 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
FZ = TypeVar("FZ", bound="ClientMetrics")
@attr.s(auto_attribs=True)
class ClientMetrics:
"""ClientMetrics contains information regarding the state of the peer.""" # noqa: E501
rtc_frames_decoded: Union[Unset, int] = UNSET
rtc_frames_dropped: Union[Unset, int] = UNSET
rtc_frames_per_second: Union[Unset, int] = UNSET
rtc_frames_received: Union[Unset, int] = UNSET
rtc_freeze_count: Union[Unset, int] = UNSET
rtc_jitter_sec: Union[Unset, float] = UNSET
rtc_keyframes_decoded: Union[Unset, int] = UNSET
rtc_total_freezes_duration_sec: Union[Unset, float] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
rtc_frames_decoded = self.rtc_frames_decoded
rtc_frames_dropped = self.rtc_frames_dropped
rtc_frames_per_second = self.rtc_frames_per_second
rtc_frames_received = self.rtc_frames_received
rtc_freeze_count = self.rtc_freeze_count
rtc_jitter_sec = self.rtc_jitter_sec
rtc_keyframes_decoded = self.rtc_keyframes_decoded
rtc_total_freezes_duration_sec = self.rtc_total_freezes_duration_sec
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if rtc_frames_decoded is not UNSET:
field_dict["rtc_frames_decoded"] = rtc_frames_decoded
if rtc_frames_dropped is not UNSET:
field_dict["rtc_frames_dropped"] = rtc_frames_dropped
if rtc_frames_per_second is not UNSET:
field_dict["rtc_frames_per_second"] = rtc_frames_per_second
if rtc_frames_received is not UNSET:
field_dict["rtc_frames_received"] = rtc_frames_received
if rtc_freeze_count is not UNSET:
field_dict["rtc_freeze_count"] = rtc_freeze_count
if rtc_jitter_sec is not UNSET:
field_dict["rtc_jitter_sec"] = rtc_jitter_sec
if rtc_keyframes_decoded is not UNSET:
field_dict["rtc_keyframes_decoded"] = rtc_keyframes_decoded
if rtc_total_freezes_duration_sec is not UNSET:
field_dict[
"rtc_total_freezes_duration_sec"
] = rtc_total_freezes_duration_sec
return field_dict
@classmethod
def from_dict(cls: Type[FZ], src_dict: Dict[str, Any]) -> FZ:
d = src_dict.copy()
rtc_frames_decoded = d.pop("rtc_frames_decoded", UNSET)
rtc_frames_dropped = d.pop("rtc_frames_dropped", UNSET)
rtc_frames_per_second = d.pop("rtc_frames_per_second", UNSET)
rtc_frames_received = d.pop("rtc_frames_received", UNSET)
rtc_freeze_count = d.pop("rtc_freeze_count", UNSET)
rtc_jitter_sec = d.pop("rtc_jitter_sec", UNSET)
rtc_keyframes_decoded = d.pop("rtc_keyframes_decoded", UNSET)
rtc_total_freezes_duration_sec = d.pop("rtc_total_freezes_duration_sec", UNSET)
client_metrics = cls(
rtc_frames_decoded=rtc_frames_decoded,
rtc_frames_dropped=rtc_frames_dropped,
rtc_frames_per_second=rtc_frames_per_second,
rtc_frames_received=rtc_frames_received,
rtc_freeze_count=rtc_freeze_count,
rtc_jitter_sec=rtc_jitter_sec,
rtc_keyframes_decoded=rtc_keyframes_decoded,
rtc_total_freezes_duration_sec=rtc_total_freezes_duration_sec,
)
client_metrics.additional_properties = d
return client_metrics
@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

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ from ..models.jetstream import Jetstream
from ..models.leaf_node import LeafNode
from ..types import UNSET, Unset
ON = TypeVar("ON", bound="Connection")
VI = TypeVar("VI", bound="Connection")
@attr.s(auto_attribs=True)
@ -33,7 +33,7 @@ class Connection:
http_base_path: Union[Unset, str] = UNSET
http_host: Union[Unset, str] = 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
in_bytes: Union[Unset, int] = UNSET
in_msgs: Union[Unset, int] = UNSET
@ -88,6 +88,7 @@ class Connection:
http_host = self.http_host
http_port = self.http_port
http_req_stats = self.http_req_stats
https_port = self.https_port
in_bytes = self.in_bytes
in_msgs = self.in_msgs
@ -132,7 +133,7 @@ class Connection:
if auth_timeout is not UNSET:
field_dict["auth_timeout"] = auth_timeout
if cluster is not UNSET:
field_dict["cluster"] = cluster
field_dict["cluster"] = cluster.to_dict()
if config_load_time is not UNSET:
field_dict["config_load_time"] = config_load_time
if connections is not UNSET:
@ -142,7 +143,7 @@ class Connection:
if cpu is not UNSET:
field_dict["cpu"] = cpu
if gateway is not UNSET:
field_dict["gateway"] = gateway
field_dict["gateway"] = gateway.to_dict()
if git_commit is not UNSET:
field_dict["git_commit"] = git_commit
if go is not UNSET:
@ -166,9 +167,9 @@ class Connection:
if in_msgs is not UNSET:
field_dict["in_msgs"] = in_msgs
if jetstream is not UNSET:
field_dict["jetstream"] = jetstream
field_dict["jetstream"] = jetstream.to_dict()
if leaf is not UNSET:
field_dict["leaf"] = leaf
field_dict["leaf"] = leaf.to_dict()
if leafnodes is not UNSET:
field_dict["leafnodes"] = leafnodes
if max_connections is not UNSET:
@ -225,7 +226,7 @@ class Connection:
return field_dict
@classmethod
def from_dict(cls: Type[ON], src_dict: Dict[str, Any]) -> ON:
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> VI:
d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET)
@ -233,8 +234,10 @@ class Connection:
cluster: Union[Unset, Cluster]
if isinstance(_cluster, Unset):
cluster = UNSET
if _cluster is None:
cluster = UNSET
else:
cluster = _cluster # type: ignore[arg-type]
cluster = Cluster.from_dict(_cluster)
_config_load_time = d.pop("config_load_time", UNSET)
config_load_time: Union[Unset, datetime.datetime]
@ -253,8 +256,10 @@ class Connection:
gateway: Union[Unset, Gateway]
if isinstance(_gateway, Unset):
gateway = UNSET
if _gateway is None:
gateway = UNSET
else:
gateway = _gateway # type: ignore[arg-type]
gateway = Gateway.from_dict(_gateway)
git_commit = d.pop("git_commit", UNSET)
@ -271,6 +276,7 @@ class Connection:
http_port = d.pop("http_port", UNSET)
http_req_stats = d.pop("http_req_stats", UNSET)
https_port = d.pop("https_port", UNSET)
in_bytes = d.pop("in_bytes", UNSET)
@ -281,15 +287,19 @@ class Connection:
jetstream: Union[Unset, Jetstream]
if isinstance(_jetstream, Unset):
jetstream = UNSET
if _jetstream is None:
jetstream = UNSET
else:
jetstream = _jetstream # type: ignore[arg-type]
jetstream = Jetstream.from_dict(_jetstream)
_leaf = d.pop("leaf", UNSET)
leaf: Union[Unset, LeafNode]
if isinstance(_leaf, Unset):
leaf = UNSET
if _leaf is None:
leaf = UNSET
else:
leaf = _leaf # type: ignore[arg-type]
leaf = LeafNode.from_dict(_leaf)
leafnodes = d.pop("leafnodes", UNSET)

View File

@ -1,507 +1,3 @@
from enum import Enum
class CountryCode(str, Enum):
"""An enumeration of all ISO-3166 alpha-2 country codes.""" # noqa: E501
"""# Afghanistan """ # noqa: E501
AF = "AF"
"""# Åland Islands """ # noqa: E501
AX = "AX"
"""# Albania """ # noqa: E501
AL = "AL"
"""# Algeria """ # noqa: E501
DZ = "DZ"
"""# American Samoa """ # noqa: E501
AS = "AS"
"""# Andorra """ # noqa: E501
AD = "AD"
"""# Angola """ # noqa: E501
AO = "AO"
"""# Anguilla """ # noqa: E501
AI = "AI"
"""# Antarctica """ # noqa: E501
AQ = "AQ"
"""# Antigua and Barbuda """ # noqa: E501
AG = "AG"
"""# Argentina """ # noqa: E501
AR = "AR"
"""# Armenia """ # noqa: E501
AM = "AM"
"""# Aruba """ # noqa: E501
AW = "AW"
"""# Australia """ # noqa: E501
AU = "AU"
"""# Austria """ # noqa: E501
AT = "AT"
"""# Azerbaijan """ # noqa: E501
AZ = "AZ"
"""# Bahamas """ # noqa: E501
BS = "BS"
"""# Bahrain """ # noqa: E501
BH = "BH"
"""# Bangladesh """ # noqa: E501
BD = "BD"
"""# Barbados """ # noqa: E501
BB = "BB"
"""# Belarus """ # noqa: E501
BY = "BY"
"""# Belgium """ # noqa: E501
BE = "BE"
"""# Belize """ # noqa: E501
BZ = "BZ"
"""# Benin """ # noqa: E501
BJ = "BJ"
"""# Bermuda """ # noqa: E501
BM = "BM"
"""# Bhutan """ # noqa: E501
BT = "BT"
"""# Bolivia (Plurinational State of) """ # noqa: E501
BO = "BO"
"""# Bonaire, Sint Eustatius and Saba """ # noqa: E501
BQ = "BQ"
"""# Bosnia and Herzegovina """ # noqa: E501
BA = "BA"
"""# Botswana """ # noqa: E501
BW = "BW"
"""# Bouvet Island """ # noqa: E501
BV = "BV"
"""# Brazil """ # noqa: E501
BR = "BR"
"""# British Indian Ocean Territory """ # noqa: E501
IO = "IO"
"""# Brunei Darussalam """ # noqa: E501
BN = "BN"
"""# Bulgaria """ # noqa: E501
BG = "BG"
"""# Burkina Faso """ # noqa: E501
BF = "BF"
"""# Burundi """ # noqa: E501
BI = "BI"
"""# Cabo Verde """ # noqa: E501
CV = "CV"
"""# Cambodia """ # noqa: E501
KH = "KH"
"""# Cameroon """ # noqa: E501
CM = "CM"
"""# Canada """ # noqa: E501
CA = "CA"
"""# Cayman Islands """ # noqa: E501
KY = "KY"
"""# Central African Republic """ # noqa: E501
CF = "CF"
"""# Chad """ # noqa: E501
TD = "TD"
"""# Chile """ # noqa: E501
CL = "CL"
"""# China """ # noqa: E501
CN = "CN"
"""# Christmas Island """ # noqa: E501
CX = "CX"
"""# Cocos (Keeling) Islands """ # noqa: E501
CC = "CC"
"""# Colombia """ # noqa: E501
CO = "CO"
"""# Comoros """ # noqa: E501
KM = "KM"
"""# Congo """ # noqa: E501
CG = "CG"
"""# Congo (Democratic Republic of the) """ # noqa: E501
CD = "CD"
"""# Cook Islands """ # noqa: E501
CK = "CK"
"""# Costa Rica """ # noqa: E501
CR = "CR"
"""# Côte d'Ivoire """ # noqa: E501
CI = "CI"
"""# Croatia """ # noqa: E501
HR = "HR"
"""# Cuba """ # noqa: E501
CU = "CU"
"""# Curaçao """ # noqa: E501
CW = "CW"
"""# Cyprus """ # noqa: E501
CY = "CY"
"""# Czechia """ # noqa: E501
CZ = "CZ"
"""# Denmark """ # noqa: E501
DK = "DK"
"""# Djibouti """ # noqa: E501
DJ = "DJ"
"""# Dominica """ # noqa: E501
DM = "DM"
"""# Dominican Republic """ # noqa: E501
DO = "DO"
"""# Ecuador """ # noqa: E501
EC = "EC"
"""# Egypt """ # noqa: E501
EG = "EG"
"""# El Salvador """ # noqa: E501
SV = "SV"
"""# Equatorial Guinea """ # noqa: E501
GQ = "GQ"
"""# Eritrea """ # noqa: E501
ER = "ER"
"""# Estonia """ # noqa: E501
EE = "EE"
"""# Ethiopia """ # noqa: E501
ET = "ET"
"""# Falkland Islands (Malvinas) """ # noqa: E501
FK = "FK"
"""# Faroe Islands """ # noqa: E501
FO = "FO"
"""# Fiji """ # noqa: E501
FJ = "FJ"
"""# Finland """ # noqa: E501
FI = "FI"
"""# France """ # noqa: E501
FR = "FR"
"""# French Guiana """ # noqa: E501
GF = "GF"
"""# French Polynesia """ # noqa: E501
PF = "PF"
"""# French Southern Territories """ # noqa: E501
TF = "TF"
"""# Gabon """ # noqa: E501
GA = "GA"
"""# Gambia """ # noqa: E501
GM = "GM"
"""# Georgia """ # noqa: E501
GE = "GE"
"""# Germany """ # noqa: E501
DE = "DE"
"""# Ghana """ # noqa: E501
GH = "GH"
"""# Gibraltar """ # noqa: E501
GI = "GI"
"""# Greece """ # noqa: E501
GR = "GR"
"""# Greenland """ # noqa: E501
GL = "GL"
"""# Grenada """ # noqa: E501
GD = "GD"
"""# Guadeloupe """ # noqa: E501
GP = "GP"
"""# Guam """ # noqa: E501
GU = "GU"
"""# Guatemala """ # noqa: E501
GT = "GT"
"""# Guernsey """ # noqa: E501
GG = "GG"
"""# Guinea """ # noqa: E501
GN = "GN"
"""# Guinea-Bissau """ # noqa: E501
GW = "GW"
"""# Guyana """ # noqa: E501
GY = "GY"
"""# Haiti """ # noqa: E501
HT = "HT"
"""# Heard Island and McDonald Islands """ # noqa: E501
HM = "HM"
"""# Holy See """ # noqa: E501
VA = "VA"
"""# Honduras """ # noqa: E501
HN = "HN"
"""# Hong Kong """ # noqa: E501
HK = "HK"
"""# Hungary """ # noqa: E501
HU = "HU"
"""# Iceland """ # noqa: E501
IS = "IS"
"""# India """ # noqa: E501
IN = "IN"
"""# Indonesia """ # noqa: E501
ID = "ID"
"""# Iran (Islamic Republic of) """ # noqa: E501
IR = "IR"
"""# Iraq """ # noqa: E501
IQ = "IQ"
"""# Ireland """ # noqa: E501
IE = "IE"
"""# Isle of Man """ # noqa: E501
IM = "IM"
"""# Israel """ # noqa: E501
IL = "IL"
"""# Italy """ # noqa: E501
IT = "IT"
"""# Jamaica """ # noqa: E501
JM = "JM"
"""# Japan """ # noqa: E501
JP = "JP"
"""# Jersey """ # noqa: E501
JE = "JE"
"""# Jordan """ # noqa: E501
JO = "JO"
"""# Kazakhstan """ # noqa: E501
KZ = "KZ"
"""# Kenya """ # noqa: E501
KE = "KE"
"""# Kiribati """ # noqa: E501
KI = "KI"
"""# Korea (Democratic People's Republic of) """ # noqa: E501
KP = "KP"
"""# Korea (Republic of) """ # noqa: E501
KR = "KR"
"""# Kuwait """ # noqa: E501
KW = "KW"
"""# Kyrgyzstan """ # noqa: E501
KG = "KG"
"""# Lao People's Democratic Republic """ # noqa: E501
LA = "LA"
"""# Latvia """ # noqa: E501
LV = "LV"
"""# Lebanon """ # noqa: E501
LB = "LB"
"""# Lesotho """ # noqa: E501
LS = "LS"
"""# Liberia """ # noqa: E501
LR = "LR"
"""# Libya """ # noqa: E501
LY = "LY"
"""# Liechtenstein """ # noqa: E501
LI = "LI"
"""# Lithuania """ # noqa: E501
LT = "LT"
"""# Luxembourg """ # noqa: E501
LU = "LU"
"""# Macao """ # noqa: E501
MO = "MO"
"""# Macedonia (the former Yugoslav Republic of) """ # noqa: E501
MK = "MK"
"""# Madagascar """ # noqa: E501
MG = "MG"
"""# Malawi """ # noqa: E501
MW = "MW"
"""# Malaysia """ # noqa: E501
MY = "MY"
"""# Maldives """ # noqa: E501
MV = "MV"
"""# Mali """ # noqa: E501
ML = "ML"
"""# Malta """ # noqa: E501
MT = "MT"
"""# Marshall Islands """ # noqa: E501
MH = "MH"
"""# Martinique """ # noqa: E501
MQ = "MQ"
"""# Mauritania """ # noqa: E501
MR = "MR"
"""# Mauritius """ # noqa: E501
MU = "MU"
"""# Mayotte """ # noqa: E501
YT = "YT"
"""# Mexico """ # noqa: E501
MX = "MX"
"""# Micronesia (Federated States of) """ # noqa: E501
FM = "FM"
"""# Moldova (Republic of) """ # noqa: E501
MD = "MD"
"""# Monaco """ # noqa: E501
MC = "MC"
"""# Mongolia """ # noqa: E501
MN = "MN"
"""# Montenegro """ # noqa: E501
ME = "ME"
"""# Montserrat """ # noqa: E501
MS = "MS"
"""# Morocco """ # noqa: E501
MA = "MA"
"""# Mozambique """ # noqa: E501
MZ = "MZ"
"""# Myanmar """ # noqa: E501
MM = "MM"
"""# Namibia """ # noqa: E501
NA = "NA"
"""# Nauru """ # noqa: E501
NR = "NR"
"""# Nepal """ # noqa: E501
NP = "NP"
"""# Netherlands """ # noqa: E501
NL = "NL"
"""# New Caledonia """ # noqa: E501
NC = "NC"
"""# New Zealand """ # noqa: E501
NZ = "NZ"
"""# Nicaragua """ # noqa: E501
NI = "NI"
"""# Niger """ # noqa: E501
NE = "NE"
"""# Nigeria """ # noqa: E501
NG = "NG"
"""# Niue """ # noqa: E501
NU = "NU"
"""# Norfolk Island """ # noqa: E501
NF = "NF"
"""# Northern Mariana Islands """ # noqa: E501
MP = "MP"
"""# Norway """ # noqa: E501
NO = "NO"
"""# Oman """ # noqa: E501
OM = "OM"
"""# Pakistan """ # noqa: E501
PK = "PK"
"""# Palau """ # noqa: E501
PW = "PW"
"""# Palestine, State of """ # noqa: E501
PS = "PS"
"""# Panama """ # noqa: E501
PA = "PA"
"""# Papua New Guinea """ # noqa: E501
PG = "PG"
"""# Paraguay """ # noqa: E501
PY = "PY"
"""# Peru """ # noqa: E501
PE = "PE"
"""# Philippines """ # noqa: E501
PH = "PH"
"""# Pitcairn """ # noqa: E501
PN = "PN"
"""# Poland """ # noqa: E501
PL = "PL"
"""# Portugal """ # noqa: E501
PT = "PT"
"""# Puerto Rico """ # noqa: E501
PR = "PR"
"""# Qatar """ # noqa: E501
QA = "QA"
"""# Réunion """ # noqa: E501
RE = "RE"
"""# Romania """ # noqa: E501
RO = "RO"
"""# Russian Federation """ # noqa: E501
RU = "RU"
"""# Rwanda """ # noqa: E501
RW = "RW"
"""# Saint Barthélemy """ # noqa: E501
BL = "BL"
"""# Saint Helena, Ascension and Tristan da Cunha """ # noqa: E501
SH = "SH"
"""# Saint Kitts and Nevis """ # noqa: E501
KN = "KN"
"""# Saint Lucia """ # noqa: E501
LC = "LC"
"""# Saint Martin (French part) """ # noqa: E501
MF = "MF"
"""# Saint Pierre and Miquelon """ # noqa: E501
PM = "PM"
"""# Saint Vincent and the Grenadines """ # noqa: E501
VC = "VC"
"""# Samoa """ # noqa: E501
WS = "WS"
"""# San Marino """ # noqa: E501
SM = "SM"
"""# Sao Tome and Principe """ # noqa: E501
ST = "ST"
"""# Saudi Arabia """ # noqa: E501
SA = "SA"
"""# Senegal """ # noqa: E501
SN = "SN"
"""# Serbia """ # noqa: E501
RS = "RS"
"""# Seychelles """ # noqa: E501
SC = "SC"
"""# Sierra Leone """ # noqa: E501
SL = "SL"
"""# Singapore """ # noqa: E501
SG = "SG"
"""# Sint Maarten (Dutch part) """ # noqa: E501
SX = "SX"
"""# Slovakia """ # noqa: E501
SK = "SK"
"""# Slovenia """ # noqa: E501
SI = "SI"
"""# Solomon Islands """ # noqa: E501
SB = "SB"
"""# Somalia """ # noqa: E501
SO = "SO"
"""# South Africa """ # noqa: E501
ZA = "ZA"
"""# South Georgia and the South Sandwich Islands """ # noqa: E501
GS = "GS"
"""# South Sudan """ # noqa: E501
SS = "SS"
"""# Spain """ # noqa: E501
ES = "ES"
"""# Sri Lanka """ # noqa: E501
LK = "LK"
"""# Sudan """ # noqa: E501
SD = "SD"
"""# Suriname """ # noqa: E501
SR = "SR"
"""# Svalbard and Jan Mayen """ # noqa: E501
SJ = "SJ"
"""# Swaziland """ # noqa: E501
SZ = "SZ"
"""# Sweden """ # noqa: E501
SE = "SE"
"""# Switzerland """ # noqa: E501
CH = "CH"
"""# Syrian Arab Republic """ # noqa: E501
SY = "SY"
"""# Taiwan, Province of China """ # noqa: E501
TW = "TW"
"""# Tajikistan """ # noqa: E501
TJ = "TJ"
"""# Tanzania, United Republic of """ # noqa: E501
TZ = "TZ"
"""# Thailand """ # noqa: E501
TH = "TH"
"""# Timor-Leste """ # noqa: E501
TL = "TL"
"""# Togo """ # noqa: E501
TG = "TG"
"""# Tokelau """ # noqa: E501
TK = "TK"
"""# Tonga """ # noqa: E501
TO = "TO"
"""# Trinidad and Tobago """ # noqa: E501
TT = "TT"
"""# Tunisia """ # noqa: E501
TN = "TN"
"""# Turkey """ # noqa: E501
TR = "TR"
"""# Turkmenistan """ # noqa: E501
TM = "TM"
"""# Turks and Caicos Islands """ # noqa: E501
TC = "TC"
"""# Tuvalu """ # noqa: E501
TV = "TV"
"""# Uganda """ # noqa: E501
UG = "UG"
"""# Ukraine """ # noqa: E501
UA = "UA"
"""# United Arab Emirates """ # noqa: E501
AE = "AE"
"""# United Kingdom of Great Britain and Northern Ireland """ # noqa: E501
GB = "GB"
"""# United States of America """ # noqa: E501
US = "US"
"""# United States Minor Outlying Islands """ # noqa: E501
UM = "UM"
"""# Uruguay """ # noqa: E501
UY = "UY"
"""# Uzbekistan """ # noqa: E501
UZ = "UZ"
"""# Vanuatu """ # noqa: E501
VU = "VU"
"""# Venezuela (Bolivarian Republic of) """ # noqa: E501
VE = "VE"
"""# Viet Nam """ # noqa: E501
VN = "VN"
"""# Virgin Islands (British) """ # noqa: E501
VG = "VG"
"""# Virgin Islands (U.S.) """ # noqa: E501
VI = "VI"
"""# Wallis and Futuna """ # noqa: E501
WF = "WF"
"""# Western Sahara """ # noqa: E501
EH = "EH"
"""# Yemen """ # noqa: E501
YE = "YE"
"""# Zambia """ # noqa: E501
ZM = "ZM"
"""# Zimbabwe """ # noqa: E501
ZW = "ZW"
class CountryCode(str):
def __str__(self) -> str:
return str(self.value)
return self

View File

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

View File

@ -1,290 +1,3 @@
from enum import Enum
class Currency(str, Enum):
"""Currency is the list of supported currencies.
This comes from the Stripe API docs: For more details see <https://support.stripe.com/questions/which-currencies-does-stripe-support>.
""" # noqa: E501
"""# United Arab Emirates Dirham """ # noqa: E501
AED = "aed"
"""# Afghan Afghani """ # noqa: E501
AFN = "afn"
"""# Albanian Lek """ # noqa: E501
ALL = "all"
"""# Armenian Dram """ # noqa: E501
AMD = "amd"
"""# Netherlands Antillean Gulden """ # noqa: E501
ANG = "ang"
"""# Angolan Kwanza """ # noqa: E501
AOA = "aoa"
"""# Argentine Peso """ # noqa: E501
ARS = "ars"
"""# Australian Dollar """ # noqa: E501
AUD = "aud"
"""# Aruban Florin """ # noqa: E501
AWG = "awg"
"""# Azerbaijani Manat """ # noqa: E501
AZN = "azn"
"""# Bosnia & Herzegovina Convertible Mark """ # noqa: E501
BAM = "bam"
"""# Barbadian Dollar """ # noqa: E501
BBD = "bbd"
"""# Bangladeshi Taka """ # noqa: E501
BDT = "bdt"
"""# Bulgarian Lev """ # noqa: E501
BGN = "bgn"
"""# Burundian Franc """ # noqa: E501
BIF = "bif"
"""# Bermudian Dollar """ # noqa: E501
BMD = "bmd"
"""# Brunei Dollar """ # noqa: E501
BND = "bnd"
"""# Bolivian Boliviano """ # noqa: E501
BOB = "bob"
"""# Brazilian Real """ # noqa: E501
BRL = "brl"
"""# Bahamian Dollar """ # noqa: E501
BSD = "bsd"
"""# Botswana Pula """ # noqa: E501
BWP = "bwp"
"""# Belize Dollar """ # noqa: E501
BZD = "bzd"
"""# Canadian Dollar """ # noqa: E501
CAD = "cad"
"""# Congolese Franc """ # noqa: E501
CDF = "cdf"
"""# Swiss Franc """ # noqa: E501
CHF = "chf"
"""# Chilean Peso """ # noqa: E501
CLP = "clp"
"""# Chinese Renminbi Yuan """ # noqa: E501
CNY = "cny"
"""# Colombian Peso """ # noqa: E501
COP = "cop"
"""# Costa Rican Colón """ # noqa: E501
CRC = "crc"
"""# Cape Verdean Escudo """ # noqa: E501
CVE = "cve"
"""# Czech Koruna """ # noqa: E501
CZK = "czk"
"""# Djiboutian Franc """ # noqa: E501
DJF = "djf"
"""# Danish Krone """ # noqa: E501
DKK = "dkk"
"""# Dominican Peso """ # noqa: E501
DOP = "dop"
"""# Algerian Dinar """ # noqa: E501
DZD = "dzd"
"""# Estonian Kroon """ # noqa: E501
EEK = "eek"
"""# Egyptian Pound """ # noqa: E501
EGP = "egp"
"""# Ethiopian Birr """ # noqa: E501
ETB = "etb"
"""# Euro """ # noqa: E501
EUR = "eur"
"""# Fijian Dollar """ # noqa: E501
FJD = "fjd"
"""# Falkland Islands Pound """ # noqa: E501
FKP = "fkp"
"""# British Pound """ # noqa: E501
GBP = "gbp"
"""# Georgian Lari """ # noqa: E501
GEL = "gel"
"""# Gibraltar Pound """ # noqa: E501
GIP = "gip"
"""# Gambian Dalasi """ # noqa: E501
GMD = "gmd"
"""# Guinean Franc """ # noqa: E501
GNF = "gnf"
"""# Guatemalan Quetzal """ # noqa: E501
GTQ = "gtq"
"""# Guyanese Dollar """ # noqa: E501
GYD = "gyd"
"""# Hong Kong Dollar """ # noqa: E501
HKD = "hkd"
"""# Honduran Lempira """ # noqa: E501
HNL = "hnl"
"""# Croatian Kuna """ # noqa: E501
HRK = "hrk"
"""# Haitian Gourde """ # noqa: E501
HTG = "htg"
"""# Hungarian Forint """ # noqa: E501
HUF = "huf"
"""# Indonesian Rupiah """ # noqa: E501
IDR = "idr"
"""# Israeli New Sheqel """ # noqa: E501
ILS = "ils"
"""# Indian Rupee """ # noqa: E501
INR = "inr"
"""# Icelandic Króna """ # noqa: E501
ISK = "isk"
"""# Jamaican Dollar """ # noqa: E501
JMD = "jmd"
"""# Japanese Yen """ # noqa: E501
JPY = "jpy"
"""# Kenyan Shilling """ # noqa: E501
KES = "kes"
"""# Kyrgyzstani Som """ # noqa: E501
KGS = "kgs"
"""# Cambodian Riel """ # noqa: E501
KHR = "khr"
"""# Comorian Franc """ # noqa: E501
KMF = "kmf"
"""# South Korean Won """ # noqa: E501
KRW = "krw"
"""# Cayman Islands Dollar """ # noqa: E501
KYD = "kyd"
"""# Kazakhstani Tenge """ # noqa: E501
KZT = "kzt"
"""# Lao Kip """ # noqa: E501
LAK = "lak"
"""# Lebanese Pound """ # noqa: E501
LBP = "lbp"
"""# Sri Lankan Rupee """ # noqa: E501
LKR = "lkr"
"""# Liberian Dollar """ # noqa: E501
LRD = "lrd"
"""# Lesotho Loti """ # noqa: E501
LSL = "lsl"
"""# Lithuanian Litas """ # noqa: E501
LTL = "ltl"
"""# Latvian Lats """ # noqa: E501
LVL = "lvl"
"""# Moroccan Dirham """ # noqa: E501
MAD = "mad"
"""# Moldovan Leu """ # noqa: E501
MDL = "mdl"
"""# Malagasy Ariary """ # noqa: E501
MGA = "mga"
"""# Macedonian Denar """ # noqa: E501
MKD = "mkd"
"""# Mongolian Tögrög """ # noqa: E501
MNT = "mnt"
"""# Macanese Pataca """ # noqa: E501
MOP = "mop"
"""# Mauritanian Ouguiya """ # noqa: E501
MRO = "mro"
"""# Mauritian Rupee """ # noqa: E501
MUR = "mur"
"""# Maldivian Rufiyaa """ # noqa: E501
MVR = "mvr"
"""# Malawian Kwacha """ # noqa: E501
MWK = "mwk"
"""# Mexican Peso """ # noqa: E501
MXN = "mxn"
"""# Malaysian Ringgit """ # noqa: E501
MYR = "myr"
"""# Mozambican Metical """ # noqa: E501
MZN = "mzn"
"""# Namibian Dollar """ # noqa: E501
NAD = "nad"
"""# Nigerian Naira """ # noqa: E501
NGN = "ngn"
"""# Nicaraguan Córdoba """ # noqa: E501
NIO = "nio"
"""# Norwegian Krone """ # noqa: E501
NOK = "nok"
"""# Nepalese Rupee """ # noqa: E501
NPR = "npr"
"""# New Zealand Dollar """ # noqa: E501
NZD = "nzd"
"""# Panamanian Balboa """ # noqa: E501
PAB = "pab"
"""# Peruvian Nuevo Sol """ # noqa: E501
PEN = "pen"
"""# Papua New Guinean Kina """ # noqa: E501
PGK = "pgk"
"""# Philippine Peso """ # noqa: E501
PHP = "php"
"""# Pakistani Rupee """ # noqa: E501
PKR = "pkr"
"""# Polish Złoty """ # noqa: E501
PLN = "pln"
"""# Paraguayan Guaraní """ # noqa: E501
PYG = "pyg"
"""# Qatari Riyal """ # noqa: E501
QAR = "qar"
"""# Romanian Leu """ # noqa: E501
RON = "ron"
"""# Serbian Dinar """ # noqa: E501
RSD = "rsd"
"""# Russian Ruble """ # noqa: E501
RUB = "rub"
"""# Rwandan Franc """ # noqa: E501
RWF = "rwf"
"""# Saudi Riyal """ # noqa: E501
SAR = "sar"
"""# Solomon Islands Dollar """ # noqa: E501
SBD = "sbd"
"""# Seychellois Rupee """ # noqa: E501
SCR = "scr"
"""# Swedish Krona """ # noqa: E501
SEK = "sek"
"""# Singapore Dollar """ # noqa: E501
SGD = "sgd"
"""# Saint Helenian Pound """ # noqa: E501
SHP = "shp"
"""# Sierra Leonean Leone """ # noqa: E501
SLL = "sll"
"""# Somali Shilling """ # noqa: E501
SOS = "sos"
"""# Surinamese Dollar """ # noqa: E501
SRD = "srd"
"""# São Tomé and Príncipe Dobra """ # noqa: E501
STD = "std"
"""# Salvadoran Colón """ # noqa: E501
SVC = "svc"
"""# Swazi Lilangeni """ # noqa: E501
SZL = "szl"
"""# Thai Baht """ # noqa: E501
THB = "thb"
"""# Tajikistani Somoni """ # noqa: E501
TJS = "tjs"
"""# Tongan Paʻanga """ # noqa: E501
TOP = "top"
"""# Turkish Lira """ # noqa: E501
TRY = "try"
"""# Trinidad and Tobago Dollar """ # noqa: E501
TTD = "ttd"
"""# New Taiwan Dollar """ # noqa: E501
TWD = "twd"
"""# Tanzanian Shilling """ # noqa: E501
TZS = "tzs"
"""# Ukrainian Hryvnia """ # noqa: E501
UAH = "uah"
"""# Ugandan Shilling """ # noqa: E501
UGX = "ugx"
"""# United States Dollar """ # noqa: E501
USD = "usd"
"""# Uruguayan Peso """ # noqa: E501
UYU = "uyu"
"""# Uzbekistani Som """ # noqa: E501
UZS = "uzs"
"""# Venezuelan Bolívar """ # noqa: E501
VEF = "vef"
"""# Vietnamese Đồng """ # noqa: E501
VND = "vnd"
"""# Vanuatu Vatu """ # noqa: E501
VUV = "vuv"
"""# Samoan Tala """ # noqa: E501
WST = "wst"
"""# Central African Cfa Franc """ # noqa: E501
XAF = "xaf"
"""# East Caribbean Dollar """ # noqa: E501
XCD = "xcd"
"""# West African Cfa Franc """ # noqa: E501
XOF = "xof"
"""# Cfp Franc """ # noqa: E501
XPF = "xpf"
"""# Yemeni Rial """ # noqa: E501
YER = "yer"
"""# South African Rand """ # noqa: E501
ZAR = "zar"
"""# Zambian Kwacha """ # noqa: E501
ZMW = "zmw"
class Currency(str):
def __str__(self) -> str:
return str(self.value)
return self

View File

@ -0,0 +1,63 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
QF = TypeVar("QF", 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[QF], src_dict: Dict[str, Any]) -> QF:
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,79 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.point3d import Point3d
from ..types import UNSET, Unset
DI = TypeVar("DI", bound="CurveGetEndPoints")
@attr.s(auto_attribs=True)
class CurveGetEndPoints:
"""Endpoints of a curve""" # noqa: E501
end: Union[Unset, Point3d] = UNSET
start: Union[Unset, Point3d] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.end, Unset):
end = self.end
if not isinstance(self.start, Unset):
start = self.start
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if end is not UNSET:
field_dict["end"] = end.to_dict()
if start is not UNSET:
field_dict["start"] = start.to_dict()
return field_dict
@classmethod
def from_dict(cls: Type[DI], src_dict: Dict[str, Any]) -> DI:
d = src_dict.copy()
_end = d.pop("end", UNSET)
end: Union[Unset, Point3d]
if isinstance(_end, Unset):
end = UNSET
if _end is None:
end = UNSET
else:
end = Point3d.from_dict(_end)
_start = d.pop("start", UNSET)
start: Union[Unset, Point3d]
if isinstance(_start, Unset):
start = UNSET
if _start is None:
start = UNSET
else:
start = Point3d.from_dict(_start)
curve_get_end_points = cls(
end=end,
start=start,
)
curve_get_end_points.additional_properties = d
return curve_get_end_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,64 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.curve_type import CurveType
from ..types import UNSET, Unset
OJ = TypeVar("OJ", 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[OJ], src_dict: Dict[str, Any]) -> OJ:
d = src_dict.copy()
_curve_type = d.pop("curve_type", UNSET)
curve_type: Union[Unset, CurveType]
if isinstance(_curve_type, Unset):
curve_type = UNSET
if _curve_type is None:
curve_type = UNSET
else:
curve_type = _curve_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,12 @@
from enum import Enum
class CurveType(str, Enum):
"""The type of Curve (embedded within path)""" # noqa: E501
LINE = "line"
ARC = "arc"
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 ..types import UNSET, Unset
US = TypeVar("US", bound="Customer")
UF = TypeVar("UF", bound="Customer")
@attr.s(auto_attribs=True)
@ -22,7 +22,7 @@ class Customer:
delinquent: Union[Unset, bool] = False
email: 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
phone: Union[Unset, str] = UNSET
@ -41,6 +41,7 @@ class Customer:
email = self.email
id = self.id
metadata = self.metadata
name = self.name
phone = self.phone
@ -48,7 +49,7 @@ class Customer:
field_dict.update(self.additional_properties)
field_dict.update({})
if address is not UNSET:
field_dict["address"] = address
field_dict["address"] = address.to_dict()
if balance is not UNSET:
field_dict["balance"] = balance
if created_at is not UNSET:
@ -71,14 +72,16 @@ class Customer:
return field_dict
@classmethod
def from_dict(cls: Type[US], src_dict: Dict[str, Any]) -> US:
def from_dict(cls: Type[UF], src_dict: Dict[str, Any]) -> UF:
d = src_dict.copy()
_address = d.pop("address", UNSET)
address: Union[Unset, NewAddress]
if isinstance(_address, Unset):
address = UNSET
if _address is None:
address = UNSET
else:
address = _address # type: ignore[arg-type]
address = NewAddress.from_dict(_address)
balance = d.pop("balance", UNSET)
@ -93,8 +96,10 @@ class Customer:
currency: Union[Unset, Currency]
if isinstance(_currency, Unset):
currency = UNSET
if _currency is None:
currency = UNSET
else:
currency = _currency # type: ignore[arg-type]
currency = _currency
delinquent = d.pop("delinquent", UNSET)
@ -103,6 +108,7 @@ class Customer:
id = d.pop("id", UNSET)
metadata = d.pop("metadata", UNSET)
name = d.pop("name", UNSET)
phone = d.pop("phone", UNSET)

View File

@ -7,7 +7,7 @@ from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..types import UNSET, Unset
KQ = TypeVar("KQ", bound="CustomerBalance")
YF = TypeVar("YF", bound="CustomerBalance")
@attr.s(auto_attribs=True)
@ -64,7 +64,7 @@ class CustomerBalance:
return field_dict
@classmethod
def from_dict(cls: Type[KQ], src_dict: Dict[str, Any]) -> KQ:
def from_dict(cls: Type[YF], src_dict: Dict[str, Any]) -> YF:
d = src_dict.copy()
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]
@ -77,8 +77,10 @@ class CustomerBalance:
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id # type: ignore[arg-type]
id = _id
monthly_credits_remaining = d.pop("monthly_credits_remaining", UNSET)
@ -95,7 +97,14 @@ class CustomerBalance:
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
customer_balance = cls(
created_at=created_at,

View File

@ -0,0 +1,71 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.unit_density import UnitDensity
from ..types import UNSET, Unset
PY = TypeVar("PY", bound="Density")
@attr.s(auto_attribs=True)
class Density:
"""The density response.""" # noqa: E501
density: Union[Unset, float] = UNSET
output_unit: Union[Unset, UnitDensity] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
density = self.density
if not isinstance(self.output_unit, Unset):
output_unit = self.output_unit
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if density is not UNSET:
field_dict["density"] = density
if output_unit is not UNSET:
field_dict["output_unit"] = output_unit
return field_dict
@classmethod
def from_dict(cls: Type[PY], src_dict: Dict[str, Any]) -> PY:
d = src_dict.copy()
density = d.pop("density", UNSET)
_output_unit = d.pop("output_unit", UNSET)
output_unit: Union[Unset, UnitDensity]
if isinstance(_output_unit, Unset):
output_unit = UNSET
if _output_unit is None:
output_unit = UNSET
else:
output_unit = _output_unit
density = cls(
density=density,
output_unit=output_unit,
)
density.additional_properties = d
return density
@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

@ -5,7 +5,7 @@ import attr
from ..models.o_auth2_grant_type import OAuth2GrantType
from ..types import UNSET, Unset
FH = TypeVar("FH", bound="DeviceAccessTokenRequestForm")
LK = TypeVar("LK", bound="DeviceAccessTokenRequestForm")
@attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class DeviceAccessTokenRequestForm:
return field_dict
@classmethod
def from_dict(cls: Type[FH], src_dict: Dict[str, Any]) -> FH:
def from_dict(cls: Type[LK], src_dict: Dict[str, Any]) -> LK:
d = src_dict.copy()
client_id = d.pop("client_id", UNSET)
@ -47,8 +47,10 @@ class DeviceAccessTokenRequestForm:
grant_type: Union[Unset, OAuth2GrantType]
if isinstance(_grant_type, Unset):
grant_type = UNSET
if _grant_type is None:
grant_type = UNSET
else:
grant_type = _grant_type # type: ignore[arg-type]
grant_type = _grant_type
device_access_token_request_form = cls(
client_id=client_id,

View File

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

View File

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

View File

@ -5,7 +5,7 @@ import attr
from ..models.coupon import Coupon
from ..types import UNSET, Unset
PJ = TypeVar("PJ", bound="Discount")
KK = TypeVar("KK", bound="Discount")
@attr.s(auto_attribs=True)
@ -24,19 +24,21 @@ class Discount:
field_dict.update(self.additional_properties)
field_dict.update({})
if coupon is not UNSET:
field_dict["coupon"] = coupon
field_dict["coupon"] = coupon.to_dict()
return field_dict
@classmethod
def from_dict(cls: Type[PJ], src_dict: Dict[str, Any]) -> PJ:
def from_dict(cls: Type[KK], src_dict: Dict[str, Any]) -> KK:
d = src_dict.copy()
_coupon = d.pop("coupon", UNSET)
coupon: Union[Unset, Coupon]
if isinstance(_coupon, Unset):
coupon = UNSET
if _coupon is None:
coupon = UNSET
else:
coupon = _coupon # type: ignore[arg-type]
coupon = Coupon.from_dict(_coupon)
discount = cls(
coupon=coupon,

View File

@ -1,543 +0,0 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.commit import Commit
from ..models.plugins_info import PluginsInfo
from ..models.registry_service_config import RegistryServiceConfig
from ..models.system_info_cgroup_driver_enum import SystemInfoCgroupDriverEnum
from ..models.system_info_cgroup_version_enum import SystemInfoCgroupVersionEnum
from ..models.system_info_isolation_enum import SystemInfoIsolationEnum
from ..types import UNSET, Unset
TV = TypeVar("TV", bound="DockerSystemInfo")
@attr.s(auto_attribs=True)
class DockerSystemInfo:
"""Docker system info.""" # noqa: E501
architecture: Union[Unset, str] = UNSET
bridge_nf_ip6tables: Union[Unset, bool] = False
bridge_nf_iptables: Union[Unset, bool] = False
cgroup_driver: Union[Unset, SystemInfoCgroupDriverEnum] = UNSET
cgroup_version: Union[Unset, SystemInfoCgroupVersionEnum] = UNSET
cluster_advertise: Union[Unset, str] = UNSET
cluster_store: Union[Unset, str] = UNSET
containerd_commit: Union[Unset, Commit] = UNSET
containers: Union[Unset, int] = UNSET
containers_paused: Union[Unset, int] = UNSET
containers_running: Union[Unset, int] = UNSET
containers_stopped: Union[Unset, int] = UNSET
cpu_cfs_period: Union[Unset, bool] = False
cpu_cfs_quota: Union[Unset, bool] = False
cpu_set: Union[Unset, bool] = False
cpu_shares: Union[Unset, bool] = False
debug: Union[Unset, bool] = False
from ..models.system_info_default_address_pools import SystemInfoDefaultAddressPools
default_address_pools: Union[Unset, List[SystemInfoDefaultAddressPools]] = UNSET
default_runtime: Union[Unset, str] = UNSET
docker_root_dir: Union[Unset, str] = UNSET
driver: Union[Unset, str] = UNSET
driver_status: Union[Unset, List[List[str]]] = UNSET
experimental_build: Union[Unset, bool] = False
http_proxy: Union[Unset, str] = UNSET
https_proxy: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
images: Union[Unset, int] = UNSET
index_server_address: Union[Unset, str] = UNSET
init_binary: Union[Unset, str] = UNSET
init_commit: Union[Unset, Commit] = UNSET
ipv4_forwarding: Union[Unset, bool] = False
isolation: Union[Unset, SystemInfoIsolationEnum] = UNSET
kernel_memory: Union[Unset, bool] = False
kernel_memory_tcp: Union[Unset, bool] = False
kernel_version: Union[Unset, str] = UNSET
labels: Union[Unset, List[str]] = UNSET
live_restore_enabled: Union[Unset, bool] = False
logging_driver: Union[Unset, str] = UNSET
mem_total: Union[Unset, int] = UNSET
memory_limit: Union[Unset, bool] = False
n_events_listener: Union[Unset, int] = UNSET
n_fd: Union[Unset, int] = UNSET
name: Union[Unset, str] = UNSET
ncpu: Union[Unset, int] = UNSET
no_proxy: Union[Unset, str] = UNSET
oom_kill_disable: Union[Unset, bool] = False
operating_system: Union[Unset, str] = UNSET
os_type: Union[Unset, str] = UNSET
os_version: Union[Unset, str] = UNSET
pids_limit: Union[Unset, bool] = False
plugins: Union[Unset, PluginsInfo] = UNSET
product_license: Union[Unset, str] = UNSET
registry_config: Union[Unset, RegistryServiceConfig] = UNSET
runc_commit: Union[Unset, Commit] = UNSET
runtimes: Union[Unset, Any] = UNSET
security_options: Union[Unset, List[str]] = UNSET
server_version: Union[Unset, str] = UNSET
swap_limit: Union[Unset, bool] = False
system_time: Union[Unset, str] = UNSET
warnings: Union[Unset, List[str]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
architecture = self.architecture
bridge_nf_ip6tables = self.bridge_nf_ip6tables
bridge_nf_iptables = self.bridge_nf_iptables
if not isinstance(self.cgroup_driver, Unset):
cgroup_driver = self.cgroup_driver
if not isinstance(self.cgroup_version, Unset):
cgroup_version = self.cgroup_version
cluster_advertise = self.cluster_advertise
cluster_store = self.cluster_store
if not isinstance(self.containerd_commit, Unset):
containerd_commit = self.containerd_commit
containers = self.containers
containers_paused = self.containers_paused
containers_running = self.containers_running
containers_stopped = self.containers_stopped
cpu_cfs_period = self.cpu_cfs_period
cpu_cfs_quota = self.cpu_cfs_quota
cpu_set = self.cpu_set
cpu_shares = self.cpu_shares
debug = self.debug
from ..models.system_info_default_address_pools import (
SystemInfoDefaultAddressPools,
)
default_address_pools: Union[Unset, List[SystemInfoDefaultAddressPools]] = UNSET
if not isinstance(self.default_address_pools, Unset):
default_address_pools = self.default_address_pools
default_runtime = self.default_runtime
docker_root_dir = self.docker_root_dir
driver = self.driver
driver_status: Union[Unset, List[List[str]]] = UNSET
if not isinstance(self.driver_status, Unset):
driver_status = self.driver_status
experimental_build = self.experimental_build
http_proxy = self.http_proxy
https_proxy = self.https_proxy
id = self.id
images = self.images
index_server_address = self.index_server_address
init_binary = self.init_binary
if not isinstance(self.init_commit, Unset):
init_commit = self.init_commit
ipv4_forwarding = self.ipv4_forwarding
if not isinstance(self.isolation, Unset):
isolation = self.isolation
kernel_memory = self.kernel_memory
kernel_memory_tcp = self.kernel_memory_tcp
kernel_version = self.kernel_version
labels: Union[Unset, List[str]] = UNSET
if not isinstance(self.labels, Unset):
labels = self.labels
live_restore_enabled = self.live_restore_enabled
logging_driver = self.logging_driver
mem_total = self.mem_total
memory_limit = self.memory_limit
n_events_listener = self.n_events_listener
n_fd = self.n_fd
name = self.name
ncpu = self.ncpu
no_proxy = self.no_proxy
oom_kill_disable = self.oom_kill_disable
operating_system = self.operating_system
os_type = self.os_type
os_version = self.os_version
pids_limit = self.pids_limit
if not isinstance(self.plugins, Unset):
plugins = self.plugins
product_license = self.product_license
if not isinstance(self.registry_config, Unset):
registry_config = self.registry_config
if not isinstance(self.runc_commit, Unset):
runc_commit = self.runc_commit
runtimes = self.runtimes
security_options: Union[Unset, List[str]] = UNSET
if not isinstance(self.security_options, Unset):
security_options = self.security_options
server_version = self.server_version
swap_limit = self.swap_limit
system_time = self.system_time
warnings: Union[Unset, List[str]] = UNSET
if not isinstance(self.warnings, Unset):
warnings = self.warnings
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if architecture is not UNSET:
field_dict["architecture"] = architecture
if bridge_nf_ip6tables is not UNSET:
field_dict["bridge_nf_ip6tables"] = bridge_nf_ip6tables
if bridge_nf_iptables is not UNSET:
field_dict["bridge_nf_iptables"] = bridge_nf_iptables
if cgroup_driver is not UNSET:
field_dict["cgroup_driver"] = cgroup_driver
if cgroup_version is not UNSET:
field_dict["cgroup_version"] = cgroup_version
if cluster_advertise is not UNSET:
field_dict["cluster_advertise"] = cluster_advertise
if cluster_store is not UNSET:
field_dict["cluster_store"] = cluster_store
if containerd_commit is not UNSET:
field_dict["containerd_commit"] = containerd_commit
if containers is not UNSET:
field_dict["containers"] = containers
if containers_paused is not UNSET:
field_dict["containers_paused"] = containers_paused
if containers_running is not UNSET:
field_dict["containers_running"] = containers_running
if containers_stopped is not UNSET:
field_dict["containers_stopped"] = containers_stopped
if cpu_cfs_period is not UNSET:
field_dict["cpu_cfs_period"] = cpu_cfs_period
if cpu_cfs_quota is not UNSET:
field_dict["cpu_cfs_quota"] = cpu_cfs_quota
if cpu_set is not UNSET:
field_dict["cpu_set"] = cpu_set
if cpu_shares is not UNSET:
field_dict["cpu_shares"] = cpu_shares
if debug is not UNSET:
field_dict["debug"] = debug
if default_address_pools is not UNSET:
field_dict["default_address_pools"] = default_address_pools
if default_runtime is not UNSET:
field_dict["default_runtime"] = default_runtime
if docker_root_dir is not UNSET:
field_dict["docker_root_dir"] = docker_root_dir
if driver is not UNSET:
field_dict["driver"] = driver
if driver_status is not UNSET:
field_dict["driver_status"] = driver_status
if experimental_build is not UNSET:
field_dict["experimental_build"] = experimental_build
if http_proxy is not UNSET:
field_dict["http_proxy"] = http_proxy
if https_proxy is not UNSET:
field_dict["https_proxy"] = https_proxy
if id is not UNSET:
field_dict["id"] = id
if images is not UNSET:
field_dict["images"] = images
if index_server_address is not UNSET:
field_dict["index_server_address"] = index_server_address
if init_binary is not UNSET:
field_dict["init_binary"] = init_binary
if init_commit is not UNSET:
field_dict["init_commit"] = init_commit
if ipv4_forwarding is not UNSET:
field_dict["ipv4_forwarding"] = ipv4_forwarding
if isolation is not UNSET:
field_dict["isolation"] = isolation
if kernel_memory is not UNSET:
field_dict["kernel_memory"] = kernel_memory
if kernel_memory_tcp is not UNSET:
field_dict["kernel_memory_tcp"] = kernel_memory_tcp
if kernel_version is not UNSET:
field_dict["kernel_version"] = kernel_version
if labels is not UNSET:
field_dict["labels"] = labels
if live_restore_enabled is not UNSET:
field_dict["live_restore_enabled"] = live_restore_enabled
if logging_driver is not UNSET:
field_dict["logging_driver"] = logging_driver
if mem_total is not UNSET:
field_dict["mem_total"] = mem_total
if memory_limit is not UNSET:
field_dict["memory_limit"] = memory_limit
if n_events_listener is not UNSET:
field_dict["n_events_listener"] = n_events_listener
if n_fd is not UNSET:
field_dict["n_fd"] = n_fd
if name is not UNSET:
field_dict["name"] = name
if ncpu is not UNSET:
field_dict["ncpu"] = ncpu
if no_proxy is not UNSET:
field_dict["no_proxy"] = no_proxy
if oom_kill_disable is not UNSET:
field_dict["oom_kill_disable"] = oom_kill_disable
if operating_system is not UNSET:
field_dict["operating_system"] = operating_system
if os_type is not UNSET:
field_dict["os_type"] = os_type
if os_version is not UNSET:
field_dict["os_version"] = os_version
if pids_limit is not UNSET:
field_dict["pids_limit"] = pids_limit
if plugins is not UNSET:
field_dict["plugins"] = plugins
if product_license is not UNSET:
field_dict["product_license"] = product_license
if registry_config is not UNSET:
field_dict["registry_config"] = registry_config
if runc_commit is not UNSET:
field_dict["runc_commit"] = runc_commit
if runtimes is not UNSET:
field_dict["runtimes"] = runtimes
if security_options is not UNSET:
field_dict["security_options"] = security_options
if server_version is not UNSET:
field_dict["server_version"] = server_version
if swap_limit is not UNSET:
field_dict["swap_limit"] = swap_limit
if system_time is not UNSET:
field_dict["system_time"] = system_time
if warnings is not UNSET:
field_dict["warnings"] = warnings
return field_dict
@classmethod
def from_dict(cls: Type[TV], src_dict: Dict[str, Any]) -> TV:
d = src_dict.copy()
architecture = d.pop("architecture", UNSET)
bridge_nf_ip6tables = d.pop("bridge_nf_ip6tables", UNSET)
bridge_nf_iptables = d.pop("bridge_nf_iptables", UNSET)
_cgroup_driver = d.pop("cgroup_driver", UNSET)
cgroup_driver: Union[Unset, SystemInfoCgroupDriverEnum]
if isinstance(_cgroup_driver, Unset):
cgroup_driver = UNSET
else:
cgroup_driver = _cgroup_driver # type: ignore[arg-type]
_cgroup_version = d.pop("cgroup_version", UNSET)
cgroup_version: Union[Unset, SystemInfoCgroupVersionEnum]
if isinstance(_cgroup_version, Unset):
cgroup_version = UNSET
else:
cgroup_version = _cgroup_version # type: ignore[arg-type]
cluster_advertise = d.pop("cluster_advertise", UNSET)
cluster_store = d.pop("cluster_store", UNSET)
_containerd_commit = d.pop("containerd_commit", UNSET)
containerd_commit: Union[Unset, Commit]
if isinstance(_containerd_commit, Unset):
containerd_commit = UNSET
else:
containerd_commit = _containerd_commit # type: ignore[arg-type]
containers = d.pop("containers", UNSET)
containers_paused = d.pop("containers_paused", UNSET)
containers_running = d.pop("containers_running", UNSET)
containers_stopped = d.pop("containers_stopped", UNSET)
cpu_cfs_period = d.pop("cpu_cfs_period", UNSET)
cpu_cfs_quota = d.pop("cpu_cfs_quota", UNSET)
cpu_set = d.pop("cpu_set", UNSET)
cpu_shares = d.pop("cpu_shares", UNSET)
debug = d.pop("debug", UNSET)
from ..models.system_info_default_address_pools import (
SystemInfoDefaultAddressPools,
)
default_address_pools = cast(
List[SystemInfoDefaultAddressPools], d.pop("default_address_pools", UNSET)
)
default_runtime = d.pop("default_runtime", UNSET)
docker_root_dir = d.pop("docker_root_dir", UNSET)
driver = d.pop("driver", UNSET)
driver_status = cast(List[List[str]], d.pop("driver_status", UNSET))
experimental_build = d.pop("experimental_build", UNSET)
http_proxy = d.pop("http_proxy", UNSET)
https_proxy = d.pop("https_proxy", UNSET)
id = d.pop("id", UNSET)
images = d.pop("images", UNSET)
index_server_address = d.pop("index_server_address", UNSET)
init_binary = d.pop("init_binary", UNSET)
_init_commit = d.pop("init_commit", UNSET)
init_commit: Union[Unset, Commit]
if isinstance(_init_commit, Unset):
init_commit = UNSET
else:
init_commit = _init_commit # type: ignore[arg-type]
ipv4_forwarding = d.pop("ipv4_forwarding", UNSET)
_isolation = d.pop("isolation", UNSET)
isolation: Union[Unset, SystemInfoIsolationEnum]
if isinstance(_isolation, Unset):
isolation = UNSET
else:
isolation = _isolation # type: ignore[arg-type]
kernel_memory = d.pop("kernel_memory", UNSET)
kernel_memory_tcp = d.pop("kernel_memory_tcp", UNSET)
kernel_version = d.pop("kernel_version", UNSET)
labels = cast(List[str], d.pop("labels", UNSET))
live_restore_enabled = d.pop("live_restore_enabled", UNSET)
logging_driver = d.pop("logging_driver", UNSET)
mem_total = d.pop("mem_total", UNSET)
memory_limit = d.pop("memory_limit", UNSET)
n_events_listener = d.pop("n_events_listener", UNSET)
n_fd = d.pop("n_fd", UNSET)
name = d.pop("name", UNSET)
ncpu = d.pop("ncpu", UNSET)
no_proxy = d.pop("no_proxy", UNSET)
oom_kill_disable = d.pop("oom_kill_disable", UNSET)
operating_system = d.pop("operating_system", UNSET)
os_type = d.pop("os_type", UNSET)
os_version = d.pop("os_version", UNSET)
pids_limit = d.pop("pids_limit", UNSET)
_plugins = d.pop("plugins", UNSET)
plugins: Union[Unset, PluginsInfo]
if isinstance(_plugins, Unset):
plugins = UNSET
else:
plugins = _plugins # type: ignore[arg-type]
product_license = d.pop("product_license", UNSET)
_registry_config = d.pop("registry_config", UNSET)
registry_config: Union[Unset, RegistryServiceConfig]
if isinstance(_registry_config, Unset):
registry_config = UNSET
else:
registry_config = _registry_config # type: ignore[arg-type]
_runc_commit = d.pop("runc_commit", UNSET)
runc_commit: Union[Unset, Commit]
if isinstance(_runc_commit, Unset):
runc_commit = UNSET
else:
runc_commit = _runc_commit # type: ignore[arg-type]
runtimes = d.pop("runtimes", UNSET)
security_options = cast(List[str], d.pop("security_options", UNSET))
server_version = d.pop("server_version", UNSET)
swap_limit = d.pop("swap_limit", UNSET)
system_time = d.pop("system_time", UNSET)
warnings = cast(List[str], d.pop("warnings", UNSET))
docker_system_info = cls(
architecture=architecture,
bridge_nf_ip6tables=bridge_nf_ip6tables,
bridge_nf_iptables=bridge_nf_iptables,
cgroup_driver=cgroup_driver,
cgroup_version=cgroup_version,
cluster_advertise=cluster_advertise,
cluster_store=cluster_store,
containerd_commit=containerd_commit,
containers=containers,
containers_paused=containers_paused,
containers_running=containers_running,
containers_stopped=containers_stopped,
cpu_cfs_period=cpu_cfs_period,
cpu_cfs_quota=cpu_cfs_quota,
cpu_set=cpu_set,
cpu_shares=cpu_shares,
debug=debug,
default_address_pools=default_address_pools,
default_runtime=default_runtime,
docker_root_dir=docker_root_dir,
driver=driver,
driver_status=driver_status,
experimental_build=experimental_build,
http_proxy=http_proxy,
https_proxy=https_proxy,
id=id,
images=images,
index_server_address=index_server_address,
init_binary=init_binary,
init_commit=init_commit,
ipv4_forwarding=ipv4_forwarding,
isolation=isolation,
kernel_memory=kernel_memory,
kernel_memory_tcp=kernel_memory_tcp,
kernel_version=kernel_version,
labels=labels,
live_restore_enabled=live_restore_enabled,
logging_driver=logging_driver,
mem_total=mem_total,
memory_limit=memory_limit,
n_events_listener=n_events_listener,
n_fd=n_fd,
name=name,
ncpu=ncpu,
no_proxy=no_proxy,
oom_kill_disable=oom_kill_disable,
operating_system=operating_system,
os_type=os_type,
os_version=os_version,
pids_limit=pids_limit,
plugins=plugins,
product_license=product_license,
registry_config=registry_config,
runc_commit=runc_commit,
runtimes=runtimes,
security_options=security_options,
server_version=server_version,
swap_limit=swap_limit,
system_time=system_time,
warnings=warnings,
)
docker_system_info.additional_properties = d
return docker_system_info
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

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

@ -1,120 +0,0 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.cache_metadata import CacheMetadata
from ..models.connection import Connection
from ..models.environment import Environment
from ..models.file_system_metadata import FileSystemMetadata
from ..types import UNSET, Unset
CE = TypeVar("CE", bound="EngineMetadata")
@attr.s(auto_attribs=True)
class EngineMetadata:
"""Metadata about our currently running server.
This is mostly used for internal purposes and debugging.""" # noqa: E501
async_jobs_running: Union[Unset, bool] = False
cache: Union[Unset, CacheMetadata] = UNSET
environment: Union[Unset, Environment] = UNSET
fs: Union[Unset, FileSystemMetadata] = UNSET
git_hash: Union[Unset, str] = UNSET
pubsub: Union[Unset, Connection] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
async_jobs_running = self.async_jobs_running
if not isinstance(self.cache, Unset):
cache = self.cache
if not isinstance(self.environment, Unset):
environment = self.environment
if not isinstance(self.fs, Unset):
fs = self.fs
git_hash = self.git_hash
if not isinstance(self.pubsub, Unset):
pubsub = self.pubsub
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if async_jobs_running is not UNSET:
field_dict["async_jobs_running"] = async_jobs_running
if cache is not UNSET:
field_dict["cache"] = cache
if environment is not UNSET:
field_dict["environment"] = environment
if fs is not UNSET:
field_dict["fs"] = fs
if git_hash is not UNSET:
field_dict["git_hash"] = git_hash
if pubsub is not UNSET:
field_dict["pubsub"] = pubsub
return field_dict
@classmethod
def from_dict(cls: Type[CE], src_dict: Dict[str, Any]) -> CE:
d = src_dict.copy()
async_jobs_running = d.pop("async_jobs_running", UNSET)
_cache = d.pop("cache", UNSET)
cache: Union[Unset, CacheMetadata]
if isinstance(_cache, Unset):
cache = UNSET
else:
cache = _cache # type: ignore[arg-type]
_environment = d.pop("environment", UNSET)
environment: Union[Unset, Environment]
if isinstance(_environment, Unset):
environment = UNSET
else:
environment = _environment # type: ignore[arg-type]
_fs = d.pop("fs", UNSET)
fs: Union[Unset, FileSystemMetadata]
if isinstance(_fs, Unset):
fs = UNSET
else:
fs = _fs # type: ignore[arg-type]
git_hash = d.pop("git_hash", UNSET)
_pubsub = d.pop("pubsub", UNSET)
pubsub: Union[Unset, Connection]
if isinstance(_pubsub, Unset):
pubsub = UNSET
else:
pubsub = _pubsub # type: ignore[arg-type]
engine_metadata = cls(
async_jobs_running=async_jobs_running,
cache=cache,
environment=environment,
fs=fs,
git_hash=git_hash,
pubsub=pubsub,
)
engine_metadata.additional_properties = d
return engine_metadata
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,57 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
FM = TypeVar("FM", 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[FM], src_dict: Dict[str, Any]) -> FM:
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
PV = TypeVar("PV", 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[PV], src_dict: Dict[str, Any]) -> PV:
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

@ -4,41 +4,39 @@ import attr
from ..types import UNSET, Unset
SK = TypeVar("SK", bound="PointEMetadata")
QI = TypeVar("QI", bound="EntityGetNumChildren")
@attr.s(auto_attribs=True)
class PointEMetadata:
"""Metadata about our point-e instance.
class EntityGetNumChildren:
"""The response from the `EntityGetNumChildren` command.""" # noqa: E501
This is mostly used for internal purposes and debugging.""" # noqa: E501
ok: Union[Unset, bool] = False
num: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
ok = self.ok
num = self.num
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if ok is not UNSET:
field_dict["ok"] = ok
if num is not UNSET:
field_dict["num"] = num
return field_dict
@classmethod
def from_dict(cls: Type[SK], src_dict: Dict[str, Any]) -> SK:
def from_dict(cls: Type[QI], src_dict: Dict[str, Any]) -> QI:
d = src_dict.copy()
ok = d.pop("ok", UNSET)
num = d.pop("num", UNSET)
point_e_metadata = cls(
ok=ok,
entity_get_num_children = cls(
num=num,
)
point_e_metadata.additional_properties = d
return point_e_metadata
entity_get_num_children.additional_properties = d
return entity_get_num_children
@property
def additional_keys(self) -> List[str]:

View File

@ -0,0 +1,55 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
TP = TypeVar("TP", 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[TP], src_dict: Dict[str, Any]) -> TP:
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"
EDGE = "edge"
FACE = "face"
PLANE = "plane"
def __str__(self) -> str:
return str(self.value)

View File

@ -2,51 +2,51 @@ from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.error_code import ErrorCode
from ..types import UNSET, Unset
MS = TypeVar("MS", bound="Error")
CF = TypeVar("CF", bound="Error")
@attr.s(auto_attribs=True)
class Error:
"""An error.""" # noqa: E501
"""Error information from a response.""" # noqa: E501
code: Union[Unset, ErrorCode] = UNSET
error_code: Union[Unset, str] = UNSET
message: Union[Unset, str] = UNSET
request_id: 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.code, Unset):
code = self.code
error_code = self.error_code
message = self.message
request_id = self.request_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if code is not UNSET:
field_dict["code"] = code
if error_code is not UNSET:
field_dict["error_code"] = error_code
if message is not UNSET:
field_dict["message"] = message
if request_id is not UNSET:
field_dict["request_id"] = request_id
return field_dict
@classmethod
def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS:
def from_dict(cls: Type[CF], src_dict: Dict[str, Any]) -> CF:
d = src_dict.copy()
_code = d.pop("code", UNSET)
code: Union[Unset, ErrorCode]
if isinstance(_code, Unset):
code = UNSET
else:
code = _code # type: ignore[arg-type]
error_code = d.pop("error_code", UNSET)
message = d.pop("message", UNSET)
request_id = d.pop("request_id", UNSET)
error = cls(
code=code,
error_code=error_code,
message=message,
request_id=request_id,
)
error.additional_properties = d

View File

@ -2,12 +2,26 @@ from enum import Enum
class ErrorCode(str, Enum):
"""The type of errorcode.""" # noqa: E501
"""The type of error sent by the KittyCAD API.""" # noqa: E501
"""# User requested something impossible or invalid """ # noqa: E501
BAD_REQUEST = "bad_request"
"""# Engine failed to complete request, consider retrying """ # 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"
"""# Client sent invalid BSON. """ # noqa: E501
INVALID_BSON = "invalid_bson"
"""# Client sent a message which is not accepted over this protocol. """ # noqa: E501
WRONG_PROTOCOL = "wrong_protocol"
"""# 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

@ -1,85 +0,0 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.docker_system_info import DockerSystemInfo
from ..models.environment import Environment
from ..types import UNSET, Unset
ED = TypeVar("ED", bound="ExecutorMetadata")
@attr.s(auto_attribs=True)
class ExecutorMetadata:
"""Metadata about our currently running server.
This is mostly used for internal purposes and debugging.""" # noqa: E501
docker_info: Union[Unset, DockerSystemInfo] = UNSET
environment: Union[Unset, Environment] = UNSET
git_hash: 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.docker_info, Unset):
docker_info = self.docker_info
if not isinstance(self.environment, Unset):
environment = self.environment
git_hash = self.git_hash
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if docker_info is not UNSET:
field_dict["docker_info"] = docker_info
if environment is not UNSET:
field_dict["environment"] = environment
if git_hash is not UNSET:
field_dict["git_hash"] = git_hash
return field_dict
@classmethod
def from_dict(cls: Type[ED], src_dict: Dict[str, Any]) -> ED:
d = src_dict.copy()
_docker_info = d.pop("docker_info", UNSET)
docker_info: Union[Unset, DockerSystemInfo]
if isinstance(_docker_info, Unset):
docker_info = UNSET
else:
docker_info = _docker_info # type: ignore[arg-type]
_environment = d.pop("environment", UNSET)
environment: Union[Unset, Environment]
if isinstance(_environment, Unset):
environment = UNSET
else:
environment = _environment # type: ignore[arg-type]
git_hash = d.pop("git_hash", UNSET)
executor_metadata = cls(
docker_info=docker_info,
environment=environment,
git_hash=git_hash,
)
executor_metadata.additional_properties = d
return executor_metadata
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

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
OM = TypeVar("OM", 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[OM], src_dict: Dict[str, Any]) -> OM:
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
from ..models.base64data import Base64Data
from ..types import UNSET, Unset
YY = TypeVar("YY", bound="ExportFile")
EN = TypeVar("EN", bound="ExportFile")
@attr.s(auto_attribs=True)
class ExportFile:
"""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
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
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
field_dict: Dict[str, Any] = {}
@ -31,9 +34,14 @@ class ExportFile:
return field_dict
@classmethod
def from_dict(cls: Type[YY], src_dict: Dict[str, Any]) -> YY:
def from_dict(cls: Type[EN], src_dict: Dict[str, Any]) -> EN:
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)

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