erest
    Preparing search index...

    Interface IApiInfo<T, Raw, State>

    API接口定义

    interface IApiInfo<
        T,
        Raw = unknown,
        State extends Record<string, unknown> = Record<string, unknown>,
    > {
        $apis: Map<string, API<T, Raw, State>>;
        afterHooks: Set<T>;
        beforeHooks: Set<T>;
        define: (opt: APIDefine<T>) => API<T, Raw, State>;
        delete: (path: string) => API<T, Raw, State>;
        docOutputFormat?: (out: unknown) => unknown;
        docs?: IAPIDoc;
        errorEnveloper?: (
            err: unknown,
            ctx: Context,
        ) => { body: unknown; status: number };
        formatOutputReverse?: (out: unknown) => [Error | null, unknown];
        get: (path: string) => API<T, Raw, State>;
        patch: (path: string) => API<T, Raw, State>;
        post: (path: string) => API<T, Raw, State>;
        put: (path: string) => API<T, Raw, State>;
        successEnveloper?: (data: unknown, ctx: Context) => unknown;
        [key: string]: unknown;
    }

    Type Parameters

    • T
    • Raw = unknown
    • State extends Record<string, unknown> = Record<string, unknown>

    Hierarchy (View Summary)

    Indexable

    • [key: string]: unknown
    Index

    Properties

    $apis: Map<string, API<T, Raw, State>>
    afterHooks: Set<T>
    beforeHooks: Set<T>
    define: (opt: APIDefine<T>) => API<T, Raw, State>
    delete: (path: string) => API<T, Raw, State>
    docOutputFormat?: (out: unknown) => unknown
    docs?: IAPIDoc
    errorEnveloper?: (
        err: unknown,
        ctx: Context,
    ) => { body: unknown; status: number }

    全局错误信封包装器(抛错时自动包装为 {body, status})

    formatOutputReverse?: (out: unknown) => [Error | null, unknown]
    get: (path: string) => API<T, Raw, State>
    patch: (path: string) => API<T, Raw, State>

    Readonlypost

    post: (path: string) => API<T, Raw, State>
    put: (path: string) => API<T, Raw, State>
    successEnveloper?: (data: unknown, ctx: Context) => unknown

    全局成功信封包装器(setResponseEnvelopers 注册后,handler return data 自动经此包装)