Skip to content

Commit 9ee93b7

Browse files
authored
update openapi spec (#503)
* YOYO NEW API SPEC!
1 parent 37ce6fa commit 9ee93b7

File tree

9 files changed

+57
-57
lines changed

9 files changed

+57
-57
lines changed

docs/pagination.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ Ml API
210210
async for item in client.ml.list_conversations_for_user():
211211
print(item)
212212
213-
**list_text_to_cad_models_for_user**
214-
List text-to-CAD models you've generated.
213+
**list_text_to_cad_parts_for_user**
214+
List text-to-CAD parts you've generated.
215215

216216
Returns: ``SyncPageIterator[TextToCadResponse]``
217217

@@ -220,11 +220,11 @@ Ml API
220220
.. code-block:: python
221221
222222
# Sync
223-
for item in client.ml.list_text_to_cad_models_for_user():
223+
for item in client.ml.list_text_to_cad_parts_for_user():
224224
print(item)
225225
226226
# Async
227-
async for item in client.ml.list_text_to_cad_models_for_user():
227+
async for item in client.ml.list_text_to_cad_parts_for_user():
228228
print(item)
229229
230230

kittycad.py.patch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,23 +1099,23 @@
10991099
"op": "add",
11001100
"path": "/paths/~1user~1text-to-cad/get/x-python",
11011101
"value": {
1102-
"example": "from kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.models.uuid import Uuid\nfrom kittycad.models.uuid import Uuid\nfrom kittycad.models import TextToCadResponseResultsPage\nfrom typing import Union, Any, Optional, List, Tuple\nfrom kittycad.types import Response\n\n\nfrom kittycad.models import TextToCadResponse\ndef example_list_text_to_cad_models_for_user():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n # Iterate through all pages automatically\n item: TextToCadResponse\n for item in client.ml.list_text_to_cad_models_for_user(sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n conversation_id=Uuid(\"<string>\"),\n limit=None,\n page_token=None,\n no_models=None):\n print(item)\n\n",
1102+
"example": "from kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.models.uuid import Uuid\nfrom kittycad.models.uuid import Uuid\nfrom kittycad.models import TextToCadResponseResultsPage\nfrom typing import Union, Any, Optional, List, Tuple\nfrom kittycad.types import Response\n\n\nfrom kittycad.models import TextToCadResponse\ndef example_list_text_to_cad_parts_for_user():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n # Iterate through all pages automatically\n item: TextToCadResponse\n for item in client.ml.list_text_to_cad_parts_for_user(sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n conversation_id=Uuid(\"<string>\"),\n limit=None,\n page_token=None,\n no_models=None):\n print(item)\n\n",
11031103
"libDocsLink": "https://python.api.docs.zoo.dev/_autosummary/kittycad.KittyCAD.html#kittycad.KittyCAD.ml"
11041104
}
11051105
},
11061106
{
11071107
"op": "add",
11081108
"path": "/paths/~1user~1text-to-cad~1{id}/get/x-python",
11091109
"value": {
1110-
"example": "from kittycad.models import TextToCadResponse\nfrom typing import Union, Any, Optional, List, Tuple\nfrom kittycad.types import Response\ndef example_get_text_to_cad_model_for_user():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n result: TextToCadResponse = client.ml.get_text_to_cad_model_for_user(id=\"<string>\")\n\n\n body: TextToCadResponse = result\n print(body)\n\n",
1110+
"example": "from kittycad.models import TextToCadResponse\nfrom typing import Union, Any, Optional, List, Tuple\nfrom kittycad.types import Response\ndef example_get_text_to_cad_parts_for_user():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n result: TextToCadResponse = client.ml.get_text_to_cad_parts_for_user(id=\"<string>\")\n\n\n body: TextToCadResponse = result\n print(body)\n\n",
11111111
"libDocsLink": "https://python.api.docs.zoo.dev/_autosummary/kittycad.KittyCAD.html#kittycad.KittyCAD.ml"
11121112
}
11131113
},
11141114
{
11151115
"op": "add",
11161116
"path": "/paths/~1user~1text-to-cad~1{id}/post/x-python",
11171117
"value": {
1118-
"example": "from kittycad.models.ml_feedback import MlFeedback\ndef example_create_text_to_cad_model_feedback():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n client.ml.create_text_to_cad_model_feedback(id=\"<string>\",\n feedback=MlFeedback.THUMBS_UP)\n\n",
1118+
"example": "from kittycad.models.ml_feedback import MlFeedback\ndef example_create_text_to_cad_part_feedback():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n client.ml.create_text_to_cad_part_feedback(id=\"<string>\",\n feedback=MlFeedback.THUMBS_UP)\n\n",
11191119
"libDocsLink": "https://python.api.docs.zoo.dev/_autosummary/kittycad.KittyCAD.html#kittycad.KittyCAD.ml"
11201120
}
11211121
},

kittycad/__init__.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ def create_text_to_cad(
663663
*,
664664
kcl: Optional[bool] = None,
665665
) -> TextToCad:
666-
"""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.
666+
"""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 parts. Any other formats you request here will also be returned when you list your generated parts.
667667
668668
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.
669669
@@ -1020,7 +1020,7 @@ def create_text_to_cad_multi_file_iteration(
10201020
body: TextToCadMultiFileIterationBody,
10211021
file_attachments: Dict[str, SyncUpload],
10221022
) -> TextToCadMultiFileIteration:
1023-
"""This endpoint can iterate on multi-file models.
1023+
"""This endpoint can iterate on multi-file projects.
10241024
10251025
Even if you give specific ranges to edit, the model might change more than just those in order to make the changes you requested without breaking the code.
10261026
@@ -1100,7 +1100,7 @@ def create_text_to_cad_multi_file_iteration(
11001100
# Validate into a Pydantic model (works for BaseModel and RootModel)
11011101
return TextToCadMultiFileIteration.model_validate(json_data)
11021102

1103-
def list_text_to_cad_models_for_user(
1103+
def list_text_to_cad_parts_for_user(
11041104
self,
11051105
*,
11061106
limit: Optional[int] = None,
@@ -1111,14 +1111,14 @@ def list_text_to_cad_models_for_user(
11111111
) -> "SyncPageIterator":
11121112
"""This will always return the STEP file contents as well as the format the user originally requested.
11131113
1114-
This endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.
1114+
This endpoint requires authentication by any Zoo user. It returns the text-to-CAD parts for the authenticated user.
11151115
1116-
The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.
1116+
The text-to-CAD parts are returned in order of creation, with the most recently created text-to-CAD parts first.
11171117
11181118
Returns an iterator that automatically handles pagination.
11191119
Iterate over all items across all pages:
11201120
1121-
for item in client.user.list_text_to_cad_models_for_user():
1121+
for item in client.user.list_text_to_cad_parts_for_user():
11221122
print(item)
11231123
"""
11241124

@@ -1147,15 +1147,15 @@ def list_text_to_cad_models_for_user(
11471147
kwargs["no_models"] = no_models
11481148

11491149
def fetch_page(**kw):
1150-
return self._fetch_page_list_text_to_cad_models_for_user(**kw)
1150+
return self._fetch_page_list_text_to_cad_parts_for_user(**kw)
11511151

11521152
# Create the page iterator
11531153
return SyncPageIterator(
11541154
page_fetcher=fetch_page,
11551155
initial_kwargs=kwargs,
11561156
)
11571157

1158-
def _fetch_page_list_text_to_cad_models_for_user(
1158+
def _fetch_page_list_text_to_cad_parts_for_user(
11591159
self, **kwargs
11601160
) -> TextToCadResponseResultsPage:
11611161
"""Internal method to fetch a single page."""
@@ -1214,7 +1214,7 @@ def _fetch_page_list_text_to_cad_models_for_user(
12141214
# Validate into a Pydantic model (supports BaseModel/RootModel)
12151215
return TextToCadResponseResultsPage.model_validate(json_data)
12161216

1217-
def get_text_to_cad_model_for_user(
1217+
def get_text_to_cad_parts_for_user(
12181218
self,
12191219
id: str,
12201220
) -> TextToCadResponse:
@@ -1242,7 +1242,7 @@ def get_text_to_cad_model_for_user(
12421242
# Validate into a Pydantic model (works for BaseModel and RootModel)
12431243
return TextToCadResponse.model_validate(json_data)
12441244

1245-
def create_text_to_cad_model_feedback(
1245+
def create_text_to_cad_part_feedback(
12461246
self,
12471247
id: str,
12481248
feedback: MlFeedback,
@@ -1301,7 +1301,7 @@ async def create_text_to_cad(
13011301
*,
13021302
kcl: Optional[bool] = None,
13031303
) -> TextToCad:
1304-
"""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.
1304+
"""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 parts. Any other formats you request here will also be returned when you list your generated parts.
13051305
13061306
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.
13071307
@@ -1658,7 +1658,7 @@ async def create_text_to_cad_multi_file_iteration(
16581658
body: TextToCadMultiFileIterationBody,
16591659
file_attachments: Dict[str, SyncUpload],
16601660
) -> TextToCadMultiFileIteration:
1661-
"""This endpoint can iterate on multi-file models.
1661+
"""This endpoint can iterate on multi-file projects.
16621662
16631663
Even if you give specific ranges to edit, the model might change more than just those in order to make the changes you requested without breaking the code.
16641664
@@ -1738,7 +1738,7 @@ async def create_text_to_cad_multi_file_iteration(
17381738
# Validate into a Pydantic model (works for BaseModel and RootModel)
17391739
return TextToCadMultiFileIteration.model_validate(json_data)
17401740

1741-
def list_text_to_cad_models_for_user(
1741+
def list_text_to_cad_parts_for_user(
17421742
self,
17431743
*,
17441744
limit: Optional[int] = None,
@@ -1749,14 +1749,14 @@ def list_text_to_cad_models_for_user(
17491749
) -> "AsyncPageIterator":
17501750
"""This will always return the STEP file contents as well as the format the user originally requested.
17511751
1752-
This endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.
1752+
This endpoint requires authentication by any Zoo user. It returns the text-to-CAD parts for the authenticated user.
17531753
1754-
The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.
1754+
The text-to-CAD parts are returned in order of creation, with the most recently created text-to-CAD parts first.
17551755
17561756
Returns an async iterator that automatically handles pagination.
17571757
Iterate over all items across all pages:
17581758
1759-
async for item in client.user.list_text_to_cad_models_for_user():
1759+
async for item in client.user.list_text_to_cad_parts_for_user():
17601760
print(item)
17611761
"""
17621762

@@ -1785,15 +1785,15 @@ def list_text_to_cad_models_for_user(
17851785
kwargs["no_models"] = no_models
17861786

17871787
async def fetch_page(**kw):
1788-
return await self._fetch_page_list_text_to_cad_models_for_user(**kw)
1788+
return await self._fetch_page_list_text_to_cad_parts_for_user(**kw)
17891789

17901790
# Create the async page iterator
17911791
return AsyncPageIterator(
17921792
page_fetcher=fetch_page,
17931793
initial_kwargs=kwargs,
17941794
)
17951795

1796-
async def _fetch_page_list_text_to_cad_models_for_user(
1796+
async def _fetch_page_list_text_to_cad_parts_for_user(
17971797
self, **kwargs
17981798
) -> TextToCadResponseResultsPage:
17991799
"""Internal async method to fetch a single page."""
@@ -1852,7 +1852,7 @@ async def _fetch_page_list_text_to_cad_models_for_user(
18521852
# Validate into a Pydantic model (supports BaseModel/RootModel)
18531853
return TextToCadResponseResultsPage.model_validate(json_data)
18541854

1855-
async def get_text_to_cad_model_for_user(
1855+
async def get_text_to_cad_parts_for_user(
18561856
self,
18571857
id: str,
18581858
) -> TextToCadResponse:
@@ -1880,7 +1880,7 @@ async def get_text_to_cad_model_for_user(
18801880
# Validate into a Pydantic model (works for BaseModel and RootModel)
18811881
return TextToCadResponse.model_validate(json_data)
18821882

1883-
async def create_text_to_cad_model_feedback(
1883+
async def create_text_to_cad_part_feedback(
18841884
self,
18851885
id: str,
18861886
feedback: MlFeedback,

kittycad/models/text_to_cad_create_body.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class TextToCadCreateBody(KittyCadBaseModel):
7-
"""Body for generating models from text."""
7+
"""Body for generating parts from text."""
88

99
kcl_version: Optional[str] = None
1010

kittycad/models/text_to_cad_iteration_body.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class TextToCadIterationBody(KittyCadBaseModel):
8-
"""Body for generating models from text."""
8+
"""Body for generating parts from text."""
99

1010
kcl_version: Optional[str] = None
1111

kittycad/tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ def test_text_to_cad():
933933
while (
934934
body.status == ApiCallStatus.IN_PROGRESS or body.status == ApiCallStatus.QUEUED
935935
) and time.time() - start_time < 120:
936-
result_status = client.ml.get_text_to_cad_model_for_user(
936+
result_status = client.ml.get_text_to_cad_parts_for_user(
937937
id=body.id,
938938
)
939939

kittycad/tests/test_examples.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,12 +3265,12 @@ async def test_update_user_shortlink_async():
32653265

32663266

32673267
@pytest.mark.skip
3268-
def test_list_text_to_cad_models_for_user():
3268+
def test_list_text_to_cad_parts_for_user():
32693269
client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable
32703270

32713271
# Iterate through all pages automatically
32723272
item: TextToCadResponse
3273-
for item in client.ml.list_text_to_cad_models_for_user(
3273+
for item in client.ml.list_text_to_cad_parts_for_user(
32743274
sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,
32753275
conversation_id=Uuid("<string>"),
32763276
limit=None,
@@ -3283,11 +3283,11 @@ def test_list_text_to_cad_models_for_user():
32833283
# OR run async
32843284
@pytest.mark.asyncio
32853285
@pytest.mark.skip
3286-
async def test_list_text_to_cad_models_for_user_async():
3286+
async def test_list_text_to_cad_parts_for_user_async():
32873287
client = AsyncKittyCAD() # Uses KITTYCAD_API_TOKEN environment variable
32883288

32893289
# Iterate through all pages automatically
3290-
iterator = client.ml.list_text_to_cad_models_for_user(
3290+
iterator = client.ml.list_text_to_cad_parts_for_user(
32913291
sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,
32923292
conversation_id=Uuid("<string>"),
32933293
limit=None,
@@ -3300,10 +3300,10 @@ async def test_list_text_to_cad_models_for_user_async():
33003300

33013301

33023302
@pytest.mark.skip
3303-
def test_get_text_to_cad_model_for_user():
3303+
def test_get_text_to_cad_parts_for_user():
33043304
client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable
33053305

3306-
result: TextToCadResponse = client.ml.get_text_to_cad_model_for_user(id="<string>")
3306+
result: TextToCadResponse = client.ml.get_text_to_cad_parts_for_user(id="<string>")
33073307

33083308
body: TextToCadResponse = result
33093309
print(body)
@@ -3312,30 +3312,30 @@ def test_get_text_to_cad_model_for_user():
33123312
# OR run async
33133313
@pytest.mark.asyncio
33143314
@pytest.mark.skip
3315-
async def test_get_text_to_cad_model_for_user_async():
3315+
async def test_get_text_to_cad_parts_for_user_async():
33163316
client = AsyncKittyCAD() # Uses KITTYCAD_API_TOKEN environment variable
33173317

3318-
result: TextToCadResponse = await client.ml.get_text_to_cad_model_for_user(
3318+
result: TextToCadResponse = await client.ml.get_text_to_cad_parts_for_user(
33193319
id="<string>"
33203320
)
33213321

33223322

33233323
@pytest.mark.skip
3324-
def test_create_text_to_cad_model_feedback():
3324+
def test_create_text_to_cad_part_feedback():
33253325
client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable
33263326

3327-
client.ml.create_text_to_cad_model_feedback(
3327+
client.ml.create_text_to_cad_part_feedback(
33283328
id="<string>", feedback=MlFeedback.THUMBS_UP
33293329
)
33303330

33313331

33323332
# OR run async
33333333
@pytest.mark.asyncio
33343334
@pytest.mark.skip
3335-
async def test_create_text_to_cad_model_feedback_async():
3335+
async def test_create_text_to_cad_part_feedback_async():
33363336
client = AsyncKittyCAD() # Uses KITTYCAD_API_TOKEN environment variable
33373337

3338-
await client.ml.create_text_to_cad_model_feedback(
3338+
await client.ml.create_text_to_cad_part_feedback(
33393339
id="<string>", feedback=MlFeedback.THUMBS_UP
33403340
)
33413341

kittycad/tests/test_pagination.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ def test_sync_pagination_integration_text_to_cad():
761761
client = KittyCAD()
762762

763763
# Call paginated endpoint - now returns SyncPageIterator
764-
iterator = client.ml.list_text_to_cad_models_for_user( # type: ignore[attr-defined]
764+
iterator = client.ml.list_text_to_cad_parts_for_user( # type: ignore[attr-defined]
765765
limit=10, # Small page size to test pagination
766766
)
767767

@@ -830,7 +830,7 @@ async def test_async_pagination_integration_text_to_cad():
830830
client = AsyncKittyCAD()
831831

832832
# Call paginated endpoint - now returns AsyncPageIterator directly
833-
iterator = client.ml.list_text_to_cad_models_for_user( # type: ignore[attr-defined]
833+
iterator = client.ml.list_text_to_cad_parts_for_user( # type: ignore[attr-defined]
834834
limit=10, # Small page size to test pagination
835835
)
836836

@@ -926,7 +926,7 @@ def mock_http_request(url, **kwargs):
926926
# Get the iterator first with specific parameters
927927
from kittycad.models.created_at_sort_mode import CreatedAtSortMode
928928

929-
iterator = client.ml.list_text_to_cad_models_for_user(
929+
iterator = client.ml.list_text_to_cad_parts_for_user(
930930
limit=5, sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING
931931
)
932932
assert isinstance(iterator, SyncPageIterator)
@@ -1014,7 +1014,7 @@ def mock_http_request(url, **kwargs):
10141014
return mock_response
10151015

10161016
# Get the iterator with an explicit page_token (user wants to start from specific page)
1017-
iterator = client.ml.list_text_to_cad_models_for_user(
1017+
iterator = client.ml.list_text_to_cad_parts_for_user(
10181018
limit=5, page_token="explicit_start_token"
10191019
)
10201020
assert isinstance(iterator, SyncPageIterator)

0 commit comments

Comments
 (0)