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

com.sinch.sdk.domains.sms.models.requests.SendSmsBatchBinaryRequest 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 java.time.Instant;
import java.util.Collection;

public class SendSmsBatchBinaryRequest extends BaseBatch {
  private final OptionalValue flashMessage;
  private final OptionalValue truncateConcat;
  private final OptionalValue maxNumberOfMessageParts;
  private final OptionalValue fromTon;
  private final OptionalValue fromNpi;
  private final OptionalValue udh;

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

  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;
  }

  public OptionalValue getUdh() {
    return udh;
  }

  @Override
  public String toString() {
    return "SendSmsBatchBinaryRequest{"
        + "flashMessage="
        + flashMessage
        + ", truncateConcat="
        + truncateConcat
        + ", maxNumberOfMessageParts="
        + maxNumberOfMessageParts
        + ", fromTon="
        + fromTon
        + ", fromNpi="
        + fromNpi
        + ", udh='"
        + udh
        + '\''
        + ", base='"
        + "} "
        + super.toString();
  }

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

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

    private Builder() {
      super();
    }

    /**
     * @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 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(int maxNumberOfMessageParts) {
      this.maxNumberOfMessageParts = OptionalValue.of(maxNumberOfMessageParts);
      return this;
    }

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

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

    /**
     * @param udh The UDH header of a binary message HEX encoded. Max 140 bytes including the body.
     * @return current builder
     */
    public Builder setUdh(String udh) {
      this.udh = OptionalValue.of(udh);
      return this;
    }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy