From f9d474f6fadece73e70c0b8b3e7193f03694cae4 Mon Sep 17 00:00:00 2001 From: Howard Xie Date: Fri, 10 Jan 2025 17:19:37 -0800 Subject: [PATCH] Revert "name instance method delete also" This reverts commit 505f8d6b595ebfea1b79a5bd98ee51c997e1882c. --- cdp/webhook.py | 9 ++++----- tests/test_webhook.py | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cdp/webhook.py b/cdp/webhook.py index bffae38..4d11b8e 100644 --- a/cdp/webhook.py +++ b/cdp/webhook.py @@ -1,4 +1,5 @@ from collections.abc import Iterator +import warnings from cdp.cdp import Cdp from cdp.client.models.create_webhook_request import CreateWebhookRequest @@ -6,7 +7,6 @@ from cdp.client.models.webhook import Webhook as WebhookModel from cdp.client.models.webhook import WebhookEventFilter, WebhookEventType, WebhookEventTypeFilter from cdp.client.models.webhook_list import WebhookList -import warnings class Webhook: @@ -142,21 +142,20 @@ def delete(webhook_id: str) -> None: """Delete a webhook by its ID. Args: - webhook_id (str): The ID of the webhook to delete. Deprecated: This static method is deprecated. Please use the instance method instead: - webhook_instance.delete() + webhook_instance.delete_webhook() """ warnings.warn( - "This static method is deprecated. Please use the instance method instead: webhook_instance.delete()", + "This static method is deprecated. Please use the instance method instead: webhook_instance.delete_webhook()", DeprecationWarning, stacklevel=2, ) Cdp.api_clients.webhooks.delete_webhook(webhook_id) - def delete(self) -> None: + def delete_webhook(self) -> None: """Delete this webhook. This method deletes the current webhook instance from the system. diff --git a/tests/test_webhook.py b/tests/test_webhook.py index 77553cb..f19557b 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -100,9 +100,9 @@ def test_webhook_instance_delete(mock_api_clients, webhook_factory): """Test Webhook instance delete method.""" # Create a webhook instance using the factory webhook = Webhook(model=webhook_factory(webhook_id="webhook-123")) - + # Call delete on the webhook instance - webhook.delete() + webhook.delete_webhook() # Verify the API client was called with the correct webhook ID mock_api_clients.webhooks.delete_webhook.assert_called_once_with("webhook-123")