UNPKG

@kontent-ai/management-sdk

Version:
209 lines (208 loc) 9.09 kB
import { WebhookContracts } from '../../contracts/webhook-contracts'; import { SharedModels } from '../shared/shared-models'; export declare namespace WebhookModels { type WebhookWorkflowStepOperation = 'publish' | 'unpublish' | 'archive' | 'restore' | 'upsert'; type WebhookContentTypeActions = 'created' | 'changed' | 'deleted'; type WebhookAssetActions = 'created' | 'changed' | 'metadata_changed' | 'deleted'; type WebhookTaxonomyActions = 'created' | 'metadata_changed' | 'deleted' | 'term_created' | 'term_changed' | 'term_deleted' | 'terms_moved'; type WebhookLanguageActions = 'created' | 'changed' | 'deleted'; type WebhookContentItemActions = 'published' | 'unpublished' | 'created' | 'changed' | 'metadata_changed' | 'deleted' | 'workflow_step_changed'; type WebhookManagementContentChangesOperations = 'archive' | 'create' | 'restore'; type WebhookPreviewContentChangesOperations = 'archive' | 'upsert' | 'restore'; type WebhookDeliveryTriggerSlots = 'published' | 'preview'; type WebhookDeliveryTriggersEvents = 'all' | 'specific'; type WebhookHealthStatus = 'unknown' | 'working' | 'failing' | 'dead'; interface IAddLegacyWebhookData { name: string; secret: string; url: string; enabled?: boolean; triggers: { delivery_api_content_changes?: WebhookContracts.ILegacyWebhookDeliveryApiContentChangesContract[]; preview_delivery_api_content_changes?: WebhookContracts.ILegacyWebhookPreviewDeliveryApiContentChangesContract[]; workflow_step_changes?: WebhookContracts.ILegacyWebhookWorkflowStepChangesContract[]; management_api_content_changes?: WebhookContracts.ILegacyWebhookManagementApiContentChangesContract[]; }; } interface IAddWebhookData { name: string; secret: string; url: string; enabled?: boolean; headers?: IWebhookHeader[]; delivery_triggers: { slot: WebhookDeliveryTriggerSlots; events: WebhookDeliveryTriggersEvents; asset?: WebhookContracts.IWebhookAssetContract; content_type?: WebhookContracts.IWebhookContentTypeContract; taxonomy?: WebhookContracts.IWebhookTaxonomyContract; language?: WebhookContracts.IWebhookLanguageContract; content_item?: WebhookContracts.IWebhookContentItemContract; }; } class WebhookDeliveryTriggersContentType { enabled: boolean; actions?: WebhookContracts.WebhookAction<WebhookContentTypeActions>[]; filters?: WebhookContracts.IContentTypeFilters; constructor(data: { enabled: boolean; actions?: WebhookContracts.WebhookAction<WebhookContentTypeActions>[]; filters?: WebhookContracts.IContentTypeFilters; }); } class WebhookDeliveryTriggersAsset { enabled: boolean; actions?: WebhookContracts.WebhookAction<WebhookAssetActions>[]; constructor(data: { enabled: boolean; actions?: WebhookContracts.WebhookAction<WebhookAssetActions>[]; }); } class WebhookDeliveryTriggersTaxonomy { enabled: boolean; actions?: WebhookContracts.WebhookAction<WebhookTaxonomyActions>[]; filters?: WebhookContracts.ITaxonomyFilters; constructor(data: { enabled: boolean; actions?: WebhookContracts.WebhookAction<WebhookTaxonomyActions>[]; filters?: WebhookContracts.ITaxonomyFilters; }); } class WebhookDeliveryTriggersLanguage { enabled: boolean; actions?: WebhookContracts.WebhookAction<WebhookLanguageActions>[]; filters?: WebhookContracts.ILanguageFilters; constructor(data: { enabled: boolean; actions?: WebhookContracts.WebhookAction<WebhookLanguageActions>[]; filters?: WebhookContracts.ILanguageFilters; }); } class WebhookDeliveryTriggersContentItem { enabled: boolean; actions?: (WebhookContracts.WebhookAction<WebhookContentItemActions> & { transition_to?: WebhookContracts.ContentItemTransitionTo[]; })[]; filters?: WebhookContracts.IContentItemFilters; constructor(data: { enabled: boolean; actions?: (WebhookContracts.WebhookAction<WebhookContentItemActions> & { transition_to?: WebhookContracts.ContentItemTransitionTo[]; })[]; filters?: WebhookContracts.IContentItemFilters; }); } class WebhookTransitionsTo { id: string; constructor(data: { id: string; }); } class LegacyWebhookWorkflowStepChanges { type: 'content_item_variant'; transitionsTo: WebhookTransitionsTo[]; constructor(data: { type: 'content_item_variant'; transitionsTo: WebhookTransitionsTo[]; }); } class LegacyWebhookDeliveryApiContentChanges { type: 'taxonomy' | 'content_item_variant'; operations: WebhookWorkflowStepOperation[]; constructor(data: { type: 'taxonomy' | 'content_item_variant'; operations: WebhookWorkflowStepOperation[]; }); } class LegacyWebhookPreviewDeliveryApiContentChanges { type: 'taxonomy' | 'content_item_variant'; operations: WebhookPreviewContentChangesOperations[]; constructor(data: { type: 'taxonomy' | 'content_item_variant'; operations: WebhookPreviewContentChangesOperations[]; }); } class LegacyWebhookManagementApiContentChanges { type: 'taxonomy' | 'content_item_variant'; operations: WebhookManagementContentChangesOperations[]; constructor(data: { type: 'taxonomy' | 'content_item_variant'; operations: WebhookManagementContentChangesOperations[]; }); } interface IWebhookHeader { key: string; value: string; } class Webhook implements SharedModels.IBaseModel<WebhookContracts.IWebhookContract> { id: string; name: string; secret: string; url: string; enabled?: boolean; lastModified?: Date; healthStatus?: WebhookHealthStatus; headers?: IWebhookHeader[]; deliveryTriggers: { slot: WebhookDeliveryTriggerSlots; events: WebhookDeliveryTriggersEvents; asset?: WebhookContracts.IWebhookAssetContract; contentType?: WebhookContracts.IWebhookContentTypeContract; taxonomy?: WebhookContracts.IWebhookTaxonomyContract; language?: WebhookContracts.IWebhookLanguageContract; contentItem?: WebhookContracts.IWebhookContentItemContract; }; _raw: WebhookContracts.IWebhookContract; constructor(data: { id: string; name: string; secret: string; url: string; enabled?: boolean; lastModified?: Date; healthStatus?: WebhookHealthStatus; headers?: IWebhookHeader[]; deliveryTriggers: { slot: WebhookDeliveryTriggerSlots; events: WebhookDeliveryTriggersEvents; asset?: WebhookContracts.IWebhookAssetContract; contentType?: WebhookContracts.IWebhookContentTypeContract; taxonomy?: WebhookContracts.IWebhookTaxonomyContract; language?: WebhookContracts.IWebhookLanguageContract; contentItem?: WebhookContracts.IWebhookContentItemContract; }; _raw: WebhookContracts.IWebhookContract; }); } class LegacyWebhook implements SharedModels.IBaseModel<WebhookContracts.ILegacyWebhookContract> { id: string; name: string; secret: string; url: string; enabled?: boolean; healthStatus?: string; lastModified?: Date; triggers: { deliveryApiContentChanges: LegacyWebhookDeliveryApiContentChanges[]; previewDeliveryContentChanges: LegacyWebhookPreviewDeliveryApiContentChanges[]; workflowStepChanges: LegacyWebhookWorkflowStepChanges[]; managementApiContentChanges: LegacyWebhookManagementApiContentChanges[]; }; _raw: WebhookContracts.ILegacyWebhookContract; constructor(data: { id: string; name: string; secret: string; url: string; healthStatus?: string; lastModified?: Date; triggers: { deliveryApiContentChanges: LegacyWebhookDeliveryApiContentChanges[]; workflowStepChanges: LegacyWebhookWorkflowStepChanges[]; previewDeliveryContentChanges: LegacyWebhookPreviewDeliveryApiContentChanges[]; managementApiContentChanges: LegacyWebhookManagementApiContentChanges[]; }; _raw: WebhookContracts.ILegacyWebhookContract; }); } }