import { JSONSchema4 } from 'json-schema'; import { ConfigRC, Method, OriginApis, ReqBodyForm, ReqParam, ReqQuery } from './types'; export declare function isString(str: any): boolean; export declare function isNumber(num: any): boolean; export declare function isRegExp(reg: any): boolean; export declare function isBool(bool: any): boolean; export declare function isDate(date: any): boolean; export declare function isArray(arr: any): boolean; export declare function isObject(obj: any): boolean; export declare function isFunction(fn: any): boolean; /** * 填充一定数量的空格 * @param count 空格数量 */ export declare function fillSpace(count: number): string; /** * 给有内容的字符串前后加空格 * @param str 字符串 */ export declare function wrapSpace(str?: string): string | undefined; /** * 给有内容的字符串前后加换行 * @param str 字符串 * @param spaceBefore 当前行锁进的空格数 * @param withPrefixSpace 换行后是否要追加空格 */ export declare function wrapNewline(str: string | undefined, spaceBefore: number, withPrefixSpace?: boolean): string; /** * 将Json Schema格式的返回值转换成我们需要的格式 * @param json json schema格式的数据 * @param spaceBefore 前置空格数 */ export declare function converJSONSchemaToTypescriptStruct(json: JSONSchema4, spaceBefore: number): string; /** * 将body转化为字符串 * @param api 待转化的service item * @param spaceBefore 前置空格数 */ export declare function convertBodyToString(api: ServiceItem, spaceBefore: number): string; interface ServiceItem { url: string; method: Method; query?: ReqQuery[]; params?: ReqParam[]; type?: 'json' | 'form' | 'file' | 'raw'; body?: ReqBodyForm[] | JSONSchema4 | null; resp?: JSONSchema4; done: boolean; } interface ServiceConvertResult { [key: string]: ServiceItem; } /** * 将Api集合转换成service * @param apis Api集合 */ export declare function convertApiToService(apis: OriginApis, config: ConfigRC): ServiceConvertResult; /** * 根据要转换的语言来移除字符串中要转换的符号或删除符号间的文字 * @param str 待替换的字符串 * @param usingJs 是否要转换为js,默认ts */ export declare function removeJsConvertSymbols(str: string, usingJs: boolean): string; interface CommentItem { symbol?: string; key?: string; value?: string; } /** * 根据注释的内容生成注释字符串 * @param commentItems 注释的内容 * @param spaceBefore 当前锁进的空格的长度 */ export declare function generateComment(commentItems: CommentItem[], spaceBefore: number): string; interface CommonCommentItem { name: string; item?: string; title?: string; desc?: string; example?: string; } /** * 为通用对象生成注释 * @param item 待生成注释的对象 */ export declare function generateCommonComment(item: CommonCommentItem): string; export {};