@vonage/voice
Version:
The Voice API lets you create outbound calls, control in-progress calls and get information about historical calls.
29 lines (27 loc) • 650 B
JavaScript
// lib/classes/NCCO/NCCOBuilder.ts
var NCCOBuilder = class {
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;
}
};
export {
NCCOBuilder
};