@@ -41,13 +41,34 @@ def failed_request_exception(message, r):
41
41
42
42
43
43
@click .group ()
44
- @click .option ('--project' )
45
- @click .option ('--client-secret' )
44
+ @click .option ('--project' ,
45
+ help = 'Enter the Google Developer Project ID that you want to '
46
+ 'use with the registration tool. If you don\' t use this flag, '
47
+ 'the tool will use the project listed in the '
48
+ '<client_secret_client-id.json> file you specify with the '
49
+ '--client-secret flag.' )
50
+ @click .option ('--client-secret' ,
51
+ help = 'Enter the path and filename for the '
52
+ '<client_secret_client-id.json> file you downloaded from your '
53
+ 'developer project. This file is used to infer the Google '
54
+ 'Developer Project ID if it was not provided with the --project '
55
+ 'flag. If the --project flag and this flag are not used, the '
56
+ 'tool will look for this file in the current directory (by '
57
+ 'searching for a file named after the client_id stored in the '
58
+ 'credentials file).' )
46
59
@click .option ('--api-endpoint' , default = 'embeddedassistant.googleapis.com' ,
47
- show_default = True )
60
+ show_default = True ,
61
+ help = 'Hostname for the Google Assistant API. Do not use this '
62
+ 'flag unless explicitly instructed.' )
48
63
@click .option ('--credentials' , show_default = True ,
49
64
default = os .path .join (click .get_app_dir ('google-oauthlib-tool' ),
50
- 'credentials.json' ))
65
+ 'credentials.json' ),
66
+ help = 'File location of the generated credentials file. The '
67
+ 'google-oauthlib-tool generates this file after authorizing '
68
+ 'the user with the <client_secret_client-id.json> file. This '
69
+ 'credentials file authorizes access to the Google Assistant '
70
+ 'API. You can use this flag if the credentials were generated '
71
+ 'in a location that is different than the default.' )
51
72
@click .pass_context
52
73
def cli (ctx , project , client_secret , api_endpoint , credentials ):
53
74
try :
@@ -82,18 +103,47 @@ def cli(ctx, project, client_secret, api_endpoint, credentials):
82
103
83
104
84
105
@cli .command ()
85
- @click .option ('--model' , required = True )
106
+ @click .option ('--model' , required = True ,
107
+ help = 'Enter a globally-unique identifier for this device model; '
108
+ 'you should use your project ID as a prefix to help avoid '
109
+ 'collisions over the range of all projects (for example, '
110
+ '"my-dev-project-my-led1").' )
86
111
@click .option ('--type' , type = click .Choice (['LIGHT' , 'SWITCH' , 'OUTLET' ]),
87
- required = True )
88
- @click .option ('--trait' , multiple = True )
89
- @click .option ('--manufacturer' , required = True )
90
- @click .option ('--product-name' , required = True )
91
- @click .option ('--description' )
92
- @click .option ('--device' , required = True )
93
- @click .option ('--nickname' )
112
+ required = True ,
113
+ help = 'Select the type of device hardware that best aligns with '
114
+ 'your device. Select LIGHT if none of the listed choices aligns '
115
+ 'with your device.' )
116
+ @click .option ('--trait' , multiple = True ,
117
+ help = 'Add traits (abilities) that the device supports. Pass '
118
+ 'this flag multiple times to create a list of traits. Refer to '
119
+ 'https://developers.google.com/assistant/sdk for a list of '
120
+ 'supported traits.' )
121
+ @click .option ('--manufacturer' , required = True ,
122
+ help = 'Enter the manufacturer\' s name in this field (for '
123
+ 'example, "Assistant SDK developer"). This information may be '
124
+ 'shown in the Assistant settings and internal analytics.' )
125
+ @click .option ('--product-name' , required = True ,
126
+ help = 'Enter the product name in this field (for example, '
127
+ '"Assistant SDK light").' )
128
+ @click .option ('--description' ,
129
+ help = 'Enter a description of the product in this field (for '
130
+ 'example, "Assistant SDK light device").' )
131
+ @click .option ('--device' , required = True ,
132
+ help = 'Enter an identifier for the device instance. This ID must '
133
+ 'be unique within all of the devices registered under the same '
134
+ 'Google Developer project.' )
135
+ @click .option ('--nickname' ,
136
+ help = 'Enter a nickname for the device. You can use this name '
137
+ 'when talking to your Assistant to refer to this device.' )
94
138
@click .pass_context
95
139
def register (ctx , model , type , trait , manufacturer , product_name , description ,
96
140
device , nickname ):
141
+ """Registers a device model and instance.
142
+
143
+ Device model and instance fields can only contain letters, numbers, and the
144
+ following symbols: period (.), hyphen (-), underscore (_), space ( ) and
145
+ plus (+). The first character of a field must be a letter or number.
146
+ """
97
147
ctx .invoke (register_model ,
98
148
model = model , type = type , trait = trait ,
99
149
manufacturer = manufacturer ,
@@ -103,16 +153,40 @@ def register(ctx, model, type, trait, manufacturer, product_name, description,
103
153
104
154
105
155
@cli .command ('register-model' )
106
- @click .option ('--model' , required = True )
156
+ @click .option ('--model' , required = True ,
157
+ help = 'Enter a globally-unique identifier for this device model; '
158
+ 'you should use your project ID as a prefix to help avoid '
159
+ 'collisions over the range of all projects (for example, '
160
+ '"my-dev-project-my-led1").' )
107
161
@click .option ('--type' , type = click .Choice (['LIGHT' , 'SWITCH' , 'OUTLET' ]),
108
- required = True )
109
- @click .option ('--trait' , multiple = True )
110
- @click .option ('--manufacturer' , required = True )
111
- @click .option ('--product-name' , required = True )
112
- @click .option ('--description' )
162
+ required = True ,
163
+ help = 'Select the type of device hardware that best aligns with '
164
+ 'your device. Select LIGHT if none of the listed choices aligns '
165
+ 'with your device.' )
166
+ @click .option ('--trait' , multiple = True ,
167
+ help = 'Add traits (abilities) that the device supports. Pass '
168
+ 'this flag multiple times to create a list of traits. Refer to '
169
+ 'https://developers.google.com/assistant/sdk for a list of '
170
+ 'supported traits.' )
171
+ @click .option ('--manufacturer' , required = True ,
172
+ help = 'Enter the manufacturer\' s name in this field (for '
173
+ 'example, "Assistant SDK developer"). This information may be '
174
+ 'shown in the Assistant settings and internal analytics.' )
175
+ @click .option ('--product-name' , required = True ,
176
+ help = 'Enter the product name in this field (for example, '
177
+ '"Assistant SDK light").' )
178
+ @click .option ('--description' ,
179
+ help = 'Enter a description of the product in this field (for '
180
+ 'example, "Assistant SDK light device").' )
113
181
@click .pass_context
114
182
def register_model (ctx , model , type , trait ,
115
183
manufacturer , product_name , description ):
184
+ """Registers a device model.
185
+
186
+ Device model and instance fields can only contain letters, numbers, and the
187
+ following symbols: period (.), hyphen (-), underscore (_), space ( ) and
188
+ plus (+). The first character of a field must be a letter or number.
189
+ """
116
190
session = ctx .obj ['SESSION' ]
117
191
118
192
model_base_url = '/' .join ([ctx .obj ['API_URL' ], 'deviceModels' ])
@@ -145,11 +219,24 @@ def register_model(ctx, model, type, trait,
145
219
146
220
147
221
@cli .command ('register-device' )
148
- @click .option ('--device' , required = True )
149
- @click .option ('--model' , required = True )
150
- @click .option ('--nickname' )
222
+ @click .option ('--device' , required = True ,
223
+ help = 'Enter an identifier for the device instance. This ID must '
224
+ 'be unique within all of the devices registered under the same '
225
+ 'Google Developer project.' )
226
+ @click .option ('--model' , required = True ,
227
+ help = 'Enter the identifier for an existing device model. This '
228
+ 'new device instance will be associated with this device model.' )
229
+ @click .option ('--nickname' ,
230
+ help = 'Enter a nickname for the device. You can use this name '
231
+ 'when talking to your Assistant to refer to this device.' )
151
232
@click .pass_context
152
233
def register_device (ctx , device , model , nickname ):
234
+ """Registers a device instance under an existing device model.
235
+
236
+ Device model and instance fields can only contain letters, numbers, and the
237
+ following symbols: period (.), hyphen (-), underscore (_), space ( ) and
238
+ plus (+). The first character of a field must be a letter or number.
239
+ """
153
240
session = ctx .obj ['SESSION' ]
154
241
155
242
device_base_url = '/' .join ([ctx .obj ['API_URL' ], 'devices' ])
@@ -177,11 +264,16 @@ def register_device(ctx, device, model, nickname):
177
264
178
265
179
266
@cli .command ()
180
- @click .option ('--model' , 'resource' , flag_value = 'deviceModels' , required = True )
181
- @click .option ('--device' , 'resource' , flag_value = 'devices' , required = True )
267
+ @click .option ('--model' , 'resource' , flag_value = 'deviceModels' , required = True ,
268
+ help = 'Enter the identifier for an existing device model.' )
269
+ @click .option ('--device' , 'resource' , flag_value = 'devices' , required = True ,
270
+ help = 'Enter the identifier for an existing device instance.' )
182
271
@click .argument ('id' )
183
272
@click .pass_context
184
273
def get (ctx , resource , id ):
274
+ """Gets all of the information (fields) for a given device model or
275
+ instance.
276
+ """
185
277
session = ctx .obj ['SESSION' ]
186
278
url = '/' .join ([ctx .obj ['API_URL' ], resource , id ])
187
279
r = session .get (url )
@@ -195,6 +287,10 @@ def get(ctx, resource, id):
195
287
@click .option ('--device' , 'resource' , flag_value = 'devices' , required = True )
196
288
@click .pass_context
197
289
def list (ctx , resource ):
290
+ """Lists all of the device models and/or instances associated with the
291
+ current Google Developer project. To change the current project, use the
292
+ devicetool's --project flag.
293
+ """
198
294
session = ctx .obj ['SESSION' ]
199
295
url = '/' .join ([ctx .obj ['API_URL' ], resource ])
200
296
r = session .get (url )
0 commit comments