Skip to content

Commit 1f3f9e8

Browse files
committed
fix(device): use correct return type
1 parent aa5fc26 commit 1f3f9e8

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/api/DeviceShadow.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ export const DeviceShadow = Type.Object({
2525
})
2626

2727
export type DeviceShadowType = Static<typeof DeviceShadow>
28-
;``

src/api/devices.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@ import { slashless } from './slashless.js'
33
import { ValidationError, validatedFetch } from './validatedFetch.js'
44
import { DeviceShadow } from './DeviceShadow.js'
55

6-
const Device = Type.Object({
7-
id: Type.String(),
8-
state: Type.Optional(DeviceShadow),
9-
})
10-
116
const Page = <T extends TSchema>(Item: T) =>
127
Type.Object({
138
total: Type.Integer(),
149
items: Type.Array(Item),
1510
})
16-
const Devices = Page(Device)
11+
const Devices = Page(DeviceShadow)
1712

1813
/**
1914
* @link https://api.nrfcloud.com/v1/#tag/IP-Devices/operation/ProvisionDevices
@@ -46,7 +41,7 @@ export const devices = (
4641
get: (
4742
id: string,
4843
) => Promise<
49-
{ error: Error | ValidationError } | { result: Static<typeof Device> }
44+
{ error: Error | ValidationError } | { result: Static<typeof DeviceShadow> }
5045
>
5146
updateState: (
5247
id: string,
@@ -87,7 +82,7 @@ export const devices = (
8782
Devices,
8883
),
8984
get: async (id) =>
90-
vf({ resource: `devices/${encodeURIComponent(id)}` }, Device),
85+
vf({ resource: `devices/${encodeURIComponent(id)}` }, DeviceShadow),
9186
updateState: async (id, state) =>
9287
fetch(
9388
`${slashless(endpoint)}/v1/devices/${encodeURIComponent(id)}/state`,

0 commit comments

Comments
 (0)