From aa00231e9c15c2e83a362636f669f0e9464f390e Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 5 Oct 2020 13:15:10 -0700 Subject: [PATCH] fix(smartdevicemanagement): update the API --- discovery/smartdevicemanagement-v1.json | 573 +++++++ src/apis/smartdevicemanagement/README.md | 47 + src/apis/smartdevicemanagement/index.ts | 39 + src/apis/smartdevicemanagement/package.json | 43 + src/apis/smartdevicemanagement/tsconfig.json | 10 + src/apis/smartdevicemanagement/v1.ts | 1482 +++++++++++++++++ .../smartdevicemanagement/webpack.config.js | 70 + 7 files changed, 2264 insertions(+) create mode 100644 discovery/smartdevicemanagement-v1.json create mode 100644 src/apis/smartdevicemanagement/README.md create mode 100644 src/apis/smartdevicemanagement/index.ts create mode 100644 src/apis/smartdevicemanagement/package.json create mode 100644 src/apis/smartdevicemanagement/tsconfig.json create mode 100644 src/apis/smartdevicemanagement/v1.ts create mode 100644 src/apis/smartdevicemanagement/webpack.config.js diff --git a/discovery/smartdevicemanagement-v1.json b/discovery/smartdevicemanagement-v1.json new file mode 100644 index 00000000000..b7d1599ccce --- /dev/null +++ b/discovery/smartdevicemanagement-v1.json @@ -0,0 +1,573 @@ +{ + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/sdm.service": { + "description": "See and/or control the devices that you selected" + } + } + } + }, + "basePath": "", + "baseUrl": "https://smartdevicemanagement.googleapis.com/", + "batchPath": "batch", + "canonicalName": "Smart Device Management", + "description": "Allow select enterprise partners to access, control, and manage Google and Nest devices programmatically.", + "discoveryVersion": "v1", + "documentationLink": "https://developers.google.com/nest/device-access", + "fullyEncodeReservedExpansion": true, + "icons": { + "x16": "http://www.google.com/images/icons/product/search-16.gif", + "x32": "http://www.google.com/images/icons/product/search-32.gif" + }, + "id": "smartdevicemanagement:v1", + "kind": "discovery#restDescription", + "mtlsRootUrl": "https://smartdevicemanagement.mtls.googleapis.com/", + "name": "smartdevicemanagement", + "ownerDomain": "google.com", + "ownerName": "Google", + "parameters": { + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "location": "query", + "type": "string" + }, + "access_token": { + "description": "OAuth access token.", + "location": "query", + "type": "string" + }, + "alt": { + "default": "json", + "description": "Data format for response.", + "enum": [ + "json", + "media", + "proto" + ], + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "location": "query", + "type": "string" + }, + "callback": { + "description": "JSONP", + "location": "query", + "type": "string" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "location": "query", + "type": "string" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "location": "query", + "type": "string" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "location": "query", + "type": "string" + }, + "prettyPrint": { + "default": "true", + "description": "Returns response with indentations and line breaks.", + "location": "query", + "type": "boolean" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "location": "query", + "type": "string" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "location": "query", + "type": "string" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "location": "query", + "type": "string" + } + }, + "protocol": "rest", + "resources": { + "enterprises": { + "resources": { + "devices": { + "methods": { + "executeCommand": { + "description": "Executes a command to device managed by the enterprise.", + "flatPath": "v1/enterprises/{enterprisesId}/devices/{devicesId}:executeCommand", + "httpMethod": "POST", + "id": "smartdevicemanagement.enterprises.devices.executeCommand", + "parameterOrder": [ + "name" + ], + "parameters": { + "name": { + "description": "The name of the device requested. For example: \"enterprises/XYZ/devices/123\"", + "location": "path", + "pattern": "^enterprises/[^/]+/devices/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v1/{+name}:executeCommand", + "request": { + "$ref": "GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest" + }, + "response": { + "$ref": "GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/sdm.service" + ] + }, + "get": { + "description": "Gets a device managed by the enterprise.", + "flatPath": "v1/enterprises/{enterprisesId}/devices/{devicesId}", + "httpMethod": "GET", + "id": "smartdevicemanagement.enterprises.devices.get", + "parameterOrder": [ + "name" + ], + "parameters": { + "name": { + "description": "The name of the device requested. For example: \"enterprises/XYZ/devices/123\"", + "location": "path", + "pattern": "^enterprises/[^/]+/devices/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v1/{+name}", + "response": { + "$ref": "GoogleHomeEnterpriseSdmV1Device" + }, + "scopes": [ + "https://www.googleapis.com/auth/sdm.service" + ] + }, + "list": { + "description": "Lists devices managed by the enterprise.", + "flatPath": "v1/enterprises/{enterprisesId}/devices", + "httpMethod": "GET", + "id": "smartdevicemanagement.enterprises.devices.list", + "parameterOrder": [ + "parent" + ], + "parameters": { + "filter": { + "description": "Optional filter to list devices. Filters can match the exact assignee (could be a structure or a room). E.g. 'assignee=enterprises/XYZ/structures/abc' Also could filter by parent (group): 'parent=enterprises/XYZ/groups/jkl' or filter by device custom name (substring match): 'customName=wing'", + "location": "query", + "type": "string" + }, + "pageSize": { + "description": "Optional requested page size. Server may return fewer devices than requested. If unspecified, server will pick an appropriate default.", + "format": "int32", + "location": "query", + "type": "integer" + }, + "pageToken": { + "description": "Optional token of the page to retrieve.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "The parent enterprise to list devices under. E.g. \"enterprises/XYZ\".", + "location": "path", + "pattern": "^enterprises/[^/]+$", + "required": true, + "type": "string" + }, + "view": { + "description": "Additional details that need to be provided for the device.", + "enum": [ + "DEVICE_DETAILS_VIEW_UNSPECIFIED", + "DEVICE_CONSOLE_VIEW" + ], + "enumDescriptions": [ + "Default option this would return basic details for both Get and Listd Devices. Currently this view is supported only for device types, SPEAKER, DISPLAY,", + "Selecting this option would return the structureId and structure name to which the device is assigned alongwith other basic details. Currently this view is supported only for device types -- sdm.devices.types.SPEAKER -- sdm.devices.types.CHROMECAST -- sdm.devices.types.DISPLAY -- sdm.devices.types.CAMERA Any other device type would only return a basic view during ListDevices invocation." + ], + "location": "query", + "type": "string" + } + }, + "path": "v1/{+parent}/devices", + "response": { + "$ref": "GoogleHomeEnterpriseSdmV1ListDevicesResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/sdm.service" + ] + } + } + }, + "structures": { + "methods": { + "get": { + "description": "Gets a structure managed by the enterprise.", + "flatPath": "v1/enterprises/{enterprisesId}/structures/{structuresId}", + "httpMethod": "GET", + "id": "smartdevicemanagement.enterprises.structures.get", + "parameterOrder": [ + "name" + ], + "parameters": { + "name": { + "description": "The name of the structure requested. For example: \"enterprises/XYZ/structures/ABC\".", + "location": "path", + "pattern": "^enterprises/[^/]+/structures/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v1/{+name}", + "response": { + "$ref": "GoogleHomeEnterpriseSdmV1Structure" + }, + "scopes": [ + "https://www.googleapis.com/auth/sdm.service" + ] + }, + "list": { + "description": "Lists structures managed by the enterprise.", + "flatPath": "v1/enterprises/{enterprisesId}/structures", + "httpMethod": "GET", + "id": "smartdevicemanagement.enterprises.structures.list", + "parameterOrder": [ + "parent" + ], + "parameters": { + "filter": { + "description": "Optional filter to list structures. Filters can match the exact album assigned to the structure. E.g. 'album=enterprises/XYZ/albums/abc' It also support filtering by parent (only groups for now): E.g. 'parent=enterprises/XYZ/groups/124'", + "location": "query", + "type": "string" + }, + "pageSize": { + "description": "Requested page size. Server may return fewer structures than requested. If unspecified, server will pick an appropriate default.", + "format": "int32", + "location": "query", + "type": "integer" + }, + "pageToken": { + "description": "The token of the page to retrieve.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "The parent enterprise to list structures under. E.g. \"enterprises/XYZ\".", + "location": "path", + "pattern": "^enterprises/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v1/{+parent}/structures", + "response": { + "$ref": "GoogleHomeEnterpriseSdmV1ListStructuresResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/sdm.service" + ] + } + }, + "resources": { + "rooms": { + "methods": { + "get": { + "description": "Gets a room managed by the enterprise.", + "flatPath": "v1/enterprises/{enterprisesId}/structures/{structuresId}/rooms/{roomsId}", + "httpMethod": "GET", + "id": "smartdevicemanagement.enterprises.structures.rooms.get", + "parameterOrder": [ + "name" + ], + "parameters": { + "name": { + "description": "The name of the room requested. For example: \"enterprises/XYZ/structures/ABC/rooms/123\".", + "location": "path", + "pattern": "^enterprises/[^/]+/structures/[^/]+/rooms/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v1/{+name}", + "response": { + "$ref": "GoogleHomeEnterpriseSdmV1Room" + }, + "scopes": [ + "https://www.googleapis.com/auth/sdm.service" + ] + }, + "list": { + "description": "Lists rooms managed by the enterprise.", + "flatPath": "v1/enterprises/{enterprisesId}/structures/{structuresId}/rooms", + "httpMethod": "GET", + "id": "smartdevicemanagement.enterprises.structures.rooms.list", + "parameterOrder": [ + "parent" + ], + "parameters": { + "pageSize": { + "description": "Requested page size. Server may return fewer rooms than requested. If unspecified, server will pick an appropriate default.", + "format": "int32", + "location": "query", + "type": "integer" + }, + "pageToken": { + "description": "The token of the page to retrieve.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "The parent resource name of the rooms requested. For example: \"enterprises/XYZ/structures/ABC\".", + "location": "path", + "pattern": "^enterprises/[^/]+/structures/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v1/{+parent}/rooms", + "response": { + "$ref": "GoogleHomeEnterpriseSdmV1ListRoomsResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/sdm.service" + ] + } + } + } + } + } + } + } + }, + "revision": "20200910", + "rootUrl": "https://smartdevicemanagement.googleapis.com/", + "schemas": { + "GoogleHomeEnterpriseSdmV1Device": { + "description": "Device resource represents an instance of enterprise managed device in the property.", + "id": "GoogleHomeEnterpriseSdmV1Device", + "properties": { + "assignee": { + "description": "Output only. The name of the structure/room where the device is assigned to. For example: \"enterprises/XYZ/structures/ABC\" or \"enterprises/XYZ/structures/ABC/rooms/123\"", + "readOnly": true, + "type": "string" + }, + "name": { + "description": "Required. The resource name of the device. For example: \"enterprises/XYZ/devices/123\".", + "type": "string" + }, + "parentRelations": { + "description": "Assignee details of the device.", + "items": { + "$ref": "GoogleHomeEnterpriseSdmV1ParentRelation" + }, + "type": "array" + }, + "traits": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "Output only. Device traits.", + "readOnly": true, + "type": "object" + }, + "type": { + "description": "Output only. Type of the device for general display purposes. For example: \"THERMOSTAT\". The device type should not be used to deduce or infer functionality of the actual device it is assigned to. Instead, use the returned traits for the device.", + "readOnly": true, + "type": "string" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest": { + "description": "Request message for SmartDeviceManagementService.ExecuteDeviceCommand", + "id": "GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest", + "properties": { + "command": { + "description": "The command name to execute, represented by the fully qualified protobuf message name.", + "type": "string" + }, + "params": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "The command message to execute, represented as a Struct.", + "type": "object" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse": { + "description": "Response message for SmartDeviceManagementService.ExecuteDeviceCommand", + "id": "GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse", + "properties": { + "results": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "The results of executing the command.", + "type": "object" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1ListDevicesResponse": { + "description": "Response message for SmartDeviceManagementService.ListDevices", + "id": "GoogleHomeEnterpriseSdmV1ListDevicesResponse", + "properties": { + "devices": { + "description": "The list of devices.", + "items": { + "$ref": "GoogleHomeEnterpriseSdmV1Device" + }, + "type": "array" + }, + "nextPageToken": { + "description": "The pagination token to retrieve the next page of results.", + "type": "string" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1ListRoomsResponse": { + "description": "Response message for SmartDeviceManagementService.ListRooms", + "id": "GoogleHomeEnterpriseSdmV1ListRoomsResponse", + "properties": { + "nextPageToken": { + "description": "The pagination token to retrieve the next page of results.", + "type": "string" + }, + "rooms": { + "description": "The list of rooms.", + "items": { + "$ref": "GoogleHomeEnterpriseSdmV1Room" + }, + "type": "array" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1ListStructuresResponse": { + "description": "Response message for SmartDeviceManagementService.ListStructures", + "id": "GoogleHomeEnterpriseSdmV1ListStructuresResponse", + "properties": { + "nextPageToken": { + "description": "The pagination token to retrieve the next page of results.", + "type": "string" + }, + "structures": { + "description": "The list of structures.", + "items": { + "$ref": "GoogleHomeEnterpriseSdmV1Structure" + }, + "type": "array" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1ParentRelation": { + "description": "Represents device relationships, for instance, structure/room to which the device is assigned to. For now this is only filled in the enterprise flow.", + "id": "GoogleHomeEnterpriseSdmV1ParentRelation", + "properties": { + "displayName": { + "description": "Output only. The custom name of the relation -- e.g., structure/room where the device is assigned to.", + "readOnly": true, + "type": "string" + }, + "parent": { + "description": "Output only. The name of the relation -- e.g., structure/room where the device is assigned to. For example: \"enterprises/XYZ/structures/ABC\" or \"enterprises/XYZ/structures/ABC/rooms/123\"", + "readOnly": true, + "type": "string" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1Room": { + "description": "Room resource represents an instance of sub-space within a structure such as rooms in a hotel suite or rental apartment.", + "id": "GoogleHomeEnterpriseSdmV1Room", + "properties": { + "name": { + "description": "Output only. The resource name of the room. For example: \"enterprises/XYZ/structures/ABC/rooms/123\".", + "type": "string" + }, + "traits": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "Room traits.", + "type": "object" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1Structure": { + "description": "Structure resource represents an instance of enterprise managed home or hotel room.", + "id": "GoogleHomeEnterpriseSdmV1Structure", + "properties": { + "name": { + "description": "Output only. The resource name of the structure. For example: \"enterprises/XYZ/structures/ABC\".", + "type": "string" + }, + "parentRelations": { + "description": "Assignee details of the structure.", + "items": { + "$ref": "GoogleHomeEnterpriseSdmV1StructureParentRelation" + }, + "type": "array" + }, + "traits": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "Structure traits.", + "type": "object" + } + }, + "type": "object" + }, + "GoogleHomeEnterpriseSdmV1StructureParentRelation": { + "description": "Represents structure assignee relationships, for instance, group to which the structure is assigned to.", + "id": "GoogleHomeEnterpriseSdmV1StructureParentRelation", + "properties": { + "displayName": { + "description": "Output only. The custom name of the relation -- e.g., group, to which the structure is assigned to.", + "readOnly": true, + "type": "string" + }, + "parent": { + "description": "Output only. The name of the relation -- e.g., group to which the structure is assigned to. For example: \"enterprises/XYZ/groups/ABC\"", + "readOnly": true, + "type": "string" + } + }, + "type": "object" + } + }, + "servicePath": "", + "title": "Smart Device Management API", + "version": "v1", + "version_module": true +} \ No newline at end of file diff --git a/src/apis/smartdevicemanagement/README.md b/src/apis/smartdevicemanagement/README.md new file mode 100644 index 00000000000..ef27041b230 --- /dev/null +++ b/src/apis/smartdevicemanagement/README.md @@ -0,0 +1,47 @@ +Google Inc. logo + +# smartdevicemanagement + +> Allow select enterprise partners to access, control, and manage Google and Nest devices programmatically. + +## Installation + +```sh +$ npm install googleapis +``` + +## Usage +All documentation and usage information can be found on [GitHub](https://github.com/googleapis/google-api-nodejs-client). + +## Building a browser bundle + +This library can be used in a browser. To prepare a single file bundle, clone the +[repository](https://github.com/googleapis/google-api-nodejs-client) and run + +```sh +$ cd src/apis/smartdevicemanagement +$ npm install +$ npm run webpack +``` + +The generated bundle will be written to `dist/smartdevicemanagement.min.js`. Use it from your HTML file: + +```html + + +``` + +## License +This library is licensed under Apache 2.0. Full license text is available in [LICENSE](https://github.com/googleapis/google-api-nodejs-client/blob/master/LICENSE). + +## Contributing +We love contributions! Before submitting a Pull Request, it's always good to start with a new issue first. To learn more, see [CONTRIBUTING](https://github.com/google/google-api-nodejs-client/blob/master/.github/CONTRIBUTING.md). + +## Questions/problems? +* Ask your development related questions on [StackOverflow](http://stackoverflow.com/questions/tagged/google-api-nodejs-client). +* If you've found an bug/issue, please [file it on GitHub](https://github.com/googleapis/google-api-nodejs-client/issues). + + +*Crafted with ❤️ by the Google Node.js team* diff --git a/src/apis/smartdevicemanagement/index.ts b/src/apis/smartdevicemanagement/index.ts new file mode 100644 index 00000000000..8333ff15b79 --- /dev/null +++ b/src/apis/smartdevicemanagement/index.ts @@ -0,0 +1,39 @@ +// Copyright 2020 Google LLC +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! THIS FILE IS AUTO-GENERATED */ + +import {AuthPlus, getAPI, GoogleConfigurable} from 'googleapis-common'; +import {smartdevicemanagement_v1} from './v1'; + +export const VERSIONS = { + v1: smartdevicemanagement_v1.Smartdevicemanagement, +}; + +export function smartdevicemanagement( + version: 'v1' +): smartdevicemanagement_v1.Smartdevicemanagement; +export function smartdevicemanagement( + options: smartdevicemanagement_v1.Options +): smartdevicemanagement_v1.Smartdevicemanagement; +export function smartdevicemanagement< + T = smartdevicemanagement_v1.Smartdevicemanagement +>( + this: GoogleConfigurable, + versionOrOptions: 'v1' | smartdevicemanagement_v1.Options +) { + return getAPI('smartdevicemanagement', versionOrOptions, VERSIONS, this); +} + +const auth = new AuthPlus(); +export {auth}; diff --git a/src/apis/smartdevicemanagement/package.json b/src/apis/smartdevicemanagement/package.json new file mode 100644 index 00000000000..f31f28392ca --- /dev/null +++ b/src/apis/smartdevicemanagement/package.json @@ -0,0 +1,43 @@ +{ + "name": "@google/smartdevicemanagement", + "version": "0.1.0", + "description": "smartdevicemanagement", + "main": "build/index.js", + "types": "build/index.d.ts", + "keywords": [ + "google" + ], + "author": "Google LLC", + "license": "Apache-2.0", + "homepage": "https://github.com/googleapis/google-api-nodejs-client", + "bugs": { + "url": "https://github.com/googleapis/google-api-nodejs-client/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/googleapis/google-api-nodejs-client.git" + }, + "engines": { + "node": ">=10.0.0" + }, + "scripts": { + "fix": "gts fix", + "lint": "gts check", + "compile": "tsc -p .", + "prepare": "npm run compile", + "docs": "typedoc --out docs/", + "webpack": "webpack" + }, + "dependencies": { + "googleapis-common": "^4.4.0" + }, + "devDependencies": { + "gts": "^2.0.0", + "null-loader": "^4.0.0", + "ts-loader": "^8.0.0", + "typedoc": "^0.19.0", + "typescript": "~3.7.0", + "webpack": "^4.35.3", + "webpack-cli": "^3.3.5" + } +} diff --git a/src/apis/smartdevicemanagement/tsconfig.json b/src/apis/smartdevicemanagement/tsconfig.json new file mode 100644 index 00000000000..e0810904968 --- /dev/null +++ b/src/apis/smartdevicemanagement/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build" + }, + "include": [ + "*.ts", + ] +} diff --git a/src/apis/smartdevicemanagement/v1.ts b/src/apis/smartdevicemanagement/v1.ts new file mode 100644 index 00000000000..c8301c4cc9b --- /dev/null +++ b/src/apis/smartdevicemanagement/v1.ts @@ -0,0 +1,1482 @@ +// Copyright 2020 Google LLC +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/class-name-casing */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/no-empty-interface */ +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable no-irregular-whitespace */ + +import { + OAuth2Client, + JWT, + Compute, + UserRefreshClient, + GaxiosPromise, + GoogleConfigurable, + createAPIRequest, + MethodOptions, + StreamMethodOptions, + GlobalOptions, + GoogleAuth, + BodyResponseCallback, + APIRequestContext, +} from 'googleapis-common'; +import {Readable} from 'stream'; + +export namespace smartdevicemanagement_v1 { + export interface Options extends GlobalOptions { + version: 'v1'; + } + + interface StandardParameters { + /** + * Auth client or API Key for the request + */ + auth?: + | string + | OAuth2Client + | JWT + | Compute + | UserRefreshClient + | GoogleAuth; + + /** + * V1 error format. + */ + '$.xgafv'?: string; + /** + * OAuth access token. + */ + access_token?: string; + /** + * Data format for response. + */ + alt?: string; + /** + * JSONP + */ + callback?: string; + /** + * Selector specifying which fields to include in a partial response. + */ + fields?: string; + /** + * API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + */ + key?: string; + /** + * OAuth 2.0 token for the current user. + */ + oauth_token?: string; + /** + * Returns response with indentations and line breaks. + */ + prettyPrint?: boolean; + /** + * Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + */ + quotaUser?: string; + /** + * Legacy upload protocol for media (e.g. "media", "multipart"). + */ + uploadType?: string; + /** + * Upload protocol for media (e.g. "raw", "multipart"). + */ + upload_protocol?: string; + } + + /** + * Smart Device Management API + * + * Allow select enterprise partners to access, control, and manage Google and Nest devices programmatically. + * + * @example + * const {google} = require('googleapis'); + * const smartdevicemanagement = google.smartdevicemanagement('v1'); + * + * @namespace smartdevicemanagement + * @type {Function} + * @version v1 + * @variation v1 + * @param {object=} options Options for Smartdevicemanagement + */ + export class Smartdevicemanagement { + context: APIRequestContext; + enterprises: Resource$Enterprises; + + constructor(options: GlobalOptions, google?: GoogleConfigurable) { + this.context = { + _options: options || {}, + google, + }; + + this.enterprises = new Resource$Enterprises(this.context); + } + } + + /** + * Device resource represents an instance of enterprise managed device in the property. + */ + export interface Schema$GoogleHomeEnterpriseSdmV1Device { + /** + * Output only. The name of the structure/room where the device is assigned to. For example: "enterprises/XYZ/structures/ABC" or "enterprises/XYZ/structures/ABC/rooms/123" + */ + assignee?: string | null; + /** + * Required. The resource name of the device. For example: "enterprises/XYZ/devices/123". + */ + name?: string | null; + /** + * Assignee details of the device. + */ + parentRelations?: Schema$GoogleHomeEnterpriseSdmV1ParentRelation[]; + /** + * Output only. Device traits. + */ + traits?: {[key: string]: any} | null; + /** + * Output only. Type of the device for general display purposes. For example: "THERMOSTAT". The device type should not be used to deduce or infer functionality of the actual device it is assigned to. Instead, use the returned traits for the device. + */ + type?: string | null; + } + /** + * Request message for SmartDeviceManagementService.ExecuteDeviceCommand + */ + export interface Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest { + /** + * The command name to execute, represented by the fully qualified protobuf message name. + */ + command?: string | null; + /** + * The command message to execute, represented as a Struct. + */ + params?: {[key: string]: any} | null; + } + /** + * Response message for SmartDeviceManagementService.ExecuteDeviceCommand + */ + export interface Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse { + /** + * The results of executing the command. + */ + results?: {[key: string]: any} | null; + } + /** + * Response message for SmartDeviceManagementService.ListDevices + */ + export interface Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse { + /** + * The list of devices. + */ + devices?: Schema$GoogleHomeEnterpriseSdmV1Device[]; + /** + * The pagination token to retrieve the next page of results. + */ + nextPageToken?: string | null; + } + /** + * Response message for SmartDeviceManagementService.ListRooms + */ + export interface Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse { + /** + * The pagination token to retrieve the next page of results. + */ + nextPageToken?: string | null; + /** + * The list of rooms. + */ + rooms?: Schema$GoogleHomeEnterpriseSdmV1Room[]; + } + /** + * Response message for SmartDeviceManagementService.ListStructures + */ + export interface Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse { + /** + * The pagination token to retrieve the next page of results. + */ + nextPageToken?: string | null; + /** + * The list of structures. + */ + structures?: Schema$GoogleHomeEnterpriseSdmV1Structure[]; + } + /** + * Represents device relationships, for instance, structure/room to which the device is assigned to. For now this is only filled in the enterprise flow. + */ + export interface Schema$GoogleHomeEnterpriseSdmV1ParentRelation { + /** + * Output only. The custom name of the relation -- e.g., structure/room where the device is assigned to. + */ + displayName?: string | null; + /** + * Output only. The name of the relation -- e.g., structure/room where the device is assigned to. For example: "enterprises/XYZ/structures/ABC" or "enterprises/XYZ/structures/ABC/rooms/123" + */ + parent?: string | null; + } + /** + * Room resource represents an instance of sub-space within a structure such as rooms in a hotel suite or rental apartment. + */ + export interface Schema$GoogleHomeEnterpriseSdmV1Room { + /** + * Output only. The resource name of the room. For example: "enterprises/XYZ/structures/ABC/rooms/123". + */ + name?: string | null; + /** + * Room traits. + */ + traits?: {[key: string]: any} | null; + } + /** + * Structure resource represents an instance of enterprise managed home or hotel room. + */ + export interface Schema$GoogleHomeEnterpriseSdmV1Structure { + /** + * Output only. The resource name of the structure. For example: "enterprises/XYZ/structures/ABC". + */ + name?: string | null; + /** + * Assignee details of the structure. + */ + parentRelations?: Schema$GoogleHomeEnterpriseSdmV1StructureParentRelation[]; + /** + * Structure traits. + */ + traits?: {[key: string]: any} | null; + } + /** + * Represents structure assignee relationships, for instance, group to which the structure is assigned to. + */ + export interface Schema$GoogleHomeEnterpriseSdmV1StructureParentRelation { + /** + * Output only. The custom name of the relation -- e.g., group, to which the structure is assigned to. + */ + displayName?: string | null; + /** + * Output only. The name of the relation -- e.g., group to which the structure is assigned to. For example: "enterprises/XYZ/groups/ABC" + */ + parent?: string | null; + } + + export class Resource$Enterprises { + context: APIRequestContext; + devices: Resource$Enterprises$Devices; + structures: Resource$Enterprises$Structures; + constructor(context: APIRequestContext) { + this.context = context; + this.devices = new Resource$Enterprises$Devices(this.context); + this.structures = new Resource$Enterprises$Structures(this.context); + } + } + + export class Resource$Enterprises$Devices { + context: APIRequestContext; + constructor(context: APIRequestContext) { + this.context = context; + } + + /** + * smartdevicemanagement.enterprises.devices.executeCommand + * @desc Executes a command to device managed by the enterprise. + * @example + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/smartdevicemanagement.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const smartdevicemanagement = google.smartdevicemanagement('v1'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: ['https://www.googleapis.com/auth/sdm.service'], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = await smartdevicemanagement.enterprises.devices.executeCommand({ + * // The name of the device requested. For example: "enterprises/XYZ/devices/123" + * name: 'enterprises/my-enterprise/devices/my-device', + * + * // Request body metadata + * requestBody: { + * // request body parameters + * // { + * // "command": "my_command", + * // "params": {} + * // } + * }, + * }); + * console.log(res.data); + * + * // Example response + * // { + * // "results": {} + * // } + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * @alias smartdevicemanagement.enterprises.devices.executeCommand + * @memberOf! () + * + * @param {object} params Parameters for request + * @param {string} params.name The name of the device requested. For example: "enterprises/XYZ/devices/123" + * @param {().GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest} params.requestBody Request body data + * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. + * @param {callback} callback The callback that handles the response. + * @return {object} Request object + */ + executeCommand( + params: Params$Resource$Enterprises$Devices$Executecommand, + options: StreamMethodOptions + ): GaxiosPromise; + executeCommand( + params?: Params$Resource$Enterprises$Devices$Executecommand, + options?: MethodOptions + ): GaxiosPromise< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + >; + executeCommand( + params: Params$Resource$Enterprises$Devices$Executecommand, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + executeCommand( + params: Params$Resource$Enterprises$Devices$Executecommand, + options: + | MethodOptions + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + >, + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + > + ): void; + executeCommand( + params: Params$Resource$Enterprises$Devices$Executecommand, + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + > + ): void; + executeCommand( + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + > + ): void; + executeCommand( + paramsOrCallback?: + | Params$Resource$Enterprises$Devices$Executecommand + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + > + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + > + | BodyResponseCallback, + callback?: + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + > + | BodyResponseCallback + ): + | void + | GaxiosPromise< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + > + | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Enterprises$Devices$Executecommand; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Enterprises$Devices$Executecommand; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = + options.rootUrl || 'https://smartdevicemanagement.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v1/{+name}:executeCommand').replace( + /([^:]\/)\/+/g, + '$1' + ), + method: 'POST', + }, + options + ), + params, + requiredParams: ['name'], + pathParams: ['name'], + context: this.context, + }; + if (callback) { + createAPIRequest< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + >(parameters, callback as BodyResponseCallback<{} | void>); + } else { + return createAPIRequest< + Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandResponse + >(parameters); + } + } + + /** + * smartdevicemanagement.enterprises.devices.get + * @desc Gets a device managed by the enterprise. + * @example + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/smartdevicemanagement.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const smartdevicemanagement = google.smartdevicemanagement('v1'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: ['https://www.googleapis.com/auth/sdm.service'], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = await smartdevicemanagement.enterprises.devices.get({ + * // The name of the device requested. For example: "enterprises/XYZ/devices/123" + * name: 'enterprises/my-enterprise/devices/my-device', + * }); + * console.log(res.data); + * + * // Example response + * // { + * // "assignee": "my_assignee", + * // "name": "my_name", + * // "parentRelations": [], + * // "traits": {}, + * // "type": "my_type" + * // } + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * @alias smartdevicemanagement.enterprises.devices.get + * @memberOf! () + * + * @param {object} params Parameters for request + * @param {string} params.name The name of the device requested. For example: "enterprises/XYZ/devices/123" + * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. + * @param {callback} callback The callback that handles the response. + * @return {object} Request object + */ + get( + params: Params$Resource$Enterprises$Devices$Get, + options: StreamMethodOptions + ): GaxiosPromise; + get( + params?: Params$Resource$Enterprises$Devices$Get, + options?: MethodOptions + ): GaxiosPromise; + get( + params: Params$Resource$Enterprises$Devices$Get, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + get( + params: Params$Resource$Enterprises$Devices$Get, + options: + | MethodOptions + | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + get( + params: Params$Resource$Enterprises$Devices$Get, + callback: BodyResponseCallback + ): void; + get( + callback: BodyResponseCallback + ): void; + get( + paramsOrCallback?: + | Params$Resource$Enterprises$Devices$Get + | BodyResponseCallback + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback + | BodyResponseCallback, + callback?: + | BodyResponseCallback + | BodyResponseCallback + ): + | void + | GaxiosPromise + | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Enterprises$Devices$Get; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Enterprises$Devices$Get; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = + options.rootUrl || 'https://smartdevicemanagement.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v1/{+name}').replace(/([^:]\/)\/+/g, '$1'), + method: 'GET', + }, + options + ), + params, + requiredParams: ['name'], + pathParams: ['name'], + context: this.context, + }; + if (callback) { + createAPIRequest( + parameters, + callback as BodyResponseCallback<{} | void> + ); + } else { + return createAPIRequest( + parameters + ); + } + } + + /** + * smartdevicemanagement.enterprises.devices.list + * @desc Lists devices managed by the enterprise. + * @example + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/smartdevicemanagement.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const smartdevicemanagement = google.smartdevicemanagement('v1'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: ['https://www.googleapis.com/auth/sdm.service'], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = await smartdevicemanagement.enterprises.devices.list({ + * // Optional filter to list devices. Filters can match the exact assignee (could be a structure or a room). E.g. 'assignee=enterprises/XYZ/structures/abc' Also could filter by parent (group): 'parent=enterprises/XYZ/groups/jkl' or filter by device custom name (substring match): 'customName=wing' + * filter: 'placeholder-value', + * // Optional requested page size. Server may return fewer devices than requested. If unspecified, server will pick an appropriate default. + * pageSize: 'placeholder-value', + * // Optional token of the page to retrieve. + * pageToken: 'placeholder-value', + * // The parent enterprise to list devices under. E.g. "enterprises/XYZ". + * parent: 'enterprises/my-enterprise', + * // Additional details that need to be provided for the device. + * view: 'placeholder-value', + * }); + * console.log(res.data); + * + * // Example response + * // { + * // "devices": [], + * // "nextPageToken": "my_nextPageToken" + * // } + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * @alias smartdevicemanagement.enterprises.devices.list + * @memberOf! () + * + * @param {object} params Parameters for request + * @param {string=} params.filter Optional filter to list devices. Filters can match the exact assignee (could be a structure or a room). E.g. 'assignee=enterprises/XYZ/structures/abc' Also could filter by parent (group): 'parent=enterprises/XYZ/groups/jkl' or filter by device custom name (substring match): 'customName=wing' + * @param {integer=} params.pageSize Optional requested page size. Server may return fewer devices than requested. If unspecified, server will pick an appropriate default. + * @param {string=} params.pageToken Optional token of the page to retrieve. + * @param {string} params.parent The parent enterprise to list devices under. E.g. "enterprises/XYZ". + * @param {string=} params.view Additional details that need to be provided for the device. + * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. + * @param {callback} callback The callback that handles the response. + * @return {object} Request object + */ + list( + params: Params$Resource$Enterprises$Devices$List, + options: StreamMethodOptions + ): GaxiosPromise; + list( + params?: Params$Resource$Enterprises$Devices$List, + options?: MethodOptions + ): GaxiosPromise; + list( + params: Params$Resource$Enterprises$Devices$List, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + list( + params: Params$Resource$Enterprises$Devices$List, + options: + | MethodOptions + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse + >, + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse + > + ): void; + list( + params: Params$Resource$Enterprises$Devices$List, + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse + > + ): void; + list( + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse + > + ): void; + list( + paramsOrCallback?: + | Params$Resource$Enterprises$Devices$List + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse + > + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse + > + | BodyResponseCallback, + callback?: + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse + > + | BodyResponseCallback + ): + | void + | GaxiosPromise + | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Enterprises$Devices$List; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Enterprises$Devices$List; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = + options.rootUrl || 'https://smartdevicemanagement.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v1/{+parent}/devices').replace( + /([^:]\/)\/+/g, + '$1' + ), + method: 'GET', + }, + options + ), + params, + requiredParams: ['parent'], + pathParams: ['parent'], + context: this.context, + }; + if (callback) { + createAPIRequest( + parameters, + callback as BodyResponseCallback<{} | void> + ); + } else { + return createAPIRequest< + Schema$GoogleHomeEnterpriseSdmV1ListDevicesResponse + >(parameters); + } + } + } + + export interface Params$Resource$Enterprises$Devices$Executecommand + extends StandardParameters { + /** + * The name of the device requested. For example: "enterprises/XYZ/devices/123" + */ + name?: string; + + /** + * Request body metadata + */ + requestBody?: Schema$GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest; + } + export interface Params$Resource$Enterprises$Devices$Get + extends StandardParameters { + /** + * The name of the device requested. For example: "enterprises/XYZ/devices/123" + */ + name?: string; + } + export interface Params$Resource$Enterprises$Devices$List + extends StandardParameters { + /** + * Optional filter to list devices. Filters can match the exact assignee (could be a structure or a room). E.g. 'assignee=enterprises/XYZ/structures/abc' Also could filter by parent (group): 'parent=enterprises/XYZ/groups/jkl' or filter by device custom name (substring match): 'customName=wing' + */ + filter?: string; + /** + * Optional requested page size. Server may return fewer devices than requested. If unspecified, server will pick an appropriate default. + */ + pageSize?: number; + /** + * Optional token of the page to retrieve. + */ + pageToken?: string; + /** + * The parent enterprise to list devices under. E.g. "enterprises/XYZ". + */ + parent?: string; + /** + * Additional details that need to be provided for the device. + */ + view?: string; + } + + export class Resource$Enterprises$Structures { + context: APIRequestContext; + rooms: Resource$Enterprises$Structures$Rooms; + constructor(context: APIRequestContext) { + this.context = context; + this.rooms = new Resource$Enterprises$Structures$Rooms(this.context); + } + + /** + * smartdevicemanagement.enterprises.structures.get + * @desc Gets a structure managed by the enterprise. + * @example + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/smartdevicemanagement.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const smartdevicemanagement = google.smartdevicemanagement('v1'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: ['https://www.googleapis.com/auth/sdm.service'], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = await smartdevicemanagement.enterprises.structures.get({ + * // The name of the structure requested. For example: "enterprises/XYZ/structures/ABC". + * name: 'enterprises/my-enterprise/structures/my-structure', + * }); + * console.log(res.data); + * + * // Example response + * // { + * // "name": "my_name", + * // "parentRelations": [], + * // "traits": {} + * // } + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * @alias smartdevicemanagement.enterprises.structures.get + * @memberOf! () + * + * @param {object} params Parameters for request + * @param {string} params.name The name of the structure requested. For example: "enterprises/XYZ/structures/ABC". + * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. + * @param {callback} callback The callback that handles the response. + * @return {object} Request object + */ + get( + params: Params$Resource$Enterprises$Structures$Get, + options: StreamMethodOptions + ): GaxiosPromise; + get( + params?: Params$Resource$Enterprises$Structures$Get, + options?: MethodOptions + ): GaxiosPromise; + get( + params: Params$Resource$Enterprises$Structures$Get, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + get( + params: Params$Resource$Enterprises$Structures$Get, + options: + | MethodOptions + | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + get( + params: Params$Resource$Enterprises$Structures$Get, + callback: BodyResponseCallback + ): void; + get( + callback: BodyResponseCallback + ): void; + get( + paramsOrCallback?: + | Params$Resource$Enterprises$Structures$Get + | BodyResponseCallback + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback + | BodyResponseCallback, + callback?: + | BodyResponseCallback + | BodyResponseCallback + ): + | void + | GaxiosPromise + | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Enterprises$Structures$Get; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Enterprises$Structures$Get; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = + options.rootUrl || 'https://smartdevicemanagement.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v1/{+name}').replace(/([^:]\/)\/+/g, '$1'), + method: 'GET', + }, + options + ), + params, + requiredParams: ['name'], + pathParams: ['name'], + context: this.context, + }; + if (callback) { + createAPIRequest( + parameters, + callback as BodyResponseCallback<{} | void> + ); + } else { + return createAPIRequest( + parameters + ); + } + } + + /** + * smartdevicemanagement.enterprises.structures.list + * @desc Lists structures managed by the enterprise. + * @example + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/smartdevicemanagement.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const smartdevicemanagement = google.smartdevicemanagement('v1'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: ['https://www.googleapis.com/auth/sdm.service'], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = await smartdevicemanagement.enterprises.structures.list({ + * // Optional filter to list structures. Filters can match the exact album assigned to the structure. E.g. 'album=enterprises/XYZ/albums/abc' It also support filtering by parent (only groups for now): E.g. 'parent=enterprises/XYZ/groups/124' + * filter: 'placeholder-value', + * // Requested page size. Server may return fewer structures than requested. If unspecified, server will pick an appropriate default. + * pageSize: 'placeholder-value', + * // The token of the page to retrieve. + * pageToken: 'placeholder-value', + * // The parent enterprise to list structures under. E.g. "enterprises/XYZ". + * parent: 'enterprises/my-enterprise', + * }); + * console.log(res.data); + * + * // Example response + * // { + * // "nextPageToken": "my_nextPageToken", + * // "structures": [] + * // } + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * @alias smartdevicemanagement.enterprises.structures.list + * @memberOf! () + * + * @param {object} params Parameters for request + * @param {string=} params.filter Optional filter to list structures. Filters can match the exact album assigned to the structure. E.g. 'album=enterprises/XYZ/albums/abc' It also support filtering by parent (only groups for now): E.g. 'parent=enterprises/XYZ/groups/124' + * @param {integer=} params.pageSize Requested page size. Server may return fewer structures than requested. If unspecified, server will pick an appropriate default. + * @param {string=} params.pageToken The token of the page to retrieve. + * @param {string} params.parent The parent enterprise to list structures under. E.g. "enterprises/XYZ". + * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. + * @param {callback} callback The callback that handles the response. + * @return {object} Request object + */ + list( + params: Params$Resource$Enterprises$Structures$List, + options: StreamMethodOptions + ): GaxiosPromise; + list( + params?: Params$Resource$Enterprises$Structures$List, + options?: MethodOptions + ): GaxiosPromise; + list( + params: Params$Resource$Enterprises$Structures$List, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + list( + params: Params$Resource$Enterprises$Structures$List, + options: + | MethodOptions + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + >, + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + > + ): void; + list( + params: Params$Resource$Enterprises$Structures$List, + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + > + ): void; + list( + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + > + ): void; + list( + paramsOrCallback?: + | Params$Resource$Enterprises$Structures$List + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + > + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + > + | BodyResponseCallback, + callback?: + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + > + | BodyResponseCallback + ): + | void + | GaxiosPromise + | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Enterprises$Structures$List; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Enterprises$Structures$List; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = + options.rootUrl || 'https://smartdevicemanagement.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v1/{+parent}/structures').replace( + /([^:]\/)\/+/g, + '$1' + ), + method: 'GET', + }, + options + ), + params, + requiredParams: ['parent'], + pathParams: ['parent'], + context: this.context, + }; + if (callback) { + createAPIRequest< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + >(parameters, callback as BodyResponseCallback<{} | void>); + } else { + return createAPIRequest< + Schema$GoogleHomeEnterpriseSdmV1ListStructuresResponse + >(parameters); + } + } + } + + export interface Params$Resource$Enterprises$Structures$Get + extends StandardParameters { + /** + * The name of the structure requested. For example: "enterprises/XYZ/structures/ABC". + */ + name?: string; + } + export interface Params$Resource$Enterprises$Structures$List + extends StandardParameters { + /** + * Optional filter to list structures. Filters can match the exact album assigned to the structure. E.g. 'album=enterprises/XYZ/albums/abc' It also support filtering by parent (only groups for now): E.g. 'parent=enterprises/XYZ/groups/124' + */ + filter?: string; + /** + * Requested page size. Server may return fewer structures than requested. If unspecified, server will pick an appropriate default. + */ + pageSize?: number; + /** + * The token of the page to retrieve. + */ + pageToken?: string; + /** + * The parent enterprise to list structures under. E.g. "enterprises/XYZ". + */ + parent?: string; + } + + export class Resource$Enterprises$Structures$Rooms { + context: APIRequestContext; + constructor(context: APIRequestContext) { + this.context = context; + } + + /** + * smartdevicemanagement.enterprises.structures.rooms.get + * @desc Gets a room managed by the enterprise. + * @example + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/smartdevicemanagement.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const smartdevicemanagement = google.smartdevicemanagement('v1'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: ['https://www.googleapis.com/auth/sdm.service'], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = await smartdevicemanagement.enterprises.structures.rooms.get({ + * // The name of the room requested. For example: "enterprises/XYZ/structures/ABC/rooms/123". + * name: 'enterprises/my-enterprise/structures/my-structure/rooms/my-room', + * }); + * console.log(res.data); + * + * // Example response + * // { + * // "name": "my_name", + * // "traits": {} + * // } + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * @alias smartdevicemanagement.enterprises.structures.rooms.get + * @memberOf! () + * + * @param {object} params Parameters for request + * @param {string} params.name The name of the room requested. For example: "enterprises/XYZ/structures/ABC/rooms/123". + * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. + * @param {callback} callback The callback that handles the response. + * @return {object} Request object + */ + get( + params: Params$Resource$Enterprises$Structures$Rooms$Get, + options: StreamMethodOptions + ): GaxiosPromise; + get( + params?: Params$Resource$Enterprises$Structures$Rooms$Get, + options?: MethodOptions + ): GaxiosPromise; + get( + params: Params$Resource$Enterprises$Structures$Rooms$Get, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + get( + params: Params$Resource$Enterprises$Structures$Rooms$Get, + options: + | MethodOptions + | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + get( + params: Params$Resource$Enterprises$Structures$Rooms$Get, + callback: BodyResponseCallback + ): void; + get( + callback: BodyResponseCallback + ): void; + get( + paramsOrCallback?: + | Params$Resource$Enterprises$Structures$Rooms$Get + | BodyResponseCallback + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback + | BodyResponseCallback, + callback?: + | BodyResponseCallback + | BodyResponseCallback + ): + | void + | GaxiosPromise + | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Enterprises$Structures$Rooms$Get; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Enterprises$Structures$Rooms$Get; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = + options.rootUrl || 'https://smartdevicemanagement.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v1/{+name}').replace(/([^:]\/)\/+/g, '$1'), + method: 'GET', + }, + options + ), + params, + requiredParams: ['name'], + pathParams: ['name'], + context: this.context, + }; + if (callback) { + createAPIRequest( + parameters, + callback as BodyResponseCallback<{} | void> + ); + } else { + return createAPIRequest( + parameters + ); + } + } + + /** + * smartdevicemanagement.enterprises.structures.rooms.list + * @desc Lists rooms managed by the enterprise. + * @example + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/smartdevicemanagement.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const smartdevicemanagement = google.smartdevicemanagement('v1'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: ['https://www.googleapis.com/auth/sdm.service'], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = await smartdevicemanagement.enterprises.structures.rooms.list({ + * // Requested page size. Server may return fewer rooms than requested. If unspecified, server will pick an appropriate default. + * pageSize: 'placeholder-value', + * // The token of the page to retrieve. + * pageToken: 'placeholder-value', + * // The parent resource name of the rooms requested. For example: "enterprises/XYZ/structures/ABC". + * parent: 'enterprises/my-enterprise/structures/my-structure', + * }); + * console.log(res.data); + * + * // Example response + * // { + * // "nextPageToken": "my_nextPageToken", + * // "rooms": [] + * // } + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * @alias smartdevicemanagement.enterprises.structures.rooms.list + * @memberOf! () + * + * @param {object} params Parameters for request + * @param {integer=} params.pageSize Requested page size. Server may return fewer rooms than requested. If unspecified, server will pick an appropriate default. + * @param {string=} params.pageToken The token of the page to retrieve. + * @param {string} params.parent The parent resource name of the rooms requested. For example: "enterprises/XYZ/structures/ABC". + * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. + * @param {callback} callback The callback that handles the response. + * @return {object} Request object + */ + list( + params: Params$Resource$Enterprises$Structures$Rooms$List, + options: StreamMethodOptions + ): GaxiosPromise; + list( + params?: Params$Resource$Enterprises$Structures$Rooms$List, + options?: MethodOptions + ): GaxiosPromise; + list( + params: Params$Resource$Enterprises$Structures$Rooms$List, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + list( + params: Params$Resource$Enterprises$Structures$Rooms$List, + options: + | MethodOptions + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse + >, + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse + > + ): void; + list( + params: Params$Resource$Enterprises$Structures$Rooms$List, + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse + > + ): void; + list( + callback: BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse + > + ): void; + list( + paramsOrCallback?: + | Params$Resource$Enterprises$Structures$Rooms$List + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse + > + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse + > + | BodyResponseCallback, + callback?: + | BodyResponseCallback< + Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse + > + | BodyResponseCallback + ): + | void + | GaxiosPromise + | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Enterprises$Structures$Rooms$List; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Enterprises$Structures$Rooms$List; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = + options.rootUrl || 'https://smartdevicemanagement.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v1/{+parent}/rooms').replace( + /([^:]\/)\/+/g, + '$1' + ), + method: 'GET', + }, + options + ), + params, + requiredParams: ['parent'], + pathParams: ['parent'], + context: this.context, + }; + if (callback) { + createAPIRequest( + parameters, + callback as BodyResponseCallback<{} | void> + ); + } else { + return createAPIRequest< + Schema$GoogleHomeEnterpriseSdmV1ListRoomsResponse + >(parameters); + } + } + } + + export interface Params$Resource$Enterprises$Structures$Rooms$Get + extends StandardParameters { + /** + * The name of the room requested. For example: "enterprises/XYZ/structures/ABC/rooms/123". + */ + name?: string; + } + export interface Params$Resource$Enterprises$Structures$Rooms$List + extends StandardParameters { + /** + * Requested page size. Server may return fewer rooms than requested. If unspecified, server will pick an appropriate default. + */ + pageSize?: number; + /** + * The token of the page to retrieve. + */ + pageToken?: string; + /** + * The parent resource name of the rooms requested. For example: "enterprises/XYZ/structures/ABC". + */ + parent?: string; + } +} diff --git a/src/apis/smartdevicemanagement/webpack.config.js b/src/apis/smartdevicemanagement/webpack.config.js new file mode 100644 index 00000000000..f11ecd0957b --- /dev/null +++ b/src/apis/smartdevicemanagement/webpack.config.js @@ -0,0 +1,70 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Use `npm run webpack` to produce Webpack bundle for this library. + +const path = require('path'); + +module.exports = { + entry: './index.ts', + resolve: { + extensions: ['.ts', '.js', '.json'], + }, + output: { + library: 'Smartdevicemanagement', + filename: 'smartdevicemanagement.min.js', + path: path.resolve(__dirname, 'dist'), + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + http2: 'empty', + }, + module: { + rules: [ + { + test: /node_modules[\\/]google-auth-library[\\/]src[\\/]crypto[\\/]node[\\/]crypto/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]https-proxy-agent[\\/]/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]gcp-metadata[\\/]/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]gtoken[\\/]/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]pkginfo[\\/]/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]semver[\\/]/, + use: 'null-loader', + }, + { + test: /\.ts$/, + use: 'ts-loader', + exclude: /node_modules/, + }, + ], + }, + mode: 'production', + plugins: [], +};