
org.sourcelab.github.client.response.ErrorResponse Maven / Gradle / Ivy
The newest version!
package org.sourcelab.github.client.response;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Represents an Error response from the REST Api.
*/
public class ErrorResponse {
private final String message;
private final String documentationUrl;
private final List errors;
/**
* Constructor.
*/
@JsonCreator
public ErrorResponse(
@JsonProperty("message") final String message,
@JsonProperty("documentation_url") final String documentationUrl,
@JsonProperty("errors") final List errors
) {
this.message = message;
this.documentationUrl = documentationUrl;
if (errors == null) {
this.errors = Collections.emptyList();
} else {
this.errors = Collections.unmodifiableList(new ArrayList<>(errors));
}
}
/**
* Error message value.
* @return Error message value.
*/
public String getMessage() {
return message;
}
/**
* Documentation url value.
* @return Documentation url value.
*/
public String getDocumentationUrl() {
return documentationUrl;
}
/**
* Optionally returned by API, the specific fields with errors.
* @return List of specific field errors.
*/
public List getErrors() {
return errors;
}
@Override
public String toString() {
return "ErrorResponse{"
+ "\n\tmessage='" + message + '\''
+ "\n\tdocumentationUrl='" + documentationUrl + '\''
+ "\n\terrors=" + errors
+ "\n}";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy