V2_WebhooksAPI

new V2_WebhooksAPI(rest)

This class is used to interact with Webhooks in TidyHQ.
Parameters:
NameTypeDescription
restRestThe rest instance to use for requests.

Methods

(async) activateWebhook(id, optionsopt) → {Promise.<TidyAPI_EmptyResponse>}

This function is used to activate a Webhook.
Parameters:
NameTypeAttributesDefaultDescription
idstringThe ID of the Webhook.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An empty response.
Type: 
Promise.<TidyAPI_EmptyResponse>

(async) createWebhook(url, matching_kind, description, optionsopt) → {Promise.<TidyAPI_V2_Webhook>}

Create a new Webhook.
Parameters:
NameTypeAttributesDefaultDescription
urlstringThe URL of the Webhook to listen to.
matching_kindstringThe kind of event to listen for.
descriptionstringThe description of the Webhook.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
allow_state_changesboolean<optional>
If the Webhook should allow state changes, or terminate on the first state change.
Returns:
- The new Webhook.
Type: 
Promise.<TidyAPI_V2_Webhook>

(async) deactivateWebhook(id, optionsopt) → {Promise.<TidyAPI_EmptyResponse>}

Deactivate a Webhook.
Parameters:
NameTypeAttributesDefaultDescription
idstringThe ID of the Webhook.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An empty response.
Type: 
Promise.<TidyAPI_EmptyResponse>

(async) deleteWebhook(id, optionsopt) → {Promise.<TidyAPI_EmptyResponse>}

Delete a Webhook.
Parameters:
NameTypeAttributesDefaultDescription
idstringThe ID of the Webhook.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An empty response.
Type: 
Promise.<TidyAPI_EmptyResponse>

(async) getWebhook(id, optionsopt) → {Promise.<TidyAPI_V2_Webhook>}

Get a Webhook by its ID.
Parameters:
NameTypeAttributesDefaultDescription
idstringThe ID of the Webhook.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The Webhook.
Type: 
Promise.<TidyAPI_V2_Webhook>

(async) getWebhooks(optionsopt) → {Promise.<TidyAPI_V2_Webhooks>}

Get a list of all Webhooks.
Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The list of Webhooks.
Type: 
Promise.<TidyAPI_V2_Webhooks>