"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Webhooks = void 0;
const webhookWebhooksCreate_js_1 = require("../funcs/webhookWebhooksCreate.js");
const webhookWebhooksDelete_js_1 = require("../funcs/webhookWebhooksDelete.js");
const webhookWebhooksGet_js_1 = require("../funcs/webhookWebhooksGet.js");
const webhookWebhooksList_js_1 = require("../funcs/webhookWebhooksList.js");
const webhookWebhooksUpdate_js_1 = require("../funcs/webhookWebhooksUpdate.js");
const sdks_js_1 = require("../lib/sdks.js");
const fp_js_1 = require("../types/fp.js");
const operations_js_1 = require("../types/operations.js");
class Webhooks extends sdks_js_1.ClientSDK {
    /**
     * List webhook subscriptions
     *
     * @remarks
     * List all webhook subscriptions
     */
    async list(request, options) {
        return (0, operations_js_1.unwrapResultIterator)((0, webhookWebhooksList_js_1.webhookWebhooksList)(this, request, options));
    }
    /**
     * Create webhook subscription
     *
     * @remarks
     * Create a webhook subscription to receive events.
     *
     * **Delivery URL Validation**: The provided `delivery_url` will be validated synchronously by sending an HTTP POST request with an HMAC signature. If validation fails (network error, timeout, non-2xx response), the webhook will still be created but with `status: "disabled"` and `disabled_reason: "delivery_url_validation_failed"`.
     *
     * **Important**: Always check the `status` and `disabled_reason` fields in the response to ensure the webhook is active.
     */
    async create(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, webhookWebhooksCreate_js_1.webhookWebhooksCreate)(this, request, options));
    }
    /**
     * Get webhook subscription
     *
     * @remarks
     * Get the webhook subscription details
     */
    async get(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, webhookWebhooksGet_js_1.webhookWebhooksGet)(this, request, options));
    }
    /**
     * Update webhook subscription
     *
     * @remarks
     * Update a webhook subscription.
     *
     * **Delivery URL Validation**: When updating the `delivery_url`, it will be validated synchronously by sending an HTTP POST request with an HMAC signature. If validation fails (network error, timeout, non-2xx response), the webhook will still be updated but with `status: "disabled"` and `disabled_reason: "delivery_url_validation_failed"`. Validation only occurs when the URL is changed.
     *
     * **Important**: Always check the `status` and `disabled_reason` fields in the response to ensure the webhook is active.
     */
    async update(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, webhookWebhooksUpdate_js_1.webhookWebhooksUpdate)(this, request, options));
    }
    /**
     * Delete webhook subscription
     *
     * @remarks
     * Delete a webhook subscription
     */
    async delete(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, webhookWebhooksDelete_js_1.webhookWebhooksDelete)(this, request, options));
    }
}
exports.Webhooks = Webhooks;
//# sourceMappingURL=webhooks.js.map