ServiceResponse<T> Class

  • java.lang.Object
    • com.microsoft.bot.restclient.ServiceResponse<T>

Type Parameters

T

the type of the response

public class ServiceResponse

An instance of this class holds a response object and a raw REST response.

Constructor Summary

Constructor Description
ServiceResponse(T body, Response<ResponseBody> response)

Instantiate a ServiceResponse instance with a response object and a raw REST response.

ServiceResponse(Response<Void> headResponse)

Instantiate a ServiceResponse instance with a response from a HEAD operation.

Method Summary

Modifier and Type Method and Description
T body()

Gets the response object.

retrofit2.Response<java.lang.Void> headResponse()

Gets the raw REST response from a HEAD operation.

retrofit2.Response<okhttp3.ResponseBody> response()

Gets the raw REST response.

ServiceResponse<T> withBody(T body)

Sets the response object.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

ServiceResponse

public ServiceResponse(T body, Response response)

Instantiate a ServiceResponse instance with a response object and a raw REST response.

Parameters:

body - deserialized response object
response - raw REST response

ServiceResponse

public ServiceResponse(Response headResponse)

Instantiate a ServiceResponse instance with a response from a HEAD operation.

Parameters:

headResponse - raw REST response from a HEAD operation

Method Details

body

public T body()

Gets the response object.

Returns:

the response object. Null if there isn't one.

headResponse

public Response headResponse()

Gets the raw REST response from a HEAD operation.

Returns:

the raw REST response from a HEAD operation.

response

public Response response()

Gets the raw REST response.

Returns:

the raw REST response.

withBody

public ServiceResponse withBody(T body)

Sets the response object.

Parameters:

body - the response object.

Returns:

the ServiceResponse object itself

Applies to