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

com.sinch.sdk.domains.sms.models.requests.SendSmsBatchTextRequest Maven / Gradle / Ivy

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

import com.sinch.sdk.core.models.OptionalValue;
import com.sinch.sdk.domains.sms.models.BaseBatch;
import com.sinch.sdk.domains.sms.models.DeliveryReportType;
import com.sinch.sdk.domains.sms.models.Parameters;
import java.time.Instant;
import java.util.Collection;

public class SendSmsBatchTextRequest extends BaseBatch {
  private final OptionalValue flashMessage;
  private final OptionalValue parameters;
  private final OptionalValue truncateConcat;
  private final OptionalValue maxNumberOfMessageParts;
  private final OptionalValue fromTon;
  private final OptionalValue fromNpi;

  private SendSmsBatchTextRequest(
      Collection to,
      OptionalValue from,
      String body,
      OptionalValue deliveryReport,
      OptionalValue sendAt,
      OptionalValue expireAt,
      OptionalValue callbackUrl,
      OptionalValue clientReference,
      OptionalValue flashMessage,
      OptionalValue feedbackEnabled,
      OptionalValue parameters,
      OptionalValue truncateConcat,
      OptionalValue maxNumberOfMessageParts,
      OptionalValue fromTon,
      OptionalValue fromNpi) {
    super(
        to,
        from,
        body,
        deliveryReport,
        sendAt,
        expireAt,
        callbackUrl,
        clientReference,
        feedbackEnabled);
    this.flashMessage = flashMessage;
    this.parameters = parameters;
    this.truncateConcat = truncateConcat;
    this.maxNumberOfMessageParts = maxNumberOfMessageParts;
    this.fromTon = fromTon;
    this.fromNpi = fromNpi;
  }

  public OptionalValue getParameters() {
    return parameters;
  }

  public OptionalValue isFlashMessage() {
    return flashMessage;
  }

  public OptionalValue isTruncateConcat() {
    return truncateConcat;
  }

  public OptionalValue getMaxNumberOfMessageParts() {
    return maxNumberOfMessageParts;
  }

  public OptionalValue getFromTon() {
    return fromTon;
  }

  public OptionalValue getFromNpi() {
    return fromNpi;
  }

  @Override
  public String toString() {
    return "SendSmsBatchTextRequest{"
        + "flashMessage="
        + flashMessage
        + ", parameters="
        + parameters
        + ", truncateConcat="
        + truncateConcat
        + ", maxNumberOfMessageParts="
        + maxNumberOfMessageParts
        + ", fromTon="
        + fromTon
        + ", fromNpi="
        + fromNpi
        + "} "
        + super.toString();
  }

  public static Builder builder() {
    return new Builder();
  }

  public static class Builder extends BaseBatch.Builder {
    private OptionalValue flashMessage = OptionalValue.empty();
    private OptionalValue parameters = OptionalValue.empty();
    private OptionalValue truncateConcat = OptionalValue.empty();
    private OptionalValue maxNumberOfMessageParts = OptionalValue.empty();
    private OptionalValue fromTon = OptionalValue.empty();
    private OptionalValue fromNpi = OptionalValue.empty();

    private Builder() {}

    /**
     * @param flashMessage If sent as a flash message, displays true.
     * @return current builder
     */
    public Builder setFlashMessage(boolean flashMessage) {
      this.flashMessage = OptionalValue.of(flashMessage);
      return this;
    }

    /**
     * @param parameters Contains the parameters that will be used for customizing the message for
     *     each recipient.
     * @return current builder
     */
    public Builder setParameters(Parameters parameters) {
      this.parameters = OptionalValue.of(parameters);
      return this;
    }

    /**
     * @param truncateConcat If set to true, the message was shortened when exceeding one part.
     * @return current builder
     */
    public Builder setTruncateConcat(Boolean truncateConcat) {
      this.truncateConcat = OptionalValue.of(truncateConcat);
      return this;
    }

    /**
     * @param maxNumberOfMessageParts Displays the number of message parts set in the request.
     * @return current builder
     */
    public Builder setMaxNumberOfMessageParts(Integer maxNumberOfMessageParts) {
      this.maxNumberOfMessageParts = OptionalValue.of(maxNumberOfMessageParts);
      return this;
    }

    /**
     * @param fromTon The type of number for the sender number.
     * @return current builder
     */
    public Builder setFromTon(Integer fromTon) {
      this.fromTon = OptionalValue.of(fromTon);
      return this;
    }

    /**
     * @param fromNpi Number Plan Indicator for the sender number.
     * @return current builder
     */
    public Builder setFromNpi(Integer fromNpi) {
      this.fromNpi = OptionalValue.of(fromNpi);
      return this;
    }

    public SendSmsBatchTextRequest build() {
      return new SendSmsBatchTextRequest(
          to,
          from,
          body,
          deliveryReport,
          sendAt,
          expireAt,
          callbackUrl,
          clientReference,
          flashMessage,
          feedbackEnabled,
          parameters,
          truncateConcat,
          maxNumberOfMessageParts,
          fromTon,
          fromNpi);
    }

    @Override
    protected Builder self() {
      return this;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy