Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
62e481fb1e | |||
ff4bff38dd | |||
f417993c85 | |||
8bebb40c9f | |||
ec68e67645 | |||
95894ba00f | |||
ad19153225 | |||
8d476bbec6 | |||
b233f94a24 | |||
6351fb1bbc | |||
0e11945f1d | |||
d3d454a2d7 | |||
b150024bff | |||
0ad6216cde | |||
8925458665 | |||
25f8effd19 | |||
9c6c504ae5 |
2
.github/workflows/black.yml
vendored
2
.github/workflows/black.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
|
||||
# Installation instructions are from: https://python-poetry.org/docs/
|
||||
- name: Install dependencies
|
||||
|
2
.github/workflows/build-test.yml
vendored
2
.github/workflows/build-test.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
|
2
.github/workflows/generate-docs.yml
vendored
2
.github/workflows/generate-docs.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
|
2
.github/workflows/make-release.yml
vendored
2
.github/workflows/make-release.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
# Installation instructions are from: https://python-poetry.org/docs/
|
||||
|
2
.github/workflows/mypy.yml
vendored
2
.github/workflows/mypy.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
|
||||
# Installation instructions are from: https://python-poetry.org/docs/
|
||||
- name: Install dependencies
|
||||
|
2
.github/workflows/ruff.yml
vendored
2
.github/workflows/ruff.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
|
||||
# Installation instructions are from: https://python-poetry.org/docs/
|
||||
- name: Install dependencies
|
||||
|
11
.github/workflows/update-spec-for-docs.yml
vendored
11
.github/workflows/update-spec-for-docs.yml
vendored
@ -15,6 +15,13 @@ jobs:
|
||||
name: update-spec
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
# required
|
||||
app-id: ${{ secrets.GH_ORG_APP_ID }}
|
||||
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
- uses: actions/checkout@v4
|
||||
- name: make generate
|
||||
shell: bash
|
||||
@ -38,7 +45,7 @@ jobs:
|
||||
with:
|
||||
repository: 'kittycad/website'
|
||||
path: 'docs'
|
||||
token: ${{secrets.PAT_GITHUB}}
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
- name: move spec to docs
|
||||
shell: bash
|
||||
run: |
|
||||
@ -62,6 +69,6 @@ jobs:
|
||||
--head "$NEW_BRANCH" \
|
||||
--base main || true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.PAT_GITHUB}}
|
||||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
|
||||
|
@ -1,18 +1,16 @@
|
||||

|
||||
|
||||
# kittycad.py
|
||||
|
||||
The Python API client for KittyCAD.
|
||||
|
||||
- [PyPI](https://pypi.org/project/kittycad/)
|
||||
- [Python docs](https://python.api.docs.kittycad.io/)
|
||||
- [KittyCAD API Docs](https://docs.kittycad.io/?lang=python)
|
||||
- [Python docs](https://python.api.docs.zoo.dev/)
|
||||
- [KittyCAD API Docs](https://zoo.dev/docs/api?lang=python)
|
||||
|
||||
## Generating
|
||||
|
||||
You can trigger a build with the GitHub action to generate the client. This will
|
||||
automatically update the client to the latest version based on the spec hosted
|
||||
at [api.kittycad.io](https://api.kittycad.io/).
|
||||
at [api.zoo.dev](https://api.zoo.dev/).
|
||||
|
||||
Alternatively, if you wish to generate the client locally, make sure you have
|
||||
[Docker installed](https://docs.docker.com/get-docker/) and run:
|
||||
|
@ -51,7 +51,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
{% if has_request_body %}"content": body,{% endif %}
|
||||
{% if has_request_body %}{% if request_body_type != "bytes" %}"content": body.model_dump_json(),{% else %}"content": body,{% endif %}{% endif %}
|
||||
}
|
||||
|
||||
|
||||
|
@ -705,6 +705,7 @@ async def test_"""
|
||||
"docs": str,
|
||||
"parse_response": str,
|
||||
"has_request_body": bool,
|
||||
"request_body_type": str,
|
||||
},
|
||||
)
|
||||
template_info: TemplateType = {
|
||||
@ -716,6 +717,7 @@ async def test_"""
|
||||
"docs": "",
|
||||
"parse_response": "",
|
||||
"has_request_body": False,
|
||||
"request_body_type": "",
|
||||
}
|
||||
|
||||
if len(endpoint_refs) == 0:
|
||||
@ -954,6 +956,7 @@ async def test_"""
|
||||
}
|
||||
)
|
||||
template_info["has_request_body"] = True
|
||||
template_info["request_body_type"] = request_body_type
|
||||
|
||||
# Generate the template for the functions.
|
||||
environment = jinja2.Environment(loader=jinja2.FileSystemLoader("generate/"))
|
||||
|
@ -2,7 +2,7 @@ import datetime
|
||||
from typing import List, Optional, Dict, Union, Any, Literal
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Base64Bytes, AnyUrl
|
||||
from pydantic import BaseModel, Base64Bytes, AnyUrl, ConfigDict
|
||||
from pydantic_extra_types.phone_numbers import PhoneNumber
|
||||
from .base64data import Base64Data
|
||||
|
||||
@ -19,3 +19,7 @@ class {{ name }}(BaseModel):
|
||||
{{ field.name }}: {{ field.type }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
model_config = ConfigDict(
|
||||
protected_namespaces=()
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
""" Contains methods for accessing the ai API paths: AI uses machine learning to generate 3D meshes. """ # noqa: E501
|
||||
""" Contains methods for accessing the ai API paths: AI uses machine learning to generate CAD models. """ # noqa: E501
|
||||
|
@ -29,7 +29,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,6 +15,7 @@ def _get_kwargs(
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
no_models: Optional[bool] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/text-to-cad".format(
|
||||
client.base_url,
|
||||
@ -38,6 +39,12 @@ def _get_kwargs(
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
if no_models is not None:
|
||||
if "?" in url:
|
||||
url = url + "&no_models=" + str(no_models)
|
||||
else:
|
||||
url = url + "?no_models=" + str(no_models)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
@ -81,11 +88,13 @@ def sync_detailed(
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
no_models: Optional[bool] = None,
|
||||
) -> Response[Optional[Union[TextToCadResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
no_models=no_models,
|
||||
client=client,
|
||||
)
|
||||
|
||||
@ -103,6 +112,7 @@ def sync(
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
no_models: Optional[bool] = None,
|
||||
) -> Optional[Union[TextToCadResultsPage, Error]]:
|
||||
"""This will always return the STEP file contents as well as the format the user originally requested.
|
||||
This endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.
|
||||
@ -113,6 +123,7 @@ def sync(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
no_models=no_models,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
@ -123,11 +134,13 @@ async def asyncio_detailed(
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
no_models: Optional[bool] = None,
|
||||
) -> Response[Optional[Union[TextToCadResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
no_models=no_models,
|
||||
client=client,
|
||||
)
|
||||
|
||||
@ -143,6 +156,7 @@ async def asyncio(
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
no_models: Optional[bool] = None,
|
||||
) -> Optional[Union[TextToCadResultsPage, Error]]:
|
||||
"""This will always return the STEP file contents as well as the format the user originally requested.
|
||||
This endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.
|
||||
@ -154,6 +168,7 @@ async def asyncio(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
no_models=no_models,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
117
kittycad/api/api_calls/get_api_call_for_org.py
Normal file
117
kittycad/api/api_calls/get_api_call_for_org.py
Normal file
@ -0,0 +1,117 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.api_call_with_price import ApiCallWithPrice
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/api-calls/{id}".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # 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[ApiCallWithPrice, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ApiCallWithPrice(**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[ApiCallWithPrice, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ApiCallWithPrice, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ApiCallWithPrice, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It returns details of the requested API call for the user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ApiCallWithPrice, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
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(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ApiCallWithPrice, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It returns details of the requested API call for the user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
159
kittycad/api/api_calls/org_list_api_calls.py
Normal file
159
kittycad/api/api_calls/org_list_api_calls.py
Normal file
@ -0,0 +1,159 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.api_call_with_price_results_page import ApiCallWithPriceResultsPage
|
||||
from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/api-calls".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
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[ApiCallWithPriceResultsPage, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ApiCallWithPriceResultsPage(**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[ApiCallWithPriceResultsPage, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[ApiCallWithPriceResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[ApiCallWithPriceResultsPage, Error]]:
|
||||
"""This includes all API calls that were made by users in the org.
|
||||
This endpoint requires authentication by an org admin. It returns the API calls for the authenticated user's org.
|
||||
The API calls are returned in order of creation, with the most recently created API calls first.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[ApiCallWithPriceResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
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(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[ApiCallWithPriceResultsPage, Error]]:
|
||||
"""This includes all API calls that were made by users in the org.
|
||||
This endpoint requires authentication by an org admin. It returns the API calls for the authenticated user's org.
|
||||
The API calls are returned in order of creation, with the most recently created API calls first.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -11,11 +11,18 @@ from ...types import Response
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/api-tokens".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
if label is not None:
|
||||
if "?" in url:
|
||||
url = url + "&label=" + str(label)
|
||||
else:
|
||||
url = url + "?label=" + str(label)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
@ -54,8 +61,10 @@ def _build_response(
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Response[Optional[Union[ApiToken, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
label=label,
|
||||
client=client,
|
||||
)
|
||||
|
||||
@ -70,10 +79,12 @@ def sync_detailed(
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Optional[Union[ApiToken, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
label=label,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
@ -81,8 +92,10 @@ def sync(
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Response[Optional[Union[ApiToken, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
label=label,
|
||||
client=client,
|
||||
)
|
||||
|
||||
@ -95,11 +108,13 @@ async def asyncio_detailed(
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Optional[Union[ApiToken, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
label=label,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -26,7 +26,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
""" Contains methods for accessing the modeling API paths: Modeling API for updating your 3D files using the KittyCAD engine. """ # noqa: E501
|
||||
""" Contains methods for accessing the modeling API paths: Modeling API for updating your 3D files using the Zoo engine. """ # noqa: E501
|
||||
|
1
kittycad/api/orgs/__init__.py
Normal file
1
kittycad/api/orgs/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
""" Contains methods for accessing the orgs API paths: An organization is a group of users of the Zoo API. Here, we can add users to an org and perform operations on orgs. """ # noqa: E501
|
116
kittycad/api/orgs/create_org.py
Normal file
116
kittycad/api/orgs/create_org.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.org import Org
|
||||
from ...models.org_details import OrgDetails
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org".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(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Org, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = Org(**response.json())
|
||||
return response_201
|
||||
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[Org, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Org, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo user that is not already in an org. It creates a new org for the authenticated user and makes them an admin.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
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(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Org, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo user that is not already in an org. It creates a new org for the authenticated user and makes them an admin.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
116
kittycad/api/orgs/create_org_member.py
Normal file
116
kittycad/api/orgs/create_org_member.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.add_org_member import AddOrgMember
|
||||
from ...models.error import Error
|
||||
from ...models.org_member import OrgMember
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: AddOrgMember,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/members".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(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[OrgMember, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = OrgMember(**response.json())
|
||||
return response_201
|
||||
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[OrgMember, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: AddOrgMember,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[OrgMember, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: AddOrgMember,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[OrgMember, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: AddOrgMember,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[OrgMember, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
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(
|
||||
body: AddOrgMember,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[OrgMember, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
106
kittycad/api/orgs/delete_org.py
Normal file
106
kittycad/api/orgs/delete_org.py
Normal file
@ -0,0 +1,106 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org".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[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(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.delete(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""In order to delete an org, you must first delete all of its members, except yourself.
|
||||
You must also have no outstanding invoices or unpaid balances.
|
||||
This endpoint requires authentication by an org admin. It deletes the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.delete(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""In order to delete an org, you must first delete all of its members, except yourself.
|
||||
You must also have no outstanding invoices or unpaid balances.
|
||||
This endpoint requires authentication by an org admin. It deletes the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
111
kittycad/api/orgs/delete_org_member.py
Normal file
111
kittycad/api/orgs/delete_org_member.py
Normal file
@ -0,0 +1,111 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/members/{user_id}".format(
|
||||
client.base_url,
|
||||
user_id=user_id,
|
||||
) # 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[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(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.delete(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin. It removes the specified member from the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.delete(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin. It removes the specified member from the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -3,8 +3,8 @@ from typing import Any, Dict, Optional, Union
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.ai_plugin_manifest import AiPluginManifest
|
||||
from ...models.error import Error
|
||||
from ...models.org import Org
|
||||
from ...types import Response
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/.well-known/ai-plugin.json".format(
|
||||
url = "{}/org".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
@ -27,11 +27,9 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[AiPluginManifest, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Org, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AiPluginManifest(**response.json())
|
||||
response_200 = Org(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
@ -44,7 +42,7 @@ def _parse_response(
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[AiPluginManifest, Error]]]:
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -56,7 +54,7 @@ def _build_response(
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[AiPluginManifest, Error]]]:
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
@ -72,7 +70,9 @@ def sync_detailed(
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[AiPluginManifest, Error]]:
|
||||
) -> Optional[Union[Org, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
@ -81,7 +81,7 @@ def sync(
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[AiPluginManifest, Error]]]:
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
@ -95,7 +95,9 @@ async def asyncio_detailed(
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[AiPluginManifest, Error]]:
|
||||
) -> Optional[Union[Org, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
116
kittycad/api/orgs/get_org_member.py
Normal file
116
kittycad/api/orgs/get_org_member.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.org_member import OrgMember
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/members/{user_id}".format(
|
||||
client.base_url,
|
||||
user_id=user_id,
|
||||
) # 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[OrgMember, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = OrgMember(**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[OrgMember, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[OrgMember, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[OrgMember, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the specified member of the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[OrgMember, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
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(
|
||||
user_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[OrgMember, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the specified member of the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
107
kittycad/api/orgs/get_user_org.py
Normal file
107
kittycad/api/orgs/get_user_org.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.user_org_info import UserOrgInfo
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/org".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[UserOrgInfo, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UserOrgInfo(**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[UserOrgInfo, 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[UserOrgInfo, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[UserOrgInfo, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It gets the authenticated user's org.
|
||||
If the user is not a member of an org, this endpoint will return a 404.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[UserOrgInfo, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
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(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[UserOrgInfo, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It gets the authenticated user's org.
|
||||
If the user is not a member of an org, this endpoint will return a 404.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
169
kittycad/api/orgs/list_org_members.py
Normal file
169
kittycad/api/orgs/list_org_members.py
Normal file
@ -0,0 +1,169 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...models.error import Error
|
||||
from ...models.org_member_results_page import OrgMemberResultsPage
|
||||
from ...models.org_role import OrgRole
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/members".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
if role is not None:
|
||||
if "?" in url:
|
||||
url = url + "&role=" + str(role)
|
||||
else:
|
||||
url = url + "?role=" + str(role)
|
||||
|
||||
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[OrgMemberResultsPage, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = OrgMemberResultsPage(**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[OrgMemberResultsPage, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[OrgMemberResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
role=role,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[OrgMemberResultsPage, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It lists the members of the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
role=role,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[OrgMemberResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
role=role,
|
||||
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(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[OrgMemberResultsPage, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It lists the members of the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
role=role,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
116
kittycad/api/orgs/update_org.py
Normal file
116
kittycad/api/orgs/update_org.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.org import Org
|
||||
from ...models.org_details import OrgDetails
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org".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(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Org, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Org(**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[Org, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Org, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It updates the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: OrgDetails,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Org, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It updates the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
127
kittycad/api/orgs/update_org_member.py
Normal file
127
kittycad/api/orgs/update_org_member.py
Normal file
@ -0,0 +1,127 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.org_member import OrgMember
|
||||
from ...models.update_member_to_org_body import UpdateMemberToOrgBody
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: Uuid,
|
||||
body: UpdateMemberToOrgBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/members/{user_id}".format(
|
||||
client.base_url,
|
||||
user_id=user_id,
|
||||
) # 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(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[OrgMember, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = OrgMember(**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[OrgMember, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: Uuid,
|
||||
body: UpdateMemberToOrgBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[OrgMember, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: Uuid,
|
||||
body: UpdateMemberToOrgBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[OrgMember, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It updates the specified member of the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: Uuid,
|
||||
body: UpdateMemberToOrgBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[OrgMember, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: Uuid,
|
||||
body: UpdateMemberToOrgBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[OrgMember, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It updates the specified member of the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
120
kittycad/api/payments/create_payment_information_for_org.py
Normal file
120
kittycad/api/payments/create_payment_information_for_org.py
Normal file
@ -0,0 +1,120 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.billing_info import BillingInfo
|
||||
from ...models.customer import Customer
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment".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(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = Customer(**response.json())
|
||||
return response_201
|
||||
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[Customer, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Customer, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Customer, Error]]:
|
||||
"""This includes billing address, phone, and name.
|
||||
This endpoint requires authentication by the org admin. It creates the payment information for the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Customer, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
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(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Customer, Error]]:
|
||||
"""This includes billing address, phone, and name.
|
||||
This endpoint requires authentication by the org admin. It creates the payment information for the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -26,7 +26,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
|
107
kittycad/api/payments/create_payment_intent_for_org.py
Normal file
107
kittycad/api/payments/create_payment_intent_for_org.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.payment_intent import PaymentIntent
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/intent".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[PaymentIntent, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = PaymentIntent(**response.json())
|
||||
return response_201
|
||||
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[PaymentIntent, 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[PaymentIntent, 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[PaymentIntent, Error]]:
|
||||
"""This endpoint requires authentication by the org admin. It creates a new payment intent for the authenticated user's org's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PaymentIntent, 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[PaymentIntent, Error]]:
|
||||
"""This endpoint requires authentication by the org admin. It creates a new payment intent for the authenticated user's org's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
104
kittycad/api/payments/delete_payment_information_for_org.py
Normal file
104
kittycad/api/payments/delete_payment_information_for_org.py
Normal file
@ -0,0 +1,104 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment".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[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(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.delete(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This includes billing address, phone, and name.
|
||||
This endpoint requires authentication by an org admin. It deletes the payment information for the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.delete(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This includes billing address, phone, and name.
|
||||
This endpoint requires authentication by an org admin. It deletes the payment information for the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
110
kittycad/api/payments/delete_payment_method_for_org.py
Normal file
110
kittycad/api/payments/delete_payment_method_for_org.py
Normal file
@ -0,0 +1,110 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/methods/{id}".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # 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[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(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.delete(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin. It deletes the specified payment method for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.delete(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin. It deletes the specified payment method for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
107
kittycad/api/payments/get_payment_balance_for_org.py
Normal file
107
kittycad/api/payments/get_payment_balance_for_org.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.customer_balance import CustomerBalance
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/balance".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[CustomerBalance, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CustomerBalance(**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[CustomerBalance, 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[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the balance information for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
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(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the balance information for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -3,6 +3,7 @@ from typing import Any, Dict, Optional, Union
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.customer import Customer
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
@ -11,7 +12,7 @@ def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/openai/openapi.json".format(
|
||||
url = "{}/org/payment".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
@ -26,9 +27,9 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = response.json()
|
||||
response_200 = Customer(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
@ -41,7 +42,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[dict, Error]]]:
|
||||
) -> Response[Optional[Union[Customer, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -53,7 +54,7 @@ def _build_response(
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[dict, Error]]]:
|
||||
) -> Response[Optional[Union[Customer, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
@ -69,8 +70,10 @@ def sync_detailed(
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[dict, Error]]:
|
||||
"""This is the same as the OpenAPI schema, BUT it has some modifications to make it compatible with OpenAI. For example, descriptions must be < 300 chars.""" # noqa: E501
|
||||
) -> Optional[Union[Customer, Error]]:
|
||||
"""This includes billing address, phone, and name.
|
||||
This endpoint requires authentication by an org admin. It gets the payment information for the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
@ -80,7 +83,7 @@ def sync(
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[dict, Error]]]:
|
||||
) -> Response[Optional[Union[Customer, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
@ -94,8 +97,10 @@ async def asyncio_detailed(
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[dict, Error]]:
|
||||
"""This is the same as the OpenAPI schema, BUT it has some modifications to make it compatible with OpenAI. For example, descriptions must be < 300 chars.""" # noqa: E501
|
||||
) -> Optional[Union[Customer, Error]]:
|
||||
"""This includes billing address, phone, and name.
|
||||
This endpoint requires authentication by an org admin. It gets the payment information for the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
107
kittycad/api/payments/list_invoices_for_org.py
Normal file
107
kittycad/api/payments/list_invoices_for_org.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.invoice import Invoice
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/invoices".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[List[Invoice], Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = [Invoice(**item) for item in 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[List[Invoice], 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[List[Invoice], Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[List[Invoice], Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It lists invoices for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[List[Invoice], Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
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(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[List[Invoice], Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It lists invoices for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
107
kittycad/api/payments/list_payment_methods_for_org.py
Normal file
107
kittycad/api/payments/list_payment_methods_for_org.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.payment_method import PaymentMethod
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/methods".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[List[PaymentMethod], Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = [PaymentMethod(**item) for item in 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[List[PaymentMethod], 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[List[PaymentMethod], Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[List[PaymentMethod], Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It lists payment methods for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[List[PaymentMethod], Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
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(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[List[PaymentMethod], Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It lists payment methods for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
120
kittycad/api/payments/update_payment_information_for_org.py
Normal file
120
kittycad/api/payments/update_payment_information_for_org.py
Normal file
@ -0,0 +1,120 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.billing_info import BillingInfo
|
||||
from ...models.customer import Customer
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment".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(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Customer(**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[Customer, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Customer, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Customer, Error]]:
|
||||
"""This includes billing address, phone, and name.
|
||||
This endpoint requires authentication by an org admin. It updates the payment information for the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Customer, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: BillingInfo,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Customer, Error]]:
|
||||
"""This includes billing address, phone, and name.
|
||||
This endpoint requires authentication by an org admin. It updates the payment information for the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -26,7 +26,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,100 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/tax".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[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(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin. It will return an error if the org's information is not valid for automatic tax. Otherwise, it will return an empty successful response.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
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(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin. It will return an error if the org's information is not valid for automatic tax. Otherwise, it will return an empty successful response.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -66,7 +66,7 @@ def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by any Zoo user. It will return an error if the customer's information is not valid for automatic tax. Otherwise, it will return an empty successful response.""" # noqa: E501
|
||||
"""This endpoint requires authentication by any Zoo user. It will return an error if the user's information is not valid for automatic tax. Otherwise, it will return an empty successful response.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
@ -91,7 +91,7 @@ async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by any Zoo user. It will return an error if the customer's information is not valid for automatic tax. Otherwise, it will return an empty successful response.""" # noqa: E501
|
||||
"""This endpoint requires authentication by any Zoo user. It will return an error if the user's information is not valid for automatic tax. Otherwise, it will return an empty successful response.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
|
@ -1 +1 @@
|
||||
""" Contains methods for accessing the users API paths: A user is someone who uses the KittyCAD API. Here, we can create, delete, and list users. We can also get information about a user. Operations will only be authorized if the user is requesting information about themselves. """ # noqa: E501
|
||||
""" Contains methods for accessing the users API paths: A user is someone who uses the Zoo API. Here, we can create, delete, and list users. We can also get information about a user. Operations will only be authorized if the user is requesting information about themselves. """ # noqa: E501
|
||||
|
@ -26,7 +26,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ class Client:
|
||||
base_url: str = attr.ib(default="https://api.kittycad.io")
|
||||
cookies: Dict[str, str] = attr.ib(factory=dict, kw_only=True)
|
||||
headers: Dict[str, str] = attr.ib(factory=dict, kw_only=True)
|
||||
timeout: float = attr.ib(50.0, kw_only=True)
|
||||
timeout: float = attr.ib(120.0, kw_only=True)
|
||||
verify_ssl: Union[str, bool, ssl.SSLContext] = attr.ib(True, kw_only=True)
|
||||
|
||||
def get_headers(self) -> Dict[str, str]:
|
||||
|
@ -1,12 +1,19 @@
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
from typing import Optional, Union
|
||||
|
||||
import pytest
|
||||
|
||||
from .api.ai import create_text_to_cad, get_text_to_cad_model_for_user
|
||||
from .api.api_tokens import list_api_tokens_for_user
|
||||
from .api.file import create_file_conversion, create_file_mass, create_file_volume
|
||||
from .api.file import (
|
||||
create_file_center_of_mass,
|
||||
create_file_conversion,
|
||||
create_file_mass,
|
||||
create_file_volume,
|
||||
)
|
||||
from .api.meta import ping
|
||||
from .api.modeling import modeling_commands_ws
|
||||
from .api.users import get_user_self, list_users_extended
|
||||
@ -20,6 +27,7 @@ from .models import (
|
||||
Direction,
|
||||
Error,
|
||||
ExtendedUserResultsPage,
|
||||
FileCenterOfMass,
|
||||
FileConversion,
|
||||
FileExportFormat,
|
||||
FileImportFormat,
|
||||
@ -32,6 +40,8 @@ from .models import (
|
||||
ModelingCmdId,
|
||||
Pong,
|
||||
System,
|
||||
TextToCad,
|
||||
TextToCadCreateBody,
|
||||
UnitDensity,
|
||||
UnitLength,
|
||||
UnitMass,
|
||||
@ -294,6 +304,37 @@ def test_file_volume():
|
||||
assert fv.status == ApiCallStatus.COMPLETED
|
||||
|
||||
|
||||
def test_file_center_of_mass():
|
||||
# Create our client.
|
||||
client = ClientFromEnv()
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
file = open(os.path.join(dir_path, "../assets/testing.obj"), "rb")
|
||||
content = file.read()
|
||||
file.close()
|
||||
|
||||
# Get the fc.
|
||||
result: Union[FileCenterOfMass, Error, None] = create_file_center_of_mass.sync(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.OBJ,
|
||||
output_unit=UnitLength.CM,
|
||||
)
|
||||
|
||||
assert isinstance(result, FileCenterOfMass)
|
||||
|
||||
fv: FileCenterOfMass = result
|
||||
|
||||
print(f"FileCenterOfMass: {fv}")
|
||||
|
||||
assert fv.id is not None
|
||||
assert fv.center_of_mass is not None
|
||||
|
||||
assert fv.model_dump_json() is not None
|
||||
|
||||
assert fv.status == ApiCallStatus.COMPLETED
|
||||
|
||||
|
||||
def test_list_users():
|
||||
# Create our client.
|
||||
client = ClientFromEnv()
|
||||
@ -489,3 +530,43 @@ def test_serialize_deserialize():
|
||||
assert model_dump["resp"]["type"] == "modeling" # type: ignore
|
||||
assert model_dump["resp"]["data"]["modeling_response"]["type"] == "import_files" # type: ignore
|
||||
assert model_dump["resp"]["data"]["modeling_response"]["data"]["object_id"] == "f61ac02e-77bd-468f-858f-fd4141a26acd" # type: ignore
|
||||
|
||||
|
||||
def test_text_to_cad():
|
||||
# Create our client.
|
||||
client = ClientFromEnv()
|
||||
|
||||
result: Optional[Union[TextToCad, Error]] = create_text_to_cad.sync(
|
||||
client=client,
|
||||
output_format=FileExportFormat.STEP,
|
||||
body=TextToCadCreateBody(
|
||||
prompt="a 2x4 lego",
|
||||
),
|
||||
)
|
||||
|
||||
if isinstance(result, Error) or result is None:
|
||||
print(result)
|
||||
raise Exception("Error in response")
|
||||
|
||||
body: TextToCad = result
|
||||
|
||||
# Poll the api until the status is completed.
|
||||
# Timeout after some seconds.
|
||||
start_time = time.time()
|
||||
while (
|
||||
body.status == ApiCallStatus.IN_PROGRESS or body.status == ApiCallStatus.QUEUED
|
||||
) and time.time() - start_time < 120:
|
||||
result_status: Optional[
|
||||
Union[TextToCad, Error]
|
||||
] = get_text_to_cad_model_for_user.sync(
|
||||
client=client,
|
||||
id=body.id,
|
||||
)
|
||||
|
||||
if isinstance(result_status, Error) or result_status is None:
|
||||
print(result_status)
|
||||
raise Exception("Error in response")
|
||||
|
||||
body = result_status
|
||||
|
||||
assert body.status == ApiCallStatus.COMPLETED
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,9 @@
|
||||
""" Contains all the data models used in inputs/outputs """
|
||||
|
||||
from .account_provider import AccountProvider
|
||||
from .add_org_member import AddOrgMember
|
||||
from .address_details import AddressDetails
|
||||
from .ai_feedback import AiFeedback
|
||||
from .ai_plugin_api import AiPluginApi
|
||||
from .ai_plugin_api_type import AiPluginApiType
|
||||
from .ai_plugin_auth import AiPluginAuth
|
||||
from .ai_plugin_auth_type import AiPluginAuthType
|
||||
from .ai_plugin_http_auth_type import AiPluginHttpAuthType
|
||||
from .ai_plugin_manifest import AiPluginManifest
|
||||
from .ai_prompt import AiPrompt
|
||||
from .ai_prompt_results_page import AiPromptResultsPage
|
||||
from .ai_prompt_type import AiPromptType
|
||||
@ -35,6 +31,7 @@ from .async_api_call_type import AsyncApiCallType
|
||||
from .axis import Axis
|
||||
from .axis_direction_pair import AxisDirectionPair
|
||||
from .billing_info import BillingInfo
|
||||
from .block_reason import BlockReason
|
||||
from .cache_metadata import CacheMetadata
|
||||
from .camera_drag_interaction_type import CameraDragInteractionType
|
||||
from .card_details import CardDetails
|
||||
@ -117,12 +114,16 @@ from .modeling_cmd import ModelingCmd
|
||||
from .modeling_cmd_id import ModelingCmdId
|
||||
from .modeling_cmd_req import ModelingCmdReq
|
||||
from .mouse_click import MouseClick
|
||||
from .new_address import NewAddress
|
||||
from .o_auth2_client_info import OAuth2ClientInfo
|
||||
from .o_auth2_grant_type import OAuth2GrantType
|
||||
from .ok_modeling_cmd_response import OkModelingCmdResponse
|
||||
from .ok_web_socket_response_data import OkWebSocketResponseData
|
||||
from .onboarding import Onboarding
|
||||
from .org import Org
|
||||
from .org_details import OrgDetails
|
||||
from .org_member import OrgMember
|
||||
from .org_member_results_page import OrgMemberResultsPage
|
||||
from .org_role import OrgRole
|
||||
from .output_file import OutputFile
|
||||
from .output_format import OutputFormat
|
||||
from .path_command import PathCommand
|
||||
@ -137,6 +138,7 @@ from .payment_intent import PaymentIntent
|
||||
from .payment_method import PaymentMethod
|
||||
from .payment_method_card_checks import PaymentMethodCardChecks
|
||||
from .payment_method_type import PaymentMethodType
|
||||
from .perspective_camera_parameters import PerspectiveCameraParameters
|
||||
from .plane_intersect_and_project import PlaneIntersectAndProject
|
||||
from .ply_storage import PlyStorage
|
||||
from .point2d import Point2d
|
||||
@ -192,8 +194,10 @@ from .unit_torque import UnitTorque
|
||||
from .unit_torque_conversion import UnitTorqueConversion
|
||||
from .unit_volume import UnitVolume
|
||||
from .unit_volume_conversion import UnitVolumeConversion
|
||||
from .update_member_to_org_body import UpdateMemberToOrgBody
|
||||
from .update_user import UpdateUser
|
||||
from .user import User
|
||||
from .user_org_info import UserOrgInfo
|
||||
from .user_results_page import UserResultsPage
|
||||
from .uuid import Uuid
|
||||
from .verification_token import VerificationToken
|
||||
|
14
kittycad/models/add_org_member.py
Normal file
14
kittycad/models/add_org_member.py
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.org_role import OrgRole
|
||||
|
||||
|
||||
class AddOrgMember(BaseModel):
|
||||
"""Data for adding a member to an org."""
|
||||
|
||||
email: str
|
||||
|
||||
role: OrgRole
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
23
kittycad/models/address_details.py
Normal file
23
kittycad/models/address_details.py
Normal file
@ -0,0 +1,23 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.country_code import CountryCode
|
||||
|
||||
|
||||
class AddressDetails(BaseModel):
|
||||
"""Address details."""
|
||||
|
||||
city: Optional[str] = None
|
||||
|
||||
country: CountryCode
|
||||
|
||||
state: Optional[str] = None
|
||||
|
||||
street1: Optional[str] = None
|
||||
|
||||
street2: Optional[str] = None
|
||||
|
||||
zip: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
@ -1,15 +0,0 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from ..models.ai_plugin_api_type import AiPluginApiType
|
||||
|
||||
|
||||
class AiPluginApi(BaseModel):
|
||||
"""AI plugin api information."""
|
||||
|
||||
is_user_authenticated: Optional[bool] = None
|
||||
|
||||
type: Optional[AiPluginApiType] = None
|
||||
|
||||
url: str
|
@ -1,11 +0,0 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class AiPluginApiType(str, Enum):
|
||||
"""AI plugin api type.""" # noqa: E501
|
||||
|
||||
"""# An OpenAPI specification. """ # noqa: E501
|
||||
OPENAPI = "openapi"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
@ -1,14 +0,0 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from ..models.ai_plugin_auth_type import AiPluginAuthType
|
||||
from ..models.ai_plugin_http_auth_type import AiPluginHttpAuthType
|
||||
|
||||
|
||||
class AiPluginAuth(BaseModel):
|
||||
"""AI plugin auth information."""
|
||||
|
||||
authorization_type: Optional[AiPluginHttpAuthType] = None
|
||||
|
||||
type: Optional[AiPluginAuthType] = None
|
@ -1,17 +0,0 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class AiPluginAuthType(str, Enum):
|
||||
"""AI plugin auth type.""" # noqa: E501
|
||||
|
||||
"""# None. """ # noqa: E501
|
||||
NONE = "none"
|
||||
"""# User http. """ # noqa: E501
|
||||
USER_HTTP = "user_http"
|
||||
"""# Service http. """ # noqa: E501
|
||||
SERVICE_HTTP = "service_http"
|
||||
"""# OAuth. """ # noqa: E501
|
||||
OAUTH = "oauth"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
@ -1,13 +0,0 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class AiPluginHttpAuthType(str, Enum):
|
||||
"""AI plugin http auth type.""" # noqa: E501
|
||||
|
||||
"""# Basic. """ # noqa: E501
|
||||
BASIC = "basic"
|
||||
"""# Bearer. """ # noqa: E501
|
||||
BEARER = "bearer"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
@ -1,33 +0,0 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from ..models.ai_plugin_api import AiPluginApi
|
||||
from ..models.ai_plugin_auth import AiPluginAuth
|
||||
|
||||
|
||||
class AiPluginManifest(BaseModel):
|
||||
"""AI plugin manifest.
|
||||
|
||||
This is used for OpenAI's ChatGPT plugins. You can read more about them [here](https://platform.openai.com/docs/plugins/getting-started/plugin-manifest).
|
||||
"""
|
||||
|
||||
api: AiPluginApi
|
||||
|
||||
auth: AiPluginAuth
|
||||
|
||||
contact_email: Optional[str] = None
|
||||
|
||||
description_for_human: Optional[str] = None
|
||||
|
||||
description_for_model: Optional[str] = None
|
||||
|
||||
legal_info_url: str
|
||||
|
||||
logo_url: str
|
||||
|
||||
name_for_human: Optional[str] = None
|
||||
|
||||
name_for_model: Optional[str] = None
|
||||
|
||||
schema_version: Optional[str] = None
|
@ -1,7 +1,7 @@
|
||||
import datetime
|
||||
from typing import Any, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.ai_feedback import AiFeedback
|
||||
from ..models.ai_prompt_type import AiPromptType
|
||||
@ -39,3 +39,5 @@ class AiPrompt(BaseModel):
|
||||
updated_at: datetime.datetime
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.ai_prompt import AiPrompt
|
||||
|
||||
@ -11,3 +11,5 @@ class AiPromptResultsPage(BaseModel):
|
||||
items: List[AiPrompt]
|
||||
|
||||
next_page: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.unit_angle import UnitAngle
|
||||
|
||||
@ -10,3 +10,5 @@ class Angle(BaseModel):
|
||||
unit: UnitAngle
|
||||
|
||||
value: float
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.annotation_line_end import AnnotationLineEnd
|
||||
|
||||
@ -10,3 +10,5 @@ class AnnotationLineEndOptions(BaseModel):
|
||||
end: AnnotationLineEnd
|
||||
|
||||
start: AnnotationLineEnd
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.annotation_line_end_options import AnnotationLineEndOptions
|
||||
from ..models.annotation_text_options import AnnotationTextOptions
|
||||
@ -20,3 +20,5 @@ class AnnotationOptions(BaseModel):
|
||||
position: Optional[Point3d] = None
|
||||
|
||||
text: Optional[AnnotationTextOptions] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.annotation_text_alignment_x import AnnotationTextAlignmentX
|
||||
from ..models.annotation_text_alignment_y import AnnotationTextAlignmentY
|
||||
@ -15,3 +15,5 @@ class AnnotationTextOptions(BaseModel):
|
||||
x: AnnotationTextAlignmentX
|
||||
|
||||
y: AnnotationTextAlignmentY
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -9,3 +9,5 @@ class ApiCallQueryGroup(BaseModel):
|
||||
count: int
|
||||
|
||||
query: str
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,7 +1,7 @@
|
||||
import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.method import Method
|
||||
from ..models.uuid import Uuid
|
||||
@ -32,6 +32,8 @@ class ApiCallWithPrice(BaseModel):
|
||||
|
||||
minutes: Optional[int] = None
|
||||
|
||||
org_id: Optional[Uuid] = None
|
||||
|
||||
origin: Optional[str] = None
|
||||
|
||||
price: Optional[float] = None
|
||||
@ -55,3 +57,5 @@ class ApiCallWithPrice(BaseModel):
|
||||
user_agent: str
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.api_call_with_price import ApiCallWithPrice
|
||||
|
||||
@ -11,3 +11,5 @@ class ApiCallWithPriceResultsPage(BaseModel):
|
||||
items: List[ApiCallWithPrice]
|
||||
|
||||
next_page: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.error_code import ErrorCode
|
||||
|
||||
@ -10,3 +10,5 @@ class ApiError(BaseModel):
|
||||
error_code: ErrorCode
|
||||
|
||||
message: str
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,7 @@
|
||||
import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.uuid import Uuid
|
||||
|
||||
@ -16,8 +17,12 @@ class ApiToken(BaseModel):
|
||||
|
||||
is_valid: bool
|
||||
|
||||
label: Optional[str] = None
|
||||
|
||||
token: Uuid
|
||||
|
||||
updated_at: datetime.datetime
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.api_token import ApiToken
|
||||
|
||||
@ -11,3 +11,5 @@ class ApiTokenResultsPage(BaseModel):
|
||||
items: List[ApiToken]
|
||||
|
||||
next_page: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -8,3 +8,5 @@ class AppClientInfo(BaseModel):
|
||||
"""Information about a third party app client."""
|
||||
|
||||
url: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,7 +1,7 @@
|
||||
import datetime
|
||||
from typing import Any, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.api_call_status import ApiCallStatus
|
||||
from ..models.async_api_call_type import AsyncApiCallType
|
||||
@ -34,3 +34,5 @@ class AsyncApiCall(BaseModel):
|
||||
user_id: Uuid
|
||||
|
||||
worker: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,7 +1,7 @@
|
||||
import datetime
|
||||
from typing import Dict, Literal, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field, RootModel
|
||||
from pydantic import BaseModel, ConfigDict, Field, RootModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from ..models.ai_feedback import AiFeedback
|
||||
@ -51,6 +51,8 @@ class file_conversion(BaseModel):
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class file_center_of_mass(BaseModel):
|
||||
"""File center of mass."""
|
||||
@ -79,6 +81,8 @@ class file_center_of_mass(BaseModel):
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class file_mass(BaseModel):
|
||||
"""A file mass."""
|
||||
@ -111,6 +115,8 @@ class file_mass(BaseModel):
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class file_volume(BaseModel):
|
||||
"""A file volume."""
|
||||
@ -139,6 +145,8 @@ class file_volume(BaseModel):
|
||||
|
||||
volume: Optional[float] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class file_density(BaseModel):
|
||||
"""A file density."""
|
||||
@ -171,6 +179,8 @@ class file_density(BaseModel):
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class file_surface_area(BaseModel):
|
||||
"""A file surface area."""
|
||||
@ -199,6 +209,8 @@ class file_surface_area(BaseModel):
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class text_to_cad(BaseModel):
|
||||
"""Text to CAD."""
|
||||
@ -231,6 +243,8 @@ class text_to_cad(BaseModel):
|
||||
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
AsyncApiCallOutput = RootModel[
|
||||
Annotated[
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.async_api_call import AsyncApiCall
|
||||
|
||||
@ -11,3 +11,5 @@ class AsyncApiCallResultsPage(BaseModel):
|
||||
items: List[AsyncApiCall]
|
||||
|
||||
next_page: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.axis import Axis
|
||||
from ..models.direction import Direction
|
||||
@ -11,3 +11,5 @@ class AxisDirectionPair(BaseModel):
|
||||
axis: Axis
|
||||
|
||||
direction: Direction
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,15 +1,17 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.new_address import NewAddress
|
||||
from ..models.address_details import AddressDetails
|
||||
|
||||
|
||||
class BillingInfo(BaseModel):
|
||||
"""The billing information for payments."""
|
||||
|
||||
address: Optional[NewAddress] = None
|
||||
address: Optional[AddressDetails] = None
|
||||
|
||||
name: Optional[str] = None
|
||||
|
||||
phone: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
13
kittycad/models/block_reason.py
Normal file
13
kittycad/models/block_reason.py
Normal file
@ -0,0 +1,13 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class BlockReason(str, Enum):
|
||||
"""The reason for blocking a user.""" # noqa: E501
|
||||
|
||||
"""# The user is missing a payment method and has exceeded their free API call credits for the month. """ # noqa: E501
|
||||
MISSING_PAYMENT_METHOD = "missing_payment_method"
|
||||
"""# The users payment method has failed. """ # noqa: E501
|
||||
PAYMENT_METHOD_FAILED = "payment_method_failed"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -9,3 +9,5 @@ class CacheMetadata(BaseModel):
|
||||
This is mostly used for internal purposes and debugging."""
|
||||
|
||||
ok: bool
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.payment_method_card_checks import PaymentMethodCardChecks
|
||||
|
||||
@ -23,3 +23,5 @@ class CardDetails(BaseModel):
|
||||
funding: Optional[str] = None
|
||||
|
||||
last4: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
from ..models.unit_length import UnitLength
|
||||
@ -11,3 +11,5 @@ class CenterOfMass(BaseModel):
|
||||
center_of_mass: Point3d
|
||||
|
||||
output_unit: UnitLength
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -21,3 +21,5 @@ class ClientMetrics(BaseModel):
|
||||
rtc_keyframes_decoded: int
|
||||
|
||||
rtc_total_freezes_duration_sec: float
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -18,3 +18,5 @@ class Cluster(BaseModel):
|
||||
tls_timeout: Optional[int] = None
|
||||
|
||||
urls: Optional[List[str]] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -2,7 +2,12 @@ from enum import Enum
|
||||
|
||||
|
||||
class CodeLanguage(str, Enum):
|
||||
"""The language code is written in.""" # noqa: E501
|
||||
"""The language code is written in.
|
||||
|
||||
<details><summary>JSON schema</summary>
|
||||
|
||||
```json { "description": "The language code is written in.", "oneOf": [ { "description": "The `go` programming language.", "type": "string", "enum": [ "go" ] }, { "description": "The `python` programming language.", "type": "string", "enum": [ "python" ] }, { "description": "The `node` programming language.", "type": "string", "enum": [ "node" ] } ] } ``` </details>
|
||||
""" # noqa: E501
|
||||
|
||||
"""# The `go` programming language. """ # noqa: E501
|
||||
GO = "go"
|
||||
|
@ -1,15 +1,22 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.output_file import OutputFile
|
||||
|
||||
|
||||
class CodeOutput(BaseModel):
|
||||
"""Output of the code being executed."""
|
||||
"""Output of the code being executed.
|
||||
|
||||
<details><summary>JSON schema</summary>
|
||||
|
||||
```json { "description": "Output of the code being executed.", "type": "object", "properties": { "output_files": { "description": "The contents of the files requested if they were passed.", "type": "array", "items": { "$ref": "#/components/schemas/OutputFile" } }, "stderr": { "description": "The stderr of the code.", "default": "", "type": "string" }, "stdout": { "description": "The stdout of the code.", "default": "", "type": "string" } } } ``` </details>
|
||||
"""
|
||||
|
||||
output_files: Optional[List[OutputFile]] = None
|
||||
|
||||
stderr: Optional[str] = None
|
||||
|
||||
stdout: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -13,3 +13,5 @@ class Color(BaseModel):
|
||||
g: float
|
||||
|
||||
r: float
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,7 +1,7 @@
|
||||
import datetime
|
||||
from typing import Dict, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.cluster import Cluster
|
||||
from ..models.gateway import Gateway
|
||||
@ -105,3 +105,5 @@ class Connection(BaseModel):
|
||||
version: Optional[str] = None
|
||||
|
||||
write_deadline: Optional[int] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
from typing import Dict, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -13,4 +13,10 @@ class Coupon(BaseModel):
|
||||
|
||||
id: Optional[str] = None
|
||||
|
||||
metadata: Optional[Dict[str, str]] = None
|
||||
|
||||
name: Optional[str] = None
|
||||
|
||||
percent_off: Optional[float] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
|
||||
@ -9,3 +9,5 @@ class CurveGetControlPoints(BaseModel):
|
||||
"""The response from the `CurveGetControlPoints` command."""
|
||||
|
||||
control_points: List[Point3d]
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
|
||||
@ -10,3 +10,5 @@ class CurveGetEndPoints(BaseModel):
|
||||
end: Point3d
|
||||
|
||||
start: Point3d
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.curve_type import CurveType
|
||||
|
||||
@ -8,3 +8,5 @@ class CurveGetType(BaseModel):
|
||||
"""The response from the `CurveGetType` command."""
|
||||
|
||||
curve_type: CurveType
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,16 +1,16 @@
|
||||
import datetime
|
||||
from typing import Dict, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.address_details import AddressDetails
|
||||
from ..models.currency import Currency
|
||||
from ..models.new_address import NewAddress
|
||||
|
||||
|
||||
class Customer(BaseModel):
|
||||
"""The resource representing a payment "Customer"."""
|
||||
|
||||
address: Optional[NewAddress] = None
|
||||
address: Optional[AddressDetails] = None
|
||||
|
||||
balance: Optional[float] = None
|
||||
|
||||
@ -29,3 +29,5 @@ class Customer(BaseModel):
|
||||
name: Optional[str] = None
|
||||
|
||||
phone: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,19 +1,21 @@
|
||||
import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.uuid import Uuid
|
||||
|
||||
|
||||
class CustomerBalance(BaseModel):
|
||||
"""A balance for a user.
|
||||
"""A balance for a customer.
|
||||
|
||||
This holds information about the financial balance for the user."""
|
||||
This holds information about the financial balance for the customer."""
|
||||
|
||||
created_at: datetime.datetime
|
||||
|
||||
id: Uuid
|
||||
|
||||
map_id: Uuid
|
||||
|
||||
monthly_credits_remaining: float
|
||||
|
||||
pre_pay_cash_remaining: float
|
||||
@ -24,4 +26,4 @@ class CustomerBalance(BaseModel):
|
||||
|
||||
updated_at: datetime.datetime
|
||||
|
||||
user_id: Uuid
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.unit_density import UnitDensity
|
||||
|
||||
@ -10,3 +10,5 @@ class Density(BaseModel):
|
||||
density: float
|
||||
|
||||
output_unit: UnitDensity
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.o_auth2_grant_type import OAuth2GrantType
|
||||
|
||||
@ -12,3 +12,5 @@ class DeviceAccessTokenRequestForm(BaseModel):
|
||||
device_code: str
|
||||
|
||||
grant_type: OAuth2GrantType
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -7,3 +7,5 @@ class DeviceAuthRequestForm(BaseModel):
|
||||
"""The request parameters for the OAuth 2.0 Device Authorization Grant flow."""
|
||||
|
||||
client_id: str
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -7,3 +7,5 @@ class DeviceAuthVerifyParams(BaseModel):
|
||||
"""The request parameters to verify the `user_code` for the OAuth 2.0 Device Authorization Grant."""
|
||||
|
||||
user_code: str
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.coupon import Coupon
|
||||
|
||||
@ -8,3 +8,5 @@ class Discount(BaseModel):
|
||||
"""The resource representing a Discount."""
|
||||
|
||||
coupon: Coupon
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Literal, Union
|
||||
|
||||
from pydantic import BaseModel, Field, RootModel
|
||||
from pydantic import BaseModel, ConfigDict, Field, RootModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from ..models.global_axis import GlobalAxis
|
||||
@ -11,6 +11,8 @@ class euclidean(BaseModel):
|
||||
|
||||
type: Literal["euclidean"] = "euclidean"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class on_axis(BaseModel):
|
||||
"""The distance between objects along the specified axis"""
|
||||
@ -19,6 +21,8 @@ class on_axis(BaseModel):
|
||||
|
||||
type: Literal["on_axis"] = "on_axis"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
DistanceType = RootModel[
|
||||
Annotated[
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -10,3 +10,5 @@ class EmailAuthenticationForm(BaseModel):
|
||||
callback_url: Optional[str] = None
|
||||
|
||||
email: str
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
@ -8,3 +8,5 @@ class EntityGetAllChildUuids(BaseModel):
|
||||
"""The response from the `EntityGetAllChildUuids` command."""
|
||||
|
||||
entity_ids: List[str]
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user