70 lines
2.6 KiB
Ruby
70 lines
2.6 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class YiffyAPIErrorCodes
|
|
attr_reader :code, :status
|
|
|
|
def initialize(code, status)
|
|
@code = code
|
|
@status = status
|
|
end
|
|
|
|
INTERNAL_ERROR = new(0, 500)
|
|
ACCESS_DENIED = new(1, 403)
|
|
READONLY = new(2, 503)
|
|
RATELIMIT_ROUTE = new(1000, 429)
|
|
RATELIMIT_GLOBAL = new(1001, 429)
|
|
IP_BLOCKED = new(1002, 403)
|
|
# unused
|
|
DOWN_FOR_MAINTENANCE = new(1003, nil)
|
|
|
|
INVALID_API_KEY = new(1010, 401)
|
|
INACTIVE_API_KEY = new(1011, 401)
|
|
DISABLED_API_KEY = new(1012, 403)
|
|
API_KEY_REQUIRED = new(1013, 401)
|
|
ANONYMOUS_RESTRICTED = new(1014, 403)
|
|
|
|
DISK_FULL = new(1020, 507)
|
|
BLOCKED_USERAGENT = new(1021, 403)
|
|
SERVICE_NO_ACCESS = new(1022, 403)
|
|
UNKNOWN_ROUTE = new(1024, 404)
|
|
METHOD_NOT_ALLOWED = new(1025, 405)
|
|
|
|
# legacy codes that are spread out
|
|
# unused
|
|
IMAGES_INVALID_RESPONSE_TYPE = new(1023, nil)
|
|
IMAGES_CATEGORY_NOT_FOUND = new(1030, 404)
|
|
# unused
|
|
IMAGES_EMPTY_CATEGORY = new(1031, nil)
|
|
IMAGES_NOT_FOUND = new(1040, 404)
|
|
IMAGES_NO_RESULTS = new(1041, 400)
|
|
IMAGES_AMOUNT_LT_ONE = new(1051, 400)
|
|
IMAGES_AMOUNT_GT_FIVE = new(1052, 400)
|
|
IMAGES_IMAGE_RESPONSE_DISABLED = new(1053, 404)
|
|
BULK_IMAGES_INVALID_BODY = new(1054, 400)
|
|
BULK_IMAGES_INVALID_CATEGORY = new(1055, 400)
|
|
BULK_IMAGES_NUMBER_GT_MAX = new(1056, 400)
|
|
IMAGES_SFW_ONLY_API_KEY = new(1057, 403)
|
|
|
|
THUMBS_GENERIC_ERROR = new(1060, 500)
|
|
THUMBS_API_KEY_REQUIRED = new(1061, nil) # unused
|
|
THUMBS_INVALID_POST_ID = new(1062, 404)
|
|
THUMBS_INVALID_MD5 = new(1063, 404)
|
|
THUMBS_INVALID_TYPE = new(1064, 404)
|
|
THUMBS_TIMEOUT = new(1065, 500)
|
|
THUMBS_CHECK_NOT_FOUND = new(1066, 404)
|
|
THUMBS_GIF_DISABLED = new(1067, 400)
|
|
|
|
SHORTENER_CODE_TOO_LONG = new(1070, 422)
|
|
SHORTENER_INVALID_CODE = new(1071, 422)
|
|
SHORTENER_CODE_IN_USE = new(1072, 409)
|
|
SHORTENER_INVALID_URL = new(1073, 422)
|
|
SHORTENER_CREDIT_TOO_LONG = new(1074, 422)
|
|
SHORTENER_NOT_FOUND = new(1075, 404)
|
|
SHORTENER_MANAGEMENT_CODE_REQUIRED = new(1076, 401)
|
|
SHORTENER_NO_MANAGEMENT_CODE = new(1077, 403)
|
|
SHORTENER_MANAGEMENT_CODE_MISMATCH = new(1078, 401)
|
|
SHORTENER_URL_IN_USE = new(1079, 409)
|
|
SHORTENER_NO_CHANGES = new(1080, 400)
|
|
SHORTENER_URL_TOO_LONG = new(1081, 422)
|
|
end
|