@lcap/asl
Version:
NetEase Application Specific Language
154 lines (153 loc) • 3.11 kB
TypeScript
import { LEVEL_ENUM, Vertex, MicroService, Logic, Service, ActionOptions } from '..';
/**
* 接口类
*/
export declare class Interface extends Vertex {
/**
* 概念类型
*/
readonly level: LEVEL_ENUM;
/**
* Id
*/
readonly id: string;
/**
* InterfaceKey
*/
readonly key: string;
/**
* 名称
*/
readonly name: string;
/**
* 协议
*/
readonly protocol: string;
/**
* 地址
*/
readonly host: string;
/**
* 端口
*/
readonly port: string;
/**
* 路径
*/
readonly path: string;
/**
* 方法
*/
readonly method: string;
/**
* 描述
*/
readonly description: string;
/**
* 请求数据
*/
exportedInterface: Interface;
/**
* 逻辑 Id
*/
readonly logicId: string;
/**
* 逻辑
* @TODO 使用 excludedInJSON 有点问题,不同 class 相同字段会串
*/
logic: Logic;
/**
* Service 类型
*/
readonly serviceType: 'micro' | 'entity' | 'process' | 'processComponent' | 'external' | 'export';
/**
* Service Id
*/
readonly serviceId: string;
/**
* Service Name
*/
readonly category: string;
/**
* 所属实体 Id
*/
entityId: string;
/**
* Service 名称
*/
readonly serviceName: string;
/**
* Service
*/
readonly service: MicroService;
/**
* 参数
*/
parameters: string;
/**
* 返回值
*/
responses: string;
/**
* 请求数据
*/
requestBody: string;
/**
* 树组件的子节点字段
*/
readonly moreChildrenFields: Array<string>;
/**
* 周边存在的名称
*/
existingNames: Array<string>;
/**
* @param source 需要合并的部分参数
*/
constructor(source?: Partial<Interface>);
/**
* 按当前 id 加载接口数据
* @requires this.id
*/
load(): Promise<this>;
/**
* 添加接口
*/
create(none?: void, actionOptions?: ActionOptions, then?: () => Promise<any>): Promise<this>;
/**
* 删除接口
*/
delete(none?: void, actionOptions?: ActionOptions): Promise<void>;
/**
* 更新接口
*/
update(none?: void, actionOptions?: ActionOptions, then?: () => Promise<any>): Promise<this>;
/**
* 设置接口名称
*/
setName(name: string): Promise<void>;
/**
* 设置接口描述
*/
setDescription(description: string): Promise<void>;
/**
* 设置接口路径
*/
setPath(path: string): Promise<void>;
/**
* 设置接口方法
*/
setMethod(method: string): Promise<void>;
/**
* 设置接口参数和返回值类型
*/
setParamAndReturn(): Promise<void>;
/**
* 查找引用
*/
findUsage(): Promise<any>;
/**
* 从后端 JSON 生成规范的 Interface 对象
*/
static from(source: any, service: Service): Interface;
}
export default Interface;