34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import { Type } from '@nestjs/common';
|
|
import { ReferenceObject, SchemaObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
|
|
export declare class ApiResponseVo<T> {
|
|
code: number;
|
|
msg: string;
|
|
success: boolean;
|
|
data: T;
|
|
constructor(code: number, data: T, msg?: string);
|
|
}
|
|
export declare class PaginatedVo<T> {
|
|
total: number;
|
|
list: T;
|
|
constructor(total: number, list: T);
|
|
}
|
|
export declare class PaginatedDto {
|
|
page?: number;
|
|
size?: number;
|
|
}
|
|
export declare class Api {
|
|
static success<T>(data?: T, msg?: string): ApiResponseVo<T | undefined>;
|
|
static successMsg(msg: string): ApiResponseVo<null>;
|
|
static error(msg: string, code?: number): ApiResponseVo<null>;
|
|
static pagination<T>(list: T, total: number): ApiResponseVo<PaginatedVo<T>>;
|
|
static ApiResponse<T extends Type<any>>(opt?: {
|
|
model?: T;
|
|
codeDescription?: string;
|
|
properties?: Record<string, SchemaObject | ReferenceObject>;
|
|
}): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
static ApiPaginatedResponse<T extends Type<any>>(opt: {
|
|
model: T;
|
|
codeDescription?: string;
|
|
}): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
}
|