UNPKG

fhirbuilder

Version:
91 lines (90 loc) 3.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BundleResponseBuilder = void 0; const models_1 = require("../../models"); const base_1 = require("../base"); /** * @version R4 (v4.0.1) * @summary FHIR® Specification by HL7® * @description Class for building a BundleResponse * @class BundleResponseBuilder * @extends {BackboneBuilder} * @implements {IBundleResponseBuilder} * @author Roberto Araneda Espinoza */ class BundleResponseBuilder extends base_1.BackboneBuilder { bundleResponse; constructor() { super(); this.bundleResponse = new models_1.BundleResponse(); } /** * @description Adds a primitive extension to the element * @param param - the field to add the extension to * @param extension - the extension to add * @returns {this} * @example addPrimitiveExtension('_value', { value: 'test' }) */ addPrimitiveExtension(param, extension) { this.bundleResponse[param] = extension; return this; } /** * @description Builds the model * @returns {BundleResponse} */ build() { return Object.assign(this.bundleResponse, super.build()); } /** * @description Sets the status value * @description The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code. * @param value - the value to set * @returns {this} */ setStatus(value) { this.bundleResponse.status = value; return this; } /** * @description Sets the location value * @description The location header created by processing this operation, populated if the operation returns a location. * @param value - the value to set * @returns {this} */ setLocation(value) { this.bundleResponse.location = value; return this; } /** * @description Sets the etag value * @description The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)). * @param value - the value to set * @returns {this} */ setEtag(value) { this.bundleResponse.etag = value; return this; } /** * @description Sets the lastModified value * @description The date/time that the resource was modified on the server. * @param value - the value to set * @returns {this} */ setLastModified(value) { this.bundleResponse.lastModified = value; return this; } /** * @description Sets the outcome value * @description An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction. * @param value - the value to set * @returns {this} */ setOutcome(value) { this.bundleResponse.outcome = value; return this; } } exports.BundleResponseBuilder = BundleResponseBuilder;