Package com.microsoft.rest
Class ServiceResponse<T>
- java.lang.Object
-
- com.microsoft.rest.ServiceResponse<T>
-
- Type Parameters:
T- the type of the response
- Direct Known Subclasses:
ServiceResponseWithHeaders
public class ServiceResponse<T> extends Object
An instance of this class holds a response object and a raw REST response.
-
-
Constructor Summary
Constructors Constructor Description ServiceResponse(retrofit2.Response<Void> headResponse)Instantiate a ServiceResponse instance with a response from a HEAD operation.ServiceResponse(T body, retrofit2.Response<okhttp3.ResponseBody> response)Instantiate a ServiceResponse instance with a response object and a raw REST response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tbody()Gets the response object.retrofit2.Response<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.
-
-
-
Constructor Detail
-
ServiceResponse
public ServiceResponse(T body, retrofit2.Response<okhttp3.ResponseBody> response)
Instantiate a ServiceResponse instance with a response object and a raw REST response.- Parameters:
body- deserialized response objectresponse- raw REST response
-
ServiceResponse
public ServiceResponse(retrofit2.Response<Void> headResponse)
Instantiate a ServiceResponse instance with a response from a HEAD operation.- Parameters:
headResponse- raw REST response from a HEAD operation
-
-
Method Detail
-
body
public T body()
Gets the response object.- Returns:
- the response object. Null if there isn't one.
-
withBody
public ServiceResponse<T> withBody(T body)
Sets the response object.- Parameters:
body- the response object.- Returns:
- the ServiceResponse object itself
-
response
public retrofit2.Response<okhttp3.ResponseBody> response()
Gets the raw REST response.- Returns:
- the raw REST response.
-
headResponse
public retrofit2.Response<Void> headResponse()
Gets the raw REST response from a HEAD operation.- Returns:
- the raw REST response from a HEAD operation.
-
-