@vonage/voice
Version:
The Voice API lets you create outbound calls, control in-progress calls and get information about historical calls.
31 lines • 896 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NCCOBuilder = void 0;
/**
* A builder class for creating Nexmo Call Control Objects (NCCOs).
*/
class NCCOBuilder {
actions = [];
/**
* Add an action to the NCCO builder.
*
* @param {Action} action - The action to add to the NCCO.
* @return {NCCOBuilder} - The NCCO builder instance (for method chaining).
*/
addAction(action) {
this.actions.push(('serializeToNCCO' in action
? action.serializeToNCCO()
: action));
return this;
}
/**
* Build the NCCO by serializing the added actions.
*
* @return {Array<Action | Serializable>} - The built NCCO, which is an array of actions.
*/
build() {
return this.actions;
}
}
exports.NCCOBuilder = NCCOBuilder;
//# sourceMappingURL=NCCOBuilder.js.map