import { APIResource } from "../core/resource.mjs"; import * as WebhooksAPI from "./webhooks.mjs"; import { APIPromise } from "../core/api-promise.mjs"; import { PagePromise, PaginatedResults, type PaginatedResultsParams } from "../core/pagination.mjs"; import { RequestOptions } from "../internal/request-options.mjs"; export declare class Notifications extends APIResource { /** * Create a new notification for a job event * * @example * ```ts * const notification = await client.notifications.create({ * event: 'job.completed', * object_id: 'job_A1cce6120E56e7Tu9ioP09Nhjk9', * webhook_id: 'wh_A1cce6120E56e7Tu9ioP09Nhjk9', * }); * ``` */ create(body: NotificationCreateParams, options?: RequestOptions): APIPromise; /** * Retrieve details of a specific notification * * @example * ```ts * const notification = await client.notifications.retrieve( * 'notificationId', * ); * ``` */ retrieve(notificationID: string, options?: RequestOptions): APIPromise; /** * Retrieve a list of notifications with optional filtering and pagination * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const notification of client.notifications.list()) { * // ... * } * ``` */ list(query?: NotificationListParams | null | undefined, options?: RequestOptions): PagePromise; /** * Delete a notification. * * @example * ```ts * await client.notifications.delete('notificationId'); * ``` */ delete(notificationID: string, options?: RequestOptions): APIPromise; } export type NotificationsPaginatedResults = PaginatedResults; export interface Notification { /** * Unique identifier of the notification */ id: string; /** * Timestamp when the notification was created */ created_at: string; /** * Type of event that triggered this notification */ event: 'job.completed' | 'job.failed' | 'job.cancelled' | 'upload.completed' | 'upload.failed' | 'upload.expired'; /** * ID of the object that triggered this notification */ object_id: string; /** * JSON payload that was sent to the webhook endpoint */ payload: string; /** * Webhook endpoint configuration that received this notification */ webhook: WebhooksAPI.Webhook; /** * HTTP status code received from the webhook endpoint */ response_status_code?: number; } export interface NotificationCreateParams { /** * Event specifies the type of event that triggered the notification. */ event: 'job.completed' | 'job.failed' | 'job.cancelled' | 'upload.completed' | 'upload.failed' | 'upload.expired'; /** * ObjectId specifies the object that triggered this notification. */ object_id: string; /** * WebhookId specifies the webhook endpoint that will receive the notification. */ webhook_id: string; } export interface NotificationListParams extends PaginatedResultsParams { created?: NotificationListParams.Created; /** * Filter by events */ events?: Array<'job.completed' | 'job.failed' | 'job.cancelled' | 'upload.completed' | 'upload.failed' | 'upload.expired'>; /** * Filter by object ID */ object_id?: string; response_status_code?: NotificationListParams.ResponseStatusCode; /** * Filter by webhook ID */ webhook_id?: string; } export declare namespace NotificationListParams { interface Created { /** * Filter by creation date greater than or equal (UNIX epoch time) */ gte?: number; /** * Filter by creation date less than or equal (UNIX epoch time) */ lte?: number; /** * Sort by creation date (asc/desc) */ sort?: 'asc' | 'desc'; } interface ResponseStatusCode { /** * Filter by exact response status code */ eq?: number; /** * Filter by response status code greater than or equal */ gte?: number; /** * Filter by response status code less than or equal */ lte?: number; } } export declare namespace Notifications { export { type Notification as Notification, type NotificationsPaginatedResults as NotificationsPaginatedResults, type NotificationCreateParams as NotificationCreateParams, type NotificationListParams as NotificationListParams, }; } //# sourceMappingURL=notifications.d.mts.map