import { HttpResponse } from "./response.js"; import { TO_HTTP_RESPONSE, type ToHttpResponse } from "./to-response.js"; /** * Represents HTTP status codes along with their standard reason phrases. * * This class provides a set of constants corresponding to standard HTTP status * codes, which are compliant with various RFC documents. It enables developers * to use predefined instances for status codes and reason phrases, thus * improving readability and reducing potential errors. * * The `StatusCode` class implements the `ToHttpResponse` interface, which may * provide additional functionality when interacting with HTTP responses. */ export declare class StatusCode implements ToHttpResponse { /** * 100 Continue * [[RFC9110, Section 15.2.1]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.2.1) */ static readonly CONTINUE: StatusCode; /** * 101 Switching Protocols * [[RFC9110, Section 15.2.2]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.2.2) */ static readonly SWITCHING_PROTOCOLS: StatusCode; /** * 102 Processing * [[RFC2518, Section 10.1]](https://datatracker.ietf.org/doc/html/rfc2518#section-10.1) */ static readonly PROCESSING: StatusCode; /** * 200 OK * [[RFC9110, Section 15.3.1]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.3.1) */ static readonly OK: StatusCode; /** * 201 Created * [[RFC9110, Section 15.3.2]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.3.2) */ static readonly CREATED: StatusCode; /** * 202 Accepted * [[RFC9110, Section 15.3.3]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.3.3) */ static readonly ACCEPTED: StatusCode; /** * 203 Non-Authoritative Information * [[RFC9110, Section 15.3.4]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.3.4) */ static readonly NON_AUTHORITATIVE_INFORMATION: StatusCode; /** * 204 No Content * [[RFC9110, Section 15.3.5]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.3.5) */ static readonly NO_CONTENT: StatusCode; /** * 205 Reset Content * [[RFC9110, Section 15.3.6]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.3.6) */ static readonly RESET_CONTENT: StatusCode; /** * 206 Partial Content * [[RFC9110, Section 15.3.7]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.3.7) */ static readonly PARTIAL_CONTENT: StatusCode; /** * 207 Multi-Status * [[RFC4918, Section 11.1]](https://datatracker.ietf.org/doc/html/rfc4918#section-11.1) */ static readonly MULTI_STATUS: StatusCode; /** * 208 Already Reported * [[RFC5842, Section 7.1]](https://datatracker.ietf.org/doc/html/rfc5842#section-7.1) */ static readonly ALREADY_REPORTED: StatusCode; /** * 226 IM Used * [[RFC3229, Section 10.4.1]](https://datatracker.ietf.org/doc/html/rfc3229#section-10.4.1) */ static readonly IM_USED: StatusCode; /** * 300 Multiple Choices * [[RFC9110, Section 15.4.1]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.4.1) */ static readonly MULTIPLE_CHOICES: StatusCode; /** * 301 Moved Permanently * [[RFC9110, Section 15.4.2]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.4.2) */ static readonly MOVED_PERMANENTLY: StatusCode; /** * 302 Found * [[RFC9110, Section 15.4.3]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.4.3) */ static readonly FOUND: StatusCode; /** * 303 See Other * [[RFC9110, Section 15.4.4]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.4.4) */ static readonly SEE_OTHER: StatusCode; /** * 304 Not Modified * [[RFC9110, Section 15.4.5]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.4.5) */ static readonly NOT_MODIFIED: StatusCode; /** * 305 Use Proxy * [[RFC9110, Section 15.4.6]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.4.6) */ static readonly USE_PROXY: StatusCode; /** * 307 Temporary Redirect * [[RFC9110, Section 15.4.7]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.4.7) */ static readonly TEMPORARY_REDIRECT: StatusCode; /** * 308 Permanent Redirect * [[RFC9110, Section 15.4.8]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.4.8) */ static readonly PERMANENT_REDIRECT: StatusCode; /** * 400 Bad Request * [[RFC9110, Section 15.5.1]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.1) */ static readonly BAD_REQUEST: StatusCode; /** * 401 Unauthorized * [[RFC9110, Section 15.5.2]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.2) */ static readonly UNAUTHORIZED: StatusCode; /** * 402 Payment Required * [[RFC9110, Section 15.5.3]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.3) */ static readonly PAYMENT_REQUIRED: StatusCode; /** * 403 Forbidden * [[RFC9110, Section 15.5.4]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.4) */ static readonly FORBIDDEN: StatusCode; /** * 404 Not Found * [[RFC9110, Section 15.5.5]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.5) */ static readonly NOT_FOUND: StatusCode; /** * 405 Method Not Allowed * [[RFC9110, Section 15.5.6]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.6) */ static readonly METHOD_NOT_ALLOWED: StatusCode; /** * 406 Not Acceptable * [[RFC9110, Section 15.5.7]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.7) */ static readonly NOT_ACCEPTABLE: StatusCode; /** * 407 Proxy Authentication Required * [[RFC9110, Section 15.5.8]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.8) */ static readonly PROXY_AUTHENTICATION_REQUIRED: StatusCode; /** * 408 Request Timeout * [[RFC9110, Section 15.5.9]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.9) */ static readonly REQUEST_TIMEOUT: StatusCode; /** * 409 Conflict * [[RFC9110, Section 15.5.10]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.10) */ static readonly CONFLICT: StatusCode; /** * 410 Gone * [[RFC9110, Section 15.5.11]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.11) */ static readonly GONE: StatusCode; /** * 411 Length Required * [[RFC9110, Section 15.5.12]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.12) */ static readonly LENGTH_REQUIRED: StatusCode; /** * 412 Precondition Failed * [[RFC9110, Section 15.5.13]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.13) */ static readonly PRECONDITION_FAILED: StatusCode; /** * 413 Content Too Large * [[RFC9110, Section 15.5.14]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.14) */ static readonly CONTENT_TOO_LARGE: StatusCode; /** * 414 URI Too Long * [[RFC9110, Section 15.5.15]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.15) */ static readonly URI_TOO_LONG: StatusCode; /** * 415 Unsupported Media Type * [[RFC9110, Section 15.5.16]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.16) */ static readonly UNSUPPORTED_MEDIA_TYPE: StatusCode; /** * 416 Range Not Satisfiable * [[RFC9110, Section 15.5.17]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.17) */ static readonly RANGE_NOT_SATISFIABLE: StatusCode; /** * 417 Expectation Failed * [[RFC9110, Section 15.5.18]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.18) */ static readonly EXPECTATION_FAILED: StatusCode; /** * 418 I'm a teapot * [[RFC7168]](https://datatracker.ietf.org/doc/html/rfc7168) */ static readonly IM_A_TEAPOT: StatusCode; /** * 421 Misdirected Request * [[RFC9110, Section 15.5.20]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.20) */ static readonly MISDIRECTED_REQUEST: StatusCode; /** * 422 Unprocessable Content * [[RFC9110, Section 15.5.21]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.21) */ static readonly UNPROCESSABLE_CONTENT: StatusCode; /** * 423 Locked * [[RFC4918, Section 11.3]](https://datatracker.ietf.org/doc/html/rfc4918#section-11.3) */ static readonly LOCKED: StatusCode; /** * 424 Failed Dependency * [[RFC4918, Section 11.4]](https://datatracker.ietf.org/doc/html/rfc4918#section-11.4) */ static readonly FAILED_DEPENDENCY: StatusCode; /** * 425 Too Early * [[RFC8470, Section 5.2]](https://datatracker.ietf.org/doc/html/rfc8470#section-5.2) */ static readonly TOO_EARLY: StatusCode; /** * 426 Upgrade Required * [[RFC9110, Section 15.5.22]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.22) */ static readonly UPGRADE_REQUIRED: StatusCode; /** * 428 Precondition Required * [[RFC6585, Section 3]](https://datatracker.ietf.org/doc/html/rfc6585#section-3) */ static readonly PRECONDITION_REQUIRED: StatusCode; /** * 429 Too Many Requests * [[RFC6585, Section 4]](https://datatracker.ietf.org/doc/html/rfc6585#section-4) */ static readonly TOO_MANY_REQUESTS: StatusCode; /** * 431 Request Header Fields Too Large * [[RFC6585, Section 5]](https://datatracker.ietf.org/doc/html/rfc6585#section-5) */ static readonly REQUEST_HEADER_FIELDS_TOO_LARGE: StatusCode; /** * 451 Unavailable For Legal Reasons * [[RFC7725]](https://datatracker.ietf.org/doc/html/rfc7725) */ static readonly UNAVAILABLE_FOR_LEGAL_REASONS: StatusCode; /** * 500 Internal Server Error * [[RFC9110, Section 15.6.1]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.1) */ static readonly INTERNAL_SERVER_ERROR: StatusCode; /** * 501 Not Implemented * [[RFC9110, Section 15.6.2]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.2) */ static readonly NOT_IMPLEMENTED: StatusCode; /** * 502 Bad Gateway * [[RFC9110, Section 15.6.3]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.3) */ static readonly BAD_GATEWAY: StatusCode; /** * 503 Service Unavailable * [[RFC9110, Section 15.6.4]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.4) */ static readonly SERVICE_UNAVAILABLE: StatusCode; /** * 504 Gateway Timeout * [[RFC9110, Section 15.6.5]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.5) */ static readonly GATEWAY_TIMEOUT: StatusCode; /** * 505 HTTP Version Not Supported * [[RFC9110, Section 15.6.6]](https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.6) */ static readonly HTTP_VERSION_NOT_SUPPORTED: StatusCode; /** * 506 Variant Also Negotiates * [[RFC2295, Section 8.1]](https://datatracker.ietf.org/doc/html/rfc2295#section-8.1) */ static readonly VARIANT_ALSO_NEGOTIATES: StatusCode; /** * 507 Insufficient Storage * [[RFC4918, Section 11.5]](https://datatracker.ietf.org/doc/html/rfc4918#section-11.5) */ static readonly INSUFFICIENT_STORAGE: StatusCode; /** * 508 Loop Detected * [[RFC5842, Section 7.2]](https://datatracker.ietf.org/doc/html/rfc5842#section-7.2) */ static readonly LOOP_DETECTED: StatusCode; /** * 510 Not Extended * [[RFC2774, Section 7]](https://datatracker.ietf.org/doc/html/rfc2774#section-7) */ static readonly NOT_EXTENDED: StatusCode; /** * 511 Network Authentication Required * [[RFC6585, Section 6]](https://datatracker.ietf.org/doc/html/rfc6585#section-6) */ static readonly NETWORK_AUTHENTICATION_REQUIRED: StatusCode; readonly code: number; readonly phrase: string; private constructor(); private static create; /** * Converts a numeric code to its corresponding StatusCode. * * @throws {Error} if the provided code is not defined in the code map. */ static fromCode(code: number): StatusCode; /** * Determines if the current HTTP status code falls within the informational * response range (100-199). */ isInformational(): boolean; /** * Determines if the current HTTP status code falls within the success * response range (200-299). */ isSuccess(): boolean; /** * Determines if the current HTTP status code falls within the redirection * response range (300-399). */ isRedirection(): boolean; /** * Determines if the current HTTP status code falls within the client error * response range (400-499). */ isClientError(): boolean; /** * Determines if the current HTTP status code falls within the server error * response range (500-599). */ isServerError(): boolean; [TO_HTTP_RESPONSE](): HttpResponse; toJSON(): number; }