Skip to content

Commit

Permalink
Revert "name instance method delete also"
Browse files Browse the repository at this point in the history
This reverts commit 505f8d6.
  • Loading branch information
howard-at-cb committed Jan 11, 2025
1 parent 505f8d6 commit f9d474f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions cdp/webhook.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from collections.abc import Iterator
import warnings

from cdp.cdp import Cdp
from cdp.client.models.create_webhook_request import CreateWebhookRequest
from cdp.client.models.update_webhook_request import UpdateWebhookRequest
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:
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit f9d474f

Please sign in to comment.