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

com.sinch.sdk.domains.voice.models.svaml.SVAMLControl Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.sinch.sdk.domains.voice.models.svaml;

import com.sinch.sdk.core.models.OptionalValue;
import com.sinch.sdk.domains.voice.models.requests.Control;
import java.util.Collection;

/**
 * Class enabling to define SVAML actions and instructions
 *
 * @see SVAML
 *     Dcoumentation
 */
public class SVAMLControl extends Control {
  private final OptionalValue> instructions;
  private final OptionalValue action;

  private SVAMLControl(
      OptionalValue> instructions, OptionalValue action) {
    this.instructions = instructions;
    this.action = action;
  }

  /**
   * Get instructions related to request
   *
   * @return See builder {@link Builder#setInstructions setter}
   */
  public OptionalValue> getInstructions() {
    return instructions;
  }

  /**
   * Get action related to request
   *
   * @return See builder {@link Builder#setAction setter}
   */
  public OptionalValue getAction() {
    return action;
  }

  @Override
  public String toString() {
    return "SVAMLControl{" + "instructions=" + instructions + ", action=" + action + '}';
  }

  /**
   * Create a builder instance
   *
   * @return Dedicated builder
   */
  public static Builder builder() {
    return new Builder();
  }

  public static class Builder {

    OptionalValue> instructions = OptionalValue.empty();
    OptionalValue action = OptionalValue.empty();

    public Builder() {}

    /**
     * The collection of instructions that can perform various tasks during the call
     *
     * @param instructions Instructions list
     * @return Current builder
     */
    public Builder setInstructions(Collection instructions) {
      this.instructions = OptionalValue.of(instructions);
      return this;
    }

    /**
     * The action that will control the call
     *
     * @param action The action description
     * @return Current builder
     */
    public Builder setAction(Action action) {
      this.action = OptionalValue.of(action);
      return this;
    }

    /**
     * Build the instance
     *
     * @return Built instance
     */
    public SVAMLControl build() {
      return new SVAMLControl(instructions, action);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy