/** * 集成中心(UserKey)类型定义 * * 字段与 dev-platform(weda-alternative/apps/dev-platform)对齐: * - 云 API 出入参为 PascalCase(EnvId / KeyID / AuthTypeCode / Ext / NeedPwd 等) * - Ext 为 JSON 字符串,承载动态配置字段(含加密后的敏感值) */ /** Ext 中单个配置字段描述(模板与实例通用) */ export interface IUserKeyExtField { /** 字段名 */ name: string; /** 字段类型,type === 'password' 视为敏感字段 */ type: string; /** 字段展示名 */ label?: string; /** 字段值(实例中为用户填写值,敏感字段为密文) */ value?: string; /** 是否必填 */ required?: boolean; [key: string]: any; } /** Ext 反序列化后的结构 */ export interface IUserKeyExt { /** 动态字段集合 */ fields?: IUserKeyExtField[]; [key: string]: any; } /** 集成模板(密钥对模版) */ export interface IUserKeyTemplate { /** 授权类型码(模板 Key) */ AuthTypeCode: string; /** 授权类型名称(模板中文名) */ AuthTypeName: string; /** 模板原始动态信息,JSON 字符串,含 fields 定义 */ Ext: string; /** 授权 URL(OAuth 类模板) */ AuthURL?: string; /** 模板图标 */ Icon?: string; State?: string; RedirectURI?: string; } /** 密钥对绑定的服务类型 */ export declare enum UserKeyBindServiceType { MCP = "Mcp", APIS = "Apis", OTHER = "Other", CLOUD_FUNCTION = "CloudFunction" } /** 密钥对绑定的服务信息 */ export interface IUserKeyBindService { /** 引用的服务标识 */ ID: string; /** 引用的服务名称 */ Name: string; /** 引用的服务类型 */ _type?: UserKeyBindServiceType; /** 绑定场景 */ Scene?: string; } /** 集成实例(一个 UserKey = 一个集成实例) */ export interface IUserKeyInfo { /** 用户密钥对名称 */ Name: string; /** 用户密钥对标识 */ KeyID: string; /** 描述 */ Description?: string; /** 授权类型码 */ AuthTypeCode: string; /** 授权类型名称 */ AuthTypeName: string; /** 额外信息,JSON 字符串(含加密敏感值) */ Ext: string; /** 已绑定的服务列表 */ BindServiceList?: { Mcp?: IUserKeyBindService[]; Apis?: IUserKeyBindService[]; Other?: IUserKeyBindService[]; [key: string]: IUserKeyBindService[] | undefined; }; /** 状态 */ Status?: string; /** OAuth 类授权 ticket id */ TicketID?: string; /** 绑定的示例代码云函数名称(集成与云函数一对一关联的载体) */ DemoCodeFunctionName?: string; /** 创建时间(ISO 8601 字符串,如 2026-07-01T10:00:00+08:00) */ CreateAt?: string; /** 更新时间(ISO 8601 字符串,如 2026-07-01T10:00:00+08:00) */ UpdateAt?: string; } /** 列出模板入参 */ export interface IListTemplatesParams { offset?: number; limit?: number; authTypeCode?: string; authTypeName?: string; /** 业务类型,integration:从集成中心来的,默认为空,表示是从授权管理中心来的 */ business?: string; } /** 列出集成实例入参 */ export interface IListUserKeysParams { name?: string; authTypeCode?: string; offset?: number; limit?: number; /** 业务类型,integration:从集成中心来的,默认为空,表示是从授权管理中心来的 */ business?: string; } /** 查询集成实例详情入参 */ export interface IGetUserKeyParams { keyId: string; /** 为 true 时返回加密字段的密文值(原始密文)/ 解密后的明文值(当 decryptPwd=true 时) */ needPwd?: boolean; /** 为 true 时 SDK 自动解密 Ext 中的 password 字段,返回明文(需同时传 needPwd=true) */ decryptPwd?: boolean; /** 业务类型,integration:从集成中心来的,默认为空,表示是从授权管理中心来的 */ business?: string; } /** 创建集成实例入参 */ export interface ICreateUserKeyParams { name: string; authTypeCode: string; description?: string; /** * Ext JSON 字符串(模板动态字段的最终取值,含敏感字段密文)。 * 与 envVariables 二选一:传入 ext 时直接透传;传入 envVariables 时 * SDK 自动识别模板中的 password 字段、拉取七彩石密钥完成加密后拼装 ext。 * 两者都传时以 ext 优先。 */ ext?: string; /** * 环境变量明文键值对。 * SDK 自动识别模板中的 password 字段并加密,无需调用方自行处理。 * ext 和 envVariables 都未传时,不携带 Ext 字段。 */ envVariables?: Record; keyId?: string; ticketId?: string; /** 业务类型,integration:从集成中心来的,默认为空,表示是从授权管理中心来的 */ business?: string; /** 示例代码云函数名称 */ demoCodeFunctionName?: string; /** Agent 云函数配置 */ runtimeConfig?: Record; } /** 更新集成实例入参 */ export interface IUpdateUserKeyParams { keyId: string; name?: string; authTypeCode?: string; description?: string; /** * Ext JSON 字符串(模板动态字段的最终取值,含敏感字段密文)。 * 与 envVariables 二选一。都未传时后端保留原有 Ext 不变。 */ ext?: string; /** * 环境变量明文键值对。 * SDK 自动识别模板中的 password 字段并加密,无需调用方自行处理。 * 传入时与现有 Ext 合并后再加密写入。 */ envVariables?: Record; /** 绑定的示例代码云函数名称(bind-resource 使用) */ demoCodeFunctionName?: string; /** 业务类型,integration:从集成中心来的,默认为空,表示是从授权管理中心来的 */ business?: string; /** Agent 云函数配置 */ runtimeConfig?: Record; } /** 删除集成实例入参 */ export interface IDeleteUserKeyParams { keyId: string; } export interface IGetUserKeyTemplateListResult { KeyTemplateList: IUserKeyTemplate[]; TotalCount: number; RequestId?: string; } export interface IGetUserKeyListResult { UserKeyList: IUserKeyInfo[]; TotalCount: number; RequestId?: string; } export interface IGetOneUserKeyResult { UserKeyInfo: IUserKeyInfo; RequestId?: string; } export interface ICreateUserKeyResult { CreateResult: number; DemoCodeFunctionName?: string; RequestId?: string; } export interface IUpdateUserKeyResult { UpdateResult: number; RequestId?: string; } export interface IDeleteUserKeyResult { DeleteResult: number; RequestId?: string; }