Class ErrorResponse

  • All Implemented Interfaces:
    com.inmobi.media.network.okhttp.NetworkResponse

    
    public final class ErrorResponse
     implements NetworkResponse
                        

    Class representing an error response from a network operation.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Integer getStatusCode() Retrieves the status code of the HTTP response.
      String getError() Retrieves the error associated with the response.
      ByteString getByteString() Retrieves the response as a ByteString.
      <T extends Any> T getResponse(Class<T> responseModelClass) Retrieves the response parsed into the specified type asynchronously.
      <T extends Any> T getResponse(Class<T> responseModelClass, Function1<String, String> modifyResponse) Retrieves the response parsed into the specified type asynchronously.
      NetworkMetaData getMetadata() Retrieves the metadata associated with the network response.
      String getUrl() Retrieves the url associated with the network request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getStatusCode

         Integer getStatusCode()

        Retrieves the status code of the HTTP response. For an ErrorResponse, this is the integer value of the errorCode.

        Returns:

        The status code.

      • getError

         String getError()

        Retrieves the error associated with the response. For an ErrorResponse, this is the name of the errorCode enum constant.

        Returns:

        The error message.

      • getByteString

         ByteString getByteString()

        Retrieves the response as a ByteString. For an ErrorResponse, this is always an empty ByteString.

        Returns:

        The empty ByteString representation of the response.

      • getResponse

         <T extends Any> T getResponse(Class<T> responseModelClass)

        Retrieves the response parsed into the specified type asynchronously. For an ErrorResponse, this returns null.

        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. For an ErrorResponse, this returns null.

        Parameters:
        responseModelClass - The class of the response model to parse into.
        modifyResponse - A function to modify the response string before parsing.
        Returns:

        A Deferred result containing the parsed response, or null if parsing fails.

      • getMetadata

         NetworkMetaData getMetadata()

        Retrieves the metadata associated with the network response. For an ErrorResponse, this provides default empty metadata.

        Returns:

        The metadata of the network response.

      • getUrl

         String getUrl()

        Retrieves the url associated with the network request.

        Returns:

        The url of the request.