1// Copyright 2021 Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Code generated file. DO NOT EDIT.
6
7// Package smartdevicemanagement provides access to the Smart Device Management API.
8//
9// For product documentation, see: https://developers.google.com/nest/device-access
10//
11// Creating a client
12//
13// Usage example:
14//
15//   import "google.golang.org/api/smartdevicemanagement/v1"
16//   ...
17//   ctx := context.Background()
18//   smartdevicemanagementService, err := smartdevicemanagement.NewService(ctx)
19//
20// In this example, Google Application Default Credentials are used for authentication.
21//
22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23//
24// Other authentication options
25//
26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
27//
28//   smartdevicemanagementService, err := smartdevicemanagement.NewService(ctx, option.WithScopes(smartdevicemanagement.SdmThermostatServiceScope))
29//
30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
31//
32//   smartdevicemanagementService, err := smartdevicemanagement.NewService(ctx, option.WithAPIKey("AIza..."))
33//
34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
35//
36//   config := &oauth2.Config{...}
37//   // ...
38//   token, err := config.Exchange(ctx, ...)
39//   smartdevicemanagementService, err := smartdevicemanagement.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
40//
41// See https://godoc.org/google.golang.org/api/option/ for details on options.
42package smartdevicemanagement // import "google.golang.org/api/smartdevicemanagement/v1"
43
44import (
45	"bytes"
46	"context"
47	"encoding/json"
48	"errors"
49	"fmt"
50	"io"
51	"net/http"
52	"net/url"
53	"strconv"
54	"strings"
55
56	googleapi "google.golang.org/api/googleapi"
57	gensupport "google.golang.org/api/internal/gensupport"
58	option "google.golang.org/api/option"
59	internaloption "google.golang.org/api/option/internaloption"
60	htransport "google.golang.org/api/transport/http"
61)
62
63// Always reference these packages, just in case the auto-generated code
64// below doesn't.
65var _ = bytes.NewBuffer
66var _ = strconv.Itoa
67var _ = fmt.Sprintf
68var _ = json.NewDecoder
69var _ = io.Copy
70var _ = url.Parse
71var _ = gensupport.MarshalJSON
72var _ = googleapi.Version
73var _ = errors.New
74var _ = strings.Replace
75var _ = context.Canceled
76var _ = internaloption.WithDefaultEndpoint
77
78const apiId = "smartdevicemanagement:v1"
79const apiName = "smartdevicemanagement"
80const apiVersion = "v1"
81const basePath = "https://smartdevicemanagement.googleapis.com/"
82const mtlsBasePath = "https://smartdevicemanagement.mtls.googleapis.com/"
83
84// OAuth2 scopes used by this API.
85const (
86	// See and/or control the devices that you selected
87	SdmServiceScope = "https://www.googleapis.com/auth/sdm.service"
88
89	// See and control the Nest thermostats that you select
90	SdmThermostatServiceScope = "https://www.googleapis.com/auth/sdm.thermostat.service"
91)
92
93// NewService creates a new Service.
94func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
95	scopesOption := option.WithScopes(
96		"https://www.googleapis.com/auth/sdm.service",
97		"https://www.googleapis.com/auth/sdm.thermostat.service",
98	)
99	// NOTE: prepend, so we don't override user-specified scopes.
100	opts = append([]option.ClientOption{scopesOption}, opts...)
101	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
102	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
103	client, endpoint, err := htransport.NewClient(ctx, opts...)
104	if err != nil {
105		return nil, err
106	}
107	s, err := New(client)
108	if err != nil {
109		return nil, err
110	}
111	if endpoint != "" {
112		s.BasePath = endpoint
113	}
114	return s, nil
115}
116
117// New creates a new Service. It uses the provided http.Client for requests.
118//
119// Deprecated: please use NewService instead.
120// To provide a custom HTTP client, use option.WithHTTPClient.
121// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
122func New(client *http.Client) (*Service, error) {
123	if client == nil {
124		return nil, errors.New("client is nil")
125	}
126	s := &Service{client: client, BasePath: basePath}
127	s.Enterprises = NewEnterprisesService(s)
128	return s, nil
129}
130
131type Service struct {
132	client    *http.Client
133	BasePath  string // API endpoint base URL
134	UserAgent string // optional additional User-Agent fragment
135
136	Enterprises *EnterprisesService
137}
138
139func (s *Service) userAgent() string {
140	if s.UserAgent == "" {
141		return googleapi.UserAgent
142	}
143	return googleapi.UserAgent + " " + s.UserAgent
144}
145
146func NewEnterprisesService(s *Service) *EnterprisesService {
147	rs := &EnterprisesService{s: s}
148	rs.Devices = NewEnterprisesDevicesService(s)
149	rs.Structures = NewEnterprisesStructuresService(s)
150	return rs
151}
152
153type EnterprisesService struct {
154	s *Service
155
156	Devices *EnterprisesDevicesService
157
158	Structures *EnterprisesStructuresService
159}
160
161func NewEnterprisesDevicesService(s *Service) *EnterprisesDevicesService {
162	rs := &EnterprisesDevicesService{s: s}
163	return rs
164}
165
166type EnterprisesDevicesService struct {
167	s *Service
168}
169
170func NewEnterprisesStructuresService(s *Service) *EnterprisesStructuresService {
171	rs := &EnterprisesStructuresService{s: s}
172	rs.Rooms = NewEnterprisesStructuresRoomsService(s)
173	return rs
174}
175
176type EnterprisesStructuresService struct {
177	s *Service
178
179	Rooms *EnterprisesStructuresRoomsService
180}
181
182func NewEnterprisesStructuresRoomsService(s *Service) *EnterprisesStructuresRoomsService {
183	rs := &EnterprisesStructuresRoomsService{s: s}
184	return rs
185}
186
187type EnterprisesStructuresRoomsService struct {
188	s *Service
189}
190
191// GoogleHomeEnterpriseSdmV1Device: Device resource represents an
192// instance of enterprise managed device in the property.
193type GoogleHomeEnterpriseSdmV1Device struct {
194	// Name: Required. The resource name of the device. For example:
195	// "enterprises/XYZ/devices/123".
196	Name string `json:"name,omitempty"`
197
198	// ParentRelations: Assignee details of the device.
199	ParentRelations []*GoogleHomeEnterpriseSdmV1ParentRelation `json:"parentRelations,omitempty"`
200
201	// Traits: Output only. Device traits.
202	Traits googleapi.RawMessage `json:"traits,omitempty"`
203
204	// Type: Output only. Type of the device for general display purposes.
205	// For example: "THERMOSTAT". The device type should not be used to
206	// deduce or infer functionality of the actual device it is assigned to.
207	// Instead, use the returned traits for the device.
208	Type string `json:"type,omitempty"`
209
210	// ServerResponse contains the HTTP response code and headers from the
211	// server.
212	googleapi.ServerResponse `json:"-"`
213
214	// ForceSendFields is a list of field names (e.g. "Name") to
215	// unconditionally include in API requests. By default, fields with
216	// empty or default values are omitted from API requests. However, any
217	// non-pointer, non-interface field appearing in ForceSendFields will be
218	// sent to the server regardless of whether the field is empty or not.
219	// This may be used to include empty fields in Patch requests.
220	ForceSendFields []string `json:"-"`
221
222	// NullFields is a list of field names (e.g. "Name") to include in API
223	// requests with the JSON null value. By default, fields with empty
224	// values are omitted from API requests. However, any field with an
225	// empty value appearing in NullFields will be sent to the server as
226	// null. It is an error if a field in this list has a non-empty value.
227	// This may be used to include null fields in Patch requests.
228	NullFields []string `json:"-"`
229}
230
231func (s *GoogleHomeEnterpriseSdmV1Device) MarshalJSON() ([]byte, error) {
232	type NoMethod GoogleHomeEnterpriseSdmV1Device
233	raw := NoMethod(*s)
234	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
235}
236
237// GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest: Request message
238// for SmartDeviceManagementService.ExecuteDeviceCommand
239type GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest struct {
240	// Command: The command name to execute, represented by the fully
241	// qualified protobuf message name.
242	Command string `json:"command,omitempty"`
243
244	// Params: The command message to execute, represented as a Struct.
245	Params googleapi.RawMessage `json:"params,omitempty"`
246
247	// ForceSendFields is a list of field names (e.g. "Command") to
248	// unconditionally include in API requests. By default, fields with
249	// empty or default values are omitted from API requests. However, any
250	// non-pointer, non-interface field appearing in ForceSendFields will be
251	// sent to the server regardless of whether the field is empty or not.
252	// This may be used to include empty fields in Patch requests.
253	ForceSendFields []string `json:"-"`
254
255	// NullFields is a list of field names (e.g. "Command") to include in
256	// API requests with the JSON null value. By default, fields with empty
257	// values are omitted from API requests. However, any field with an
258	// empty value appearing in NullFields will be sent to the server as
259	// null. It is an error if a field in this list has a non-empty value.
260	// This may be used to include null fields in Patch requests.
261	NullFields []string `json:"-"`
262}
263
264func (s *GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest) MarshalJSON() ([]byte, error) {
265	type NoMethod GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest
266	raw := NoMethod(*s)
267	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
268}
269
270// GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse: Response
271// message for SmartDeviceManagementService.ExecuteDeviceCommand
272type GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse struct {
273	// Results: The results of executing the command.
274	Results googleapi.RawMessage `json:"results,omitempty"`
275
276	// ServerResponse contains the HTTP response code and headers from the
277	// server.
278	googleapi.ServerResponse `json:"-"`
279
280	// ForceSendFields is a list of field names (e.g. "Results") to
281	// unconditionally include in API requests. By default, fields with
282	// empty or default values are omitted from API requests. However, any
283	// non-pointer, non-interface field appearing in ForceSendFields will be
284	// sent to the server regardless of whether the field is empty or not.
285	// This may be used to include empty fields in Patch requests.
286	ForceSendFields []string `json:"-"`
287
288	// NullFields is a list of field names (e.g. "Results") to include in
289	// API requests with the JSON null value. By default, fields with empty
290	// values are omitted from API requests. However, any field with an
291	// empty value appearing in NullFields will be sent to the server as
292	// null. It is an error if a field in this list has a non-empty value.
293	// This may be used to include null fields in Patch requests.
294	NullFields []string `json:"-"`
295}
296
297func (s *GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse) MarshalJSON() ([]byte, error) {
298	type NoMethod GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse
299	raw := NoMethod(*s)
300	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
301}
302
303// GoogleHomeEnterpriseSdmV1ListDevicesResponse: Response message for
304// SmartDeviceManagementService.ListDevices
305type GoogleHomeEnterpriseSdmV1ListDevicesResponse struct {
306	// Devices: The list of devices.
307	Devices []*GoogleHomeEnterpriseSdmV1Device `json:"devices,omitempty"`
308
309	// NextPageToken: The pagination token to retrieve the next page of
310	// results.
311	NextPageToken string `json:"nextPageToken,omitempty"`
312
313	// ServerResponse contains the HTTP response code and headers from the
314	// server.
315	googleapi.ServerResponse `json:"-"`
316
317	// ForceSendFields is a list of field names (e.g. "Devices") to
318	// unconditionally include in API requests. By default, fields with
319	// empty or default values are omitted from API requests. However, any
320	// non-pointer, non-interface field appearing in ForceSendFields will be
321	// sent to the server regardless of whether the field is empty or not.
322	// This may be used to include empty fields in Patch requests.
323	ForceSendFields []string `json:"-"`
324
325	// NullFields is a list of field names (e.g. "Devices") to include in
326	// API requests with the JSON null value. By default, fields with empty
327	// values are omitted from API requests. However, any field with an
328	// empty value appearing in NullFields will be sent to the server as
329	// null. It is an error if a field in this list has a non-empty value.
330	// This may be used to include null fields in Patch requests.
331	NullFields []string `json:"-"`
332}
333
334func (s *GoogleHomeEnterpriseSdmV1ListDevicesResponse) MarshalJSON() ([]byte, error) {
335	type NoMethod GoogleHomeEnterpriseSdmV1ListDevicesResponse
336	raw := NoMethod(*s)
337	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
338}
339
340// GoogleHomeEnterpriseSdmV1ListRoomsResponse: Response message for
341// SmartDeviceManagementService.ListRooms
342type GoogleHomeEnterpriseSdmV1ListRoomsResponse struct {
343	// NextPageToken: The pagination token to retrieve the next page of
344	// results. If this field is omitted, there are no subsequent pages.
345	NextPageToken string `json:"nextPageToken,omitempty"`
346
347	// Rooms: The list of rooms.
348	Rooms []*GoogleHomeEnterpriseSdmV1Room `json:"rooms,omitempty"`
349
350	// ServerResponse contains the HTTP response code and headers from the
351	// server.
352	googleapi.ServerResponse `json:"-"`
353
354	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
355	// unconditionally include in API requests. By default, fields with
356	// empty or default values are omitted from API requests. However, any
357	// non-pointer, non-interface field appearing in ForceSendFields will be
358	// sent to the server regardless of whether the field is empty or not.
359	// This may be used to include empty fields in Patch requests.
360	ForceSendFields []string `json:"-"`
361
362	// NullFields is a list of field names (e.g. "NextPageToken") to include
363	// in API requests with the JSON null value. By default, fields with
364	// empty values are omitted from API requests. However, any field with
365	// an empty value appearing in NullFields will be sent to the server as
366	// null. It is an error if a field in this list has a non-empty value.
367	// This may be used to include null fields in Patch requests.
368	NullFields []string `json:"-"`
369}
370
371func (s *GoogleHomeEnterpriseSdmV1ListRoomsResponse) MarshalJSON() ([]byte, error) {
372	type NoMethod GoogleHomeEnterpriseSdmV1ListRoomsResponse
373	raw := NoMethod(*s)
374	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
375}
376
377// GoogleHomeEnterpriseSdmV1ListStructuresResponse: Response message for
378// SmartDeviceManagementService.ListStructures
379type GoogleHomeEnterpriseSdmV1ListStructuresResponse struct {
380	// NextPageToken: The pagination token to retrieve the next page of
381	// results. If this field is omitted, there are no subsequent pages.
382	NextPageToken string `json:"nextPageToken,omitempty"`
383
384	// Structures: The list of structures.
385	Structures []*GoogleHomeEnterpriseSdmV1Structure `json:"structures,omitempty"`
386
387	// ServerResponse contains the HTTP response code and headers from the
388	// server.
389	googleapi.ServerResponse `json:"-"`
390
391	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
392	// unconditionally include in API requests. By default, fields with
393	// empty or default values are omitted from API requests. However, any
394	// non-pointer, non-interface field appearing in ForceSendFields will be
395	// sent to the server regardless of whether the field is empty or not.
396	// This may be used to include empty fields in Patch requests.
397	ForceSendFields []string `json:"-"`
398
399	// NullFields is a list of field names (e.g. "NextPageToken") to include
400	// in API requests with the JSON null value. By default, fields with
401	// empty values are omitted from API requests. However, any field with
402	// an empty value appearing in NullFields will be sent to the server as
403	// null. It is an error if a field in this list has a non-empty value.
404	// This may be used to include null fields in Patch requests.
405	NullFields []string `json:"-"`
406}
407
408func (s *GoogleHomeEnterpriseSdmV1ListStructuresResponse) MarshalJSON() ([]byte, error) {
409	type NoMethod GoogleHomeEnterpriseSdmV1ListStructuresResponse
410	raw := NoMethod(*s)
411	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
412}
413
414// GoogleHomeEnterpriseSdmV1ParentRelation: Represents device
415// relationships, for instance, structure/room to which the device is
416// assigned to.
417type GoogleHomeEnterpriseSdmV1ParentRelation struct {
418	// DisplayName: Output only. The custom name of the relation -- e.g.,
419	// structure/room where the device is assigned to.
420	DisplayName string `json:"displayName,omitempty"`
421
422	// Parent: Output only. The name of the relation -- e.g., structure/room
423	// where the device is assigned to. For example:
424	// "enterprises/XYZ/structures/ABC" or
425	// "enterprises/XYZ/structures/ABC/rooms/123"
426	Parent string `json:"parent,omitempty"`
427
428	// ForceSendFields is a list of field names (e.g. "DisplayName") to
429	// unconditionally include in API requests. By default, fields with
430	// empty or default values are omitted from API requests. However, any
431	// non-pointer, non-interface field appearing in ForceSendFields will be
432	// sent to the server regardless of whether the field is empty or not.
433	// This may be used to include empty fields in Patch requests.
434	ForceSendFields []string `json:"-"`
435
436	// NullFields is a list of field names (e.g. "DisplayName") to include
437	// in API requests with the JSON null value. By default, fields with
438	// empty values are omitted from API requests. However, any field with
439	// an empty value appearing in NullFields will be sent to the server as
440	// null. It is an error if a field in this list has a non-empty value.
441	// This may be used to include null fields in Patch requests.
442	NullFields []string `json:"-"`
443}
444
445func (s *GoogleHomeEnterpriseSdmV1ParentRelation) MarshalJSON() ([]byte, error) {
446	type NoMethod GoogleHomeEnterpriseSdmV1ParentRelation
447	raw := NoMethod(*s)
448	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
449}
450
451// GoogleHomeEnterpriseSdmV1Room: Room resource represents an instance
452// of sub-space within a structure such as rooms in a hotel suite or
453// rental apartment.
454type GoogleHomeEnterpriseSdmV1Room struct {
455	// Name: Output only. The resource name of the room. For example:
456	// "enterprises/XYZ/structures/ABC/rooms/123".
457	Name string `json:"name,omitempty"`
458
459	// Traits: Room traits.
460	Traits googleapi.RawMessage `json:"traits,omitempty"`
461
462	// ServerResponse contains the HTTP response code and headers from the
463	// server.
464	googleapi.ServerResponse `json:"-"`
465
466	// ForceSendFields is a list of field names (e.g. "Name") to
467	// unconditionally include in API requests. By default, fields with
468	// empty or default values are omitted from API requests. However, any
469	// non-pointer, non-interface field appearing in ForceSendFields will be
470	// sent to the server regardless of whether the field is empty or not.
471	// This may be used to include empty fields in Patch requests.
472	ForceSendFields []string `json:"-"`
473
474	// NullFields is a list of field names (e.g. "Name") to include in API
475	// requests with the JSON null value. By default, fields with empty
476	// values are omitted from API requests. However, any field with an
477	// empty value appearing in NullFields will be sent to the server as
478	// null. It is an error if a field in this list has a non-empty value.
479	// This may be used to include null fields in Patch requests.
480	NullFields []string `json:"-"`
481}
482
483func (s *GoogleHomeEnterpriseSdmV1Room) MarshalJSON() ([]byte, error) {
484	type NoMethod GoogleHomeEnterpriseSdmV1Room
485	raw := NoMethod(*s)
486	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
487}
488
489// GoogleHomeEnterpriseSdmV1Structure: Structure resource represents an
490// instance of enterprise managed home or hotel room.
491type GoogleHomeEnterpriseSdmV1Structure struct {
492	// Name: Output only. The resource name of the structure. For example:
493	// "enterprises/XYZ/structures/ABC".
494	Name string `json:"name,omitempty"`
495
496	// Traits: Structure traits.
497	Traits googleapi.RawMessage `json:"traits,omitempty"`
498
499	// ServerResponse contains the HTTP response code and headers from the
500	// server.
501	googleapi.ServerResponse `json:"-"`
502
503	// ForceSendFields is a list of field names (e.g. "Name") to
504	// unconditionally include in API requests. By default, fields with
505	// empty or default values are omitted from API requests. However, any
506	// non-pointer, non-interface field appearing in ForceSendFields will be
507	// sent to the server regardless of whether the field is empty or not.
508	// This may be used to include empty fields in Patch requests.
509	ForceSendFields []string `json:"-"`
510
511	// NullFields is a list of field names (e.g. "Name") to include in API
512	// requests with the JSON null value. By default, fields with empty
513	// values are omitted from API requests. However, any field with an
514	// empty value appearing in NullFields will be sent to the server as
515	// null. It is an error if a field in this list has a non-empty value.
516	// This may be used to include null fields in Patch requests.
517	NullFields []string `json:"-"`
518}
519
520func (s *GoogleHomeEnterpriseSdmV1Structure) MarshalJSON() ([]byte, error) {
521	type NoMethod GoogleHomeEnterpriseSdmV1Structure
522	raw := NoMethod(*s)
523	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
524}
525
526// method id "smartdevicemanagement.enterprises.devices.executeCommand":
527
528type EnterprisesDevicesExecuteCommandCall struct {
529	s                                                    *Service
530	name                                                 string
531	googlehomeenterprisesdmv1executedevicecommandrequest *GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest
532	urlParams_                                           gensupport.URLParams
533	ctx_                                                 context.Context
534	header_                                              http.Header
535}
536
537// ExecuteCommand: Executes a command to device managed by the
538// enterprise.
539//
540// - name: The name of the device requested. For example:
541//   "enterprises/XYZ/devices/123".
542func (r *EnterprisesDevicesService) ExecuteCommand(name string, googlehomeenterprisesdmv1executedevicecommandrequest *GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest) *EnterprisesDevicesExecuteCommandCall {
543	c := &EnterprisesDevicesExecuteCommandCall{s: r.s, urlParams_: make(gensupport.URLParams)}
544	c.name = name
545	c.googlehomeenterprisesdmv1executedevicecommandrequest = googlehomeenterprisesdmv1executedevicecommandrequest
546	return c
547}
548
549// Fields allows partial responses to be retrieved. See
550// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
551// for more information.
552func (c *EnterprisesDevicesExecuteCommandCall) Fields(s ...googleapi.Field) *EnterprisesDevicesExecuteCommandCall {
553	c.urlParams_.Set("fields", googleapi.CombineFields(s))
554	return c
555}
556
557// Context sets the context to be used in this call's Do method. Any
558// pending HTTP request will be aborted if the provided context is
559// canceled.
560func (c *EnterprisesDevicesExecuteCommandCall) Context(ctx context.Context) *EnterprisesDevicesExecuteCommandCall {
561	c.ctx_ = ctx
562	return c
563}
564
565// Header returns an http.Header that can be modified by the caller to
566// add HTTP headers to the request.
567func (c *EnterprisesDevicesExecuteCommandCall) Header() http.Header {
568	if c.header_ == nil {
569		c.header_ = make(http.Header)
570	}
571	return c.header_
572}
573
574func (c *EnterprisesDevicesExecuteCommandCall) doRequest(alt string) (*http.Response, error) {
575	reqHeaders := make(http.Header)
576	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210812")
577	for k, v := range c.header_ {
578		reqHeaders[k] = v
579	}
580	reqHeaders.Set("User-Agent", c.s.userAgent())
581	var body io.Reader = nil
582	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlehomeenterprisesdmv1executedevicecommandrequest)
583	if err != nil {
584		return nil, err
585	}
586	reqHeaders.Set("Content-Type", "application/json")
587	c.urlParams_.Set("alt", alt)
588	c.urlParams_.Set("prettyPrint", "false")
589	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:executeCommand")
590	urls += "?" + c.urlParams_.Encode()
591	req, err := http.NewRequest("POST", urls, body)
592	if err != nil {
593		return nil, err
594	}
595	req.Header = reqHeaders
596	googleapi.Expand(req.URL, map[string]string{
597		"name": c.name,
598	})
599	return gensupport.SendRequest(c.ctx_, c.s.client, req)
600}
601
602// Do executes the "smartdevicemanagement.enterprises.devices.executeCommand" call.
603// Exactly one of *GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse
604// or error will be non-nil. Any non-2xx status code is an error.
605// Response headers are in either
606// *GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse.ServerResponse.
607// Header or (if a response was returned at all) in
608// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
609// whether the returned error was because http.StatusNotModified was
610// returned.
611func (c *EnterprisesDevicesExecuteCommandCall) Do(opts ...googleapi.CallOption) (*GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse, error) {
612	gensupport.SetOptions(c.urlParams_, opts...)
613	res, err := c.doRequest("json")
614	if res != nil && res.StatusCode == http.StatusNotModified {
615		if res.Body != nil {
616			res.Body.Close()
617		}
618		return nil, &googleapi.Error{
619			Code:   res.StatusCode,
620			Header: res.Header,
621		}
622	}
623	if err != nil {
624		return nil, err
625	}
626	defer googleapi.CloseBody(res)
627	if err := googleapi.CheckResponse(res); err != nil {
628		return nil, err
629	}
630	ret := &GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse{
631		ServerResponse: googleapi.ServerResponse{
632			Header:         res.Header,
633			HTTPStatusCode: res.StatusCode,
634		},
635	}
636	target := &ret
637	if err := gensupport.DecodeResponse(target, res); err != nil {
638		return nil, err
639	}
640	return ret, nil
641	// {
642	//   "description": "Executes a command to device managed by the enterprise.",
643	//   "flatPath": "v1/enterprises/{enterprisesId}/devices/{devicesId}:executeCommand",
644	//   "httpMethod": "POST",
645	//   "id": "smartdevicemanagement.enterprises.devices.executeCommand",
646	//   "parameterOrder": [
647	//     "name"
648	//   ],
649	//   "parameters": {
650	//     "name": {
651	//       "description": "The name of the device requested. For example: \"enterprises/XYZ/devices/123\"",
652	//       "location": "path",
653	//       "pattern": "^enterprises/[^/]+/devices/[^/]+$",
654	//       "required": true,
655	//       "type": "string"
656	//     }
657	//   },
658	//   "path": "v1/{+name}:executeCommand",
659	//   "request": {
660	//     "$ref": "GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest"
661	//   },
662	//   "response": {
663	//     "$ref": "GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse"
664	//   },
665	//   "scopes": [
666	//     "https://www.googleapis.com/auth/sdm.service",
667	//     "https://www.googleapis.com/auth/sdm.thermostat.service"
668	//   ]
669	// }
670
671}
672
673// method id "smartdevicemanagement.enterprises.devices.get":
674
675type EnterprisesDevicesGetCall struct {
676	s            *Service
677	name         string
678	urlParams_   gensupport.URLParams
679	ifNoneMatch_ string
680	ctx_         context.Context
681	header_      http.Header
682}
683
684// Get: Gets a device managed by the enterprise.
685//
686// - name: The name of the device requested. For example:
687//   "enterprises/XYZ/devices/123".
688func (r *EnterprisesDevicesService) Get(name string) *EnterprisesDevicesGetCall {
689	c := &EnterprisesDevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
690	c.name = name
691	return c
692}
693
694// Fields allows partial responses to be retrieved. See
695// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
696// for more information.
697func (c *EnterprisesDevicesGetCall) Fields(s ...googleapi.Field) *EnterprisesDevicesGetCall {
698	c.urlParams_.Set("fields", googleapi.CombineFields(s))
699	return c
700}
701
702// IfNoneMatch sets the optional parameter which makes the operation
703// fail if the object's ETag matches the given value. This is useful for
704// getting updates only after the object has changed since the last
705// request. Use googleapi.IsNotModified to check whether the response
706// error from Do is the result of In-None-Match.
707func (c *EnterprisesDevicesGetCall) IfNoneMatch(entityTag string) *EnterprisesDevicesGetCall {
708	c.ifNoneMatch_ = entityTag
709	return c
710}
711
712// Context sets the context to be used in this call's Do method. Any
713// pending HTTP request will be aborted if the provided context is
714// canceled.
715func (c *EnterprisesDevicesGetCall) Context(ctx context.Context) *EnterprisesDevicesGetCall {
716	c.ctx_ = ctx
717	return c
718}
719
720// Header returns an http.Header that can be modified by the caller to
721// add HTTP headers to the request.
722func (c *EnterprisesDevicesGetCall) Header() http.Header {
723	if c.header_ == nil {
724		c.header_ = make(http.Header)
725	}
726	return c.header_
727}
728
729func (c *EnterprisesDevicesGetCall) doRequest(alt string) (*http.Response, error) {
730	reqHeaders := make(http.Header)
731	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210812")
732	for k, v := range c.header_ {
733		reqHeaders[k] = v
734	}
735	reqHeaders.Set("User-Agent", c.s.userAgent())
736	if c.ifNoneMatch_ != "" {
737		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
738	}
739	var body io.Reader = nil
740	c.urlParams_.Set("alt", alt)
741	c.urlParams_.Set("prettyPrint", "false")
742	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
743	urls += "?" + c.urlParams_.Encode()
744	req, err := http.NewRequest("GET", urls, body)
745	if err != nil {
746		return nil, err
747	}
748	req.Header = reqHeaders
749	googleapi.Expand(req.URL, map[string]string{
750		"name": c.name,
751	})
752	return gensupport.SendRequest(c.ctx_, c.s.client, req)
753}
754
755// Do executes the "smartdevicemanagement.enterprises.devices.get" call.
756// Exactly one of *GoogleHomeEnterpriseSdmV1Device or error will be
757// non-nil. Any non-2xx status code is an error. Response headers are in
758// either *GoogleHomeEnterpriseSdmV1Device.ServerResponse.Header or (if
759// a response was returned at all) in error.(*googleapi.Error).Header.
760// Use googleapi.IsNotModified to check whether the returned error was
761// because http.StatusNotModified was returned.
762func (c *EnterprisesDevicesGetCall) Do(opts ...googleapi.CallOption) (*GoogleHomeEnterpriseSdmV1Device, error) {
763	gensupport.SetOptions(c.urlParams_, opts...)
764	res, err := c.doRequest("json")
765	if res != nil && res.StatusCode == http.StatusNotModified {
766		if res.Body != nil {
767			res.Body.Close()
768		}
769		return nil, &googleapi.Error{
770			Code:   res.StatusCode,
771			Header: res.Header,
772		}
773	}
774	if err != nil {
775		return nil, err
776	}
777	defer googleapi.CloseBody(res)
778	if err := googleapi.CheckResponse(res); err != nil {
779		return nil, err
780	}
781	ret := &GoogleHomeEnterpriseSdmV1Device{
782		ServerResponse: googleapi.ServerResponse{
783			Header:         res.Header,
784			HTTPStatusCode: res.StatusCode,
785		},
786	}
787	target := &ret
788	if err := gensupport.DecodeResponse(target, res); err != nil {
789		return nil, err
790	}
791	return ret, nil
792	// {
793	//   "description": "Gets a device managed by the enterprise.",
794	//   "flatPath": "v1/enterprises/{enterprisesId}/devices/{devicesId}",
795	//   "httpMethod": "GET",
796	//   "id": "smartdevicemanagement.enterprises.devices.get",
797	//   "parameterOrder": [
798	//     "name"
799	//   ],
800	//   "parameters": {
801	//     "name": {
802	//       "description": "The name of the device requested. For example: \"enterprises/XYZ/devices/123\"",
803	//       "location": "path",
804	//       "pattern": "^enterprises/[^/]+/devices/[^/]+$",
805	//       "required": true,
806	//       "type": "string"
807	//     }
808	//   },
809	//   "path": "v1/{+name}",
810	//   "response": {
811	//     "$ref": "GoogleHomeEnterpriseSdmV1Device"
812	//   },
813	//   "scopes": [
814	//     "https://www.googleapis.com/auth/sdm.service",
815	//     "https://www.googleapis.com/auth/sdm.thermostat.service"
816	//   ]
817	// }
818
819}
820
821// method id "smartdevicemanagement.enterprises.devices.list":
822
823type EnterprisesDevicesListCall struct {
824	s            *Service
825	parent       string
826	urlParams_   gensupport.URLParams
827	ifNoneMatch_ string
828	ctx_         context.Context
829	header_      http.Header
830}
831
832// List: Lists devices managed by the enterprise.
833//
834// - parent: The parent enterprise to list devices under. E.g.
835//   "enterprises/XYZ".
836func (r *EnterprisesDevicesService) List(parent string) *EnterprisesDevicesListCall {
837	c := &EnterprisesDevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
838	c.parent = parent
839	return c
840}
841
842// Filter sets the optional parameter "filter": Optional filter to list
843// devices. Filters can be done on: Device custom name (substring
844// match): 'customName=wing'
845func (c *EnterprisesDevicesListCall) Filter(filter string) *EnterprisesDevicesListCall {
846	c.urlParams_.Set("filter", filter)
847	return c
848}
849
850// PageSize sets the optional parameter "pageSize": Optional requested
851// page size. Server may return fewer devices than requested. If
852// unspecified, server will pick an appropriate default.
853func (c *EnterprisesDevicesListCall) PageSize(pageSize int64) *EnterprisesDevicesListCall {
854	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
855	return c
856}
857
858// PageToken sets the optional parameter "pageToken": Optional token of
859// the page to retrieve.
860func (c *EnterprisesDevicesListCall) PageToken(pageToken string) *EnterprisesDevicesListCall {
861	c.urlParams_.Set("pageToken", pageToken)
862	return c
863}
864
865// Fields allows partial responses to be retrieved. See
866// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
867// for more information.
868func (c *EnterprisesDevicesListCall) Fields(s ...googleapi.Field) *EnterprisesDevicesListCall {
869	c.urlParams_.Set("fields", googleapi.CombineFields(s))
870	return c
871}
872
873// IfNoneMatch sets the optional parameter which makes the operation
874// fail if the object's ETag matches the given value. This is useful for
875// getting updates only after the object has changed since the last
876// request. Use googleapi.IsNotModified to check whether the response
877// error from Do is the result of In-None-Match.
878func (c *EnterprisesDevicesListCall) IfNoneMatch(entityTag string) *EnterprisesDevicesListCall {
879	c.ifNoneMatch_ = entityTag
880	return c
881}
882
883// Context sets the context to be used in this call's Do method. Any
884// pending HTTP request will be aborted if the provided context is
885// canceled.
886func (c *EnterprisesDevicesListCall) Context(ctx context.Context) *EnterprisesDevicesListCall {
887	c.ctx_ = ctx
888	return c
889}
890
891// Header returns an http.Header that can be modified by the caller to
892// add HTTP headers to the request.
893func (c *EnterprisesDevicesListCall) Header() http.Header {
894	if c.header_ == nil {
895		c.header_ = make(http.Header)
896	}
897	return c.header_
898}
899
900func (c *EnterprisesDevicesListCall) doRequest(alt string) (*http.Response, error) {
901	reqHeaders := make(http.Header)
902	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210812")
903	for k, v := range c.header_ {
904		reqHeaders[k] = v
905	}
906	reqHeaders.Set("User-Agent", c.s.userAgent())
907	if c.ifNoneMatch_ != "" {
908		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
909	}
910	var body io.Reader = nil
911	c.urlParams_.Set("alt", alt)
912	c.urlParams_.Set("prettyPrint", "false")
913	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices")
914	urls += "?" + c.urlParams_.Encode()
915	req, err := http.NewRequest("GET", urls, body)
916	if err != nil {
917		return nil, err
918	}
919	req.Header = reqHeaders
920	googleapi.Expand(req.URL, map[string]string{
921		"parent": c.parent,
922	})
923	return gensupport.SendRequest(c.ctx_, c.s.client, req)
924}
925
926// Do executes the "smartdevicemanagement.enterprises.devices.list" call.
927// Exactly one of *GoogleHomeEnterpriseSdmV1ListDevicesResponse or error
928// will be non-nil. Any non-2xx status code is an error. Response
929// headers are in either
930// *GoogleHomeEnterpriseSdmV1ListDevicesResponse.ServerResponse.Header
931// or (if a response was returned at all) in
932// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
933// whether the returned error was because http.StatusNotModified was
934// returned.
935func (c *EnterprisesDevicesListCall) Do(opts ...googleapi.CallOption) (*GoogleHomeEnterpriseSdmV1ListDevicesResponse, error) {
936	gensupport.SetOptions(c.urlParams_, opts...)
937	res, err := c.doRequest("json")
938	if res != nil && res.StatusCode == http.StatusNotModified {
939		if res.Body != nil {
940			res.Body.Close()
941		}
942		return nil, &googleapi.Error{
943			Code:   res.StatusCode,
944			Header: res.Header,
945		}
946	}
947	if err != nil {
948		return nil, err
949	}
950	defer googleapi.CloseBody(res)
951	if err := googleapi.CheckResponse(res); err != nil {
952		return nil, err
953	}
954	ret := &GoogleHomeEnterpriseSdmV1ListDevicesResponse{
955		ServerResponse: googleapi.ServerResponse{
956			Header:         res.Header,
957			HTTPStatusCode: res.StatusCode,
958		},
959	}
960	target := &ret
961	if err := gensupport.DecodeResponse(target, res); err != nil {
962		return nil, err
963	}
964	return ret, nil
965	// {
966	//   "description": "Lists devices managed by the enterprise.",
967	//   "flatPath": "v1/enterprises/{enterprisesId}/devices",
968	//   "httpMethod": "GET",
969	//   "id": "smartdevicemanagement.enterprises.devices.list",
970	//   "parameterOrder": [
971	//     "parent"
972	//   ],
973	//   "parameters": {
974	//     "filter": {
975	//       "description": "Optional filter to list devices. Filters can be done on: Device custom name (substring match): 'customName=wing'",
976	//       "location": "query",
977	//       "type": "string"
978	//     },
979	//     "pageSize": {
980	//       "description": "Optional requested page size. Server may return fewer devices than requested. If unspecified, server will pick an appropriate default.",
981	//       "format": "int32",
982	//       "location": "query",
983	//       "type": "integer"
984	//     },
985	//     "pageToken": {
986	//       "description": "Optional token of the page to retrieve.",
987	//       "location": "query",
988	//       "type": "string"
989	//     },
990	//     "parent": {
991	//       "description": "The parent enterprise to list devices under. E.g. \"enterprises/XYZ\".",
992	//       "location": "path",
993	//       "pattern": "^enterprises/[^/]+$",
994	//       "required": true,
995	//       "type": "string"
996	//     }
997	//   },
998	//   "path": "v1/{+parent}/devices",
999	//   "response": {
1000	//     "$ref": "GoogleHomeEnterpriseSdmV1ListDevicesResponse"
1001	//   },
1002	//   "scopes": [
1003	//     "https://www.googleapis.com/auth/sdm.service",
1004	//     "https://www.googleapis.com/auth/sdm.thermostat.service"
1005	//   ]
1006	// }
1007
1008}
1009
1010// Pages invokes f for each page of results.
1011// A non-nil error returned from f will halt the iteration.
1012// The provided context supersedes any context provided to the Context method.
1013func (c *EnterprisesDevicesListCall) Pages(ctx context.Context, f func(*GoogleHomeEnterpriseSdmV1ListDevicesResponse) error) error {
1014	c.ctx_ = ctx
1015	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
1016	for {
1017		x, err := c.Do()
1018		if err != nil {
1019			return err
1020		}
1021		if err := f(x); err != nil {
1022			return err
1023		}
1024		if x.NextPageToken == "" {
1025			return nil
1026		}
1027		c.PageToken(x.NextPageToken)
1028	}
1029}
1030
1031// method id "smartdevicemanagement.enterprises.structures.get":
1032
1033type EnterprisesStructuresGetCall struct {
1034	s            *Service
1035	name         string
1036	urlParams_   gensupport.URLParams
1037	ifNoneMatch_ string
1038	ctx_         context.Context
1039	header_      http.Header
1040}
1041
1042// Get: Gets a structure managed by the enterprise.
1043//
1044// - name: The name of the structure requested. For example:
1045//   "enterprises/XYZ/structures/ABC".
1046func (r *EnterprisesStructuresService) Get(name string) *EnterprisesStructuresGetCall {
1047	c := &EnterprisesStructuresGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1048	c.name = name
1049	return c
1050}
1051
1052// Fields allows partial responses to be retrieved. See
1053// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1054// for more information.
1055func (c *EnterprisesStructuresGetCall) Fields(s ...googleapi.Field) *EnterprisesStructuresGetCall {
1056	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1057	return c
1058}
1059
1060// IfNoneMatch sets the optional parameter which makes the operation
1061// fail if the object's ETag matches the given value. This is useful for
1062// getting updates only after the object has changed since the last
1063// request. Use googleapi.IsNotModified to check whether the response
1064// error from Do is the result of In-None-Match.
1065func (c *EnterprisesStructuresGetCall) IfNoneMatch(entityTag string) *EnterprisesStructuresGetCall {
1066	c.ifNoneMatch_ = entityTag
1067	return c
1068}
1069
1070// Context sets the context to be used in this call's Do method. Any
1071// pending HTTP request will be aborted if the provided context is
1072// canceled.
1073func (c *EnterprisesStructuresGetCall) Context(ctx context.Context) *EnterprisesStructuresGetCall {
1074	c.ctx_ = ctx
1075	return c
1076}
1077
1078// Header returns an http.Header that can be modified by the caller to
1079// add HTTP headers to the request.
1080func (c *EnterprisesStructuresGetCall) Header() http.Header {
1081	if c.header_ == nil {
1082		c.header_ = make(http.Header)
1083	}
1084	return c.header_
1085}
1086
1087func (c *EnterprisesStructuresGetCall) doRequest(alt string) (*http.Response, error) {
1088	reqHeaders := make(http.Header)
1089	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210812")
1090	for k, v := range c.header_ {
1091		reqHeaders[k] = v
1092	}
1093	reqHeaders.Set("User-Agent", c.s.userAgent())
1094	if c.ifNoneMatch_ != "" {
1095		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1096	}
1097	var body io.Reader = nil
1098	c.urlParams_.Set("alt", alt)
1099	c.urlParams_.Set("prettyPrint", "false")
1100	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1101	urls += "?" + c.urlParams_.Encode()
1102	req, err := http.NewRequest("GET", urls, body)
1103	if err != nil {
1104		return nil, err
1105	}
1106	req.Header = reqHeaders
1107	googleapi.Expand(req.URL, map[string]string{
1108		"name": c.name,
1109	})
1110	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1111}
1112
1113// Do executes the "smartdevicemanagement.enterprises.structures.get" call.
1114// Exactly one of *GoogleHomeEnterpriseSdmV1Structure or error will be
1115// non-nil. Any non-2xx status code is an error. Response headers are in
1116// either *GoogleHomeEnterpriseSdmV1Structure.ServerResponse.Header or
1117// (if a response was returned at all) in
1118// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1119// whether the returned error was because http.StatusNotModified was
1120// returned.
1121func (c *EnterprisesStructuresGetCall) Do(opts ...googleapi.CallOption) (*GoogleHomeEnterpriseSdmV1Structure, error) {
1122	gensupport.SetOptions(c.urlParams_, opts...)
1123	res, err := c.doRequest("json")
1124	if res != nil && res.StatusCode == http.StatusNotModified {
1125		if res.Body != nil {
1126			res.Body.Close()
1127		}
1128		return nil, &googleapi.Error{
1129			Code:   res.StatusCode,
1130			Header: res.Header,
1131		}
1132	}
1133	if err != nil {
1134		return nil, err
1135	}
1136	defer googleapi.CloseBody(res)
1137	if err := googleapi.CheckResponse(res); err != nil {
1138		return nil, err
1139	}
1140	ret := &GoogleHomeEnterpriseSdmV1Structure{
1141		ServerResponse: googleapi.ServerResponse{
1142			Header:         res.Header,
1143			HTTPStatusCode: res.StatusCode,
1144		},
1145	}
1146	target := &ret
1147	if err := gensupport.DecodeResponse(target, res); err != nil {
1148		return nil, err
1149	}
1150	return ret, nil
1151	// {
1152	//   "description": "Gets a structure managed by the enterprise.",
1153	//   "flatPath": "v1/enterprises/{enterprisesId}/structures/{structuresId}",
1154	//   "httpMethod": "GET",
1155	//   "id": "smartdevicemanagement.enterprises.structures.get",
1156	//   "parameterOrder": [
1157	//     "name"
1158	//   ],
1159	//   "parameters": {
1160	//     "name": {
1161	//       "description": "The name of the structure requested. For example: \"enterprises/XYZ/structures/ABC\".",
1162	//       "location": "path",
1163	//       "pattern": "^enterprises/[^/]+/structures/[^/]+$",
1164	//       "required": true,
1165	//       "type": "string"
1166	//     }
1167	//   },
1168	//   "path": "v1/{+name}",
1169	//   "response": {
1170	//     "$ref": "GoogleHomeEnterpriseSdmV1Structure"
1171	//   },
1172	//   "scopes": [
1173	//     "https://www.googleapis.com/auth/sdm.service",
1174	//     "https://www.googleapis.com/auth/sdm.thermostat.service"
1175	//   ]
1176	// }
1177
1178}
1179
1180// method id "smartdevicemanagement.enterprises.structures.list":
1181
1182type EnterprisesStructuresListCall struct {
1183	s            *Service
1184	parent       string
1185	urlParams_   gensupport.URLParams
1186	ifNoneMatch_ string
1187	ctx_         context.Context
1188	header_      http.Header
1189}
1190
1191// List: Lists structures managed by the enterprise.
1192//
1193// - parent: The parent enterprise to list structures under. E.g.
1194//   "enterprises/XYZ".
1195func (r *EnterprisesStructuresService) List(parent string) *EnterprisesStructuresListCall {
1196	c := &EnterprisesStructuresListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1197	c.parent = parent
1198	return c
1199}
1200
1201// Filter sets the optional parameter "filter": Optional filter to list
1202// structures.
1203func (c *EnterprisesStructuresListCall) Filter(filter string) *EnterprisesStructuresListCall {
1204	c.urlParams_.Set("filter", filter)
1205	return c
1206}
1207
1208// PageSize sets the optional parameter "pageSize": Requested page size.
1209// Server may return fewer structures than requested. If unspecified,
1210// server will pick an appropriate default.
1211func (c *EnterprisesStructuresListCall) PageSize(pageSize int64) *EnterprisesStructuresListCall {
1212	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1213	return c
1214}
1215
1216// PageToken sets the optional parameter "pageToken": The token of the
1217// page to retrieve.
1218func (c *EnterprisesStructuresListCall) PageToken(pageToken string) *EnterprisesStructuresListCall {
1219	c.urlParams_.Set("pageToken", pageToken)
1220	return c
1221}
1222
1223// Fields allows partial responses to be retrieved. See
1224// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1225// for more information.
1226func (c *EnterprisesStructuresListCall) Fields(s ...googleapi.Field) *EnterprisesStructuresListCall {
1227	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1228	return c
1229}
1230
1231// IfNoneMatch sets the optional parameter which makes the operation
1232// fail if the object's ETag matches the given value. This is useful for
1233// getting updates only after the object has changed since the last
1234// request. Use googleapi.IsNotModified to check whether the response
1235// error from Do is the result of In-None-Match.
1236func (c *EnterprisesStructuresListCall) IfNoneMatch(entityTag string) *EnterprisesStructuresListCall {
1237	c.ifNoneMatch_ = entityTag
1238	return c
1239}
1240
1241// Context sets the context to be used in this call's Do method. Any
1242// pending HTTP request will be aborted if the provided context is
1243// canceled.
1244func (c *EnterprisesStructuresListCall) Context(ctx context.Context) *EnterprisesStructuresListCall {
1245	c.ctx_ = ctx
1246	return c
1247}
1248
1249// Header returns an http.Header that can be modified by the caller to
1250// add HTTP headers to the request.
1251func (c *EnterprisesStructuresListCall) Header() http.Header {
1252	if c.header_ == nil {
1253		c.header_ = make(http.Header)
1254	}
1255	return c.header_
1256}
1257
1258func (c *EnterprisesStructuresListCall) doRequest(alt string) (*http.Response, error) {
1259	reqHeaders := make(http.Header)
1260	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210812")
1261	for k, v := range c.header_ {
1262		reqHeaders[k] = v
1263	}
1264	reqHeaders.Set("User-Agent", c.s.userAgent())
1265	if c.ifNoneMatch_ != "" {
1266		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1267	}
1268	var body io.Reader = nil
1269	c.urlParams_.Set("alt", alt)
1270	c.urlParams_.Set("prettyPrint", "false")
1271	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/structures")
1272	urls += "?" + c.urlParams_.Encode()
1273	req, err := http.NewRequest("GET", urls, body)
1274	if err != nil {
1275		return nil, err
1276	}
1277	req.Header = reqHeaders
1278	googleapi.Expand(req.URL, map[string]string{
1279		"parent": c.parent,
1280	})
1281	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1282}
1283
1284// Do executes the "smartdevicemanagement.enterprises.structures.list" call.
1285// Exactly one of *GoogleHomeEnterpriseSdmV1ListStructuresResponse or
1286// error will be non-nil. Any non-2xx status code is an error. Response
1287// headers are in either
1288// *GoogleHomeEnterpriseSdmV1ListStructuresResponse.ServerResponse.Header
1289//  or (if a response was returned at all) in
1290// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1291// whether the returned error was because http.StatusNotModified was
1292// returned.
1293func (c *EnterprisesStructuresListCall) Do(opts ...googleapi.CallOption) (*GoogleHomeEnterpriseSdmV1ListStructuresResponse, error) {
1294	gensupport.SetOptions(c.urlParams_, opts...)
1295	res, err := c.doRequest("json")
1296	if res != nil && res.StatusCode == http.StatusNotModified {
1297		if res.Body != nil {
1298			res.Body.Close()
1299		}
1300		return nil, &googleapi.Error{
1301			Code:   res.StatusCode,
1302			Header: res.Header,
1303		}
1304	}
1305	if err != nil {
1306		return nil, err
1307	}
1308	defer googleapi.CloseBody(res)
1309	if err := googleapi.CheckResponse(res); err != nil {
1310		return nil, err
1311	}
1312	ret := &GoogleHomeEnterpriseSdmV1ListStructuresResponse{
1313		ServerResponse: googleapi.ServerResponse{
1314			Header:         res.Header,
1315			HTTPStatusCode: res.StatusCode,
1316		},
1317	}
1318	target := &ret
1319	if err := gensupport.DecodeResponse(target, res); err != nil {
1320		return nil, err
1321	}
1322	return ret, nil
1323	// {
1324	//   "description": "Lists structures managed by the enterprise.",
1325	//   "flatPath": "v1/enterprises/{enterprisesId}/structures",
1326	//   "httpMethod": "GET",
1327	//   "id": "smartdevicemanagement.enterprises.structures.list",
1328	//   "parameterOrder": [
1329	//     "parent"
1330	//   ],
1331	//   "parameters": {
1332	//     "filter": {
1333	//       "description": "Optional filter to list structures.",
1334	//       "location": "query",
1335	//       "type": "string"
1336	//     },
1337	//     "pageSize": {
1338	//       "description": "Requested page size. Server may return fewer structures than requested. If unspecified, server will pick an appropriate default.",
1339	//       "format": "int32",
1340	//       "location": "query",
1341	//       "type": "integer"
1342	//     },
1343	//     "pageToken": {
1344	//       "description": "The token of the page to retrieve.",
1345	//       "location": "query",
1346	//       "type": "string"
1347	//     },
1348	//     "parent": {
1349	//       "description": "The parent enterprise to list structures under. E.g. \"enterprises/XYZ\".",
1350	//       "location": "path",
1351	//       "pattern": "^enterprises/[^/]+$",
1352	//       "required": true,
1353	//       "type": "string"
1354	//     }
1355	//   },
1356	//   "path": "v1/{+parent}/structures",
1357	//   "response": {
1358	//     "$ref": "GoogleHomeEnterpriseSdmV1ListStructuresResponse"
1359	//   },
1360	//   "scopes": [
1361	//     "https://www.googleapis.com/auth/sdm.service",
1362	//     "https://www.googleapis.com/auth/sdm.thermostat.service"
1363	//   ]
1364	// }
1365
1366}
1367
1368// Pages invokes f for each page of results.
1369// A non-nil error returned from f will halt the iteration.
1370// The provided context supersedes any context provided to the Context method.
1371func (c *EnterprisesStructuresListCall) Pages(ctx context.Context, f func(*GoogleHomeEnterpriseSdmV1ListStructuresResponse) error) error {
1372	c.ctx_ = ctx
1373	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
1374	for {
1375		x, err := c.Do()
1376		if err != nil {
1377			return err
1378		}
1379		if err := f(x); err != nil {
1380			return err
1381		}
1382		if x.NextPageToken == "" {
1383			return nil
1384		}
1385		c.PageToken(x.NextPageToken)
1386	}
1387}
1388
1389// method id "smartdevicemanagement.enterprises.structures.rooms.get":
1390
1391type EnterprisesStructuresRoomsGetCall struct {
1392	s            *Service
1393	name         string
1394	urlParams_   gensupport.URLParams
1395	ifNoneMatch_ string
1396	ctx_         context.Context
1397	header_      http.Header
1398}
1399
1400// Get: Gets a room managed by the enterprise.
1401//
1402// - name: The name of the room requested. For example:
1403//   "enterprises/XYZ/structures/ABC/rooms/123".
1404func (r *EnterprisesStructuresRoomsService) Get(name string) *EnterprisesStructuresRoomsGetCall {
1405	c := &EnterprisesStructuresRoomsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1406	c.name = name
1407	return c
1408}
1409
1410// Fields allows partial responses to be retrieved. See
1411// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1412// for more information.
1413func (c *EnterprisesStructuresRoomsGetCall) Fields(s ...googleapi.Field) *EnterprisesStructuresRoomsGetCall {
1414	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1415	return c
1416}
1417
1418// IfNoneMatch sets the optional parameter which makes the operation
1419// fail if the object's ETag matches the given value. This is useful for
1420// getting updates only after the object has changed since the last
1421// request. Use googleapi.IsNotModified to check whether the response
1422// error from Do is the result of In-None-Match.
1423func (c *EnterprisesStructuresRoomsGetCall) IfNoneMatch(entityTag string) *EnterprisesStructuresRoomsGetCall {
1424	c.ifNoneMatch_ = entityTag
1425	return c
1426}
1427
1428// Context sets the context to be used in this call's Do method. Any
1429// pending HTTP request will be aborted if the provided context is
1430// canceled.
1431func (c *EnterprisesStructuresRoomsGetCall) Context(ctx context.Context) *EnterprisesStructuresRoomsGetCall {
1432	c.ctx_ = ctx
1433	return c
1434}
1435
1436// Header returns an http.Header that can be modified by the caller to
1437// add HTTP headers to the request.
1438func (c *EnterprisesStructuresRoomsGetCall) Header() http.Header {
1439	if c.header_ == nil {
1440		c.header_ = make(http.Header)
1441	}
1442	return c.header_
1443}
1444
1445func (c *EnterprisesStructuresRoomsGetCall) doRequest(alt string) (*http.Response, error) {
1446	reqHeaders := make(http.Header)
1447	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210812")
1448	for k, v := range c.header_ {
1449		reqHeaders[k] = v
1450	}
1451	reqHeaders.Set("User-Agent", c.s.userAgent())
1452	if c.ifNoneMatch_ != "" {
1453		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1454	}
1455	var body io.Reader = nil
1456	c.urlParams_.Set("alt", alt)
1457	c.urlParams_.Set("prettyPrint", "false")
1458	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1459	urls += "?" + c.urlParams_.Encode()
1460	req, err := http.NewRequest("GET", urls, body)
1461	if err != nil {
1462		return nil, err
1463	}
1464	req.Header = reqHeaders
1465	googleapi.Expand(req.URL, map[string]string{
1466		"name": c.name,
1467	})
1468	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1469}
1470
1471// Do executes the "smartdevicemanagement.enterprises.structures.rooms.get" call.
1472// Exactly one of *GoogleHomeEnterpriseSdmV1Room or error will be
1473// non-nil. Any non-2xx status code is an error. Response headers are in
1474// either *GoogleHomeEnterpriseSdmV1Room.ServerResponse.Header or (if a
1475// response was returned at all) in error.(*googleapi.Error).Header. Use
1476// googleapi.IsNotModified to check whether the returned error was
1477// because http.StatusNotModified was returned.
1478func (c *EnterprisesStructuresRoomsGetCall) Do(opts ...googleapi.CallOption) (*GoogleHomeEnterpriseSdmV1Room, error) {
1479	gensupport.SetOptions(c.urlParams_, opts...)
1480	res, err := c.doRequest("json")
1481	if res != nil && res.StatusCode == http.StatusNotModified {
1482		if res.Body != nil {
1483			res.Body.Close()
1484		}
1485		return nil, &googleapi.Error{
1486			Code:   res.StatusCode,
1487			Header: res.Header,
1488		}
1489	}
1490	if err != nil {
1491		return nil, err
1492	}
1493	defer googleapi.CloseBody(res)
1494	if err := googleapi.CheckResponse(res); err != nil {
1495		return nil, err
1496	}
1497	ret := &GoogleHomeEnterpriseSdmV1Room{
1498		ServerResponse: googleapi.ServerResponse{
1499			Header:         res.Header,
1500			HTTPStatusCode: res.StatusCode,
1501		},
1502	}
1503	target := &ret
1504	if err := gensupport.DecodeResponse(target, res); err != nil {
1505		return nil, err
1506	}
1507	return ret, nil
1508	// {
1509	//   "description": "Gets a room managed by the enterprise.",
1510	//   "flatPath": "v1/enterprises/{enterprisesId}/structures/{structuresId}/rooms/{roomsId}",
1511	//   "httpMethod": "GET",
1512	//   "id": "smartdevicemanagement.enterprises.structures.rooms.get",
1513	//   "parameterOrder": [
1514	//     "name"
1515	//   ],
1516	//   "parameters": {
1517	//     "name": {
1518	//       "description": "The name of the room requested. For example: \"enterprises/XYZ/structures/ABC/rooms/123\".",
1519	//       "location": "path",
1520	//       "pattern": "^enterprises/[^/]+/structures/[^/]+/rooms/[^/]+$",
1521	//       "required": true,
1522	//       "type": "string"
1523	//     }
1524	//   },
1525	//   "path": "v1/{+name}",
1526	//   "response": {
1527	//     "$ref": "GoogleHomeEnterpriseSdmV1Room"
1528	//   },
1529	//   "scopes": [
1530	//     "https://www.googleapis.com/auth/sdm.service",
1531	//     "https://www.googleapis.com/auth/sdm.thermostat.service"
1532	//   ]
1533	// }
1534
1535}
1536
1537// method id "smartdevicemanagement.enterprises.structures.rooms.list":
1538
1539type EnterprisesStructuresRoomsListCall struct {
1540	s            *Service
1541	parent       string
1542	urlParams_   gensupport.URLParams
1543	ifNoneMatch_ string
1544	ctx_         context.Context
1545	header_      http.Header
1546}
1547
1548// List: Lists rooms managed by the enterprise.
1549//
1550// - parent: The parent resource name of the rooms requested. For
1551//   example: "enterprises/XYZ/structures/ABC".
1552func (r *EnterprisesStructuresRoomsService) List(parent string) *EnterprisesStructuresRoomsListCall {
1553	c := &EnterprisesStructuresRoomsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1554	c.parent = parent
1555	return c
1556}
1557
1558// PageSize sets the optional parameter "pageSize": Requested page size.
1559// Server may return fewer rooms than requested. If unspecified, server
1560// will pick an appropriate default.
1561func (c *EnterprisesStructuresRoomsListCall) PageSize(pageSize int64) *EnterprisesStructuresRoomsListCall {
1562	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1563	return c
1564}
1565
1566// PageToken sets the optional parameter "pageToken": The token of the
1567// page to retrieve.
1568func (c *EnterprisesStructuresRoomsListCall) PageToken(pageToken string) *EnterprisesStructuresRoomsListCall {
1569	c.urlParams_.Set("pageToken", pageToken)
1570	return c
1571}
1572
1573// Fields allows partial responses to be retrieved. See
1574// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1575// for more information.
1576func (c *EnterprisesStructuresRoomsListCall) Fields(s ...googleapi.Field) *EnterprisesStructuresRoomsListCall {
1577	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1578	return c
1579}
1580
1581// IfNoneMatch sets the optional parameter which makes the operation
1582// fail if the object's ETag matches the given value. This is useful for
1583// getting updates only after the object has changed since the last
1584// request. Use googleapi.IsNotModified to check whether the response
1585// error from Do is the result of In-None-Match.
1586func (c *EnterprisesStructuresRoomsListCall) IfNoneMatch(entityTag string) *EnterprisesStructuresRoomsListCall {
1587	c.ifNoneMatch_ = entityTag
1588	return c
1589}
1590
1591// Context sets the context to be used in this call's Do method. Any
1592// pending HTTP request will be aborted if the provided context is
1593// canceled.
1594func (c *EnterprisesStructuresRoomsListCall) Context(ctx context.Context) *EnterprisesStructuresRoomsListCall {
1595	c.ctx_ = ctx
1596	return c
1597}
1598
1599// Header returns an http.Header that can be modified by the caller to
1600// add HTTP headers to the request.
1601func (c *EnterprisesStructuresRoomsListCall) Header() http.Header {
1602	if c.header_ == nil {
1603		c.header_ = make(http.Header)
1604	}
1605	return c.header_
1606}
1607
1608func (c *EnterprisesStructuresRoomsListCall) doRequest(alt string) (*http.Response, error) {
1609	reqHeaders := make(http.Header)
1610	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210812")
1611	for k, v := range c.header_ {
1612		reqHeaders[k] = v
1613	}
1614	reqHeaders.Set("User-Agent", c.s.userAgent())
1615	if c.ifNoneMatch_ != "" {
1616		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1617	}
1618	var body io.Reader = nil
1619	c.urlParams_.Set("alt", alt)
1620	c.urlParams_.Set("prettyPrint", "false")
1621	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/rooms")
1622	urls += "?" + c.urlParams_.Encode()
1623	req, err := http.NewRequest("GET", urls, body)
1624	if err != nil {
1625		return nil, err
1626	}
1627	req.Header = reqHeaders
1628	googleapi.Expand(req.URL, map[string]string{
1629		"parent": c.parent,
1630	})
1631	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1632}
1633
1634// Do executes the "smartdevicemanagement.enterprises.structures.rooms.list" call.
1635// Exactly one of *GoogleHomeEnterpriseSdmV1ListRoomsResponse or error
1636// will be non-nil. Any non-2xx status code is an error. Response
1637// headers are in either
1638// *GoogleHomeEnterpriseSdmV1ListRoomsResponse.ServerResponse.Header or
1639// (if a response was returned at all) in
1640// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1641// whether the returned error was because http.StatusNotModified was
1642// returned.
1643func (c *EnterprisesStructuresRoomsListCall) Do(opts ...googleapi.CallOption) (*GoogleHomeEnterpriseSdmV1ListRoomsResponse, error) {
1644	gensupport.SetOptions(c.urlParams_, opts...)
1645	res, err := c.doRequest("json")
1646	if res != nil && res.StatusCode == http.StatusNotModified {
1647		if res.Body != nil {
1648			res.Body.Close()
1649		}
1650		return nil, &googleapi.Error{
1651			Code:   res.StatusCode,
1652			Header: res.Header,
1653		}
1654	}
1655	if err != nil {
1656		return nil, err
1657	}
1658	defer googleapi.CloseBody(res)
1659	if err := googleapi.CheckResponse(res); err != nil {
1660		return nil, err
1661	}
1662	ret := &GoogleHomeEnterpriseSdmV1ListRoomsResponse{
1663		ServerResponse: googleapi.ServerResponse{
1664			Header:         res.Header,
1665			HTTPStatusCode: res.StatusCode,
1666		},
1667	}
1668	target := &ret
1669	if err := gensupport.DecodeResponse(target, res); err != nil {
1670		return nil, err
1671	}
1672	return ret, nil
1673	// {
1674	//   "description": "Lists rooms managed by the enterprise.",
1675	//   "flatPath": "v1/enterprises/{enterprisesId}/structures/{structuresId}/rooms",
1676	//   "httpMethod": "GET",
1677	//   "id": "smartdevicemanagement.enterprises.structures.rooms.list",
1678	//   "parameterOrder": [
1679	//     "parent"
1680	//   ],
1681	//   "parameters": {
1682	//     "pageSize": {
1683	//       "description": "Requested page size. Server may return fewer rooms than requested. If unspecified, server will pick an appropriate default.",
1684	//       "format": "int32",
1685	//       "location": "query",
1686	//       "type": "integer"
1687	//     },
1688	//     "pageToken": {
1689	//       "description": "The token of the page to retrieve.",
1690	//       "location": "query",
1691	//       "type": "string"
1692	//     },
1693	//     "parent": {
1694	//       "description": "The parent resource name of the rooms requested. For example: \"enterprises/XYZ/structures/ABC\".",
1695	//       "location": "path",
1696	//       "pattern": "^enterprises/[^/]+/structures/[^/]+$",
1697	//       "required": true,
1698	//       "type": "string"
1699	//     }
1700	//   },
1701	//   "path": "v1/{+parent}/rooms",
1702	//   "response": {
1703	//     "$ref": "GoogleHomeEnterpriseSdmV1ListRoomsResponse"
1704	//   },
1705	//   "scopes": [
1706	//     "https://www.googleapis.com/auth/sdm.service",
1707	//     "https://www.googleapis.com/auth/sdm.thermostat.service"
1708	//   ]
1709	// }
1710
1711}
1712
1713// Pages invokes f for each page of results.
1714// A non-nil error returned from f will halt the iteration.
1715// The provided context supersedes any context provided to the Context method.
1716func (c *EnterprisesStructuresRoomsListCall) Pages(ctx context.Context, f func(*GoogleHomeEnterpriseSdmV1ListRoomsResponse) error) error {
1717	c.ctx_ = ctx
1718	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
1719	for {
1720		x, err := c.Do()
1721		if err != nil {
1722			return err
1723		}
1724		if err := f(x); err != nil {
1725			return err
1726		}
1727		if x.NextPageToken == "" {
1728			return nil
1729		}
1730		c.PageToken(x.NextPageToken)
1731	}
1732}
1733