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