Class NetworkResponseImpl
-
- All Implemented Interfaces:
-
com.inmobi.media.network.okhttp.NetworkResponse
public final class NetworkResponseImpl implements NetworkResponse
Implementation of the NetworkResponse interface that encapsulates the response data
-
-
Constructor Summary
Constructors Constructor Description NetworkResponseImpl(String resolvedUrl, Integer responseStatusCode, ByteString bodyBytes, NetworkMetaData responseMetaData)
-
Method Summary
Modifier and Type Method Description IntegergetStatusCode()Retrieves the status code of the HTTP response. StringgetError()Retrieves the error associated with the response, if any. ByteStringgetByteString()Retrieves the response as a ByteString. NetworkMetaDatagetMetadata()Retrieves the metadata associated with the network response. StringgetUrl()Retrieves the url associated with the network request. <T extends Any> TgetResponse(Class<T> responseModelClass)Retrieves the response parsed into the specified type asynchronously. <T extends Any> TgetResponse(Class<T> responseModelClass, Function1<String, String> modifyResponse)Retrieves the response parsed into the specified type asynchronously. -
-
Constructor Detail
-
NetworkResponseImpl
NetworkResponseImpl(String resolvedUrl, Integer responseStatusCode, ByteString bodyBytes, NetworkMetaData responseMetaData)
-
-
Method Detail
-
getStatusCode
Integer getStatusCode()
Retrieves the status code of the HTTP response.
- Returns:
The status code.
-
getError
String getError()
Retrieves the error associated with the response, if any.
- Returns:
The error message, or null if no error occurred.
-
getByteString
ByteString getByteString()
Retrieves the response as a ByteString.
- Returns:
The string representation of the response.
-
getMetadata
NetworkMetaData getMetadata()
Retrieves the metadata associated with the network response.
- Returns:
The metadata of the network response.
-
getUrl
String getUrl()
Retrieves the url associated with the network request.
- Returns:
The url of the request.
-
getResponse
<T extends Any> T getResponse(Class<T> responseModelClass)
Retrieves the response parsed into the specified type asynchronously.
- Parameters:
responseModelClass- The class of the response model to parse into.- Returns:
A Deferred result containing the parsed response, or null if parsing fails.
-
getResponse
<T extends Any> T getResponse(Class<T> responseModelClass, Function1<String, String> modifyResponse)
Retrieves the response parsed into the specified type asynchronously.
- Parameters:
responseModelClass- The class of the response model to parse into.modifyResponse- allows the caller to modify the response to fit the model class.- Returns:
A Deferred result containing the parsed response, or null if parsing fails.
-
-
-
-