Skip to content

Commit b70dd57

Browse files
zoo-github-actions-auth[bot]github-actions[bot]jessfraz
authored
Update api spec (#451)
* YOYO NEW API SPEC! * updates Signed-off-by: Jessie Frazelle <[email protected]> * I have generated the latest API! --------- Signed-off-by: Jessie Frazelle <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jessie Frazelle <[email protected]>
1 parent a0e3d35 commit b70dd57

23 files changed

+1364
-856
lines changed

generate/generate.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ def generateTypeAndExamplePython(
389389
logging.error("schema: %s", json.dumps(schema, indent=4))
390390
raise Exception("Unknown parameter type")
391391
elif "oneOf" in schema and len(schema["oneOf"]) > 0:
392-
one_of = schema["oneOf"][0]
393-
if len(schema["oneOf"]) > 1:
394-
one_of = schema["oneOf"][1]
392+
# Choose a random one.
393+
index = random.randint(0, len(schema["oneOf"]) - 1)
394+
one_of = schema["oneOf"][index]
395395

396396
# Check if this is a nested object.
397397
if isNestedObjectOneOf(schema):
@@ -2377,7 +2377,8 @@ def getTypeName(schema: dict) -> str:
23772377
def randletter() -> str:
23782378
letter1 = chr(random.randint(ord("A"), ord("Z")))
23792379
letter2 = chr(random.randint(ord("A"), ord("Z")))
2380-
letter = letter1 + letter2
2380+
letter3 = chr(random.randint(ord("A"), ord("Z")))
2381+
letter = letter1 + letter2 + letter3
23812382
while letter in letters:
23822383
return randletter()
23832384
letters.append(letter)

kittycad.py.patch.json

Lines changed: 417 additions & 417 deletions
Large diffs are not rendered by default.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
from typing import Any, Dict, Optional, Union
2+
3+
import httpx
4+
5+
from ...client import Client
6+
from ...models.conversion_params import ConversionParams
7+
from ...models.error import Error
8+
from ...models.file_conversion import FileConversion
9+
from ...types import Response
10+
11+
12+
def _get_kwargs(
13+
body: ConversionParams,
14+
*,
15+
client: Client,
16+
) -> Dict[str, Any]:
17+
url = "{}/file/conversion".format(
18+
client.base_url,
19+
) # noqa: E501
20+
21+
headers: Dict[str, Any] = client.get_headers()
22+
cookies: Dict[str, Any] = client.get_cookies()
23+
24+
return {
25+
"url": url,
26+
"headers": headers,
27+
"cookies": cookies,
28+
"timeout": client.get_timeout(),
29+
"content": body.model_dump_json(),
30+
}
31+
32+
33+
def _parse_response(
34+
*, response: httpx.Response
35+
) -> Optional[Union[FileConversion, Error]]:
36+
if response.status_code == 201:
37+
response_201 = FileConversion(**response.json())
38+
return response_201
39+
if response.status_code == 400:
40+
response_4XX = Error(**response.json())
41+
return response_4XX
42+
if response.status_code == 500:
43+
response_5XX = Error(**response.json())
44+
return response_5XX
45+
return Error(**response.json())
46+
47+
48+
def _build_response(
49+
*, response: httpx.Response
50+
) -> Response[Optional[Union[FileConversion, Error]]]:
51+
return Response(
52+
status_code=response.status_code,
53+
content=response.content,
54+
headers=response.headers,
55+
parsed=_parse_response(response=response),
56+
)
57+
58+
59+
def sync_detailed(
60+
body: ConversionParams,
61+
*,
62+
client: Client,
63+
) -> Response[Optional[Union[FileConversion, Error]]]:
64+
kwargs = _get_kwargs(
65+
body=body,
66+
client=client,
67+
)
68+
69+
response = httpx.post(
70+
verify=client.verify_ssl,
71+
**kwargs,
72+
)
73+
74+
return _build_response(response=response)
75+
76+
77+
def sync(
78+
body: ConversionParams,
79+
*,
80+
client: Client,
81+
) -> Optional[Union[FileConversion, Error]]:
82+
"""This takes a HTTP multipart body with these fields in any order:
83+
84+
- The input and output format options (as JSON), name is 'body'. - The files to convert, in raw binary. Must supply filenames.
85+
86+
This starts a conversion job and returns the `id` of the operation. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.""" # noqa: E501
87+
88+
return sync_detailed(
89+
body=body,
90+
client=client,
91+
).parsed
92+
93+
94+
async def asyncio_detailed(
95+
body: ConversionParams,
96+
*,
97+
client: Client,
98+
) -> Response[Optional[Union[FileConversion, Error]]]:
99+
kwargs = _get_kwargs(
100+
body=body,
101+
client=client,
102+
)
103+
104+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
105+
response = await _client.post(**kwargs)
106+
107+
return _build_response(response=response)
108+
109+
110+
async def asyncio(
111+
body: ConversionParams,
112+
*,
113+
client: Client,
114+
) -> Optional[Union[FileConversion, Error]]:
115+
"""This takes a HTTP multipart body with these fields in any order:
116+
117+
- The input and output format options (as JSON), name is 'body'. - The files to convert, in raw binary. Must supply filenames.
118+
119+
This starts a conversion job and returns the `id` of the operation. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.""" # noqa: E501
120+
121+
return (
122+
await asyncio_detailed(
123+
body=body,
124+
client=client,
125+
)
126+
).parsed

kittycad/api/users/get_user_onboarding_self.py

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)