-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,86 @@ | ||
export type WebhookNotification = { | ||
data: WebhookData; | ||
message: WebhookMessage; | ||
type WebhookPublishedDeliverySlot = "published"; | ||
type WebhookPreviewDeliverySlot = "preview"; | ||
|
||
export type WebhookDeliverySlot = WebhookPublishedDeliverySlot | WebhookPreviewDeliverySlot; | ||
|
||
type CommonEvents = "created" | "deleted"; | ||
export type AssetEvents = CommonEvents | "metadata_changed"; | ||
export type ContentItemPreviewEvents = CommonEvents | "workflow_step_changed" | "metadata_changed"; | ||
export type ContentItemPublishedEvents = "published" | "unpublished" | "metadata_changed"; | ||
export type ContentTypeEvents = CommonEvents | "changed"; | ||
export type LanguageEvents = CommonEvents | "changed"; | ||
export type TaxonomyEvents = | ||
| CommonEvents | ||
| "metadata_changed" | ||
| "term_created" | ||
| "term_changed" | ||
| "term_deleted" | ||
| "terms_moved"; | ||
|
||
export type WebhookNotification = WebhookItemNotification | WebhookObjectNotification; | ||
|
||
export type WebhookItemNotification = { | ||
data: { | ||
system: WebhookItemObjectData; | ||
}; | ||
message: ContentItemPreviewMessage | ContentItemPublishedMessage; | ||
}; | ||
|
||
export type WebhookMessage = { | ||
export type WebhookObjectNotification = { | ||
data: { | ||
system: WebhookObjectData; | ||
}; | ||
message: AssetMesage | ContentTypeMessage | LanguageMessage | TaxonomyMessage; | ||
}; | ||
|
||
type WebhookMessageCommon = { | ||
environment_id: string; | ||
object_type: string; | ||
action: string; | ||
delivery_slot: string; | ||
delivery_slot: WebhookDeliverySlot; | ||
}; | ||
|
||
export type AssetMesage = WebhookMessageCommon & { | ||
object_type: "asset"; | ||
action: AssetEvents; | ||
}; | ||
|
||
export type ContentItemPreviewMessage = WebhookMessageCommon & { | ||
object_type: "content_item"; | ||
action: ContentItemPreviewEvents; | ||
delivery_slot: WebhookPreviewDeliverySlot; | ||
}; | ||
|
||
export type ContentItemPublishedMessage = WebhookMessageCommon & { | ||
object_type: "content_item"; | ||
action: ContentItemPublishedEvents; | ||
delivery_slot: WebhookPublishedDeliverySlot; | ||
}; | ||
|
||
export type ContentTypeMessage = WebhookMessageCommon & { | ||
object_type: "content_type"; | ||
action: ContentTypeEvents; | ||
}; | ||
|
||
export type LanguageMessage = WebhookMessageCommon & { | ||
object_type: "language"; | ||
action: LanguageEvents; | ||
}; | ||
|
||
export type WebhookData = { | ||
system: WebhookObject | WebhookItemObject; | ||
export type TaxonomyMessage = WebhookMessageCommon & { | ||
object_type: "taxonomy"; | ||
action: TaxonomyEvents; | ||
}; | ||
|
||
export type WebhookObject = { | ||
export type WebhookObjectData = { | ||
id: string; | ||
name: string; | ||
codename: string; | ||
last_modified: string; | ||
}; | ||
|
||
export type WebhookItemObject = { | ||
export type WebhookItemObjectData = { | ||
collection: string; | ||
workflow: string; | ||
workflow_step: string; | ||
language: string; | ||
type: string; | ||
} & WebhookObject; | ||
} & WebhookObjectData; |