001package com.plivo.api.models.number;
002
003import com.plivo.api.models.base.Updater;
004import com.plivo.api.util.Utils;
005import retrofit2.Call;
006
007public class NumberUpdater extends Updater<NumberUpdateResponse> {
008
009  private String appId;
010  private String subaccount;
011  private String alias;
012
013  NumberUpdater(final String number) {
014    super(number);
015  }
016
017  public String appId() {
018    return this.appId;
019  }
020
021  public String subaccount() {
022    return this.subaccount;
023  }
024
025  public String alias() {
026    return this.alias;
027  }
028
029  public NumberUpdater appId(final String appId) {
030    this.appId = appId;
031    return this;
032  }
033
034  public NumberUpdater subaccount(final String subaccount) {
035    this.subaccount = subaccount;
036    return this;
037  }
038
039  public NumberUpdater alias(final String alias) {
040    this.alias = alias;
041    return this;
042  }
043
044  @Override
045  protected void validate() {
046    if (!Utils.anyNotNull(alias, subaccount, appId)) {
047      throw new IllegalStateException("one of alias, subaccount, appId must be non-null");
048    }
049    super.validate();
050  }
051
052  @Override
053  protected Call<NumberUpdateResponse> obtainCall() {
054    return client().getApiService().numberUpdate(client().getAuthId(), id, this);
055  }
056}