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

com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateRequestParameters Maven / Gradle / Ivy

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

import com.sinch.sdk.core.models.OptionalValue;

/**
 * Parameters request to update an active number for a project
 *
 * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Active-Number/#tag/Active-Number/operation/NumberService_UpdateActiveNumber
 * @since 1.0
 */
public class ActiveNumberUpdateRequestParameters {
  private final OptionalValue displayName;
  private final OptionalValue smsConfiguration;
  private final OptionalValue
      voiceConfiguration;
  private final OptionalValue callback;

  private ActiveNumberUpdateRequestParameters(
      OptionalValue displayName,
      OptionalValue smsConfiguration,
      OptionalValue voiceConfiguration,
      OptionalValue callback) {
    this.displayName = displayName;
    this.smsConfiguration = smsConfiguration;
    this.voiceConfiguration = voiceConfiguration;
    this.callback = callback;
  }

  public OptionalValue getDisplayName() {
    return displayName;
  }

  public OptionalValue getSmsConfiguration() {
    return smsConfiguration;
  }

  public OptionalValue
      getVoiceConfiguration() {
    return voiceConfiguration;
  }

  public OptionalValue getCallback() {
    return callback;
  }

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

  public static class Builder {
    OptionalValue displayName = OptionalValue.empty();
    OptionalValue smsConfiguration =
        OptionalValue.empty();
    OptionalValue voiceConfiguration =
        OptionalValue.empty();
    OptionalValue callback = OptionalValue.empty();

    private Builder() {}

    /**
     * @param displayName User supplied name for the phone number
     * @return current builder
     */
    public Builder setDisplayName(String displayName) {
      this.displayName = OptionalValue.of(displayName);
      return this;
    }

    /**
     * @param smsConfiguration The current SMS configuration for this number
     * @return current builder
     */
    public Builder setSmsConfiguration(
        ActiveNumberUpdateSMSConfigurationRequestParameters smsConfiguration) {
      this.smsConfiguration = OptionalValue.of(smsConfiguration);
      return this;
    }

    /**
     * @param voiceConfiguration The current voice configuration for this number
     * @return current builder
     */
    public Builder setVoiceConfiguration(
        ActiveNumberUpdateVoiceConfigurationRequestParameters voiceConfiguration) {
      this.voiceConfiguration = OptionalValue.of(voiceConfiguration);
      return this;
    }

    /**
     * @param callback The callback URL to be called for a rented number's provisioning /
     *     deprovisioning operations ({@link com.sinch.sdk.domains.numbers.WebHooksService see
     *     WebHooksService})
     * @return current builder
     */
    public Builder setCallback(String callback) {
      this.callback = OptionalValue.of(callback);
      return this;
    }

    public ActiveNumberUpdateRequestParameters build() {
      return new ActiveNumberUpdateRequestParameters(
          displayName, smsConfiguration, voiceConfiguration, callback);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy