@topgroup/diginext
Version:
A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.
39 lines • 1.48 kB
TypeScript
import type { IDataReferences, IWebhook } from "../entities/Webhook";
import type { IQueryOptions } from "../interfaces";
import type { Ownership, SystemEvent, WebhookChannel, WebhookEventStatus } from "../interfaces/SystemTypes";
import BaseService from "./BaseService";
import { NotificationService } from "./NotificationService";
export interface WebhookDto extends IDataReferences {
/**
* Array of webhook events to subscribe to
*/
events: SystemEvent[];
/**
* Array of User ID
* @default []
*/
consumers?: string[];
/**
* Array of webhook channels to receive
* @default ["email"]
*/
channels?: WebhookChannel[];
}
export declare class WebhookService extends BaseService<IWebhook> {
notiSvc: NotificationService;
constructor(ownership?: Ownership);
create(data: WebhookDto, options?: IQueryOptions): Promise<IWebhook>;
/**
* Trigger a webhook & send the notification
* @param id - Webhook ID
* @param status - Webhook event status
*/
trigger(id: string, status: WebhookEventStatus, options?: IQueryOptions): Promise<(void | import("../entities").INotification | import("../entities").INotification[])[]>;
/**
* Subscribe a consumer to a webhook
* @param id - Webhook ID
* @param data - Subscription data
*/
subscribe(id: string, consumers: string[], options?: IQueryOptions): Promise<IWebhook>;
}
//# sourceMappingURL=WebhookService.d.ts.map