@sourceloop/ctrl-plane-tenant-management-service
Version:
Tenant Management microservice for SaaS control plane
45 lines (42 loc) • 978 B
text/typescript
import {AnyObject} from '@loopback/repository';
import {WebhookType} from '../enums/webhook-types.enum';
import {NotificationType} from '../enums';
export enum WebhookStatus {
FAILURE,
SUCCESS,
}
/**
* Represents the payload for a webhook.
*/
//sonarignore:start this was intentional
export type WebhookPayload = ResourceProvisionedWebhookPayload;
//sonarignore:end
/**
* Represents the payload for a resource provisioned webhook.
*/
export type ResourceProvisionedWebhookPayload = {
/**
* The ID of the initiator.
*/
initiatorId: string;
/**
* The type of the webhook.
*/
type: WebhookType.RESOURCES_PROVISIONED;
/**
* The data of the webhook.
*/
data: {
status: WebhookStatus.SUCCESS | WebhookStatus.FAILURE;
resources: AnyObject[];
appPlaneUrl: string;
};
};
export interface WebhookNotificationServiceType {
send<T>(
email: string,
type: NotificationType,
data: T,
token: string,
): Promise<void>;
}