UNPKG

apass-opensdk-hugong

Version:

飞书Apass低代码平台-飞书开放平台-相关的接口整合和常用的方法整合

166 lines (147 loc) 4.91 kB
// Object_.d.ts export = Object_; declare class Object_ { constructor(hg: any); /** * 获取对象的所有字段 * @param objectApiName 对象 API 名称 * @returns 字段列表 */ getFields(objectApiName: string): Promise<any[]>; /** * 获取对象的指定字段 * @param objectApiName 对象 API 名称 * @param fieldApiName 字段 API 名称 * @returns 字段对象 */ getField(objectApiName: string, fieldApiName: string): Promise<any>; /** * 执行 OQL 查询,使用系统权限 * @param {*} oql OQL 查询语句 * @param {*} nameArgs 命名参数对象 * @returns 查询结果 */ oqlUseSystemAuth(oql: string, nameArgs?: Record<string, any> | null): Promise<any>; /** * 执行 OQL 查询 * @param oql OQL 查询语句 * @param nameArgs 命名参数对象 * @returns 查询结果 */ oql(oql: string, nameArgs?: Record<string, any> | null, useSystemAuth?: boolean): Promise<any>; /** * 清空表中满足条件的数据 * @param objectApiName 表名 * @param where 条件对象;省略时全部清空 * @param useSystemAuth 是否使用系统权限;默认 false */ clearData(objectApiName: string, where?: any, useSystemAuth?: boolean): Promise<void>; /** * 查询列表,使用系统权限 * @param {*} objectApiName 表名 * @param {*} fields 需要返回的字段,默认 ['_id','_name'] * @param {*} where 过滤条件 * @param {*} callback 每批记录回调;提供时方法返回 void * @param {*} orderby 排序字段,默认 '_id' */ findListUseSystemAuth<T = any>( objectApiName: string, fields?: string[] | null, where?: any, callback?: (records: T[]) => Promise<void> | void, orderby?: string ): Promise<T[] | void>; /** * 查询列表 * @param objectApiName 表名 * @param field 需要返回的字段,默认 ['_id','_name'] * @param where 过滤条件 * @param callback 每批记录回调;提供时方法返回 void * @param orderby 排序字段,默认 '_id' * @param useSystemAuth 是否使用系统权限;默认 false * @returns 无 callback 时返回全部记录 */ findList<T = any>( objectApiName: string, fields?: string[] | null, where?: any, callback?: (records: T[]) => Promise<void> | void, orderby?: string, useSystemAuth?: boolean ): Promise<T[] | void>; /** * 查询单条记录,使用系统权限 * @param {*} objectApiName 表名 * @param {*} fields 需要返回的字段,默认 ['_id','_name'] * @param {*} where 过滤条件 */ findOneUseSystemAuth<T = any>( objectApiName: string, fields?: string[] | null, where?: any ): Promise<T | null>; /** * 查询单条记录 * @param objectApiName 表名 * @param field 需要返回的字段,默认 ['_id','_name'] * @param where 过滤条件 * @param useSystemAuth 是否使用系统权限;默认 false * @returns 记录对象或 null */ findOne<T = any>( objectApiName: string, fields?: string[] | null, where?: any, useSystemAuth?: boolean ): Promise<T | null>; /** * 查询单条记录,使用系统权限 * @param {*} objectApiName 表名 * @param {*} fields 需要返回的字段,默认 ['_id','_name'] * @param {*} where 过滤条件 */ findOneByIdUseSystemAuth<T = any>( objectApiName: string, id: string | number, fields?: string[] | null ): Promise<T | null>; /** * 根据主键查询单条记录 * @param objectApiName 表名 * @param id 记录 ID * @param fields 需要返回的字段,默认 ['_id','_name'] * @param useSystemAuth 是否使用系统权限;默认 false * @returns 记录对象或 null */ findOneById<T = any>( objectApiName: string, id: string | number, fields?: string[] | null, useSystemAuth?: boolean ): Promise<T | null>; /** * 批量创建记录 */ batchCreate<T = any>(objectApiName: string, list: T[], useSystemAuth?: boolean): Promise<any | null>; /** * 创建单条记录 */ create<T = any>(objectApiName: string, data: T, useSystemAuth?: boolean): Promise<any>; /** * 批量更新记录 */ batchUpdate<T = any>(objectApiName: string, list: T[], useSystemAuth?: boolean): Promise<any | null>; /** * 更新单条记录 */ update<T = any>(objectApiName: string, data: T, useSystemAuth?: boolean): Promise<any>; /** * 删除单条记录(按 _id) */ deleteOne(objectApiName: string, _id: string | number, useSystemAuth?: boolean): Promise<any>; /** * 批量删除(按 _ids) */ deleteBatchByIds(objectApiName: string, _ids: (string | number)[], useSystemAuth?: boolean): Promise<any | null>; } declare namespace Object_ { }