public abstract class SendEvent
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected AsyncCallback<java.lang.Void,java.lang.Exception> |
mCallback |
protected java.io.ByteArrayOutputStream |
mOutputStream |
Constructor and Description |
---|
SendEvent() |
Modifier and Type | Method and Description |
---|---|
protected void |
addFormDataParts(okhttp3.MultipartBody.Builder builder)
When override, our extending classes can add their own data to the POST
|
protected AvsResponse |
completeGet() |
protected AvsResponse |
completePost()
When finished adding voice data to the output, we close it using completePost() and it is sent off to the AVS server
and the response is parsed and returned
|
protected abstract java.lang.String |
getEvent()
Get our JSON
Event for this call |
protected void |
prepareConnection(java.lang.String url,
java.lang.String accessToken)
Set up all the headers that we need in our OkHttp POST/GET, this prepares the connection for
the event or the raw audio that we'll need to pass to the AVS server
|
protected java.io.ByteArrayOutputStream mOutputStream
protected AsyncCallback<java.lang.Void,java.lang.Exception> mCallback
protected void prepareConnection(java.lang.String url, java.lang.String accessToken)
protected AvsResponse completePost() throws java.io.IOException, AvsException, java.lang.RuntimeException
java.io.IOException
- if the OkHttp request can't executeAvsException
- if we can't parse the response body into an AvsResponse
itemjava.lang.RuntimeException
protected AvsResponse completeGet() throws java.io.IOException, AvsException, java.lang.RuntimeException
java.io.IOException
AvsException
java.lang.RuntimeException
protected void addFormDataParts(okhttp3.MultipartBody.Builder builder)
builder
- with audio data