import { APIResource } from "../../../../../core/resource.mjs"; import * as JobsAPI from "./jobs.mjs"; import { BaseJobs, JobCreateParams, JobCreateResponse, Jobs } from "./jobs.mjs"; import { APIPromise } from "../../../../../core/api-promise.mjs"; import { PagePromise, SinglePage } from "../../../../../core/pagination.mjs"; import { RequestOptions } from "../../../../../internal/request-options.mjs"; export declare class BaseWebhooks extends APIResource { static readonly _key: readonly ['zeroTrust', 'casb', 'posture', 'webhooks']; /** * Creates a new webhook configuration for sending finding notifications to * external endpoints. * * @example * ```ts * const webhook = * await client.zeroTrust.casb.posture.webhooks.create({ * account_id: '46148281d8a93d002ef242d8b0d5f9f6', * authentication_type: 'Bearer Auth', * destination_url: 'https://example.com/webhook', * label: 'Send to Slack', * }); * ``` */ create(params: WebhookCreateParams, options?: RequestOptions): APIPromise; /** * Updates an existing webhook configuration with new settings. * * @example * ```ts * const webhook = * await client.zeroTrust.casb.posture.webhooks.update( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { * account_id: '46148281d8a93d002ef242d8b0d5f9f6', * authentication_type: 'Bearer Auth', * destination_url: 'https://example.com/webhook', * label: 'Send to Slack', * status: 'enabled', * }, * ); * ``` */ update(webhookID: string, params: WebhookUpdateParams, options?: RequestOptions): APIPromise; /** * Retrieves all webhook configurations for the authenticated account. Returns an * array of webhook configurations that can be used to send finding notifications. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const webhookListResponse of client.zeroTrust.casb.posture.webhooks.list( * { account_id: '46148281d8a93d002ef242d8b0d5f9f6' }, * )) { * // ... * } * ``` */ list(params: WebhookListParams, options?: RequestOptions): PagePromise; /** * Soft deletes a webhook configuration by its unique identifier. The webhook will * be marked as deleted and will no longer be available for use. * * @example * ```ts * const webhook = * await client.zeroTrust.casb.posture.webhooks.delete( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '46148281d8a93d002ef242d8b0d5f9f6' }, * ); * ``` */ delete(webhookID: string, params: WebhookDeleteParams, options?: RequestOptions): APIPromise; /** * Sends a test webhook event to the specified destination URL to verify the * webhook endpoint is reachable and properly configured. This allows customers to * validate their webhook configuration before creating the actual webhook * resource. * * The test payload includes: * * - event_type: "webhook.test" * - timestamp: Current UTC timestamp * - message: Test message indicating this is from Cloudflare CASB * - data: Object with test: true * * @example * ```ts * const response = * await client.zeroTrust.casb.posture.webhooks.evaluate({ * account_id: '46148281d8a93d002ef242d8b0d5f9f6', * authentication_type: 'Bearer Auth', * destination_url: 'https://example.com/webhook', * }); * ``` */ evaluate(params: WebhookEvaluateParams, options?: RequestOptions): APIPromise; /** * Sends a test webhook event using an existing webhook configuration. This allows * customers to verify their webhook endpoint is still reachable and properly * configured after creating the webhook resource. * * The test payload includes: * * - event_type: "webhook.test" * - timestamp: Current UTC timestamp * - message: Test message indicating this is from Cloudflare CASB * - data: Object with test: true * * @example * ```ts * const response = * await client.zeroTrust.casb.posture.webhooks.evaluateExisting( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '46148281d8a93d002ef242d8b0d5f9f6' }, * ); * ``` */ evaluateExisting(webhookID: string, params: WebhookEvaluateExistingParams, options?: RequestOptions): APIPromise; /** * Retrieves a specific webhook configuration by its unique identifier. * * @example * ```ts * const webhook = * await client.zeroTrust.casb.posture.webhooks.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '46148281d8a93d002ef242d8b0d5f9f6' }, * ); * ``` */ get(webhookID: string, params: WebhookGetParams, options?: RequestOptions): APIPromise; } export declare class Webhooks extends BaseWebhooks { jobs: JobsAPI.Jobs; } export type WebhookListResponsesSinglePage = SinglePage; /** * Webhook configuration for sending finding notifications. */ export interface WebhookCreateResponse { /** * Unique identifier for the specific webhook configuration. */ id: string; /** * Type of authentication used for the webhook. */ authentication_type: 'Basic Auth' | 'None' | 'Bearer Auth' | 'Static Headers' | 'HMAC-Signing'; /** * Timestamp when the webhook configuration was created. */ created_at: string; /** * Target URL for the webhook configuration. Where resulting data will be sent. */ destination_url: string; /** * Account-specified display label for the webhook configuration. */ label: string; /** * Current status of the webhook configuration. If disabled, data cannot be sent * through this configuration. */ status: 'enabled' | 'disabled'; /** * Timestamp when the webhook configuration was last updated. */ updated_at: string; /** * Version number of the configuration. */ version: number; /** * List of header keys configured for this webhook. Values are not included for * security reasons. */ headers?: Array; } export declare namespace WebhookCreateResponse { interface Header { /** * Header key name (lowercase). */ key?: string; } } /** * Webhook configuration for sending finding notifications. */ export interface WebhookUpdateResponse { /** * Unique identifier for the specific webhook configuration. */ id: string; /** * Type of authentication used for the webhook. */ authentication_type: 'Basic Auth' | 'None' | 'Bearer Auth' | 'Static Headers' | 'HMAC-Signing'; /** * Timestamp when the webhook configuration was created. */ created_at: string; /** * Target URL for the webhook configuration. Where resulting data will be sent. */ destination_url: string; /** * Account-specified display label for the webhook configuration. */ label: string; /** * Current status of the webhook configuration. If disabled, data cannot be sent * through this configuration. */ status: 'enabled' | 'disabled'; /** * Timestamp when the webhook configuration was last updated. */ updated_at: string; /** * Version number of the configuration. */ version: number; /** * List of header keys configured for this webhook. Values are not included for * security reasons. */ headers?: Array; } export declare namespace WebhookUpdateResponse { interface Header { /** * Header key name (lowercase). */ key?: string; } } /** * Webhook configuration for sending finding notifications. */ export interface WebhookListResponse { /** * Unique identifier for the specific webhook configuration. */ id: string; /** * Type of authentication used for the webhook. */ authentication_type: 'Basic Auth' | 'None' | 'Bearer Auth' | 'Static Headers' | 'HMAC-Signing'; /** * Timestamp when the webhook configuration was created. */ created_at: string; /** * Target URL for the webhook configuration. Where resulting data will be sent. */ destination_url: string; /** * Account-specified display label for the webhook configuration. */ label: string; /** * Current status of the webhook configuration. If disabled, data cannot be sent * through this configuration. */ status: 'enabled' | 'disabled'; /** * Timestamp when the webhook configuration was last updated. */ updated_at: string; /** * Version number of the configuration. */ version: number; /** * List of header keys configured for this webhook. Values are not included for * security reasons. */ headers?: Array; } export declare namespace WebhookListResponse { interface Header { /** * Header key name (lowercase). */ key?: string; } } /** * Common response structure for all API endpoints. */ export interface WebhookDeleteResponse { errors: Array; messages: Array; /** * Whether the API call was successful. */ success: boolean; } export declare namespace WebhookDeleteResponse { interface Error { /** * Error or message code. */ code: number; /** * Human-readable message. */ message: string; /** * Link to relevant documentation. */ documentation_url?: string; source?: Error.Source; } namespace Error { interface Source { /** * JSON pointer to the source of the error. */ pointer?: string; } } interface Message { /** * Error or message code. */ code: number; /** * Human-readable message. */ message: string; /** * Link to relevant documentation. */ documentation_url?: string; source?: Message.Source; } namespace Message { interface Source { /** * JSON pointer to the source of the error. */ pointer?: string; } } } /** * Response body for webhook evaluation test results. */ export interface WebhookEvaluateResponse { /** * Human-readable message describing the test result. */ message: string; /** * HTTP status code returned by the webhook endpoint. 0 if connection failed. */ status_code: number; /** * Whether the webhook test was successful (received 2xx response). */ success: boolean; } /** * Response body for webhook evaluation test results. */ export interface WebhookEvaluateExistingResponse { /** * Human-readable message describing the test result. */ message: string; /** * HTTP status code returned by the webhook endpoint. 0 if connection failed. */ status_code: number; /** * Whether the webhook test was successful (received 2xx response). */ success: boolean; } /** * Webhook configuration for sending finding notifications. */ export interface WebhookGetResponse { /** * Unique identifier for the specific webhook configuration. */ id: string; /** * Type of authentication used for the webhook. */ authentication_type: 'Basic Auth' | 'None' | 'Bearer Auth' | 'Static Headers' | 'HMAC-Signing'; /** * Timestamp when the webhook configuration was created. */ created_at: string; /** * Target URL for the webhook configuration. Where resulting data will be sent. */ destination_url: string; /** * Account-specified display label for the webhook configuration. */ label: string; /** * Current status of the webhook configuration. If disabled, data cannot be sent * through this configuration. */ status: 'enabled' | 'disabled'; /** * Timestamp when the webhook configuration was last updated. */ updated_at: string; /** * Version number of the configuration. */ version: number; /** * List of header keys configured for this webhook. Values are not included for * security reasons. */ headers?: Array; } export declare namespace WebhookGetResponse { interface Header { /** * Header key name (lowercase). */ key?: string; } } export interface WebhookCreateParams { /** * Path param: Cloudflare account ID for the user making the request. */ account_id: string; /** * Body param: Type of authentication used for the webhook. */ authentication_type: 'Basic Auth' | 'None' | 'Bearer Auth' | 'Static Headers' | 'HMAC-Signing'; /** * Body param: Target URL for the webhook configuration. Where resulting data will * be sent. */ destination_url: string; /** * Body param: Account-specified display label for the webhook configuration. */ label: string; /** * Body param: List of custom headers to include in webhook requests. */ headers?: Array; /** * Body param: Secret key used for HMAC signing when authentication_type is * "HMAC-Signing". */ signing_secret?: string; } export declare namespace WebhookCreateParams { /** * A header to include in webhook requests. On Create/Evaluate, both key and value * are required. On Update, omitting value means "keep existing value". */ interface Header { /** * Header key name. */ key: string; /** * Header value. Required on Create and Evaluate. On Update, omit or set to null to * keep existing value. */ value?: string | null; } } export interface WebhookUpdateParams { /** * Path param: Cloudflare account ID for the user making the request. */ account_id: string; /** * Body param: Type of authentication used for the webhook. */ authentication_type: 'Basic Auth' | 'None' | 'Bearer Auth' | 'Static Headers' | 'HMAC-Signing'; /** * Body param: Target URL for the webhook configuration. Where resulting data will * be sent. */ destination_url: string; /** * Body param: Account-specified display label for the webhook configuration. */ label: string; /** * Body param: Status of the webhook configuration. */ status: 'enabled' | 'disabled'; /** * Body param: List of custom headers to include in webhook requests. */ headers?: Array; /** * Body param: Secret key used for HMAC signing when authentication_type is * "HMAC-Signing". */ signing_secret?: string; } export declare namespace WebhookUpdateParams { /** * A header to include in webhook requests. On Create/Evaluate, both key and value * are required. On Update, omitting value means "keep existing value". */ interface Header { /** * Header key name. */ key: string; /** * Header value. Required on Create and Evaluate. On Update, omit or set to null to * keep existing value. */ value?: string | null; } } export interface WebhookListParams { /** * Cloudflare account ID for the user making the request. */ account_id: string; } export interface WebhookDeleteParams { /** * Cloudflare account ID for the user making the request. */ account_id: string; } export interface WebhookEvaluateParams { /** * Path param: Cloudflare account ID for the user making the request. */ account_id: string; /** * Body param: Type of authentication to use for the test webhook request. */ authentication_type: 'Basic Auth' | 'None' | 'Bearer Auth' | 'Static Headers' | 'HMAC-Signing'; /** * Body param: Target URL to send the test webhook event to. */ destination_url: string; /** * Body param: List of custom headers to include in the test webhook request. */ headers?: Array; /** * Body param: Secret key used for HMAC signing when authentication_type is * "HMAC-Signing". */ signing_secret?: string; } export declare namespace WebhookEvaluateParams { /** * A header to include in webhook requests. On Create/Evaluate, both key and value * are required. On Update, omitting value means "keep existing value". */ interface Header { /** * Header key name. */ key: string; /** * Header value. Required on Create and Evaluate. On Update, omit or set to null to * keep existing value. */ value?: string | null; } } export interface WebhookEvaluateExistingParams { /** * Cloudflare account ID for the user making the request. */ account_id: string; } export interface WebhookGetParams { /** * Cloudflare account ID for the user making the request. */ account_id: string; } export declare namespace Webhooks { export { type WebhookCreateResponse as WebhookCreateResponse, type WebhookUpdateResponse as WebhookUpdateResponse, type WebhookListResponse as WebhookListResponse, type WebhookDeleteResponse as WebhookDeleteResponse, type WebhookEvaluateResponse as WebhookEvaluateResponse, type WebhookEvaluateExistingResponse as WebhookEvaluateExistingResponse, type WebhookGetResponse as WebhookGetResponse, type WebhookListResponsesSinglePage as WebhookListResponsesSinglePage, type WebhookCreateParams as WebhookCreateParams, type WebhookUpdateParams as WebhookUpdateParams, type WebhookListParams as WebhookListParams, type WebhookDeleteParams as WebhookDeleteParams, type WebhookEvaluateParams as WebhookEvaluateParams, type WebhookEvaluateExistingParams as WebhookEvaluateExistingParams, type WebhookGetParams as WebhookGetParams, }; export { Jobs as Jobs, BaseJobs as BaseJobs, type JobCreateResponse as JobCreateResponse, type JobCreateParams as JobCreateParams, }; } //# sourceMappingURL=webhooks.d.mts.map