package com.rollbar.http;

public enum RollbarResponseCode {
    Success(200),
    BadRequest(400),
    Unauthorized(401),
    AccessDenied(403),
    RequestTooLarge(413),
    UnprocessablePayload(422),
    TooManyRequests(429),
    InternalServerError(500);

    private final int value;

    RollbarResponseCode(int value) {
        this.value = value;
    }

    public RollbarResponse response(String message) {
        return RollbarResponse.failure(this, message);
    }

    public static RollbarResponseCode fromInt(int i) throws InvalidResponseCodeException {
        for(RollbarResponseCode rrc : RollbarResponseCode.values()) {
            if (rrc.value == i) return rrc;
        }
        throw new InvalidResponseCodeException(i);
    }
}

@@ -24,458 +24,1782 @@
 p;%0A%0A
-public enum RollbarResponseCode %7B%0A    Success(200),%0A    BadRequest(400),%0A    Unauthorized(401),%0A    AccessDenied(403),%0A    RequestTooLarge(413),%0A    UnprocessablePayload(422),%0A    TooManyRequests(429),%0A    InternalServerError(500);%0A%0A    private final int value;%0A%0A    RollbarResponseCode(int value) %7B%0A        this.value = value;%0A    %7D%0A%0A    public RollbarResponse response(String message) %7B%0A        return RollbarResponse.failure(this, message);%0A    %7D%0A
+/**%0A * Represents expected response codes from POSTing an item to Rollbar%0A *%0A */%0Apublic enum RollbarResponseCode %7B%0A    /**%0A     * A successful POST to the API%0A     */%0A    Success(200),%0A    /**%0A     * Invalid, or missing, JSON POST body.%0A     */%0A    BadRequest(400),%0A    /**%0A     * Missing Access Token. (Check your JSON serialization).%0A     */%0A    Unauthorized(401),%0A    /**%0A     * Invalid access token. Bad format, invalid scope,  for type of request (Client -%3E Server, or vice versa).%0A     * See the %7B@link RollbarResponse%7D message.%0A     */%0A    AccessDenied(403),%0A    /**%0A     * Max Payload size exceeded. Try removing or truncating particularly large portions of your payload%0A     * (e.g. whole binary files, or large strings).%0A     */%0A    RequestTooLarge(413),%0A    /**%0A     * JSON was valid, but semantically incorrect. See %7B@link RollbarResponse%7D message.%0A     */%0A    UnprocessablePayload(422),%0A    /**%0A     * Rate limit for your account or access token was reached.%0A     */%0A    TooManyRequests(429),%0A    /**%0A     * An error occurred on Rollbar's end.%0A     */%0A    InternalServerError(500);%0A%0A    private final int value;%0A%0A    RollbarResponseCode(int value) %7B%0A        this.value = value;%0A    %7D%0A%0A    /**%0A     * Create a %7B@link RollbarResponse%7D from a response code, with a message.%0A     * @param message The explanatory message.%0A     * @return RollbarResponse with explanatory message.%0A     */%0A    public RollbarResponse response(String message) %7B%0A        return RollbarResponse.failure(this, message);%0A    %7D%0A%0A    /**%0A     * Get a Response Code from the integer value returned by the HTTP request.%0A     * @param i the integer value of the response code.%0A     * @return the RollbarResponseCode%0A     * @throws InvalidResponseCodeException if not a valid ResponseCode%0A     */
 %0A   

Document the RollbarResponseCode