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

## getPresetEvent

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

### 描述

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

### 参数

`Params`

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

### 引用对象

##### `type` GetAiVisualPresetEventParams

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

##### `enum` BusinessType

| 枚举值 | 实际值 | 描述 |
| --- | --- | --- |
| `BusinessType.aigcProtect` | `aigcProtect` | 智能魔方保护 |
| `BusinessType.aiTimePhotoAlbumDetect` | `aiTimePhotoAlbumDetect` | 时光相册检测 |
| `BusinessType.aiSmartFreeEvent` | `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": "人形检测"
  }
]
```
