com.twilio.twiml.voice.Stream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of twilio Show documentation
Show all versions of twilio Show documentation
Twilio Java Helper Library
/**
* 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 Stream 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 String url;
private final Stream.Track track;
/**
* For XML Serialization/Deserialization
*/
private Stream() {
this(new Builder());
}
/**
* Create a new {@code } element
*/
private Stream(Builder b) {
super("Stream", b);
this.name = b.name;
this.connectorName = b.connectorName;
this.url = b.url;
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.getUrl() != null) {
attrs.put("url", this.getUrl());
}
if (this.getTrack() != null) {
attrs.put("track", this.getTrack().toString());
}
return attrs;
}
/**
* Friendly name given to the Stream
*
* @return Friendly name given to the Stream
*/
public String getName() {
return name;
}
/**
* Unique name for Stream Connector
*
* @return Unique name for Stream Connector
*/
public String getConnectorName() {
return connectorName;
}
/**
* URL of the remote service where the Stream is routed
*
* @return URL of the remote service where the Stream is routed
*/
public String getUrl() {
return url;
}
/**
* Track to be streamed to remote service
*
* @return Track to be streamed to remote service
*/
public Stream.Track getTrack() {
return track;
}
/**
* Create a new {@code } element
*/
public static class Builder extends TwiML.Builder {
private String name;
private String connectorName;
private String url;
private Stream.Track track;
/**
* Friendly name given to the Stream
*/
public Builder name(String name) {
this.name = name;
return this;
}
/**
* Unique name for Stream Connector
*/
public Builder connectorName(String connectorName) {
this.connectorName = connectorName;
return this;
}
/**
* URL of the remote service where the Stream is routed
*/
public Builder url(String url) {
this.url = url;
return this;
}
/**
* Track to be streamed to remote service
*/
public Builder track(Stream.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 Stream build() {
return new Stream(this);
}
}
}