---
name: "queryAlbumFileIndexs"
mode: "kit"
versionRequirements:
  - { name: "P2PKit", version: "1.0.0" }
  - { name: "@ray-js/ray", version: "1.3.15" }
platform:
  - "iOS"
  - "Android"
async: true
title: "p2p.queryAlbumFileIndexs - 查询设备相册文件索引列表"
---

## queryAlbumFileIndexs

> [VERSION] P2PKit >= 1.0.0 | @ray-js/ray >= 1.3.15

> [PLATFORM] iOS, Android

> ⚡ **支持 Promise 调用** — 不传 success / fail / complete 回调时，该方法返回 Promise。

### 描述

query device's album file index infos

### 参数

| 属性 | 类型 | 必填 | 默认值 | 最低版本 | 描述 |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | 是 | - | `1.0.0` | device id |
| `albumName` | `string` | 是 | - | `1.0.0` | albumName,given by the device |
| `complete` | `() => void` | 否 | - | - | 接口调用结束的回调函数（调用成功、失败都会执行） |
| `success` | `(params: Object) => void` ↓见下方 | 否 | - | - | 接口调用成功的回调函数 |
| `fail` | `(params: Object) => void` ↓见下方 | 否 | - | - | 接口调用失败的回调函数 |

#### success 回调参数

| 属性 | 类型 | 最低版本 | 描述 |
| --- | --- | --- | --- |
| `count` | `number` | `2.0.2` | file count |
| `items` | `ThingP2PAlbumFileIndex[]` | `2.0.2` | file index infos |

#### fail 回调参数

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `errorMsg` | `string` | 错误信息 |
| `errorCode` | `string \| number` | 错误码 |
| `innerError` | `Object` | 错误扩展 |

##### fail(params).innerError 的属性

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `errorCode` | `string \| number` | 错误扩展码 |
| `errorMsg` | `string` | 错误扩展信息 |


### 引用对象

##### `interface` ThingP2PAlbumFileIndex

| 属性 | 类型 | 最低版本 | 描述 |
| --- | --- | --- | --- |
| `idx` | `number` | `2.0.2` | idx,given by the device |
| `channel` | `number` | `2.0.2` | channel channel number |
| `type` | `number` | `2.0.2` | type file type,0: image，2: mp4, 3: Panoramic stitching file |
| `dir` | `number` | `2.0.2` | dir 0: file，1: directory |
| `filename` | `string` | `2.0.2` | file name contains suffix |
| `createTime` | `number` | `2.0.2` | createTime file create time |
| `duration` | `number` | `2.0.2` | duration file duration |


### 示例代码

#### Demo

```tsx
import { p2p } from '@ray-js/ray'

p2p.queryAlbumFileIndexs({
  deviceId: "xx",
  albumName: "xx",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
