Webhook
- class AzuracastPy.models.Webhook(name: str, type: str, is_enabled: bool, triggers: List[str], config: Dict[str, Any], id: int, links: Links, _station)
Represents a webhook on a station.
- __init__(name: str, type: str, is_enabled: bool, triggers: List[str], config: Dict[str, Any], id: int, links: Links, _station)
Initializes a
Webhookinstance.Note
This class should not be initialized directly. Instead, obtain an instance via:
create(),__call__()orwebhooks().
- delete()
Deletes the webhook from the station.
Sets all attributes of the current
Webhookobject toNone.Usage:
webhook.delete()
- edit(name: str | None = None, webhook_config: Dict[str, Any] | None = None, triggers: List[WebhookTriggers] | None = None)
Edits the webhook’s properties.
Updates all edited attributes of the current
Webhookobject.- Parameters:
name – (Optional) The new name of the webhook. Default:
None.webhook_config – (Optional) The new config object for the webhook’s type. This can be generated using the
generate_webhook_config()function. Default:None.triggers –
(Optional) The new list of triggers for the webhook. Each element of the list must be from the
WebhookTriggersenum. Default:None.
Usage:
from AzuracastPy.enums import WebhookTriggers webhook.edit( name="New name lol", triggers=[ WebhookTriggers.LIVE_DISCONNECT ] )
- trigger
An instance of
TriggerHelper.Provides the interface for working with this webhook’s triggers.
For example, to add one or more triggers to the webhook:
from AzuracastPy.enums import WebhookTriggers webhook.trigger.add(WebhookTriggers.SONG_CHANGED) webhook.trigger.add( WebhookTriggers.SONG_CHANGED, WebhookTriggers.LIVE_CONNECT )
To remove one or more triggers from the webhook:
from AzuracastPy.enums import WebhookTriggers webhook.trigger.remove(WebhookTriggers.SONG_CHANGED) webhook.trigger.remove( WebhookTriggers.SONG_CHANGED, WebhookTriggers.LIVE_CONNECT )