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

com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentRequestParameters 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 rent a number
 *
 * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Number/#tag/Available-Number/operation/NumberService_RentNumber
 * @since 1.0
 */
public class AvailableNumberRentRequestParameters {
  private final OptionalValue smsConfiguration;
  private final OptionalValue voiceConfiguration;
  private final OptionalValue callbackUrl;

  private AvailableNumberRentRequestParameters(
      OptionalValue smsConfiguration,
      OptionalValue voiceConfiguration,
      OptionalValue callbackUrl) {
    this.smsConfiguration = smsConfiguration;
    this.voiceConfiguration = voiceConfiguration;
    this.callbackUrl = callbackUrl;
  }

  public OptionalValue getSmsConfiguration() {
    return smsConfiguration;
  }

  public OptionalValue getVoiceConfiguration() {
    return voiceConfiguration;
  }

  public OptionalValue getCallBackUrl() {
    return callbackUrl;
  }

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

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

    private Builder() {}

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

    /**
     * @param voiceConfiguration The current voice configuration for this number. During scheduled
     *     provisioning, the app ID value may be empty in a response if it is still processing or if
     *     it has failed. The status of scheduled provisioning will show under a
     *     scheduledVoiceProvisioning object if it's still running. Once processed successfully, the
     *     appId sent will appear directly under the voiceConfiguration object.
     * @return current builder
     */
    public Builder setVoiceConfiguration(
        RentVoiceConfigurationRequestParameters voiceConfiguration) {
      this.voiceConfiguration = OptionalValue.of(voiceConfiguration);
      return this;
    }

    /**
     * @param callbackUrl The callback URL to be called for a rented number's provisioning /
     *     de-provisioning operations.
     * @return current builder
     */
    public Builder setCallbackUrl(String callbackUrl) {
      this.callbackUrl = OptionalValue.of(callbackUrl);
      return this;
    }

    public AvailableNumberRentRequestParameters build() {
      return new AvailableNumberRentRequestParameters(
          smsConfiguration, voiceConfiguration, callbackUrl);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy