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.VoiceCreator; 006import com.plivo.api.models.call.LegSpecifier; 007import java.io.IOException; 008import java.util.List; 009import retrofit2.Call; 010 011public class CallPlayCreator extends VoiceCreator<CallPlayCreateResponse> { 012 013 private List<String> urls; 014 private Long length; 015 private LegSpecifier legs; 016 private Boolean loop; 017 private Boolean mix; 018 private String id; 019 020 public CallPlayCreator(String id, List<String> urls) { 021 this.id = id; 022 this.urls = urls; 023 } 024 025 public List<String> urls() { 026 return this.urls; 027 } 028 029 public Long length() { 030 return this.length; 031 } 032 033 public LegSpecifier legs() { 034 return this.legs; 035 } 036 037 public Boolean loop() { 038 return this.loop; 039 } 040 041 public Boolean mix() { 042 return this.mix; 043 } 044 045 public CallPlayCreator urls(final List<String> urls) { 046 this.urls = urls; 047 return this; 048 } 049 050 public CallPlayCreator length(final Long length) { 051 this.length = length; 052 return this; 053 } 054 055 public CallPlayCreator legs(final LegSpecifier legs) { 056 this.legs = legs; 057 return this; 058 } 059 060 public CallPlayCreator loop(final Boolean loop) { 061 this.loop = loop; 062 return this; 063 } 064 065 public CallPlayCreator mix(final Boolean mix) { 066 this.mix = mix; 067 return this; 068 } 069 070 071 @Override 072 protected Call<CallPlayCreateResponse> obtainCall() { 073 return client().getVoiceApiService().callPlayCreate(client().getAuthId(), id, this); 074 } 075 076 @Override 077 protected Call<CallPlayCreateResponse> obtainFallback1Call() { 078 return client().getVoiceFallback1Service().callPlayCreate(client().getAuthId(), id, this); 079 } 080 081 @Override 082 protected Call<CallPlayCreateResponse> obtainFallback2Call() { 083 return client().getVoiceFallback2Service().callPlayCreate(client().getAuthId(), id, this); 084 } 085 086 public CallPlayCreateResponse play() throws IOException, PlivoRestException { 087 return create(); 088 } 089 090 @Override 091 public CallPlayCreator client(final PlivoClient plivoClient) { 092 this.plivoClient = plivoClient; 093 return this; 094 } 095 096 097}