From 56b0249ed24ebde0cfde2f26e6cc53701b31ce9b Mon Sep 17 00:00:00 2001 From: Adam Jenkins Date: Wed, 30 Jul 2025 08:10:11 -0300 Subject: [PATCH] Expose SDK method to delete an organization domain --- tests/test_organizations.py | 19 +++++++++++++++++++ workos/organizations.py | 25 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/tests/test_organizations.py b/tests/test_organizations.py index 87598466..789da120 100644 --- a/tests/test_organizations.py +++ b/tests/test_organizations.py @@ -218,6 +218,25 @@ def test_delete_organization(self, capture_and_mock_http_client_request): assert request_kwargs["method"] == "delete" assert response is None + def test_delete_organization_domain(self, capture_and_mock_http_client_request): + request_kwargs = capture_and_mock_http_client_request( + self.http_client, + 204, + headers={"content-type": "text/plain; charset=utf-8"}, + ) + + response = syncify( + self.organizations.delete_organization_domain( + organization_domain_id="org_domain_01EHT88Z8WZEFWYPM6EC9BX2R8" + ) + ) + + assert request_kwargs["url"].endswith( + "/organization_domains/org_domain_01EHT88Z8WZEFWYPM6EC9BX2R8" + ) + assert request_kwargs["method"] == "delete" + assert response is None + def test_list_organizations_auto_pagination_for_single_page( self, mock_organizations_single_page_response, diff --git a/workos/organizations.py b/workos/organizations.py index f60ff703..4c24b16c 100644 --- a/workos/organizations.py +++ b/workos/organizations.py @@ -128,6 +128,19 @@ def delete_organization(self, organization_id: str) -> SyncOrAsync[None]: """ ... + def delete_organization_domain( + self, organization_domain_id: str + ) -> SyncOrAsync[None]: + """Deletes a single Organization Domain + + Args: + organization_domain_id (str): Organization Domain unique identifier + + Returns: + None + """ + ... + class Organizations(OrganizationsModule): _http_client: SyncHTTPClient @@ -239,6 +252,12 @@ def delete_organization(self, organization_id: str) -> None: method=REQUEST_METHOD_DELETE, ) + def delete_organization_domain(self, organization_domain_id: str) -> None: + self._http_client.request( + f"organization_domains/{organization_domain_id}", + method=REQUEST_METHOD_DELETE, + ) + def list_organization_roles(self, organization_id: str) -> RoleList: response = self._http_client.request( f"organizations/{organization_id}/roles", @@ -358,6 +377,12 @@ async def delete_organization(self, organization_id: str) -> None: method=REQUEST_METHOD_DELETE, ) + async def delete_organization_domain(self, organization_domain_id: str) -> None: + await self._http_client.request( + f"organization_domains/{organization_domain_id}", + method=REQUEST_METHOD_DELETE, + ) + async def list_organization_roles(self, organization_id: str) -> RoleList: response = await self._http_client.request( f"organizations/{organization_id}/roles",