Class RemoteResponse<T>
java.lang.Object
com.atlassian.jira.plugin.link.applinks.RemoteResponse<T>
- Type Parameters:
T- the type of entity stored in the response
Represents a response from a remote resource, e.g. REST, XMLRPC.
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteResponse(T entity, ErrorCollection errors, com.atlassian.sal.api.net.Response response) RemoteResponse(T entity, com.atlassian.sal.api.net.Response response) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsErrorWithText(String... text) Checks if any of the error messages contain all of the elements in the text list.static <E> RemoteResponse<E> credentialsRequired(com.atlassian.sal.api.net.Response response) Creates a RemoteResponse for when the endpoint requires authentication, but no credentials are available.Returns the ErrorCollection from the response entity.intbooleanReturns true if the response entity was a non-empty ErrorCollection, false if otherwise.booleanvoidsetStatusCode(int statusCode) voidsetSuccessful(boolean success) toString()
-
Constructor Details
-
RemoteResponse
public RemoteResponse(@Nullable T entity, @Nullable ErrorCollection errors, com.atlassian.sal.api.net.Response response) -
RemoteResponse
-
-
Method Details
-
getEntity
-
hasErrors
public boolean hasErrors()Returns true if the response entity was a non-empty ErrorCollection, false if otherwise.- Returns:
- true if the response entity was a non-empty ErrorCollection, false if otherwise
-
getErrors
Returns the ErrorCollection from the response entity. If the response was successful, this will generally be null.- Returns:
- the ErrorCollection from the response entity
-
containsErrorWithText
Checks if any of the error messages contain all of the elements in the text list.- Parameters:
text- an array of snippets to check for in the error message- Returns:
- true if an error message contains all of the elements in the text list, false if otherwise
-
getStatusCode
public int getStatusCode() -
getStatusText
-
isSuccessful
public boolean isSuccessful() -
credentialsRequired
public static <E> RemoteResponse<E> credentialsRequired(com.atlassian.sal.api.net.Response response) Creates a RemoteResponse for when the endpoint requires authentication, but no credentials are available.- Parameters:
response- response requiring authentication- Returns:
- RemoteResponse that requires credentials
-
setStatusCode
public void setStatusCode(int statusCode) -
setSuccessful
public void setSuccessful(boolean success) -
toString
-