UNPKG

@api-helper/template

Version:

根据 Swagger 的接口定义生成 TypeScript/JavaScript 的接口类型及其请求函数代码。

44 lines (43 loc) 1.44 kB
import { PrettierOptions, FormatCodeConfig } from '@api-helper/core/lib/interface'; import { APIHelper } from '@api-helper/core/es/lib/types'; export declare type RenderApiTemplateParams = { apiList: Array<APIHelper.API>; }; export declare type RenderModelTemplateParams = { api: APIHelper.API; requestDataSchemaList: APIHelper.SchemaList; responseDataSchemaList: APIHelper.SchemaList; }; declare type Template = { title: string; id: string; content: string; builtIn: boolean; formatCodeExtension: FormatCodeConfig['formatCodeExtension'] | ''; }; declare type DocumentConfig = { id: string; title: string; url: string; type: string; auth?: { username?: string; password?: string; }; authToken: string; dataKey: string; /** 以下属性是基于项目级别的通用配置项 - 开始 * */ fileDirectoryId: string; fileDirectoryExportPath: string; apiTplId: string; modelTplId: string; headCodeText: string; onlyApiFunc: boolean; maxlength: number; placeholder: number; grid: number; generateLabel: number; prettierOptions: PrettierOptions; }; declare const _default: (templateMap: Template, params: RenderApiTemplateParams | RenderModelTemplateParams, documentConfig?: DocumentConfig | undefined, formatCodeFunc?: Function | undefined) => Promise<Array<APIHelper.TemplateContent>>; export default _default;