UNPKG

@avonjs/avonjs

Version:

A fluent Node.js API generator.

32 lines (31 loc) 836 B
import type { AnyRecord, AnyValue } from '../../Contracts'; export default abstract class AvonResponse { code: number; data: Record<string | number, AnyValue>; meta: AnyRecord; /** * Indicates custom headers. */ protected headers: AnyRecord; constructor(code: number, data?: Record<string | number, AnyValue>, meta?: AnyRecord); /** * Merge the given meta into the response meta. */ withMeta(meta: string | AnyRecord, value?: AnyValue): this; /** * Get content for response. */ content(): AnyRecord; /** * Get response status code. */ getStatusCode(): number; /** * Get the response headers. */ getHeaders(): AnyRecord; /** * Append header value to response. */ withHeader(key: string, value: AnyValue): this; }