Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 32 additions & 24 deletions kittycad.py.patch.json

Large diffs are not rendered by default.

124 changes: 97 additions & 27 deletions kittycad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@
)
from .models.account_provider import AccountProvider
from .models.add_org_member import AddOrgMember
from .models.announcement_list import AnnouncementList
from .models.api_call_with_price import ApiCallWithPrice
from .models.api_call_with_price_results_page import ApiCallWithPriceResultsPage
from .models.api_token import ApiToken
from .models.api_token_results_page import ApiTokenResultsPage
from .models.api_token_uuid import ApiTokenUuid
from .models.api_token_with_full_token import ApiTokenWithFullToken
from .models.app_client_info import AppClientInfo
from .models.async_api_call_output import AsyncApiCallOutput
from .models.auth_api_key_response import AuthApiKeyResponse
Expand Down Expand Up @@ -106,7 +108,6 @@
from .models.o_auth2_token_request_form import OAuth2TokenRequestForm
from .models.oauth2_client_info import OAuth2ClientInfo
from .models.org import Org
from .models.org_admin_details import OrgAdminDetails
from .models.org_dataset import OrgDataset
from .models.org_dataset_conversion_stats_response import (
OrgDatasetConversionStatsResponse,
Expand All @@ -120,6 +121,7 @@
from .models.org_details import OrgDetails
from .models.org_member import OrgMember
from .models.org_member_results_page import OrgMemberResultsPage
from .models.org_skill_response import OrgSkillResponse
from .models.payment_intent import PaymentIntent
from .models.payment_method import PaymentMethod
from .models.pong import Pong
Expand Down Expand Up @@ -284,6 +286,33 @@ def get_ipinfo(
# Validate into a Pydantic model (works for BaseModel and RootModel)
return IpAddrInfo.model_validate(json_data, extra="ignore")

def get_announcements(
self,
) -> AnnouncementList:
"""No authentication is required."""

url = "{}/announcements".format(self.client.base_url)

_client = self.client.get_http_client()

response = _client.get(
url=url,
headers=self.client.get_headers(),
)

if not response.is_success:
from kittycad.response_helpers import raise_for_status

raise_for_status(response)

if not response.content:
return None # type: ignore

json_data = response.json()

# Validate into a Pydantic model (works for BaseModel and RootModel)
return AnnouncementList.model_validate(json_data, extra="ignore")

def community_sso(
self,
sso: str,
Expand Down Expand Up @@ -470,6 +499,33 @@ async def get_ipinfo(
# Validate into a Pydantic model (works for BaseModel and RootModel)
return IpAddrInfo.model_validate(json_data, extra="ignore")

async def get_announcements(
self,
) -> AnnouncementList:
"""No authentication is required."""

url = "{}/announcements".format(self.client.base_url)

_client = self.client.get_http_client()

response = await _client.get(
url=url,
headers=self.client.get_headers(),
)

if not response.is_success:
from kittycad.response_helpers import raise_for_status

raise_for_status(response)

if not response.content:
return None # type: ignore

json_data = response.json()

# Validate into a Pydantic model (works for BaseModel and RootModel)
return AnnouncementList.model_validate(json_data, extra="ignore")

async def community_sso(
self,
sso: str,
Expand Down Expand Up @@ -7927,13 +7983,12 @@ def _fetch_page_get_org_shortlinks(self, **kwargs) -> ShortlinkResultsPage:
# Validate into a Pydantic model (supports BaseModel/RootModel)
return ShortlinkResultsPage.model_validate(json_data, extra="ignore")

def org_admin_details_get(
def list_org_skills(
self,
id: Uuid,
) -> OrgAdminDetails:
"""Zoo admins can retrieve extended information about any organization, while non-admins receive a 404 to avoid leaking existence."""
) -> List[OrgSkillResponse]:
"""List every skill that belongs to the caller's organization."""

url = "{}/orgs/{id}/admin/details".format(self.client.base_url, id=id)
url = "{}/org/skills".format(self.client.base_url)

_client = self.client.get_http_client()

Expand All @@ -7952,8 +8007,12 @@ def org_admin_details_get(

json_data = response.json()

# Validate into a Pydantic model (works for BaseModel and RootModel)
return OrgAdminDetails.model_validate(json_data, extra="ignore")
# Validate into annotated/collection/union types using TypeAdapter
from pydantic import TypeAdapter

return TypeAdapter(List[OrgSkillResponse]).validate_python(
json_data, extra="ignore"
)

def get_billing_contract_for_any_org(
self,
Expand Down Expand Up @@ -9316,13 +9375,12 @@ async def _fetch_page_get_org_shortlinks(self, **kwargs) -> ShortlinkResultsPage
# Validate into a Pydantic model (supports BaseModel/RootModel)
return ShortlinkResultsPage.model_validate(json_data, extra="ignore")

async def org_admin_details_get(
async def list_org_skills(
self,
id: Uuid,
) -> OrgAdminDetails:
"""Zoo admins can retrieve extended information about any organization, while non-admins receive a 404 to avoid leaking existence."""
) -> List[OrgSkillResponse]:
"""List every skill that belongs to the caller's organization."""

url = "{}/orgs/{id}/admin/details".format(self.client.base_url, id=id)
url = "{}/org/skills".format(self.client.base_url)

_client = self.client.get_http_client()

Expand All @@ -9341,8 +9399,12 @@ async def org_admin_details_get(

json_data = response.json()

# Validate into a Pydantic model (works for BaseModel and RootModel)
return OrgAdminDetails.model_validate(json_data, extra="ignore")
# Validate into annotated/collection/union types using TypeAdapter
from pydantic import TypeAdapter

return TypeAdapter(List[OrgSkillResponse]).validate_python(
json_data, extra="ignore"
)

async def get_billing_contract_for_any_org(
self,
Expand Down Expand Up @@ -11843,11 +11905,13 @@ def get_service_account_for_org(

def delete_service_account_for_org(
self,
token: ServiceAccountUuid,
token: str,
):
"""This endpoint requires authentication by an org member. It deletes the requested service account for the organization.

This endpoint does not actually delete the service account from the database. It merely marks the token as invalid. We still want to keep the service account in the database for historical purposes."""
This endpoint does not actually delete the service account from the database. It merely marks the token as invalid. We still want to keep the service account in the database for historical purposes.

The token path parameter can be either the full service account token (prefixed with `svc-`) or the token's unique ID (a UUID)."""

url = "{}/org/service-accounts/{token}".format(
self.client.base_url, token=token
Expand Down Expand Up @@ -12033,11 +12097,13 @@ async def get_service_account_for_org(

async def delete_service_account_for_org(
self,
token: ServiceAccountUuid,
token: str,
):
"""This endpoint requires authentication by an org member. It deletes the requested service account for the organization.

This endpoint does not actually delete the service account from the database. It merely marks the token as invalid. We still want to keep the service account in the database for historical purposes."""
This endpoint does not actually delete the service account from the database. It merely marks the token as invalid. We still want to keep the service account in the database for historical purposes.

The token path parameter can be either the full service account token (prefixed with `svc-`) or the token's unique ID (a UUID)."""

url = "{}/org/service-accounts/{token}".format(
self.client.base_url, token=token
Expand Down Expand Up @@ -15916,7 +15982,7 @@ def create_api_token_for_user(
self,
*,
label: Optional[str] = None,
) -> ApiToken:
) -> ApiTokenWithFullToken:
"""This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user."""

url = "{}/user/api-tokens".format(self.client.base_url)
Expand Down Expand Up @@ -15945,7 +16011,7 @@ def create_api_token_for_user(
json_data = response.json()

# Validate into a Pydantic model (works for BaseModel and RootModel)
return ApiToken.model_validate(json_data, extra="ignore")
return ApiTokenWithFullToken.model_validate(json_data, extra="ignore")

def get_api_token_for_user(
self,
Expand Down Expand Up @@ -15977,11 +16043,13 @@ def get_api_token_for_user(

def delete_api_token_for_user(
self,
token: ApiTokenUuid,
token: str,
):
"""This endpoint requires authentication by any Zoo user. It deletes the requested API token for the user.

This endpoint does not actually delete the API token from the database. It merely marks the token as invalid. We still want to keep the token in the database for historical purposes."""
This endpoint does not actually delete the API token from the database. It merely marks the token as invalid. We still want to keep the token in the database for historical purposes.

The token path parameter can be either the full API token (prefixed with `api-`) or the token's unique ID (a UUID)."""

url = "{}/user/api-tokens/{token}".format(self.client.base_url, token=token)

Expand Down Expand Up @@ -16102,7 +16170,7 @@ async def create_api_token_for_user(
self,
*,
label: Optional[str] = None,
) -> ApiToken:
) -> ApiTokenWithFullToken:
"""This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user."""

url = "{}/user/api-tokens".format(self.client.base_url)
Expand Down Expand Up @@ -16131,7 +16199,7 @@ async def create_api_token_for_user(
json_data = response.json()

# Validate into a Pydantic model (works for BaseModel and RootModel)
return ApiToken.model_validate(json_data, extra="ignore")
return ApiTokenWithFullToken.model_validate(json_data, extra="ignore")

async def get_api_token_for_user(
self,
Expand Down Expand Up @@ -16163,11 +16231,13 @@ async def get_api_token_for_user(

async def delete_api_token_for_user(
self,
token: ApiTokenUuid,
token: str,
):
"""This endpoint requires authentication by any Zoo user. It deletes the requested API token for the user.

This endpoint does not actually delete the API token from the database. It merely marks the token as invalid. We still want to keep the token in the database for historical purposes."""
This endpoint does not actually delete the API token from the database. It merely marks the token as invalid. We still want to keep the token in the database for historical purposes.

The token path parameter can be either the full API token (prefixed with `api-`) or the token's unique ID (a UUID)."""

url = "{}/user/api-tokens/{token}".format(self.client.base_url, token=token)

Expand Down
14 changes: 12 additions & 2 deletions kittycad/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from .annotation_text_alignment_y import AnnotationTextAlignmentY
from .annotation_text_options import AnnotationTextOptions
from .annotation_type import AnnotationType
from .announcement import Announcement
from .announcement_list import AnnouncementList
from .api_call_status import ApiCallStatus
from .api_call_with_price import ApiCallWithPrice
from .api_call_with_price_results_page import ApiCallWithPriceResultsPage
Expand All @@ -27,6 +29,7 @@
from .api_token import ApiToken
from .api_token_results_page import ApiTokenResultsPage
from .api_token_uuid import ApiTokenUuid
from .api_token_with_full_token import ApiTokenWithFullToken
from .app_client_info import AppClientInfo
from .async_api_call_output import AsyncApiCallOutput
from .auth_api_key_response import AuthApiKeyResponse
Expand Down Expand Up @@ -140,11 +143,14 @@
from .device_auth_confirm_params import DeviceAuthConfirmParams
from .device_auth_request_form import DeviceAuthRequestForm
from .direction import Direction
from .direction_type import DirectionType
from .disable_dry_run import DisableDryRun
from .discount import Discount
from .discount_code import DiscountCode
from .distance_type import DistanceType
from .dxf_storage import DxfStorage
from .edge_cut_version import EdgeCutVersion
from .edge_get_length import EdgeGetLength
from .edge_info import EdgeInfo
from .edge_lines_visible import EdgeLinesVisible
from .edge_specifier import EdgeSpecifier
Expand Down Expand Up @@ -292,15 +298,14 @@
from .oauth2_grant_type import OAuth2GrantType
from .object_bring_to_front import ObjectBringToFront
from .object_set_material_params_pbr import ObjectSetMaterialParamsPbr
from .object_set_name import ObjectSetName
from .object_visible import ObjectVisible
from .offset_surface import OffsetSurface
from .ok_modeling_cmd_response import OkModelingCmdResponse
from .ok_web_socket_response_data import OkWebSocketResponseData
from .opposite_for_angle import OppositeForAngle
from .opposite_for_length_unit import OppositeForLengthUnit
from .org import Org
from .org_address import OrgAddress
from .org_admin_details import OrgAdminDetails
from .org_dataset import OrgDataset
from .org_dataset_conversion_stats_response import OrgDatasetConversionStatsResponse
from .org_dataset_file_conversion_details import OrgDatasetFileConversionDetails
Expand All @@ -319,6 +324,7 @@
from .org_member import OrgMember
from .org_member_results_page import OrgMemberResultsPage
from .org_role import OrgRole
from .org_skill_response import OrgSkillResponse
from .orient_to_face import OrientToFace
from .origin_type import OriginType
from .output_file import OutputFile
Expand Down Expand Up @@ -372,6 +378,7 @@
from .reasoning_message import ReasoningMessage
from .reconfigure_stream import ReconfigureStream
from .region_get_query_point import RegionGetQueryPoint
from .region_get_resolvable_intersection_info import RegionGetResolvableIntersectionInfo
from .region_version import RegionVersion
from .relative_to import RelativeTo
from .remove_scene_objects import RemoveSceneObjects
Expand Down Expand Up @@ -541,4 +548,7 @@
from .zoo_product_subscriptions_org_request import ZooProductSubscriptionsOrgRequest
from .zoo_product_subscriptions_user_request import ZooProductSubscriptionsUserRequest
from .zoo_tool import ZooTool
from .zookeeper_auto_router_metadata import ZookeeperAutoRouterMetadata
from .zookeeper_edit_patch import ZookeeperEditPatch
from .zookeeper_edit_patch_file import ZookeeperEditPatchFile
from .zoom_to_fit import ZoomToFit
9 changes: 7 additions & 2 deletions kittycad/models/annotation_basic_dimension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Optional

from ..models.annotation_mbd_basic_dimension import AnnotationMbdBasicDimension
from ..models.edge_specifier import EdgeSpecifier
from ..models.point2d import Point2d
from .base import KittyCadBaseModel

Expand All @@ -16,7 +17,9 @@ class AnnotationBasicDimension(KittyCadBaseModel):

font_scale: float

from_entity_id: str
from_edge_reference: Optional[EdgeSpecifier] = None

from_entity_id: Optional[str] = None

from_entity_pos: Point2d

Expand All @@ -26,6 +29,8 @@ class AnnotationBasicDimension(KittyCadBaseModel):

precision: int

to_entity_id: str
to_edge_reference: Optional[EdgeSpecifier] = None

to_entity_id: Optional[str] = None

to_entity_pos: Point2d
5 changes: 4 additions & 1 deletion kittycad/models/annotation_feature_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from ..models.annotation_line_end import AnnotationLineEnd
from ..models.annotation_mbd_basic_dimension import AnnotationMbdBasicDimension
from ..models.annotation_mbd_control_frame import AnnotationMbdControlFrame
from ..models.edge_specifier import EdgeSpecifier
from ..models.point2d import Point2d
from .base import KittyCadBaseModel

Expand All @@ -16,7 +17,9 @@ class AnnotationFeatureControl(KittyCadBaseModel):

dimension: Optional[AnnotationMbdBasicDimension] = None

entity_id: str
edge_reference: Optional[EdgeSpecifier] = None

entity_id: Optional[str] = None

entity_pos: Point2d

Expand Down
Loading
Loading