summaryrefslogtreecommitdiff
path: root/src/@types/miio.d.ts
blob: 0e277afdb4273820716c3546141f9c765182b66c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
declare module 'miio' {
  type PrimitiveTypes = string | number | boolean

  interface DeviceOptions {
    address: string
    port?: number
    token?: string
  }

  interface DeviceInfo {
    id: number
    token: string
    model: string
  }

  interface DeviceHandle {
    api: DeviceInfo
  }

  interface Device {
    handle: DeviceHandle
    call(method: string, arguments: PrimitiveTypes[]): Promise<PrimitiveTypes[]>
  }

  function device(options: DeviceOptions): Promise<Device>
}