---
name: "getPresetEvent"
mode: "kit"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.5" }
---

## getPresetEvent

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.5

### 方法签名

```typescript
getPresetEvent(params: GetAiVisualPresetEventParams)
```

### 描述

查询智能视觉魔方列表预置事件

### 参数

`Params`

| 参数 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `params` | `GetAiVisualPresetEventParams` | 是 | - | 请求体 |

### 返回值

类型: `Promise<PresetEvent[]>`

预置事件配置列表（见 PresetEvent）

### 引用对象

##### `type` GetAiVisualPresetEventParams

| 属性 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `gid` | `string` | 是 | 家庭 gid |
| `businessType` | `"BusinessType.aigcProtect" \\| "BusinessType.aiTimePhotoAlbumDetect" \\| "BusinessType.aiSmartFreeEvent"` | 是 | 业务类型（minituya `getPresetEvent` 文档为 `eventValue`/`stockId` 等字段；与本封装字段不完全一致，以 `BusinessType` 为准） |

##### `interface` PresetEvent

预制检测事件

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `configCode` | `string` | 配置编码 |
| `configCodeIcon` | `string` | 配置图标 |
| `configCodeDesc` | `string` | 配置描述 |

##### `enum` BusinessType

| 枚举值 | 实际值 | 描述 |
| --- | --- | --- |
| `BusinessType.aigcProtect` | `aigcProtect` | 智能魔方保护 |
| `BusinessType.aiTimePhotoAlbumDetect` | `aiTimePhotoAlbumDetect` | 时光相册检测 |
| `BusinessType.aiSmartFreeEvent` | `aiSmartFreeEvent` | 智能免费事件 |


### 合法值

##### `BusinessType`

| 值 | 说明 | 最低版本 |
| --- | --- | --- |
| `aigcProtect` | 智能魔方保护 | - |
| `aiTimePhotoAlbumDetect` | 时光相册检测 | - |
| `aiSmartFreeEvent` | 智能免费事件 | - |


### 示例代码

#### 请求示例

```typescript
import { getPresetEvent } from '@tuya-miniapp/cloud-api';

getPresetEvent({ gid: '194137', businessType: 'aiSmartFreeEvent' })
  .then((list) => console.log(list))
  .catch(console.error);
```

#### 返回示例

```json
[
  {
    "configCode": "person",
    "configCodeIcon": "https://images.example.com/icon.png",
    "configCodeDesc": "人形检测"
  }
]
```
