Update api spec (#337)

* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
zoo-github-actions-auth[bot]
2024-12-11 13:14:58 -08:00
committed by GitHub
parent 7153c7ab17
commit d25fc283e9
10 changed files with 1207 additions and 805 deletions

View File

@ -0,0 +1,126 @@
from typing import Any, Dict, Optional
import httpx
from ...client import Client
from ...models.error import Error
from ...types import Response
def _get_kwargs(
sig: str,
sso: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/community/sso".format(
client.base_url,
) # noqa: E501
if sig is not None:
if "?" in url:
url = url + "&sig=" + str(sig)
else:
url = url + "?sig=" + str(sig)
if sso is not None:
if "?" in url:
url = url + "&sso=" + str(sso)
else:
url = url + "?sso=" + str(sso)
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(**response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error(**response.json())
return response_5XX
return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
sig: str,
sso: str,
*,
client: Client,
) -> Response[Optional[Error]]:
kwargs = _get_kwargs(
sig=sig,
sso=sso,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
sig: str,
sso: str,
*,
client: Client,
) -> Optional[Error]:
return sync_detailed(
sig=sig,
sso=sso,
client=client,
).parsed
async def asyncio_detailed(
sig: str,
sso: str,
*,
client: Client,
) -> Response[Optional[Error]]:
kwargs = _get_kwargs(
sig=sig,
sso=sso,
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(
sig: str,
sso: str,
*,
client: Client,
) -> Optional[Error]:
return (
await asyncio_detailed(
sig=sig,
sso=sso,
client=client,
)
).parsed

View File

@ -44,6 +44,7 @@ from kittycad.api.hidden import (
redirect_user_shortlink,
)
from kittycad.api.meta import (
community_sso,
create_debug_uploads,
create_event,
get_ipinfo,
@ -1126,6 +1127,53 @@ async def test_post_auth_saml_async():
)
@pytest.mark.skip
def test_community_sso():
# Create our client.
client = ClientFromEnv()
result: Optional[Error] = community_sso.sync(
client=client,
sig="<string>",
sso="<string>",
)
if isinstance(result, Error) or result is None:
print(result)
raise Exception("Error in response")
body: Error = result
print(body)
# OR if you need more info (e.g. status_code)
response: Response[Optional[Error]] = community_sso.sync_detailed(
client=client,
sig="<string>",
sso="<string>",
)
# OR run async
@pytest.mark.asyncio
@pytest.mark.skip
async def test_community_sso_async():
# Create our client.
client = ClientFromEnv()
result: Optional[Error] = await community_sso.asyncio(
client=client,
sig="<string>",
sso="<string>",
)
# OR run async with more info
response: Response[Optional[Error]] = await community_sso.asyncio_detailed(
client=client,
sig="<string>",
sso="<string>",
)
@pytest.mark.skip
def test_create_debug_uploads():
# Create our client.

View File

@ -295,6 +295,7 @@ from .subscription_training_data_behavior import SubscriptionTrainingDataBehavio
from .success_web_socket_response import SuccessWebSocketResponse
from .support_tier import SupportTier
from .surface_area import SurfaceArea
from .sweep import Sweep
from .system import System
from .take_snapshot import TakeSnapshot
from .text_to_cad import TextToCad

View File

@ -6,8 +6,10 @@ class CameraDragInteractionType(str, Enum):
"""# Camera pan """ # noqa: E501
PAN = "pan"
"""# Camera rotate (revolve/orbit) """ # noqa: E501
"""# Camera rotate (spherical camera revolve/orbit) """ # noqa: E501
ROTATE = "rotate"
"""# Camera rotate (trackball with 3 degrees of freedom) """ # noqa: E501
ROTATETRACKBALL = "rotatetrackball"
"""# Camera zoom (increase or decrease distance to reference point center) """ # noqa: E501
ZOOM = "zoom"

View File

@ -10,6 +10,8 @@ class ExtrusionFaceCapType(str, Enum):
TOP = "top"
"""# Capped below. """ # noqa: E501
BOTTOM = "bottom"
"""# Capped on both ends. """ # noqa: E501
BOTH = "both"
def __str__(self) -> str:
return str(self.value)

View File

@ -90,6 +90,22 @@ class OptionExtrude(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class OptionSweep(BaseModel):
"""Extrude the object along a path."""
sectional: bool
target: ModelingCmdId
tolerance: LengthUnit
trajectory: ModelingCmdId
type: Literal["sweep"] = "sweep"
model_config = ConfigDict(protected_namespaces=())
class OptionRevolve(BaseModel):
"""Command for revolving a solid 2d."""
@ -349,7 +365,9 @@ class OptionEntityLinearPatternTransform(BaseModel):
entity_id: str
transform: List[Transform]
transform: List[Transform] = []
transforms: List[List[Transform]] = []
type: Literal["entity_linear_pattern_transform"] = "entity_linear_pattern_transform"
@ -1366,6 +1384,7 @@ ModelingCmd = RootModel[
OptionMovePathPen,
OptionExtendPath,
OptionExtrude,
OptionSweep,
OptionRevolve,
OptionSolid3DShellFace,
OptionRevolveAboutEdge,

View File

@ -113,6 +113,7 @@ from ..models.solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
from ..models.solid3d_shell_face import Solid3dShellFace
from ..models.start_path import StartPath
from ..models.surface_area import SurfaceArea
from ..models.sweep import Sweep
from ..models.take_snapshot import TakeSnapshot
from ..models.update_annotation import UpdateAnnotation
from ..models.view_isometric import ViewIsometric
@ -178,6 +179,16 @@ class OptionExtrude(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class OptionSweep(BaseModel):
""""""
data: Sweep
type: Literal["sweep"] = "sweep"
model_config = ConfigDict(protected_namespaces=())
class OptionRevolve(BaseModel):
""""""
@ -1273,6 +1284,7 @@ OkModelingCmdResponse = RootModel[
OptionMovePathPen,
OptionExtendPath,
OptionExtrude,
OptionSweep,
OptionRevolve,
OptionSolid3DShellFace,
OptionRevolveAboutEdge,

7
kittycad/models/sweep.py Normal file
View File

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