Update api spec (#458)

* 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]
2025-07-04 14:13:27 +02:00
committed by GitHub
parent b922adf749
commit bb2718fb25
6 changed files with 1246 additions and 916 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,107 @@
from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.auth_api_key_response import AuthApiKeyResponse
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/auth/api-key".format(
client.base_url,
) # 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(),
}
def _parse_response(
*, response: httpx.Response
) -> Optional[Union[AuthApiKeyResponse, Error]]:
if response.status_code == 200:
response_200 = AuthApiKeyResponse(**response.json())
return response_200
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[Union[AuthApiKeyResponse, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Optional[Union[AuthApiKeyResponse, Error]]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[AuthApiKeyResponse, Error]]:
"""This returns a session token.""" # noqa: E501
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Optional[Union[AuthApiKeyResponse, Error]]]:
kwargs = _get_kwargs(
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(
*,
client: Client,
) -> Optional[Union[AuthApiKeyResponse, Error]]:
"""This returns a session token.""" # noqa: E501
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -37,6 +37,7 @@ from kittycad.api.file import (
create_file_volume, create_file_volume,
) )
from kittycad.api.hidden import ( from kittycad.api.hidden import (
auth_api_key,
auth_email, auth_email,
auth_email_callback, auth_email_callback,
get_auth_saml, get_auth_saml,
@ -176,6 +177,7 @@ from kittycad.models import (
ApiTokenResultsPage, ApiTokenResultsPage,
AppClientInfo, AppClientInfo,
AsyncApiCallResultsPage, AsyncApiCallResultsPage,
AuthApiKeyResponse,
CodeOutput, CodeOutput,
CreateShortlinkResponse, CreateShortlinkResponse,
Customer, Customer,
@ -907,6 +909,49 @@ async def test_get_async_operation_async():
) )
@pytest.mark.skip
def test_auth_api_key():
# Create our client.
client = ClientFromEnv()
result: Optional[Union[AuthApiKeyResponse, Error]] = auth_api_key.sync(
client=client,
)
if isinstance(result, Error) or result is None:
print(result)
raise Exception("Error in response")
body: AuthApiKeyResponse = result
print(body)
# OR if you need more info (e.g. status_code)
response: Response[Optional[Union[AuthApiKeyResponse, Error]]] = (
auth_api_key.sync_detailed(
client=client,
)
)
# OR run async
@pytest.mark.asyncio
@pytest.mark.skip
async def test_auth_api_key_async():
# Create our client.
client = ClientFromEnv()
result: Optional[Union[AuthApiKeyResponse, Error]] = await auth_api_key.asyncio(
client=client,
)
# OR run async with more info
response: Response[
Optional[Union[AuthApiKeyResponse, Error]]
] = await auth_api_key.asyncio_detailed(
client=client,
)
@pytest.mark.skip @pytest.mark.skip
def test_auth_email(): def test_auth_email():
# Create our client. # Create our client.

View File

@ -28,6 +28,7 @@ from .async_api_call import AsyncApiCall
from .async_api_call_output import AsyncApiCallOutput from .async_api_call_output import AsyncApiCallOutput
from .async_api_call_results_page import AsyncApiCallResultsPage from .async_api_call_results_page import AsyncApiCallResultsPage
from .async_api_call_type import AsyncApiCallType from .async_api_call_type import AsyncApiCallType
from .auth_api_key_response import AuthApiKeyResponse
from .auth_callback import AuthCallback from .auth_callback import AuthCallback
from .axis import Axis from .axis import Axis
from .axis_direction_pair import AxisDirectionPair from .axis_direction_pair import AxisDirectionPair

View File

@ -0,0 +1,9 @@
from pydantic import BaseModel, ConfigDict
class AuthApiKeyResponse(BaseModel):
"""The response from the `/auth/api-key` endpoint."""
session_token: str
model_config = ConfigDict(protected_namespaces=())

160
spec.json
View File

@ -1167,6 +1167,153 @@
} }
} }
}, },
"/auth/api-key": {
"post": {
"tags": [
"hidden"
],
"summary": "Authenticate using an api-key. This is disabled on production but can be used in dev to login without email magic.",
"description": "This returns a session token.",
"operationId": "auth_api_key",
"responses": {
"200": {
"description": "successful operation",
"headers": {
"Access-Control-Allow-Credentials": {
"description": "Access-Control-Allow-Credentials header.",
"style": "simple",
"schema": {
"nullable": true,
"type": "string"
}
},
"Access-Control-Allow-Headers": {
"description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.",
"style": "simple",
"schema": {
"nullable": true,
"type": "string"
}
},
"Access-Control-Allow-Methods": {
"description": "Access-Control-Allow-Methods header.",
"style": "simple",
"schema": {
"nullable": true,
"type": "string"
}
},
"Access-Control-Allow-Origin": {
"description": "Access-Control-Allow-Origin header.",
"style": "simple",
"schema": {
"nullable": true,
"type": "string"
}
},
"Set-Cookie": {
"description": "Set-Cookie header.",
"style": "simple",
"schema": {
"nullable": true,
"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"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AuthApiKeyResponse"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
},
"options": {
"tags": [
"hidden"
],
"summary": "OPTIONS endpoint.",
"description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.",
"operationId": "options_auth_api_key",
"responses": {
"204": {
"description": "resource updated",
"headers": {
"Access-Control-Allow-Credentials": {
"description": "Access-Control-Allow-Credentials header.",
"style": "simple",
"schema": {
"nullable": true,
"type": "string"
}
},
"Access-Control-Allow-Headers": {
"description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.",
"style": "simple",
"schema": {
"nullable": true,
"type": "string"
}
},
"Access-Control-Allow-Methods": {
"description": "Access-Control-Allow-Methods header.",
"style": "simple",
"schema": {
"nullable": true,
"type": "string"
}
},
"Access-Control-Allow-Origin": {
"description": "Access-Control-Allow-Origin header.",
"style": "simple",
"schema": {
"nullable": true,
"type": "string"
}
},
"Set-Cookie": {
"description": "Set-Cookie header.",
"style": "simple",
"schema": {
"nullable": true,
"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"
}
}
}
},
"/auth/email": { "/auth/email": {
"post": { "post": {
"tags": [ "tags": [
@ -19367,6 +19514,19 @@
} }
] ]
}, },
"AuthApiKeyResponse": {
"description": "The response from the `/auth/api-key` endpoint.",
"type": "object",
"properties": {
"session_token": {
"description": "The session token",
"type": "string"
}
},
"required": [
"session_token"
]
},
"AuthCallback": { "AuthCallback": {
"description": "The authentication callback from the OAuth 2.0 client. This is typically posted to the redirect URL as query params after authenticating.", "description": "The authentication callback from the OAuth 2.0 client. This is typically posted to the redirect URL as query params after authenticating.",
"type": "object", "type": "object",