Package top.focess.qq.api.util.network
Class HttpResponse
- java.lang.Object
-
- top.focess.qq.api.util.network.HttpResponse
-
public class HttpResponse extends Object
This class is used to define a response to a http-request
-
-
Field Summary
Fields Modifier and Type Field Description static intEXCEPTIONException thrown error codestatic intUNKNOWN_REQUESTUnknown request type error code
-
Constructor Summary
Constructors Constructor Description HttpResponse(Plugin plugin, int code, okhttp3.Headers headers, String value)Initialize a HttpResponse without exceptionsHttpResponse(Plugin plugin, Exception e)Initialize an exception thrown HttpResponse with e
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JSONgetAsJSON()Get the values as JSON instanceintgetCode()ExceptiongetException()okhttp3.HeadersgetHeaders()PlugingetPlugin()StringgetResponse()booleanisError()Indicate this is an exception thrown HttpResponsestatic HttpResponseofNull(Plugin plugin)
-
-
-
Field Detail
-
UNKNOWN_REQUEST
public static final int UNKNOWN_REQUEST
Unknown request type error code- See Also:
- Constant Field Values
-
EXCEPTION
public static final int EXCEPTION
Exception thrown error code- See Also:
- Constant Field Values
-
-
Method Detail
-
ofNull
public static HttpResponse ofNull(Plugin plugin)
-
getException
@Nullable public Exception getException()
-
getCode
public int getCode()
-
getAsJSON
@NotNull public JSON getAsJSON()
Get the values as JSON instance- Returns:
- JSON instance of this response data
-
getResponse
@Nullable public String getResponse()
-
getHeaders
@Nullable public okhttp3.Headers getHeaders()
-
getPlugin
public Plugin getPlugin()
-
isError
public boolean isError()
Indicate this is an exception thrown HttpResponse- Returns:
- true if this is an exception thrown HttpResponse, false otherwise
-
-