001package com.plivo.api.models.call.actions;
002
003import com.plivo.api.PlivoClient;
004import com.plivo.api.exceptions.PlivoRestException;
005import com.plivo.api.models.base.Creator;
006import com.plivo.api.models.call.LegSpecifier;
007import java.io.IOException;
008import retrofit2.Call;
009
010public class CallDtmfCreator extends Creator<CallDtmfCreateResponse> {
011
012  private final String digits;
013  private final String id;
014  private LegSpecifier leg;
015
016  public CallDtmfCreator(String id, String digits) {
017    this.id = id;
018    this.digits = digits;
019  }
020
021  public String digits() {
022    return digits;
023  }
024
025  public LegSpecifier leg() {
026    return this.leg;
027  }
028
029  public CallDtmfCreator leg(final LegSpecifier leg) {
030    this.leg = leg;
031    return this;
032  }
033
034
035  @Override
036  protected Call<CallDtmfCreateResponse> obtainCall() {
037    return client().getApiService().callDtmfCreate(client().getAuthId(), id, this);
038  }
039
040  public CallDtmfCreateResponse sendDigits() throws IOException, PlivoRestException {
041    return create();
042  }
043
044  @Override
045  public CallDtmfCreator client(final PlivoClient plivoClient) {
046    this.plivoClient = plivoClient;
047    return this;
048  }
049
050}