UNPKG

sinch-rtc

Version:

RTC JavaScript/Web SDK

36 lines 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageBuilder = void 0; const fsm_1 = require("../session/fsm"); const utils_1 = require("../utils"); const Message_1 = require("./Message"); class MessageBuilder { method(method) { this.mxpMethod = method; return this; } body(body) { this.mxpBody = body; return this; } from(from) { this.mxpFrom = from; return this; } values(values) { this.mxpValues = values; return this; } sessionId(sessionId) { this.mxpSessionId = sessionId; return this; } build() { if (!this.mxpMethod || !this.mxpSessionId || !this.mxpFrom) throw new fsm_1.ArgumentError("Missing arguments", (0, utils_1.nameof)(this)); return new Message_1.Message(this.mxpMethod, this.mxpSessionId, this.mxpFrom, this.mxpBody, this.mxpValues); } } exports.MessageBuilder = MessageBuilder; MessageBuilder.create = () => new MessageBuilder(); //# sourceMappingURL=MessageBuilder.js.map