UNPKG

4.81 kBTypeScriptView Raw
1/**
2 * Copyright 2018 Google Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { ApiClientObjectMap } from '../../../common';
17export declare type SmartHomeV1Intents = 'action.devices.SYNC' | 'action.devices.QUERY' | 'action.devices.EXECUTE' | 'action.devices.DISCONNECT';
18export declare type SmartHomeV1ExecuteStatus = 'SUCCESS' | 'PENDING' | 'OFFLINE' | 'ERROR';
19export declare type SmartHomeV1ExecuteErrors = string;
20export interface SmartHomeV1SyncRequestInputs {
21 intent: SmartHomeV1Intents;
22}
23export interface SmartHomeV1SyncRequest {
24 requestId: string;
25 inputs: SmartHomeV1SyncRequestInputs[];
26}
27export interface SmartHomeV1QueryRequestDevices {
28 id: string;
29 customData?: ApiClientObjectMap<any>;
30}
31export interface SmartHomeV1QueryRequestPayload {
32 devices: SmartHomeV1QueryRequestDevices[];
33}
34export interface SmartHomeV1QueryRequestInputs {
35 intent: SmartHomeV1Intents;
36 payload: SmartHomeV1QueryRequestPayload;
37}
38export interface SmartHomeV1QueryRequest {
39 requestId: string;
40 inputs: SmartHomeV1QueryRequestInputs[];
41}
42export interface SmartHomeV1ExecuteRequestExecution {
43 command: string;
44 params?: ApiClientObjectMap<any>;
45 challenge?: {
46 pin?: string;
47 ack?: boolean;
48 };
49}
50export interface SmartHomeV1ExecuteRequestCommands {
51 devices: SmartHomeV1QueryRequestDevices[];
52 execution: SmartHomeV1ExecuteRequestExecution[];
53}
54export interface SmartHomeV1ExecuteRequestPayload {
55 commands: SmartHomeV1ExecuteRequestCommands[];
56}
57export interface SmartHomeV1ExecuteRequestInputs {
58 intent: SmartHomeV1Intents;
59 payload: SmartHomeV1ExecuteRequestPayload;
60}
61export interface SmartHomeV1ExecuteRequest {
62 requestId: string;
63 inputs: SmartHomeV1ExecuteRequestInputs[];
64}
65export interface SmartHomeV1DisconnectRequest {
66 requestId: string;
67 inputs: {
68 intent: 'action.devices.DISCONNECT';
69 }[];
70}
71export declare type SmartHomeV1Request = SmartHomeV1SyncRequest | SmartHomeV1QueryRequest | SmartHomeV1ExecuteRequest | SmartHomeV1DisconnectRequest;
72export interface SmartHomeV1SyncName {
73 defaultNames: string[];
74 name: string;
75 nicknames: string[];
76}
77export interface SmartHomeV1SyncDeviceInfo {
78 manufacturer: string;
79 model: string;
80 hwVersion: string;
81 swVersion: string;
82}
83export interface SmartHomeV1SyncOtherDeviceIds {
84 agentId?: string;
85 deviceId: string;
86}
87export interface SmartHomeV1SyncDevices {
88 id: string;
89 type: string;
90 traits: string[];
91 name: SmartHomeV1SyncName;
92 willReportState: boolean;
93 deviceInfo?: SmartHomeV1SyncDeviceInfo;
94 attributes?: ApiClientObjectMap<any>;
95 customData?: ApiClientObjectMap<any>;
96 roomHint?: string;
97 otherDeviceIds?: SmartHomeV1SyncOtherDeviceIds[];
98}
99export interface SmartHomeV1SyncPayload {
100 agentUserId?: string;
101 errorCode?: string;
102 debugString?: string;
103 devices: SmartHomeV1SyncDevices[];
104}
105export interface SmartHomeV1SyncResponse {
106 requestId: string;
107 payload: SmartHomeV1SyncPayload;
108}
109export interface SmartHomeV1QueryPayload {
110 devices: ApiClientObjectMap<any>;
111}
112export interface SmartHomeV1QueryResponse {
113 requestId: string;
114 payload: SmartHomeV1QueryPayload;
115}
116export interface SmartHomeV1ExecuteResponseCommands {
117 ids: string[];
118 status: SmartHomeV1ExecuteStatus;
119 errorCode?: SmartHomeV1ExecuteErrors;
120 debugString?: string;
121 states?: ApiClientObjectMap<any>;
122 challengeNeeded?: {
123 type: challengeType;
124 };
125}
126export declare type challengeType = 'ackNeeded' | 'pinNeeded' | 'challengeFailedPinNeeded';
127export interface SmartHomeV1ExecutePayload {
128 commands: SmartHomeV1ExecuteResponseCommands[];
129 errorCode?: SmartHomeV1ExecuteErrors;
130 debugString?: string;
131}
132export interface SmartHomeV1ExecuteResponse {
133 requestId: string;
134 payload: SmartHomeV1ExecutePayload;
135}
136export interface SmartHomeV1DisconnectResponse {
137}
138export declare type SmartHomeV1Response = SmartHomeV1SyncResponse | SmartHomeV1QueryResponse | SmartHomeV1ExecuteResponse | SmartHomeV1DisconnectResponse;
139export interface SmartHomeV1ReportStateRequest {
140 requestId: string;
141 agentUserId: string;
142 payload: {
143 devices: {
144 states: ApiClientObjectMap<any>;
145 };
146 };
147}