import type * as Extend from "../index"; /** * Union of all webhook event types. Use `eventType` as the discriminator * to determine the specific event type and narrow the `payload` type. * * Example usage in TypeScript: * ```typescript * function handleWebhook(event: Extend.WebhookEvent) { * switch (event.eventType) { * case "workflow_run.completed": * // event.payload is typed as WorkflowRun * console.log(event.payload.status); * break; * case "extract_run.processed": * // event.payload is typed as ExtractRun * console.log(event.payload.output); * break; * } * } * ``` */ export type WebhookEvent = Extend.WebhookEvent.WorkflowRunCompleted | Extend.WebhookEvent.WorkflowRunFailed | Extend.WebhookEvent.WorkflowRunNeedsReview | Extend.WebhookEvent.WorkflowRunRejected | Extend.WebhookEvent.WorkflowRunCancelled | Extend.WebhookEvent.WorkflowRunStepRunProcessed | Extend.WebhookEvent.ExtractRunProcessed | Extend.WebhookEvent.ExtractRunFailed | Extend.WebhookEvent.ClassifyRunProcessed | Extend.WebhookEvent.ClassifyRunFailed | Extend.WebhookEvent.SplitRunProcessed | Extend.WebhookEvent.SplitRunFailed | Extend.WebhookEvent.BatchProcessorRunProcessed | Extend.WebhookEvent.BatchProcessorRunFailed | Extend.WebhookEvent.BatchParseRunProcessed | Extend.WebhookEvent.BatchParseRunFailed | Extend.WebhookEvent.ParseRunProcessed | Extend.WebhookEvent.ParseRunFailed | Extend.WebhookEvent.EditRunProcessed | Extend.WebhookEvent.EditRunFailed | Extend.WebhookEvent.WorkflowCreated | Extend.WebhookEvent.WorkflowDeployed | Extend.WebhookEvent.WorkflowDeleted | Extend.WebhookEvent.ExtractorCreated | Extend.WebhookEvent.ExtractorUpdated | Extend.WebhookEvent.ExtractorDeleted | Extend.WebhookEvent.ExtractorDraftUpdated | Extend.WebhookEvent.ExtractorVersionPublished | Extend.WebhookEvent.ClassifierCreated | Extend.WebhookEvent.ClassifierUpdated | Extend.WebhookEvent.ClassifierDeleted | Extend.WebhookEvent.ClassifierDraftUpdated | Extend.WebhookEvent.ClassifierVersionPublished | Extend.WebhookEvent.SplitterCreated | Extend.WebhookEvent.SplitterUpdated | Extend.WebhookEvent.SplitterDeleted | Extend.WebhookEvent.SplitterDraftUpdated | Extend.WebhookEvent.SplitterVersionPublished; export declare namespace WebhookEvent { interface WorkflowRunCompleted extends Extend.WorkflowRunCompletedWebhookEvent { eventType: "workflow_run.completed"; } interface WorkflowRunFailed extends Extend.WorkflowRunFailedWebhookEvent { eventType: "workflow_run.failed"; } interface WorkflowRunNeedsReview extends Extend.WorkflowRunNeedsReviewWebhookEvent { eventType: "workflow_run.needs_review"; } interface WorkflowRunRejected extends Extend.WorkflowRunRejectedWebhookEvent { eventType: "workflow_run.rejected"; } interface WorkflowRunCancelled extends Extend.WorkflowRunCancelledWebhookEvent { eventType: "workflow_run.cancelled"; } interface WorkflowRunStepRunProcessed extends Extend.WorkflowRunStepRunProcessedWebhookEvent { eventType: "workflow_run.step_run.processed"; } interface ExtractRunProcessed extends Extend.ExtractRunProcessedWebhookEvent { eventType: "extract_run.processed"; } interface ExtractRunFailed extends Extend.ExtractRunFailedWebhookEvent { eventType: "extract_run.failed"; } interface ClassifyRunProcessed extends Extend.ClassifyRunProcessedWebhookEvent { eventType: "classify_run.processed"; } interface ClassifyRunFailed extends Extend.ClassifyRunFailedWebhookEvent { eventType: "classify_run.failed"; } interface SplitRunProcessed extends Extend.SplitRunProcessedWebhookEvent { eventType: "split_run.processed"; } interface SplitRunFailed extends Extend.SplitRunFailedWebhookEvent { eventType: "split_run.failed"; } interface BatchProcessorRunProcessed extends Extend.BatchProcessorRunCompletedWebhookEvent { eventType: "batch_processor_run.processed"; } interface BatchProcessorRunFailed extends Extend.BatchProcessorRunFailedWebhookEvent { eventType: "batch_processor_run.failed"; } interface BatchParseRunProcessed extends Extend.BatchParseRunCompletedWebhookEvent { eventType: "batch_parse_run.processed"; } interface BatchParseRunFailed extends Extend.BatchParseRunFailedWebhookEvent { eventType: "batch_parse_run.failed"; } interface ParseRunProcessed extends Extend.ParseRunProcessedWebhookEvent { eventType: "parse_run.processed"; } interface ParseRunFailed extends Extend.ParseRunFailedWebhookEvent { eventType: "parse_run.failed"; } interface EditRunProcessed extends Extend.EditRunProcessedWebhookEvent { eventType: "edit_run.processed"; } interface EditRunFailed extends Extend.EditRunFailedWebhookEvent { eventType: "edit_run.failed"; } interface WorkflowCreated extends Extend.WorkflowCreatedWebhookEvent { eventType: "workflow.created"; } interface WorkflowDeployed extends Extend.WorkflowDeployedWebhookEvent { eventType: "workflow.deployed"; } interface WorkflowDeleted extends Extend.WorkflowDeletedWebhookEvent { eventType: "workflow.deleted"; } interface ExtractorCreated extends Extend.ExtractorCreatedWebhookEvent { eventType: "extractor.created"; } interface ExtractorUpdated extends Extend.ExtractorUpdatedWebhookEvent { eventType: "extractor.updated"; } interface ExtractorDeleted extends Extend.ExtractorDeletedWebhookEvent { eventType: "extractor.deleted"; } interface ExtractorDraftUpdated extends Extend.ExtractorDraftUpdatedWebhookEvent { eventType: "extractor.draft.updated"; } interface ExtractorVersionPublished extends Extend.ExtractorVersionPublishedWebhookEvent { eventType: "extractor.version.published"; } interface ClassifierCreated extends Extend.ClassifierCreatedWebhookEvent { eventType: "classifier.created"; } interface ClassifierUpdated extends Extend.ClassifierUpdatedWebhookEvent { eventType: "classifier.updated"; } interface ClassifierDeleted extends Extend.ClassifierDeletedWebhookEvent { eventType: "classifier.deleted"; } interface ClassifierDraftUpdated extends Extend.ClassifierDraftUpdatedWebhookEvent { eventType: "classifier.draft.updated"; } interface ClassifierVersionPublished extends Extend.ClassifierVersionPublishedWebhookEvent { eventType: "classifier.version.published"; } interface SplitterCreated extends Extend.SplitterCreatedWebhookEvent { eventType: "splitter.created"; } interface SplitterUpdated extends Extend.SplitterUpdatedWebhookEvent { eventType: "splitter.updated"; } interface SplitterDeleted extends Extend.SplitterDeletedWebhookEvent { eventType: "splitter.deleted"; } interface SplitterDraftUpdated extends Extend.SplitterDraftUpdatedWebhookEvent { eventType: "splitter.draft.updated"; } interface SplitterVersionPublished extends Extend.SplitterVersionPublishedWebhookEvent { eventType: "splitter.version.published"; } }