UNPKG

dc-management-sdk-js

Version:
131 lines (130 loc) 3.16 kB
import { HalResource } from '../hal/models/HalResource'; import { Hub } from './Hub'; import { Page } from './Page'; /** * Class representing the [Webhook](https://amplience.com/docs/api/dynamic-content/management/#tag/Webhooks) resource. * A Webhook is a HTTP callback: a HTTP request that occurs when something happens; a simple event-notification via the HTTP protocol. */ export declare class Webhook extends HalResource { /** * Unique id generated on creation */ id?: string; /** * Friendly display label for the Webhook */ label?: string; /** * List of events that will cause this webhook to trigger */ events?: string[]; /** * List of callback URLs to invoke when an event triggers */ handlers?: string[]; /** * List of custom webhook headers to be sent. */ headers?: WebhookHeader[]; /** * List of filters used to gate sending of webhooks. */ filters?: WebhookFilter[]; /** * The webhooks HTTP method. */ method?: 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** * A customized payload format. */ customPayload?: WebhookCustomPayload; /** * Enables or disables the webhook */ active?: boolean; /** * When a notification is sent, this value will be used to calculate a cryptographic hash which is transmitted as part of the notification. * This hash can be used to assert a trusted party sent the notification. */ secret?: string; /** * Resources and actions related to a Webhook */ readonly related: { /** * Retrieves the Hub this webhook is stored in */ hub: () => Promise<Hub>; /** * Delete Webhook */ delete: () => Promise<void>; /** * Updates this Webhook with the changes in the mutation parameter. * @param mutation */ update: (mutation: Webhook) => Promise<Webhook>; }; parse(data: unknown): void; } /** * A custom webhook header which will be sent along with a webhook. */ export type WebhookHeader = { /** * The header */ key: string; /** * The header's value. */ value: string; /** * Indicates this header value is sensitive. */ secret?: boolean; }; /** * A custom payload format for the webhook. */ export type WebhookCustomPayload = { /** * MIME type of the custom payload. */ type: 'text/x-handlebars-template'; /** * Custom payload. */ value: string; }; /** * A webhook filter. */ export type WebhookFilter = { /** * The type of filter. */ type: 'equal' | 'in'; /** * The arguments for the filter. */ arguments: [WebhookFilterJSONPathArgument, WebhookFilterValueArgument]; }; /** * A JSON Path argument. */ export type WebhookFilterJSONPathArgument = { jsonPath: string; }; /** * A value argument. */ export type WebhookFilterValueArgument = { value: string | string[]; }; /** * @hidden */ export declare class WebhooksPage extends Page<Webhook> { constructor(data?: any); }