@@ -23,6 +23,21 @@ def baseurl(self) -> str:
2323
2424 @api (version = "3.6" )
2525 def get (self , req_options : Optional ["RequestOptions" ] = None ) -> tuple [list [WebhookItem ], PaginationItem ]:
26+ """
27+ Returns a list of all webhooks on the site.
28+
29+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#list_webhooks_for_site
30+
31+ Parameters
32+ ----------
33+ req_options : Optional[RequestOptions]
34+ Filter and sorting options for the request.
35+
36+ Returns
37+ -------
38+ tuple[list[WebhookItem], PaginationItem]
39+ A tuple of the list of webhooks and pagination item
40+ """
2641 logger .info ("Querying all Webhooks on site" )
2742 url = self .baseurl
2843 server_response = self .get_request (url , req_options )
@@ -32,6 +47,21 @@ def get(self, req_options: Optional["RequestOptions"] = None) -> tuple[list[Webh
3247
3348 @api (version = "3.6" )
3449 def get_by_id (self , webhook_id : str ) -> WebhookItem :
50+ """
51+ Returns information about a specified Webhook.
52+
53+ Rest API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#get_webhook
54+
55+ Parameters
56+ ----------
57+ webhook_id : str
58+ The ID of the webhook to query.
59+
60+ Returns
61+ -------
62+ WebhookItem
63+ An object containing information about the webhook.
64+ """
3565 if not webhook_id :
3666 error = "Webhook ID undefined."
3767 raise ValueError (error )
@@ -42,6 +72,20 @@ def get_by_id(self, webhook_id: str) -> WebhookItem:
4272
4373 @api (version = "3.6" )
4474 def delete (self , webhook_id : str ) -> None :
75+ """
76+ Deletes a specified webhook.
77+
78+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#delete_webhook
79+
80+ Parameters
81+ ----------
82+ webhook_id : str
83+ The ID of the webhook to delete.
84+
85+ Returns
86+ -------
87+ None
88+ """
4589 if not webhook_id :
4690 error = "Webhook ID undefined."
4791 raise ValueError (error )
@@ -51,6 +95,21 @@ def delete(self, webhook_id: str) -> None:
5195
5296 @api (version = "3.6" )
5397 def create (self , webhook_item : WebhookItem ) -> WebhookItem :
98+ """
99+ Creates a new webhook on the site.
100+
101+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#create_webhook
102+
103+ Parameters
104+ ----------
105+ webhook_item : WebhookItem
106+ The webhook item to create.
107+
108+ Returns
109+ -------
110+ WebhookItem
111+ An object containing information about the created webhook
112+ """
54113 url = self .baseurl
55114 create_req = RequestFactory .Webhook .create_req (webhook_item )
56115 server_response = self .post_request (url , create_req )
@@ -61,6 +120,24 @@ def create(self, webhook_item: WebhookItem) -> WebhookItem:
61120
62121 @api (version = "3.6" )
63122 def test (self , webhook_id : str ):
123+ """
124+ Tests the specified webhook. Sends an empty payload to the configured
125+ destination URL of the webhook and returns the response from the server.
126+ This is useful for testing, to ensure that things are being sent from
127+ Tableau and received back as expected.
128+
129+ Rest API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#test_webhook
130+
131+ Parameters
132+ ----------
133+ webhook_id : str
134+ The ID of the webhook to test.
135+
136+ Returns
137+ -------
138+ XML Response
139+
140+ """
64141 if not webhook_id :
65142 error = "Webhook ID undefined."
66143 raise ValueError (error )
0 commit comments