All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twilio.twiml.voice.Siprec Maven / Gradle / Ivy

There is a newer version: 10.1.5
Show newest version
/**
 * This code was generated by
 * \ / _    _  _|   _  _
 *  | (_)\/(_)(_|\/| |(/_  v1.0.0
 *       /       /
 */

package com.twilio.twiml.voice;

import com.twilio.twiml.TwiML;

import java.util.HashMap;
import java.util.Map;

/**
 * TwiML wrapper for {@code }
 */
public class Siprec extends TwiML {
    public enum Track {
        INBOUND_TRACK("inbound_track"),
        OUTBOUND_TRACK("outbound_track"),
        BOTH_TRACKS("both_tracks");

        private final String value;

        private Track(final String value) {
            this.value = value;
        }

        public String toString() {
            return value;
        }
    }

    private final String name;
    private final String connectorName;
    private final Siprec.Track track;

    /**
     * For XML Serialization/Deserialization
     */
    private Siprec() {
        this(new Builder());
    }

    /**
     * Create a new {@code } element
     */
    private Siprec(Builder b) {
        super("Siprec", b);
        this.name = b.name;
        this.connectorName = b.connectorName;
        this.track = b.track;
    }

    /**
     * Attributes to set on the generated XML element
     *
     * @return A Map of attribute keys to values
     */
    protected Map getElementAttributes() {
        // Preserve order of attributes
        Map attrs = new HashMap<>();

        if (this.getName() != null) {
            attrs.put("name", this.getName());
        }
        if (this.getConnectorName() != null) {
            attrs.put("connectorName", this.getConnectorName());
        }
        if (this.getTrack() != null) {
            attrs.put("track", this.getTrack().toString());
        }

        return attrs;
    }

    /**
     * Friendly name given to SIPREC
     *
     * @return Friendly name given to SIPREC
     */
    public String getName() {
        return name;
    }

    /**
     * Unique name for Connector
     *
     * @return Unique name for Connector
     */
    public String getConnectorName() {
        return connectorName;
    }

    /**
     * Track to be streamed to remote service
     *
     * @return Track to be streamed to remote service
     */
    public Siprec.Track getTrack() {
        return track;
    }

    /**
     * Create a new {@code } element
     */
    public static class Builder extends TwiML.Builder {
        private String name;
        private String connectorName;
        private Siprec.Track track;

        /**
         * Friendly name given to SIPREC
         */
        public Builder name(String name) {
            this.name = name;
            return this;
        }

        /**
         * Unique name for Connector
         */
        public Builder connectorName(String connectorName) {
            this.connectorName = connectorName;
            return this;
        }

        /**
         * Track to be streamed to remote service
         */
        public Builder track(Siprec.Track track) {
            this.track = track;
            return this;
        }

        /**
         * Add a child {@code } element
         */
        public Builder parameter(Parameter parameter) {
            this.children.add(parameter);
            return this;
        }

        /**
         * Create and return resulting {@code } element
         */
        public Siprec build() {
            return new Siprec(this);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy