UNPKG

@umbraco/json-models-builders

Version:
58 lines 1.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebhookBuilder = void 0; class WebhookBuilder { enabled; name; description; url; contentTypeKeys; headers; events; constructor() { this.contentTypeKeys = []; this.headers = {}; this.events = []; } withEnabled(enabled) { this.enabled = enabled; return this; } withName(name) { this.name = name; return this; } withDescription(description) { this.description = description; return this; } withUrl(url) { this.url = url; return this; } withContentTypeKey(contentTypeKey) { this.contentTypeKeys.push(contentTypeKey); return this; } withHeader(headerName, headerValue) { this.headers[headerName] = headerValue; return this; } withEventAlias(eventAlias) { this.events.push(eventAlias); return this; } build() { return { enabled: this.enabled !== undefined ? this.enabled : true, name: this.name, description: this.description || '', url: this.url, contentTypeKeys: this.contentTypeKeys, headers: this.headers, events: this.events, }; } } exports.WebhookBuilder = WebhookBuilder; //# sourceMappingURL=webhookBuilder.js.map