001package com.plivo.api.models.number;
002
003import com.plivo.api.models.base.ListResponse;
004import com.plivo.api.models.base.Lister;
005import com.plivo.api.util.Utils;
006import retrofit2.Call;
007
008public class PhoneNumberLister extends Lister<PhoneNumber> {
009
010  private final String countryIso;
011  private NumberType type;
012  private String pattern;
013  private String region;
014  private String services;
015  private String lata;
016  private String rateCenter;
017
018  PhoneNumberLister(String countryIso) {
019    if (!Utils.allNotNull(countryIso)) {
020      throw new IllegalArgumentException("countryIso cannot be null");
021    }
022
023    this.countryIso = countryIso;
024  }
025
026  public String countryIso() {
027    return this.countryIso;
028  }
029
030  public NumberType type() {
031    return this.type;
032  }
033
034  public String pattern() {
035    return this.pattern;
036  }
037
038  public String region() {
039    return this.region;
040  }
041
042  public String services() {
043    return this.services;
044  }
045
046  public String lata() {
047    return this.lata;
048  }
049
050  public String rateCenter() {
051    return this.rateCenter;
052  }
053
054  public PhoneNumberLister type(final NumberType type) {
055    this.type = type;
056    return this;
057  }
058
059  public PhoneNumberLister pattern(final String pattern) {
060    this.pattern = pattern;
061    return this;
062  }
063
064  public PhoneNumberLister region(final String region) {
065    this.region = region;
066    return this;
067  }
068
069  public PhoneNumberLister services(final String services) {
070    this.services = services;
071    return this;
072  }
073
074  public PhoneNumberLister lata(final String lata) {
075    this.lata = lata;
076    return this;
077  }
078
079  public PhoneNumberLister rateCenter(final String rateCenter) {
080    this.rateCenter = rateCenter;
081    return this;
082  }
083
084  @Override
085  protected Call<ListResponse<PhoneNumber>> obtainCall() {
086    return client().getApiService().phoneNumberList(client().getAuthId(), toMap());
087  }
088}