---
name: "getPetList"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.6.27" }
title: "getPetList - 获取宠物列表"
---

## getPetList

> [VERSION] @ray-js/ray >= 1.6.27

### 描述

获取宠物列表

### 参数

`Params`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `data` | `GetPetList` | 是 | 请求参数：ownerId 家庭 id；bizTypes 可选，内部会固定为宠物中心业务 |

### 返回值

类型: `Promise<GetPetListResult>`

Promise，resolve 值为当前家庭下的宠物列表（GetPetListResult）

### 引用对象

##### `type` GetPetList

| 属性 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `ownerId` | `string` | 是 | 家庭id |
| `bizTypes` | `number[]` | 否 | 业务类型，1-宠物中心，2-宠物AI，默认为1 |

##### `type` GetPetListResult

```typescript
Pet[]
```


### 示例代码

#### 请求示例

```typescript
import { getPetList } from '@ray-js/ray';

getPetList({
  ownerId: 'xxxx',
  bizTypes: [2],
});
```

#### 返回示例

```json
[
  {
    "id": 1,
    "ownerId": "xxxx",
    "petType": "cat",
    "name": "福宝",
    "avatar": "smart/xxxx/xxxx/xxxx",
    "avatarDisplay": "https://xxx/xxx",
    "sex": 1,
    "activeness": 1,
    "birth": 1614528000000,
    "weight": 5000,
    "breedCode": "xxx",
    "breedName": "金吉拉",
    "rfid": "xxxxx",
    "extInfo": "",
    "bindFood": false,
    "gmtCreate": 1740792022716,
    "gmtModified": 1741785184589
  }
]
```
