---
name: "getDeviceThingModelInfo"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "2.0.7" }
  - { name: "@ray-js/ray", version: "0.6.23" }
platform:
  - "iOS"
  - "Android"
async: true
---

## getDeviceThingModelInfo

> [VERSION] DeviceKit >= 2.0.7 | @ray-js/ray >= 0.6.23

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Get device thing model information. On success, the callback returns GetDeviceThingModelInfoResponse with details such as modelId, productId, services.

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `devId` | `string` | Yes | - | `2.0.7` | Device ID |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `modelId` | `string` | `3.3.0` | Thing Model ID |
| `productId` | `string` | `3.3.0` | Product ID |
| `productVersion` | `string` | `3.3.0` | Product version |
| `services` | `ServiceModel[]` | `3.3.0` | Service list |
| `extensions` | `Record<string, any>` | `3.3.0` | Thing model extension properties in key-value form, used to carry information beyond the standard model |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Referenced Types

##### `interface` ServiceModel

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `properties` | `ThingProperty[]` | `3.3.0` | Attribute list |
| `actions` | `ThingAction[]` | `3.3.0` | Action list |
| `events` | `ThingEvent[]` | `3.3.0` | Event list |

##### `type` ThingProperty

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `abilityId` | `number` | `3.3.0` | Attribute ID |
| `accessMode` | `string` | `3.3.0` | Access mode: ro - read-only, wr - write-only, rw - read/write |
| `typeSpec` | `Record<string, any>` | `3.3.0` | Property type specification (JSON structure defining data types, value ranges, etc.) |
| `defaultValue` | `Record<string, any>` | `3.3.0` | Attribute default value |
| `code` | `string` | `3.3.0` | Identifier code |

##### `type` ThingAction

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `abilityId` | `number` | `3.3.0` | Action ID |
| `inputParams` | `Record<string, any>[]` | `3.3.0` | Action input parameter specification list; each item is a parameter definition object (including fields such as code and typeSpec) |
| `outputParams` | `Record<string, any>[]` | `3.3.0` | Action output parameter specification list; each item is a parameter definition object (including fields such as code and typeSpec) |
| `code` | `string` | `3.3.0` | Identifier code |

##### `type` ThingEvent

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `abilityId` | `number` | `3.3.0` | Event ID |
| `outputParams` | `Record<string, any>[]` | `3.3.0` | Event output parameter specification list; each item is a parameter definition object (including fields such as code and typeSpec) |
| `code` | `string` | `3.3.0` | Identifier code |


### Examples

#### Basic usage

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

const { getDeviceThingModelInfo } = device;

getDeviceThingModelInfo({
  devId: 'device_001',
  success: (result) => {
    console.log('getDeviceThingModelInfo success', result);
  },
  fail: (error) => {
    console.log('getDeviceThingModelInfo fail', error.errorMsg);
  },
});
```
