import { BufferEncoding } from 'formidable'; import { FileResponse, MiddlewareModificationRequest, RawResponse, Redirect, SigilResponse } from '../../responses'; import { BadGateway, BadRequest, Conflict, Exception, ExpectationFailed, FailedDependency, Forbidden, GatewayTimeout, Gone, HTTPVersionNotSupported, ImATeapot, InsufficientStorage, InternalServerError, LengthRequired, Locked, LoopDetected, MethodNotAllowed, MisdirectedRequest, NetworkAuthenticationRequired, NotAcceptable, NotExtended, NotFound, NotImplemented, PayloadTooLarge, PaymentRequired, PreconditionFailed, PreconditionRequired, ProxyAuthenticationRequired, RangeNotSatisfiable, RequestHeaderFieldsTooLarge, RequestTimeout, ServiceUnavailable, TooEarly, TooManyRequests, Unauthorized, UnavailableForLegalReasons, UnprocessableEntity, UnsupportedMediaType, UpgradeRequired, URITooLong, VariantAlsoNegotiates } from '../../responses/exceptions'; import { MiddlewareModificationRequestOptions } from '../../responses/middleware-modification-request'; /** * Helper class providing factory methods for standard successful responses. * Includes JSON, raw, redirect, and file response constructors. */ declare class SuccessSigilResponses { /** * Creates a standard JSON response with status code and headers. * * @param payload - The content payload to send. * @param code - HTTP status code (default: 200). * @param headers - Optional headers object. * @returns A SigilResponse instance. */ response(payload: any, code?: number, headers?: Record): SigilResponse; /** * If returned from middleware, will replace response status code and merge with * existing headers, instead of returning actual response * * If returned outside of middleware, will act like * default SigilResponse with null as body * * @param {MiddlewareModificationRequestOptions} options params that will be modified if request accepted */ middlewareModificationRequest(options: MiddlewareModificationRequestOptions): MiddlewareModificationRequest; /** * Creates a raw response with custom headers or init options. * * @param payload - The raw content payload (string, buffer, etc.). * @param headers - Optional headers object, Headers instance, or init. * @param code - HTTP status code (default: 200). * @returns A RawResponse instance. */ rawResponse(payload: any, headers?: Record | Headers | HeadersInit, code?: number): RawResponse; /** * Creates a redirect response to the specified URL. * * @param to - Target URL for redirection. * @param code - Optional HTTP redirect code (3xx). * @returns A Redirect instance. */ redirect(to: string, code?: number): Redirect; /** * Creates a file response serving a file from disk. * * @param path - Filesystem path to the file. * @param contentType - Optional MIME type of the file. * @param encoding - Optional file encoding (default: utf8). * @returns A FileResponse instance. */ fileResponse(path: string, contentType?: string, encoding?: BufferEncoding): FileResponse; } /** * Extended response factory including common HTTP exceptions. * Provides methods to generate standard error responses by status code. */ export default class SigilResponsesList extends SuccessSigilResponses { /** * Creates a generic exception response. * * @param message - Error message. * @param code - HTTP status code (default: 500). * @param name - Optional exception name. * @returns An Exception instance. */ exception(message: string, code?: number, name?: string): Exception; /** @returns 400 Bad Request exception. */ badRequest(...messages: string[]): BadRequest; /** @returns 401 Unauthorized exception. */ unauthorized(...messages: string[]): Unauthorized; /** @returns 402 Payment Required exception. */ paymentRequired(...messages: string[]): PaymentRequired; /** @returns 403 Forbidden exception. */ forbidden(...messages: string[]): Forbidden; /** @returns 404 Not Found exception. */ notFound(...messages: string[]): NotFound; /** @returns 405 Method Not Allowed exception. */ methodNotAllowed(...messages: string[]): MethodNotAllowed; /** @returns 406 Not Acceptable exception. */ notAcceptable(...messages: string[]): NotAcceptable; /** @returns 407 Proxy Authentication Required exception. */ proxyAuthenticationRequired(...messages: string[]): ProxyAuthenticationRequired; /** @returns 408 Request Timeout exception. */ requestTimeout(...messages: string[]): RequestTimeout; /** @returns 409 Conflict exception. */ conflict(...messages: string[]): Conflict; /** @returns 410 Gone exception. */ gone(...messages: string[]): Gone; /** @returns 411 Length Required exception. */ lengthRequired(...messages: string[]): LengthRequired; /** @returns 412 Precondition Failed exception. */ preconditionFailed(...messages: string[]): PreconditionFailed; /** @returns 413 Payload Too Large exception. */ payloadTooLarge(...messages: string[]): PayloadTooLarge; /** @returns 414 URI Too Long exception. */ uriTooLong(...messages: string[]): URITooLong; /** @returns 415 Unsupported Media Type exception. */ unsupportedMediaType(...messages: string[]): UnsupportedMediaType; /** @returns 416 Range Not Satisfiable exception. */ rangeNotSatisfiable(...messages: string[]): RangeNotSatisfiable; /** @returns 417 Expectation Failed exception. */ expectationFailed(...messages: string[]): ExpectationFailed; /** @returns 418 I'm a Teapot exception. */ imATeapot(...messages: string[]): ImATeapot; /** @returns 421 Misdirected Request exception. */ misdirectedRequest(...messages: string[]): MisdirectedRequest; /** @returns 422 Unprocessable Entity exception. */ unprocessableEntity(...messages: string[]): UnprocessableEntity; /** @returns 423 Locked exception. */ locked(...messages: string[]): Locked; /** @returns 424 Failed Dependency exception. */ failedDependency(...messages: string[]): FailedDependency; /** @returns 425 Too Early exception. */ tooEarly(...messages: string[]): TooEarly; /** @returns 426 Upgrade Required exception. */ upgradeRequired(...messages: string[]): UpgradeRequired; /** @returns 428 Precondition Required exception. */ preconditionRequired(...messages: string[]): PreconditionRequired; /** @returns 429 Too Many Requests exception. */ tooManyRequests(...messages: string[]): TooManyRequests; /** @returns 431 Request Header Fields Too Large exception. */ requestHeaderFieldsTooLarge(...messages: string[]): RequestHeaderFieldsTooLarge; /** @returns 451 Unavailable For Legal Reasons exception. */ unavailableForLegalReasons(...messages: string[]): UnavailableForLegalReasons; /** @returns 500 Internal Server Error exception. */ internalServerError(...messages: string[]): InternalServerError; /** @returns 501 Not Implemented exception. */ notImplemented(...messages: string[]): NotImplemented; /** @returns 502 Bad Gateway exception. */ badGateway(...messages: string[]): BadGateway; /** @returns 503 Service Unavailable exception. */ serviceUnavailable(...messages: string[]): ServiceUnavailable; /** @returns 504 Gateway Timeout exception. */ gatewayTimeout(...messages: string[]): GatewayTimeout; /** @returns 505 HTTP Version Not Supported exception. */ httpVersionNotSupported(...messages: string[]): HTTPVersionNotSupported; /** @returns 506 Variant Also Negotiates exception. */ variantAlsoNegotiates(...messages: string[]): VariantAlsoNegotiates; /** @returns 507 Insufficient Storage exception. */ insufficientStorage(...messages: string[]): InsufficientStorage; /** @returns 508 Loop Detected exception. */ loopDetected(...messages: string[]): LoopDetected; /** @returns 510 Not Extended exception. */ notExtended(...messages: string[]): NotExtended; /** @returns 511 Network Authentication Required exception. */ networkAuthenticationRequired(...messages: string[]): NetworkAuthenticationRequired; } export {};