You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

201 lines
5.1 KiB

declare module "dpa" {
global {
/**
* @description: 运行在 dpa 的脚本,可以使用额外的环境信息和功能。
*/
const dpa: DPA;
}
interface DPA {
/**
* @description: 包含环境信息和开发者自定义的脚本配置(参见 [在脚本中使用配置] )。
*
* [在脚本中使用配置]: https://docs.hamibot.com/tutorials/tutorial-config#%E5%9C%A8%E8%84%9A%E6%9C%AC%E4%B8%AD%E4%BD%BF%E7%94%A8%E9%85%8D%E7%BD%AE
*/
readonly env: DPAEnv;
/**
* @description: 获取流程输入。
* @param {string} action 流程输入参数 默认为 input
* @example
* ```typescript
* dpa.getInParam();
* ```
*/
getInParam(action?: string): void;
/**
* @description: 设置流程输出。
* @param {any} content 流程输出内容
* @param {string} action 流程输出参数 默认为 input
* @example
* ```typescript
* dpa.setOutParam('输出内容');
* ```
*/
setOutParam(content: any, action?: string): void;
/**
* @description: 数据表操作
* @param {string} type "find" | "select" | "delete"
* @param {string} content where查询条件
* @example
* ```typescript
* dpa.optDataTable("find", { name: '名字', age: 18 });
* ```
*/
optDataTable(
type: "find" | "select" | "delete",
content?: Record<string, string | number>
): void;
/**
* @description: 数据表操作添加单条数据
* @param {string} type add
* @param {string} content 数据对象
* @example
* ```typescript
* dpa.optDataTable("add", { name: '名字', age: 18 });
* ```
*/
optDataTable(type: "add", content?: Record<string, string | number>): void;
/**
* @description: 数据表操作 添加多条数据
* @param {string} type add
* @param {string} content 数据对象数组
* @example
* ```typescript
* dpa.optDataTable("add", [{ name: '名字1', age: 18 }, { name: '名字2', age: 19 }]);
* ```
*/
optDataTable(
type: "add",
content?: Record<string, string | number>[]
): void;
/**
* @description: 数据表操作 更新数据
* @param {string} type "find" | "select" | "delete"
* @param {string} content where查询条件, data更新数据
* @example
* ```typescript
* dpa.optDataTable("find", { name: '名字', age: 18 });
* ```
*/
optDataTable(
type: "update",
content?: {
where: Record<string, string | number>;
data: Record<string, string | number>;
}
): void;
/**
* @description: 数据表操作 条件更新 当 where 条件未命中到任何数据时添加数据,命中数据则更新该数据。
* @param {string} type "thenUpdate"
* @param {string} content where查询条件, data更新数据
* @example
* ```typescript
* dpa.optDataTable("find", { name: '名字', age: 18 });
* ```
*/
optDataTable(
type: "thenUpdate",
content?: {
where: Record<string, string | number>;
data: Record<string, string | number>;
}
): void;
}
interface DPAEnv {
/**
* @description: 助手id
*/
readonly excutorId: number;
/**
* @description: 任务id
*/
readonly taskId: string;
/**
* @description: DPA应用id
*/
readonly solutionId: number;
/**
* @description: 设备id
*/
readonly deviceId: string;
}
// /**
// * @description: 脚本定价计划。
// */
// interface PricePlan {
// /**
// * @description: 计划名称(默认为 `免费` )。
// */
// readonly name: string;
// /**
// * @description: 定价模式,可以是下列值之一:。
// * - `free`
// * - `flatRate`
// * (默认为 `free` )
// */
// readonly mode: 'free' | 'flatRate';
// /**
// * @description: 是否处于免费试用期(默认为 `false` )。
// */
// readonly onFreeTrial: boolean;
// }
// /**
// * @description: 消息选项。
// */
// interface MessageOptions {
// telemetry: boolean; // TODO: 询问这个键的意义
// /**
// * @description: 消息数据。
// */
// data: MessageData | Object;
// }
// /**
// * @description: 消息数据(包括消息标题和消息附件)。
// */
// interface MessageData {
// /**
// * @description: 消息标题。
// */
// title: string;
// /**
// * @description: 存放附件的数组。
// */
// attachments: MessageAttachment[];
// }
// /**
// * @description: 消息附件。
// */
// interface MessageAttachment {
// /**
// * @description: 附件类型,根据实际需要选择使用,可选的值为:
// *
// * - `text` - 文本类型
// * - `json` - JSON类型
// * - `image` - 图片类型
// *
// */
// type: 'text' | 'json' | 'image';
// /**
// * @description: 附件内容。
// */
// data: string;
// }
}