
com.plivo.api.models.phlo.PhloUpdater Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plivo-java Show documentation
Show all versions of plivo-java Show documentation
A Java SDK to make voice calls & send SMS using Plivo and to generate Plivo XML
package com.plivo.api.models.phlo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonParseException;
import com.plivo.api.Plivo;
import com.plivo.api.PlivoClient;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.base.Updater;
import retrofit2.Call;
import retrofit2.Response;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class PhloUpdater extends Updater {
private Map payload = new HashMap<>();
@JsonIgnore
protected PlivoClient plivoClient = Plivo.getPhloClient();
public PhloUpdater(final String phloId) {
super(phloId);
}
public PhloUpdater payload(Map payload) {
this.payload = payload;
return this;
}
@Override
public PlivoClient client() {
return this.plivoClient;
}
public PhloUpdateResponse run() throws IOException, PlivoRestException {
validate();
try {
Response response = obtainCall().execute();
handleResponse(response);
return response.body();
} catch (JsonParseException je) {
//FIXME( server side needs to be updated to return proper json )
System.out.println("Improperly formed json received as response, ignoring!!");
}
return null;
}
@Override
protected Call obtainCall() {
return client().getApiService().runPhlo(this.client()
.getAuthId(), id, this.payload);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy