HTTP Status Codes

See https://www.restapitutorial.com/httpstatuscodes.html

/** 200: The operation succeeded */
const val HTTP_STATUS_200 = 200

/** 304: Used with caching to indicate that the cached copy is still valid. */
const val HTTP_STATUS_304 = 304

/** 400: The request is believed to be invalid in some way. The response body will contain an error message.
 * You should display the error message to the user. */
const val HTTP_STATUS_400 = 400

/** 401: An OAuth authentication failure occurred. You should ask the user to log in again. */
const val HTTP_STATUS_401 = 401

/** 429: Your rate limit has been exceeded. Your rate limit will reset at the start of the next hour.
 * You should not attempt to make any more calls until then. */
const val HTTP_STATUS_429 = 429

/** 500: The server encountered an unexpected condition which prevented it from fulfilling the request.
 * You should display a generic “whoops” error message to the user. */
const val HTTP_STATUS_500 = 500
val isSuccessful: Boolean
    get() = code >= HttpURLConnection.HTTP_OK && code < HttpURLConnection.HTTP_MULT_CHOICE