@mindconnect/mindconnect-nodejs
Version:
NodeJS Library for Siemens Insights Hub Connectivity - TypeScript SDK for Insights Hub and Industrial IoT - Command Line Interface - Insights Hub Development Proxy (Siemens Insights Hub was formerly known as MindSphere)
22 lines • 850 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.notificationTemplate = void 0;
const notificationTemplate = (metadata, attachments) => {
let attachementString = "";
(attachments || []).forEach((attachement) => {
attachementString += `\r\n----mindsphere\r\n\
Content-Disposition: form-data; name="attachment"; filename="${attachement.fileName}"\r\n\
Content-Type: ${attachement.mimeType}\r\n\r\n${attachement.buffer.toString("ascii")}\r\n`;
});
const result = `----mindsphere\r\n\
Content-Disposition: form-data; name="metadata"\
\r\n\
Content-Type: application/json\
\r\n\r\n\
${JSON.stringify(metadata, null, 2)}\
${attachementString}\
\r\n----mindsphere--`;
return result;
};
exports.notificationTemplate = notificationTemplate;
//# sourceMappingURL=notification-data-template.js.map