Constructor
new Webhook(apiKeyopt)
Create a new Webhook API client.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
apiKey |
string | null |
<optional> |
null | Your API key. If omitted, the `IDANALYZER_KEY` environment variable is used. |
- Source:
Extends
Methods
(async) deleteWebhook(webhookIdopt) → {Promise.<ApiResponse>}
Delete a webhook delivery log.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
webhookId |
string |
<optional> |
"" | Webhook delivery ID. |
- Source:
Throws:
-
If `webhookId` is empty.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
getApiKey(customKeyopt) → {string|null}
Resolve the API key, preferring the provided value and falling back to
the `IDANALYZER_KEY` environment variable.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
customKey |
string | null |
<optional> |
null | Explicitly supplied API key. |
- Overrides:
- Source:
Returns:
The resolved API key, or `null` if none is available.
- Type
- string | null
(async) listWebhook(orderopt, limitopt, offsetopt, eventopt, successopt, createdAtMinopt, createdAtMaxopt) → {Promise.<ApiResponse>}
List webhook delivery logs.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
order |
number |
<optional> |
-1 | Sort results by newest(-1) or oldest(1). |
limit |
number |
<optional> |
10 | Number of items to be returned per call. |
offset |
number |
<optional> |
0 | Start the list from a particular entry index. |
event |
string |
<optional> |
"" | Filter by event type. |
success |
number |
<optional> |
-1 | Filter by delivery success: 1=success, 0=failure, -1=no filter. |
createdAtMin |
string |
<optional> |
"" | List deliveries created after this timestamp. |
createdAtMax |
string |
<optional> |
"" | List deliveries created before this timestamp. |
- Source:
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
(async) resendWebhook(webhookIdopt) → {Promise.<ApiResponse>}
Resend a webhook delivery.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
webhookId |
string |
<optional> |
"" | Webhook delivery ID. |
- Source:
Throws:
-
If `webhookId` is empty.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
setParam(key, value) → {void}
Set an API parameter and its value, this function allows you to set any API parameter without using the built-in functions
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | Parameter key |
value |
* | Parameter value |
- Overrides:
- Source:
Returns:
- Type
- void
throwApiException(swopt) → {void}
Whether an exception should be thrown if API response contains an error message
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
sw |
boolean |
<optional> |
false | Set to `true` to throw an APIError when the API response contains an error, or `false` to return the raw error response instead. |
- Overrides:
- Source:
Returns:
- Type
- void