import { z } from 'zod'; import { type APIClient } from '../api.ts'; import { type CreateDestinationRequest, type DeliveryLog, type Destination, type ListDeliveryLogsRequest, type QueueApiOptions, type UpdateDestinationRequest } from './types.ts'; export declare const DestinationResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ success: z.ZodLiteral; message: z.ZodString; code: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ success: z.ZodLiteral; data: z.ZodObject<{ destination: z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodOptional>; queue_id: z.ZodString; destination_type: z.ZodEnum<{ email: "email"; http: "http"; queue: "queue"; sandbox: "sandbox"; url: "url"; webhook: "webhook"; }>; config: z.ZodUnion>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ queue_id: z.ZodString; }, z.core.$strip>, z.ZodObject<{ sandbox_id: z.ZodString; }, z.core.$strip>, z.ZodObject<{ email_address: z.ZodString; }, z.core.$strip>, z.ZodOptional>]>; enabled: z.ZodBoolean; stats: z.ZodOptional>; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; }, z.core.$strip>>; success_count: z.ZodOptional; failure_count: z.ZodOptional; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; last_failure_error: z.ZodOptional>; created_at: z.ZodString; updated_at: z.ZodString; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>], "success">; export declare const DestinationsListResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ success: z.ZodLiteral; message: z.ZodString; code: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ success: z.ZodLiteral; data: z.ZodObject<{ destinations: z.ZodArray>; queue_id: z.ZodString; destination_type: z.ZodEnum<{ email: "email"; http: "http"; queue: "queue"; sandbox: "sandbox"; url: "url"; webhook: "webhook"; }>; config: z.ZodUnion>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ queue_id: z.ZodString; }, z.core.$strip>, z.ZodObject<{ sandbox_id: z.ZodString; }, z.core.$strip>, z.ZodObject<{ email_address: z.ZodString; }, z.core.$strip>, z.ZodOptional>]>; enabled: z.ZodBoolean; stats: z.ZodOptional>; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; }, z.core.$strip>>; success_count: z.ZodOptional; failure_count: z.ZodOptional; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; last_failure_error: z.ZodOptional>; created_at: z.ZodString; updated_at: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>], "success">; export declare const DeleteDestinationResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ success: z.ZodLiteral; message: z.ZodString; code: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ success: z.ZodLiteral; }, z.core.$strip>], "success">; /** * Create a destination for a queue. * * Destinations are webhook endpoints that automatically receive messages when * they are published to a queue. When a message is published, it will be * delivered via HTTP POST to all active destinations configured for that queue. * * @param client - The API client instance * @param queueName - The name of the queue to add the destination to * @param params - Destination configuration including URL and optional settings * @returns The created destination with assigned ID * @throws {QueueValidationError} If validation fails (invalid queue name or config) * @throws {QueueNotFoundError} If the queue does not exist * @throws {QueueError} If the API request fails * * @example * ```typescript * const destination = await createDestination(client, 'order-events', { * url: 'https://api.example.com/webhooks/orders', * config: { * retry_attempts: 3, * timeout_seconds: 30, * }, * }); * console.log(`Created destination ${destination.id}`); * ``` */ export declare function createDestination(client: APIClient, queueName: string, params: CreateDestinationRequest, options?: QueueApiOptions): Promise; /** * List all destinations for a queue. * * Retrieves all webhook destinations configured for a queue. Each destination * represents an endpoint that receives messages when they are published. * * @param client - The API client instance * @param queueName - The name of the queue * @returns Array of destinations configured for the queue * @throws {QueueValidationError} If validation fails (invalid queue name) * @throws {QueueNotFoundError} If the queue does not exist * @throws {QueueError} If the API request fails * * @example * ```typescript * const destinations = await listDestinations(client, 'order-events'); * for (const dest of destinations) { * console.log(`Destination ${dest.id}: ${dest.url} (${dest.enabled ? 'enabled' : 'disabled'})`); * } * ``` */ export declare function listDestinations(client: APIClient, queueName: string, options?: QueueApiOptions): Promise; /** * Update a destination's configuration. * * Modifies an existing destination's settings such as URL, enabled status, * or retry configuration. Only the fields provided in params will be updated. * * @param client - The API client instance * @param queueName - The name of the queue * @param destinationId - The destination ID to update (prefixed with qdest_) * @param params - Fields to update (partial update supported) * @returns The updated destination * @throws {QueueValidationError} If validation fails (invalid queue name, destination ID, or config) * @throws {DestinationNotFoundError} If the destination does not exist * @throws {QueueNotFoundError} If the queue does not exist * @throws {QueueError} If the API request fails * * @example * ```typescript * // Disable a destination temporarily * const updated = await updateDestination(client, 'order-events', 'qdest_abc123', { * enabled: false, * }); * * // Update URL and retry settings * const updated = await updateDestination(client, 'order-events', 'qdest_abc123', { * url: 'https://api.example.com/v2/webhooks/orders', * config: { * retry_attempts: 5, * }, * }); * ``` */ export declare function updateDestination(client: APIClient, queueName: string, destinationId: string, params: UpdateDestinationRequest, options?: QueueApiOptions): Promise; /** * Delete a destination from a queue. * * Permanently removes a webhook destination. Messages will no longer be * delivered to this endpoint. This action cannot be undone. * * @param client - The API client instance * @param queueName - The name of the queue * @param destinationId - The destination ID to delete (prefixed with qdest_) * @returns void * @throws {QueueValidationError} If validation fails (invalid queue name or destination ID) * @throws {DestinationNotFoundError} If the destination does not exist * @throws {QueueNotFoundError} If the queue does not exist * @throws {QueueError} If the API request fails * * @example * ```typescript * await deleteDestination(client, 'order-events', 'qdest_abc123'); * console.log('Destination deleted'); * ``` */ export declare function deleteDestination(client: APIClient, queueName: string, destinationId: string, options?: QueueApiOptions): Promise; export declare const DeliveryLogsListResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ success: z.ZodLiteral; message: z.ZodString; code: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ success: z.ZodLiteral; data: z.ZodObject<{ deliveries: z.ZodArray; status: z.ZodEnum<{ failed: "failed"; pending: "pending"; success: "success"; }>; http_status_code: z.ZodOptional>; error: z.ZodOptional>; duration_ms: z.ZodOptional; attempt_number: z.ZodOptional; request_headers: z.ZodOptional>; response_headers: z.ZodOptional>; delivered_at: z.ZodString; created_at: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>], "success">; /** * List delivery attempts for a queue destination. * * Returns the most recent delivery attempts to a configured webhook destination, * including HTTP status codes, timing, and error details for failed deliveries. * * @param client - The API client instance * @param queueName - The name of the queue * @param destinationId - The destination ID (prefixed with qdest_) * @param params - Optional filtering and pagination * @returns Array of delivery log entries * @throws {QueueValidationError} If validation fails * @throws {DestinationNotFoundError} If the destination does not exist * @throws {QueueError} If the API request fails * * @example * ```typescript * const deliveries = await listDestinationDeliveries(client, 'order-events', 'qdest_abc123', { * limit: 50, * status: 'failed', * }); * ``` */ export declare function listDestinationDeliveries(client: APIClient, queueName: string, destinationId: string, params?: ListDeliveryLogsRequest, options?: QueueApiOptions): Promise; //# sourceMappingURL=destinations.d.ts.map