@umbraco/json-models-builders
Version:
Builders and models for Umbraco Sites
68 lines • 1.78 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MediaValueBuilder = void 0;
const mediaValueDataBuilder_1 = require("./mediaValueDataBuilder");
class MediaValueBuilder {
parentBuilder;
culture;
segment;
alias;
editorAlias;
entityType;
value;
mediaValueData;
constructor(parentBuilder) {
this.parentBuilder = parentBuilder;
}
withCulture(culture) {
this.culture = culture;
return this;
}
withSegment(segment) {
this.segment = segment;
return this;
}
withAlias(alias) {
this.alias = alias;
return this;
}
withEditorAlias(editorAlias) {
this.editorAlias = editorAlias;
return this;
}
withEntityType(entityType) {
this.entityType = entityType;
return this;
}
withValue(value) {
this.value = value;
return this;
}
addValueData() {
const builder = new mediaValueDataBuilder_1.MediaValueDataBuilder(this);
this.mediaValueData = builder;
return builder;
}
done() {
return this.parentBuilder;
}
build() {
let value = null;
if (this.value != null) {
value = this.value;
}
else {
value = this.mediaValueData.getValue();
}
return {
culture: this.culture || null,
segment: this.segment || null,
alias: this.alias || null,
editorAlias: this.editorAlias || null,
value: value || null,
entityType: this.editorAlias !== undefined ? 'media-property-value' : null
};
}
}
exports.MediaValueBuilder = MediaValueBuilder;
//# sourceMappingURL=mediaValueBuilder.js.map