-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathmyq-types.ts
158 lines (144 loc) · 3.96 KB
/
myq-types.ts
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* Copyright(C) 2017-2023, HJD (https://github.com/hjdhjd). All rights reserved.
*
* myq-types.ts: Type definitions for myQ.
*/
// A complete description of the myQ authentication JSON.
/* eslint-disable camelcase */
interface myQTokenInterface {
access_token: string,
expires_in: number,
refresh_token: string,
scope: string,
token_type: string
}
/* eslint-enable camelcase */
// A complete description of the myQ account JSON.
/* eslint-disable camelcase */
export interface myQAccountInterface {
accounts: {
created_by: string,
id: string,
max_users: {
co_owner: number,
guest: number
},
name: string
}[]
}
/* eslint-enable camelcase */
// A complete description of the myQ account profile JSON.
// This is currently unused and documented here primarily for reference.
/* eslint-disable camelcase */
export interface myQProfileInterface {
address: {
address_line1: string,
address_line2: string,
city: string,
country: {
is_eea_country: boolean,
name: string
},
postal_code: string,
state: string
},
analytics_id: string,
culture_code: string,
diagnostics_opt_in: boolean,
email: string,
first_name: string,
last_name: string,
mailing_list_opt_in: boolean,
phone_number: string,
timezone: string,
user_id: string
}
/* eslint-enable camelcase */
// A complete description of the myQ device list JSON.
export interface myQDeviceListInterface {
count: number,
href: string,
items: myQDevice[]
}
// A semi-complete description of the myQ device JSON.
/* eslint-disable camelcase */
export interface myQDeviceInterface {
account_id: string,
created_date: string,
device_family: string,
device_model: string,
device_platform: string,
device_type: string,
href: string,
name: string,
parent_device_id: string,
serial_number: string,
state: {
attached_work_light_error_present: boolean,
aux_relay_behavior: string,
aux_relay_delay: string,
close: string,
command_channel_report_status: boolean,
control_from_browser: boolean,
door_ajar_interval: string,
door_state: string,
dps_low_battery_mode: boolean,
firmware_version: string,
gdo_lock_connected: boolean,
homekit_capable: boolean,
homekit_enabled: boolean,
invalid_credential_window: string,
invalid_shutout_period: string,
is_unattended_close_allowed: boolean,
is_unattended_open_allowed: boolean,
lamp_state: string,
lamp_subtype: string,
last_event: string,
last_status: string,
last_update: string,
learn: string,
learn_mode: boolean,
light_state: string,
links: {
events: string,
stream: string
}
max_invalid_attempts: number,
online: boolean,
online_change_time: string,
open: string,
passthrough_interval: string,
pending_bootload_abandoned: boolean,
physical_devices: [],
report_ajar: boolean,
report_forced: boolean,
rex_fires_door: boolean,
servers: string,
updated_date: string,
use_aux_relay: boolean
}
}
/* eslint-enable camelcase */
// Hardware device information reference.
export interface myQHwInfoInterface {
brand: string,
product: string
}
// We use types instead of interfaces here because we can more easily set the entire thing as readonly.
// Unfortunately, interfaces can't be quickly set as readonly in TypeScript without marking each and
// every property as readonly along the way.
export type myQAccount = Readonly<myQAccountInterface>;
export type myQDeviceList = Readonly<myQDeviceListInterface>;
export type myQProfile = Readonly<myQProfileInterface>;
export type myQToken = Readonly<myQTokenInterface>;
export type myQDevice = Readonly<myQDeviceInterface>;
export type myQHwInfo = Readonly<myQHwInfoInterface>;
/*
* // List all the door types we know about. For future use...
* const myQDoorTypes = [
* "commercialdooropener",
* "garagedooropener",
* "gate",
* "virtualgaragedooropener",
* "wifigaragedooropener"
* ];
*/