-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add support for vnext webhooks API (#131)
* created new webhook contract, updated naming of legacy webhook contracts * created new webhook model, updated naming of legacy webhook models * created new webhook responses, updated legacy webhook responses * added new webhook delivery trigger models * added new webhook mappers, updated legacy webhook mappers. Maded needed adjustments to contracts, models * added new webhook endpoints and updated legacy webhook naming * added needed webhook queries to queries folder and query service class * added remaining legacy webhook query classes * updated query exports, updated management client with new webhook methods * added webhook tests and converted existing tests to legacy webhook * changed webhook trigger models to match API output. Finished test cases, all tests passing * made requested changes, updated models contracts test cases and fake responses accordingly * Uses provided type instead of string literal, restructures types * Adds missing enabled property, uses health status type, fixes tests property check --------- Co-authored-by: Richard Sustek <[email protected]>
- Loading branch information
Showing
35 changed files
with
1,339 additions
and
239 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
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
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,48 +1,131 @@ | ||
import { SharedContracts } from './shared-contracts'; | ||
|
||
export namespace WebhookContracts { | ||
export type WebhookWorkflowStepOperationContract = 'publish' | 'unpublish' | 'archive' | 'restore' | 'upsert'; | ||
export type WebhookManagementContentChangesOperations = 'archive' | 'create' | 'restore'; | ||
export type WebhookPreviewContentChangesOperations = 'archive' | 'upsert' | 'restore'; | ||
export type WebhookContentTypeActions = 'created' | 'changed' | 'deleted'; | ||
export type WebhookAssetActions = 'created' | 'changed' | 'metadata_changed' | 'deleted'; | ||
export type WebhookTaxonomyActions = | ||
| 'created' | ||
| 'metadata_changed' | ||
| 'deleted' | ||
| 'term_created' | ||
| 'term_changed' | ||
| 'term_deleted' | ||
| 'terms_moved'; | ||
export type WebhookLanguageActions = 'created' | 'changed' | 'deleted'; | ||
export type WebhookContentItemActions = | ||
| 'published' | ||
| 'unpublished' | ||
| 'created' | ||
| 'changed' | ||
| 'metadata_changed' | ||
| 'deleted' | ||
| 'workflow_step_changed'; | ||
export type WebhookDeliveryTriggerSlots = 'published' | 'preview'; | ||
export type WebhookDeliveryTriggersEvents = 'all' | 'specific'; | ||
|
||
export interface IDeleteWebhookResponseContract { | ||
} | ||
export interface IDeleteWebhookResponseContract {} | ||
|
||
export interface IWebhookTransitionsToContract { | ||
export interface ILegacyWebhookTransitionsToContract { | ||
id: string; | ||
} | ||
|
||
export type WebhookWorkflowStepOperationContract = 'publish' | 'unpublish' | 'archive' | 'restore' | 'upsert'; | ||
|
||
export type WebhookManagementContentChangesOperations = 'archive' | 'create' | 'restore'; | ||
|
||
export interface IWebhookWorkflowStepChangesContract { | ||
export interface ILegacyWebhookWorkflowStepChangesContract { | ||
type: 'content_item_variant'; | ||
transitions_to: IWebhookTransitionsToContract[]; | ||
transitions_to: ILegacyWebhookTransitionsToContract[]; | ||
} | ||
|
||
export interface IWebhookManagementApiContentChangesContract { | ||
export interface ILegacyWebhookManagementApiContentChangesContract { | ||
type: 'content_item_variant'; | ||
operations: WebhookManagementContentChangesOperations[]; | ||
} | ||
|
||
export interface IWebhookDeliveryApiContentChangesContract { | ||
export interface ILegacyWebhookDeliveryApiContentChangesContract { | ||
type: 'taxonomy' | 'content_item_variant'; | ||
operations: WebhookWorkflowStepOperationContract[]; | ||
} | ||
|
||
export interface IWebhookContract { | ||
export interface ILegacyWebhookPreviewDeliveryApiContentChangesContract { | ||
type: 'taxonomy' | 'content_item_variant'; | ||
operations: WebhookPreviewContentChangesOperations[]; | ||
} | ||
|
||
export interface IWebhookContentTypeContract { | ||
enabled: boolean; | ||
actions?: WebhookContentTypeActions[]; | ||
} | ||
|
||
export interface IWebhookAssetContract { | ||
enabled: boolean; | ||
actions?: WebhookAssetActions[]; | ||
} | ||
|
||
export interface IWebhookTaxonomyContract { | ||
enabled: boolean; | ||
actions?: WebhookTaxonomyActions[]; | ||
} | ||
|
||
export interface IWebhookLanguageContract { | ||
enabled: boolean; | ||
actions?: WebhookLanguageActions[]; | ||
} | ||
|
||
export interface IContentItemFilters { | ||
collections?: SharedContracts.IReferenceObjectContract[]; | ||
content_types?: SharedContracts.IReferenceObjectContract[]; | ||
languages?: SharedContracts.IReferenceObjectContract[]; | ||
} | ||
export interface IWebhookContentItemContract { | ||
enabled: boolean; | ||
actions?: WebhookContentItemActions[]; | ||
filters?: IContentItemFilters; | ||
} | ||
|
||
export interface ILegacyWebhookContract { | ||
id: string; | ||
name: string; | ||
secret: string; | ||
url: string; | ||
last_modified?: string; | ||
health_status?: string; | ||
triggers: { | ||
delivery_api_content_changes: IWebhookDeliveryApiContentChangesContract[], | ||
workflow_step_changes: IWebhookWorkflowStepChangesContract[], | ||
delivery_api_content_changes: ILegacyWebhookDeliveryApiContentChangesContract[]; | ||
workflow_step_changes: ILegacyWebhookWorkflowStepChangesContract[]; | ||
preview_delivery_api_content_changes: ILegacyWebhookPreviewDeliveryApiContentChangesContract[]; | ||
management_api_content_changes: ILegacyWebhookManagementApiContentChangesContract[]; | ||
}; | ||
} | ||
|
||
export interface IGetWebhookContract extends IWebhookContract { | ||
export interface IWebhookContract { | ||
id: string; | ||
name: string; | ||
secret: string; | ||
url: string; | ||
last_modified?: string; | ||
enabled?: boolean; | ||
health_status?: string; | ||
delivery_triggers: { | ||
slot: WebhookDeliveryTriggerSlots; | ||
events: WebhookDeliveryTriggersEvents; | ||
asset?: IWebhookAssetContract; | ||
content_type?: IWebhookContentTypeContract; | ||
taxonomy?: IWebhookTaxonomyContract; | ||
language?: IWebhookLanguageContract; | ||
content_item?: IWebhookContentItemContract; | ||
}; | ||
} | ||
|
||
export interface IAddWebhookContract extends IWebhookContract { | ||
} | ||
export interface IGetLegacyWebhookContract extends ILegacyWebhookContract {} | ||
|
||
export interface IGetWebhookContract extends IWebhookContract {} | ||
|
||
export interface IAddLegacyWebhookContract extends ILegacyWebhookContract {} | ||
|
||
export interface IAddWebhookContract extends IWebhookContract {} | ||
|
||
export type ILegacyWebhookListContract = ILegacyWebhookContract[]; | ||
|
||
export type IWebhookListContract = IWebhookContract[]; | ||
} |
Oops, something went wrong.