@maxim_mazurok/gapi.client.homegraph-v1 0.0.20220805

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,441 @@
1
+ /* Type definitions for non-npm package HomeGraph API v1 0.0 */
2
+ // Project: https://developers.google.com/actions/smarthome/create-app#request-sync
3
+ // Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
4
+ // Nick Amoscato <https://github.com/namoscato>
5
+ // Declan Vong <https://github.com/declanvong>
6
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
+ // TypeScript Version: 2.8
8
+
9
+ // IMPORTANT
10
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
11
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
12
+ // Generated from: https://homegraph.googleapis.com/$discovery/rest?version=v1
13
+ // Revision: 20220805
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load HomeGraph API v1 */
19
+ function load(urlOrObject: "https://homegraph.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "homegraph", version: "v1"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "homegraph", version: "v1", callback: () => any): void;
24
+
25
+ namespace homegraph {
26
+ interface AgentDeviceId {
27
+ /** Third-party device ID. */
28
+ id?: string;
29
+ }
30
+ interface AgentOtherDeviceId {
31
+ /** Project ID for your smart home Action. */
32
+ agentId?: string;
33
+ /** Unique third-party device ID. */
34
+ deviceId?: string;
35
+ }
36
+ interface Device {
37
+ /** Attributes for the traits supported by the device. */
38
+ attributes?: { [P in string]: any };
39
+ /**
40
+ * Custom device attributes stored in Home Graph and provided to your smart home Action in each [QUERY](https://developers.google.com/assistant/smarthome/reference/intent/query) and
41
+ * [EXECUTE](https://developers.google.com/assistant/smarthome/reference/intent/execute) intent. Data in this object has a few constraints: No sensitive information, including but not
42
+ * limited to Personally Identifiable Information.
43
+ */
44
+ customData?: { [P in string]: any };
45
+ /** Device manufacturer, model, hardware version, and software version. */
46
+ deviceInfo?: DeviceInfo;
47
+ /** Third-party device ID. */
48
+ id?: string;
49
+ /** Names given to this device by your smart home Action. */
50
+ name?: DeviceNames;
51
+ /**
52
+ * Indicates whether your smart home Action will report notifications to Google for this device via ReportStateAndNotification. If your smart home Action enables users to control
53
+ * device notifications, you should update this field and call RequestSyncDevices.
54
+ */
55
+ notificationSupportedByAgent?: boolean;
56
+ /**
57
+ * Alternate IDs associated with this device. This is used to identify cloud synced devices enabled for [local
58
+ * fulfillment](https://developers.google.com/assistant/smarthome/concepts/local).
59
+ */
60
+ otherDeviceIds?: AgentOtherDeviceId[];
61
+ /** Suggested name for the room where this device is installed. Google attempts to use this value during user setup. */
62
+ roomHint?: string;
63
+ /** Suggested name for the structure where this device is installed. Google attempts to use this value during user setup. */
64
+ structureHint?: string;
65
+ /** Traits supported by the device. See [device traits](https://developers.google.com/assistant/smarthome/traits). */
66
+ traits?: string[];
67
+ /** Hardware type of the device. See [device types](https://developers.google.com/assistant/smarthome/guides). */
68
+ type?: string;
69
+ /** Indicates whether your smart home Action will report state of this device to Google via ReportStateAndNotification. */
70
+ willReportState?: boolean;
71
+ }
72
+ interface DeviceInfo {
73
+ /** Device hardware version. */
74
+ hwVersion?: string;
75
+ /** Device manufacturer. */
76
+ manufacturer?: string;
77
+ /** Device model. */
78
+ model?: string;
79
+ /** Device software version. */
80
+ swVersion?: string;
81
+ }
82
+ interface DeviceNames {
83
+ /** List of names provided by the manufacturer rather than the user, such as serial numbers, SKUs, etc. */
84
+ defaultNames?: string[];
85
+ /** Primary name of the device, generally provided by the user. */
86
+ name?: string;
87
+ /** Additional names provided by the user for the device. */
88
+ nicknames?: string[];
89
+ }
90
+ // tslint:disable-next-line:no-empty-interface
91
+ interface Empty {
92
+ }
93
+ interface QueryRequest {
94
+ /** Required. Third-party user ID. */
95
+ agentUserId?: string;
96
+ /** Required. Inputs containing third-party device IDs for which to get the device states. */
97
+ inputs?: QueryRequestInput[];
98
+ /** Request ID used for debugging. */
99
+ requestId?: string;
100
+ }
101
+ interface QueryRequestInput {
102
+ /** Payload containing third-party device IDs. */
103
+ payload?: QueryRequestPayload;
104
+ }
105
+ interface QueryRequestPayload {
106
+ /** Third-party device IDs for which to get the device states. */
107
+ devices?: AgentDeviceId[];
108
+ }
109
+ interface QueryResponse {
110
+ /** Device states for the devices given in the request. */
111
+ payload?: QueryResponsePayload;
112
+ /** Request ID used for debugging. Copied from the request. */
113
+ requestId?: string;
114
+ }
115
+ interface QueryResponsePayload {
116
+ /** States of the devices. Map of third-party device ID to struct of device states. */
117
+ devices?: { [P in string]: { [P in string]: any } };
118
+ }
119
+ interface ReportStateAndNotificationDevice {
120
+ /** Notifications metadata for devices. See the **Device NOTIFICATIONS** section of the individual trait [reference guides](https://developers.google.com/assistant/smarthome/traits). */
121
+ notifications?: { [P in string]: any };
122
+ /** States of devices to update. See the **Device STATES** section of the individual trait [reference guides](https://developers.google.com/assistant/smarthome/traits). */
123
+ states?: { [P in string]: any };
124
+ }
125
+ interface ReportStateAndNotificationRequest {
126
+ /** Required. Third-party user ID. */
127
+ agentUserId?: string;
128
+ /** Unique identifier per event (for example, a doorbell press). */
129
+ eventId?: string;
130
+ /** Deprecated. */
131
+ followUpToken?: string;
132
+ /** Required. State of devices to update and notification metadata for devices. */
133
+ payload?: StateAndNotificationPayload;
134
+ /** Request ID used for debugging. */
135
+ requestId?: string;
136
+ }
137
+ interface ReportStateAndNotificationResponse {
138
+ /** Request ID copied from ReportStateAndNotificationRequest. */
139
+ requestId?: string;
140
+ }
141
+ interface RequestSyncDevicesRequest {
142
+ /** Required. Third-party user ID. */
143
+ agentUserId?: string;
144
+ /**
145
+ * Optional. If set, the request will be added to a queue and a response will be returned immediately. This enables concurrent requests for the given `agent_user_id`, but the caller
146
+ * will not receive any error responses.
147
+ */
148
+ async?: boolean;
149
+ }
150
+ // tslint:disable-next-line:no-empty-interface
151
+ interface RequestSyncDevicesResponse {
152
+ }
153
+ interface StateAndNotificationPayload {
154
+ /** The devices for updating state and sending notifications. */
155
+ devices?: ReportStateAndNotificationDevice;
156
+ }
157
+ interface SyncRequest {
158
+ /** Required. Third-party user ID. */
159
+ agentUserId?: string;
160
+ /** Request ID used for debugging. */
161
+ requestId?: string;
162
+ }
163
+ interface SyncResponse {
164
+ /** Devices associated with the third-party user. */
165
+ payload?: SyncResponsePayload;
166
+ /** Request ID used for debugging. Copied from the request. */
167
+ requestId?: string;
168
+ }
169
+ interface SyncResponsePayload {
170
+ /** Third-party user ID */
171
+ agentUserId?: string;
172
+ /** Devices associated with the third-party user. */
173
+ devices?: Device[];
174
+ }
175
+ interface AgentUsersResource {
176
+ /**
177
+ * Unlinks the given third-party user from your smart home Action. All data related to this user will be deleted. For more details on how users link their accounts, see [fulfillment
178
+ * and authentication](https://developers.google.com/assistant/smarthome/concepts/fulfillment-authentication). The third-party user's identity is passed in via the `agent_user_id` (see
179
+ * DeleteAgentUserRequest). This request must be authorized using service account credentials from your Actions console project.
180
+ */
181
+ delete(request?: {
182
+ /** V1 error format. */
183
+ "$.xgafv"?: string;
184
+ /** OAuth access token. */
185
+ access_token?: string;
186
+ /** Required. Third-party user ID. */
187
+ agentUserId: string;
188
+ /** Data format for response. */
189
+ alt?: string;
190
+ /** JSONP */
191
+ callback?: string;
192
+ /** Selector specifying which fields to include in a partial response. */
193
+ fields?: string;
194
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
195
+ key?: string;
196
+ /** OAuth 2.0 token for the current user. */
197
+ oauth_token?: string;
198
+ /** Returns response with indentations and line breaks. */
199
+ prettyPrint?: boolean;
200
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
201
+ quotaUser?: string;
202
+ /** Request ID used for debugging. */
203
+ requestId?: string;
204
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
205
+ upload_protocol?: string;
206
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
207
+ uploadType?: string;
208
+ }): Request<{}>;
209
+ }
210
+ interface DevicesResource {
211
+ /**
212
+ * Gets the current states in Home Graph for the given set of the third-party user's devices. The third-party user's identity is passed in via the `agent_user_id` (see QueryRequest).
213
+ * This request must be authorized using service account credentials from your Actions console project.
214
+ */
215
+ query(request: {
216
+ /** V1 error format. */
217
+ "$.xgafv"?: string;
218
+ /** OAuth access token. */
219
+ access_token?: string;
220
+ /** Data format for response. */
221
+ alt?: string;
222
+ /** JSONP */
223
+ callback?: string;
224
+ /** Selector specifying which fields to include in a partial response. */
225
+ fields?: string;
226
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
227
+ key?: string;
228
+ /** OAuth 2.0 token for the current user. */
229
+ oauth_token?: string;
230
+ /** Returns response with indentations and line breaks. */
231
+ prettyPrint?: boolean;
232
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
233
+ quotaUser?: string;
234
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
235
+ upload_protocol?: string;
236
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
237
+ uploadType?: string;
238
+ /** Request body */
239
+ resource: QueryRequest;
240
+ }): Request<QueryResponse>;
241
+ query(request: {
242
+ /** V1 error format. */
243
+ "$.xgafv"?: string;
244
+ /** OAuth access token. */
245
+ access_token?: string;
246
+ /** Data format for response. */
247
+ alt?: string;
248
+ /** JSONP */
249
+ callback?: string;
250
+ /** Selector specifying which fields to include in a partial response. */
251
+ fields?: string;
252
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
253
+ key?: string;
254
+ /** OAuth 2.0 token for the current user. */
255
+ oauth_token?: string;
256
+ /** Returns response with indentations and line breaks. */
257
+ prettyPrint?: boolean;
258
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
259
+ quotaUser?: string;
260
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
261
+ upload_protocol?: string;
262
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
263
+ uploadType?: string;
264
+ },
265
+ body: QueryRequest): Request<QueryResponse>;
266
+ /**
267
+ * Reports device state and optionally sends device notifications. Called by your smart home Action when the state of a third-party device changes or you need to send a notification
268
+ * about the device. See [Implement Report State](https://developers.google.com/assistant/smarthome/develop/report-state) for more information. This method updates the device state
269
+ * according to its declared [traits](https://developers.google.com/assistant/smarthome/concepts/devices-traits). Publishing a new state value outside of these traits will result in an
270
+ * `INVALID_ARGUMENT` error response. The third-party user's identity is passed in via the `agent_user_id` (see ReportStateAndNotificationRequest). This request must be authorized
271
+ * using service account credentials from your Actions console project.
272
+ */
273
+ reportStateAndNotification(request: {
274
+ /** V1 error format. */
275
+ "$.xgafv"?: string;
276
+ /** OAuth access token. */
277
+ access_token?: string;
278
+ /** Data format for response. */
279
+ alt?: string;
280
+ /** JSONP */
281
+ callback?: string;
282
+ /** Selector specifying which fields to include in a partial response. */
283
+ fields?: string;
284
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
285
+ key?: string;
286
+ /** OAuth 2.0 token for the current user. */
287
+ oauth_token?: string;
288
+ /** Returns response with indentations and line breaks. */
289
+ prettyPrint?: boolean;
290
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
291
+ quotaUser?: string;
292
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
293
+ upload_protocol?: string;
294
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
295
+ uploadType?: string;
296
+ /** Request body */
297
+ resource: ReportStateAndNotificationRequest;
298
+ }): Request<ReportStateAndNotificationResponse>;
299
+ reportStateAndNotification(request: {
300
+ /** V1 error format. */
301
+ "$.xgafv"?: string;
302
+ /** OAuth access token. */
303
+ access_token?: string;
304
+ /** Data format for response. */
305
+ alt?: string;
306
+ /** JSONP */
307
+ callback?: string;
308
+ /** Selector specifying which fields to include in a partial response. */
309
+ fields?: string;
310
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
311
+ key?: string;
312
+ /** OAuth 2.0 token for the current user. */
313
+ oauth_token?: string;
314
+ /** Returns response with indentations and line breaks. */
315
+ prettyPrint?: boolean;
316
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
317
+ quotaUser?: string;
318
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
319
+ upload_protocol?: string;
320
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
321
+ uploadType?: string;
322
+ },
323
+ body: ReportStateAndNotificationRequest): Request<ReportStateAndNotificationResponse>;
324
+ /**
325
+ * Requests Google to send an `action.devices.SYNC` [intent](https://developers.google.com/assistant/smarthome/reference/intent/sync) to your smart home Action to update device
326
+ * metadata for the given user. The third-party user's identity is passed via the `agent_user_id` (see RequestSyncDevicesRequest). This request must be authorized using service account
327
+ * credentials from your Actions console project.
328
+ */
329
+ requestSync(request: {
330
+ /** V1 error format. */
331
+ "$.xgafv"?: string;
332
+ /** OAuth access token. */
333
+ access_token?: string;
334
+ /** Data format for response. */
335
+ alt?: string;
336
+ /** JSONP */
337
+ callback?: string;
338
+ /** Selector specifying which fields to include in a partial response. */
339
+ fields?: string;
340
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
341
+ key?: string;
342
+ /** OAuth 2.0 token for the current user. */
343
+ oauth_token?: string;
344
+ /** Returns response with indentations and line breaks. */
345
+ prettyPrint?: boolean;
346
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
347
+ quotaUser?: string;
348
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
349
+ upload_protocol?: string;
350
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
351
+ uploadType?: string;
352
+ /** Request body */
353
+ resource: RequestSyncDevicesRequest;
354
+ }): Request<{}>;
355
+ requestSync(request: {
356
+ /** V1 error format. */
357
+ "$.xgafv"?: string;
358
+ /** OAuth access token. */
359
+ access_token?: string;
360
+ /** Data format for response. */
361
+ alt?: string;
362
+ /** JSONP */
363
+ callback?: string;
364
+ /** Selector specifying which fields to include in a partial response. */
365
+ fields?: string;
366
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
367
+ key?: string;
368
+ /** OAuth 2.0 token for the current user. */
369
+ oauth_token?: string;
370
+ /** Returns response with indentations and line breaks. */
371
+ prettyPrint?: boolean;
372
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
373
+ quotaUser?: string;
374
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
375
+ upload_protocol?: string;
376
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
377
+ uploadType?: string;
378
+ },
379
+ body: RequestSyncDevicesRequest): Request<{}>;
380
+ /**
381
+ * Gets all the devices associated with the given third-party user. The third-party user's identity is passed in via the `agent_user_id` (see SyncRequest). This request must be
382
+ * authorized using service account credentials from your Actions console project.
383
+ */
384
+ sync(request: {
385
+ /** V1 error format. */
386
+ "$.xgafv"?: string;
387
+ /** OAuth access token. */
388
+ access_token?: string;
389
+ /** Data format for response. */
390
+ alt?: string;
391
+ /** JSONP */
392
+ callback?: string;
393
+ /** Selector specifying which fields to include in a partial response. */
394
+ fields?: string;
395
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
396
+ key?: string;
397
+ /** OAuth 2.0 token for the current user. */
398
+ oauth_token?: string;
399
+ /** Returns response with indentations and line breaks. */
400
+ prettyPrint?: boolean;
401
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
402
+ quotaUser?: string;
403
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
404
+ upload_protocol?: string;
405
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
406
+ uploadType?: string;
407
+ /** Request body */
408
+ resource: SyncRequest;
409
+ }): Request<SyncResponse>;
410
+ sync(request: {
411
+ /** V1 error format. */
412
+ "$.xgafv"?: string;
413
+ /** OAuth access token. */
414
+ access_token?: string;
415
+ /** Data format for response. */
416
+ alt?: string;
417
+ /** JSONP */
418
+ callback?: string;
419
+ /** Selector specifying which fields to include in a partial response. */
420
+ fields?: string;
421
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
422
+ key?: string;
423
+ /** OAuth 2.0 token for the current user. */
424
+ oauth_token?: string;
425
+ /** Returns response with indentations and line breaks. */
426
+ prettyPrint?: boolean;
427
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
428
+ quotaUser?: string;
429
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
430
+ upload_protocol?: string;
431
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
432
+ uploadType?: string;
433
+ },
434
+ body: SyncRequest): Request<SyncResponse>;
435
+ }
436
+
437
+ const agentUsers: AgentUsersResource;
438
+
439
+ const devices: DevicesResource;
440
+ }
441
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.homegraph-v1",
3
+ "version": "0.0.20220805",
4
+ "description": "TypeScript typings for HomeGraph API v1",
5
+ "license": "MIT",
6
+ "author": {
7
+ "email": "maxim@mazurok.com",
8
+ "name": "Maxim Mazurok",
9
+ "url": "https://maxim.mazurok.com"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,93 @@
1
+ # TypeScript typings for HomeGraph API v1
2
+
3
+
4
+ For detailed description please check [documentation](https://developers.google.com/actions/smarthome/create-app#request-sync).
5
+
6
+ ## Installing
7
+
8
+ Install typings for HomeGraph API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.homegraph-v1 --save-dev
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You need to initialize Google API client in your code:
17
+
18
+ ```typescript
19
+ gapi.load('client', () => {
20
+ // now we can use gapi.client
21
+ // ...
22
+ });
23
+ ```
24
+
25
+ Then load api client wrapper:
26
+
27
+ ```typescript
28
+ gapi.client.load('https://homegraph.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.homegraph
31
+ });
32
+ ```
33
+
34
+ ```typescript
35
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
36
+ gapi.client.load('homegraph', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.homegraph
39
+ });
40
+ ```
41
+
42
+ Don't forget to authenticate your client before sending any request to resources:
43
+
44
+ ```typescript
45
+ // declare client_id registered in Google Developers Console
46
+ var client_id = '',
47
+ scope = [
48
+ // Private Service: https://www.googleapis.com/auth/homegraph
49
+ 'https://www.googleapis.com/auth/homegraph',
50
+ ],
51
+ immediate = true;
52
+ // ...
53
+
54
+ gapi.auth.authorize(
55
+ { client_id: client_id, scope: scope, immediate: immediate },
56
+ authResult => {
57
+ if (authResult && !authResult.error) {
58
+ /* handle successful authorization */
59
+ } else {
60
+ /* handle authorization error */
61
+ }
62
+ });
63
+ ```
64
+
65
+ After that you can use HomeGraph API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+
69
+ /*
70
+ Unlinks the given third-party user from your smart home Action. All data related to this user will be deleted. For more details on how users link their accounts, see [fulfillment and authentication](https://developers.google.com/assistant/smarthome/concepts/fulfillment-authentication). The third-party user's identity is passed in via the `agent_user_id` (see DeleteAgentUserRequest). This request must be authorized using service account credentials from your Actions console project.
71
+ */
72
+ await gapi.client.homegraph.agentUsers.delete({ agentUserId: "agentUserId", });
73
+
74
+ /*
75
+ Gets the current states in Home Graph for the given set of the third-party user's devices. The third-party user's identity is passed in via the `agent_user_id` (see QueryRequest). This request must be authorized using service account credentials from your Actions console project.
76
+ */
77
+ await gapi.client.homegraph.devices.query({ });
78
+
79
+ /*
80
+ Reports device state and optionally sends device notifications. Called by your smart home Action when the state of a third-party device changes or you need to send a notification about the device. See [Implement Report State](https://developers.google.com/assistant/smarthome/develop/report-state) for more information. This method updates the device state according to its declared [traits](https://developers.google.com/assistant/smarthome/concepts/devices-traits). Publishing a new state value outside of these traits will result in an `INVALID_ARGUMENT` error response. The third-party user's identity is passed in via the `agent_user_id` (see ReportStateAndNotificationRequest). This request must be authorized using service account credentials from your Actions console project.
81
+ */
82
+ await gapi.client.homegraph.devices.reportStateAndNotification({ });
83
+
84
+ /*
85
+ Requests Google to send an `action.devices.SYNC` [intent](https://developers.google.com/assistant/smarthome/reference/intent/sync) to your smart home Action to update device metadata for the given user. The third-party user's identity is passed via the `agent_user_id` (see RequestSyncDevicesRequest). This request must be authorized using service account credentials from your Actions console project.
86
+ */
87
+ await gapi.client.homegraph.devices.requestSync({ });
88
+
89
+ /*
90
+ Gets all the devices associated with the given third-party user. The third-party user's identity is passed in via the `agent_user_id` (see SyncRequest). This request must be authorized using service account credentials from your Actions console project.
91
+ */
92
+ await gapi.client.homegraph.devices.sync({ });
93
+ ```
package/tests.ts ADDED
@@ -0,0 +1,105 @@
1
+ /* This is stub file for gapi.client.homegraph-v1 definition tests */
2
+ // IMPORTANT
3
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
+
6
+ // Revision: 20220805
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://homegraph.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.homegraph */
13
+
14
+ /** don't forget to authenticate your client before sending any request to resources: */
15
+ /** declare client_id registered in Google Developers Console */
16
+ const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
+ const scope = [
18
+ /** Private Service: https://www.googleapis.com/auth/homegraph */
19
+ 'https://www.googleapis.com/auth/homegraph',
20
+ ];
21
+ const immediate = false;
22
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
23
+ if (authResult && !authResult.error) {
24
+ /** handle successful authorization */
25
+ run();
26
+ } else {
27
+ /** handle authorization error */
28
+ }
29
+ });
30
+
31
+ async function run() {
32
+ /**
33
+ * Unlinks the given third-party user from your smart home Action. All data related to this user will be deleted. For more details on how users link their accounts, see [fulfillment and
34
+ * authentication](https://developers.google.com/assistant/smarthome/concepts/fulfillment-authentication). The third-party user's identity is passed in via the `agent_user_id` (see
35
+ * DeleteAgentUserRequest). This request must be authorized using service account credentials from your Actions console project.
36
+ */
37
+ await gapi.client.homegraph.agentUsers.delete({
38
+ agentUserId: "Test string",
39
+ requestId: "Test string",
40
+ });
41
+ /**
42
+ * Gets the current states in Home Graph for the given set of the third-party user's devices. The third-party user's identity is passed in via the `agent_user_id` (see QueryRequest). This
43
+ * request must be authorized using service account credentials from your Actions console project.
44
+ */
45
+ await gapi.client.homegraph.devices.query({
46
+ }, {
47
+ agentUserId: "Test string",
48
+ inputs: [
49
+ {
50
+ payload: {
51
+ devices: [
52
+ {
53
+ id: "Test string",
54
+ }
55
+ ],
56
+ },
57
+ }
58
+ ],
59
+ requestId: "Test string",
60
+ });
61
+ /**
62
+ * Reports device state and optionally sends device notifications. Called by your smart home Action when the state of a third-party device changes or you need to send a notification about
63
+ * the device. See [Implement Report State](https://developers.google.com/assistant/smarthome/develop/report-state) for more information. This method updates the device state according to
64
+ * its declared [traits](https://developers.google.com/assistant/smarthome/concepts/devices-traits). Publishing a new state value outside of these traits will result in an
65
+ * `INVALID_ARGUMENT` error response. The third-party user's identity is passed in via the `agent_user_id` (see ReportStateAndNotificationRequest). This request must be authorized using
66
+ * service account credentials from your Actions console project.
67
+ */
68
+ await gapi.client.homegraph.devices.reportStateAndNotification({
69
+ }, {
70
+ agentUserId: "Test string",
71
+ eventId: "Test string",
72
+ followUpToken: "Test string",
73
+ payload: {
74
+ devices: {
75
+ notifications: {
76
+ A: 42
77
+ },
78
+ states: {
79
+ A: 42
80
+ },
81
+ },
82
+ },
83
+ requestId: "Test string",
84
+ });
85
+ /**
86
+ * Requests Google to send an `action.devices.SYNC` [intent](https://developers.google.com/assistant/smarthome/reference/intent/sync) to your smart home Action to update device metadata
87
+ * for the given user. The third-party user's identity is passed via the `agent_user_id` (see RequestSyncDevicesRequest). This request must be authorized using service account credentials
88
+ * from your Actions console project.
89
+ */
90
+ await gapi.client.homegraph.devices.requestSync({
91
+ }, {
92
+ agentUserId: "Test string",
93
+ async: true,
94
+ });
95
+ /**
96
+ * Gets all the devices associated with the given third-party user. The third-party user's identity is passed in via the `agent_user_id` (see SyncRequest). This request must be authorized
97
+ * using service account credentials from your Actions console project.
98
+ */
99
+ await gapi.client.homegraph.devices.sync({
100
+ }, {
101
+ agentUserId: "Test string",
102
+ requestId: "Test string",
103
+ });
104
+ }
105
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "lib": ["es6", "dom"],
5
+ "noImplicitAny": true,
6
+ "noImplicitThis": true,
7
+ "strictNullChecks": true,
8
+ "baseUrl": "../",
9
+ "typeRoots": [
10
+ "../"
11
+ ],
12
+ "types": [],
13
+ "noEmit": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strictFunctionTypes": true
16
+ },
17
+ "files": ["index.d.ts", "tests.ts"]
18
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }