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:
committed by
GitHub
parent
7153c7ab17
commit
d25fc283e9
File diff suppressed because it is too large
Load Diff
126
kittycad/api/meta/community_sso.py
Normal file
126
kittycad/api/meta/community_sso.py
Normal 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
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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
7
kittycad/models/sweep.py
Normal file
@ -0,0 +1,7 @@
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
class Sweep(BaseModel):
|
||||
"""The response from the `Sweep` endpoint."""
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
181
spec.json
181
spec.json
@ -1605,6 +1605,89 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/community/sso": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"meta",
|
||||
"hidden"
|
||||
],
|
||||
"summary": "Authorize an inbound auth request from our Community page.",
|
||||
"operationId": "community_sso",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "query",
|
||||
"name": "sig",
|
||||
"description": "The signature for the given payload",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "sso",
|
||||
"description": "The nonce and redirect URL sent to us by Discourse",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"302": {
|
||||
"description": "Temporary Redirect",
|
||||
"headers": {
|
||||
"Access-Control-Allow-Credentials": {
|
||||
"description": "Access-Control-Allow-Credentials header.",
|
||||
"style": "simple",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"Access-Control-Allow-Headers": {
|
||||
"description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.",
|
||||
"style": "simple",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"Access-Control-Allow-Methods": {
|
||||
"description": "Access-Control-Allow-Methods header.",
|
||||
"style": "simple",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"Access-Control-Allow-Origin": {
|
||||
"description": "Access-Control-Allow-Origin header.",
|
||||
"style": "simple",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"X-Api-Call-Id": {
|
||||
"description": "ID for this request. We return it so that users can report this to us and help us debug their problems.",
|
||||
"style": "simple",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"4XX": {
|
||||
"$ref": "#/components/responses/Error"
|
||||
},
|
||||
"5XX": {
|
||||
"$ref": "#/components/responses/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/debug/uploads": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@ -16610,12 +16693,19 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Camera rotate (revolve/orbit)",
|
||||
"description": "Camera rotate (spherical camera revolve/orbit)",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"rotate"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Camera rotate (trackball with 3 degrees of freedom)",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"rotatetrackball"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Camera zoom (increase or decrease distance to reference point center)",
|
||||
"type": "string",
|
||||
@ -18671,6 +18761,13 @@
|
||||
"enum": [
|
||||
"bottom"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Capped on both ends.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"both"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -21552,6 +21649,53 @@
|
||||
"type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Extrude the object along a path.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"sectional": {
|
||||
"description": "If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"target": {
|
||||
"description": "Which sketch to sweep. Must be a closed 2D solid.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ModelingCmdId"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tolerance": {
|
||||
"description": "The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/LengthUnit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"trajectory": {
|
||||
"description": "Path along which to sweep.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ModelingCmdId"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"sweep"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"sectional",
|
||||
"target",
|
||||
"tolerance",
|
||||
"trajectory",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Command for revolving a solid 2d.",
|
||||
"type": "object",
|
||||
@ -22232,11 +22376,23 @@
|
||||
},
|
||||
"transform": {
|
||||
"description": "How to transform each repeated solid. The 0th transform will create the first copy of the entity. The total number of (optional) repetitions equals the size of this list.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Transform"
|
||||
}
|
||||
},
|
||||
"transforms": {
|
||||
"description": "Alternatively, you could set this key instead. If you want to use multiple transforms per item. If this is non-empty then the `transform` key must be empty, and vice-versa.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Transform"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@ -22246,7 +22402,6 @@
|
||||
},
|
||||
"required": [
|
||||
"entity_id",
|
||||
"transform",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
@ -24923,6 +25078,24 @@
|
||||
"type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/components/schemas/Sweep"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"sweep"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"data",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -29637,6 +29810,10 @@
|
||||
"surface_area"
|
||||
]
|
||||
},
|
||||
"Sweep": {
|
||||
"description": "The response from the `Sweep` endpoint.",
|
||||
"type": "object"
|
||||
},
|
||||
"System": {
|
||||
"description": "Co-ordinate system definition.\n\nThe `up` axis must be orthogonal to the `forward` axis.\n\nSee [cglearn.eu] for background reading.\n\n[cglearn.eu](https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1)",
|
||||
"type": "object",
|
||||
|
Reference in New Issue
Block a user