@companydev/shared-kernel
Version:
Shared kernel for DDD hexagonal architecture
27 lines (26 loc) • 1.31 kB
TypeScript
import type { APIGatewayProxyResult } from 'aws-lambda';
interface SuccessParams<T> {
data: T;
statusCode?: number;
}
export declare class ApiResponseBuilder {
private static createTimestamp;
private static buildResponse;
private static createSuccessBody;
private static createErrorBody;
static success<T>(params: SuccessParams<T>): APIGatewayProxyResult;
static ok<T>(data: T): APIGatewayProxyResult;
static created<T>(data: T): APIGatewayProxyResult;
static noContent(): APIGatewayProxyResult;
private static error;
static badRequest(message: string, code: string): APIGatewayProxyResult;
static unauthorized(message: string, code: string): APIGatewayProxyResult;
static forbidden(message: string, code: string): APIGatewayProxyResult;
static notFound(message: string, code: string): APIGatewayProxyResult;
static conflict(message: string, code: string): APIGatewayProxyResult;
static unprocessableEntity(message: string, code: string): APIGatewayProxyResult;
static internalServerError(message: string, code: string): APIGatewayProxyResult;
static serviceUnavailable(message: string, code: string): APIGatewayProxyResult;
static custom(statusCode: number, message: string, code: string): APIGatewayProxyResult;
}
export {};