All files / node-sdk/models/bxml/verbs SpeakSentence.ts

100% Statements 9/9
100% Branches 2/2
100% Functions 3/3
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 3811x   11x                           11x                   2x             11x 1x   11x  
import { Verb } from '../Verb';
import { XMLWriterOptions } from 'xmlbuilder2/lib/interfaces';
import { SSML_REGEX } from '../Root';
 
export interface SpeakSentenceAttributes {
    voice?: string;
    gender?: string;
    locale?: string;
}
 
/**
 * @export
 * @class SpeakSentence
 * @extends {Verb}
 * Represents a SpeakSentence verb
*/
export class SpeakSentence extends Verb {
    text: string;
    attributes: SpeakSentenceAttributes;
 
    /**
     * Creates an instance of SpeakSentence
     * @param {string} text The text to speak
     * @param {SpeakSentenceAttributes} attributes The attributes to add to the element
     */
    constructor(text: string, attributes?: SpeakSentenceAttributes) {
        super('SpeakSentence', text, attributes);
    }
 
    /**
     * Return BXML representation of this element
     * @param options XML Serialization options
     */
    toBxml(options?: XMLWriterOptions): string {
        return this.generateXml().toString(options).replace(SSML_REGEX, '<$1>');
    }
}