From bb5b7096fddd5fa74921c69e0b536442090a8582 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 3 Jan 2022 20:01:26 +0000 Subject: [PATCH] CodeGen from PR 16846 in Azure/azure-rest-api-specs Merge 488eedfb494cf3a00b9643caae45658c093dffd4 into 2b083f0d1b7ecb0717741551fa543a73e86d672c --- .../cognitiveservices-face/LICENSE | 21 + .../cognitiveservices-face/README.md | 151 +- .../cognitiveservices-face/api-extractor.json | 18 + .../cognitiveservices-face/package.json | 90 +- .../cognitiveservices-face/rollup.config.js | 211 +- .../cognitiveservices-face/src/faceClient.ts | 129 +- .../src/faceClientContext.ts | 51 - .../cognitiveservices-face/src/index.ts | 11 + .../src/models/faceListOperationsMappers.ts | 22 - .../src/models/faceMappers.ts | 40 - .../src/models/index.ts | 3297 +++++------------ .../models/largeFaceListOperationsMappers.ts | 24 - .../largePersonGroupOperationsMappers.ts | 22 - .../models/largePersonGroupPersonMappers.ts | 17 - .../src/models/mappers.ts | 2029 +++++----- .../src/models/parameters.ts | 630 ++-- .../models/personGroupOperationsMappers.ts | 22 - .../src/models/personGroupPersonMappers.ts | 17 - .../src/models/snapshotOperationsMappers.ts | 19 - .../src/operations/face.ts | 729 ++-- .../src/operations/faceListOperations.ts | 568 +-- .../src/operations/index.ts | 8 +- .../src/operations/largeFaceListOperations.ts | 853 ++--- .../operations/largePersonGroupOperations.ts | 442 +-- .../src/operations/largePersonGroupPerson.ts | 764 ++-- .../src/operations/personGroupOperations.ts | 430 +-- .../src/operations/personGroupPerson.ts | 757 ++-- .../src/operations/snapshotOperations.ts | 523 +-- .../src/operationsInterfaces/face.ts | 233 ++ .../faceListOperations.ts | 182 + .../src/operationsInterfaces/index.ts | 16 + .../largeFaceListOperations.ts | 264 ++ .../largePersonGroupOperations.ts | 132 + .../largePersonGroupPerson.ts | 212 ++ .../personGroupOperations.ts | 126 + .../operationsInterfaces/personGroupPerson.ts | 228 ++ .../snapshotOperations.ts | 155 + .../cognitiveservices-face/test/sampleTest.ts | 48 + .../cognitiveservices-face/tsconfig.json | 6 +- 39 files changed, 6349 insertions(+), 7148 deletions(-) create mode 100644 sdk/cognitiveservices/cognitiveservices-face/LICENSE create mode 100644 sdk/cognitiveservices/cognitiveservices-face/api-extractor.json delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/faceClientContext.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/index.ts delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/models/faceListOperationsMappers.ts delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/models/faceMappers.ts delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/models/largeFaceListOperationsMappers.ts delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupOperationsMappers.ts delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupPersonMappers.ts delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupOperationsMappers.ts delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupPersonMappers.ts delete mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/models/snapshotOperationsMappers.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/face.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/faceListOperations.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/index.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largeFaceListOperations.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largePersonGroupOperations.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largePersonGroupPerson.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/personGroupOperations.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/personGroupPerson.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/snapshotOperations.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-face/test/sampleTest.ts diff --git a/sdk/cognitiveservices/cognitiveservices-face/LICENSE b/sdk/cognitiveservices/cognitiveservices-face/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/cognitiveservices/cognitiveservices-face/README.md b/sdk/cognitiveservices/cognitiveservices-face/README.md index db696bd9a1ee..3307667d59e8 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/README.md +++ b/sdk/cognitiveservices/cognitiveservices-face/README.md @@ -1,108 +1,97 @@ -## An isomorphic javascript sdk for - FaceClient +# Azure Face client library for JavaScript -This package contains an isomorphic SDK for FaceClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Face client. + +An API for face detection, verification, and identification. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitiveservices/cognitiveservices-face) | +[Package (NPM)](https://www.npmjs.com/package/@azure/cognitiveservices-face) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/cognitiveservices-face?view=azure-node-preview) | +[Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitiveservices/cognitiveservices-face/samples) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/cognitiveservices-face` package -### How to Install +Install the Azure Face client library for JavaScript with `npm`: ```bash npm install @azure/cognitiveservices-face ``` -### How to use +### Create and authenticate a `FaceClient` -#### nodejs - Authentication, client creation and list personGroupPerson as an example written in TypeScript. +To create a client object to access the Azure Face API, you will need the `endpoint` of your Azure Face resource and a `credential`. The Azure Face client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Face resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-azure-js +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: ```bash -npm install @azure/ms-rest-azure-js +npm install @azure/identity ``` -##### Sample code -The following sample detects the facial features on the given image. To know more, refer to the [Azure Documentation on Face APIs](https://docs.microsoft.com/azure/cognitive-services/face/overview) +You will also need to **register a new AAD application and grant access to Azure Face** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript -const { FaceClient, FaceModels } = require("@azure/cognitiveservices-face"); -const { CognitiveServicesCredentials } = require("@azure/ms-rest-azure-js"); - -async function main() { - const faceKey = process.env["faceKey"] || ""; - const faceEndPoint = process.env["faceEndPoint"] || ""; - const cognitiveServiceCredentials = new CognitiveServicesCredentials(faceKey); - const client = new FaceClient(cognitiveServiceCredentials, faceEndPoint); - const url = - "https://pbs.twimg.com/profile_images/3354326900/3a5168f2b45c07d0965098be1a4e3007.jpeg"; - const options = { - returnFaceLandmarks: true - }; - client.face - .detectWithUrl(url, options) - .then(result => { - console.log("The result is: "); - console.log(result); - }) - .catch(err => { - console.log("An error occurred:"); - console.error(err); - }); -} - -main(); +const { FaceClient } = require("@azure/cognitiveservices-face"); +const { DefaultAzureCredential } = require("@azure/identity"); +const client = new FaceClient("", new DefaultAzureCredential()); ``` -#### browser - Authentication, client creation and list personGroupPerson as an example written in JavaScript. - -##### Sample code - -- index.html -```html - - - - @azure/cognitiveservices-face sample - - - - - - + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### FaceClient + +`FaceClient` is the primary interface for developers using the Azure Face client library. Explore the methods on this client object to understand the different features of the Azure Face service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); ``` +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitiveservices/cognitiveservices-face/samples) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcognitiveservices%2Fcognitiveservices-face%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/cognitiveservices/cognitiveservices-face/api-extractor.json b/sdk/cognitiveservices/cognitiveservices-face/api-extractor.json new file mode 100644 index 000000000000..b613e087feb5 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/cognitiveservices-face.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/package.json b/sdk/cognitiveservices/cognitiveservices-face/package.json index 998d6c2bfd11..2e182b62c021 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/package.json +++ b/sdk/cognitiveservices/cognitiveservices-face/package.json @@ -1,56 +1,88 @@ { "name": "@azure/cognitiveservices-face", + "sdk-type": "client", "author": "Microsoft Corporation", - "description": "FaceClient Library with typescript type definitions for node.js and browser.", - "version": "5.0.0", + "description": "A generated SDK for FaceClient.", + "version": "1.0.0-beta.1", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/cognitiveservices-face.js", - "module": "./esm/faceClient.js", - "types": "./esm/faceClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/cognitiveservices-face.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitiveservices/cognitiveservices-face", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-face.js.map'\" -o ./dist/cognitiveservices-face.min.js ./dist/cognitiveservices-face.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, "autoPublish": true diff --git a/sdk/cognitiveservices/cognitiveservices-face/rollup.config.js b/sdk/cognitiveservices/cognitiveservices-face/rollup.config.js index 7473944f8d56..9be1955eb7f1 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/rollup.config.js +++ b/sdk/cognitiveservices/cognitiveservices-face/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler /** - * @type {rollup.RollupFileOptions} + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. */ -const config = { - input: "./esm/faceClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/cognitiveservices-face.js", - format: "umd", - name: "Azure.CognitiveservicesFace", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] }, - banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false }; -export default config; +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/faceClient.ts b/sdk/cognitiveservices/cognitiveservices-face/src/faceClient.ts index 9638aeeb2bd1..53c2498a0158 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/faceClient.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/faceClient.ts @@ -1,56 +1,99 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { FaceClientContext } from "./faceClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + FaceImpl, + PersonGroupPersonImpl, + PersonGroupOperationsImpl, + FaceListOperationsImpl, + LargePersonGroupPersonImpl, + LargePersonGroupOperationsImpl, + LargeFaceListOperationsImpl, + SnapshotOperationsImpl +} from "./operations"; +import { + Face, + PersonGroupPerson, + PersonGroupOperations, + FaceListOperations, + LargePersonGroupPerson, + LargePersonGroupOperations, + LargeFaceListOperations, + SnapshotOperations +} from "./operationsInterfaces"; +import { FaceClientOptionalParams } from "./models"; -class FaceClient extends FaceClientContext { - // Operation groups - face: operations.Face; - personGroupPerson: operations.PersonGroupPerson; - personGroup: operations.PersonGroupOperations; - faceList: operations.FaceListOperations; - largePersonGroupPerson: operations.LargePersonGroupPerson; - largePersonGroup: operations.LargePersonGroupOperations; - largeFaceList: operations.LargeFaceListOperations; - snapshot: operations.SnapshotOperations; +export class FaceClient extends coreClient.ServiceClient { + endpoint: string; /** * Initializes a new instance of the FaceClient class. - * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus.api.cognitive.microsoft.com). * @param credentials Subscription credentials which uniquely identify client subscription. - * @param [options] The parameter options + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) { - super(credentials, endpoint, options); - this.face = new operations.Face(this); - this.personGroupPerson = new operations.PersonGroupPerson(this); - this.personGroup = new operations.PersonGroupOperations(this); - this.faceList = new operations.FaceListOperations(this); - this.largePersonGroupPerson = new operations.LargePersonGroupPerson(this); - this.largePersonGroup = new operations.LargePersonGroupOperations(this); - this.largeFaceList = new operations.LargeFaceListOperations(this); - this.snapshot = new operations.SnapshotOperations(this); - } -} + constructor( + credentials: coreAuth.TokenCredential, + endpoint: string, + options?: FaceClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (endpoint === undefined) { + throw new Error("'endpoint' cannot be null"); + } -// Operation Specifications + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: FaceClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; -export { - FaceClient, - FaceClientContext, - Models as FaceModels, - Mappers as FaceMappers -}; -export * from "./operations"; + const packageDetails = `azsdk-js-cognitiveservices-face/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "{Endpoint}/face/v1.0" + }; + super(optionsWithDefaults); + // Parameter assignments + this.endpoint = endpoint; + this.face = new FaceImpl(this); + this.personGroupPerson = new PersonGroupPersonImpl(this); + this.personGroupOperations = new PersonGroupOperationsImpl(this); + this.faceListOperations = new FaceListOperationsImpl(this); + this.largePersonGroupPerson = new LargePersonGroupPersonImpl(this); + this.largePersonGroupOperations = new LargePersonGroupOperationsImpl(this); + this.largeFaceListOperations = new LargeFaceListOperationsImpl(this); + this.snapshotOperations = new SnapshotOperationsImpl(this); + } + + face: Face; + personGroupPerson: PersonGroupPerson; + personGroupOperations: PersonGroupOperations; + faceListOperations: FaceListOperations; + largePersonGroupPerson: LargePersonGroupPerson; + largePersonGroupOperations: LargePersonGroupOperations; + largeFaceListOperations: LargeFaceListOperations; + snapshotOperations: SnapshotOperations; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/faceClientContext.ts b/sdk/cognitiveservices/cognitiveservices-face/src/faceClientContext.ts deleted file mode 100644 index bb04230cc3d5..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/faceClientContext.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; - -const packageName = "@azure/cognitiveservices-face"; -const packageVersion = "5.0.0"; - -export class FaceClientContext extends msRest.ServiceClient { - endpoint: string; - credentials: msRest.ServiceClientCredentials; - - /** - * Initializes a new instance of the FaceClientContext class. - * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus.api.cognitive.microsoft.com). - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) { - if (endpoint == undefined) { - throw new Error("'endpoint' cannot be null."); - } - if (credentials == undefined) { - throw new Error("'credentials' cannot be null."); - } - - if (!options) { - options = {}; - } - - if (!options.userAgent) { - const defaultUserAgent = msRest.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.baseUri = "{Endpoint}/face/v1.0"; - this.requestContentType = "application/json; charset=utf-8"; - this.endpoint = endpoint; - this.credentials = credentials; - } -} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/index.ts b/sdk/cognitiveservices/cognitiveservices-face/src/index.ts new file mode 100644 index 000000000000..4f71fddb6e3b --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./models"; +export { FaceClient } from "./faceClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/faceListOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/faceListOperationsMappers.ts deleted file mode 100644 index 81f2d69d64da..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/faceListOperationsMappers.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - APIError, - ErrorModel, - FaceList, - ImageUrl, - LargeFaceList, - LargePersonGroup, - MetaDataContract, - NameAndUserDataContract, - NonNullableNameAndNullableUserDataContract, - PersistedFace, - Person, - PersonGroup -} from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/faceMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/faceMappers.ts deleted file mode 100644 index 2b055e4650d3..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/faceMappers.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - Accessory, - APIError, - Blur, - Coordinate, - DetectedFace, - Emotion, - ErrorModel, - Exposure, - FaceAttributes, - FaceLandmarks, - FaceRectangle, - FacialHair, - FindSimilarRequest, - GroupRequest, - GroupResult, - Hair, - HairColor, - HeadPose, - IdentifyCandidate, - IdentifyRequest, - IdentifyResult, - ImageUrl, - Makeup, - Mask, - Noise, - Occlusion, - SimilarFace, - VerifyFaceToFaceRequest, - VerifyFaceToPersonRequest, - VerifyResult -} from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/index.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/index.ts index 4383f35373d2..f698897bd670 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/index.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/index.ts @@ -1,2645 +1,1302 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +import * as coreClient from "@azure/core-client"; -import * as msRest from "@azure/ms-rest-js"; +/** Request body for find similar operation. */ +export interface FindSimilarRequest { + /** FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire at the time specified by faceIdTimeToLive after the detection call */ + faceId: string; + /** An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. */ + faceListId?: string; + /** An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. */ + largeFaceListId?: string; + /** An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire at the time specified by faceIdTimeToLive after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. */ + faceIds?: string[]; + /** The number of top similar faces returned. The valid range is [1, 1000]. */ + maxNumOfCandidatesReturned?: number; + /** Similar face searching mode. It can be "matchPerson" or "matchFace". */ + mode?: FindSimilarMatchMode; +} -/** - * Error body. - */ +/** Response body for find similar face operation. */ +export interface SimilarFace { + /** FaceId of candidate face when find by faceIds. faceId is created by Face - Detect and will expire at the time specified by faceIdTimeToLive after the detection call */ + faceId?: string; + /** PersistedFaceId of candidate face when find by faceListId. persistedFaceId in face list is persisted and will not expire. As showed in below response */ + persistedFaceId?: string; + /** Similarity confidence of the candidate face. The higher confidence, the more similar. Range between [0,1]. */ + confidence: number; +} + +/** Error information returned by the API */ +export interface APIError { + /** Error body. */ + error?: ErrorModel; +} + +/** Error body. */ export interface ErrorModel { code?: string; message?: string; } -/** - * Error information returned by the API - */ -export interface APIError { - error?: ErrorModel; +/** Request body for group request. */ +export interface GroupRequest { + /** Array of candidate faceId created by Face - Detect. The maximum is 1000 faces */ + faceIds: string[]; } -/** - * A rectangle within which a face can be found - */ +/** An array of face groups based on face similarity. */ +export interface GroupResult { + /** A partition of the original faces based on face similarity. Groups are ranked by number of faces */ + groups: string[][]; + /** Face ids array of faces that cannot find any similar faces from original faces. */ + messyGroup?: string[]; +} + +/** Request body for identify face operation. */ +export interface IdentifyRequest { + /** Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ + faceIds: string[]; + /** PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ + personGroupId?: string; + /** LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ + largePersonGroupId?: string; + /** The range of maxNumOfCandidatesReturned is between 1 and 100 (default is 1). */ + maxNumOfCandidatesReturned?: number; + /** Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). */ + confidenceThreshold?: number; +} + +/** Response body for identify face operation. */ +export interface IdentifyResult { + /** FaceId of the query face */ + faceId: string; + /** Identified person candidates for that face (ranked by confidence). Array size should be no larger than input maxNumOfCandidatesReturned. If no person is identified, will return an empty array. */ + candidates: IdentifyCandidate[]; +} + +/** All possible faces that may qualify. */ +export interface IdentifyCandidate { + /** Id of candidate */ + personId: string; + /** Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). */ + confidence: number; +} + +/** Request body for face to face verification. */ +export interface VerifyFaceToFaceRequest { + /** FaceId of the first face, comes from Face - Detect */ + faceId1: string; + /** FaceId of the second face, comes from Face - Detect */ + faceId2: string; +} + +/** Result of the verify operation. */ +export interface VerifyResult { + /** True if the two faces belong to the same person or the face belongs to the person, otherwise false. */ + isIdentical: boolean; + /** A number indicates the similarity confidence of whether two faces belong to the same person, or whether the face belongs to the person. By default, isIdentical is set to True if similarity confidence is greater than or equal to 0.5. This is useful for advanced users to override "isIdentical" and fine-tune the result on their own data. */ + confidence: number; +} + +/** A combination of user defined name and user specified data for the person, largePersonGroup/personGroup, and largeFaceList/faceList. */ +export interface NameAndUserDataContract { + /** User defined name, maximum length is 128. */ + name?: string; + /** User specified data. Length should not exceed 16KB. */ + userData?: string; +} + +/** PersonFace object. */ +export interface PersistedFace { + /** The persistedFaceId of the target face, which is persisted and will not expire. Different from faceId created by Face - Detect and will expire in at the time specified by faceIdTimeToLive after the detection call. */ + persistedFaceId: string; + /** User-provided data attached to the face. The size limit is 1KB. */ + userData?: string; +} + +/** Request to update face data. */ +export interface UpdateFaceRequest { + /** User-provided data attached to the face. The size limit is 1KB. */ + userData?: string; +} + +/** A combination of user defined name and user specified data for the person, largePersonGroup/personGroup, and largeFaceList/faceList. */ +export interface NonNullableNameAndNullableUserDataContract { + /** User defined name, maximum length is 128. */ + name: string; + /** User specified data. Length should not exceed 16KB. */ + userData?: string; +} + +/** Person group object. */ +export interface PersonGroup { + /** PersonGroupId of the target person group. */ + personGroupId: string; + /** User defined name, maximum length is 128. */ + name: string; + /** User specified data. Length should not exceed 16KB. */ + userData?: string; + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ + recognitionModel?: RecognitionModel; +} + +/** Training status object. */ +export interface TrainingStatus { + /** Training status: notstarted, running, succeeded, failed. If the training process is waiting to perform, the status is notstarted. If the training is ongoing, the status is running. Status succeed means this person group or large person group is ready for Face - Identify, or this large face list is ready for Face - Find Similar. Status failed is often caused by no person or no persisted face exist in the person group or large person group, or no persisted face exist in the large face list. */ + status: TrainingStatusType; + /** A combined UTC date and time string that describes the created time of the person group, large person group or large face list. */ + created: Date; + /** A combined UTC date and time string that describes the last modify time of the person group, large person group or large face list, could be null value when the group is not successfully trained. */ + lastAction?: Date; + /** A combined UTC date and time string that describes the last successful training time of the person group, large person group or large face list. */ + lastSuccessfulTraining?: Date; + /** Show failure message when training failed (omitted when training succeed). */ + message?: string; +} + +/** Face list object. */ +export interface FaceList { + /** FaceListId of the target face list. */ + faceListId: string; + /** User defined name, maximum length is 128. */ + name: string; + /** User specified data. Length should not exceed 16KB. */ + userData?: string; + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ + recognitionModel?: RecognitionModel; + /** Persisted faces within the face list. */ + persistedFaces?: PersistedFace[]; +} + +export interface ImageUrl { + /** Publicly reachable URL of an image */ + url: string; +} + +/** Detected Face object. */ +export interface DetectedFace { + faceId?: string; + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ + recognitionModel?: RecognitionModel; + /** A rectangle within which a face can be found */ + faceRectangle: FaceRectangle; + /** A collection of 27-point face landmarks pointing to the important positions of face components. */ + faceLandmarks?: FaceLandmarks; + /** Face Attributes */ + faceAttributes?: FaceAttributes; +} + +/** A rectangle within which a face can be found */ export interface FaceRectangle { - /** - * The width of the rectangle, in pixels. - */ + /** The width of the rectangle, in pixels. */ width: number; - /** - * The height of the rectangle, in pixels. - */ + /** The height of the rectangle, in pixels. */ height: number; - /** - * The distance from the left edge if the image to the left edge of the rectangle, in pixels. - */ + /** The distance from the left edge if the image to the left edge of the rectangle, in pixels. */ left: number; - /** - * The distance from the top edge if the image to the top edge of the rectangle, in pixels. - */ + /** The distance from the top edge if the image to the top edge of the rectangle, in pixels. */ top: number; } -/** - * Coordinates within an image - */ -export interface Coordinate { - /** - * The horizontal component, in pixels. - */ - x: number; - /** - * The vertical component, in pixels. - */ - y: number; -} - -/** - * A collection of 27-point face landmarks pointing to the important positions of face components. - */ +/** A collection of 27-point face landmarks pointing to the important positions of face components. */ export interface FaceLandmarks { + /** Coordinates within an image */ pupilLeft?: Coordinate; + /** Coordinates within an image */ pupilRight?: Coordinate; + /** Coordinates within an image */ noseTip?: Coordinate; + /** Coordinates within an image */ mouthLeft?: Coordinate; + /** Coordinates within an image */ mouthRight?: Coordinate; + /** Coordinates within an image */ eyebrowLeftOuter?: Coordinate; + /** Coordinates within an image */ eyebrowLeftInner?: Coordinate; + /** Coordinates within an image */ eyeLeftOuter?: Coordinate; + /** Coordinates within an image */ eyeLeftTop?: Coordinate; + /** Coordinates within an image */ eyeLeftBottom?: Coordinate; + /** Coordinates within an image */ eyeLeftInner?: Coordinate; + /** Coordinates within an image */ eyebrowRightInner?: Coordinate; + /** Coordinates within an image */ eyebrowRightOuter?: Coordinate; + /** Coordinates within an image */ eyeRightInner?: Coordinate; + /** Coordinates within an image */ eyeRightTop?: Coordinate; + /** Coordinates within an image */ eyeRightBottom?: Coordinate; + /** Coordinates within an image */ eyeRightOuter?: Coordinate; + /** Coordinates within an image */ noseRootLeft?: Coordinate; + /** Coordinates within an image */ noseRootRight?: Coordinate; + /** Coordinates within an image */ noseLeftAlarTop?: Coordinate; + /** Coordinates within an image */ noseRightAlarTop?: Coordinate; + /** Coordinates within an image */ noseLeftAlarOutTip?: Coordinate; + /** Coordinates within an image */ noseRightAlarOutTip?: Coordinate; + /** Coordinates within an image */ upperLipTop?: Coordinate; + /** Coordinates within an image */ upperLipBottom?: Coordinate; + /** Coordinates within an image */ underLipTop?: Coordinate; + /** Coordinates within an image */ underLipBottom?: Coordinate; } -/** - * Properties describing facial hair attributes. - */ +/** Coordinates within an image */ +export interface Coordinate { + /** The horizontal component, in pixels. */ + x: number; + /** The vertical component, in pixels. */ + y: number; +} + +/** Face Attributes */ +export interface FaceAttributes { + /** Age in years */ + age?: number; + /** Possible gender of the face. */ + gender?: Gender; + /** Smile intensity, a number between [0,1] */ + smile?: number; + /** Properties describing facial hair attributes. */ + facialHair?: FacialHair; + /** Glasses type if any of the face. */ + glasses?: GlassesType; + /** Properties indicating head pose of the face. */ + headPose?: HeadPose; + /** Properties describing facial emotion in form of confidence ranging from 0 to 1. */ + emotion?: Emotion; + /** Properties describing hair attributes. */ + hair?: Hair; + /** Properties describing the presence of makeup on a given face. */ + makeup?: Makeup; + /** Properties describing occlusions on a given face. */ + occlusion?: Occlusion; + /** Properties describing any accessories on a given face. */ + accessories?: Accessory[]; + /** Properties describing any presence of blur within the image. */ + blur?: Blur; + /** Properties describing exposure level of the image. */ + exposure?: Exposure; + /** Properties describing noise level of the image. */ + noise?: Noise; + /** Properties describing the presence of a mask on a given face. */ + mask?: Mask; + /** Properties describing the overall image quality regarding whether the image being used in the detection is of sufficient quality to attempt face recognition on. */ + qualityForRecognition?: QualityForRecognition; +} + +/** Properties describing facial hair attributes. */ export interface FacialHair { + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ moustache?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ beard?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ sideburns?: number; } -/** - * Properties indicating head pose of the face. - */ +/** Properties indicating head pose of the face. */ export interface HeadPose { roll?: number; yaw?: number; pitch?: number; } -/** - * Properties describing facial emotion in form of confidence ranging from 0 to 1. - */ +/** Properties describing facial emotion in form of confidence ranging from 0 to 1. */ export interface Emotion { + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ anger?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ contempt?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ disgust?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ fear?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ happiness?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ neutral?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ sadness?: number; + /** A number ranging from 0 to 1 indicating a level of confidence associated with a property. */ surprise?: number; } -/** - * Hair color and associated confidence - */ -export interface HairColor { - /** - * Name of the hair color. Possible values include: 'unknown', 'white', 'gray', 'blond', 'brown', - * 'red', 'black', 'other' - */ - color?: HairColorType; - /** - * Confidence level of the color - */ - confidence?: number; -} - -/** - * Properties describing hair attributes. - */ +/** Properties describing hair attributes. */ export interface Hair { - /** - * A number describing confidence level of whether the person is bald. - */ + /** A number describing confidence level of whether the person is bald. */ bald?: number; - /** - * A boolean value describing whether the hair is visible in the image. - */ + /** A boolean value describing whether the hair is visible in the image. */ invisible?: boolean; - /** - * An array of candidate colors and confidence level in the presence of each. - */ + /** An array of candidate colors and confidence level in the presence of each. */ hairColor?: HairColor[]; } -/** - * Properties describing the presence of makeup on a given face. - */ +/** Hair color and associated confidence */ +export interface HairColor { + /** Name of the hair color. */ + color?: HairColorType; + /** Confidence level of the color */ + confidence?: number; +} + +/** Properties describing the presence of makeup on a given face. */ export interface Makeup { - /** - * A boolean value describing whether eye makeup is present on a face. - */ + /** A boolean value describing whether eye makeup is present on a face. */ eyeMakeup?: boolean; - /** - * A boolean value describing whether lip makeup is present on a face. - */ + /** A boolean value describing whether lip makeup is present on a face. */ lipMakeup?: boolean; } -/** - * Properties describing occlusions on a given face. - */ +/** Properties describing occlusions on a given face. */ export interface Occlusion { - /** - * A boolean value indicating whether forehead is occluded. - */ + /** A boolean value indicating whether forehead is occluded. */ foreheadOccluded?: boolean; - /** - * A boolean value indicating whether eyes are occluded. - */ + /** A boolean value indicating whether eyes are occluded. */ eyeOccluded?: boolean; - /** - * A boolean value indicating whether the mouth is occluded. - */ + /** A boolean value indicating whether the mouth is occluded. */ mouthOccluded?: boolean; } -/** - * Accessory item and corresponding confidence level. - */ +/** Accessory item and corresponding confidence level. */ export interface Accessory { - /** - * Type of an accessory. Possible values include: 'headWear', 'glasses', 'mask' - */ + /** Type of an accessory */ type?: AccessoryType; - /** - * Confidence level of an accessory - */ + /** Confidence level of an accessory */ confidence?: number; } -/** - * Properties describing any presence of blur within the image. - */ +/** Properties describing any presence of blur within the image. */ export interface Blur { - /** - * An enum value indicating level of blurriness. Possible values include: 'Low', 'Medium', 'High' - */ + /** An enum value indicating level of blurriness. */ blurLevel?: BlurLevel; - /** - * A number indicating level of blurriness ranging from 0 to 1. - */ + /** A number indicating level of blurriness ranging from 0 to 1. */ value?: number; } -/** - * Properties describing exposure level of the image. - */ +/** Properties describing exposure level of the image. */ export interface Exposure { - /** - * An enum value indicating level of exposure. Possible values include: 'UnderExposure', - * 'GoodExposure', 'OverExposure' - */ + /** An enum value indicating level of exposure. */ exposureLevel?: ExposureLevel; - /** - * A number indicating level of exposure level ranging from 0 to 1. [0, 0.25) is under exposure. - * [0.25, 0.75) is good exposure. [0.75, 1] is over exposure. - */ + /** A number indicating level of exposure level ranging from 0 to 1. [0, 0.25) is under exposure. [0.25, 0.75) is good exposure. [0.75, 1] is over exposure. */ value?: number; } -/** - * Properties describing noise level of the image. - */ +/** Properties describing noise level of the image. */ export interface Noise { - /** - * An enum value indicating level of noise. Possible values include: 'Low', 'Medium', 'High' - */ + /** An enum value indicating level of noise. */ noiseLevel?: NoiseLevel; - /** - * A number indicating level of noise level ranging from 0 to 1. [0, 0.25) is under exposure. - * [0.25, 0.75) is good exposure. [0.75, 1] is over exposure. [0, 0.3) is low noise level. [0.3, - * 0.7) is medium noise level. [0.7, 1] is high noise level. - */ + /** A number indicating level of noise level ranging from 0 to 1. [0, 0.25) is under exposure. [0.25, 0.75) is good exposure. [0.75, 1] is over exposure. [0, 0.3) is low noise level. [0.3, 0.7) is medium noise level. [0.7, 1] is high noise level. */ value?: number; } -/** - * Properties describing the presence of a mask on a given face. - */ +/** Properties describing the presence of a mask on a given face. */ export interface Mask { - /** - * Mask type if any of the face. Possible values include: 'noMask', 'faceMask', - * 'otherMaskOrOcclusion', 'uncertain' - */ + /** Mask type if any of the face */ type?: MaskType; - /** - * A boolean value indicating whether nose and mouth are covered. - */ + /** A boolean value indicating whether nose and mouth are covered. */ noseAndMouthCovered?: boolean; } -/** - * Face Attributes - */ -export interface FaceAttributes { - /** - * Age in years - */ - age?: number; - /** - * Possible gender of the face. Possible values include: 'male', 'female' - */ - gender?: Gender; - /** - * Smile intensity, a number between [0,1] - */ - smile?: number; - /** - * Properties describing facial hair attributes. - */ - facialHair?: FacialHair; - /** - * Glasses type if any of the face. Possible values include: 'noGlasses', 'readingGlasses', - * 'sunglasses', 'swimmingGoggles' - */ - glasses?: GlassesType; - /** - * Properties indicating head pose of the face. - */ - headPose?: HeadPose; - /** - * Properties describing facial emotion in form of confidence ranging from 0 to 1. - */ - emotion?: Emotion; - /** - * Properties describing hair attributes. - */ - hair?: Hair; - /** - * Properties describing the presence of makeup on a given face. - */ - makeup?: Makeup; - /** - * Properties describing occlusions on a given face. - */ - occlusion?: Occlusion; - /** - * Properties describing any accessories on a given face. - */ - accessories?: Accessory[]; - /** - * Properties describing any presence of blur within the image. - */ - blur?: Blur; - /** - * Properties describing exposure level of the image. - */ - exposure?: Exposure; - /** - * Properties describing noise level of the image. - */ - noise?: Noise; - /** - * Properties describing the presence of a mask on a given face. - */ - mask?: Mask; - /** - * Properties describing the overall image quality regarding whether the image being used in the - * detection is of sufficient quality to attempt face recognition on. Possible values include: - * 'Low', 'Medium', 'High' - */ - qualityForRecognition?: QualityForRecognition; +/** Large person group object. */ +export interface LargePersonGroup { + /** LargePersonGroupId of the target large person groups */ + largePersonGroupId: string; + /** User defined name, maximum length is 128. */ + name: string; + /** User specified data. Length should not exceed 16KB. */ + userData?: string; + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ + recognitionModel?: RecognitionModel; } -/** - * Detected Face object. - */ -export interface DetectedFace { - faceId?: string; - /** - * Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', - * 'recognition_04'. Default value: 'recognition_01'. - */ +/** Large face list object. */ +export interface LargeFaceList { + /** LargeFaceListId of the target large face list. */ + largeFaceListId: string; + /** User defined name, maximum length is 128. */ + name: string; + /** User specified data. Length should not exceed 16KB. */ + userData?: string; + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ recognitionModel?: RecognitionModel; - faceRectangle: FaceRectangle; - faceLandmarks?: FaceLandmarks; - faceAttributes?: FaceAttributes; } -/** - * Request body for find similar operation. - */ -export interface FindSimilarRequest { - /** - * FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note - * that this faceId is not persisted and will expire at the time specified by faceIdTimeToLive - * after the detection call - */ - faceId: string; - /** - * An existing user-specified unique candidate face list, created in Face List - Create a Face - * List. Face list contains a set of persistedFaceIds which are persisted and will never expire. - * Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. - */ - faceListId?: string; - /** - * An existing user-specified unique candidate large face list, created in LargeFaceList - - * Create. Large face list contains a set of persistedFaceIds which are persisted and will never - * expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same - * time. - */ - largeFaceListId?: string; - /** - * An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will - * expire at the time specified by faceIdTimeToLive after the detection call. The number of - * faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be - * provided at the same time. - */ - faceIds?: string[]; - /** - * The number of top similar faces returned. The valid range is [1, 1000]. Default value: 20. - */ - maxNumOfCandidatesReturned?: number; - /** - * Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: - * 'matchPerson', 'matchFace'. Default value: 'matchPerson'. - */ - mode?: FindSimilarMatchMode; +/** Request body for taking snapshot operation. */ +export interface TakeSnapshotRequest { + /** User specified type for the source object to take snapshot from. Currently FaceList, PersonGroup, LargeFaceList and LargePersonGroup are supported. */ + type: SnapshotObjectType; + /** User specified source object id to take snapshot from. */ + objectId: string; + /** User specified array of target Face subscription ids for the snapshot. For each snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. */ + applyScope: string[]; + /** User specified data about the snapshot for any purpose. Length should not exceed 16KB. */ + userData?: string; } -/** - * Response body for find similar face operation. - */ -export interface SimilarFace { - /** - * FaceId of candidate face when find by faceIds. faceId is created by Face - Detect and will - * expire at the time specified by faceIdTimeToLive after the detection call - */ - faceId?: string; - /** - * PersistedFaceId of candidate face when find by faceListId. persistedFaceId in face list is - * persisted and will not expire. As showed in below response - */ - persistedFaceId?: string; - /** - * Similarity confidence of the candidate face. The higher confidence, the more similar. Range - * between [0,1]. - */ - confidence: number; +/** Snapshot object. */ +export interface Snapshot { + /** Snapshot id. */ + id: string; + /** Azure Cognitive Service Face account id of the subscriber who created the snapshot by Snapshot - Take. */ + account: string; + /** Type of the source object in the snapshot, specified by the subscriber who created the snapshot when calling Snapshot - Take. Currently FaceList, PersonGroup, LargeFaceList and LargePersonGroup are supported. */ + type: SnapshotObjectType; + /** Array of the target Face subscription ids for the snapshot, specified by the user who created the snapshot when calling Snapshot - Take. For each snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. */ + applyScope: string[]; + /** User specified data about the snapshot for any purpose. Length should not exceed 16KB. */ + userData?: string; + /** A combined UTC date and time string that describes the created time of the snapshot. E.g. 2018-12-25T11:41:02.2331413Z. */ + createdTime: Date; + /** A combined UTC date and time string that describes the last time when the snapshot was created or updated by Snapshot - Update. E.g. 2018-12-25T11:51:27.8705696Z. */ + lastUpdateTime: Date; } -/** - * Request body for group request. - */ -export interface GroupRequest { - /** - * Array of candidate faceId created by Face - Detect. The maximum is 1000 faces - */ - faceIds: string[]; +/** Request body for updating a snapshot, with a combination of user defined apply scope and user specified data. */ +export interface UpdateSnapshotRequest { + /** Array of the target Face subscription ids for the snapshot, specified by the user who created the snapshot when calling Snapshot - Take. For each snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. */ + applyScope?: string[]; + /** User specified data about the snapshot for any purpose. Length should not exceed 16KB. */ + userData?: string; } -/** - * An array of face groups based on face similarity. - */ -export interface GroupResult { - /** - * A partition of the original faces based on face similarity. Groups are ranked by number of - * faces - */ - groups: string[][]; - /** - * Face ids array of faces that cannot find any similar faces from original faces. - */ - messyGroup?: string[]; +/** Request body for applying snapshot operation. */ +export interface ApplySnapshotRequest { + /** User specified target object id to be created from the snapshot. */ + objectId: string; + /** Snapshot applying mode. Currently only CreateNew is supported, which means the apply operation will fail if target subscription already contains an object of same type and using the same objectId. Users can specify the "objectId" in request body to avoid such conflicts. */ + mode?: "CreateNew"; } -/** - * Request body for identify face operation. - */ -export interface IdentifyRequest { - /** - * Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified - * independently. The valid number of faceIds is between [1, 10]. - */ - faceIds: string[]; - /** - * PersonGroupId of the target person group, created by PersonGroup - Create. Parameter - * personGroupId and largePersonGroupId should not be provided at the same time. - */ - personGroupId?: string; - /** - * LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. - * Parameter personGroupId and largePersonGroupId should not be provided at the same time. - */ - largePersonGroupId?: string; - /** - * The range of maxNumOfCandidatesReturned is between 1 and 100 (default is 1). Default value: 1. - */ - maxNumOfCandidatesReturned?: number; - /** - * Confidence threshold of identification, used to judge whether one face belong to one person. - * The range of confidenceThreshold is [0, 1] (default specified by algorithm). - */ - confidenceThreshold?: number; -} - -/** - * All possible faces that may qualify. - */ -export interface IdentifyCandidate { - /** - * Id of candidate - */ - personId: string; - /** - * Confidence threshold of identification, used to judge whether one face belong to one person. - * The range of confidenceThreshold is [0, 1] (default specified by algorithm). - */ - confidence: number; -} - -/** - * Response body for identify face operation. - */ -export interface IdentifyResult { - /** - * FaceId of the query face - */ - faceId: string; - /** - * Identified person candidates for that face (ranked by confidence). Array size should be no - * larger than input maxNumOfCandidatesReturned. If no person is identified, will return an empty - * array. - */ - candidates: IdentifyCandidate[]; +/** Operation status object. Operation refers to the asynchronous backend task including taking a snapshot and applying a snapshot. */ +export interface OperationStatus { + /** Operation status: notstarted, running, succeeded, failed. If the operation is requested and waiting to perform, the status is notstarted. If the operation is ongoing in backend, the status is running. Status succeeded means the operation is completed successfully, specifically for snapshot taking operation, it illustrates the snapshot is well taken and ready to apply, and for snapshot applying operation, it presents the target object has finished creating by the snapshot and ready to be used. Status failed is often caused by editing the source object while taking the snapshot or editing the target object while applying the snapshot before completion, see the field "message" to check the failure reason. */ + status: OperationStatusType; + /** A combined UTC date and time string that describes the time when the operation (take or apply a snapshot) is requested. E.g. 2018-12-25T11:41:02.2331413Z. */ + createdTime: Date; + /** A combined UTC date and time string that describes the last time the operation (take or apply a snapshot) is actively migrating data. The lastActionTime will keep increasing until the operation finishes. E.g. 2018-12-25T11:51:27.8705696Z. */ + lastActionTime?: Date; + /** When the operation succeeds successfully, for snapshot taking operation the snapshot id will be included in this field, and for snapshot applying operation, the path to get the target object will be returned in this field. */ + resourceLocation?: string; + /** Show failure message when operation fails (omitted when operation succeeds). */ + message?: string; } -/** - * Request body for face to person verification. - */ +/** Request body for face to person verification. */ export interface VerifyFaceToPersonRequest { - /** - * FaceId of the face, comes from Face - Detect - */ + /** FaceId of the face, comes from Face - Detect */ faceId: string; - /** - * Using existing personGroupId and personId for fast loading a specified person. personGroupId - * is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not - * be provided at the same time. - */ + /** Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ personGroupId?: string; - /** - * Using existing largePersonGroupId and personId for fast loading a specified person. - * largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and - * largePersonGroupId should not be provided at the same time. - */ + /** Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ largePersonGroupId?: string; - /** - * Specify a certain person in a person group or a large person group. personId is created in - * PersonGroup Person - Create or LargePersonGroup Person - Create. - */ + /** Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. */ personId: string; } -/** - * Request body for face to face verification. - */ -export interface VerifyFaceToFaceRequest { - /** - * FaceId of the first face, comes from Face - Detect - */ - faceId1: string; - /** - * FaceId of the second face, comes from Face - Detect - */ - faceId2: string; -} - -/** - * Result of the verify operation. - */ -export interface VerifyResult { - /** - * True if the two faces belong to the same person or the face belongs to the person, otherwise - * false. - */ - isIdentical: boolean; - /** - * A number indicates the similarity confidence of whether two faces belong to the same person, - * or whether the face belongs to the person. By default, isIdentical is set to True if - * similarity confidence is greater than or equal to 0.5. This is useful for advanced users to - * override "isIdentical" and fine-tune the result on their own data. - */ - confidence: number; -} - -/** - * PersonFace object. - */ -export interface PersistedFace { - /** - * The persistedFaceId of the target face, which is persisted and will not expire. Different from - * faceId created by Face - Detect and will expire in at the time specified by faceIdTimeToLive - * after the detection call. - */ - persistedFaceId: string; - /** - * User-provided data attached to the face. The size limit is 1KB. - */ - userData?: string; -} - -/** - * A combination of user defined name and user specified data for the person, - * largePersonGroup/personGroup, and largeFaceList/faceList. - */ -export interface NonNullableNameAndNullableUserDataContract { - /** - * User defined name, maximum length is 128. - */ - name: string; - /** - * User specified data. Length should not exceed 16KB. - */ - userData?: string; -} - -/** - * A combination of user defined name and user specified data and recognition model name for - * largePersonGroup/personGroup, and largeFaceList/faceList. - */ -export interface MetaDataContract extends NonNullableNameAndNullableUserDataContract { - /** - * Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', - * 'recognition_04'. Default value: 'recognition_01'. - */ - recognitionModel?: RecognitionModel; -} - -/** - * Face list object. - */ -export interface FaceList extends MetaDataContract { - /** - * FaceListId of the target face list. - */ - faceListId: string; - /** - * Persisted faces within the face list. - */ - persistedFaces?: PersistedFace[]; -} - -/** - * Person group object. - */ -export interface PersonGroup extends MetaDataContract { - /** - * PersonGroupId of the target person group. - */ - personGroupId: string; -} - -/** - * A combination of user defined name and user specified data for the person, - * largePersonGroup/personGroup, and largeFaceList/faceList. - */ -export interface NameAndUserDataContract { - /** - * User defined name, maximum length is 128. - */ - name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ - userData?: string; -} - -/** - * Person object. - */ -export interface Person extends NameAndUserDataContract { - /** - * PersonId of the target face list. - */ +/** Person object. */ +export type Person = NameAndUserDataContract & { + /** PersonId of the target face list. */ personId: string; - /** - * PersistedFaceIds of registered faces in the person. These persistedFaceIds are returned from - * Person - Add a Person Face, and will not expire. - */ + /** PersistedFaceIds of registered faces in the person. These persistedFaceIds are returned from Person - Add a Person Face, and will not expire. */ persistedFaceIds?: string[]; -} - -/** - * Large face list object. - */ -export interface LargeFaceList extends MetaDataContract { - /** - * LargeFaceListId of the target large face list. - */ - largeFaceListId: string; -} - -/** - * Large person group object. - */ -export interface LargePersonGroup extends MetaDataContract { - /** - * LargePersonGroupId of the target large person groups - */ - largePersonGroupId: string; -} - -/** - * Request to update face data. - */ -export interface UpdateFaceRequest { - /** - * User-provided data attached to the face. The size limit is 1KB. - */ - userData?: string; -} - -/** - * Training status object. - */ -export interface TrainingStatus { - /** - * Training status: notstarted, running, succeeded, failed. If the training process is waiting to - * perform, the status is notstarted. If the training is ongoing, the status is running. Status - * succeed means this person group or large person group is ready for Face - Identify, or this - * large face list is ready for Face - Find Similar. Status failed is often caused by no person - * or no persisted face exist in the person group or large person group, or no persisted face - * exist in the large face list. Possible values include: 'nonstarted', 'running', 'succeeded', - * 'failed' - */ - status: TrainingStatusType; - /** - * A combined UTC date and time string that describes the created time of the person group, large - * person group or large face list. - */ - created: Date; - /** - * A combined UTC date and time string that describes the last modify time of the person group, - * large person group or large face list, could be null value when the group is not successfully - * trained. - */ - lastAction?: Date; - /** - * A combined UTC date and time string that describes the last successful training time of the - * person group, large person group or large face list. - */ - lastSuccessfulTraining?: Date; - /** - * Show failure message when training failed (omitted when training succeed). - */ - message?: string; -} - -/** - * Request body for applying snapshot operation. - */ -export interface ApplySnapshotRequest { - /** - * User specified target object id to be created from the snapshot. - */ - objectId: string; - /** - * Snapshot applying mode. Currently only CreateNew is supported, which means the apply operation - * will fail if target subscription already contains an object of same type and using the same - * objectId. Users can specify the "objectId" in request body to avoid such conflicts. Possible - * values include: 'CreateNew'. Default value: 'CreateNew'. - */ - mode?: SnapshotApplyMode; -} - -/** - * Snapshot object. - */ -export interface Snapshot { - /** - * Snapshot id. - */ - id: string; - /** - * Azure Cognitive Service Face account id of the subscriber who created the snapshot by Snapshot - * - Take. - */ - account: string; - /** - * Type of the source object in the snapshot, specified by the subscriber who created the - * snapshot when calling Snapshot - Take. Currently FaceList, PersonGroup, LargeFaceList and - * LargePersonGroup are supported. Possible values include: 'FaceList', 'LargeFaceList', - * 'LargePersonGroup', 'PersonGroup' - */ - type: SnapshotObjectType; - /** - * Array of the target Face subscription ids for the snapshot, specified by the user who created - * the snapshot when calling Snapshot - Take. For each snapshot, only subscriptions included in - * the applyScope of Snapshot - Take can apply it. - */ - applyScope: string[]; - /** - * User specified data about the snapshot for any purpose. Length should not exceed 16KB. - */ - userData?: string; - /** - * A combined UTC date and time string that describes the created time of the snapshot. E.g. - * 2018-12-25T11:41:02.2331413Z. - */ - createdTime: Date; - /** - * A combined UTC date and time string that describes the last time when the snapshot was created - * or updated by Snapshot - Update. E.g. 2018-12-25T11:51:27.8705696Z. - */ - lastUpdateTime: Date; -} - -/** - * Request body for taking snapshot operation. - */ -export interface TakeSnapshotRequest { - /** - * User specified type for the source object to take snapshot from. Currently FaceList, - * PersonGroup, LargeFaceList and LargePersonGroup are supported. Possible values include: - * 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' - */ - type: SnapshotObjectType; - /** - * User specified source object id to take snapshot from. - */ - objectId: string; - /** - * User specified array of target Face subscription ids for the snapshot. For each snapshot, only - * subscriptions included in the applyScope of Snapshot - Take can apply it. - */ - applyScope: string[]; - /** - * User specified data about the snapshot for any purpose. Length should not exceed 16KB. - */ - userData?: string; -} - -/** - * Request body for updating a snapshot, with a combination of user defined apply scope and user - * specified data. - */ -export interface UpdateSnapshotRequest { - /** - * Array of the target Face subscription ids for the snapshot, specified by the user who created - * the snapshot when calling Snapshot - Take. For each snapshot, only subscriptions included in - * the applyScope of Snapshot - Take can apply it. - */ - applyScope?: string[]; - /** - * User specified data about the snapshot for any purpose. Length should not exceed 16KB. - */ - userData?: string; -} +}; -/** - * Operation status object. Operation refers to the asynchronous backend task including taking a - * snapshot and applying a snapshot. - */ -export interface OperationStatus { - /** - * Operation status: notstarted, running, succeeded, failed. If the operation is requested and - * waiting to perform, the status is notstarted. If the operation is ongoing in backend, the - * status is running. Status succeeded means the operation is completed successfully, - * specifically for snapshot taking operation, it illustrates the snapshot is well taken and - * ready to apply, and for snapshot applying operation, it presents the target object has - * finished creating by the snapshot and ready to be used. Status failed is often caused by - * editing the source object while taking the snapshot or editing the target object while - * applying the snapshot before completion, see the field "message" to check the failure reason. - * Possible values include: 'notstarted', 'running', 'succeeded', 'failed' - */ - status: OperationStatusType; - /** - * A combined UTC date and time string that describes the time when the operation (take or apply - * a snapshot) is requested. E.g. 2018-12-25T11:41:02.2331413Z. - */ - createdTime: Date; - /** - * A combined UTC date and time string that describes the last time the operation (take or apply - * a snapshot) is actively migrating data. The lastActionTime will keep increasing until the - * operation finishes. E.g. 2018-12-25T11:51:27.8705696Z. - */ - lastActionTime?: Date; - /** - * When the operation succeeds successfully, for snapshot taking operation the snapshot id will - * be included in this field, and for snapshot applying operation, the path to get the target - * object will be returned in this field. - */ - resourceLocation?: string; - /** - * Show failure message when operation fails (omitted when operation succeeds). - */ - message?: string; -} +/** A combination of user defined name and user specified data and recognition model name for largePersonGroup/personGroup, and largeFaceList/faceList. */ +export type MetaDataContract = NonNullableNameAndNullableUserDataContract & { + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ + recognitionModel?: RecognitionModel; +}; -/** - * An interface representing ImageUrl. - */ -export interface ImageUrl { - /** - * Publicly reachable URL of an image - */ - url: string; +/** Defines headers for Snapshot_take operation. */ +export interface SnapshotTakeHeaders { + /** Operation location with an operation id used to track the progress of taking snapshot. The returned id is the operation id, rather than snapshot id. Snapshot id can be obtained only when the operation status becomes "succeeded" in OperationStatus - Get. */ + operationLocation?: string; } -/** - * Optional Parameters. - */ -export interface FaceFindSimilarOptionalParams extends msRest.RequestOptionsBase { - /** - * An existing user-specified unique candidate face list, created in Face List - Create a Face - * List. Face list contains a set of persistedFaceIds which are persisted and will never expire. - * Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. - */ +/** Defines headers for Snapshot_apply operation. */ +export interface SnapshotApplyHeaders { + /** Operation location with an operation id used to track the progress of applying the snapshot by OperationStatus - Get. */ + operationLocation?: string; +} + +/** Known values of {@link RecognitionModel} that the service accepts. */ +export enum KnownRecognitionModel { + Recognition01 = "recognition_01", + Recognition02 = "recognition_02", + Recognition03 = "recognition_03", + Recognition04 = "recognition_04" +} + +/** + * Defines values for RecognitionModel. \ + * {@link KnownRecognitionModel} can be used interchangeably with RecognitionModel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **recognition_01** \ + * **recognition_02** \ + * **recognition_03** \ + * **recognition_04** + */ +export type RecognitionModel = string; + +/** Known values of {@link DetectionModel} that the service accepts. */ +export enum KnownDetectionModel { + Detection01 = "detection_01", + Detection02 = "detection_02", + Detection03 = "detection_03" +} + +/** + * Defines values for DetectionModel. \ + * {@link KnownDetectionModel} can be used interchangeably with DetectionModel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **detection_01** \ + * **detection_02** \ + * **detection_03** + */ +export type DetectionModel = string; +/** Defines values for FindSimilarMatchMode. */ +export type FindSimilarMatchMode = "matchPerson" | "matchFace"; +/** Defines values for TrainingStatusType. */ +export type TrainingStatusType = + | "nonstarted" + | "running" + | "succeeded" + | "failed"; +/** Defines values for FaceAttributeType. */ +export type FaceAttributeType = + | "age" + | "gender" + | "headPose" + | "smile" + | "facialHair" + | "glasses" + | "emotion" + | "hair" + | "makeup" + | "occlusion" + | "accessories" + | "blur" + | "exposure" + | "noise" + | "mask" + | "qualityForRecognition"; +/** Defines values for Gender. */ +export type Gender = "male" | "female"; +/** Defines values for GlassesType. */ +export type GlassesType = + | "noGlasses" + | "readingGlasses" + | "sunglasses" + | "swimmingGoggles"; +/** Defines values for HairColorType. */ +export type HairColorType = + | "unknown" + | "white" + | "gray" + | "blond" + | "brown" + | "red" + | "black" + | "other"; +/** Defines values for AccessoryType. */ +export type AccessoryType = "headWear" | "glasses" | "mask"; +/** Defines values for BlurLevel. */ +export type BlurLevel = "Low" | "Medium" | "High"; +/** Defines values for ExposureLevel. */ +export type ExposureLevel = "UnderExposure" | "GoodExposure" | "OverExposure"; +/** Defines values for NoiseLevel. */ +export type NoiseLevel = "Low" | "Medium" | "High"; +/** Defines values for MaskType. */ +export type MaskType = + | "noMask" + | "faceMask" + | "otherMaskOrOcclusion" + | "uncertain"; +/** Defines values for QualityForRecognition. */ +export type QualityForRecognition = "Low" | "Medium" | "High"; +/** Defines values for SnapshotObjectType. */ +export type SnapshotObjectType = + | "FaceList" + | "LargeFaceList" + | "LargePersonGroup" + | "PersonGroup"; +/** Defines values for OperationStatusType. */ +export type OperationStatusType = + | "notstarted" + | "running" + | "succeeded" + | "failed"; + +/** Optional parameters. */ +export interface FaceFindSimilarOptionalParams + extends coreClient.OperationOptions { + /** An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. */ faceListId?: string; - /** - * An existing user-specified unique candidate large face list, created in LargeFaceList - - * Create. Large face list contains a set of persistedFaceIds which are persisted and will never - * expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same - * time. - */ + /** An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. */ largeFaceListId?: string; - /** - * An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will - * expire at the time specified by faceIdTimeToLive after the detection call. The number of - * faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be - * provided at the same time. - */ + /** An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire at the time specified by faceIdTimeToLive after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. */ faceIds?: string[]; - /** - * The number of top similar faces returned. The valid range is [1, 1000]. Default value: 20. - */ + /** The number of top similar faces returned. The valid range is [1, 1000]. */ maxNumOfCandidatesReturned?: number; - /** - * Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: - * 'matchPerson', 'matchFace'. Default value: 'matchPerson'. - */ + /** Similar face searching mode. It can be "matchPerson" or "matchFace". */ mode?: FindSimilarMatchMode; } -/** - * Optional Parameters. - */ -export interface FaceIdentifyOptionalParams extends msRest.RequestOptionsBase { - /** - * PersonGroupId of the target person group, created by PersonGroup - Create. Parameter - * personGroupId and largePersonGroupId should not be provided at the same time. - */ +/** Contains response data for the findSimilar operation. */ +export type FaceFindSimilarResponse = SimilarFace[]; + +/** Optional parameters. */ +export interface FaceGroupOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the group operation. */ +export type FaceGroupResponse = GroupResult; + +/** Optional parameters. */ +export interface FaceIdentifyOptionalParams + extends coreClient.OperationOptions { + /** PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ personGroupId?: string; - /** - * LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. - * Parameter personGroupId and largePersonGroupId should not be provided at the same time. - */ + /** LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ largePersonGroupId?: string; - /** - * The range of maxNumOfCandidatesReturned is between 1 and 100 (default is 1). Default value: 1. - */ + /** The range of maxNumOfCandidatesReturned is between 1 and 100 (default is 1). */ maxNumOfCandidatesReturned?: number; - /** - * Confidence threshold of identification, used to judge whether one face belong to one person. - * The range of confidenceThreshold is [0, 1] (default specified by algorithm). - */ + /** Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). */ confidenceThreshold?: number; } -/** - * Optional Parameters. - */ -export interface FaceDetectWithUrlOptionalParams extends msRest.RequestOptionsBase { - /** - * A value indicating whether the operation should return faceIds of detected faces. Default - * value: true. - */ +/** Contains response data for the identify operation. */ +export type FaceIdentifyResponse = IdentifyResult[]; + +/** Optional parameters. */ +export interface FaceVerifyFaceToFaceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the verifyFaceToFace operation. */ +export type FaceVerifyFaceToFaceResponse = VerifyResult; + +/** Optional parameters. */ +export interface FaceDetectWithUrlOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return faceIds of detected faces. */ returnFaceId?: boolean; - /** - * A value indicating whether the operation should return landmarks of the detected faces. - * Default value: false. - */ + /** A value indicating whether the operation should return landmarks of the detected faces. */ returnFaceLandmarks?: boolean; - /** - * Analyze and return the one or more specified face attributes in the comma-separated string - * like "returnFaceAttributes=age,gender". The available attributes depends on the - * 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, - * glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and - * qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' - * only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only - * supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. - * Note that each face attribute analysis has additional computational and time cost. - */ + /** Analyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. */ returnFaceAttributes?: FaceAttributeType[]; - /** - * Name of recognition model. Recognition model is used when the face features are extracted and - * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model - * name can be provided when performing Face - Detect or (Large)FaceList - Create or - * (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, - * please explicitly specify the model you need. Possible values include: 'recognition_01', - * 'recognition_02', 'recognition_03', 'recognition_04'. Default value: 'recognition_01'. - */ + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ recognitionModel?: RecognitionModel; - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ + /** A value indicating whether the operation should return 'recognitionModel' in response. */ returnRecognitionModel?: boolean; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ detectionModel?: DetectionModel; - /** - * The number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 - * seconds. The default value is 86400 (24 hours). Default value: 86400. - */ + /** The number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours). */ faceIdTimeToLive?: number; } -/** - * Optional Parameters. - */ -export interface FaceVerifyFaceToPersonOptionalParams extends msRest.RequestOptionsBase { - /** - * Using existing personGroupId and personId for fast loading a specified person. personGroupId - * is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not - * be provided at the same time. - */ +/** Contains response data for the detectWithUrl operation. */ +export type FaceDetectWithUrlResponse = DetectedFace[]; + +/** Optional parameters. */ +export interface FaceVerifyFaceToPersonOptionalParams + extends coreClient.OperationOptions { + /** Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ personGroupId?: string; - /** - * Using existing largePersonGroupId and personId for fast loading a specified person. - * largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and - * largePersonGroupId should not be provided at the same time. - */ + /** Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ largePersonGroupId?: string; } -/** - * Optional Parameters. - */ -export interface FaceDetectWithStreamOptionalParams extends msRest.RequestOptionsBase { - /** - * A value indicating whether the operation should return faceIds of detected faces. Default - * value: true. - */ +/** Contains response data for the verifyFaceToPerson operation. */ +export type FaceVerifyFaceToPersonResponse = VerifyResult; + +/** Optional parameters. */ +export interface FaceDetectWithStreamOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return faceIds of detected faces. */ returnFaceId?: boolean; - /** - * A value indicating whether the operation should return landmarks of the detected faces. - * Default value: false. - */ + /** A value indicating whether the operation should return landmarks of the detected faces. */ returnFaceLandmarks?: boolean; - /** - * Analyze and return the one or more specified face attributes in the comma-separated string - * like "returnFaceAttributes=age,gender". The available attributes depends on the - * 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, - * glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and - * qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' - * only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only - * supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. - * Note that each face attribute analysis has additional computational and time cost. - */ + /** Analyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. */ returnFaceAttributes?: FaceAttributeType[]; - /** - * Name of recognition model. Recognition model is used when the face features are extracted and - * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model - * name can be provided when performing Face - Detect or (Large)FaceList - Create or - * (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, - * please explicitly specify the model you need. Possible values include: 'recognition_01', - * 'recognition_02', 'recognition_03', 'recognition_04'. Default value: 'recognition_01'. - */ + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ recognitionModel?: RecognitionModel; - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ + /** A value indicating whether the operation should return 'recognitionModel' in response. */ returnRecognitionModel?: boolean; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ detectionModel?: DetectionModel; - /** - * The number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 - * seconds. The default value is 86400 (24 hours). Default value: 86400. - */ + /** The number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours). */ faceIdTimeToLive?: number; } -/** - * Optional Parameters. - */ -export interface PersonGroupPersonCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ +/** Contains response data for the detectWithStream operation. */ +export type FaceDetectWithStreamResponse = DetectedFace[]; + +/** Optional parameters. */ +export interface PersonGroupPersonCreateOptionalParams + extends coreClient.OperationOptions { + /** User defined name, maximum length is 128. */ name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ + /** User specified data. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface PersonGroupPersonListOptionalParams extends msRest.RequestOptionsBase { - /** - * Starting person id to return (used to list a range of persons). - */ +/** Contains response data for the create operation. */ +export type PersonGroupPersonCreateResponse = Person; + +/** Optional parameters. */ +export interface PersonGroupPersonListOptionalParams + extends coreClient.OperationOptions { + /** Starting person id to return (used to list a range of persons). */ start?: string; - /** - * Number of persons to return starting with the person id indicated by the 'start' parameter. - */ + /** Number of persons to return starting with the person id indicated by the 'start' parameter. */ top?: number; } -/** - * Optional Parameters. - */ -export interface PersonGroupPersonUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ +/** Contains response data for the list operation. */ +export type PersonGroupPersonListResponse = Person[]; + +/** Optional parameters. */ +export interface PersonGroupPersonDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface PersonGroupPersonGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type PersonGroupPersonGetResponse = Person; + +/** Optional parameters. */ +export interface PersonGroupPersonUpdateOptionalParams + extends coreClient.OperationOptions { + /** User defined name, maximum length is 128. */ name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ + /** User specified data. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface PersonGroupPersonUpdateFaceOptionalParams extends msRest.RequestOptionsBase { - /** - * User-provided data attached to the face. The size limit is 1KB. - */ +/** Optional parameters. */ +export interface PersonGroupPersonDeleteFaceOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface PersonGroupPersonGetFaceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getFace operation. */ +export type PersonGroupPersonGetFaceResponse = PersistedFace; + +/** Optional parameters. */ +export interface PersonGroupPersonUpdateFaceOptionalParams + extends coreClient.OperationOptions { + /** User-provided data attached to the face. The size limit is 1KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface PersonGroupPersonAddFaceFromUrlOptionalParams extends msRest.RequestOptionsBase { - /** - * User-specified data about the face for any purpose. The maximum length is 1KB. - */ +/** Optional parameters. */ +export interface PersonGroupPersonAddFaceFromUrlOptionalParams + extends coreClient.OperationOptions { + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ + detectionModel?: DetectionModel; + /** User-specified data about the face for any purpose. The maximum length is 1KB. */ userData?: string; - /** - * A face rectangle to specify the target face to be added to a person in the format of - * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one - * face in the image, targetFace is required to specify which face to add. No targetFace means - * there is only one face detected in the entire image. - */ + /** A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. */ targetFace?: number[]; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ - detectionModel?: DetectionModel; } -/** - * Optional Parameters. - */ -export interface PersonGroupPersonAddFaceFromStreamOptionalParams extends msRest.RequestOptionsBase { - /** - * User-specified data about the face for any purpose. The maximum length is 1KB. - */ +/** Contains response data for the addFaceFromUrl operation. */ +export type PersonGroupPersonAddFaceFromUrlResponse = PersistedFace; + +/** Optional parameters. */ +export interface PersonGroupPersonAddFaceFromStreamOptionalParams + extends coreClient.OperationOptions { + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ + detectionModel?: DetectionModel; + /** User-specified data about the face for any purpose. The maximum length is 1KB. */ userData?: string; - /** - * A face rectangle to specify the target face to be added to a person in the format of - * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one - * face in the image, targetFace is required to specify which face to add. No targetFace means - * there is only one face detected in the entire image. - */ + /** A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. */ targetFace?: number[]; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ - detectionModel?: DetectionModel; } -/** - * Optional Parameters. - */ -export interface PersonGroupCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User specified data. Length should not exceed 16KB. - */ +/** Contains response data for the addFaceFromStream operation. */ +export type PersonGroupPersonAddFaceFromStreamResponse = PersistedFace; + +/** Optional parameters. */ +export interface PersonGroupCreateOptionalParams + extends coreClient.OperationOptions { + /** User specified data. Length should not exceed 16KB. */ userData?: string; - /** - * Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', - * 'recognition_04'. Default value: 'recognition_01'. - */ + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ recognitionModel?: RecognitionModel; } -/** - * Optional Parameters. - */ -export interface PersonGroupGetOptionalParams extends msRest.RequestOptionsBase { - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ +/** Optional parameters. */ +export interface PersonGroupDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface PersonGroupGetOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return 'recognitionModel' in response. */ returnRecognitionModel?: boolean; } -/** - * Optional Parameters. - */ -export interface PersonGroupUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ +/** Contains response data for the get operation. */ +export type PersonGroupGetResponse = PersonGroup; + +/** Optional parameters. */ +export interface PersonGroupUpdateOptionalParams + extends coreClient.OperationOptions { + /** User defined name, maximum length is 128. */ name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ + /** User specified data. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface PersonGroupListOptionalParams extends msRest.RequestOptionsBase { - /** - * List person groups from the least personGroupId greater than the "start". - */ +/** Optional parameters. */ +export interface PersonGroupGetTrainingStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getTrainingStatus operation. */ +export type PersonGroupGetTrainingStatusResponse = TrainingStatus; + +/** Optional parameters. */ +export interface PersonGroupListOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return 'recognitionModel' in response. */ + returnRecognitionModel?: boolean; + /** List person groups from the least personGroupId greater than the "start". */ start?: string; - /** - * The number of person groups to list. Default value: 1000. - */ + /** The number of person groups to list. */ top?: number; - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ - returnRecognitionModel?: boolean; } -/** - * Optional Parameters. - */ -export interface FaceListCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User specified data. Length should not exceed 16KB. - */ +/** Contains response data for the list operation. */ +export type PersonGroupListResponse = PersonGroup[]; + +/** Optional parameters. */ +export interface PersonGroupTrainOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FaceListCreateOptionalParams + extends coreClient.OperationOptions { + /** User specified data. Length should not exceed 16KB. */ userData?: string; - /** - * Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', - * 'recognition_04'. Default value: 'recognition_01'. - */ + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ recognitionModel?: RecognitionModel; } -/** - * Optional Parameters. - */ -export interface FaceListGetOptionalParams extends msRest.RequestOptionsBase { - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ +/** Optional parameters. */ +export interface FaceListGetOptionalParams extends coreClient.OperationOptions { + /** A value indicating whether the operation should return 'recognitionModel' in response. */ returnRecognitionModel?: boolean; } -/** - * Optional Parameters. - */ -export interface FaceListUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ +/** Contains response data for the get operation. */ +export type FaceListGetResponse = FaceList; + +/** Optional parameters. */ +export interface FaceListUpdateOptionalParams + extends coreClient.OperationOptions { + /** User defined name, maximum length is 128. */ name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ + /** User specified data. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface FaceListListOptionalParams extends msRest.RequestOptionsBase { - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ +/** Optional parameters. */ +export interface FaceListDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FaceListListOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return 'recognitionModel' in response. */ returnRecognitionModel?: boolean; } -/** - * Optional Parameters. - */ -export interface FaceListAddFaceFromUrlOptionalParams extends msRest.RequestOptionsBase { - /** - * User-specified data about the face for any purpose. The maximum length is 1KB. - */ +/** Contains response data for the list operation. */ +export type FaceListListResponse = FaceList[]; + +/** Optional parameters. */ +export interface FaceListDeleteFaceOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FaceListAddFaceFromUrlOptionalParams + extends coreClient.OperationOptions { + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ + detectionModel?: DetectionModel; + /** User-specified data about the face for any purpose. The maximum length is 1KB. */ userData?: string; - /** - * A face rectangle to specify the target face to be added to a person in the format of - * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one - * face in the image, targetFace is required to specify which face to add. No targetFace means - * there is only one face detected in the entire image. - */ + /** A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. */ targetFace?: number[]; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ - detectionModel?: DetectionModel; } -/** - * Optional Parameters. - */ -export interface FaceListAddFaceFromStreamOptionalParams extends msRest.RequestOptionsBase { - /** - * User-specified data about the face for any purpose. The maximum length is 1KB. - */ +/** Contains response data for the addFaceFromUrl operation. */ +export type FaceListAddFaceFromUrlResponse = PersistedFace; + +/** Optional parameters. */ +export interface FaceListAddFaceFromStreamOptionalParams + extends coreClient.OperationOptions { + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ + detectionModel?: DetectionModel; + /** User-specified data about the face for any purpose. The maximum length is 1KB. */ userData?: string; - /** - * A face rectangle to specify the target face to be added to a person in the format of - * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one - * face in the image, targetFace is required to specify which face to add. No targetFace means - * there is only one face detected in the entire image. - */ + /** A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. */ targetFace?: number[]; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ - detectionModel?: DetectionModel; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupPersonCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ +/** Contains response data for the addFaceFromStream operation. */ +export type FaceListAddFaceFromStreamResponse = PersistedFace; + +/** Optional parameters. */ +export interface LargePersonGroupPersonCreateOptionalParams + extends coreClient.OperationOptions { + /** User defined name, maximum length is 128. */ name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ + /** User specified data. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupPersonListOptionalParams extends msRest.RequestOptionsBase { - /** - * Starting person id to return (used to list a range of persons). - */ +/** Contains response data for the create operation. */ +export type LargePersonGroupPersonCreateResponse = Person; + +/** Optional parameters. */ +export interface LargePersonGroupPersonListOptionalParams + extends coreClient.OperationOptions { + /** Starting person id to return (used to list a range of persons). */ start?: string; - /** - * Number of persons to return starting with the person id indicated by the 'start' parameter. - */ + /** Number of persons to return starting with the person id indicated by the 'start' parameter. */ top?: number; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupPersonUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ +/** Contains response data for the list operation. */ +export type LargePersonGroupPersonListResponse = Person[]; + +/** Optional parameters. */ +export interface LargePersonGroupPersonDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface LargePersonGroupPersonGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type LargePersonGroupPersonGetResponse = Person; + +/** Optional parameters. */ +export interface LargePersonGroupPersonUpdateOptionalParams + extends coreClient.OperationOptions { + /** User defined name, maximum length is 128. */ name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ + /** User specified data. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupPersonUpdateFaceOptionalParams extends msRest.RequestOptionsBase { - /** - * User-provided data attached to the face. The size limit is 1KB. - */ +/** Optional parameters. */ +export interface LargePersonGroupPersonDeleteFaceOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface LargePersonGroupPersonGetFaceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getFace operation. */ +export type LargePersonGroupPersonGetFaceResponse = PersistedFace; + +/** Optional parameters. */ +export interface LargePersonGroupPersonUpdateFaceOptionalParams + extends coreClient.OperationOptions { + /** User-provided data attached to the face. The size limit is 1KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupPersonAddFaceFromUrlOptionalParams extends msRest.RequestOptionsBase { - /** - * User-specified data about the face for any purpose. The maximum length is 1KB. - */ +/** Optional parameters. */ +export interface LargePersonGroupPersonAddFaceFromUrlOptionalParams + extends coreClient.OperationOptions { + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ + detectionModel?: DetectionModel; + /** User-specified data about the face for any purpose. The maximum length is 1KB. */ userData?: string; - /** - * A face rectangle to specify the target face to be added to a person in the format of - * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one - * face in the image, targetFace is required to specify which face to add. No targetFace means - * there is only one face detected in the entire image. - */ + /** A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. */ targetFace?: number[]; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ - detectionModel?: DetectionModel; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupPersonAddFaceFromStreamOptionalParams extends msRest.RequestOptionsBase { - /** - * User-specified data about the face for any purpose. The maximum length is 1KB. - */ +/** Contains response data for the addFaceFromUrl operation. */ +export type LargePersonGroupPersonAddFaceFromUrlResponse = PersistedFace; + +/** Optional parameters. */ +export interface LargePersonGroupPersonAddFaceFromStreamOptionalParams + extends coreClient.OperationOptions { + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ + detectionModel?: DetectionModel; + /** User-specified data about the face for any purpose. The maximum length is 1KB. */ userData?: string; - /** - * A face rectangle to specify the target face to be added to a person in the format of - * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one - * face in the image, targetFace is required to specify which face to add. No targetFace means - * there is only one face detected in the entire image. - */ + /** A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. */ targetFace?: number[]; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ - detectionModel?: DetectionModel; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User specified data. Length should not exceed 16KB. - */ +/** Contains response data for the addFaceFromStream operation. */ +export type LargePersonGroupPersonAddFaceFromStreamResponse = PersistedFace; + +/** Optional parameters. */ +export interface LargePersonGroupCreateOptionalParams + extends coreClient.OperationOptions { + /** User specified data. Length should not exceed 16KB. */ userData?: string; - /** - * Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', - * 'recognition_04'. Default value: 'recognition_01'. - */ + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ recognitionModel?: RecognitionModel; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupGetOptionalParams extends msRest.RequestOptionsBase { - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ +/** Optional parameters. */ +export interface LargePersonGroupDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface LargePersonGroupGetOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return 'recognitionModel' in response. */ returnRecognitionModel?: boolean; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ +/** Contains response data for the get operation. */ +export type LargePersonGroupGetResponse = LargePersonGroup; + +/** Optional parameters. */ +export interface LargePersonGroupUpdateOptionalParams + extends coreClient.OperationOptions { + /** User defined name, maximum length is 128. */ name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ + /** User specified data. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface LargePersonGroupListOptionalParams extends msRest.RequestOptionsBase { - /** - * List large person groups from the least largePersonGroupId greater than the "start". - */ +/** Optional parameters. */ +export interface LargePersonGroupGetTrainingStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getTrainingStatus operation. */ +export type LargePersonGroupGetTrainingStatusResponse = TrainingStatus; + +/** Optional parameters. */ +export interface LargePersonGroupListOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return 'recognitionModel' in response. */ + returnRecognitionModel?: boolean; + /** List large person groups from the least largePersonGroupId greater than the "start". */ start?: string; - /** - * The number of large person groups to list. Default value: 1000. - */ + /** The number of large person groups to list. */ top?: number; - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ - returnRecognitionModel?: boolean; } -/** - * Optional Parameters. - */ -export interface LargeFaceListCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User specified data. Length should not exceed 16KB. - */ +/** Contains response data for the list operation. */ +export type LargePersonGroupListResponse = LargePersonGroup[]; + +/** Optional parameters. */ +export interface LargePersonGroupTrainOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface LargeFaceListCreateOptionalParams + extends coreClient.OperationOptions { + /** User specified data. Length should not exceed 16KB. */ userData?: string; - /** - * Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', - * 'recognition_04'. Default value: 'recognition_01'. - */ + /** Name of recognition model. Recognition model is used when the face features are extracted and associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition model name can be provided when performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup - Create. The default value is 'recognition_01', if latest model needed, please explicitly specify the model you need. */ recognitionModel?: RecognitionModel; } -/** - * Optional Parameters. - */ -export interface LargeFaceListGetOptionalParams extends msRest.RequestOptionsBase { - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ +/** Optional parameters. */ +export interface LargeFaceListGetOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return 'recognitionModel' in response. */ returnRecognitionModel?: boolean; } -/** - * Optional Parameters. - */ -export interface LargeFaceListUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ +/** Contains response data for the get operation. */ +export type LargeFaceListGetResponse = LargeFaceList; + +/** Optional parameters. */ +export interface LargeFaceListUpdateOptionalParams + extends coreClient.OperationOptions { + /** User defined name, maximum length is 128. */ name?: string; - /** - * User specified data. Length should not exceed 16KB. - */ + /** User specified data. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface LargeFaceListListOptionalParams extends msRest.RequestOptionsBase { - /** - * A value indicating whether the operation should return 'recognitionModel' in response. Default - * value: false. - */ +/** Optional parameters. */ +export interface LargeFaceListDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface LargeFaceListGetTrainingStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getTrainingStatus operation. */ +export type LargeFaceListGetTrainingStatusResponse = TrainingStatus; + +/** Optional parameters. */ +export interface LargeFaceListListOptionalParams + extends coreClient.OperationOptions { + /** A value indicating whether the operation should return 'recognitionModel' in response. */ returnRecognitionModel?: boolean; - /** - * Starting large face list id to return (used to list a range of large face lists). - */ + /** Starting large face list id to return (used to list a range of large face lists). */ start?: string; - /** - * Number of large face lists to return starting with the large face list id indicated by the - * 'start' parameter. - */ + /** Number of large face lists to return starting with the large face list id indicated by the 'start' parameter. */ top?: number; } -/** - * Optional Parameters. - */ -export interface LargeFaceListUpdateFaceOptionalParams extends msRest.RequestOptionsBase { - /** - * User-provided data attached to the face. The size limit is 1KB. - */ +/** Contains response data for the list operation. */ +export type LargeFaceListListResponse = LargeFaceList[]; + +/** Optional parameters. */ +export interface LargeFaceListTrainOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface LargeFaceListDeleteFaceOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface LargeFaceListGetFaceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getFace operation. */ +export type LargeFaceListGetFaceResponse = PersistedFace; + +/** Optional parameters. */ +export interface LargeFaceListUpdateFaceOptionalParams + extends coreClient.OperationOptions { + /** User-provided data attached to the face. The size limit is 1KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface LargeFaceListAddFaceFromUrlOptionalParams extends msRest.RequestOptionsBase { - /** - * User-specified data about the face for any purpose. The maximum length is 1KB. - */ +/** Optional parameters. */ +export interface LargeFaceListAddFaceFromUrlOptionalParams + extends coreClient.OperationOptions { + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ + detectionModel?: DetectionModel; + /** User-specified data about the face for any purpose. The maximum length is 1KB. */ userData?: string; - /** - * A face rectangle to specify the target face to be added to a person in the format of - * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one - * face in the image, targetFace is required to specify which face to add. No targetFace means - * there is only one face detected in the entire image. - */ + /** A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. */ targetFace?: number[]; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ - detectionModel?: DetectionModel; } -/** - * Optional Parameters. - */ -export interface LargeFaceListListFacesOptionalParams extends msRest.RequestOptionsBase { - /** - * Starting face id to return (used to list a range of faces). - */ +/** Contains response data for the addFaceFromUrl operation. */ +export type LargeFaceListAddFaceFromUrlResponse = PersistedFace; + +/** Optional parameters. */ +export interface LargeFaceListListFacesOptionalParams + extends coreClient.OperationOptions { + /** Starting face id to return (used to list a range of faces). */ start?: string; - /** - * Number of faces to return starting with the face id indicated by the 'start' parameter. - */ + /** Number of faces to return starting with the face id indicated by the 'start' parameter. */ top?: number; } -/** - * Optional Parameters. - */ -export interface LargeFaceListAddFaceFromStreamOptionalParams extends msRest.RequestOptionsBase { - /** - * User-specified data about the face for any purpose. The maximum length is 1KB. - */ - userData?: string; - /** - * A face rectangle to specify the target face to be added to a person in the format of - * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one - * face in the image, targetFace is required to specify which face to add. No targetFace means - * there is only one face detected in the entire image. - */ - targetFace?: number[]; - /** - * Name of detection model. Detection model is used to detect faces in the submitted image. A - * detection model name can be provided when performing Face - Detect or (Large)FaceList - Add - * Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model - * is needed, please explicitly specify it. Possible values include: 'detection_01', - * 'detection_02', 'detection_03'. Default value: 'detection_01'. - */ - detectionModel?: DetectionModel; -} +/** Contains response data for the listFaces operation. */ +export type LargeFaceListListFacesResponse = PersistedFace[]; -/** - * Optional Parameters. - */ -export interface SnapshotTakeOptionalParams extends msRest.RequestOptionsBase { - /** - * User specified data about the snapshot for any purpose. Length should not exceed 16KB. - */ +/** Optional parameters. */ +export interface LargeFaceListAddFaceFromStreamOptionalParams + extends coreClient.OperationOptions { + /** Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. */ + detectionModel?: DetectionModel; + /** User-specified data about the face for any purpose. The maximum length is 1KB. */ userData?: string; + /** A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. */ + targetFace?: number[]; } -/** - * Optional Parameters. - */ -export interface SnapshotListOptionalParams extends msRest.RequestOptionsBase { - /** - * User specified object type as a search filter. Possible values include: 'FaceList', - * 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' - */ - type?: SnapshotObjectType; - /** - * User specified snapshot apply scopes as a search filter. ApplyScope is an array of the target - * Azure subscription ids for the snapshot, specified by the user who created the snapshot by - * Snapshot - Take. - */ - applyScope?: string[]; -} +/** Contains response data for the addFaceFromStream operation. */ +export type LargeFaceListAddFaceFromStreamResponse = PersistedFace; -/** - * Optional Parameters. - */ -export interface SnapshotUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Array of the target Face subscription ids for the snapshot, specified by the user who created - * the snapshot when calling Snapshot - Take. For each snapshot, only subscriptions included in - * the applyScope of Snapshot - Take can apply it. - */ - applyScope?: string[]; - /** - * User specified data about the snapshot for any purpose. Length should not exceed 16KB. - */ +/** Optional parameters. */ +export interface SnapshotTakeOptionalParams + extends coreClient.OperationOptions { + /** User specified data about the snapshot for any purpose. Length should not exceed 16KB. */ userData?: string; } -/** - * Optional Parameters. - */ -export interface SnapshotApplyOptionalParams extends msRest.RequestOptionsBase { - /** - * Snapshot applying mode. Currently only CreateNew is supported, which means the apply operation - * will fail if target subscription already contains an object of same type and using the same - * objectId. Users can specify the "objectId" in request body to avoid such conflicts. Possible - * values include: 'CreateNew'. Default value: 'CreateNew'. - */ - mode?: SnapshotApplyMode; -} - -/** - * Defines headers for Take operation. - */ -export interface SnapshotTakeHeaders { - /** - * Operation location with an operation id used to track the progress of taking snapshot. The - * returned id is the operation id, rather than snapshot id. Snapshot id can be obtained only - * when the operation status becomes "succeeded" in OperationStatus - Get. - */ - operationLocation: string; -} +/** Contains response data for the take operation. */ +export type SnapshotTakeResponse = SnapshotTakeHeaders; -/** - * Defines headers for Apply operation. - */ -export interface SnapshotApplyHeaders { - /** - * Operation location with an operation id used to track the progress of applying the snapshot by - * OperationStatus - Get. - */ - operationLocation: string; +/** Optional parameters. */ +export interface SnapshotListOptionalParams + extends coreClient.OperationOptions { + /** User specified object type as a search filter. */ + typeParam?: SnapshotObjectType; + /** User specified snapshot apply scopes as a search filter. ApplyScope is an array of the target Azure subscription ids for the snapshot, specified by the user who created the snapshot by Snapshot - Take. */ + applyScope?: string[]; } -/** - * Defines values for RecognitionModel. - * Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', 'recognition_04' - * @readonly - * @enum {string} - */ -export type RecognitionModel = 'recognition_01' | 'recognition_02' | 'recognition_03' | 'recognition_04'; - -/** - * Defines values for Gender. - * Possible values include: 'male', 'female' - * @readonly - * @enum {string} - */ -export type Gender = 'male' | 'female'; - -/** - * Defines values for GlassesType. - * Possible values include: 'noGlasses', 'readingGlasses', 'sunglasses', 'swimmingGoggles' - * @readonly - * @enum {string} - */ -export type GlassesType = 'noGlasses' | 'readingGlasses' | 'sunglasses' | 'swimmingGoggles'; - -/** - * Defines values for HairColorType. - * Possible values include: 'unknown', 'white', 'gray', 'blond', 'brown', 'red', 'black', 'other' - * @readonly - * @enum {string} - */ -export type HairColorType = 'unknown' | 'white' | 'gray' | 'blond' | 'brown' | 'red' | 'black' | 'other'; - -/** - * Defines values for AccessoryType. - * Possible values include: 'headWear', 'glasses', 'mask' - * @readonly - * @enum {string} - */ -export type AccessoryType = 'headWear' | 'glasses' | 'mask'; - -/** - * Defines values for BlurLevel. - * Possible values include: 'Low', 'Medium', 'High' - * @readonly - * @enum {string} - */ -export type BlurLevel = 'Low' | 'Medium' | 'High'; - -/** - * Defines values for ExposureLevel. - * Possible values include: 'UnderExposure', 'GoodExposure', 'OverExposure' - * @readonly - * @enum {string} - */ -export type ExposureLevel = 'UnderExposure' | 'GoodExposure' | 'OverExposure'; - -/** - * Defines values for NoiseLevel. - * Possible values include: 'Low', 'Medium', 'High' - * @readonly - * @enum {string} - */ -export type NoiseLevel = 'Low' | 'Medium' | 'High'; - -/** - * Defines values for MaskType. - * Possible values include: 'noMask', 'faceMask', 'otherMaskOrOcclusion', 'uncertain' - * @readonly - * @enum {string} - */ -export type MaskType = 'noMask' | 'faceMask' | 'otherMaskOrOcclusion' | 'uncertain'; - -/** - * Defines values for QualityForRecognition. - * Possible values include: 'Low', 'Medium', 'High' - * @readonly - * @enum {string} - */ -export type QualityForRecognition = 'Low' | 'Medium' | 'High'; - -/** - * Defines values for FindSimilarMatchMode. - * Possible values include: 'matchPerson', 'matchFace' - * @readonly - * @enum {string} - */ -export type FindSimilarMatchMode = 'matchPerson' | 'matchFace'; - -/** - * Defines values for TrainingStatusType. - * Possible values include: 'nonstarted', 'running', 'succeeded', 'failed' - * @readonly - * @enum {string} - */ -export type TrainingStatusType = 'nonstarted' | 'running' | 'succeeded' | 'failed'; - -/** - * Defines values for SnapshotApplyMode. - * Possible values include: 'CreateNew' - * @readonly - * @enum {string} - */ -export type SnapshotApplyMode = 'CreateNew'; - -/** - * Defines values for SnapshotObjectType. - * Possible values include: 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' - * @readonly - * @enum {string} - */ -export type SnapshotObjectType = 'FaceList' | 'LargeFaceList' | 'LargePersonGroup' | 'PersonGroup'; - -/** - * Defines values for OperationStatusType. - * Possible values include: 'notstarted', 'running', 'succeeded', 'failed' - * @readonly - * @enum {string} - */ -export type OperationStatusType = 'notstarted' | 'running' | 'succeeded' | 'failed'; - -/** - * Defines values for FaceAttributeType. - * Possible values include: 'age', 'gender', 'headPose', 'smile', 'facialHair', 'glasses', - * 'emotion', 'hair', 'makeup', 'occlusion', 'accessories', 'blur', 'exposure', 'noise', 'mask', - * 'qualityForRecognition' - * @readonly - * @enum {string} - */ -export type FaceAttributeType = 'age' | 'gender' | 'headPose' | 'smile' | 'facialHair' | 'glasses' | 'emotion' | 'hair' | 'makeup' | 'occlusion' | 'accessories' | 'blur' | 'exposure' | 'noise' | 'mask' | 'qualityForRecognition'; - -/** - * Defines values for DetectionModel. - * Possible values include: 'detection_01', 'detection_02', 'detection_03' - * @readonly - * @enum {string} - */ -export type DetectionModel = 'detection_01' | 'detection_02' | 'detection_03'; - -/** - * Contains response data for the findSimilar operation. - */ -export type FaceFindSimilarResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SimilarFace[]; - }; -}; - -/** - * Contains response data for the group operation. - */ -export type FaceGroupResponse = GroupResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: GroupResult; - }; -}; - -/** - * Contains response data for the identify operation. - */ -export type FaceIdentifyResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: IdentifyResult[]; - }; -}; - -/** - * Contains response data for the verifyFaceToFace operation. - */ -export type FaceVerifyFaceToFaceResponse = VerifyResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: VerifyResult; - }; -}; - -/** - * Contains response data for the detectWithUrl operation. - */ -export type FaceDetectWithUrlResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DetectedFace[]; - }; -}; - -/** - * Contains response data for the verifyFaceToPerson operation. - */ -export type FaceVerifyFaceToPersonResponse = VerifyResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: VerifyResult; - }; -}; - -/** - * Contains response data for the detectWithStream operation. - */ -export type FaceDetectWithStreamResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DetectedFace[]; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type PersonGroupPersonCreateResponse = Person & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Person; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type PersonGroupPersonListResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Person[]; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type PersonGroupPersonGetResponse = Person & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Person; - }; -}; - -/** - * Contains response data for the getFace operation. - */ -export type PersonGroupPersonGetFaceResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the addFaceFromUrl operation. - */ -export type PersonGroupPersonAddFaceFromUrlResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the addFaceFromStream operation. - */ -export type PersonGroupPersonAddFaceFromStreamResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type PersonGroupGetResponse = PersonGroup & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersonGroup; - }; -}; +/** Contains response data for the list operation. */ +export type SnapshotListResponse = Snapshot[]; -/** - * Contains response data for the getTrainingStatus operation. - */ -export type PersonGroupGetTrainingStatusResponse = TrainingStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: TrainingStatus; - }; -}; +/** Optional parameters. */ +export interface SnapshotGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the list operation. - */ -export type PersonGroupListResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersonGroup[]; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type FaceListGetResponse = FaceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: FaceList; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type FaceListListResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: FaceList[]; - }; -}; - -/** - * Contains response data for the addFaceFromUrl operation. - */ -export type FaceListAddFaceFromUrlResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the addFaceFromStream operation. - */ -export type FaceListAddFaceFromStreamResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type LargePersonGroupPersonCreateResponse = Person & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Person; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type LargePersonGroupPersonListResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Person[]; - }; -}; +/** Contains response data for the get operation. */ +export type SnapshotGetResponse = Snapshot; -/** - * Contains response data for the get operation. - */ -export type LargePersonGroupPersonGetResponse = Person & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Person; - }; -}; - -/** - * Contains response data for the getFace operation. - */ -export type LargePersonGroupPersonGetFaceResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the addFaceFromUrl operation. - */ -export type LargePersonGroupPersonAddFaceFromUrlResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the addFaceFromStream operation. - */ -export type LargePersonGroupPersonAddFaceFromStreamResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type LargePersonGroupGetResponse = LargePersonGroup & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: LargePersonGroup; - }; -}; - -/** - * Contains response data for the getTrainingStatus operation. - */ -export type LargePersonGroupGetTrainingStatusResponse = TrainingStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: TrainingStatus; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type LargePersonGroupListResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: LargePersonGroup[]; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type LargeFaceListGetResponse = LargeFaceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: LargeFaceList; - }; -}; - -/** - * Contains response data for the getTrainingStatus operation. - */ -export type LargeFaceListGetTrainingStatusResponse = TrainingStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: TrainingStatus; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type LargeFaceListListResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: LargeFaceList[]; - }; -}; - -/** - * Contains response data for the getFace operation. - */ -export type LargeFaceListGetFaceResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the addFaceFromUrl operation. - */ -export type LargeFaceListAddFaceFromUrlResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; - -/** - * Contains response data for the listFaces operation. - */ -export type LargeFaceListListFacesResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace[]; - }; -}; +/** Optional parameters. */ +export interface SnapshotUpdateOptionalParams + extends coreClient.OperationOptions { + /** Array of the target Face subscription ids for the snapshot, specified by the user who created the snapshot when calling Snapshot - Take. For each snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. */ + applyScope?: string[]; + /** User specified data about the snapshot for any purpose. Length should not exceed 16KB. */ + userData?: string; +} -/** - * Contains response data for the addFaceFromStream operation. - */ -export type LargeFaceListAddFaceFromStreamResponse = PersistedFace & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PersistedFace; - }; -}; +/** Optional parameters. */ +export interface SnapshotDeleteOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the take operation. - */ -export type SnapshotTakeResponse = SnapshotTakeHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: SnapshotTakeHeaders; - }; -}; +/** Optional parameters. */ +export interface SnapshotApplyOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the list operation. - */ -export type SnapshotListResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Snapshot[]; - }; -}; +/** Contains response data for the apply operation. */ +export type SnapshotApplyResponse = SnapshotApplyHeaders; -/** - * Contains response data for the get operation. - */ -export type SnapshotGetResponse = Snapshot & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Snapshot; - }; -}; +/** Optional parameters. */ +export interface SnapshotGetOperationStatusOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the apply operation. - */ -export type SnapshotApplyResponse = SnapshotApplyHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: SnapshotApplyHeaders; - }; -}; +/** Contains response data for the getOperationStatus operation. */ +export type SnapshotGetOperationStatusResponse = OperationStatus; -/** - * Contains response data for the getOperationStatus operation. - */ -export type SnapshotGetOperationStatusResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; +/** Optional parameters. */ +export interface FaceClientOptionalParams + extends coreClient.ServiceClientOptions { + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/largeFaceListOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/largeFaceListOperationsMappers.ts deleted file mode 100644 index 20e358ef7056..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/largeFaceListOperationsMappers.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - APIError, - ErrorModel, - FaceList, - ImageUrl, - LargeFaceList, - LargePersonGroup, - MetaDataContract, - NameAndUserDataContract, - NonNullableNameAndNullableUserDataContract, - PersistedFace, - Person, - PersonGroup, - TrainingStatus, - UpdateFaceRequest -} from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupOperationsMappers.ts deleted file mode 100644 index cf3b2057ebfc..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupOperationsMappers.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - APIError, - ErrorModel, - FaceList, - LargeFaceList, - LargePersonGroup, - MetaDataContract, - NameAndUserDataContract, - NonNullableNameAndNullableUserDataContract, - PersistedFace, - Person, - PersonGroup, - TrainingStatus -} from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupPersonMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupPersonMappers.ts deleted file mode 100644 index 84d8f6bba2b6..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupPersonMappers.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - APIError, - ErrorModel, - ImageUrl, - NameAndUserDataContract, - PersistedFace, - Person, - UpdateFaceRequest -} from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/mappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/mappers.ts index 7de7fc39afa4..dc7df9476540 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/mappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/mappers.ts @@ -1,38 +1,115 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; - -export const ErrorModel: msRest.CompositeMapper = { - serializedName: "Error", +export const FindSimilarRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ErrorModel", + className: "FindSimilarRequest", modelProperties: { - code: { - serializedName: "code", + faceId: { + serializedName: "faceId", + required: true, + type: { + name: "Uuid" + } + }, + faceListId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "faceListId", type: { name: "String" } }, - message: { - serializedName: "message", + largeFaceListId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "largeFaceListId", type: { name: "String" } + }, + faceIds: { + constraints: { + MaxItems: 1000 + }, + serializedName: "faceIds", + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + }, + maxNumOfCandidatesReturned: { + defaultValue: 20, + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + serializedName: "maxNumOfCandidatesReturned", + type: { + name: "Number" + } + }, + mode: { + defaultValue: "matchPerson", + serializedName: "mode", + type: { + name: "Enum", + allowedValues: ["matchPerson", "matchFace"] + } + } + } + } +}; + +export const SimilarFace: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SimilarFace", + modelProperties: { + faceId: { + serializedName: "faceId", + type: { + name: "Uuid" + } + }, + persistedFaceId: { + serializedName: "persistedFaceId", + type: { + name: "Uuid" + } + }, + confidence: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "confidence", + required: true, + type: { + name: "Number" + } } } } }; -export const APIError: msRest.CompositeMapper = { - serializedName: "APIError", +export const APIError: coreClient.CompositeMapper = { type: { name: "Composite", className: "APIError", @@ -48,321 +125,591 @@ export const APIError: msRest.CompositeMapper = { } }; -export const FaceRectangle: msRest.CompositeMapper = { - serializedName: "FaceRectangle", +export const ErrorModel: coreClient.CompositeMapper = { type: { name: "Composite", - className: "FaceRectangle", + className: "ErrorModel", modelProperties: { - width: { - required: true, - serializedName: "width", - type: { - name: "Number" - } - }, - height: { - required: true, - serializedName: "height", + code: { + serializedName: "code", type: { - name: "Number" + name: "String" } }, - left: { - required: true, - serializedName: "left", + message: { + serializedName: "message", type: { - name: "Number" + name: "String" } - }, - top: { + } + } + } +}; + +export const GroupRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupRequest", + modelProperties: { + faceIds: { + constraints: { + MaxItems: 1000 + }, + serializedName: "faceIds", required: true, - serializedName: "top", type: { - name: "Number" + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } } } } } }; -export const Coordinate: msRest.CompositeMapper = { - serializedName: "Coordinate", +export const GroupResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Coordinate", + className: "GroupResult", modelProperties: { - x: { + groups: { + serializedName: "groups", required: true, - serializedName: "x", type: { - name: "Number" + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + } } }, - y: { - required: true, - serializedName: "y", + messyGroup: { + serializedName: "messyGroup", type: { - name: "Number" + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } } } } } }; -export const FaceLandmarks: msRest.CompositeMapper = { - serializedName: "FaceLandmarks", +export const IdentifyRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "FaceLandmarks", + className: "IdentifyRequest", modelProperties: { - pupilLeft: { - serializedName: "pupilLeft", - type: { - name: "Composite", - className: "Coordinate" - } - }, - pupilRight: { - serializedName: "pupilRight", + faceIds: { + constraints: { + MaxItems: 10 + }, + serializedName: "faceIds", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } } }, - noseTip: { - serializedName: "noseTip", + personGroupId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "personGroupId", type: { - name: "Composite", - className: "Coordinate" + name: "String" } }, - mouthLeft: { - serializedName: "mouthLeft", + largePersonGroupId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "largePersonGroupId", type: { - name: "Composite", - className: "Coordinate" + name: "String" } }, - mouthRight: { - serializedName: "mouthRight", + maxNumOfCandidatesReturned: { + defaultValue: 1, + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 1 + }, + serializedName: "maxNumOfCandidatesReturned", type: { - name: "Composite", - className: "Coordinate" + name: "Number" } }, - eyebrowLeftOuter: { - serializedName: "eyebrowLeftOuter", + confidenceThreshold: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "confidenceThreshold", type: { - name: "Composite", - className: "Coordinate" + name: "Number" } - }, - eyebrowLeftInner: { - serializedName: "eyebrowLeftInner", + } + } + } +}; + +export const IdentifyResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "IdentifyResult", + modelProperties: { + faceId: { + serializedName: "faceId", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "Uuid" } }, - eyeLeftOuter: { - serializedName: "eyeLeftOuter", + candidates: { + serializedName: "candidates", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "IdentifyCandidate" + } + } } - }, - eyeLeftTop: { - serializedName: "eyeLeftTop", + } + } + } +}; + +export const IdentifyCandidate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "IdentifyCandidate", + modelProperties: { + personId: { + serializedName: "personId", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "Uuid" } }, - eyeLeftBottom: { - serializedName: "eyeLeftBottom", + confidence: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "confidence", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "Number" } - }, - eyeLeftInner: { - serializedName: "eyeLeftInner", + } + } + } +}; + +export const VerifyFaceToFaceRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VerifyFaceToFaceRequest", + modelProperties: { + faceId1: { + serializedName: "faceId1", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "Uuid" } }, - eyebrowRightInner: { - serializedName: "eyebrowRightInner", + faceId2: { + serializedName: "faceId2", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "Uuid" + } + } + } + } +}; + +export const VerifyResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VerifyResult", + modelProperties: { + isIdentical: { + serializedName: "isIdentical", + required: true, + type: { + name: "Boolean" } }, - eyebrowRightOuter: { - serializedName: "eyebrowRightOuter", + confidence: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "confidence", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "Number" + } + } + } + } +}; + +export const NameAndUserDataContract: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NameAndUserDataContract", + modelProperties: { + name: { + constraints: { + MaxLength: 128 + }, + serializedName: "name", + type: { + name: "String" } }, - eyeRightInner: { - serializedName: "eyeRightInner", + userData: { + constraints: { + MaxLength: 16384 + }, + serializedName: "userData", type: { - name: "Composite", - className: "Coordinate" + name: "String" + } + } + } + } +}; + +export const PersistedFace: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PersistedFace", + modelProperties: { + persistedFaceId: { + serializedName: "persistedFaceId", + required: true, + type: { + name: "Uuid" } }, - eyeRightTop: { - serializedName: "eyeRightTop", + userData: { + constraints: { + MaxLength: 1024 + }, + serializedName: "userData", type: { - name: "Composite", - className: "Coordinate" + name: "String" + } + } + } + } +}; + +export const UpdateFaceRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateFaceRequest", + modelProperties: { + userData: { + constraints: { + MaxLength: 1024 + }, + serializedName: "userData", + type: { + name: "String" + } + } + } + } +}; + +export const NonNullableNameAndNullableUserDataContract: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NonNullableNameAndNullableUserDataContract", + modelProperties: { + name: { + constraints: { + MaxLength: 128, + MinLength: 1 + }, + serializedName: "name", + required: true, + type: { + name: "String" } }, - eyeRightBottom: { - serializedName: "eyeRightBottom", + userData: { + constraints: { + MaxLength: 16384 + }, + serializedName: "userData", type: { - name: "Composite", - className: "Coordinate" + name: "String" + } + } + } + } +}; + +export const PersonGroup: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PersonGroup", + modelProperties: { + personGroupId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "personGroupId", + required: true, + type: { + name: "String" } }, - eyeRightOuter: { - serializedName: "eyeRightOuter", + name: { + constraints: { + MaxLength: 128, + MinLength: 1 + }, + serializedName: "name", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "String" } }, - noseRootLeft: { - serializedName: "noseRootLeft", + userData: { + constraints: { + MaxLength: 16384 + }, + serializedName: "userData", type: { - name: "Composite", - className: "Coordinate" + name: "String" } }, - noseRootRight: { - serializedName: "noseRootRight", + recognitionModel: { + serializedName: "recognitionModel", type: { - name: "Composite", - className: "Coordinate" + name: "String" + } + } + } + } +}; + +export const TrainingStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrainingStatus", + modelProperties: { + status: { + serializedName: "status", + required: true, + type: { + name: "Enum", + allowedValues: ["nonstarted", "running", "succeeded", "failed"] } }, - noseLeftAlarTop: { - serializedName: "noseLeftAlarTop", + created: { + serializedName: "createdDateTime", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "DateTime" } }, - noseRightAlarTop: { - serializedName: "noseRightAlarTop", + lastAction: { + serializedName: "lastActionDateTime", type: { - name: "Composite", - className: "Coordinate" + name: "DateTime" } }, - noseLeftAlarOutTip: { - serializedName: "noseLeftAlarOutTip", + lastSuccessfulTraining: { + serializedName: "lastSuccessfulTrainingDateTime", type: { - name: "Composite", - className: "Coordinate" + name: "DateTime" } }, - noseRightAlarOutTip: { - serializedName: "noseRightAlarOutTip", + message: { + serializedName: "message", type: { - name: "Composite", - className: "Coordinate" + name: "String" + } + } + } + } +}; + +export const FaceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FaceList", + modelProperties: { + faceListId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "faceListId", + required: true, + type: { + name: "String" } }, - upperLipTop: { - serializedName: "upperLipTop", + name: { + constraints: { + MaxLength: 128, + MinLength: 1 + }, + serializedName: "name", + required: true, type: { - name: "Composite", - className: "Coordinate" + name: "String" } }, - upperLipBottom: { - serializedName: "upperLipBottom", + userData: { + constraints: { + MaxLength: 16384 + }, + serializedName: "userData", type: { - name: "Composite", - className: "Coordinate" + name: "String" } }, - underLipTop: { - serializedName: "underLipTop", + recognitionModel: { + serializedName: "recognitionModel", type: { - name: "Composite", - className: "Coordinate" + name: "String" } }, - underLipBottom: { - serializedName: "underLipBottom", + persistedFaces: { + serializedName: "persistedFaces", type: { - name: "Composite", - className: "Coordinate" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PersistedFace" + } + } } } } } }; -export const FacialHair: msRest.CompositeMapper = { - serializedName: "FacialHair", +export const ImageUrl: coreClient.CompositeMapper = { type: { name: "Composite", - className: "FacialHair", + className: "ImageUrl", modelProperties: { - moustache: { - nullable: false, - serializedName: "moustache", + url: { + serializedName: "url", + required: true, type: { - name: "Number" + name: "String" + } + } + } + } +}; + +export const DetectedFace: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DetectedFace", + modelProperties: { + faceId: { + serializedName: "faceId", + type: { + name: "Uuid" } }, - beard: { - nullable: false, - serializedName: "beard", + recognitionModel: { + serializedName: "recognitionModel", type: { - name: "Number" + name: "String" } }, - sideburns: { - nullable: false, - serializedName: "sideburns", + faceRectangle: { + serializedName: "faceRectangle", type: { - name: "Number" + name: "Composite", + className: "FaceRectangle" + } + }, + faceLandmarks: { + serializedName: "faceLandmarks", + type: { + name: "Composite", + className: "FaceLandmarks" + } + }, + faceAttributes: { + serializedName: "faceAttributes", + type: { + name: "Composite", + className: "FaceAttributes" } } } } }; -export const HeadPose: msRest.CompositeMapper = { - serializedName: "HeadPose", +export const FaceRectangle: coreClient.CompositeMapper = { type: { name: "Composite", - className: "HeadPose", + className: "FaceRectangle", modelProperties: { - roll: { - nullable: false, - serializedName: "roll", + width: { + serializedName: "width", + required: true, type: { name: "Number" } }, - yaw: { - nullable: false, - serializedName: "yaw", + height: { + serializedName: "height", + required: true, type: { name: "Number" } }, - pitch: { - nullable: false, - serializedName: "pitch", + left: { + serializedName: "left", + required: true, + type: { + name: "Number" + } + }, + top: { + serializedName: "top", + required: true, type: { name: "Number" } @@ -371,345 +718,228 @@ export const HeadPose: msRest.CompositeMapper = { } }; -export const Emotion: msRest.CompositeMapper = { - serializedName: "Emotion", +export const FaceLandmarks: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Emotion", + className: "FaceLandmarks", modelProperties: { - anger: { - nullable: false, - serializedName: "anger", + pupilLeft: { + serializedName: "pupilLeft", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } }, - contempt: { - nullable: false, - serializedName: "contempt", + pupilRight: { + serializedName: "pupilRight", type: { - name: "Number" + name: "Composite", + className: "Coordinate" + } + }, + noseTip: { + serializedName: "noseTip", + type: { + name: "Composite", + className: "Coordinate" } }, - disgust: { - nullable: false, - serializedName: "disgust", + mouthLeft: { + serializedName: "mouthLeft", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } }, - fear: { - nullable: false, - serializedName: "fear", + mouthRight: { + serializedName: "mouthRight", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } }, - happiness: { - nullable: false, - serializedName: "happiness", + eyebrowLeftOuter: { + serializedName: "eyebrowLeftOuter", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } }, - neutral: { - nullable: false, - serializedName: "neutral", + eyebrowLeftInner: { + serializedName: "eyebrowLeftInner", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } }, - sadness: { - nullable: false, - serializedName: "sadness", + eyeLeftOuter: { + serializedName: "eyeLeftOuter", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } }, - surprise: { - nullable: false, - serializedName: "surprise", + eyeLeftTop: { + serializedName: "eyeLeftTop", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } - } - } - } -}; - -export const HairColor: msRest.CompositeMapper = { - serializedName: "HairColor", - type: { - name: "Composite", - className: "HairColor", - modelProperties: { - color: { - nullable: false, - serializedName: "color", + }, + eyeLeftBottom: { + serializedName: "eyeLeftBottom", type: { - name: "Enum", - allowedValues: [ - "unknown", - "white", - "gray", - "blond", - "brown", - "red", - "black", - "other" - ] + name: "Composite", + className: "Coordinate" } }, - confidence: { - nullable: false, - serializedName: "confidence", + eyeLeftInner: { + serializedName: "eyeLeftInner", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } - } - } - } -}; - -export const Hair: msRest.CompositeMapper = { - serializedName: "Hair", - type: { - name: "Composite", - className: "Hair", - modelProperties: { - bald: { - nullable: false, - serializedName: "bald", + }, + eyebrowRightInner: { + serializedName: "eyebrowRightInner", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } }, - invisible: { - nullable: false, - serializedName: "invisible", + eyebrowRightOuter: { + serializedName: "eyebrowRightOuter", type: { - name: "Boolean" + name: "Composite", + className: "Coordinate" } }, - hairColor: { - serializedName: "hairColor", + eyeRightInner: { + serializedName: "eyeRightInner", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "HairColor" - } - } + name: "Composite", + className: "Coordinate" } - } - } - } -}; - -export const Makeup: msRest.CompositeMapper = { - serializedName: "Makeup", - type: { - name: "Composite", - className: "Makeup", - modelProperties: { - eyeMakeup: { - nullable: false, - serializedName: "eyeMakeup", + }, + eyeRightTop: { + serializedName: "eyeRightTop", type: { - name: "Boolean" + name: "Composite", + className: "Coordinate" } }, - lipMakeup: { - nullable: false, - serializedName: "lipMakeup", + eyeRightBottom: { + serializedName: "eyeRightBottom", type: { - name: "Boolean" + name: "Composite", + className: "Coordinate" } - } - } - } -}; - -export const Occlusion: msRest.CompositeMapper = { - serializedName: "Occlusion", - type: { - name: "Composite", - className: "Occlusion", - modelProperties: { - foreheadOccluded: { - nullable: false, - serializedName: "foreheadOccluded", + }, + eyeRightOuter: { + serializedName: "eyeRightOuter", type: { - name: "Boolean" + name: "Composite", + className: "Coordinate" } }, - eyeOccluded: { - nullable: false, - serializedName: "eyeOccluded", + noseRootLeft: { + serializedName: "noseRootLeft", type: { - name: "Boolean" + name: "Composite", + className: "Coordinate" } }, - mouthOccluded: { - nullable: false, - serializedName: "mouthOccluded", + noseRootRight: { + serializedName: "noseRootRight", type: { - name: "Boolean" + name: "Composite", + className: "Coordinate" } - } - } - } -}; - -export const Accessory: msRest.CompositeMapper = { - serializedName: "Accessory", - type: { - name: "Composite", - className: "Accessory", - modelProperties: { - type: { - nullable: false, - serializedName: "type", + }, + noseLeftAlarTop: { + serializedName: "noseLeftAlarTop", type: { - name: "Enum", - allowedValues: [ - "headWear", - "glasses", - "mask" - ] + name: "Composite", + className: "Coordinate" } }, - confidence: { - nullable: false, - serializedName: "confidence", + noseRightAlarTop: { + serializedName: "noseRightAlarTop", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } - } - } - } -}; - -export const Blur: msRest.CompositeMapper = { - serializedName: "Blur", - type: { - name: "Composite", - className: "Blur", - modelProperties: { - blurLevel: { - nullable: false, - serializedName: "blurLevel", + }, + noseLeftAlarOutTip: { + serializedName: "noseLeftAlarOutTip", type: { - name: "Enum", - allowedValues: [ - "Low", - "Medium", - "High" - ] + name: "Composite", + className: "Coordinate" } }, - value: { - nullable: false, - serializedName: "value", + noseRightAlarOutTip: { + serializedName: "noseRightAlarOutTip", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } - } - } - } -}; - -export const Exposure: msRest.CompositeMapper = { - serializedName: "Exposure", - type: { - name: "Composite", - className: "Exposure", - modelProperties: { - exposureLevel: { - nullable: false, - serializedName: "exposureLevel", + }, + upperLipTop: { + serializedName: "upperLipTop", type: { - name: "Enum", - allowedValues: [ - "UnderExposure", - "GoodExposure", - "OverExposure" - ] + name: "Composite", + className: "Coordinate" } }, - value: { - nullable: false, - serializedName: "value", + upperLipBottom: { + serializedName: "upperLipBottom", type: { - name: "Number" - } - } - } - } -}; - -export const Noise: msRest.CompositeMapper = { - serializedName: "Noise", - type: { - name: "Composite", - className: "Noise", - modelProperties: { - noiseLevel: { - nullable: false, - serializedName: "noiseLevel", + name: "Composite", + className: "Coordinate" + } + }, + underLipTop: { + serializedName: "underLipTop", type: { - name: "Enum", - allowedValues: [ - "Low", - "Medium", - "High" - ] + name: "Composite", + className: "Coordinate" } }, - value: { - nullable: false, - serializedName: "value", + underLipBottom: { + serializedName: "underLipBottom", type: { - name: "Number" + name: "Composite", + className: "Coordinate" } } } } }; -export const Mask: msRest.CompositeMapper = { - serializedName: "Mask", +export const Coordinate: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Mask", + className: "Coordinate", modelProperties: { - type: { - nullable: false, - serializedName: "type", + x: { + serializedName: "x", + required: true, type: { - name: "Enum", - allowedValues: [ - "noMask", - "faceMask", - "otherMaskOrOcclusion", - "uncertain" - ] + name: "Number" } }, - noseAndMouthCovered: { - nullable: false, - serializedName: "noseAndMouthCovered", + y: { + serializedName: "y", + required: true, type: { - name: "Boolean" + name: "Number" } } } } }; -export const FaceAttributes: msRest.CompositeMapper = { - serializedName: "FaceAttributes", +export const FaceAttributes: coreClient.CompositeMapper = { type: { name: "Composite", className: "FaceAttributes", @@ -724,13 +954,14 @@ export const FaceAttributes: msRest.CompositeMapper = { serializedName: "gender", type: { name: "Enum", - allowedValues: [ - "male", - "female" - ] + allowedValues: ["male", "female"] } }, smile: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, serializedName: "smile", type: { name: "Number" @@ -834,158 +1065,71 @@ export const FaceAttributes: msRest.CompositeMapper = { serializedName: "qualityForRecognition", type: { name: "Enum", - allowedValues: [ - "Low", - "Medium", - "High" - ] - } - } - } - } -}; - -export const DetectedFace: msRest.CompositeMapper = { - serializedName: "DetectedFace", - type: { - name: "Composite", - className: "DetectedFace", - modelProperties: { - faceId: { - serializedName: "faceId", - type: { - name: "Uuid" - } - }, - recognitionModel: { - nullable: false, - serializedName: "recognitionModel", - defaultValue: 'recognition_01', - type: { - name: "String" - } - }, - faceRectangle: { - required: true, - serializedName: "faceRectangle", - type: { - name: "Composite", - className: "FaceRectangle" - } - }, - faceLandmarks: { - serializedName: "faceLandmarks", - type: { - name: "Composite", - className: "FaceLandmarks" - } - }, - faceAttributes: { - serializedName: "faceAttributes", - type: { - name: "Composite", - className: "FaceAttributes" + allowedValues: ["Low", "Medium", "High"] } } } } }; -export const FindSimilarRequest: msRest.CompositeMapper = { - serializedName: "FindSimilarRequest", +export const FacialHair: coreClient.CompositeMapper = { type: { name: "Composite", - className: "FindSimilarRequest", + className: "FacialHair", modelProperties: { - faceId: { - required: true, - serializedName: "faceId", - type: { - name: "Uuid" - } - }, - faceListId: { - serializedName: "faceListId", - constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ - }, - type: { - name: "String" - } - }, - largeFaceListId: { - serializedName: "largeFaceListId", + moustache: { constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "moustache", type: { - name: "String" + name: "Number" } }, - faceIds: { - serializedName: "faceIds", + beard: { constraints: { - MaxItems: 1000 + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "beard", type: { - name: "Sequence", - element: { - type: { - name: "Uuid" - } - } + name: "Number" } }, - maxNumOfCandidatesReturned: { - serializedName: "maxNumOfCandidatesReturned", - defaultValue: 20, + sideburns: { constraints: { - InclusiveMaximum: 1000, - InclusiveMinimum: 1 + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "sideburns", type: { name: "Number" } - }, - mode: { - nullable: false, - serializedName: "mode", - defaultValue: 'matchPerson', - type: { - name: "Enum", - allowedValues: [ - "matchPerson", - "matchFace" - ] - } } } } }; -export const SimilarFace: msRest.CompositeMapper = { - serializedName: "SimilarFace", +export const HeadPose: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SimilarFace", + className: "HeadPose", modelProperties: { - faceId: { - serializedName: "faceId", + roll: { + serializedName: "roll", type: { - name: "Uuid" + name: "Number" } }, - persistedFaceId: { - serializedName: "persistedFaceId", + yaw: { + serializedName: "yaw", type: { - name: "Uuid" + name: "Number" } }, - confidence: { - required: true, - serializedName: "confidence", + pitch: { + serializedName: "pitch", type: { name: "Number" } @@ -994,123 +1138,87 @@ export const SimilarFace: msRest.CompositeMapper = { } }; -export const GroupRequest: msRest.CompositeMapper = { - serializedName: "GroupRequest", +export const Emotion: coreClient.CompositeMapper = { type: { name: "Composite", - className: "GroupRequest", + className: "Emotion", modelProperties: { - faceIds: { - required: true, - serializedName: "faceIds", + anger: { constraints: { - MaxItems: 1000 + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "anger", type: { - name: "Sequence", - element: { - type: { - name: "Uuid" - } - } + name: "Number" } - } - } - } -}; - -export const GroupResult: msRest.CompositeMapper = { - serializedName: "GroupResult", - type: { - name: "Composite", - className: "GroupResult", - modelProperties: { - groups: { - required: true, - serializedName: "groups", + }, + contempt: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "contempt", type: { - name: "Sequence", - element: { - type: { - name: "Sequence", - element: { - type: { - name: "Uuid" - } - } - } - } + name: "Number" } }, - messyGroup: { - serializedName: "messyGroup", + disgust: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "disgust", type: { - name: "Sequence", - element: { - type: { - name: "Uuid" - } - } + name: "Number" } - } - } - } -}; - -export const IdentifyRequest: msRest.CompositeMapper = { - serializedName: "IdentifyRequest", - type: { - name: "Composite", - className: "IdentifyRequest", - modelProperties: { - faceIds: { - required: true, - serializedName: "faceIds", + }, + fear: { constraints: { - MaxItems: 10 + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "fear", type: { - name: "Sequence", - element: { - type: { - name: "Uuid" - } - } + name: "Number" } }, - personGroupId: { - serializedName: "personGroupId", + happiness: { constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "happiness", type: { - name: "String" + name: "Number" } }, - largePersonGroupId: { - serializedName: "largePersonGroupId", + neutral: { constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "neutral", type: { - name: "String" + name: "Number" } }, - maxNumOfCandidatesReturned: { - serializedName: "maxNumOfCandidatesReturned", - defaultValue: 1, + sadness: { constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 1 + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "sadness", type: { name: "Number" } }, - confidenceThreshold: { - serializedName: "confidenceThreshold", + surprise: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "surprise", type: { name: "Number" } @@ -1119,52 +1227,35 @@ export const IdentifyRequest: msRest.CompositeMapper = { } }; -export const IdentifyCandidate: msRest.CompositeMapper = { - serializedName: "IdentifyCandidate", +export const Hair: coreClient.CompositeMapper = { type: { name: "Composite", - className: "IdentifyCandidate", + className: "Hair", modelProperties: { - personId: { - required: true, - serializedName: "personId", - type: { - name: "Uuid" - } - }, - confidence: { - required: true, - serializedName: "confidence", + bald: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "bald", type: { name: "Number" } - } - } - } -}; - -export const IdentifyResult: msRest.CompositeMapper = { - serializedName: "IdentifyResult", - type: { - name: "Composite", - className: "IdentifyResult", - modelProperties: { - faceId: { - required: true, - serializedName: "faceId", + }, + invisible: { + serializedName: "invisible", type: { - name: "Uuid" + name: "Boolean" } }, - candidates: { - required: true, - serializedName: "candidates", + hairColor: { + serializedName: "hairColor", type: { name: "Sequence", element: { type: { name: "Composite", - className: "IdentifyCandidate" + className: "HairColor" } } } @@ -1173,89 +1264,106 @@ export const IdentifyResult: msRest.CompositeMapper = { } }; -export const VerifyFaceToPersonRequest: msRest.CompositeMapper = { - serializedName: "VerifyFaceToPersonRequest", +export const HairColor: coreClient.CompositeMapper = { type: { name: "Composite", - className: "VerifyFaceToPersonRequest", + className: "HairColor", modelProperties: { - faceId: { - required: true, - serializedName: "faceId", + color: { + serializedName: "color", type: { - name: "Uuid" + name: "Enum", + allowedValues: [ + "unknown", + "white", + "gray", + "blond", + "brown", + "red", + "black", + "other" + ] } }, - personGroupId: { - serializedName: "personGroupId", + confidence: { constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "confidence", type: { - name: "String" + name: "Number" } - }, - largePersonGroupId: { - serializedName: "largePersonGroupId", - constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ - }, + } + } + } +}; + +export const Makeup: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Makeup", + modelProperties: { + eyeMakeup: { + serializedName: "eyeMakeup", type: { - name: "String" + name: "Boolean" } }, - personId: { - required: true, - serializedName: "personId", + lipMakeup: { + serializedName: "lipMakeup", type: { - name: "Uuid" + name: "Boolean" } } } } }; -export const VerifyFaceToFaceRequest: msRest.CompositeMapper = { - serializedName: "VerifyFaceToFaceRequest", +export const Occlusion: coreClient.CompositeMapper = { type: { name: "Composite", - className: "VerifyFaceToFaceRequest", + className: "Occlusion", modelProperties: { - faceId1: { - required: true, - serializedName: "faceId1", + foreheadOccluded: { + serializedName: "foreheadOccluded", type: { - name: "Uuid" + name: "Boolean" } }, - faceId2: { - required: true, - serializedName: "faceId2", + eyeOccluded: { + serializedName: "eyeOccluded", type: { - name: "Uuid" + name: "Boolean" + } + }, + mouthOccluded: { + serializedName: "mouthOccluded", + type: { + name: "Boolean" } } } } }; -export const VerifyResult: msRest.CompositeMapper = { - serializedName: "VerifyResult", +export const Accessory: coreClient.CompositeMapper = { type: { name: "Composite", - className: "VerifyResult", + className: "Accessory", modelProperties: { - isIdentical: { - required: true, - serializedName: "isIdentical", + type: { + serializedName: "type", type: { - name: "Boolean" + name: "Enum", + allowedValues: ["headWear", "glasses", "mask"] } }, confidence: { - required: true, + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, serializedName: "confidence", type: { name: "Number" @@ -1265,249 +1373,195 @@ export const VerifyResult: msRest.CompositeMapper = { } }; -export const PersistedFace: msRest.CompositeMapper = { - serializedName: "PersistedFace", +export const Blur: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PersistedFace", + className: "Blur", modelProperties: { - persistedFaceId: { - required: true, - serializedName: "persistedFaceId", + blurLevel: { + serializedName: "blurLevel", type: { - name: "Uuid" + name: "Enum", + allowedValues: ["Low", "Medium", "High"] } }, - userData: { - serializedName: "userData", + value: { constraints: { - MaxLength: 1024 + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "value", type: { - name: "String" + name: "Number" } } } } }; -export const NonNullableNameAndNullableUserDataContract: msRest.CompositeMapper = { - serializedName: "NonNullableNameAndNullableUserDataContract", +export const Exposure: coreClient.CompositeMapper = { type: { name: "Composite", - className: "NonNullableNameAndNullableUserDataContract", + className: "Exposure", modelProperties: { - name: { - required: true, - serializedName: "name", - constraints: { - MaxLength: 128, - MinLength: 1 - }, + exposureLevel: { + serializedName: "exposureLevel", type: { - name: "String" + name: "Enum", + allowedValues: ["UnderExposure", "GoodExposure", "OverExposure"] } }, - userData: { - serializedName: "userData", + value: { constraints: { - MaxLength: 16384 + InclusiveMaximum: 1, + InclusiveMinimum: 0 }, + serializedName: "value", type: { - name: "String" + name: "Number" } } } } }; -export const MetaDataContract: msRest.CompositeMapper = { - serializedName: "MetaDataContract", +export const Noise: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MetaDataContract", + className: "Noise", modelProperties: { - ...NonNullableNameAndNullableUserDataContract.type.modelProperties, - recognitionModel: { - nullable: false, - serializedName: "recognitionModel", - defaultValue: 'recognition_01', + noiseLevel: { + serializedName: "noiseLevel", type: { - name: "String" + name: "Enum", + allowedValues: ["Low", "Medium", "High"] + } + }, + value: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 0 + }, + serializedName: "value", + type: { + name: "Number" } } } } }; -export const FaceList: msRest.CompositeMapper = { - serializedName: "FaceList", +export const Mask: coreClient.CompositeMapper = { type: { name: "Composite", - className: "FaceList", + className: "Mask", modelProperties: { - ...MetaDataContract.type.modelProperties, - faceListId: { - required: true, - serializedName: "faceListId", - constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ - }, + type: { + serializedName: "type", type: { - name: "String" + name: "Enum", + allowedValues: [ + "noMask", + "faceMask", + "otherMaskOrOcclusion", + "uncertain" + ] } }, - persistedFaces: { - serializedName: "persistedFaces", + noseAndMouthCovered: { + serializedName: "noseAndMouthCovered", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PersistedFace" - } - } + name: "Boolean" } } } } }; -export const PersonGroup: msRest.CompositeMapper = { - serializedName: "PersonGroup", +export const LargePersonGroup: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PersonGroup", + className: "LargePersonGroup", modelProperties: { - ...MetaDataContract.type.modelProperties, - personGroupId: { - required: true, - serializedName: "personGroupId", + largePersonGroupId: { constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 }, + serializedName: "largePersonGroupId", + required: true, type: { name: "String" } - } - } - } -}; - -export const NameAndUserDataContract: msRest.CompositeMapper = { - serializedName: "NameAndUserDataContract", - type: { - name: "Composite", - className: "NameAndUserDataContract", - modelProperties: { + }, name: { - serializedName: "name", constraints: { - MaxLength: 128 + MaxLength: 128, + MinLength: 1 }, + serializedName: "name", + required: true, type: { name: "String" } }, userData: { - serializedName: "userData", constraints: { MaxLength: 16384 }, + serializedName: "userData", type: { name: "String" } - } - } - } -}; - -export const Person: msRest.CompositeMapper = { - serializedName: "Person", - type: { - name: "Composite", - className: "Person", - modelProperties: { - ...NameAndUserDataContract.type.modelProperties, - personId: { - required: true, - serializedName: "personId", - type: { - name: "Uuid" - } }, - persistedFaceIds: { - serializedName: "persistedFaceIds", + recognitionModel: { + serializedName: "recognitionModel", type: { - name: "Sequence", - element: { - type: { - name: "Uuid" - } - } + name: "String" } } } } }; -export const LargeFaceList: msRest.CompositeMapper = { - serializedName: "LargeFaceList", +export const LargeFaceList: coreClient.CompositeMapper = { type: { name: "Composite", className: "LargeFaceList", modelProperties: { - ...MetaDataContract.type.modelProperties, largeFaceListId: { - required: true, - serializedName: "largeFaceListId", constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 }, + serializedName: "largeFaceListId", + required: true, type: { name: "String" } - } - } - } -}; - -export const LargePersonGroup: msRest.CompositeMapper = { - serializedName: "LargePersonGroup", - type: { - name: "Composite", - className: "LargePersonGroup", - modelProperties: { - ...MetaDataContract.type.modelProperties, - largePersonGroupId: { - required: true, - serializedName: "largePersonGroupId", + }, + name: { constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + MaxLength: 128, + MinLength: 1 }, + serializedName: "name", + required: true, type: { name: "String" } - } - } - } -}; - -export const UpdateFaceRequest: msRest.CompositeMapper = { - serializedName: "UpdateFaceRequest", - type: { - name: "Composite", - className: "UpdateFaceRequest", - modelProperties: { + }, userData: { - serializedName: "userData", constraints: { - MaxLength: 1024 + MaxLength: 16384 }, + serializedName: "userData", + type: { + name: "String" + } + }, + recognitionModel: { + serializedName: "recognitionModel", type: { name: "String" } @@ -1516,109 +1570,82 @@ export const UpdateFaceRequest: msRest.CompositeMapper = { } }; -export const TrainingStatus: msRest.CompositeMapper = { - serializedName: "TrainingStatus", +export const TakeSnapshotRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TrainingStatus", + className: "TakeSnapshotRequest", modelProperties: { - status: { + type: { + serializedName: "type", required: true, - serializedName: "status", type: { name: "Enum", allowedValues: [ - "nonstarted", - "running", - "succeeded", - "failed" + "FaceList", + "LargeFaceList", + "LargePersonGroup", + "PersonGroup" ] } }, - created: { + objectId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "objectId", required: true, - serializedName: "createdDateTime", - type: { - name: "DateTime" - } - }, - lastAction: { - serializedName: "lastActionDateTime", type: { - name: "DateTime" + name: "String" } }, - lastSuccessfulTraining: { - serializedName: "lastSuccessfulTrainingDateTime", + applyScope: { + serializedName: "applyScope", + required: true, type: { - name: "DateTime" + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } } }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const ApplySnapshotRequest: msRest.CompositeMapper = { - serializedName: "ApplySnapshotRequest", - type: { - name: "Composite", - className: "ApplySnapshotRequest", - modelProperties: { - objectId: { - required: true, - serializedName: "objectId", + userData: { constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + MaxLength: 16384 }, + serializedName: "userData", type: { name: "String" } - }, - mode: { - nullable: false, - serializedName: "mode", - defaultValue: 'CreateNew', - type: { - name: "Enum", - allowedValues: [ - "CreateNew" - ] - } } } } }; -export const Snapshot: msRest.CompositeMapper = { - serializedName: "Snapshot", +export const Snapshot: coreClient.CompositeMapper = { type: { name: "Composite", className: "Snapshot", modelProperties: { id: { - required: true, serializedName: "id", + required: true, type: { name: "Uuid" } }, account: { - required: true, serializedName: "account", + required: true, type: { name: "String" } }, type: { - required: true, serializedName: "type", + required: true, type: { name: "Enum", allowedValues: [ @@ -1630,8 +1657,8 @@ export const Snapshot: msRest.CompositeMapper = { } }, applyScope: { - required: true, serializedName: "applyScope", + required: true, type: { name: "Sequence", element: { @@ -1642,24 +1669,24 @@ export const Snapshot: msRest.CompositeMapper = { } }, userData: { - serializedName: "userData", constraints: { MaxLength: 16384 }, + serializedName: "userData", type: { name: "String" } }, createdTime: { - required: true, serializedName: "createdTime", + required: true, type: { name: "DateTime" } }, lastUpdateTime: { - required: true, serializedName: "lastUpdateTime", + required: true, type: { name: "DateTime" } @@ -1668,38 +1695,12 @@ export const Snapshot: msRest.CompositeMapper = { } }; -export const TakeSnapshotRequest: msRest.CompositeMapper = { - serializedName: "TakeSnapshotRequest", +export const UpdateSnapshotRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TakeSnapshotRequest", + className: "UpdateSnapshotRequest", modelProperties: { - type: { - required: true, - serializedName: "type", - type: { - name: "Enum", - allowedValues: [ - "FaceList", - "LargeFaceList", - "LargePersonGroup", - "PersonGroup" - ] - } - }, - objectId: { - required: true, - serializedName: "objectId", - constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ - }, - type: { - name: "String" - } - }, applyScope: { - required: true, serializedName: "applyScope", type: { name: "Sequence", @@ -1711,10 +1712,10 @@ export const TakeSnapshotRequest: msRest.CompositeMapper = { } }, userData: { - serializedName: "userData", constraints: { MaxLength: 16384 }, + serializedName: "userData", type: { name: "String" } @@ -1723,28 +1724,26 @@ export const TakeSnapshotRequest: msRest.CompositeMapper = { } }; -export const UpdateSnapshotRequest: msRest.CompositeMapper = { - serializedName: "UpdateSnapshotRequest", +export const ApplySnapshotRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "UpdateSnapshotRequest", + className: "ApplySnapshotRequest", modelProperties: { - applyScope: { - serializedName: "applyScope", + objectId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "objectId", + required: true, type: { - name: "Sequence", - element: { - type: { - name: "Uuid" - } - } + name: "String" } }, - userData: { - serializedName: "userData", - constraints: { - MaxLength: 16384 - }, + mode: { + defaultValue: "CreateNew", + isConstant: true, + serializedName: "mode", type: { name: "String" } @@ -1753,28 +1752,22 @@ export const UpdateSnapshotRequest: msRest.CompositeMapper = { } }; -export const OperationStatus: msRest.CompositeMapper = { - serializedName: "OperationStatus", +export const OperationStatus: coreClient.CompositeMapper = { type: { name: "Composite", className: "OperationStatus", modelProperties: { status: { - required: true, serializedName: "status", + required: true, type: { name: "Enum", - allowedValues: [ - "notstarted", - "running", - "succeeded", - "failed" - ] + allowedValues: ["notstarted", "running", "succeeded", "failed"] } }, createdTime: { - required: true, serializedName: "createdTime", + required: true, type: { name: "DateTime" } @@ -1801,15 +1794,85 @@ export const OperationStatus: msRest.CompositeMapper = { } }; -export const ImageUrl: msRest.CompositeMapper = { - serializedName: "ImageUrl", +export const VerifyFaceToPersonRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ImageUrl", + className: "VerifyFaceToPersonRequest", modelProperties: { - url: { + faceId: { + serializedName: "faceId", required: true, - serializedName: "url", + type: { + name: "Uuid" + } + }, + personGroupId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "personGroupId", + type: { + name: "String" + } + }, + largePersonGroupId: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "largePersonGroupId", + type: { + name: "String" + } + }, + personId: { + serializedName: "personId", + required: true, + type: { + name: "Uuid" + } + } + } + } +}; + +export const Person: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Person", + modelProperties: { + ...NameAndUserDataContract.type.modelProperties, + personId: { + serializedName: "personId", + required: true, + type: { + name: "Uuid" + } + }, + persistedFaceIds: { + serializedName: "persistedFaceIds", + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + } + } + } +}; + +export const MetaDataContract: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetaDataContract", + modelProperties: { + ...NonNullableNameAndNullableUserDataContract.type.modelProperties, + recognitionModel: { + serializedName: "recognitionModel", type: { name: "String" } @@ -1818,8 +1881,7 @@ export const ImageUrl: msRest.CompositeMapper = { } }; -export const SnapshotTakeHeaders: msRest.CompositeMapper = { - serializedName: "snapshot-take-headers", +export const SnapshotTakeHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "SnapshotTakeHeaders", @@ -1834,8 +1896,7 @@ export const SnapshotTakeHeaders: msRest.CompositeMapper = { } }; -export const SnapshotApplyHeaders: msRest.CompositeMapper = { - serializedName: "snapshot-apply-headers", +export const SnapshotApplyHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "SnapshotApplyHeaders", diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/parameters.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/parameters.ts index b709c276a0a0..a8bffca35c3c 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/parameters.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/parameters.ts @@ -1,291 +1,391 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + FindSimilarRequest as FindSimilarRequestMapper, + GroupRequest as GroupRequestMapper, + IdentifyRequest as IdentifyRequestMapper, + VerifyFaceToFaceRequest as VerifyFaceToFaceRequestMapper, + ImageUrl as ImageUrlMapper, + VerifyFaceToPersonRequest as VerifyFaceToPersonRequestMapper, + NameAndUserDataContract as NameAndUserDataContractMapper, + UpdateFaceRequest as UpdateFaceRequestMapper, + MetaDataContract as MetaDataContractMapper, + TakeSnapshotRequest as TakeSnapshotRequestMapper, + UpdateSnapshotRequest as UpdateSnapshotRequestMapper, + ApplySnapshotRequest as ApplySnapshotRequestMapper +} from "../models/mappers"; -export const applyScope: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "applyScope" - ], +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - serializedName: "applyScope", + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { - name: "Sequence", - element: { - type: { - name: "Uuid" - } - } + name: "String" } - }, - collectionFormat: msRest.QueryCollectionFormat.Csv + } }; -export const detectionModel: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "detectionModel" - ], + +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "detectionModel", - defaultValue: 'detection_01', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const endpoint: msRest.OperationURLParameter = { + +export const faceId: OperationParameter = { + parameterPath: "faceId", + mapper: FindSimilarRequestMapper +}; + +export const faceListId: OperationParameter = { + parameterPath: ["options", "faceListId"], + mapper: FindSimilarRequestMapper +}; + +export const largeFaceListId: OperationParameter = { + parameterPath: ["options", "largeFaceListId"], + mapper: FindSimilarRequestMapper +}; + +export const faceIds: OperationParameter = { + parameterPath: ["options", "faceIds"], + mapper: FindSimilarRequestMapper +}; + +export const maxNumOfCandidatesReturned: OperationParameter = { + parameterPath: ["options", "maxNumOfCandidatesReturned"], + mapper: FindSimilarRequestMapper +}; + +export const mode: OperationParameter = { + parameterPath: ["options", "mode"], + mapper: FindSimilarRequestMapper +}; + +export const endpoint: OperationURLParameter = { parameterPath: "endpoint", mapper: { - required: true, serializedName: "Endpoint", - defaultValue: '', + required: true, type: { name: "String" } }, skipEncoding: true }; -export const faceIdTimeToLive: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "faceIdTimeToLive" - ], + +export const faceIds1: OperationParameter = { + parameterPath: "faceIds", + mapper: GroupRequestMapper +}; + +export const faceIds2: OperationParameter = { + parameterPath: "faceIds", + mapper: IdentifyRequestMapper +}; + +export const personGroupId: OperationParameter = { + parameterPath: ["options", "personGroupId"], + mapper: IdentifyRequestMapper +}; + +export const largePersonGroupId: OperationParameter = { + parameterPath: ["options", "largePersonGroupId"], + mapper: IdentifyRequestMapper +}; + +export const maxNumOfCandidatesReturned1: OperationParameter = { + parameterPath: ["options", "maxNumOfCandidatesReturned"], + mapper: IdentifyRequestMapper +}; + +export const confidenceThreshold: OperationParameter = { + parameterPath: ["options", "confidenceThreshold"], + mapper: IdentifyRequestMapper +}; + +export const faceId1: OperationParameter = { + parameterPath: "faceId1", + mapper: VerifyFaceToFaceRequestMapper +}; + +export const faceId2: OperationParameter = { + parameterPath: "faceId2", + mapper: VerifyFaceToFaceRequestMapper +}; + +export const url: OperationParameter = { + parameterPath: "url", + mapper: ImageUrlMapper +}; + +export const returnFaceId: OperationQueryParameter = { + parameterPath: ["options", "returnFaceId"], mapper: { - serializedName: "faceIdTimeToLive", - defaultValue: 86400, - constraints: { - InclusiveMaximum: 86400, - InclusiveMinimum: 60 - }, + defaultValue: true, + serializedName: "returnFaceId", type: { - name: "Number" + name: "Boolean" } } }; -export const faceListId: msRest.OperationURLParameter = { - parameterPath: "faceListId", + +export const returnFaceLandmarks: OperationQueryParameter = { + parameterPath: ["options", "returnFaceLandmarks"], mapper: { - required: true, - serializedName: "faceListId", - constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ - }, + defaultValue: false, + serializedName: "returnFaceLandmarks", type: { - name: "String" + name: "Boolean" } } }; -export const largeFaceListId: msRest.OperationURLParameter = { - parameterPath: "largeFaceListId", + +export const returnFaceAttributes: OperationQueryParameter = { + parameterPath: ["options", "returnFaceAttributes"], mapper: { - required: true, - serializedName: "largeFaceListId", - constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ - }, + serializedName: "returnFaceAttributes", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Enum", + allowedValues: [ + "age", + "gender", + "headPose", + "smile", + "facialHair", + "glasses", + "emotion", + "hair", + "makeup", + "occlusion", + "accessories", + "blur", + "exposure", + "noise", + "mask", + "qualityForRecognition" + ] + } + } } - } + }, + collectionFormat: "CSV" }; -export const largePersonGroupId: msRest.OperationURLParameter = { - parameterPath: "largePersonGroupId", + +export const recognitionModel: OperationQueryParameter = { + parameterPath: ["options", "recognitionModel"], mapper: { - required: true, - serializedName: "largePersonGroupId", - constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ - }, + serializedName: "recognitionModel", type: { name: "String" } } }; -export const operationId: msRest.OperationURLParameter = { - parameterPath: "operationId", + +export const returnRecognitionModel: OperationQueryParameter = { + parameterPath: ["options", "returnRecognitionModel"], mapper: { - required: true, - serializedName: "operationId", + defaultValue: false, + serializedName: "returnRecognitionModel", type: { - name: "Uuid" + name: "Boolean" } } }; -export const persistedFaceId: msRest.OperationURLParameter = { - parameterPath: "persistedFaceId", + +export const detectionModel: OperationQueryParameter = { + parameterPath: ["options", "detectionModel"], mapper: { - required: true, - serializedName: "persistedFaceId", + defaultValue: "detection_01", + serializedName: "detectionModel", type: { - name: "Uuid" + name: "String" } } }; -export const personGroupId: msRest.OperationURLParameter = { - parameterPath: "personGroupId", + +export const faceIdTimeToLive: OperationQueryParameter = { + parameterPath: ["options", "faceIdTimeToLive"], mapper: { - required: true, - serializedName: "personGroupId", + defaultValue: 86400, constraints: { - MaxLength: 64, - Pattern: /^[a-z0-9-_]+$/ + InclusiveMaximum: 86400, + InclusiveMinimum: 60 }, + serializedName: "faceIdTimeToLive", type: { - name: "String" + name: "Number" } } }; -export const personId: msRest.OperationURLParameter = { + +export const faceId1: OperationParameter = { + parameterPath: "faceId", + mapper: VerifyFaceToPersonRequestMapper +}; + +export const personGroupId1: OperationParameter = { + parameterPath: ["options", "personGroupId"], + mapper: VerifyFaceToPersonRequestMapper +}; + +export const largePersonGroupId1: OperationParameter = { + parameterPath: ["options", "largePersonGroupId"], + mapper: VerifyFaceToPersonRequestMapper +}; + +export const personId: OperationParameter = { parameterPath: "personId", + mapper: VerifyFaceToPersonRequestMapper +}; + +export const contentType1: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - required: true, - serializedName: "personId", + defaultValue: "application/octet-stream", + isConstant: true, + serializedName: "Content-Type", type: { - name: "Uuid" + name: "String" } } }; -export const recognitionModel: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "recognitionModel" - ], + +export const image: OperationParameter = { + parameterPath: "image", mapper: { - serializedName: "recognitionModel", - defaultValue: 'recognition_01', + serializedName: "image", + required: true, type: { - name: "String" + name: "Stream" } } }; -export const returnFaceAttributes: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "returnFaceAttributes" - ], + +export const accept1: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "returnFaceAttributes", + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { - name: "Sequence", - element: { - type: { - name: "Enum", - allowedValues: [ - "age", - "gender", - "headPose", - "smile", - "facialHair", - "glasses", - "emotion", - "hair", - "makeup", - "occlusion", - "accessories", - "blur", - "exposure", - "noise", - "mask", - "qualityForRecognition" - ] - } - } + name: "String" } - }, - collectionFormat: msRest.QueryCollectionFormat.Csv + } }; -export const returnFaceId: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "returnFaceId" - ], + +export const name: OperationParameter = { + parameterPath: ["options", "name"], + mapper: NameAndUserDataContractMapper +}; + +export const userData: OperationParameter = { + parameterPath: ["options", "userData"], + mapper: NameAndUserDataContractMapper +}; + +export const personGroupId2: OperationURLParameter = { + parameterPath: "personGroupId", mapper: { - serializedName: "returnFaceId", - defaultValue: true, + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "personGroupId", + required: true, type: { - name: "Boolean" + name: "String" } } }; -export const returnFaceLandmarks: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "returnFaceLandmarks" - ], + +export const start: OperationQueryParameter = { + parameterPath: ["options", "start"], mapper: { - serializedName: "returnFaceLandmarks", - defaultValue: false, + serializedName: "start", type: { - name: "Boolean" + name: "String" } } }; -export const returnRecognitionModel: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "returnRecognitionModel" - ], + +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], mapper: { - serializedName: "returnRecognitionModel", - defaultValue: false, + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + serializedName: "top", type: { - name: "Boolean" + name: "Number" } } }; -export const snapshotId: msRest.OperationURLParameter = { - parameterPath: "snapshotId", + +export const personId1: OperationURLParameter = { + parameterPath: "personId", mapper: { + serializedName: "personId", required: true, - serializedName: "snapshotId", type: { name: "Uuid" } } }; -export const start0: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "start" - ], + +export const persistedFaceId: OperationURLParameter = { + parameterPath: "persistedFaceId", mapper: { - serializedName: "start", + serializedName: "persistedFaceId", + required: true, type: { - name: "String" + name: "Uuid" } } }; -export const start1: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "start" - ], + +export const userData1: OperationParameter = { + parameterPath: ["options", "userData"], + mapper: UpdateFaceRequestMapper +}; + +export const userData2: OperationQueryParameter = { + parameterPath: ["options", "userData"], mapper: { - serializedName: "start", constraints: { - MaxLength: 64 + MaxLength: 1024 }, + serializedName: "userData", type: { name: "String" } } }; -export const targetFace: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "targetFace" - ], + +export const targetFace: OperationQueryParameter = { + parameterPath: ["options", "targetFace"], mapper: { serializedName: "targetFace", type: { @@ -297,46 +397,119 @@ export const targetFace: msRest.OperationQueryParameter = { } } }, - collectionFormat: msRest.QueryCollectionFormat.Csv + collectionFormat: "CSV" +}; + +export const name1: OperationParameter = { + parameterPath: "name", + mapper: MetaDataContractMapper }; -export const top0: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "top" - ], + +export const userData3: OperationParameter = { + parameterPath: ["options", "userData"], + mapper: MetaDataContractMapper +}; + +export const recognitionModel1: OperationParameter = { + parameterPath: ["options", "recognitionModel"], + mapper: MetaDataContractMapper +}; + +export const start1: OperationQueryParameter = { + parameterPath: ["options", "start"], mapper: { - serializedName: "top", constraints: { - InclusiveMaximum: 1000, - InclusiveMinimum: 1 + MaxLength: 64 }, + serializedName: "start", type: { - name: "Number" + name: "String" } } }; -export const top1: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "top" - ], + +export const top1: OperationQueryParameter = { + parameterPath: ["options", "top"], mapper: { - serializedName: "top", defaultValue: 1000, constraints: { InclusiveMaximum: 1000, InclusiveMinimum: 1 }, + serializedName: "top", type: { name: "Number" } } }; -export const type: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "type" - ], + +export const faceListId1: OperationURLParameter = { + parameterPath: "faceListId", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "faceListId", + required: true, + type: { + name: "String" + } + } +}; + +export const largePersonGroupId2: OperationURLParameter = { + parameterPath: "largePersonGroupId", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "largePersonGroupId", + required: true, + type: { + name: "String" + } + } +}; + +export const largeFaceListId1: OperationURLParameter = { + parameterPath: "largeFaceListId", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z0-9-_]+$"), + MaxLength: 64 + }, + serializedName: "largeFaceListId", + required: true, + type: { + name: "String" + } + } +}; + +export const typeParam: OperationParameter = { + parameterPath: "typeParam", + mapper: TakeSnapshotRequestMapper +}; + +export const objectId: OperationParameter = { + parameterPath: "objectId", + mapper: TakeSnapshotRequestMapper +}; + +export const applyScope: OperationParameter = { + parameterPath: "applyScope", + mapper: TakeSnapshotRequestMapper +}; + +export const userData4: OperationParameter = { + parameterPath: ["options", "userData"], + mapper: TakeSnapshotRequestMapper +}; + +export const typeParam1: OperationQueryParameter = { + parameterPath: ["options", "typeParam"], mapper: { serializedName: "type", type: { @@ -350,18 +523,61 @@ export const type: msRest.OperationQueryParameter = { } } }; -export const userData: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "userData" - ], + +export const applyScope1: OperationQueryParameter = { + parameterPath: ["options", "applyScope"], mapper: { - serializedName: "userData", - constraints: { - MaxLength: 1024 - }, + serializedName: "applyScope", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + }, + collectionFormat: "CSV" +}; + +export const snapshotId: OperationURLParameter = { + parameterPath: "snapshotId", + mapper: { + serializedName: "snapshotId", + required: true, + type: { + name: "Uuid" + } + } +}; + +export const applyScope2: OperationParameter = { + parameterPath: ["options", "applyScope"], + mapper: UpdateSnapshotRequestMapper +}; + +export const userData5: OperationParameter = { + parameterPath: ["options", "userData"], + mapper: UpdateSnapshotRequestMapper +}; + +export const objectId1: OperationParameter = { + parameterPath: "objectId", + mapper: ApplySnapshotRequestMapper +}; + +export const mode1: OperationParameter = { + parameterPath: ["options", "mode"], + mapper: ApplySnapshotRequestMapper +}; + +export const operationId: OperationURLParameter = { + parameterPath: "operationId", + mapper: { + serializedName: "operationId", + required: true, + type: { + name: "Uuid" } } }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupOperationsMappers.ts deleted file mode 100644 index cf3b2057ebfc..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupOperationsMappers.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - APIError, - ErrorModel, - FaceList, - LargeFaceList, - LargePersonGroup, - MetaDataContract, - NameAndUserDataContract, - NonNullableNameAndNullableUserDataContract, - PersistedFace, - Person, - PersonGroup, - TrainingStatus -} from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupPersonMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupPersonMappers.ts deleted file mode 100644 index 84d8f6bba2b6..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupPersonMappers.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - APIError, - ErrorModel, - ImageUrl, - NameAndUserDataContract, - PersistedFace, - Person, - UpdateFaceRequest -} from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/snapshotOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/snapshotOperationsMappers.ts deleted file mode 100644 index d8f46446e597..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/snapshotOperationsMappers.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - APIError, - ApplySnapshotRequest, - ErrorModel, - OperationStatus, - Snapshot, - SnapshotApplyHeaders, - SnapshotTakeHeaders, - TakeSnapshotRequest, - UpdateSnapshotRequest -} from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/face.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/face.ts index aabed8119485..39e850eacaaf 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/face.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/face.ts @@ -1,174 +1,146 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/faceMappers"; +import { Face } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { FaceClientContext } from "../faceClientContext"; +import { FaceClient } from "../faceClient"; +import { + FaceFindSimilarOptionalParams, + FaceFindSimilarResponse, + FaceGroupOptionalParams, + FaceGroupResponse, + FaceIdentifyOptionalParams, + FaceIdentifyResponse, + FaceVerifyFaceToFaceOptionalParams, + FaceVerifyFaceToFaceResponse, + FaceDetectWithUrlOptionalParams, + FaceDetectWithUrlResponse, + FaceVerifyFaceToPersonOptionalParams, + FaceVerifyFaceToPersonResponse, + FaceDetectWithStreamOptionalParams, + FaceDetectWithStreamResponse +} from "../models"; -/** Class representing a Face. */ -export class Face { - private readonly client: FaceClientContext; +/** Class containing Face operations. */ +export class FaceImpl implements Face { + private readonly client: FaceClient; /** - * Create a Face. - * @param {FaceClientContext} client Reference to the service client. + * Initialize a new instance of the class Face class. + * @param client Reference to the service client */ - constructor(client: FaceClientContext) { + constructor(client: FaceClient) { this.client = client; } /** - * Given query face's faceId, to search the similar-looking faces from a faceId array, a face list - * or a large face list. faceId array contains the faces created by [Face - Detect With + * Given query face's faceId, to search the similar-looking faces from a faceId array, a face list or a + * large face list. faceId array contains the faces created by [Face - Detect With * Url](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl) or [Face - Detect With - * Stream](https://docs.microsoft.com/rest/api/faceapi/face/detectwithstream), which will expire at - * the time specified by faceIdTimeToLive after creation. A "faceListId" is created by [FaceList - + * Stream](https://docs.microsoft.com/rest/api/faceapi/face/detectwithstream), which will expire at the + * time specified by faceIdTimeToLive after creation. A "faceListId" is created by [FaceList - * Create](https://docs.microsoft.com/rest/api/faceapi/facelist/create) containing persistedFaceIds * that will not expire. And a "largeFaceListId" is created by [LargeFaceList - * Create](https://docs.microsoft.com/rest/api/faceapi/largefacelist/create) containing - * persistedFaceIds that will also not expire. Depending on the input the returned similar faces - * list contains faceIds or persistedFaceIds ranked by similarity. - *
Find similar has two working modes, "matchPerson" and "matchFace". "matchPerson" is the - * default mode that it tries to find faces of the same person as possible by using internal - * same-person thresholds. It is useful to find a known person's other photos. Note that an empty - * list will be returned if no faces pass the internal thresholds. "matchFace" mode ignores - * same-person thresholds and returns ranked similar faces anyway, even the similarity is low. It - * can be used in the cases like searching celebrity-looking faces. + * persistedFaceIds that will also not expire. Depending on the input the returned similar faces list + * contains faceIds or persistedFaceIds ranked by similarity. + *
Find similar has two working modes, "matchPerson" and "matchFace". "matchPerson" is the default + * mode that it tries to find faces of the same person as possible by using internal same-person + * thresholds. It is useful to find a known person's other photos. Note that an empty list will be + * returned if no faces pass the internal thresholds. "matchFace" mode ignores same-person thresholds + * and returns ranked similar faces anyway, even the similarity is low. It can be used in the cases + * like searching celebrity-looking faces. *
The 'recognitionModel' associated with the query face's faceId should be the same as the * 'recognitionModel' used by the target faceId array, face list or large face list. + * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid - * faceId. Note that this faceId is not persisted and will expire at the time specified by - * faceIdTimeToLive after the detection call - * @param [options] The optional parameters - * @returns Promise - */ - findSimilar(faceId: string, options?: Models.FaceFindSimilarOptionalParams): Promise; - /** - * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid - * faceId. Note that this faceId is not persisted and will expire at the time specified by - * faceIdTimeToLive after the detection call - * @param callback The callback - */ - findSimilar(faceId: string, callback: msRest.ServiceCallback): void; - /** - * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid - * faceId. Note that this faceId is not persisted and will expire at the time specified by - * faceIdTimeToLive after the detection call - * @param options The optional parameters - * @param callback The callback + * faceId. Note that this faceId is not persisted and will expire at the time specified by + * faceIdTimeToLive after the detection call + * @param options The options parameters. */ - findSimilar(faceId: string, options: Models.FaceFindSimilarOptionalParams, callback: msRest.ServiceCallback): void; - findSimilar(faceId: string, options?: Models.FaceFindSimilarOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + findSimilar( + faceId: string, + options?: FaceFindSimilarOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceId, - options - }, - findSimilarOperationSpec, - callback) as Promise; + { faceId, options }, + findSimilarOperationSpec + ); } /** * Divide candidate faces into groups based on face similarity.
* * The output is one or more disjointed face groups and a messyGroup. A face group contains faces * that have similar looking, often of the same person. Face groups are ranked by group size, i.e. - * number of faces. Notice that faces belonging to a same person might be split into several groups - * in the result. - * * MessyGroup is a special face group containing faces that cannot find any similar counterpart - * face from original faces. The messyGroup will not appear in the result if all faces found their + * number of faces. Notice that faces belonging to a same person might be split into several groups in + * the result. + * * MessyGroup is a special face group containing faces that cannot find any similar counterpart face + * from original faces. The messyGroup will not appear in the result if all faces found their * counterparts. * * Group API needs at least 2 candidate faces and 1000 at most. We suggest to try [Face - * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface) when you only have 2 * candidate faces. * * The 'recognitionModel' associated with the query faces' faceIds should be the same. + * * @param faceIds Array of candidate faceId created by Face - Detect. The maximum is 1000 faces - * @param [options] The optional parameters - * @returns Promise - */ - group(faceIds: string[], options?: msRest.RequestOptionsBase): Promise; - /** - * @param faceIds Array of candidate faceId created by Face - Detect. The maximum is 1000 faces - * @param callback The callback - */ - group(faceIds: string[], callback: msRest.ServiceCallback): void; - /** - * @param faceIds Array of candidate faceId created by Face - Detect. The maximum is 1000 faces - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - group(faceIds: string[], options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - group(faceIds: string[], options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + group( + faceIds: string[], + options?: FaceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceIds, - options - }, - groupOperationSpec, - callback) as Promise; + { faceIds, options }, + groupOperationSpec + ); } /** - * 1-to-many identification to find the closest matches of the specific query person face from a - * person group or large person group. - *
For each face in the faceIds array, Face Identify will compute similarities between the - * query face and all the faces in the person group (given by personGroupId) or large person group - * (given by largePersonGroupId), and return candidate person(s) for that face ranked by similarity - * confidence. The person group/large person group should be trained to make it ready for - * identification. See more in [PersonGroup - - * Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) and [LargePersonGroup - - * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train). + * 1-to-many identification to find the closest matches of the specific query person face from a person + * group or large person group. + *
For each face in the faceIds array, Face Identify will compute similarities between the query + * face and all the faces in the person group (given by personGroupId) or large person group (given by + * largePersonGroupId), and return candidate person(s) for that face ranked by similarity confidence. + * The person group/large person group should be trained to make it ready for identification. See more + * in [PersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) and + * [LargePersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train). *
* * Remarks:
- * * The algorithm allows more than one face to be identified independently at the same request, - * but no more than 10 faces. - * * Each person in the person group/large person group could have more than one face, but no more - * than 248 faces. + * * The algorithm allows more than one face to be identified independently at the same request, but no + * more than 10 faces. + * * Each person in the person group/large person group could have more than one face, but no more than + * 248 faces. * * Higher face image quality means better identification precision. Please consider high-quality * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. - * * Number of candidates returned is restricted by maxNumOfCandidatesReturned and - * confidenceThreshold. If no person is identified, the returned candidates will be an empty array. - * * Try [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) when - * you need to find similar faces from a face list/large face list instead of a person group/large - * person group. + * * Number of candidates returned is restricted by maxNumOfCandidatesReturned and confidenceThreshold. + * If no person is identified, the returned candidates will be an empty array. + * * Try [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) when you + * need to find similar faces from a face list/large face list instead of a person group/large person + * group. * * The 'recognitionModel' associated with the query faces' faceIds should be the same as the * 'recognitionModel' used by the target person group or large person group. + * * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are - * identified independently. The valid number of faceIds is between [1, 10]. - * @param [options] The optional parameters - * @returns Promise - */ - identify(faceIds: string[], options?: Models.FaceIdentifyOptionalParams): Promise; - /** - * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are - * identified independently. The valid number of faceIds is between [1, 10]. - * @param callback The callback - */ - identify(faceIds: string[], callback: msRest.ServiceCallback): void; - /** - * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are - * identified independently. The valid number of faceIds is between [1, 10]. - * @param options The optional parameters - * @param callback The callback + * identified independently. The valid number of faceIds is between [1, 10]. + * @param options The options parameters. */ - identify(faceIds: string[], options: Models.FaceIdentifyOptionalParams, callback: msRest.ServiceCallback): void; - identify(faceIds: string[], options?: Models.FaceIdentifyOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + identify( + faceIds: string[], + options?: FaceIdentifyOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceIds, - options - }, - identifyOperationSpec, - callback) as Promise; + { faceIds, options }, + identifyOperationSpec + ); } /** @@ -180,54 +152,40 @@ export class Face { * * For the scenarios that are sensitive to accuracy please make your own judgment. * * The 'recognitionModel' associated with the query faces' faceIds should be the same as the * 'recognitionModel' used by the target face, person group or large person group. + * * @param faceId1 FaceId of the first face, comes from Face - Detect * @param faceId2 FaceId of the second face, comes from Face - Detect - * @param [options] The optional parameters - * @returns Promise - */ - verifyFaceToFace(faceId1: string, faceId2: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param faceId1 FaceId of the first face, comes from Face - Detect - * @param faceId2 FaceId of the second face, comes from Face - Detect - * @param callback The callback - */ - verifyFaceToFace(faceId1: string, faceId2: string, callback: msRest.ServiceCallback): void; - /** - * @param faceId1 FaceId of the first face, comes from Face - Detect - * @param faceId2 FaceId of the second face, comes from Face - Detect - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - verifyFaceToFace(faceId1: string, faceId2: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - verifyFaceToFace(faceId1: string, faceId2: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + verifyFaceToFace( + faceId1: string, + faceId2: string, + options?: FaceVerifyFaceToFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceId1, - faceId2, - options - }, - verifyFaceToFaceOperationSpec, - callback) as Promise; + { faceId1, faceId2, options }, + verifyFaceToFaceOperationSpec + ); } /** - * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, - * and attributes.
- * * No image will be stored. Only the extracted face feature will be stored on server. The faceId - * is an identifier of the face feature and will be used in [Face - + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.
+ * * No image will be stored. Only the extracted face feature will be stored on server. The faceId is + * an identifier of the face feature and will be used in [Face - * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find - * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face - * feature(s) will expire and be deleted at the time specified by faceIdTimeToLive after the - * original detection call. + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) + * will expire and be deleted at the time specified by faceIdTimeToLive after the original detection + * call. * * Optional parameters include faceId, landmarks, and attributes. Attributes include age, gender, - * headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, - * exposure, noise, mask, and qualityForRecognition. Some of the results returned for specific - * attributes may not be highly accurate. + * headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, + * noise, mask, and qualityForRecognition. Some of the results returned for specific attributes may not + * be highly accurate. * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is * from 1KB to 6MB. - * * Up to 100 faces can be returned for an image. Faces are ranked by face rectangle size from - * large to small. + * * Up to 100 faces can be returned for an image. Faces are ranked by face rectangle size from large + * to small. * * For optimal results when querying [Face - * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find @@ -235,98 +193,68 @@ export class Face { * please use faces that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels * between eyes). * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). * - * * Different 'recognitionModel' values are provided. If follow-up operations like Verify, - * Identify, Find Similar are needed, please specify the recognition model with 'recognitionModel' - * parameter. The default value for 'recognitionModel' is 'recognition_01', if latest model needed, - * please explicitly specify the model you need in this parameter. Once specified, the detected - * faceIds will be associated with the specified recognition model. More details, please refer to - * [Specify a recognition + * * Different 'recognitionModel' values are provided. If follow-up operations like Verify, Identify, + * Find Similar are needed, please specify the recognition model with 'recognitionModel' parameter. The + * default value for 'recognitionModel' is 'recognition_01', if latest model needed, please explicitly + * specify the model you need in this parameter. Once specified, the detected faceIds will be + * associated with the specified recognition model. More details, please refer to [Specify a + * recognition * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). * @param url Publicly reachable URL of an image - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - detectWithUrl(url: string, options?: Models.FaceDetectWithUrlOptionalParams): Promise; - /** - * @param url Publicly reachable URL of an image - * @param callback The callback - */ - detectWithUrl(url: string, callback: msRest.ServiceCallback): void; - /** - * @param url Publicly reachable URL of an image - * @param options The optional parameters - * @param callback The callback - */ - detectWithUrl(url: string, options: Models.FaceDetectWithUrlOptionalParams, callback: msRest.ServiceCallback): void; - detectWithUrl(url: string, options?: Models.FaceDetectWithUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + detectWithUrl( + url: string, + options?: FaceDetectWithUrlOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - url, - options - }, - detectWithUrlOperationSpec, - callback) as Promise; + { url, options }, + detectWithUrlOperationSpec + ); } /** * Verify whether two faces belong to a same person. Compares a face Id with a Person Id * @param faceId FaceId of the face, comes from Face - Detect * @param personId Specify a certain person in a person group or a large person group. personId is - * created in PersonGroup Person - Create or LargePersonGroup Person - Create. - * @param [options] The optional parameters - * @returns Promise + * created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param options The options parameters. */ - verifyFaceToPerson(faceId: string, personId: string, options?: Models.FaceVerifyFaceToPersonOptionalParams): Promise; - /** - * @param faceId FaceId of the face, comes from Face - Detect - * @param personId Specify a certain person in a person group or a large person group. personId is - * created in PersonGroup Person - Create or LargePersonGroup Person - Create. - * @param callback The callback - */ - verifyFaceToPerson(faceId: string, personId: string, callback: msRest.ServiceCallback): void; - /** - * @param faceId FaceId of the face, comes from Face - Detect - * @param personId Specify a certain person in a person group or a large person group. personId is - * created in PersonGroup Person - Create or LargePersonGroup Person - Create. - * @param options The optional parameters - * @param callback The callback - */ - verifyFaceToPerson(faceId: string, personId: string, options: Models.FaceVerifyFaceToPersonOptionalParams, callback: msRest.ServiceCallback): void; - verifyFaceToPerson(faceId: string, personId: string, options?: Models.FaceVerifyFaceToPersonOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + verifyFaceToPerson( + faceId: string, + personId: string, + options?: FaceVerifyFaceToPersonOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceId, - personId, - options - }, - verifyFaceToPersonOperationSpec, - callback) as Promise; + { faceId, personId, options }, + verifyFaceToPersonOperationSpec + ); } /** - * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, - * and attributes.
- * * No image will be stored. Only the extracted face feature will be stored on server. The faceId - * is an identifier of the face feature and will be used in [Face - + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.
+ * * No image will be stored. Only the extracted face feature will be stored on server. The faceId is + * an identifier of the face feature and will be used in [Face - * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find - * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face - * feature(s) will expire and be deleted at the time specified by faceIdTimeToLive after the - * original detection call. + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) + * will expire and be deleted at the time specified by faceIdTimeToLive after the original detection + * call. * * Optional parameters include faceId, landmarks, and attributes. Attributes include age, gender, - * headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, - * exposure, noise, mask, and qualityForRecognition. Some of the results returned for specific - * attributes may not be highly accurate. + * headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, + * noise, mask, and qualityForRecognition. Some of the results returned for specific attributes may not + * be highly accurate. * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is * from 1KB to 6MB. - * * Up to 100 faces can be returned for an image. Faces are ranked by face rectangle size from - * large to small. + * * Up to 100 faces can be returned for an image. Faces are ranked by face rectangle size from large + * to small. * * For optimal results when querying [Face - * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find @@ -334,94 +262,43 @@ export class Face { * please use faces that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels * between eyes). * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) - * * Different 'recognitionModel' values are provided. If follow-up operations like Verify, - * Identify, Find Similar are needed, please specify the recognition model with 'recognitionModel' - * parameter. The default value for 'recognitionModel' is 'recognition_01', if latest model needed, - * please explicitly specify the model you need in this parameter. Once specified, the detected - * faceIds will be associated with the specified recognition model. More details, please refer to - * [Specify a recognition + * * Different 'recognitionModel' values are provided. If follow-up operations like Verify, Identify, + * Find Similar are needed, please specify the recognition model with 'recognitionModel' parameter. The + * default value for 'recognitionModel' is 'recognition_01', if latest model needed, please explicitly + * specify the model you need in this parameter. Once specified, the detected faceIds will be + * associated with the specified recognition model. More details, please refer to [Specify a + * recognition * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). * @param image An image stream. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - detectWithStream(image: msRest.HttpRequestBody, options?: Models.FaceDetectWithStreamOptionalParams): Promise; - /** - * @param image An image stream. - * @param callback The callback - */ - detectWithStream(image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; - /** - * @param image An image stream. - * @param options The optional parameters - * @param callback The callback - */ - detectWithStream(image: msRest.HttpRequestBody, options: Models.FaceDetectWithStreamOptionalParams, callback: msRest.ServiceCallback): void; - detectWithStream(image: msRest.HttpRequestBody, options?: Models.FaceDetectWithStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + detectWithStream( + image: coreRestPipeline.RequestBodyType, + options?: FaceDetectWithStreamOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - image, - options - }, - detectWithStreamOperationSpec, - callback) as Promise; + { image, options }, + detectWithStreamOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const findSimilarOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const findSimilarOperationSpec: coreClient.OperationSpec = { + path: "/findsimilars", httpMethod: "POST", - path: "findsimilars", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: { - faceId: "faceId", - faceListId: [ - "options", - "faceListId" - ], - largeFaceListId: [ - "options", - "largeFaceListId" - ], - faceIds: [ - "options", - "faceIds" - ], - maxNumOfCandidatesReturned: [ - "options", - "maxNumOfCandidatesReturned" - ], - mode: [ - "options", - "mode" - ] - }, - mapper: { - ...Mappers.FindSimilarRequest, - required: true - } - }, responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "SimilarFace" - } - } + element: { type: { name: "Composite", className: "SimilarFace" } } } } }, @@ -429,24 +306,25 @@ const findSimilarOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const groupOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "group", - urlParameters: [ - Parameters.endpoint - ], requestBody: { parameterPath: { - faceIds: "faceIds" + faceId: ["faceId"], + faceListId: ["options", "faceListId"], + largeFaceListId: ["options", "largeFaceListId"], + faceIds: ["options", "faceIds"], + maxNumOfCandidatesReturned: ["options", "maxNumOfCandidatesReturned"], + mode: ["options", "mode"] }, - mapper: { - ...Mappers.GroupRequest, - required: true - } + mapper: { ...Mappers.FindSimilarRequest, required: true } }, + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const groupOperationSpec: coreClient.OperationSpec = { + path: "/group", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.GroupResult @@ -455,52 +333,24 @@ const groupOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { faceIds: ["faceIds"] }, + mapper: { ...Mappers.GroupRequest, required: true } + }, + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const identifyOperationSpec: msRest.OperationSpec = { +const identifyOperationSpec: coreClient.OperationSpec = { + path: "/identify", httpMethod: "POST", - path: "identify", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: { - faceIds: "faceIds", - personGroupId: [ - "options", - "personGroupId" - ], - largePersonGroupId: [ - "options", - "largePersonGroupId" - ], - maxNumOfCandidatesReturned: [ - "options", - "maxNumOfCandidatesReturned" - ], - confidenceThreshold: [ - "options", - "confidenceThreshold" - ] - }, - mapper: { - ...Mappers.IdentifyRequest, - required: true - } - }, responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "IdentifyResult" - } - } + element: { type: { name: "Composite", className: "IdentifyResult" } } } } }, @@ -508,25 +358,24 @@ const identifyOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const verifyFaceToFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "verify", - urlParameters: [ - Parameters.endpoint - ], requestBody: { parameterPath: { - faceId1: "faceId1", - faceId2: "faceId2" + faceIds: ["faceIds"], + personGroupId: ["options", "personGroupId"], + largePersonGroupId: ["options", "largePersonGroupId"], + maxNumOfCandidatesReturned: ["options", "maxNumOfCandidatesReturned"], + confidenceThreshold: ["options", "confidenceThreshold"] }, - mapper: { - ...Mappers.VerifyFaceToFaceRequest, - required: true - } + mapper: { ...Mappers.IdentifyRequest, required: true } }, + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const verifyFaceToFaceOperationSpec: coreClient.OperationSpec = { + path: "/verify", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.VerifyResult @@ -535,45 +384,24 @@ const verifyFaceToFaceOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { faceId1: ["faceId1"], faceId2: ["faceId2"] }, + mapper: { ...Mappers.VerifyFaceToFaceRequest, required: true } + }, + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const detectWithUrlOperationSpec: msRest.OperationSpec = { +const detectWithUrlOperationSpec: coreClient.OperationSpec = { + path: "/detect", httpMethod: "POST", - path: "detect", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.returnFaceId, - Parameters.returnFaceLandmarks, - Parameters.returnFaceAttributes, - Parameters.recognitionModel, - Parameters.returnRecognitionModel, - Parameters.detectionModel, - Parameters.faceIdTimeToLive - ], - requestBody: { - parameterPath: { - url: "url" - }, - mapper: { - ...Mappers.ImageUrl, - required: true - } - }, responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "DetectedFace" - } - } + element: { type: { name: "Composite", className: "DetectedFace" } } } } }, @@ -581,33 +409,27 @@ const detectWithUrlOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { url: ["url"] }, + mapper: { ...Mappers.ImageUrl, required: true } + }, + queryParameters: [ + Parameters.returnFaceId, + Parameters.returnFaceLandmarks, + Parameters.returnFaceAttributes, + Parameters.recognitionModel, + Parameters.returnRecognitionModel, + Parameters.detectionModel, + Parameters.faceIdTimeToLive + ], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const verifyFaceToPersonOperationSpec: msRest.OperationSpec = { +const verifyFaceToPersonOperationSpec: coreClient.OperationSpec = { + path: "/verify", httpMethod: "POST", - path: "verify", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: { - faceId: "faceId", - personGroupId: [ - "options", - "personGroupId" - ], - largePersonGroupId: [ - "options", - "largePersonGroupId" - ], - personId: "personId" - }, - mapper: { - ...Mappers.VerifyFaceToPersonRequest, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.VerifyResult @@ -616,47 +438,29 @@ const verifyFaceToPersonOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + faceId: ["faceId"], + personGroupId: ["options", "personGroupId"], + largePersonGroupId: ["options", "largePersonGroupId"], + personId: ["personId"] + }, + mapper: { ...Mappers.VerifyFaceToPersonRequest, required: true } + }, + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const detectWithStreamOperationSpec: msRest.OperationSpec = { +const detectWithStreamOperationSpec: coreClient.OperationSpec = { + path: "/detect", httpMethod: "POST", - path: "detect", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.returnFaceId, - Parameters.returnFaceLandmarks, - Parameters.returnFaceAttributes, - Parameters.recognitionModel, - Parameters.returnRecognitionModel, - Parameters.detectionModel, - Parameters.faceIdTimeToLive - ], - requestBody: { - parameterPath: "image", - mapper: { - required: true, - serializedName: "Image", - type: { - name: "Stream" - } - } - }, - contentType: "application/octet-stream", responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "DetectedFace" - } - } + element: { type: { name: "Composite", className: "DetectedFace" } } } } }, @@ -664,5 +468,18 @@ const detectWithStreamOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: Parameters.image, + queryParameters: [ + Parameters.returnFaceId, + Parameters.returnFaceLandmarks, + Parameters.returnFaceAttributes, + Parameters.recognitionModel, + Parameters.returnRecognitionModel, + Parameters.detectionModel, + Parameters.faceIdTimeToLive + ], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.contentType1, Parameters.accept1], + mediaType: "binary", serializer }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/faceListOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/faceListOperations.ts index 82bd77ef5fbd..d9724d9e4089 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/faceListOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/faceListOperations.ts @@ -1,28 +1,41 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/faceListOperationsMappers"; +import { FaceListOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { FaceClientContext } from "../faceClientContext"; +import { FaceClient } from "../faceClient"; +import { + FaceListCreateOptionalParams, + FaceListGetOptionalParams, + FaceListGetResponse, + FaceListUpdateOptionalParams, + FaceListDeleteOptionalParams, + FaceListListOptionalParams, + FaceListListResponse, + FaceListDeleteFaceOptionalParams, + FaceListAddFaceFromUrlOptionalParams, + FaceListAddFaceFromUrlResponse, + FaceListAddFaceFromStreamOptionalParams, + FaceListAddFaceFromStreamResponse +} from "../models"; -/** Class representing a FaceListOperations. */ -export class FaceListOperations { - private readonly client: FaceClientContext; +/** Class containing FaceListOperations operations. */ +export class FaceListOperationsImpl implements FaceListOperations { + private readonly client: FaceClient; /** - * Create a FaceListOperations. - * @param {FaceClientContext} client Reference to the service client. + * Initialize a new instance of the class FaceListOperations class. + * @param client Reference to the service client */ - constructor(client: FaceClientContext) { + constructor(client: FaceClient) { this.client = client; } @@ -32,163 +45,93 @@ export class FaceListOperations { *
Face list is a list of faces, up to 1,000 faces, and used by [Face - Find * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). *
After creation, user should use [FaceList - Add - * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/addfacefromurl) to import the faces. - * No image will be stored. Only the extracted face features are stored on server until [FaceList - + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/addfacefromurl) to import the faces. No + * image will be stored. Only the extracted face features are stored on server until [FaceList - * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. - *
Find Similar is used for scenario like finding celebrity-like faces, similar face - * filtering, or as a light way face identification. But if the actual use is to identify person, - * please use [PersonGroup](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + *
Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, + * or as a light way face identification. But if the actual use is to identify person, please use + * [PersonGroup](https://docs.microsoft.com/rest/api/faceapi/persongroup) / * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). - *
Please consider - * [LargeFaceList](https://docs.microsoft.com/rest/api/faceapi/largefacelist) when the face number - * is large. It can support up to 1,000,000 faces. - *
'recognitionModel' should be specified to associate with this face list. The default value - * for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly - * specify the model you need in this parameter. New faces that are added to an existing face list - * will use the recognition model that's already associated with the collection. Existing face - * features in a face list can't be updated to features extracted by another version of recognition - * model. + *
Please consider [LargeFaceList](https://docs.microsoft.com/rest/api/faceapi/largefacelist) + * when the face number is large. It can support up to 1,000,000 faces. + *
'recognitionModel' should be specified to associate with this face list. The default value for + * 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify the + * model you need in this parameter. New faces that are added to an existing face list will use the + * recognition model that's already associated with the collection. Existing face features in a face + * list can't be updated to features extracted by another version of recognition model. * Please Refer to [Specify a face recognition * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). * @param faceListId Id referencing a particular face list. * @param name User defined name, maximum length is 128. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(faceListId: string, name: string, options?: Models.FaceListCreateOptionalParams): Promise; - /** - * @param faceListId Id referencing a particular face list. - * @param name User defined name, maximum length is 128. - * @param callback The callback - */ - create(faceListId: string, name: string, callback: msRest.ServiceCallback): void; - /** - * @param faceListId Id referencing a particular face list. - * @param name User defined name, maximum length is 128. - * @param options The optional parameters - * @param callback The callback - */ - create(faceListId: string, name: string, options: Models.FaceListCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(faceListId: string, name: string, options?: Models.FaceListCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + faceListId: string, + name: string, + options?: FaceListCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceListId, - name, - options - }, - createOperationSpec, - callback); + { faceListId, name, options }, + createOperationSpec + ); } /** * Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. + * * @param faceListId Id referencing a particular face list. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(faceListId: string, options?: Models.FaceListGetOptionalParams): Promise; - /** - * @param faceListId Id referencing a particular face list. - * @param callback The callback - */ - get(faceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param faceListId Id referencing a particular face list. - * @param options The optional parameters - * @param callback The callback - */ - get(faceListId: string, options: Models.FaceListGetOptionalParams, callback: msRest.ServiceCallback): void; - get(faceListId: string, options?: Models.FaceListGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + faceListId: string, + options?: FaceListGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceListId, - options - }, - getOperationSpec, - callback) as Promise; + { faceListId, options }, + getOperationSpec + ); } /** * Update information of a face list. * @param faceListId Id referencing a particular face list. - * @param [options] The optional parameters - * @returns Promise - */ - update(faceListId: string, options?: Models.FaceListUpdateOptionalParams): Promise; - /** - * @param faceListId Id referencing a particular face list. - * @param callback The callback + * @param options The options parameters. */ - update(faceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param faceListId Id referencing a particular face list. - * @param options The optional parameters - * @param callback The callback - */ - update(faceListId: string, options: Models.FaceListUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(faceListId: string, options?: Models.FaceListUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + faceListId: string, + options?: FaceListUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceListId, - options - }, - updateOperationSpec, - callback); + { faceListId, options }, + updateOperationSpec + ); } /** * Delete a specified face list. * @param faceListId Id referencing a particular face list. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(faceListId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param faceListId Id referencing a particular face list. - * @param callback The callback - */ - deleteMethod(faceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param faceListId Id referencing a particular face list. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(faceListId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(faceListId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + faceListId: string, + options?: FaceListDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceListId, - options - }, - deleteMethodOperationSpec, - callback); + { faceListId, options }, + deleteOperationSpec + ); } /** * List face lists’ faceListId, name, userData and recognitionModel.
* To get face information inside faceList use [FaceList - * Get](https://docs.microsoft.com/rest/api/faceapi/facelist/get) - * @param [options] The optional parameters - * @returns Promise + * + * @param options The options parameters. */ - list(options?: Models.FaceListListOptionalParams): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: Models.FaceListListOptionalParams, callback: msRest.ServiceCallback): void; - list(options?: Models.FaceListListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; + list(options?: FaceListListOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** @@ -197,40 +140,25 @@ export class FaceListOperations { * different face lists are in parallel. * @param faceListId Id referencing a particular face list. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteFace(faceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param faceListId Id referencing a particular face list. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback - */ - deleteFace(faceListId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** - * @param faceListId Id referencing a particular face list. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback - */ - deleteFace(faceListId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteFace(faceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + deleteFace( + faceListId: string, + persistedFaceId: string, + options?: FaceListDeleteFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceListId, - persistedFaceId, - options - }, - deleteFaceOperationSpec, - callback); + { faceListId, persistedFaceId, options }, + deleteFaceOperationSpec + ); } /** * Add a face to a specified face list, up to 1,000 faces. - *
To deal with an image contains multiple faces, input face can be specified as an image - * with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image - * will be stored. Only the extracted face feature will be stored on server until [FaceList - - * Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + *
To deal with an image contains multiple faces, input face can be specified as an image with a + * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be + * stored. Only the extracted face feature will be stored on server until [FaceList - Delete + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). @@ -243,52 +171,37 @@ export class FaceListOperations { * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. - * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions - * will cause failures. - * * Adding/deleting faces to/from a same face list are processed sequentially and to/from - * different face lists are in parallel. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same face list are processed sequentially and to/from different + * face lists are in parallel. * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). * @param faceListId Id referencing a particular face list. * @param url Publicly reachable URL of an image - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - addFaceFromUrl(faceListId: string, url: string, options?: Models.FaceListAddFaceFromUrlOptionalParams): Promise; - /** - * @param faceListId Id referencing a particular face list. - * @param url Publicly reachable URL of an image - * @param callback The callback - */ - addFaceFromUrl(faceListId: string, url: string, callback: msRest.ServiceCallback): void; - /** - * @param faceListId Id referencing a particular face list. - * @param url Publicly reachable URL of an image - * @param options The optional parameters - * @param callback The callback - */ - addFaceFromUrl(faceListId: string, url: string, options: Models.FaceListAddFaceFromUrlOptionalParams, callback: msRest.ServiceCallback): void; - addFaceFromUrl(faceListId: string, url: string, options?: Models.FaceListAddFaceFromUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + addFaceFromUrl( + faceListId: string, + url: string, + options?: FaceListAddFaceFromUrlOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceListId, - url, - options - }, - addFaceFromUrlOperationSpec, - callback) as Promise; + { faceListId, url, options }, + addFaceFromUrlOperationSpec + ); } /** * Add a face to a specified face list, up to 1,000 faces. - *
To deal with an image contains multiple faces, input face can be specified as an image - * with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image - * will be stored. Only the extracted face feature will be stored on server until [FaceList - - * Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + *
To deal with an image contains multiple faces, input face can be specified as an image with a + * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be + * stored. Only the extracted face feature will be stored on server until [FaceList - Delete + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). @@ -301,92 +214,59 @@ export class FaceListOperations { * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. - * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions - * will cause failures. - * * Adding/deleting faces to/from a same face list are processed sequentially and to/from - * different face lists are in parallel. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same face list are processed sequentially and to/from different + * face lists are in parallel. * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). * @param faceListId Id referencing a particular face list. * @param image An image stream. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - addFaceFromStream(faceListId: string, image: msRest.HttpRequestBody, options?: Models.FaceListAddFaceFromStreamOptionalParams): Promise; - /** - * @param faceListId Id referencing a particular face list. - * @param image An image stream. - * @param callback The callback - */ - addFaceFromStream(faceListId: string, image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; - /** - * @param faceListId Id referencing a particular face list. - * @param image An image stream. - * @param options The optional parameters - * @param callback The callback - */ - addFaceFromStream(faceListId: string, image: msRest.HttpRequestBody, options: Models.FaceListAddFaceFromStreamOptionalParams, callback: msRest.ServiceCallback): void; - addFaceFromStream(faceListId: string, image: msRest.HttpRequestBody, options?: Models.FaceListAddFaceFromStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + addFaceFromStream( + faceListId: string, + image: coreRestPipeline.RequestBodyType, + options?: FaceListAddFaceFromStreamOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - faceListId, - image, - options - }, - addFaceFromStreamOperationSpec, - callback) as Promise; + { faceListId, image, options }, + addFaceFromStreamOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/facelists/{faceListId}", httpMethod: "PUT", - path: "facelists/{faceListId}", - urlParameters: [ - Parameters.endpoint, - Parameters.faceListId - ], - requestBody: { - parameterPath: { - name: "name", - userData: [ - "options", - "userData" - ], - recognitionModel: [ - "options", - "recognitionModel" - ] - }, - mapper: { - ...Mappers.MetaDataContract, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["name"], + userData: ["options", "userData"], + recognitionModel: ["options", "recognitionModel"] + }, + mapper: { ...Mappers.MetaDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.faceListId1], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const getOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: "/facelists/{faceListId}", httpMethod: "GET", - path: "facelists/{faceListId}", - urlParameters: [ - Parameters.endpoint, - Parameters.faceListId - ], - queryParameters: [ - Parameters.returnRecognitionModel - ], responses: { 200: { bodyMapper: Mappers.FaceList @@ -395,78 +275,54 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.returnRecognitionModel], + urlParameters: [Parameters.endpoint, Parameters.faceListId1], + headerParameters: [Parameters.accept], serializer }; - -const updateOperationSpec: msRest.OperationSpec = { +const updateOperationSpec: coreClient.OperationSpec = { + path: "/facelists/{faceListId}", httpMethod: "PATCH", - path: "facelists/{faceListId}", - urlParameters: [ - Parameters.endpoint, - Parameters.faceListId - ], - requestBody: { - parameterPath: { - name: [ - "options", - "name" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.NameAndUserDataContract, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["options", "name"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.NameAndUserDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.faceListId1], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/facelists/{faceListId}", httpMethod: "DELETE", - path: "facelists/{faceListId}", - urlParameters: [ - Parameters.endpoint, - Parameters.faceListId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.faceListId1], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/facelists", httpMethod: "GET", - path: "facelists", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.returnRecognitionModel - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "FaceList" - } - } + element: { type: { name: "Composite", className: "FaceList" } } } } }, @@ -474,47 +330,31 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.returnRecognitionModel], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.accept], serializer }; - -const deleteFaceOperationSpec: msRest.OperationSpec = { +const deleteFaceOperationSpec: coreClient.OperationSpec = { + path: "/facelists/{faceListId}/persistedfaces/{persistedFaceId}", httpMethod: "DELETE", - path: "facelists/{faceListId}/persistedfaces/{persistedFaceId}", - urlParameters: [ - Parameters.endpoint, - Parameters.faceListId, - Parameters.persistedFaceId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const addFaceFromUrlOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "facelists/{faceListId}/persistedfaces", urlParameters: [ Parameters.endpoint, - Parameters.faceListId - ], - queryParameters: [ - Parameters.userData, - Parameters.targetFace, - Parameters.detectionModel + Parameters.persistedFaceId, + Parameters.faceListId1 ], - requestBody: { - parameterPath: { - url: "url" - }, - mapper: { - ...Mappers.ImageUrl, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const addFaceFromUrlOperationSpec: coreClient.OperationSpec = { + path: "/facelists/{faceListId}/persistedfaces", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -523,32 +363,23 @@ const addFaceFromUrlOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { url: ["url"] }, + mapper: { ...Mappers.ImageUrl, required: true } + }, + queryParameters: [ + Parameters.detectionModel, + Parameters.userData2, + Parameters.targetFace + ], + urlParameters: [Parameters.endpoint, Parameters.faceListId1], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const addFaceFromStreamOperationSpec: msRest.OperationSpec = { +const addFaceFromStreamOperationSpec: coreClient.OperationSpec = { + path: "/facelists/{faceListId}/persistedfaces", httpMethod: "POST", - path: "facelists/{faceListId}/persistedfaces", - urlParameters: [ - Parameters.endpoint, - Parameters.faceListId - ], - queryParameters: [ - Parameters.userData, - Parameters.targetFace, - Parameters.detectionModel - ], - requestBody: { - parameterPath: "image", - mapper: { - required: true, - serializedName: "Image", - type: { - name: "Stream" - } - } - }, - contentType: "application/octet-stream", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -557,5 +388,14 @@ const addFaceFromStreamOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: Parameters.image, + queryParameters: [ + Parameters.detectionModel, + Parameters.userData2, + Parameters.targetFace + ], + urlParameters: [Parameters.endpoint, Parameters.faceListId1], + headerParameters: [Parameters.contentType1, Parameters.accept1], + mediaType: "binary", serializer }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/index.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/index.ts index 3a6f9ae466be..77c859e722a0 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/index.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/index.ts @@ -1,11 +1,9 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./face"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largeFaceListOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largeFaceListOperations.ts index 588c81241273..0bdf0f859989 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largeFaceListOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largeFaceListOperations.ts @@ -1,46 +1,66 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/largeFaceListOperationsMappers"; +import { LargeFaceListOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { FaceClientContext } from "../faceClientContext"; +import { FaceClient } from "../faceClient"; +import { + LargeFaceListCreateOptionalParams, + LargeFaceListGetOptionalParams, + LargeFaceListGetResponse, + LargeFaceListUpdateOptionalParams, + LargeFaceListDeleteOptionalParams, + LargeFaceListGetTrainingStatusOptionalParams, + LargeFaceListGetTrainingStatusResponse, + LargeFaceListListOptionalParams, + LargeFaceListListResponse, + LargeFaceListTrainOptionalParams, + LargeFaceListDeleteFaceOptionalParams, + LargeFaceListGetFaceOptionalParams, + LargeFaceListGetFaceResponse, + LargeFaceListUpdateFaceOptionalParams, + LargeFaceListAddFaceFromUrlOptionalParams, + LargeFaceListAddFaceFromUrlResponse, + LargeFaceListListFacesOptionalParams, + LargeFaceListListFacesResponse, + LargeFaceListAddFaceFromStreamOptionalParams, + LargeFaceListAddFaceFromStreamResponse +} from "../models"; -/** Class representing a LargeFaceListOperations. */ -export class LargeFaceListOperations { - private readonly client: FaceClientContext; +/** Class containing LargeFaceListOperations operations. */ +export class LargeFaceListOperationsImpl implements LargeFaceListOperations { + private readonly client: FaceClient; /** - * Create a LargeFaceListOperations. - * @param {FaceClientContext} client Reference to the service client. + * Initialize a new instance of the class LargeFaceListOperations class. + * @param client Reference to the service client */ - constructor(client: FaceClientContext) { + constructor(client: FaceClient) { this.client = client; } /** - * Create an empty large face list with user-specified largeFaceListId, name, an optional userData - * and recognitionModel. + * Create an empty large face list with user-specified largeFaceListId, name, an optional userData and + * recognitionModel. *
Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - Find * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). *
After creation, user should use [LargeFaceList Face - - * Add](https://docs.microsoft.com/rest/api/faceapi/largefacelist/addfacefromurl) to import the - * faces and [LargeFaceList - - * Train](https://docs.microsoft.com/rest/api/faceapi/largefacelist/train) to make it ready for - * [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). No image - * will be stored. Only the extracted face features are stored on server until [LargeFaceList - + * Add](https://docs.microsoft.com/rest/api/faceapi/largefacelist/addfacefromurl) to import the faces + * and [LargeFaceList - Train](https://docs.microsoft.com/rest/api/faceapi/largefacelist/train) to make + * it ready for [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). No + * image will be stored. Only the extracted face features are stored on server until [LargeFaceList - * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. - *
Find Similar is used for scenario like finding celebrity-like faces, similar face - * filtering, or as a light way face identification. But if the actual use is to identify person, - * please use [PersonGroup](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + *
Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, + * or as a light way face identification. But if the actual use is to identify person, please use + * [PersonGroup](https://docs.microsoft.com/rest/api/faceapi/persongroup) / * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). *
'recognitionModel' should be specified to associate with this large face list. The default @@ -56,245 +76,136 @@ export class LargeFaceListOperations { * * S0-tier subscription quota: 1,000,000 large face lists. * @param largeFaceListId Id referencing a particular large face list. * @param name User defined name, maximum length is 128. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(largeFaceListId: string, name: string, options?: Models.LargeFaceListCreateOptionalParams): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param name User defined name, maximum length is 128. - * @param callback The callback - */ - create(largeFaceListId: string, name: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param name User defined name, maximum length is 128. - * @param options The optional parameters - * @param callback The callback - */ - create(largeFaceListId: string, name: string, options: Models.LargeFaceListCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(largeFaceListId: string, name: string, options?: Models.LargeFaceListCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + largeFaceListId: string, + name: string, + options?: LargeFaceListCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - name, - options - }, - createOperationSpec, - callback); + { largeFaceListId, name, options }, + createOperationSpec + ); } /** * Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel. * @param largeFaceListId Id referencing a particular large face list. - * @param [options] The optional parameters - * @returns Promise - */ - get(largeFaceListId: string, options?: Models.LargeFaceListGetOptionalParams): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param callback The callback - */ - get(largeFaceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(largeFaceListId: string, options: Models.LargeFaceListGetOptionalParams, callback: msRest.ServiceCallback): void; - get(largeFaceListId: string, options?: Models.LargeFaceListGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + largeFaceListId: string, + options?: LargeFaceListGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - options - }, - getOperationSpec, - callback) as Promise; + { largeFaceListId, options }, + getOperationSpec + ); } /** * Update information of a large face list. * @param largeFaceListId Id referencing a particular large face list. - * @param [options] The optional parameters - * @returns Promise - */ - update(largeFaceListId: string, options?: Models.LargeFaceListUpdateOptionalParams): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param callback The callback - */ - update(largeFaceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - update(largeFaceListId: string, options: Models.LargeFaceListUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(largeFaceListId: string, options?: Models.LargeFaceListUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + largeFaceListId: string, + options?: LargeFaceListUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - options - }, - updateOperationSpec, - callback); + { largeFaceListId, options }, + updateOperationSpec + ); } /** * Delete a specified large face list. * @param largeFaceListId Id referencing a particular large face list. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(largeFaceListId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param callback The callback - */ - deleteMethod(largeFaceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(largeFaceListId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(largeFaceListId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + largeFaceListId: string, + options?: LargeFaceListDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - options - }, - deleteMethodOperationSpec, - callback); + { largeFaceListId, options }, + deleteOperationSpec + ); } /** * Retrieve the training status of a large face list (completed or ongoing). * @param largeFaceListId Id referencing a particular large face list. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getTrainingStatus(largeFaceListId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param callback The callback - */ - getTrainingStatus(largeFaceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param options The optional parameters - * @param callback The callback - */ - getTrainingStatus(largeFaceListId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getTrainingStatus(largeFaceListId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getTrainingStatus( + largeFaceListId: string, + options?: LargeFaceListGetTrainingStatusOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - options - }, - getTrainingStatusOperationSpec, - callback) as Promise; + { largeFaceListId, options }, + getTrainingStatusOperationSpec + ); } /** - * List large face lists’ information of largeFaceListId, name, userData and recognitionModel.
+ * List large face lists’ information of largeFaceListId, name, userData and recognitionModel.
* To get face information inside largeFaceList use [LargeFaceList Face - * Get](https://docs.microsoft.com/rest/api/faceapi/largefacelist/getface)
* * Large face lists are stored in alphabetical order of largeFaceListId. * * "start" parameter (string, optional) is a user-provided largeFaceListId value that returned - * entries have larger ids by string comparison. "start" set to empty to indicate return from the - * first item. + * entries have larger ids by string comparison. "start" set to empty to indicate return from the first + * item. * * "top" parameter (int, optional) specifies the number of entries to return. A maximal of 1000 - * entries can be returned in one call. To fetch more, you can specify "start" with the last - * returned entry’s Id of the current call. + * entries can be returned in one call. To fetch more, you can specify "start" with the last returned + * entry’s Id of the current call. *
* For example, total 5 large person lists: "list1", ..., "list5". *
"start=&top=" will return all 5 lists. *
"start=&top=2" will return "list1", "list2". *
"start=list2&top=3" will return "list3", "list4", "list5". - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: Models.LargeFaceListListOptionalParams): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback + * + * @param options The options parameters. */ - list(options: Models.LargeFaceListListOptionalParams, callback: msRest.ServiceCallback): void; - list(options?: Models.LargeFaceListListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; + list( + options?: LargeFaceListListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Queue a large face list training task, the training task may not be started immediately. * @param largeFaceListId Id referencing a particular large face list. - * @param [options] The optional parameters - * @returns Promise - */ - train(largeFaceListId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param callback The callback + * @param options The options parameters. */ - train(largeFaceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param options The optional parameters - * @param callback The callback - */ - train(largeFaceListId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - train(largeFaceListId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + train( + largeFaceListId: string, + options?: LargeFaceListTrainOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - options - }, - trainOperationSpec, - callback); + { largeFaceListId, options }, + trainOperationSpec + ); } /** * Delete a face from a large face list by specified largeFaceListId and persistedFaceId. - *
Adding/deleting faces to/from a same large face list are processed sequentially and - * to/from different large face lists are in parallel. - * @param largeFaceListId Id referencing a particular large face list. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise - */ - deleteFace(largeFaceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback - */ - deleteFace(largeFaceListId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** + *
Adding/deleting faces to/from a same large face list are processed sequentially and to/from + * different large face lists are in parallel. * @param largeFaceListId Id referencing a particular large face list. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteFace(largeFaceListId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteFace(largeFaceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + deleteFace( + largeFaceListId: string, + persistedFaceId: string, + options?: LargeFaceListDeleteFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - persistedFaceId, - options - }, - deleteFaceOperationSpec, - callback); + { largeFaceListId, persistedFaceId, options }, + deleteFaceOperationSpec + ); } /** @@ -302,93 +213,62 @@ export class LargeFaceListOperations { * largeFaceListId). * @param largeFaceListId Id referencing a particular large face list. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getFace(largeFaceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback - */ - getFace(largeFaceListId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback - */ - getFace(largeFaceListId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getFace(largeFaceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getFace( + largeFaceListId: string, + persistedFaceId: string, + options?: LargeFaceListGetFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - persistedFaceId, - options - }, - getFaceOperationSpec, - callback) as Promise; + { largeFaceListId, persistedFaceId, options }, + getFaceOperationSpec + ); } /** * Update a persisted face's userData field. * @param largeFaceListId Id referencing a particular large face list. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise - */ - updateFace(largeFaceListId: string, persistedFaceId: string, options?: Models.LargeFaceListUpdateFaceOptionalParams): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback - */ - updateFace(largeFaceListId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - updateFace(largeFaceListId: string, persistedFaceId: string, options: Models.LargeFaceListUpdateFaceOptionalParams, callback: msRest.ServiceCallback): void; - updateFace(largeFaceListId: string, persistedFaceId: string, options?: Models.LargeFaceListUpdateFaceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + updateFace( + largeFaceListId: string, + persistedFaceId: string, + options?: LargeFaceListUpdateFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - persistedFaceId, - options - }, - updateFaceOperationSpec, - callback); + { largeFaceListId, persistedFaceId, options }, + updateFaceOperationSpec + ); } /** * Add a face to a specified large face list, up to 1,000,000 faces. - *
To deal with an image contains multiple faces, input face can be specified as an image - * with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image - * will be stored. Only the extracted face feature will be stored on server until [LargeFaceList - * Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or - * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is - * called. + *
To deal with an image contains multiple faces, input face can be specified as an image with a + * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be + * stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). - * * Higher face image quality means better recognition precision. Please consider high-quality - * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is * from 1KB to 6MB. * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. - * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions - * will cause failures. - * * Adding/deleting faces to/from a same face list are processed sequentially and to/from - * different face lists are in parallel. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same face list are processed sequentially and to/from different + * face lists are in parallel. * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) * * Quota: @@ -396,90 +276,61 @@ export class LargeFaceListOperations { * * S0-tier subscription quota: 1,000,000 faces per large face list. * @param largeFaceListId Id referencing a particular large face list. * @param url Publicly reachable URL of an image - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - addFaceFromUrl(largeFaceListId: string, url: string, options?: Models.LargeFaceListAddFaceFromUrlOptionalParams): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param url Publicly reachable URL of an image - * @param callback The callback - */ - addFaceFromUrl(largeFaceListId: string, url: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param url Publicly reachable URL of an image - * @param options The optional parameters - * @param callback The callback - */ - addFaceFromUrl(largeFaceListId: string, url: string, options: Models.LargeFaceListAddFaceFromUrlOptionalParams, callback: msRest.ServiceCallback): void; - addFaceFromUrl(largeFaceListId: string, url: string, options?: Models.LargeFaceListAddFaceFromUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + addFaceFromUrl( + largeFaceListId: string, + url: string, + options?: LargeFaceListAddFaceFromUrlOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - url, - options - }, - addFaceFromUrlOperationSpec, - callback) as Promise; + { largeFaceListId, url, options }, + addFaceFromUrlOperationSpec + ); } /** * List all faces in a large face list, and retrieve face information (including userData and * persistedFaceIds of registered faces of the face). * @param largeFaceListId Id referencing a particular large face list. - * @param [options] The optional parameters - * @returns Promise - */ - listFaces(largeFaceListId: string, options?: Models.LargeFaceListListFacesOptionalParams): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param callback The callback + * @param options The options parameters. */ - listFaces(largeFaceListId: string, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param options The optional parameters - * @param callback The callback - */ - listFaces(largeFaceListId: string, options: Models.LargeFaceListListFacesOptionalParams, callback: msRest.ServiceCallback): void; - listFaces(largeFaceListId: string, options?: Models.LargeFaceListListFacesOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + listFaces( + largeFaceListId: string, + options?: LargeFaceListListFacesOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - options - }, - listFacesOperationSpec, - callback) as Promise; + { largeFaceListId, options }, + listFacesOperationSpec + ); } /** * Add a face to a specified large face list, up to 1,000,000 faces. - *
To deal with an image contains multiple faces, input face can be specified as an image - * with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image - * will be stored. Only the extracted face feature will be stored on server until [LargeFaceList - * Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or - * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is - * called. + *
To deal with an image contains multiple faces, input face can be specified as an image with a + * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be + * stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). - * * Higher face image quality means better recognition precision. Please consider high-quality - * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is * from 1KB to 6MB. * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. - * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions - * will cause failures. - * * Adding/deleting faces to/from a same face list are processed sequentially and to/from - * different face lists are in parallel. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same face list are processed sequentially and to/from different + * face lists are in parallel. * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). * * Quota: @@ -487,80 +338,47 @@ export class LargeFaceListOperations { * * S0-tier subscription quota: 1,000,000 faces per large face list. * @param largeFaceListId Id referencing a particular large face list. * @param image An image stream. - * @param [options] The optional parameters - * @returns Promise - */ - addFaceFromStream(largeFaceListId: string, image: msRest.HttpRequestBody, options?: Models.LargeFaceListAddFaceFromStreamOptionalParams): Promise; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param image An image stream. - * @param callback The callback - */ - addFaceFromStream(largeFaceListId: string, image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; - /** - * @param largeFaceListId Id referencing a particular large face list. - * @param image An image stream. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - addFaceFromStream(largeFaceListId: string, image: msRest.HttpRequestBody, options: Models.LargeFaceListAddFaceFromStreamOptionalParams, callback: msRest.ServiceCallback): void; - addFaceFromStream(largeFaceListId: string, image: msRest.HttpRequestBody, options?: Models.LargeFaceListAddFaceFromStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + addFaceFromStream( + largeFaceListId: string, + image: coreRestPipeline.RequestBodyType, + options?: LargeFaceListAddFaceFromStreamOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largeFaceListId, - image, - options - }, - addFaceFromStreamOperationSpec, - callback) as Promise; + { largeFaceListId, image, options }, + addFaceFromStreamOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}", httpMethod: "PUT", - path: "largefacelists/{largeFaceListId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId - ], - requestBody: { - parameterPath: { - name: "name", - userData: [ - "options", - "userData" - ], - recognitionModel: [ - "options", - "recognitionModel" - ] - }, - mapper: { - ...Mappers.MetaDataContract, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["name"], + userData: ["options", "userData"], + recognitionModel: ["options", "recognitionModel"] + }, + mapper: { ...Mappers.MetaDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const getOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}", httpMethod: "GET", - path: "largefacelists/{largeFaceListId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId - ], - queryParameters: [ - Parameters.returnRecognitionModel - ], responses: { 200: { bodyMapper: Mappers.LargeFaceList @@ -569,64 +387,48 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.returnRecognitionModel], + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.accept], serializer }; - -const updateOperationSpec: msRest.OperationSpec = { +const updateOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}", httpMethod: "PATCH", - path: "largefacelists/{largeFaceListId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId - ], - requestBody: { - parameterPath: { - name: [ - "options", - "name" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.NameAndUserDataContract, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["options", "name"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.NameAndUserDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}", httpMethod: "DELETE", - path: "largefacelists/{largeFaceListId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.accept], serializer }; - -const getTrainingStatusOperationSpec: msRest.OperationSpec = { +const getTrainingStatusOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}/training", httpMethod: "GET", - path: "largefacelists/{largeFaceListId}/training", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId - ], responses: { 200: { bodyMapper: Mappers.TrainingStatus @@ -635,32 +437,19 @@ const getTrainingStatusOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists", httpMethod: "GET", - path: "largefacelists", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.returnRecognitionModel, - Parameters.start0, - Parameters.top0 - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "LargeFaceList" - } - } + element: { type: { name: "Composite", className: "LargeFaceList" } } } } }, @@ -668,50 +457,48 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [ + Parameters.returnRecognitionModel, + Parameters.start, + Parameters.top + ], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.accept], serializer }; - -const trainOperationSpec: msRest.OperationSpec = { +const trainOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}/train", httpMethod: "POST", - path: "largefacelists/{largeFaceListId}/train", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId - ], responses: { 202: {}, default: { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.accept], serializer }; - -const deleteFaceOperationSpec: msRest.OperationSpec = { +const deleteFaceOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", httpMethod: "DELETE", - path: "largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId, - Parameters.persistedFaceId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const getFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", urlParameters: [ Parameters.endpoint, - Parameters.largeFaceListId, - Parameters.persistedFaceId + Parameters.persistedFaceId, + Parameters.largeFaceListId1 ], + headerParameters: [Parameters.accept], + serializer +}; +const getFaceOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -720,59 +507,39 @@ const getFaceOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const updateFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", urlParameters: [ Parameters.endpoint, - Parameters.largeFaceListId, - Parameters.persistedFaceId + Parameters.persistedFaceId, + Parameters.largeFaceListId1 ], - requestBody: { - parameterPath: { - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.UpdateFaceRequest, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const updateFaceOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", + httpMethod: "PATCH", responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const addFaceFromUrlOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "largefacelists/{largeFaceListId}/persistedfaces", + requestBody: { + parameterPath: { userData: ["options", "userData"] }, + mapper: { ...Mappers.UpdateFaceRequest, required: true } + }, urlParameters: [ Parameters.endpoint, - Parameters.largeFaceListId + Parameters.persistedFaceId, + Parameters.largeFaceListId1 ], - queryParameters: [ - Parameters.userData, - Parameters.targetFace, - Parameters.detectionModel - ], - requestBody: { - parameterPath: { - url: "url" - }, - mapper: { - ...Mappers.ImageUrl, - required: true - } - }, + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const addFaceFromUrlOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}/persistedfaces", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -781,32 +548,29 @@ const addFaceFromUrlOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { url: ["url"] }, + mapper: { ...Mappers.ImageUrl, required: true } + }, + queryParameters: [ + Parameters.detectionModel, + Parameters.userData2, + Parameters.targetFace + ], + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listFacesOperationSpec: msRest.OperationSpec = { +const listFacesOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}/persistedfaces", httpMethod: "GET", - path: "largefacelists/{largeFaceListId}/persistedfaces", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId - ], - queryParameters: [ - Parameters.start0, - Parameters.top0 - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "PersistedFace" - } - } + element: { type: { name: "Composite", className: "PersistedFace" } } } } }, @@ -814,32 +578,14 @@ const listFacesOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.start, Parameters.top], + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.accept], serializer }; - -const addFaceFromStreamOperationSpec: msRest.OperationSpec = { +const addFaceFromStreamOperationSpec: coreClient.OperationSpec = { + path: "/largefacelists/{largeFaceListId}/persistedfaces", httpMethod: "POST", - path: "largefacelists/{largeFaceListId}/persistedfaces", - urlParameters: [ - Parameters.endpoint, - Parameters.largeFaceListId - ], - queryParameters: [ - Parameters.userData, - Parameters.targetFace, - Parameters.detectionModel - ], - requestBody: { - parameterPath: "image", - mapper: { - required: true, - serializedName: "Image", - type: { - name: "Stream" - } - } - }, - contentType: "application/octet-stream", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -848,5 +594,14 @@ const addFaceFromStreamOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: Parameters.image, + queryParameters: [ + Parameters.detectionModel, + Parameters.userData2, + Parameters.targetFace + ], + urlParameters: [Parameters.endpoint, Parameters.largeFaceListId1], + headerParameters: [Parameters.contentType1, Parameters.accept1], + mediaType: "binary", serializer }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupOperations.ts index 09eb2bfee4c8..fd6298211004 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupOperations.ts @@ -1,53 +1,64 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/largePersonGroupOperationsMappers"; +import { LargePersonGroupOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { FaceClientContext } from "../faceClientContext"; +import { FaceClient } from "../faceClient"; +import { + LargePersonGroupCreateOptionalParams, + LargePersonGroupDeleteOptionalParams, + LargePersonGroupGetOptionalParams, + LargePersonGroupGetResponse, + LargePersonGroupUpdateOptionalParams, + LargePersonGroupGetTrainingStatusOptionalParams, + LargePersonGroupGetTrainingStatusResponse, + LargePersonGroupListOptionalParams, + LargePersonGroupListResponse, + LargePersonGroupTrainOptionalParams +} from "../models"; -/** Class representing a LargePersonGroupOperations. */ -export class LargePersonGroupOperations { - private readonly client: FaceClientContext; +/** Class containing LargePersonGroupOperations operations. */ +export class LargePersonGroupOperationsImpl + implements LargePersonGroupOperations { + private readonly client: FaceClient; /** - * Create a LargePersonGroupOperations. - * @param {FaceClientContext} client Reference to the service client. + * Initialize a new instance of the class LargePersonGroupOperations class. + * @param client Reference to the service client */ - constructor(client: FaceClientContext) { + constructor(client: FaceClient) { this.client = client; } /** - * Create a new large person group with user-specified largePersonGroupId, name, an optional - * userData and recognitionModel. - *
A large person group is the container of the uploaded person data, including face - * recognition feature, and up to 1,000,000 + * Create a new large person group with user-specified largePersonGroupId, name, an optional userData + * and recognitionModel. + *
A large person group is the container of the uploaded person data, including face recognition + * feature, and up to 1,000,000 * people. *
After creation, use [LargePersonGroup Person - * Create](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/create) to add person * into the group, and call [LargePersonGroup - - * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train) to get this group - * ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). + * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train) to get this group ready + * for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). *
No image will be stored. Only the person's extracted face features and userData will be * stored on server until [LargePersonGroup Person - * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or - * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) - * is called. - *
'recognitionModel' should be specified to associate with this large person group. The - * default value for 'recognitionModel' is 'recognition_01', if the latest model needed, please - * explicitly specify the model you need in this parameter. New faces that are added to an existing - * large person group will use the recognition model that's already associated with the collection. - * Existing face features in a large person group can't be updated to features extracted by another - * version of recognition model. Please refer to [Specify a face recognition + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is + * called. + *
'recognitionModel' should be specified to associate with this large person group. The default + * value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly + * specify the model you need in this parameter. New faces that are added to an existing large person + * group will use the recognition model that's already associated with the collection. Existing face + * features in a large person group can't be updated to features extracted by another version of + * recognition model. Please refer to [Specify a face recognition * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). * * Large person group quota: @@ -55,278 +66,165 @@ export class LargePersonGroupOperations { * * S0-tier subscription quota: 1,000,000 large person groups. * @param largePersonGroupId Id referencing a particular large person group. * @param name User defined name, maximum length is 128. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(largePersonGroupId: string, name: string, options?: Models.LargePersonGroupCreateOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param name User defined name, maximum length is 128. - * @param callback The callback - */ - create(largePersonGroupId: string, name: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param name User defined name, maximum length is 128. - * @param options The optional parameters - * @param callback The callback - */ - create(largePersonGroupId: string, name: string, options: Models.LargePersonGroupCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(largePersonGroupId: string, name: string, options?: Models.LargePersonGroupCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + largePersonGroupId: string, + name: string, + options?: LargePersonGroupCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - name, - options - }, - createOperationSpec, - callback); + { largePersonGroupId, name, options }, + createOperationSpec + ); } /** * Delete an existing large person group. Persisted face features of all people in the large person * group will also be deleted. * @param largePersonGroupId Id referencing a particular large person group. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(largePersonGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(largePersonGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(largePersonGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(largePersonGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + largePersonGroupId: string, + options?: LargePersonGroupDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - options - }, - deleteMethodOperationSpec, - callback); + { largePersonGroupId, options }, + deleteOperationSpec + ); } /** - * Retrieve the information of a large person group, including its name, userData and - * recognitionModel. This API returns large person group information only, use [LargePersonGroup - * Person - List](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/list) instead - * to retrieve person information under the large person group. - * @param largePersonGroupId Id referencing a particular large person group. - * @param [options] The optional parameters - * @returns Promise - */ - get(largePersonGroupId: string, options?: Models.LargePersonGroupGetOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param callback The callback - */ - get(largePersonGroupId: string, callback: msRest.ServiceCallback): void; - /** + * Retrieve the information of a large person group, including its name, userData and recognitionModel. + * This API returns large person group information only, use [LargePersonGroup Person - + * List](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/list) instead to retrieve + * person information under the large person group. + * * @param largePersonGroupId Id referencing a particular large person group. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(largePersonGroupId: string, options: Models.LargePersonGroupGetOptionalParams, callback: msRest.ServiceCallback): void; - get(largePersonGroupId: string, options?: Models.LargePersonGroupGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + largePersonGroupId: string, + options?: LargePersonGroupGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - options - }, - getOperationSpec, - callback) as Promise; + { largePersonGroupId, options }, + getOperationSpec + ); } /** * Update an existing large person group's display name and userData. The properties which does not * appear in request body will not be updated. * @param largePersonGroupId Id referencing a particular large person group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(largePersonGroupId: string, options?: Models.LargePersonGroupUpdateOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param callback The callback - */ - update(largePersonGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param options The optional parameters - * @param callback The callback - */ - update(largePersonGroupId: string, options: Models.LargePersonGroupUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(largePersonGroupId: string, options?: Models.LargePersonGroupUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + largePersonGroupId: string, + options?: LargePersonGroupUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - options - }, - updateOperationSpec, - callback); + { largePersonGroupId, options }, + updateOperationSpec + ); } /** * Retrieve the training status of a large person group (completed or ongoing). * @param largePersonGroupId Id referencing a particular large person group. - * @param [options] The optional parameters - * @returns Promise - */ - getTrainingStatus(largePersonGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param callback The callback - */ - getTrainingStatus(largePersonGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - getTrainingStatus(largePersonGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getTrainingStatus(largePersonGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getTrainingStatus( + largePersonGroupId: string, + options?: LargePersonGroupGetTrainingStatusOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - options - }, - getTrainingStatusOperationSpec, - callback) as Promise; + { largePersonGroupId, options }, + getTrainingStatusOperationSpec + ); } /** - * List all existing large person groups’ largePersonGroupId, name, userData and - * recognitionModel.
+ * List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.
* * Large person groups are stored in alphabetical order of largePersonGroupId. * * "start" parameter (string, optional) is a user-provided largePersonGroupId value that returned - * entries have larger ids by string comparison. "start" set to empty to indicate return from the - * first item. + * entries have larger ids by string comparison. "start" set to empty to indicate return from the first + * item. * * "top" parameter (int, optional) specifies the number of entries to return. A maximal of 1000 - * entries can be returned in one call. To fetch more, you can specify "start" with the last - * returned entry’s Id of the current call. + * entries can be returned in one call. To fetch more, you can specify "start" with the last returned + * entry’s Id of the current call. *
* For example, total 5 large person groups: "group1", ..., "group5". *
"start=&top=" will return all 5 groups. *
"start=&top=2" will return "group1", "group2". *
"start=group2&top=3" will return "group3", "group4", "group5". - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: Models.LargePersonGroupListOptionalParams): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback + * + * @param options The options parameters. */ - list(options: Models.LargePersonGroupListOptionalParams, callback: msRest.ServiceCallback): void; - list(options?: Models.LargePersonGroupListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; + list( + options?: LargePersonGroupListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Queue a large person group training task, the training task may not be started immediately. * @param largePersonGroupId Id referencing a particular large person group. - * @param [options] The optional parameters - * @returns Promise - */ - train(largePersonGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param callback The callback - */ - train(largePersonGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - train(largePersonGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - train(largePersonGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + train( + largePersonGroupId: string, + options?: LargePersonGroupTrainOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - options - }, - trainOperationSpec, - callback); + { largePersonGroupId, options }, + trainOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}", httpMethod: "PUT", - path: "largepersongroups/{largePersonGroupId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId - ], - requestBody: { - parameterPath: { - name: "name", - userData: [ - "options", - "userData" - ], - recognitionModel: [ - "options", - "recognitionModel" - ] - }, - mapper: { - ...Mappers.MetaDataContract, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["name"], + userData: ["options", "userData"], + recognitionModel: ["options", "recognitionModel"] + }, + mapper: { ...Mappers.MetaDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.largePersonGroupId2], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}", httpMethod: "DELETE", - path: "largepersongroups/{largePersonGroupId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.largePersonGroupId2], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}", httpMethod: "GET", - path: "largepersongroups/{largePersonGroupId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId - ], - queryParameters: [ - Parameters.returnRecognitionModel - ], responses: { 200: { bodyMapper: Mappers.LargePersonGroup @@ -335,48 +233,35 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.returnRecognitionModel], + urlParameters: [Parameters.endpoint, Parameters.largePersonGroupId2], + headerParameters: [Parameters.accept], serializer }; - -const updateOperationSpec: msRest.OperationSpec = { +const updateOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}", httpMethod: "PATCH", - path: "largepersongroups/{largePersonGroupId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId - ], - requestBody: { - parameterPath: { - name: [ - "options", - "name" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.NameAndUserDataContract, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["options", "name"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.NameAndUserDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.largePersonGroupId2], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const getTrainingStatusOperationSpec: msRest.OperationSpec = { +const getTrainingStatusOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}/training", httpMethod: "GET", - path: "largepersongroups/{largePersonGroupId}/training", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId - ], responses: { 200: { bodyMapper: Mappers.TrainingStatus @@ -385,31 +270,20 @@ const getTrainingStatusOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.largePersonGroupId2], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups", httpMethod: "GET", - path: "largepersongroups", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.start1, - Parameters.top1, - Parameters.returnRecognitionModel - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", element: { - type: { - name: "Composite", - className: "LargePersonGroup" - } + type: { name: "Composite", className: "LargePersonGroup" } } } } @@ -418,21 +292,25 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [ + Parameters.returnRecognitionModel, + Parameters.start1, + Parameters.top1 + ], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.accept], serializer }; - -const trainOperationSpec: msRest.OperationSpec = { +const trainOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}/train", httpMethod: "POST", - path: "largepersongroups/{largePersonGroupId}/train", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId - ], responses: { 202: {}, default: { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.largePersonGroupId2], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupPerson.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupPerson.ts index 2491b447ce31..bf2012e4455e 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupPerson.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupPerson.ts @@ -1,223 +1,152 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/largePersonGroupPersonMappers"; +import { LargePersonGroupPerson } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { FaceClientContext } from "../faceClientContext"; +import { FaceClient } from "../faceClient"; +import { + LargePersonGroupPersonCreateOptionalParams, + LargePersonGroupPersonCreateResponse, + LargePersonGroupPersonListOptionalParams, + LargePersonGroupPersonListResponse, + LargePersonGroupPersonDeleteOptionalParams, + LargePersonGroupPersonGetOptionalParams, + LargePersonGroupPersonGetResponse, + LargePersonGroupPersonUpdateOptionalParams, + LargePersonGroupPersonDeleteFaceOptionalParams, + LargePersonGroupPersonGetFaceOptionalParams, + LargePersonGroupPersonGetFaceResponse, + LargePersonGroupPersonUpdateFaceOptionalParams, + LargePersonGroupPersonAddFaceFromUrlOptionalParams, + LargePersonGroupPersonAddFaceFromUrlResponse, + LargePersonGroupPersonAddFaceFromStreamOptionalParams, + LargePersonGroupPersonAddFaceFromStreamResponse +} from "../models"; -/** Class representing a LargePersonGroupPerson. */ -export class LargePersonGroupPerson { - private readonly client: FaceClientContext; +/** Class containing LargePersonGroupPerson operations. */ +export class LargePersonGroupPersonImpl implements LargePersonGroupPerson { + private readonly client: FaceClient; /** - * Create a LargePersonGroupPerson. - * @param {FaceClientContext} client Reference to the service client. + * Initialize a new instance of the class LargePersonGroupPerson class. + * @param client Reference to the service client */ - constructor(client: FaceClientContext) { + constructor(client: FaceClient) { this.client = client; } /** * Create a new person in a specified large person group. * @param largePersonGroupId Id referencing a particular large person group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(largePersonGroupId: string, options?: Models.LargePersonGroupPersonCreateOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param callback The callback - */ - create(largePersonGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param options The optional parameters - * @param callback The callback - */ - create(largePersonGroupId: string, options: Models.LargePersonGroupPersonCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(largePersonGroupId: string, options?: Models.LargePersonGroupPersonCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + largePersonGroupId: string, + options?: LargePersonGroupPersonCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - options - }, - createOperationSpec, - callback) as Promise; + { largePersonGroupId, options }, + createOperationSpec + ); } /** - * List all persons in a large person group, and retrieve person information (including personId, - * name, userData and persistedFaceIds of registered faces of the person). + * List all persons in a large person group, and retrieve person information (including personId, name, + * userData and persistedFaceIds of registered faces of the person). * @param largePersonGroupId Id referencing a particular large person group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(largePersonGroupId: string, options?: Models.LargePersonGroupPersonListOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param callback The callback - */ - list(largePersonGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param options The optional parameters - * @param callback The callback - */ - list(largePersonGroupId: string, options: Models.LargePersonGroupPersonListOptionalParams, callback: msRest.ServiceCallback): void; - list(largePersonGroupId: string, options?: Models.LargePersonGroupPersonListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + list( + largePersonGroupId: string, + options?: LargePersonGroupPersonListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - options - }, - listOperationSpec, - callback) as Promise; + { largePersonGroupId, options }, + listOperationSpec + ); } /** - * Delete an existing person from a large person group. The persistedFaceId, userData, person name - * and face feature in the person entry will all be deleted. + * Delete an existing person from a large person group. The persistedFaceId, userData, person name and + * face feature in the person entry will all be deleted. * @param largePersonGroupId Id referencing a particular large person group. * @param personId Id referencing a particular person. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(largePersonGroupId: string, personId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param callback The callback - */ - deleteMethod(largePersonGroupId: string, personId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(largePersonGroupId: string, personId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(largePersonGroupId: string, personId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + largePersonGroupId: string, + personId: string, + options?: LargePersonGroupPersonDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - personId, - options - }, - deleteMethodOperationSpec, - callback); + { largePersonGroupId, personId, options }, + deleteOperationSpec + ); } /** - * Retrieve a person's name and userData, and the persisted faceIds representing the registered - * person face feature. - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param [options] The optional parameters - * @returns Promise - */ - get(largePersonGroupId: string, personId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param callback The callback - */ - get(largePersonGroupId: string, personId: string, callback: msRest.ServiceCallback): void; - /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person + * face feature. * @param largePersonGroupId Id referencing a particular large person group. * @param personId Id referencing a particular person. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(largePersonGroupId: string, personId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(largePersonGroupId: string, personId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + largePersonGroupId: string, + personId: string, + options?: LargePersonGroupPersonGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - personId, - options - }, - getOperationSpec, - callback) as Promise; + { largePersonGroupId, personId, options }, + getOperationSpec + ); } /** * Update name or userData of a person. * @param largePersonGroupId Id referencing a particular large person group. * @param personId Id referencing a particular person. - * @param [options] The optional parameters - * @returns Promise - */ - update(largePersonGroupId: string, personId: string, options?: Models.LargePersonGroupPersonUpdateOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param callback The callback + * @param options The options parameters. */ - update(largePersonGroupId: string, personId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param options The optional parameters - * @param callback The callback - */ - update(largePersonGroupId: string, personId: string, options: Models.LargePersonGroupPersonUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(largePersonGroupId: string, personId: string, options?: Models.LargePersonGroupPersonUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + largePersonGroupId: string, + personId: string, + options?: LargePersonGroupPersonUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - personId, - options - }, - updateOperationSpec, - callback); + { largePersonGroupId, personId, options }, + updateOperationSpec + ); } /** - * Delete a face from a person in a large person group by specified largePersonGroupId, personId - * and persistedFaceId. - *
Adding/deleting faces to/from a same person will be processed sequentially. - * Adding/deleting faces to/from different persons are processed in parallel. - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise - */ - deleteFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback - */ - deleteFace(largePersonGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** + * Delete a face from a person in a large person group by specified largePersonGroupId, personId and + * persistedFaceId. + *
Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting + * faces to/from different persons are processed in parallel. * @param largePersonGroupId Id referencing a particular large person group. * @param personId Id referencing a particular person. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + deleteFace( + largePersonGroupId: string, + personId: string, + persistedFaceId: string, + options?: LargePersonGroupPersonDeleteFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - personId, - persistedFaceId, - options - }, - deleteFaceOperationSpec, - callback); + { largePersonGroupId, personId, persistedFaceId, options }, + deleteFaceOperationSpec + ); } /** @@ -226,35 +155,18 @@ export class LargePersonGroupPerson { * @param largePersonGroupId Id referencing a particular large person group. * @param personId Id referencing a particular person. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise - */ - getFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback - */ - getFace(largePersonGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - getFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getFace( + largePersonGroupId: string, + personId: string, + persistedFaceId: string, + options?: LargePersonGroupPersonGetFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - personId, - persistedFaceId, - options - }, - getFaceOperationSpec, - callback) as Promise; + { largePersonGroupId, personId, persistedFaceId, options }, + getFaceOperationSpec + ); } /** @@ -262,52 +174,34 @@ export class LargePersonGroupPerson { * @param largePersonGroupId Id referencing a particular large person group. * @param personId Id referencing a particular person. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - updateFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: Models.LargePersonGroupPersonUpdateFaceOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback - */ - updateFace(largePersonGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback - */ - updateFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options: Models.LargePersonGroupPersonUpdateFaceOptionalParams, callback: msRest.ServiceCallback): void; - updateFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: Models.LargePersonGroupPersonUpdateFaceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + updateFace( + largePersonGroupId: string, + personId: string, + persistedFaceId: string, + options?: LargePersonGroupPersonUpdateFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - personId, - persistedFaceId, - options - }, - updateFaceOperationSpec, - callback); + { largePersonGroupId, personId, persistedFaceId, options }, + updateFaceOperationSpec + ); } /** - * Add a face to a person into a large person group for face identification or verification. To - * deal with an image contains multiple faces, input face can be specified as an image with a - * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be - * stored. Only the extracted face feature will be stored on server until [LargePersonGroup - * PersonFace - + * Add a face to a person into a large person group for face identification or verification. To deal + * with an image contains multiple faces, input face can be specified as an image with a targetFace + * rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only + * the extracted face feature will be stored on server until [LargePersonGroup PersonFace - * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), * [LargePersonGroup Person - * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or - * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) - * is called. + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is + * called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). - * * Higher face image quality means better recognition precision. Please consider high-quality - * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. * * Each person entry can hold up to 248 faces. * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is * from 1KB to 6MB. @@ -315,65 +209,47 @@ export class LargePersonGroupPerson { * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. - * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions - * will cause failures. - * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting - * faces to/from different persons are processed in parallel. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces + * to/from different persons are processed in parallel. * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) * @param largePersonGroupId Id referencing a particular large person group. * @param personId Id referencing a particular person. * @param url Publicly reachable URL of an image - * @param [options] The optional parameters - * @returns Promise - */ - addFaceFromUrl(largePersonGroupId: string, personId: string, url: string, options?: Models.LargePersonGroupPersonAddFaceFromUrlOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param url Publicly reachable URL of an image - * @param callback The callback - */ - addFaceFromUrl(largePersonGroupId: string, personId: string, url: string, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param url Publicly reachable URL of an image - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - addFaceFromUrl(largePersonGroupId: string, personId: string, url: string, options: Models.LargePersonGroupPersonAddFaceFromUrlOptionalParams, callback: msRest.ServiceCallback): void; - addFaceFromUrl(largePersonGroupId: string, personId: string, url: string, options?: Models.LargePersonGroupPersonAddFaceFromUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + addFaceFromUrl( + largePersonGroupId: string, + personId: string, + url: string, + options?: LargePersonGroupPersonAddFaceFromUrlOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - personId, - url, - options - }, - addFaceFromUrlOperationSpec, - callback) as Promise; + { largePersonGroupId, personId, url, options }, + addFaceFromUrlOperationSpec + ); } /** - * Add a face to a person into a large person group for face identification or verification. To - * deal with an image contains multiple faces, input face can be specified as an image with a - * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be - * stored. Only the extracted face feature will be stored on server until [LargePersonGroup - * PersonFace - + * Add a face to a person into a large person group for face identification or verification. To deal + * with an image contains multiple faces, input face can be specified as an image with a targetFace + * rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only + * the extracted face feature will be stored on server until [LargePersonGroup PersonFace - * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), * [LargePersonGroup Person - * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or - * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) - * is called. + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is + * called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). - * * Higher face image quality means better recognition precision. Please consider high-quality - * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. * * Each person entry can hold up to 248 faces. * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is * from 1KB to 6MB. @@ -381,76 +257,39 @@ export class LargePersonGroupPerson { * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. - * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions - * will cause failures. - * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting - * faces to/from different persons are processed in parallel. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces + * to/from different persons are processed in parallel. * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). * @param largePersonGroupId Id referencing a particular large person group. * @param personId Id referencing a particular person. * @param image An image stream. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - addFaceFromStream(largePersonGroupId: string, personId: string, image: msRest.HttpRequestBody, options?: Models.LargePersonGroupPersonAddFaceFromStreamOptionalParams): Promise; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param image An image stream. - * @param callback The callback - */ - addFaceFromStream(largePersonGroupId: string, personId: string, image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; - /** - * @param largePersonGroupId Id referencing a particular large person group. - * @param personId Id referencing a particular person. - * @param image An image stream. - * @param options The optional parameters - * @param callback The callback - */ - addFaceFromStream(largePersonGroupId: string, personId: string, image: msRest.HttpRequestBody, options: Models.LargePersonGroupPersonAddFaceFromStreamOptionalParams, callback: msRest.ServiceCallback): void; - addFaceFromStream(largePersonGroupId: string, personId: string, image: msRest.HttpRequestBody, options?: Models.LargePersonGroupPersonAddFaceFromStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + addFaceFromStream( + largePersonGroupId: string, + personId: string, + image: coreRestPipeline.RequestBodyType, + options?: LargePersonGroupPersonAddFaceFromStreamOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - largePersonGroupId, - personId, - image, - options - }, - addFaceFromStreamOperationSpec, - callback) as Promise; + { largePersonGroupId, personId, image, options }, + addFaceFromStreamOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}/persons", httpMethod: "POST", - path: "largepersongroups/{largePersonGroupId}/persons", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId - ], - requestBody: { - parameterPath: { - name: [ - "options", - "name" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.NameAndUserDataContract, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.Person @@ -459,32 +298,27 @@ const createOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["options", "name"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.NameAndUserDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.largePersonGroupId2], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}/persons", httpMethod: "GET", - path: "largepersongroups/{largePersonGroupId}/persons", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId - ], - queryParameters: [ - Parameters.start0, - Parameters.top0 - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "Person" - } - } + element: { type: { name: "Composite", className: "Person" } } } } }, @@ -492,34 +326,31 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.start, Parameters.top], + urlParameters: [Parameters.endpoint, Parameters.largePersonGroupId2], + headerParameters: [Parameters.accept], serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}/persons/{personId}", httpMethod: "DELETE", - path: "largepersongroups/{largePersonGroupId}/persons/{personId}", - urlParameters: [ - Parameters.endpoint, - Parameters.largePersonGroupId, - Parameters.personId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "largepersongroups/{largePersonGroupId}/persons/{personId}", urlParameters: [ Parameters.endpoint, - Parameters.largePersonGroupId, - Parameters.personId + Parameters.personId1, + Parameters.largePersonGroupId2 ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}/persons/{personId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Person @@ -528,69 +359,62 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const updateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "largepersongroups/{largePersonGroupId}/persons/{personId}", urlParameters: [ Parameters.endpoint, - Parameters.largePersonGroupId, - Parameters.personId + Parameters.personId1, + Parameters.largePersonGroupId2 ], - requestBody: { - parameterPath: { - name: [ - "options", - "name" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.NameAndUserDataContract, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/largepersongroups/{largePersonGroupId}/persons/{personId}", + httpMethod: "PATCH", responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const deleteFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + requestBody: { + parameterPath: { + name: ["options", "name"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.NameAndUserDataContract, required: true } + }, urlParameters: [ Parameters.endpoint, - Parameters.largePersonGroupId, - Parameters.personId, - Parameters.persistedFaceId + Parameters.personId1, + Parameters.largePersonGroupId2 ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const deleteFaceOperationSpec: coreClient.OperationSpec = { + path: + "/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + httpMethod: "DELETE", responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const getFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", urlParameters: [ Parameters.endpoint, - Parameters.largePersonGroupId, - Parameters.personId, - Parameters.persistedFaceId + Parameters.personId1, + Parameters.persistedFaceId, + Parameters.largePersonGroupId2 ], + headerParameters: [Parameters.accept], + serializer +}; +const getFaceOperationSpec: coreClient.OperationSpec = { + path: + "/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -599,61 +423,43 @@ const getFaceOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const updateFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", urlParameters: [ Parameters.endpoint, - Parameters.largePersonGroupId, - Parameters.personId, - Parameters.persistedFaceId + Parameters.personId1, + Parameters.persistedFaceId, + Parameters.largePersonGroupId2 ], - requestBody: { - parameterPath: { - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.UpdateFaceRequest, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const updateFaceOperationSpec: coreClient.OperationSpec = { + path: + "/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + httpMethod: "PATCH", responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const addFaceFromUrlOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces", + requestBody: { + parameterPath: { userData: ["options", "userData"] }, + mapper: { ...Mappers.UpdateFaceRequest, required: true } + }, urlParameters: [ Parameters.endpoint, - Parameters.largePersonGroupId, - Parameters.personId - ], - queryParameters: [ - Parameters.userData, - Parameters.targetFace, - Parameters.detectionModel + Parameters.personId1, + Parameters.persistedFaceId, + Parameters.largePersonGroupId2 ], - requestBody: { - parameterPath: { - url: "url" - }, - mapper: { - ...Mappers.ImageUrl, - required: true - } - }, + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const addFaceFromUrlOperationSpec: coreClient.OperationSpec = { + path: + "/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -662,33 +468,28 @@ const addFaceFromUrlOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const addFaceFromStreamOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces", + requestBody: { + parameterPath: { url: ["url"] }, + mapper: { ...Mappers.ImageUrl, required: true } + }, + queryParameters: [ + Parameters.detectionModel, + Parameters.userData2, + Parameters.targetFace + ], urlParameters: [ Parameters.endpoint, - Parameters.largePersonGroupId, - Parameters.personId - ], - queryParameters: [ - Parameters.userData, - Parameters.targetFace, - Parameters.detectionModel + Parameters.personId1, + Parameters.largePersonGroupId2 ], - requestBody: { - parameterPath: "image", - mapper: { - required: true, - serializedName: "Image", - type: { - name: "Stream" - } - } - }, - contentType: "application/octet-stream", + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const addFaceFromStreamOperationSpec: coreClient.OperationSpec = { + path: + "/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -697,5 +498,18 @@ const addFaceFromStreamOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: Parameters.image, + queryParameters: [ + Parameters.detectionModel, + Parameters.userData2, + Parameters.targetFace + ], + urlParameters: [ + Parameters.endpoint, + Parameters.personId1, + Parameters.largePersonGroupId2 + ], + headerParameters: [Parameters.contentType1, Parameters.accept1], + mediaType: "binary", serializer }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupOperations.ts index cf6aa218924e..872a86a54971 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupOperations.ts @@ -1,28 +1,38 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/personGroupOperationsMappers"; +import { PersonGroupOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { FaceClientContext } from "../faceClientContext"; +import { FaceClient } from "../faceClient"; +import { + PersonGroupCreateOptionalParams, + PersonGroupDeleteOptionalParams, + PersonGroupGetOptionalParams, + PersonGroupGetResponse, + PersonGroupUpdateOptionalParams, + PersonGroupGetTrainingStatusOptionalParams, + PersonGroupGetTrainingStatusResponse, + PersonGroupListOptionalParams, + PersonGroupListResponse, + PersonGroupTrainOptionalParams +} from "../models"; -/** Class representing a PersonGroupOperations. */ -export class PersonGroupOperations { - private readonly client: FaceClientContext; +/** Class containing PersonGroupOperations operations. */ +export class PersonGroupOperationsImpl implements PersonGroupOperations { + private readonly client: FaceClient; /** - * Create a PersonGroupOperations. - * @param {FaceClientContext} client Reference to the service client. + * Initialize a new instance of the class PersonGroupOperations class. + * @param client Reference to the service client */ - constructor(client: FaceClientContext) { + constructor(client: FaceClient) { this.client = client; } @@ -32,20 +42,19 @@ export class PersonGroupOperations { *
A person group is the container of the uploaded person data, including face recognition * features. *
After creation, use [PersonGroup Person - - * Create](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/create) to add persons - * into the group, and then call [PersonGroup - - * Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) to get this group ready - * for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). + * Create](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/create) to add persons into + * the group, and then call [PersonGroup - + * Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) to get this group ready for + * [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). *
No image will be stored. Only the person's extracted face features and userData will be * stored on server until [PersonGroup Person - * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. - *
'recognitionModel' should be specified to associate with this person group. The default - * value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly - * specify the model you need in this parameter. New faces that are added to an existing person - * group will use the recognition model that's already associated with the collection. Existing - * face features in a person group can't be updated to features extracted by another version of - * recognition model. + *
'recognitionModel' should be specified to associate with this person group. The default value + * for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify + * the model you need in this parameter. New faces that are added to an existing person group will use + * the recognition model that's already associated with the collection. Existing face features in a + * person group can't be updated to features extracted by another version of recognition model. * * Person group quota: * * Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000 persons. @@ -54,61 +63,33 @@ export class PersonGroupOperations { * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup). * @param personGroupId Id referencing a particular person group. * @param name User defined name, maximum length is 128. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(personGroupId: string, name: string, options?: Models.PersonGroupCreateOptionalParams): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param name User defined name, maximum length is 128. - * @param callback The callback - */ - create(personGroupId: string, name: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param name User defined name, maximum length is 128. - * @param options The optional parameters - * @param callback The callback - */ - create(personGroupId: string, name: string, options: Models.PersonGroupCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(personGroupId: string, name: string, options?: Models.PersonGroupCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + personGroupId: string, + name: string, + options?: PersonGroupCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - name, - options - }, - createOperationSpec, - callback); + { personGroupId, name, options }, + createOperationSpec + ); } /** - * Delete an existing person group. Persisted face features of all people in the person group will - * also be deleted. - * @param personGroupId Id referencing a particular person group. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(personGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** + * Delete an existing person group. Persisted face features of all people in the person group will also + * be deleted. * @param personGroupId Id referencing a particular person group. - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(personGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(personGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(personGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + personGroupId: string, + options?: PersonGroupDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - options - }, - deleteMethodOperationSpec, - callback); + { personGroupId, options }, + deleteOperationSpec + ); } /** @@ -116,214 +97,127 @@ export class PersonGroupOperations { * personGroup, use [PersonGroup Person - * List](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/list). * @param personGroupId Id referencing a particular person group. - * @param [options] The optional parameters - * @returns Promise - */ - get(personGroupId: string, options?: Models.PersonGroupGetOptionalParams): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param callback The callback + * @param options The options parameters. */ - get(personGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param options The optional parameters - * @param callback The callback - */ - get(personGroupId: string, options: Models.PersonGroupGetOptionalParams, callback: msRest.ServiceCallback): void; - get(personGroupId: string, options?: Models.PersonGroupGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + personGroupId: string, + options?: PersonGroupGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - options - }, - getOperationSpec, - callback) as Promise; + { personGroupId, options }, + getOperationSpec + ); } /** - * Update an existing person group's display name and userData. The properties which does not - * appear in request body will not be updated. + * Update an existing person group's display name and userData. The properties which does not appear in + * request body will not be updated. * @param personGroupId Id referencing a particular person group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(personGroupId: string, options?: Models.PersonGroupUpdateOptionalParams): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param callback The callback - */ - update(personGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param options The optional parameters - * @param callback The callback - */ - update(personGroupId: string, options: Models.PersonGroupUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(personGroupId: string, options?: Models.PersonGroupUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + personGroupId: string, + options?: PersonGroupUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - options - }, - updateOperationSpec, - callback); + { personGroupId, options }, + updateOperationSpec + ); } /** * Retrieve the training status of a person group (completed or ongoing). * @param personGroupId Id referencing a particular person group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getTrainingStatus(personGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param callback The callback - */ - getTrainingStatus(personGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param options The optional parameters - * @param callback The callback - */ - getTrainingStatus(personGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getTrainingStatus(personGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getTrainingStatus( + personGroupId: string, + options?: PersonGroupGetTrainingStatusOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - options - }, - getTrainingStatusOperationSpec, - callback) as Promise; + { personGroupId, options }, + getTrainingStatusOperationSpec + ); } /** * List person groups’ personGroupId, name, userData and recognitionModel.
* * Person groups are stored in alphabetical order of personGroupId. - * * "start" parameter (string, optional) is a user-provided personGroupId value that returned - * entries have larger ids by string comparison. "start" set to empty to indicate return from the - * first item. + * * "start" parameter (string, optional) is a user-provided personGroupId value that returned entries + * have larger ids by string comparison. "start" set to empty to indicate return from the first item. * * "top" parameter (int, optional) specifies the number of entries to return. A maximal of 1000 - * entries can be returned in one call. To fetch more, you can specify "start" with the last - * returned entry’s Id of the current call. + * entries can be returned in one call. To fetch more, you can specify "start" with the last returned + * entry’s Id of the current call. *
* For example, total 5 person groups: "group1", ..., "group5". *
"start=&top=" will return all 5 groups. *
"start=&top=2" will return "group1", "group2". *
"start=group2&top=3" will return "group3", "group4", "group5". - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: Models.PersonGroupListOptionalParams): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback + * + * @param options The options parameters. */ - list(options: Models.PersonGroupListOptionalParams, callback: msRest.ServiceCallback): void; - list(options?: Models.PersonGroupListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; + list( + options?: PersonGroupListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Queue a person group training task, the training task may not be started immediately. * @param personGroupId Id referencing a particular person group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - train(personGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param callback The callback - */ - train(personGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param options The optional parameters - * @param callback The callback - */ - train(personGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - train(personGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + train( + personGroupId: string, + options?: PersonGroupTrainOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - options - }, - trainOperationSpec, - callback); + { personGroupId, options }, + trainOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}", httpMethod: "PUT", - path: "persongroups/{personGroupId}", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId - ], - requestBody: { - parameterPath: { - name: "name", - userData: [ - "options", - "userData" - ], - recognitionModel: [ - "options", - "recognitionModel" - ] - }, - mapper: { - ...Mappers.MetaDataContract, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["name"], + userData: ["options", "userData"], + recognitionModel: ["options", "recognitionModel"] + }, + mapper: { ...Mappers.MetaDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.personGroupId2], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}", httpMethod: "DELETE", - path: "persongroups/{personGroupId}", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.personGroupId2], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}", httpMethod: "GET", - path: "persongroups/{personGroupId}", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId - ], - queryParameters: [ - Parameters.returnRecognitionModel - ], responses: { 200: { bodyMapper: Mappers.PersonGroup @@ -332,48 +226,35 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.returnRecognitionModel], + urlParameters: [Parameters.endpoint, Parameters.personGroupId2], + headerParameters: [Parameters.accept], serializer }; - -const updateOperationSpec: msRest.OperationSpec = { +const updateOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}", httpMethod: "PATCH", - path: "persongroups/{personGroupId}", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId - ], - requestBody: { - parameterPath: { - name: [ - "options", - "name" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.NameAndUserDataContract, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["options", "name"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.NameAndUserDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.personGroupId2], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const getTrainingStatusOperationSpec: msRest.OperationSpec = { +const getTrainingStatusOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/training", httpMethod: "GET", - path: "persongroups/{personGroupId}/training", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId - ], responses: { 200: { bodyMapper: Mappers.TrainingStatus @@ -382,32 +263,19 @@ const getTrainingStatusOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.personGroupId2], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/persongroups", httpMethod: "GET", - path: "persongroups", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.start1, - Parameters.top1, - Parameters.returnRecognitionModel - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "PersonGroup" - } - } + element: { type: { name: "Composite", className: "PersonGroup" } } } } }, @@ -415,21 +283,25 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [ + Parameters.returnRecognitionModel, + Parameters.start1, + Parameters.top1 + ], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.accept], serializer }; - -const trainOperationSpec: msRest.OperationSpec = { +const trainOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/train", httpMethod: "POST", - path: "persongroups/{personGroupId}/train", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId - ], responses: { 202: {}, default: { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.personGroupId2], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupPerson.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupPerson.ts index e5d3f35f90e6..b60043f3b440 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupPerson.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupPerson.ts @@ -1,222 +1,151 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/personGroupPersonMappers"; +import { PersonGroupPerson } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { FaceClientContext } from "../faceClientContext"; +import { FaceClient } from "../faceClient"; +import { + PersonGroupPersonCreateOptionalParams, + PersonGroupPersonCreateResponse, + PersonGroupPersonListOptionalParams, + PersonGroupPersonListResponse, + PersonGroupPersonDeleteOptionalParams, + PersonGroupPersonGetOptionalParams, + PersonGroupPersonGetResponse, + PersonGroupPersonUpdateOptionalParams, + PersonGroupPersonDeleteFaceOptionalParams, + PersonGroupPersonGetFaceOptionalParams, + PersonGroupPersonGetFaceResponse, + PersonGroupPersonUpdateFaceOptionalParams, + PersonGroupPersonAddFaceFromUrlOptionalParams, + PersonGroupPersonAddFaceFromUrlResponse, + PersonGroupPersonAddFaceFromStreamOptionalParams, + PersonGroupPersonAddFaceFromStreamResponse +} from "../models"; -/** Class representing a PersonGroupPerson. */ -export class PersonGroupPerson { - private readonly client: FaceClientContext; +/** Class containing PersonGroupPerson operations. */ +export class PersonGroupPersonImpl implements PersonGroupPerson { + private readonly client: FaceClient; /** - * Create a PersonGroupPerson. - * @param {FaceClientContext} client Reference to the service client. + * Initialize a new instance of the class PersonGroupPerson class. + * @param client Reference to the service client */ - constructor(client: FaceClientContext) { + constructor(client: FaceClient) { this.client = client; } /** * Create a new person in a specified person group. * @param personGroupId Id referencing a particular person group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(personGroupId: string, options?: Models.PersonGroupPersonCreateOptionalParams): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param callback The callback - */ - create(personGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param options The optional parameters - * @param callback The callback - */ - create(personGroupId: string, options: Models.PersonGroupPersonCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(personGroupId: string, options?: Models.PersonGroupPersonCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + personGroupId: string, + options?: PersonGroupPersonCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - options - }, - createOperationSpec, - callback) as Promise; + { personGroupId, options }, + createOperationSpec + ); } /** * List all persons in a person group, and retrieve person information (including personId, name, * userData and persistedFaceIds of registered faces of the person). * @param personGroupId Id referencing a particular person group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(personGroupId: string, options?: Models.PersonGroupPersonListOptionalParams): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param callback The callback - */ - list(personGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param options The optional parameters - * @param callback The callback - */ - list(personGroupId: string, options: Models.PersonGroupPersonListOptionalParams, callback: msRest.ServiceCallback): void; - list(personGroupId: string, options?: Models.PersonGroupPersonListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + list( + personGroupId: string, + options?: PersonGroupPersonListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - options - }, - listOperationSpec, - callback) as Promise; + { personGroupId, options }, + listOperationSpec + ); } /** - * Delete an existing person from a person group. The persistedFaceId, userData, person name and - * face feature in the person entry will all be deleted. - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(personGroupId: string, personId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param callback The callback - */ - deleteMethod(personGroupId: string, personId: string, callback: msRest.ServiceCallback): void; - /** + * Delete an existing person from a person group. The persistedFaceId, userData, person name and face + * feature in the person entry will all be deleted. * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(personGroupId: string, personId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(personGroupId: string, personId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + personGroupId: string, + personId: string, + options?: PersonGroupPersonDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - personId, - options - }, - deleteMethodOperationSpec, - callback); + { personGroupId, personId, options }, + deleteOperationSpec + ); } /** * Retrieve a person's information, including registered persisted faces, name and userData. * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. - * @param [options] The optional parameters - * @returns Promise - */ - get(personGroupId: string, personId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param callback The callback - */ - get(personGroupId: string, personId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(personGroupId: string, personId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(personGroupId: string, personId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + personGroupId: string, + personId: string, + options?: PersonGroupPersonGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - personId, - options - }, - getOperationSpec, - callback) as Promise; + { personGroupId, personId, options }, + getOperationSpec + ); } /** * Update name or userData of a person. * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(personGroupId: string, personId: string, options?: Models.PersonGroupPersonUpdateOptionalParams): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param callback The callback - */ - update(personGroupId: string, personId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param options The optional parameters - * @param callback The callback - */ - update(personGroupId: string, personId: string, options: Models.PersonGroupPersonUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(personGroupId: string, personId: string, options?: Models.PersonGroupPersonUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + personGroupId: string, + personId: string, + options?: PersonGroupPersonUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - personId, - options - }, - updateOperationSpec, - callback); + { personGroupId, personId, options }, + updateOperationSpec + ); } /** * Delete a face from a person in a person group by specified personGroupId, personId and * persistedFaceId. - *
Adding/deleting faces to/from a same person will be processed sequentially. - * Adding/deleting faces to/from different persons are processed in parallel. - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise - */ - deleteFace(personGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback - */ - deleteFace(personGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** + *
Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting + * faces to/from different persons are processed in parallel. * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteFace(personGroupId: string, personId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteFace(personGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + deleteFace( + personGroupId: string, + personId: string, + persistedFaceId: string, + options?: PersonGroupPersonDeleteFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - personId, - persistedFaceId, - options - }, - deleteFaceOperationSpec, - callback); + { personGroupId, personId, persistedFaceId, options }, + deleteFaceOperationSpec + ); } /** @@ -225,50 +154,32 @@ export class PersonGroupPerson { * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise - */ - getFace(personGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback + * @param options The options parameters. */ - getFace(personGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback - */ - getFace(personGroupId: string, personId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getFace(personGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getFace( + personGroupId: string, + personId: string, + persistedFaceId: string, + options?: PersonGroupPersonGetFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - personId, - persistedFaceId, - options - }, - getFaceOperationSpec, - callback) as Promise; + { personGroupId, personId, persistedFaceId, options }, + getFaceOperationSpec + ); } /** - * Add a face to a person into a person group for face identification or verification. To deal with - * an image contains multiple faces, input face can be specified as an image with a targetFace - * rectangle. It returns a persistedFaceId representing the added face. No image will be stored. - * Only the extracted face feature will be stored on server until [PersonGroup PersonFace - + * Add a face to a person into a person group for face identification or verification. To deal with an + * image contains multiple faces, input face can be specified as an image with a targetFace rectangle. + * It returns a persistedFaceId representing the added face. No image will be stored. Only the + * extracted face feature will be stored on server until [PersonGroup PersonFace - * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup * Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or - * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is - * called. + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). - * * Higher face image quality means better recognition precision. Please consider high-quality - * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. * * Each person entry can hold up to 248 faces. * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is * from 1KB to 6MB. @@ -276,62 +187,44 @@ export class PersonGroupPerson { * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. - * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions - * will cause failures. - * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting - * faces to/from different persons are processed in parallel. - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param [options] The optional parameters - * @returns Promise - */ - updateFace(personGroupId: string, personId: string, persistedFaceId: string, options?: Models.PersonGroupPersonUpdateFaceOptionalParams): Promise; - /** + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces + * to/from different persons are processed in parallel. * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param callback The callback + * @param options The options parameters. */ - updateFace(personGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. - * @param options The optional parameters - * @param callback The callback - */ - updateFace(personGroupId: string, personId: string, persistedFaceId: string, options: Models.PersonGroupPersonUpdateFaceOptionalParams, callback: msRest.ServiceCallback): void; - updateFace(personGroupId: string, personId: string, persistedFaceId: string, options?: Models.PersonGroupPersonUpdateFaceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + updateFace( + personGroupId: string, + personId: string, + persistedFaceId: string, + options?: PersonGroupPersonUpdateFaceOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - personId, - persistedFaceId, - options - }, - updateFaceOperationSpec, - callback); + { personGroupId, personId, persistedFaceId, options }, + updateFaceOperationSpec + ); } /** - * Add a face to a person into a person group for face identification or verification. To deal with - * an image contains multiple faces, input face can be specified as an image with a targetFace - * rectangle. It returns a persistedFaceId representing the added face. No image will be stored. - * Only the extracted face feature will be stored on server until [PersonGroup PersonFace - + * Add a face to a person into a person group for face identification or verification. To deal with an + * image contains multiple faces, input face can be specified as an image with a targetFace rectangle. + * It returns a persistedFaceId representing the added face. No image will be stored. Only the + * extracted face feature will be stored on server until [PersonGroup PersonFace - * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup * Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or - * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is - * called. + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * * Higher face image quality means better recognition precision. Please consider high-quality * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. * * Each person entry can hold up to 248 faces. - * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size - * is from 1KB to 6MB. - * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as - * an error. If the provided "targetFace" rectangle is not returned from [Face - + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions @@ -339,63 +232,45 @@ export class PersonGroupPerson { * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting * faces to/from different persons are processed in parallel. * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. * @param url Publicly reachable URL of an image - * @param [options] The optional parameters - * @returns Promise - */ - addFaceFromUrl(personGroupId: string, personId: string, url: string, options?: Models.PersonGroupPersonAddFaceFromUrlOptionalParams): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param url Publicly reachable URL of an image - * @param callback The callback - */ - addFaceFromUrl(personGroupId: string, personId: string, url: string, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param url Publicly reachable URL of an image - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - addFaceFromUrl(personGroupId: string, personId: string, url: string, options: Models.PersonGroupPersonAddFaceFromUrlOptionalParams, callback: msRest.ServiceCallback): void; - addFaceFromUrl(personGroupId: string, personId: string, url: string, options?: Models.PersonGroupPersonAddFaceFromUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + addFaceFromUrl( + personGroupId: string, + personId: string, + url: string, + options?: PersonGroupPersonAddFaceFromUrlOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - personId, - url, - options - }, - addFaceFromUrlOperationSpec, - callback) as Promise; + { personGroupId, personId, url, options }, + addFaceFromUrlOperationSpec + ); } /** - * Add a face to a person into a person group for face identification or verification. To deal with - * an image contains multiple faces, input face can be specified as an image with a targetFace - * rectangle. It returns a persistedFaceId representing the added face. No image will be stored. - * Only the extracted face feature will be stored on server until [PersonGroup PersonFace - + * Add a face to a person into a person group for face identification or verification. To deal with an + * image contains multiple faces, input face can be specified as an image with a targetFace rectangle. + * It returns a persistedFaceId representing the added face. No image will be stored. Only the + * extracted face feature will be stored on server until [PersonGroup PersonFace - * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup * Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or - * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is - * called. + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. *
Note persistedFaceId is different from faceId generated by [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * * Higher face image quality means better recognition precision. Please consider high-quality * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. * * Each person entry can hold up to 248 faces. - * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size - * is from 1KB to 6MB. - * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as - * an error. If the provided "targetFace" rectangle is not returned from [Face - + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to * detect and add the face successfully. * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions @@ -403,71 +278,34 @@ export class PersonGroupPerson { * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting * faces to/from different persons are processed in parallel. * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. - * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum - * face size. - * * Different 'detectionModel' values can be provided. To use and compare different detection - * models, please refer to [How to specify a detection + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. * @param image An image stream. - * @param [options] The optional parameters - * @returns Promise - */ - addFaceFromStream(personGroupId: string, personId: string, image: msRest.HttpRequestBody, options?: Models.PersonGroupPersonAddFaceFromStreamOptionalParams): Promise; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param image An image stream. - * @param callback The callback - */ - addFaceFromStream(personGroupId: string, personId: string, image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; - /** - * @param personGroupId Id referencing a particular person group. - * @param personId Id referencing a particular person. - * @param image An image stream. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - addFaceFromStream(personGroupId: string, personId: string, image: msRest.HttpRequestBody, options: Models.PersonGroupPersonAddFaceFromStreamOptionalParams, callback: msRest.ServiceCallback): void; - addFaceFromStream(personGroupId: string, personId: string, image: msRest.HttpRequestBody, options?: Models.PersonGroupPersonAddFaceFromStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + addFaceFromStream( + personGroupId: string, + personId: string, + image: coreRestPipeline.RequestBodyType, + options?: PersonGroupPersonAddFaceFromStreamOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - personGroupId, - personId, - image, - options - }, - addFaceFromStreamOperationSpec, - callback) as Promise; + { personGroupId, personId, image, options }, + addFaceFromStreamOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/persons", httpMethod: "POST", - path: "persongroups/{personGroupId}/persons", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId - ], - requestBody: { - parameterPath: { - name: [ - "options", - "name" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.NameAndUserDataContract, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.Person @@ -476,32 +314,27 @@ const createOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + name: ["options", "name"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.NameAndUserDataContract, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.personGroupId2], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/persons", httpMethod: "GET", - path: "persongroups/{personGroupId}/persons", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId - ], - queryParameters: [ - Parameters.start0, - Parameters.top0 - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "Person" - } - } + element: { type: { name: "Composite", className: "Person" } } } } }, @@ -509,34 +342,31 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.start, Parameters.top], + urlParameters: [Parameters.endpoint, Parameters.personGroupId2], + headerParameters: [Parameters.accept], serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/persons/{personId}", httpMethod: "DELETE", - path: "persongroups/{personGroupId}/persons/{personId}", - urlParameters: [ - Parameters.endpoint, - Parameters.personGroupId, - Parameters.personId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "persongroups/{personGroupId}/persons/{personId}", urlParameters: [ Parameters.endpoint, - Parameters.personGroupId, - Parameters.personId + Parameters.personGroupId2, + Parameters.personId1 ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/persons/{personId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Person @@ -545,69 +375,62 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const updateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "persongroups/{personGroupId}/persons/{personId}", urlParameters: [ Parameters.endpoint, - Parameters.personGroupId, - Parameters.personId + Parameters.personGroupId2, + Parameters.personId1 ], - requestBody: { - parameterPath: { - name: [ - "options", - "name" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.NameAndUserDataContract, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/persons/{personId}", + httpMethod: "PATCH", responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const deleteFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + requestBody: { + parameterPath: { + name: ["options", "name"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.NameAndUserDataContract, required: true } + }, urlParameters: [ Parameters.endpoint, - Parameters.personGroupId, - Parameters.personId, - Parameters.persistedFaceId + Parameters.personGroupId2, + Parameters.personId1 ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const deleteFaceOperationSpec: coreClient.OperationSpec = { + path: + "/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + httpMethod: "DELETE", responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const getFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", urlParameters: [ Parameters.endpoint, - Parameters.personGroupId, - Parameters.personId, + Parameters.personGroupId2, + Parameters.personId1, Parameters.persistedFaceId ], + headerParameters: [Parameters.accept], + serializer +}; +const getFaceOperationSpec: coreClient.OperationSpec = { + path: + "/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -616,61 +439,42 @@ const getFaceOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const updateFaceOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", urlParameters: [ Parameters.endpoint, - Parameters.personGroupId, - Parameters.personId, + Parameters.personGroupId2, + Parameters.personId1, Parameters.persistedFaceId ], - requestBody: { - parameterPath: { - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.UpdateFaceRequest, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const updateFaceOperationSpec: coreClient.OperationSpec = { + path: + "/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + httpMethod: "PATCH", responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, - serializer -}; - -const addFaceFromUrlOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces", + requestBody: { + parameterPath: { userData: ["options", "userData"] }, + mapper: { ...Mappers.UpdateFaceRequest, required: true } + }, urlParameters: [ Parameters.endpoint, - Parameters.personGroupId, - Parameters.personId - ], - queryParameters: [ - Parameters.userData, - Parameters.targetFace, - Parameters.detectionModel + Parameters.personGroupId2, + Parameters.personId1, + Parameters.persistedFaceId ], - requestBody: { - parameterPath: { - url: "url" - }, - mapper: { - ...Mappers.ImageUrl, - required: true - } - }, + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const addFaceFromUrlOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/persons/{personId}/persistedfaces", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -679,33 +483,27 @@ const addFaceFromUrlOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, - serializer -}; - -const addFaceFromStreamOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces", + requestBody: { + parameterPath: { url: ["url"] }, + mapper: { ...Mappers.ImageUrl, required: true } + }, + queryParameters: [ + Parameters.detectionModel, + Parameters.userData2, + Parameters.targetFace + ], urlParameters: [ Parameters.endpoint, - Parameters.personGroupId, - Parameters.personId - ], - queryParameters: [ - Parameters.userData, - Parameters.targetFace, - Parameters.detectionModel + Parameters.personGroupId2, + Parameters.personId1 ], - requestBody: { - parameterPath: "image", - mapper: { - required: true, - serializedName: "Image", - type: { - name: "Stream" - } - } - }, - contentType: "application/octet-stream", + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const addFaceFromStreamOperationSpec: coreClient.OperationSpec = { + path: "/persongroups/{personGroupId}/persons/{personId}/persistedfaces", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.PersistedFace @@ -714,5 +512,18 @@ const addFaceFromStreamOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: Parameters.image, + queryParameters: [ + Parameters.detectionModel, + Parameters.userData2, + Parameters.targetFace + ], + urlParameters: [ + Parameters.endpoint, + Parameters.personGroupId2, + Parameters.personId1 + ], + headerParameters: [Parameters.contentType1, Parameters.accept1], + mediaType: "binary", serializer }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/snapshotOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/snapshotOperations.ts index 3d68784865ed..ea931eee1279 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/snapshotOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/snapshotOperations.ts @@ -1,186 +1,132 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/snapshotOperationsMappers"; +import { SnapshotOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { FaceClientContext } from "../faceClientContext"; +import { FaceClient } from "../faceClient"; +import { + SnapshotObjectType, + SnapshotTakeOptionalParams, + SnapshotTakeResponse, + SnapshotListOptionalParams, + SnapshotListResponse, + SnapshotGetOptionalParams, + SnapshotGetResponse, + SnapshotUpdateOptionalParams, + SnapshotDeleteOptionalParams, + SnapshotApplyOptionalParams, + SnapshotApplyResponse, + SnapshotGetOperationStatusOptionalParams, + SnapshotGetOperationStatusResponse +} from "../models"; -/** Class representing a SnapshotOperations. */ -export class SnapshotOperations { - private readonly client: FaceClientContext; +/** Class containing SnapshotOperations operations. */ +export class SnapshotOperationsImpl implements SnapshotOperations { + private readonly client: FaceClient; /** - * Create a SnapshotOperations. - * @param {FaceClientContext} client Reference to the service client. + * Initialize a new instance of the class SnapshotOperations class. + * @param client Reference to the service client */ - constructor(client: FaceClientContext) { + constructor(client: FaceClient) { this.client = client; } /** - * Submit an operation to take a snapshot of face list, large face list, person group or large - * person group, with user-specified snapshot type, source object id, apply scope and an optional - * user data.
+ * Submit an operation to take a snapshot of face list, large face list, person group or large person + * group, with user-specified snapshot type, source object id, apply scope and an optional user + * data.
* The snapshot interfaces are for users to backup and restore their face data from one face * subscription to another, inside same region or across regions. The workflow contains two phases, - * user first calls Snapshot - Take to create a copy of the source object and store it as a - * snapshot, then calls Snapshot - Apply to paste the snapshot to target subscription. The - * snapshots are stored in a centralized location (per Azure instance), so that they can be applied - * cross accounts and regions.
+ * user first calls Snapshot - Take to create a copy of the source object and store it as a snapshot, + * then calls Snapshot - Apply to paste the snapshot to target subscription. The snapshots are stored + * in a centralized location (per Azure instance), so that they can be applied cross accounts and + * regions.
* Taking snapshot is an asynchronous operation. An operation id can be obtained from the - * "Operation-Location" field in response header, to be used in OperationStatus - Get for tracking - * the progress of creating the snapshot. The snapshot id will be included in the - * "resourceLocation" field in OperationStatus - Get response when the operation status is - * "succeeded".
- * Snapshot taking time depends on the number of person and face entries in the source object. It - * could be in seconds, or up to several hours for 1,000,000 persons with multiple faces.
- * Snapshots will be automatically expired and cleaned in 48 hours after it is created by Snapshot - * - Take. User can delete the snapshot using Snapshot - Delete by themselves any time before + * "Operation-Location" field in response header, to be used in OperationStatus - Get for tracking the + * progress of creating the snapshot. The snapshot id will be included in the "resourceLocation" field + * in OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot taking time depends on the number of person and face entries in the source object. It could + * be in seconds, or up to several hours for 1,000,000 persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is created by Snapshot - + * Take. User can delete the snapshot using Snapshot - Delete by themselves any time before * expiration.
* Taking snapshot for a certain object will not block any other operations against the object. All - * read-only operations (Get/List and Identify/FindSimilar/Verify) can be conducted as usual. For - * all writable operations, including Add/Update/Delete the source object or its persons/faces and - * Train, they are not blocked but not recommended because writable updates may not be reflected on - * the snapshot during its taking. After snapshot taking is completed, all readable and writable - * operations can work as normal. Snapshot will also include the training results of the source - * object, which means target subscription the snapshot applied to does not need re-train the - * target object before calling Identify/FindSimilar.
+ * read-only operations (Get/List and Identify/FindSimilar/Verify) can be conducted as usual. For all + * writable operations, including Add/Update/Delete the source object or its persons/faces and Train, + * they are not blocked but not recommended because writable updates may not be reflected on the + * snapshot during its taking. After snapshot taking is completed, all readable and writable operations + * can work as normal. Snapshot will also include the training results of the source object, which + * means target subscription the snapshot applied to does not need re-train the target object before + * calling Identify/FindSimilar.
* * Free-tier subscription quota: 100 take operations per month. * * S0-tier subscription quota: 100 take operations per day. - * @param type User specified type for the source object to take snapshot from. Currently FaceList, - * PersonGroup, LargeFaceList and LargePersonGroup are supported. Possible values include: - * 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' * @param objectId User specified source object id to take snapshot from. - * @param applyScope User specified array of target Face subscription ids for the snapshot. For - * each snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. - * @param [options] The optional parameters - * @returns Promise + * @param applyScope User specified array of target Face subscription ids for the snapshot. For each + * snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. + * @param typeParam User specified type for the source object to take snapshot from. Currently + * FaceList, PersonGroup, LargeFaceList and LargePersonGroup are supported. + * @param options The options parameters. */ - take(type: Models.SnapshotObjectType, objectId: string, applyScope: string[], options?: Models.SnapshotTakeOptionalParams): Promise; - /** - * @param type User specified type for the source object to take snapshot from. Currently FaceList, - * PersonGroup, LargeFaceList and LargePersonGroup are supported. Possible values include: - * 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' - * @param objectId User specified source object id to take snapshot from. - * @param applyScope User specified array of target Face subscription ids for the snapshot. For - * each snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. - * @param callback The callback - */ - take(type: Models.SnapshotObjectType, objectId: string, applyScope: string[], callback: msRest.ServiceCallback): void; - /** - * @param type User specified type for the source object to take snapshot from. Currently FaceList, - * PersonGroup, LargeFaceList and LargePersonGroup are supported. Possible values include: - * 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' - * @param objectId User specified source object id to take snapshot from. - * @param applyScope User specified array of target Face subscription ids for the snapshot. For - * each snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. - * @param options The optional parameters - * @param callback The callback - */ - take(type: Models.SnapshotObjectType, objectId: string, applyScope: string[], options: Models.SnapshotTakeOptionalParams, callback: msRest.ServiceCallback): void; - take(type: Models.SnapshotObjectType, objectId: string, applyScope: string[], options?: Models.SnapshotTakeOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + take( + objectId: string, + applyScope: string[], + typeParam: SnapshotObjectType, + options?: SnapshotTakeOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - type, - objectId, - applyScope, - options - }, - takeOperationSpec, - callback) as Promise; + { objectId, applyScope, typeParam, options }, + takeOperationSpec + ); } /** - * List all accessible snapshots with related information, including snapshots that were taken by - * the user, or snapshots to be applied to the user (subscription id was included in the applyScope - * in Snapshot - Take). - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: Models.SnapshotListOptionalParams): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback + * List all accessible snapshots with related information, including snapshots that were taken by the + * user, or snapshots to be applied to the user (subscription id was included in the applyScope in + * Snapshot - Take). + * @param options The options parameters. */ - list(options: Models.SnapshotListOptionalParams, callback: msRest.ServiceCallback): void; - list(options?: Models.SnapshotListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; + list(options?: SnapshotListOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** - * Retrieve information about a snapshot. Snapshot is only accessible to the source subscription - * who took it, and target subscriptions included in the applyScope in Snapshot - Take. + * Retrieve information about a snapshot. Snapshot is only accessible to the source subscription who + * took it, and target subscriptions included in the applyScope in Snapshot - Take. * @param snapshotId Id referencing a particular snapshot. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(snapshotId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param snapshotId Id referencing a particular snapshot. - * @param callback The callback - */ - get(snapshotId: string, callback: msRest.ServiceCallback): void; - /** - * @param snapshotId Id referencing a particular snapshot. - * @param options The optional parameters - * @param callback The callback - */ - get(snapshotId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(snapshotId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + snapshotId: string, + options?: SnapshotGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - snapshotId, - options - }, - getOperationSpec, - callback) as Promise; + { snapshotId, options }, + getOperationSpec + ); } /** - * Update the information of a snapshot. Only the source subscription who took the snapshot can - * update the snapshot. - * @param snapshotId Id referencing a particular snapshot. - * @param [options] The optional parameters - * @returns Promise - */ - update(snapshotId: string, options?: Models.SnapshotUpdateOptionalParams): Promise; - /** + * Update the information of a snapshot. Only the source subscription who took the snapshot can update + * the snapshot. * @param snapshotId Id referencing a particular snapshot. - * @param callback The callback + * @param options The options parameters. */ - update(snapshotId: string, callback: msRest.ServiceCallback): void; - /** - * @param snapshotId Id referencing a particular snapshot. - * @param options The optional parameters - * @param callback The callback - */ - update(snapshotId: string, options: Models.SnapshotUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(snapshotId: string, options?: Models.SnapshotUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + snapshotId: string, + options?: SnapshotUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - snapshotId, - options - }, - updateOperationSpec, - callback); + { snapshotId, options }, + updateOperationSpec + ); } /** @@ -189,29 +135,16 @@ export class SnapshotOperations { * snapshot. If the user does not delete a snapshot with this API, the snapshot will still be * automatically deleted in 48 hours after creation. * @param snapshotId Id referencing a particular snapshot. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(snapshotId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param snapshotId Id referencing a particular snapshot. - * @param callback The callback - */ - deleteMethod(snapshotId: string, callback: msRest.ServiceCallback): void; - /** - * @param snapshotId Id referencing a particular snapshot. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(snapshotId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(snapshotId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + snapshotId: string, + options?: SnapshotDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - snapshotId, - options - }, - deleteMethodOperationSpec, - callback); + { snapshotId, options }, + deleteOperationSpec + ); } /** @@ -219,114 +152,66 @@ export class SnapshotOperations { * subscriptions included in the applyScope of Snapshot - Take can apply it.
* The snapshot interfaces are for users to backup and restore their face data from one face * subscription to another, inside same region or across regions. The workflow contains two phases, - * user first calls Snapshot - Take to create a copy of the source object and store it as a - * snapshot, then calls Snapshot - Apply to paste the snapshot to target subscription. The - * snapshots are stored in a centralized location (per Azure instance), so that they can be applied - * cross accounts and regions.
+ * user first calls Snapshot - Take to create a copy of the source object and store it as a snapshot, + * then calls Snapshot - Apply to paste the snapshot to target subscription. The snapshots are stored + * in a centralized location (per Azure instance), so that they can be applied cross accounts and + * regions.
* Applying snapshot is an asynchronous operation. An operation id can be obtained from the - * "Operation-Location" field in response header, to be used in OperationStatus - Get for tracking - * the progress of applying the snapshot. The target object id will be included in the - * "resourceLocation" field in OperationStatus - Get response when the operation status is - * "succeeded".
- * Snapshot applying time depends on the number of person and face entries in the snapshot object. - * It could be in seconds, or up to 1 hour for 1,000,000 persons with multiple faces.
- * Snapshots will be automatically expired and cleaned in 48 hours after it is created by Snapshot - * - Take. So the target subscription is required to apply the snapshot in 48 hours since its + * "Operation-Location" field in response header, to be used in OperationStatus - Get for tracking the + * progress of applying the snapshot. The target object id will be included in the "resourceLocation" + * field in OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot applying time depends on the number of person and face entries in the snapshot object. It + * could be in seconds, or up to 1 hour for 1,000,000 persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is created by Snapshot - + * Take. So the target subscription is required to apply the snapshot in 48 hours since its * creation.
- * Applying a snapshot will not block any other operations against the target object, however it is - * not recommended because the correctness cannot be guaranteed during snapshot applying. After - * snapshot applying is completed, all operations towards the target object can work as normal. - * Snapshot also includes the training results of the source object, which means target - * subscription the snapshot applied to does not need re-train the target object before calling - * Identify/FindSimilar.
- * One snapshot can be applied multiple times in parallel, while currently only CreateNew apply - * mode is supported, which means the apply operation will fail if target subscription already - * contains an object of same type and using the same objectId. Users can specify the "objectId" in - * request body to avoid such conflicts.
+ * Applying a snapshot will not block any other operations against the target object, however it is not + * recommended because the correctness cannot be guaranteed during snapshot applying. After snapshot + * applying is completed, all operations towards the target object can work as normal. Snapshot also + * includes the training results of the source object, which means target subscription the snapshot + * applied to does not need re-train the target object before calling Identify/FindSimilar.
+ * One snapshot can be applied multiple times in parallel, while currently only CreateNew apply mode is + * supported, which means the apply operation will fail if target subscription already contains an + * object of same type and using the same objectId. Users can specify the "objectId" in request body to + * avoid such conflicts.
* * Free-tier subscription quota: 100 apply operations per month. * * S0-tier subscription quota: 100 apply operations per day. * @param snapshotId Id referencing a particular snapshot. * @param objectId User specified target object id to be created from the snapshot. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - apply(snapshotId: string, objectId: string, options?: Models.SnapshotApplyOptionalParams): Promise; - /** - * @param snapshotId Id referencing a particular snapshot. - * @param objectId User specified target object id to be created from the snapshot. - * @param callback The callback - */ - apply(snapshotId: string, objectId: string, callback: msRest.ServiceCallback): void; - /** - * @param snapshotId Id referencing a particular snapshot. - * @param objectId User specified target object id to be created from the snapshot. - * @param options The optional parameters - * @param callback The callback - */ - apply(snapshotId: string, objectId: string, options: Models.SnapshotApplyOptionalParams, callback: msRest.ServiceCallback): void; - apply(snapshotId: string, objectId: string, options?: Models.SnapshotApplyOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + apply( + snapshotId: string, + objectId: string, + options?: SnapshotApplyOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - snapshotId, - objectId, - options - }, - applyOperationSpec, - callback) as Promise; + { snapshotId, objectId, options }, + applyOperationSpec + ); } /** * Retrieve the status of a take/apply snapshot operation. * @param operationId Id referencing a particular take/apply snapshot operation. - * @param [options] The optional parameters - * @returns Promise - */ - getOperationStatus(operationId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param operationId Id referencing a particular take/apply snapshot operation. - * @param callback The callback - */ - getOperationStatus(operationId: string, callback: msRest.ServiceCallback): void; - /** - * @param operationId Id referencing a particular take/apply snapshot operation. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - getOperationStatus(operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getOperationStatus(operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getOperationStatus( + operationId: string, + options?: SnapshotGetOperationStatusOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - operationId, - options - }, - getOperationStatusOperationSpec, - callback) as Promise; + { operationId, options }, + getOperationStatusOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const takeOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const takeOperationSpec: coreClient.OperationSpec = { + path: "/snapshots", httpMethod: "POST", - path: "snapshots", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: { - type: "type", - objectId: "objectId", - applyScope: "applyScope", - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.TakeSnapshotRequest, - required: true - } - }, responses: { 202: { headersMapper: Mappers.SnapshotTakeHeaders @@ -335,31 +220,29 @@ const takeOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + typeParam: ["typeParam"], + objectId: ["objectId"], + applyScope: ["applyScope"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.TakeSnapshotRequest, required: true } + }, + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/snapshots", httpMethod: "GET", - path: "snapshots", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.type, - Parameters.applyScope - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "Snapshot" - } - } + element: { type: { name: "Composite", className: "Snapshot" } } } } }, @@ -367,16 +250,14 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + queryParameters: [Parameters.typeParam1, Parameters.applyScope1], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: "/snapshots/{snapshotId}", httpMethod: "GET", - path: "snapshots/{snapshotId}", - urlParameters: [ - Parameters.endpoint, - Parameters.snapshotId - ], responses: { 200: { bodyMapper: Mappers.Snapshot @@ -385,77 +266,47 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.snapshotId], + headerParameters: [Parameters.accept], serializer }; - -const updateOperationSpec: msRest.OperationSpec = { +const updateOperationSpec: coreClient.OperationSpec = { + path: "/snapshots/{snapshotId}", httpMethod: "PATCH", - path: "snapshots/{snapshotId}", - urlParameters: [ - Parameters.endpoint, - Parameters.snapshotId - ], - requestBody: { - parameterPath: { - applyScope: [ - "options", - "applyScope" - ], - userData: [ - "options", - "userData" - ] - }, - mapper: { - ...Mappers.UpdateSnapshotRequest, - required: true - } - }, responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { + applyScope: ["options", "applyScope"], + userData: ["options", "userData"] + }, + mapper: { ...Mappers.UpdateSnapshotRequest, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.snapshotId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/snapshots/{snapshotId}", httpMethod: "DELETE", - path: "snapshots/{snapshotId}", - urlParameters: [ - Parameters.endpoint, - Parameters.snapshotId - ], responses: { 200: {}, default: { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.snapshotId], + headerParameters: [Parameters.accept], serializer }; - -const applyOperationSpec: msRest.OperationSpec = { +const applyOperationSpec: coreClient.OperationSpec = { + path: "/snapshots/{snapshotId}/apply", httpMethod: "POST", - path: "snapshots/{snapshotId}/apply", - urlParameters: [ - Parameters.endpoint, - Parameters.snapshotId - ], - requestBody: { - parameterPath: { - objectId: "objectId", - mode: [ - "options", - "mode" - ] - }, - mapper: { - ...Mappers.ApplySnapshotRequest, - required: true - } - }, responses: { 202: { headersMapper: Mappers.SnapshotApplyHeaders @@ -464,16 +315,18 @@ const applyOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + requestBody: { + parameterPath: { objectId: ["objectId"], mode: ["options", "mode"] }, + mapper: { ...Mappers.ApplySnapshotRequest, required: true } + }, + urlParameters: [Parameters.endpoint, Parameters.snapshotId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const getOperationStatusOperationSpec: msRest.OperationSpec = { +const getOperationStatusOperationSpec: coreClient.OperationSpec = { + path: "/operations/{operationId}", httpMethod: "GET", - path: "operations/{operationId}", - urlParameters: [ - Parameters.endpoint, - Parameters.operationId - ], responses: { 200: { bodyMapper: Mappers.OperationStatus @@ -482,5 +335,7 @@ const getOperationStatusOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.APIError } }, + urlParameters: [Parameters.endpoint, Parameters.operationId], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/face.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/face.ts new file mode 100644 index 000000000000..4826882e7310 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/face.ts @@ -0,0 +1,233 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + FaceFindSimilarOptionalParams, + FaceFindSimilarResponse, + FaceGroupOptionalParams, + FaceGroupResponse, + FaceIdentifyOptionalParams, + FaceIdentifyResponse, + FaceVerifyFaceToFaceOptionalParams, + FaceVerifyFaceToFaceResponse, + FaceDetectWithUrlOptionalParams, + FaceDetectWithUrlResponse, + FaceVerifyFaceToPersonOptionalParams, + FaceVerifyFaceToPersonResponse, + FaceDetectWithStreamOptionalParams, + FaceDetectWithStreamResponse +} from "../models"; + +/** Interface representing a Face. */ +export interface Face { + /** + * Given query face's faceId, to search the similar-looking faces from a faceId array, a face list or a + * large face list. faceId array contains the faces created by [Face - Detect With + * Url](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl) or [Face - Detect With + * Stream](https://docs.microsoft.com/rest/api/faceapi/face/detectwithstream), which will expire at the + * time specified by faceIdTimeToLive after creation. A "faceListId" is created by [FaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/facelist/create) containing persistedFaceIds + * that will not expire. And a "largeFaceListId" is created by [LargeFaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/largefacelist/create) containing + * persistedFaceIds that will also not expire. Depending on the input the returned similar faces list + * contains faceIds or persistedFaceIds ranked by similarity. + *
Find similar has two working modes, "matchPerson" and "matchFace". "matchPerson" is the default + * mode that it tries to find faces of the same person as possible by using internal same-person + * thresholds. It is useful to find a known person's other photos. Note that an empty list will be + * returned if no faces pass the internal thresholds. "matchFace" mode ignores same-person thresholds + * and returns ranked similar faces anyway, even the similarity is low. It can be used in the cases + * like searching celebrity-looking faces. + *
The 'recognitionModel' associated with the query face's faceId should be the same as the + * 'recognitionModel' used by the target faceId array, face list or large face list. + * + * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid + * faceId. Note that this faceId is not persisted and will expire at the time specified by + * faceIdTimeToLive after the detection call + * @param options The options parameters. + */ + findSimilar( + faceId: string, + options?: FaceFindSimilarOptionalParams + ): Promise; + /** + * Divide candidate faces into groups based on face similarity.
+ * * The output is one or more disjointed face groups and a messyGroup. A face group contains faces + * that have similar looking, often of the same person. Face groups are ranked by group size, i.e. + * number of faces. Notice that faces belonging to a same person might be split into several groups in + * the result. + * * MessyGroup is a special face group containing faces that cannot find any similar counterpart face + * from original faces. The messyGroup will not appear in the result if all faces found their + * counterparts. + * * Group API needs at least 2 candidate faces and 1000 at most. We suggest to try [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface) when you only have 2 + * candidate faces. + * * The 'recognitionModel' associated with the query faces' faceIds should be the same. + * + * @param faceIds Array of candidate faceId created by Face - Detect. The maximum is 1000 faces + * @param options The options parameters. + */ + group( + faceIds: string[], + options?: FaceGroupOptionalParams + ): Promise; + /** + * 1-to-many identification to find the closest matches of the specific query person face from a person + * group or large person group. + *
For each face in the faceIds array, Face Identify will compute similarities between the query + * face and all the faces in the person group (given by personGroupId) or large person group (given by + * largePersonGroupId), and return candidate person(s) for that face ranked by similarity confidence. + * The person group/large person group should be trained to make it ready for identification. See more + * in [PersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) and + * [LargePersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train). + *
+ * + * Remarks:
+ * * The algorithm allows more than one face to be identified independently at the same request, but no + * more than 10 faces. + * * Each person in the person group/large person group could have more than one face, but no more than + * 248 faces. + * * Higher face image quality means better identification precision. Please consider high-quality + * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Number of candidates returned is restricted by maxNumOfCandidatesReturned and confidenceThreshold. + * If no person is identified, the returned candidates will be an empty array. + * * Try [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) when you + * need to find similar faces from a face list/large face list instead of a person group/large person + * group. + * * The 'recognitionModel' associated with the query faces' faceIds should be the same as the + * 'recognitionModel' used by the target person group or large person group. + * + * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are + * identified independently. The valid number of faceIds is between [1, 10]. + * @param options The options parameters. + */ + identify( + faceIds: string[], + options?: FaceIdentifyOptionalParams + ): Promise; + /** + * Verify whether two faces belong to a same person or whether one face belongs to a person. + *
+ * Remarks:
+ * * Higher face image quality means better identification precision. Please consider high-quality + * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * For the scenarios that are sensitive to accuracy please make your own judgment. + * * The 'recognitionModel' associated with the query faces' faceIds should be the same as the + * 'recognitionModel' used by the target face, person group or large person group. + * + * @param faceId1 FaceId of the first face, comes from Face - Detect + * @param faceId2 FaceId of the second face, comes from Face - Detect + * @param options The options parameters. + */ + verifyFaceToFace( + faceId1: string, + faceId2: string, + options?: FaceVerifyFaceToFaceOptionalParams + ): Promise; + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.
+ * * No image will be stored. Only the extracted face feature will be stored on server. The faceId is + * an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) + * will expire and be deleted at the time specified by faceIdTimeToLive after the original detection + * call. + * * Optional parameters include faceId, landmarks, and attributes. Attributes include age, gender, + * headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, + * noise, mask, and qualityForRecognition. Some of the results returned for specific attributes may not + * be highly accurate. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * Up to 100 faces can be returned for an image. Faces are ranked by face rectangle size from large + * to small. + * * For optimal results when querying [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), + * please use faces that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels + * between eyes). + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + * * Different 'recognitionModel' values are provided. If follow-up operations like Verify, Identify, + * Find Similar are needed, please specify the recognition model with 'recognitionModel' parameter. The + * default value for 'recognitionModel' is 'recognition_01', if latest model needed, please explicitly + * specify the model you need in this parameter. Once specified, the detected faceIds will be + * associated with the specified recognition model. More details, please refer to [Specify a + * recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * @param url Publicly reachable URL of an image + * @param options The options parameters. + */ + detectWithUrl( + url: string, + options?: FaceDetectWithUrlOptionalParams + ): Promise; + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is + * created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param options The options parameters. + */ + verifyFaceToPerson( + faceId: string, + personId: string, + options?: FaceVerifyFaceToPersonOptionalParams + ): Promise; + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.
+ * * No image will be stored. Only the extracted face feature will be stored on server. The faceId is + * an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) + * will expire and be deleted at the time specified by faceIdTimeToLive after the original detection + * call. + * * Optional parameters include faceId, landmarks, and attributes. Attributes include age, gender, + * headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, + * noise, mask, and qualityForRecognition. Some of the results returned for specific attributes may not + * be highly accurate. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * Up to 100 faces can be returned for an image. Faces are ranked by face rectangle size from large + * to small. + * * For optimal results when querying [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), + * please use faces that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels + * between eyes). + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) + * * Different 'recognitionModel' values are provided. If follow-up operations like Verify, Identify, + * Find Similar are needed, please specify the recognition model with 'recognitionModel' parameter. The + * default value for 'recognitionModel' is 'recognition_01', if latest model needed, please explicitly + * specify the model you need in this parameter. Once specified, the detected faceIds will be + * associated with the specified recognition model. More details, please refer to [Specify a + * recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * @param image An image stream. + * @param options The options parameters. + */ + detectWithStream( + image: coreRestPipeline.RequestBodyType, + options?: FaceDetectWithStreamOptionalParams + ): Promise; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/faceListOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/faceListOperations.ts new file mode 100644 index 000000000000..8cbaceffc7ec --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/faceListOperations.ts @@ -0,0 +1,182 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + FaceListCreateOptionalParams, + FaceListGetOptionalParams, + FaceListGetResponse, + FaceListUpdateOptionalParams, + FaceListDeleteOptionalParams, + FaceListListOptionalParams, + FaceListListResponse, + FaceListDeleteFaceOptionalParams, + FaceListAddFaceFromUrlOptionalParams, + FaceListAddFaceFromUrlResponse, + FaceListAddFaceFromStreamOptionalParams, + FaceListAddFaceFromStreamResponse +} from "../models"; + +/** Interface representing a FaceListOperations. */ +export interface FaceListOperations { + /** + * Create an empty face list with user-specified faceListId, name, an optional userData and + * recognitionModel. Up to 64 face lists are allowed in one subscription. + *
Face list is a list of faces, up to 1,000 faces, and used by [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). + *
After creation, user should use [FaceList - Add + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/addfacefromurl) to import the faces. No + * image will be stored. Only the extracted face features are stored on server until [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. + *
Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, + * or as a light way face identification. But if the actual use is to identify person, please use + * [PersonGroup](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). + *
Please consider [LargeFaceList](https://docs.microsoft.com/rest/api/faceapi/largefacelist) + * when the face number is large. It can support up to 1,000,000 faces. + *
'recognitionModel' should be specified to associate with this face list. The default value for + * 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify the + * model you need in this parameter. New faces that are added to an existing face list will use the + * recognition model that's already associated with the collection. Existing face features in a face + * list can't be updated to features extracted by another version of recognition model. + * Please Refer to [Specify a face recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * @param faceListId Id referencing a particular face list. + * @param name User defined name, maximum length is 128. + * @param options The options parameters. + */ + create( + faceListId: string, + name: string, + options?: FaceListCreateOptionalParams + ): Promise; + /** + * Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. + * + * @param faceListId Id referencing a particular face list. + * @param options The options parameters. + */ + get( + faceListId: string, + options?: FaceListGetOptionalParams + ): Promise; + /** + * Update information of a face list. + * @param faceListId Id referencing a particular face list. + * @param options The options parameters. + */ + update( + faceListId: string, + options?: FaceListUpdateOptionalParams + ): Promise; + /** + * Delete a specified face list. + * @param faceListId Id referencing a particular face list. + * @param options The options parameters. + */ + delete( + faceListId: string, + options?: FaceListDeleteOptionalParams + ): Promise; + /** + * List face lists’ faceListId, name, userData and recognitionModel.
+ * To get face information inside faceList use [FaceList - + * Get](https://docs.microsoft.com/rest/api/faceapi/facelist/get) + * + * @param options The options parameters. + */ + list(options?: FaceListListOptionalParams): Promise; + /** + * Delete a face from a face list by specified faceListId and persistedFaceId. + *
Adding/deleting faces to/from a same face list are processed sequentially and to/from + * different face lists are in parallel. + * @param faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + deleteFace( + faceListId: string, + persistedFaceId: string, + options?: FaceListDeleteFaceOptionalParams + ): Promise; + /** + * Add a face to a specified face list, up to 1,000 faces. + *
To deal with an image contains multiple faces, input face can be specified as an image with a + * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be + * stored. Only the extracted face feature will be stored on server until [FaceList - Delete + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better detection and recognition precision. Please consider + * high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or + * bigger. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same face list are processed sequentially and to/from different + * face lists are in parallel. + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * @param faceListId Id referencing a particular face list. + * @param url Publicly reachable URL of an image + * @param options The options parameters. + */ + addFaceFromUrl( + faceListId: string, + url: string, + options?: FaceListAddFaceFromUrlOptionalParams + ): Promise; + /** + * Add a face to a specified face list, up to 1,000 faces. + *
To deal with an image contains multiple faces, input face can be specified as an image with a + * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be + * stored. Only the extracted face feature will be stored on server until [FaceList - Delete + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better detection and recognition precision. Please consider + * high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or + * bigger. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same face list are processed sequentially and to/from different + * face lists are in parallel. + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param options The options parameters. + */ + addFaceFromStream( + faceListId: string, + image: coreRestPipeline.RequestBodyType, + options?: FaceListAddFaceFromStreamOptionalParams + ): Promise; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/index.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..77c859e722a0 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./face"; +export * from "./personGroupPerson"; +export * from "./personGroupOperations"; +export * from "./faceListOperations"; +export * from "./largePersonGroupPerson"; +export * from "./largePersonGroupOperations"; +export * from "./largeFaceListOperations"; +export * from "./snapshotOperations"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largeFaceListOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largeFaceListOperations.ts new file mode 100644 index 000000000000..f082f64f4937 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largeFaceListOperations.ts @@ -0,0 +1,264 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + LargeFaceListCreateOptionalParams, + LargeFaceListGetOptionalParams, + LargeFaceListGetResponse, + LargeFaceListUpdateOptionalParams, + LargeFaceListDeleteOptionalParams, + LargeFaceListGetTrainingStatusOptionalParams, + LargeFaceListGetTrainingStatusResponse, + LargeFaceListListOptionalParams, + LargeFaceListListResponse, + LargeFaceListTrainOptionalParams, + LargeFaceListDeleteFaceOptionalParams, + LargeFaceListGetFaceOptionalParams, + LargeFaceListGetFaceResponse, + LargeFaceListUpdateFaceOptionalParams, + LargeFaceListAddFaceFromUrlOptionalParams, + LargeFaceListAddFaceFromUrlResponse, + LargeFaceListListFacesOptionalParams, + LargeFaceListListFacesResponse, + LargeFaceListAddFaceFromStreamOptionalParams, + LargeFaceListAddFaceFromStreamResponse +} from "../models"; + +/** Interface representing a LargeFaceListOperations. */ +export interface LargeFaceListOperations { + /** + * Create an empty large face list with user-specified largeFaceListId, name, an optional userData and + * recognitionModel. + *
Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). + *
After creation, user should use [LargeFaceList Face - + * Add](https://docs.microsoft.com/rest/api/faceapi/largefacelist/addfacefromurl) to import the faces + * and [LargeFaceList - Train](https://docs.microsoft.com/rest/api/faceapi/largefacelist/train) to make + * it ready for [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). No + * image will be stored. Only the extracted face features are stored on server until [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. + *
Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, + * or as a light way face identification. But if the actual use is to identify person, please use + * [PersonGroup](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). + *
'recognitionModel' should be specified to associate with this large face list. The default + * value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly + * specify the model you need in this parameter. New faces that are added to an existing large face + * list will use the recognition model that's already associated with the collection. Existing face + * features in a large face list can't be updated to features extracted by another version of + * recognition model. Please refer to [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + * Large face list quota: + * * Free-tier subscription quota: 64 large face lists. + * * S0-tier subscription quota: 1,000,000 large face lists. + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param options The options parameters. + */ + create( + largeFaceListId: string, + name: string, + options?: LargeFaceListCreateOptionalParams + ): Promise; + /** + * Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel. + * @param largeFaceListId Id referencing a particular large face list. + * @param options The options parameters. + */ + get( + largeFaceListId: string, + options?: LargeFaceListGetOptionalParams + ): Promise; + /** + * Update information of a large face list. + * @param largeFaceListId Id referencing a particular large face list. + * @param options The options parameters. + */ + update( + largeFaceListId: string, + options?: LargeFaceListUpdateOptionalParams + ): Promise; + /** + * Delete a specified large face list. + * @param largeFaceListId Id referencing a particular large face list. + * @param options The options parameters. + */ + delete( + largeFaceListId: string, + options?: LargeFaceListDeleteOptionalParams + ): Promise; + /** + * Retrieve the training status of a large face list (completed or ongoing). + * @param largeFaceListId Id referencing a particular large face list. + * @param options The options parameters. + */ + getTrainingStatus( + largeFaceListId: string, + options?: LargeFaceListGetTrainingStatusOptionalParams + ): Promise; + /** + * List large face lists’ information of largeFaceListId, name, userData and recognitionModel.
+ * To get face information inside largeFaceList use [LargeFaceList Face - + * Get](https://docs.microsoft.com/rest/api/faceapi/largefacelist/getface)
+ * * Large face lists are stored in alphabetical order of largeFaceListId. + * * "start" parameter (string, optional) is a user-provided largeFaceListId value that returned + * entries have larger ids by string comparison. "start" set to empty to indicate return from the first + * item. + * * "top" parameter (int, optional) specifies the number of entries to return. A maximal of 1000 + * entries can be returned in one call. To fetch more, you can specify "start" with the last returned + * entry’s Id of the current call. + *
+ * For example, total 5 large person lists: "list1", ..., "list5". + *
"start=&top=" will return all 5 lists. + *
"start=&top=2" will return "list1", "list2". + *
"start=list2&top=3" will return "list3", "list4", "list5". + * + * @param options The options parameters. + */ + list( + options?: LargeFaceListListOptionalParams + ): Promise; + /** + * Queue a large face list training task, the training task may not be started immediately. + * @param largeFaceListId Id referencing a particular large face list. + * @param options The options parameters. + */ + train( + largeFaceListId: string, + options?: LargeFaceListTrainOptionalParams + ): Promise; + /** + * Delete a face from a large face list by specified largeFaceListId and persistedFaceId. + *
Adding/deleting faces to/from a same large face list are processed sequentially and to/from + * different large face lists are in parallel. + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + deleteFace( + largeFaceListId: string, + persistedFaceId: string, + options?: LargeFaceListDeleteFaceOptionalParams + ): Promise; + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging + * largeFaceListId). + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + getFace( + largeFaceListId: string, + persistedFaceId: string, + options?: LargeFaceListGetFaceOptionalParams + ): Promise; + /** + * Update a persisted face's userData field. + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + updateFace( + largeFaceListId: string, + persistedFaceId: string, + options?: LargeFaceListUpdateFaceOptionalParams + ): Promise; + /** + * Add a face to a specified large face list, up to 1,000,000 faces. + *
To deal with an image contains multiple faces, input face can be specified as an image with a + * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be + * stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same face list are processed sequentially and to/from different + * face lists are in parallel. + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) + * + * Quota: + * * Free-tier subscription quota: 1,000 faces per large face list. + * * S0-tier subscription quota: 1,000,000 faces per large face list. + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param options The options parameters. + */ + addFaceFromUrl( + largeFaceListId: string, + url: string, + options?: LargeFaceListAddFaceFromUrlOptionalParams + ): Promise; + /** + * List all faces in a large face list, and retrieve face information (including userData and + * persistedFaceIds of registered faces of the face). + * @param largeFaceListId Id referencing a particular large face list. + * @param options The options parameters. + */ + listFaces( + largeFaceListId: string, + options?: LargeFaceListListFacesOptionalParams + ): Promise; + /** + * Add a face to a specified large face list, up to 1,000,000 faces. + *
To deal with an image contains multiple faces, input face can be specified as an image with a + * targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be + * stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same face list are processed sequentially and to/from different + * face lists are in parallel. + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + * Quota: + * * Free-tier subscription quota: 1,000 faces per large face list. + * * S0-tier subscription quota: 1,000,000 faces per large face list. + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param options The options parameters. + */ + addFaceFromStream( + largeFaceListId: string, + image: coreRestPipeline.RequestBodyType, + options?: LargeFaceListAddFaceFromStreamOptionalParams + ): Promise; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largePersonGroupOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largePersonGroupOperations.ts new file mode 100644 index 000000000000..53145d2269ba --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largePersonGroupOperations.ts @@ -0,0 +1,132 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + LargePersonGroupCreateOptionalParams, + LargePersonGroupDeleteOptionalParams, + LargePersonGroupGetOptionalParams, + LargePersonGroupGetResponse, + LargePersonGroupUpdateOptionalParams, + LargePersonGroupGetTrainingStatusOptionalParams, + LargePersonGroupGetTrainingStatusResponse, + LargePersonGroupListOptionalParams, + LargePersonGroupListResponse, + LargePersonGroupTrainOptionalParams +} from "../models"; + +/** Interface representing a LargePersonGroupOperations. */ +export interface LargePersonGroupOperations { + /** + * Create a new large person group with user-specified largePersonGroupId, name, an optional userData + * and recognitionModel. + *
A large person group is the container of the uploaded person data, including face recognition + * feature, and up to 1,000,000 + * people. + *
After creation, use [LargePersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/create) to add person + * into the group, and call [LargePersonGroup - + * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train) to get this group ready + * for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). + *
No image will be stored. Only the person's extracted face features and userData will be + * stored on server until [LargePersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is + * called. + *
'recognitionModel' should be specified to associate with this large person group. The default + * value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly + * specify the model you need in this parameter. New faces that are added to an existing large person + * group will use the recognition model that's already associated with the collection. Existing face + * features in a large person group can't be updated to features extracted by another version of + * recognition model. Please refer to [Specify a face recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + * Large person group quota: + * * Free-tier subscription quota: 1,000 large person groups. + * * S0-tier subscription quota: 1,000,000 large person groups. + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param options The options parameters. + */ + create( + largePersonGroupId: string, + name: string, + options?: LargePersonGroupCreateOptionalParams + ): Promise; + /** + * Delete an existing large person group. Persisted face features of all people in the large person + * group will also be deleted. + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The options parameters. + */ + delete( + largePersonGroupId: string, + options?: LargePersonGroupDeleteOptionalParams + ): Promise; + /** + * Retrieve the information of a large person group, including its name, userData and recognitionModel. + * This API returns large person group information only, use [LargePersonGroup Person - + * List](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/list) instead to retrieve + * person information under the large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The options parameters. + */ + get( + largePersonGroupId: string, + options?: LargePersonGroupGetOptionalParams + ): Promise; + /** + * Update an existing large person group's display name and userData. The properties which does not + * appear in request body will not be updated. + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The options parameters. + */ + update( + largePersonGroupId: string, + options?: LargePersonGroupUpdateOptionalParams + ): Promise; + /** + * Retrieve the training status of a large person group (completed or ongoing). + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The options parameters. + */ + getTrainingStatus( + largePersonGroupId: string, + options?: LargePersonGroupGetTrainingStatusOptionalParams + ): Promise; + /** + * List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.
+ * * Large person groups are stored in alphabetical order of largePersonGroupId. + * * "start" parameter (string, optional) is a user-provided largePersonGroupId value that returned + * entries have larger ids by string comparison. "start" set to empty to indicate return from the first + * item. + * * "top" parameter (int, optional) specifies the number of entries to return. A maximal of 1000 + * entries can be returned in one call. To fetch more, you can specify "start" with the last returned + * entry’s Id of the current call. + *
+ * For example, total 5 large person groups: "group1", ..., "group5". + *
"start=&top=" will return all 5 groups. + *
"start=&top=2" will return "group1", "group2". + *
"start=group2&top=3" will return "group3", "group4", "group5". + * + * @param options The options parameters. + */ + list( + options?: LargePersonGroupListOptionalParams + ): Promise; + /** + * Queue a large person group training task, the training task may not be started immediately. + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The options parameters. + */ + train( + largePersonGroupId: string, + options?: LargePersonGroupTrainOptionalParams + ): Promise; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largePersonGroupPerson.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largePersonGroupPerson.ts new file mode 100644 index 000000000000..747e5fe5f6ee --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/largePersonGroupPerson.ts @@ -0,0 +1,212 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + LargePersonGroupPersonCreateOptionalParams, + LargePersonGroupPersonCreateResponse, + LargePersonGroupPersonListOptionalParams, + LargePersonGroupPersonListResponse, + LargePersonGroupPersonDeleteOptionalParams, + LargePersonGroupPersonGetOptionalParams, + LargePersonGroupPersonGetResponse, + LargePersonGroupPersonUpdateOptionalParams, + LargePersonGroupPersonDeleteFaceOptionalParams, + LargePersonGroupPersonGetFaceOptionalParams, + LargePersonGroupPersonGetFaceResponse, + LargePersonGroupPersonUpdateFaceOptionalParams, + LargePersonGroupPersonAddFaceFromUrlOptionalParams, + LargePersonGroupPersonAddFaceFromUrlResponse, + LargePersonGroupPersonAddFaceFromStreamOptionalParams, + LargePersonGroupPersonAddFaceFromStreamResponse +} from "../models"; + +/** Interface representing a LargePersonGroupPerson. */ +export interface LargePersonGroupPerson { + /** + * Create a new person in a specified large person group. + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The options parameters. + */ + create( + largePersonGroupId: string, + options?: LargePersonGroupPersonCreateOptionalParams + ): Promise; + /** + * List all persons in a large person group, and retrieve person information (including personId, name, + * userData and persistedFaceIds of registered faces of the person). + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The options parameters. + */ + list( + largePersonGroupId: string, + options?: LargePersonGroupPersonListOptionalParams + ): Promise; + /** + * Delete an existing person from a large person group. The persistedFaceId, userData, person name and + * face feature in the person entry will all be deleted. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param options The options parameters. + */ + delete( + largePersonGroupId: string, + personId: string, + options?: LargePersonGroupPersonDeleteOptionalParams + ): Promise; + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person + * face feature. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param options The options parameters. + */ + get( + largePersonGroupId: string, + personId: string, + options?: LargePersonGroupPersonGetOptionalParams + ): Promise; + /** + * Update name or userData of a person. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param options The options parameters. + */ + update( + largePersonGroupId: string, + personId: string, + options?: LargePersonGroupPersonUpdateOptionalParams + ): Promise; + /** + * Delete a face from a person in a large person group by specified largePersonGroupId, personId and + * persistedFaceId. + *
Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting + * faces to/from different persons are processed in parallel. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + deleteFace( + largePersonGroupId: string, + personId: string, + persistedFaceId: string, + options?: LargePersonGroupPersonDeleteFaceOptionalParams + ): Promise; + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its + * belonging largePersonGroupId). + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + getFace( + largePersonGroupId: string, + personId: string, + persistedFaceId: string, + options?: LargePersonGroupPersonGetFaceOptionalParams + ): Promise; + /** + * Update a person persisted face's userData field. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + updateFace( + largePersonGroupId: string, + personId: string, + persistedFaceId: string, + options?: LargePersonGroupPersonUpdateFaceOptionalParams + ): Promise; + /** + * Add a face to a person into a large person group for face identification or verification. To deal + * with an image contains multiple faces, input face can be specified as an image with a targetFace + * rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only + * the extracted face feature will be stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), + * [LargePersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is + * called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Each person entry can hold up to 248 faces. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces + * to/from different persons are processed in parallel. + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param options The options parameters. + */ + addFaceFromUrl( + largePersonGroupId: string, + personId: string, + url: string, + options?: LargePersonGroupPersonAddFaceFromUrlOptionalParams + ): Promise; + /** + * Add a face to a person into a large person group for face identification or verification. To deal + * with an image contains multiple faces, input face can be specified as an image with a targetFace + * rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only + * the extracted face feature will be stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), + * [LargePersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is + * called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Each person entry can hold up to 248 faces. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces + * to/from different persons are processed in parallel. + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param options The options parameters. + */ + addFaceFromStream( + largePersonGroupId: string, + personId: string, + image: coreRestPipeline.RequestBodyType, + options?: LargePersonGroupPersonAddFaceFromStreamOptionalParams + ): Promise; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/personGroupOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/personGroupOperations.ts new file mode 100644 index 000000000000..aa788e853123 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/personGroupOperations.ts @@ -0,0 +1,126 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + PersonGroupCreateOptionalParams, + PersonGroupDeleteOptionalParams, + PersonGroupGetOptionalParams, + PersonGroupGetResponse, + PersonGroupUpdateOptionalParams, + PersonGroupGetTrainingStatusOptionalParams, + PersonGroupGetTrainingStatusResponse, + PersonGroupListOptionalParams, + PersonGroupListResponse, + PersonGroupTrainOptionalParams +} from "../models"; + +/** Interface representing a PersonGroupOperations. */ +export interface PersonGroupOperations { + /** + * Create a new person group with specified personGroupId, name, user-provided userData and + * recognitionModel. + *
A person group is the container of the uploaded person data, including face recognition + * features. + *
After creation, use [PersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/create) to add persons into + * the group, and then call [PersonGroup - + * Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) to get this group ready for + * [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). + *
No image will be stored. Only the person's extracted face features and userData will be + * stored on server until [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + *
'recognitionModel' should be specified to associate with this person group. The default value + * for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify + * the model you need in this parameter. New faces that are added to an existing person group will use + * the recognition model that's already associated with the collection. Existing face features in a + * person group can't be updated to features extracted by another version of recognition model. + * + * Person group quota: + * * Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000 persons. + * * S0-tier subscription quota: 1,000,000 person groups. Each holds up to 10,000 persons. + * * to handle larger scale face identification problem, please consider using + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup). + * @param personGroupId Id referencing a particular person group. + * @param name User defined name, maximum length is 128. + * @param options The options parameters. + */ + create( + personGroupId: string, + name: string, + options?: PersonGroupCreateOptionalParams + ): Promise; + /** + * Delete an existing person group. Persisted face features of all people in the person group will also + * be deleted. + * @param personGroupId Id referencing a particular person group. + * @param options The options parameters. + */ + delete( + personGroupId: string, + options?: PersonGroupDeleteOptionalParams + ): Promise; + /** + * Retrieve person group name, userData and recognitionModel. To get person information under this + * personGroup, use [PersonGroup Person - + * List](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/list). + * @param personGroupId Id referencing a particular person group. + * @param options The options parameters. + */ + get( + personGroupId: string, + options?: PersonGroupGetOptionalParams + ): Promise; + /** + * Update an existing person group's display name and userData. The properties which does not appear in + * request body will not be updated. + * @param personGroupId Id referencing a particular person group. + * @param options The options parameters. + */ + update( + personGroupId: string, + options?: PersonGroupUpdateOptionalParams + ): Promise; + /** + * Retrieve the training status of a person group (completed or ongoing). + * @param personGroupId Id referencing a particular person group. + * @param options The options parameters. + */ + getTrainingStatus( + personGroupId: string, + options?: PersonGroupGetTrainingStatusOptionalParams + ): Promise; + /** + * List person groups’ personGroupId, name, userData and recognitionModel.
+ * * Person groups are stored in alphabetical order of personGroupId. + * * "start" parameter (string, optional) is a user-provided personGroupId value that returned entries + * have larger ids by string comparison. "start" set to empty to indicate return from the first item. + * * "top" parameter (int, optional) specifies the number of entries to return. A maximal of 1000 + * entries can be returned in one call. To fetch more, you can specify "start" with the last returned + * entry’s Id of the current call. + *
+ * For example, total 5 person groups: "group1", ..., "group5". + *
"start=&top=" will return all 5 groups. + *
"start=&top=2" will return "group1", "group2". + *
"start=group2&top=3" will return "group3", "group4", "group5". + * + * @param options The options parameters. + */ + list( + options?: PersonGroupListOptionalParams + ): Promise; + /** + * Queue a person group training task, the training task may not be started immediately. + * @param personGroupId Id referencing a particular person group. + * @param options The options parameters. + */ + train( + personGroupId: string, + options?: PersonGroupTrainOptionalParams + ): Promise; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/personGroupPerson.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/personGroupPerson.ts new file mode 100644 index 000000000000..944f58e05cf2 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/personGroupPerson.ts @@ -0,0 +1,228 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PersonGroupPersonCreateOptionalParams, + PersonGroupPersonCreateResponse, + PersonGroupPersonListOptionalParams, + PersonGroupPersonListResponse, + PersonGroupPersonDeleteOptionalParams, + PersonGroupPersonGetOptionalParams, + PersonGroupPersonGetResponse, + PersonGroupPersonUpdateOptionalParams, + PersonGroupPersonDeleteFaceOptionalParams, + PersonGroupPersonGetFaceOptionalParams, + PersonGroupPersonGetFaceResponse, + PersonGroupPersonUpdateFaceOptionalParams, + PersonGroupPersonAddFaceFromUrlOptionalParams, + PersonGroupPersonAddFaceFromUrlResponse, + PersonGroupPersonAddFaceFromStreamOptionalParams, + PersonGroupPersonAddFaceFromStreamResponse +} from "../models"; + +/** Interface representing a PersonGroupPerson. */ +export interface PersonGroupPerson { + /** + * Create a new person in a specified person group. + * @param personGroupId Id referencing a particular person group. + * @param options The options parameters. + */ + create( + personGroupId: string, + options?: PersonGroupPersonCreateOptionalParams + ): Promise; + /** + * List all persons in a person group, and retrieve person information (including personId, name, + * userData and persistedFaceIds of registered faces of the person). + * @param personGroupId Id referencing a particular person group. + * @param options The options parameters. + */ + list( + personGroupId: string, + options?: PersonGroupPersonListOptionalParams + ): Promise; + /** + * Delete an existing person from a person group. The persistedFaceId, userData, person name and face + * feature in the person entry will all be deleted. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param options The options parameters. + */ + delete( + personGroupId: string, + personId: string, + options?: PersonGroupPersonDeleteOptionalParams + ): Promise; + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param options The options parameters. + */ + get( + personGroupId: string, + personId: string, + options?: PersonGroupPersonGetOptionalParams + ): Promise; + /** + * Update name or userData of a person. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param options The options parameters. + */ + update( + personGroupId: string, + personId: string, + options?: PersonGroupPersonUpdateOptionalParams + ): Promise; + /** + * Delete a face from a person in a person group by specified personGroupId, personId and + * persistedFaceId. + *
Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting + * faces to/from different persons are processed in parallel. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + deleteFace( + personGroupId: string, + personId: string, + persistedFaceId: string, + options?: PersonGroupPersonDeleteFaceOptionalParams + ): Promise; + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its + * belonging personGroupId). + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + getFace( + personGroupId: string, + personId: string, + persistedFaceId: string, + options?: PersonGroupPersonGetFaceOptionalParams + ): Promise; + /** + * Add a face to a person into a person group for face identification or verification. To deal with an + * image contains multiple faces, input face can be specified as an image with a targetFace rectangle. + * It returns a persistedFaceId representing the added face. No image will be stored. Only the + * extracted face feature will be stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup + * Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better recognition precision. Please consider high-quality faces: + * frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Each person entry can hold up to 248 faces. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will + * cause failures. + * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces + * to/from different persons are processed in parallel. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The options parameters. + */ + updateFace( + personGroupId: string, + personId: string, + persistedFaceId: string, + options?: PersonGroupPersonUpdateFaceOptionalParams + ): Promise; + /** + * Add a face to a person into a person group for face identification or verification. To deal with an + * image contains multiple faces, input face can be specified as an image with a targetFace rectangle. + * It returns a persistedFaceId representing the added face. No image will be stored. Only the + * extracted face feature will be stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup + * Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better recognition precision. Please consider high-quality + * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Each person entry can hold up to 248 faces. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions + * will cause failures. + * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting + * faces to/from different persons are processed in parallel. + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param options The options parameters. + */ + addFaceFromUrl( + personGroupId: string, + personId: string, + url: string, + options?: PersonGroupPersonAddFaceFromUrlOptionalParams + ): Promise; + /** + * Add a face to a person into a person group for face identification or verification. To deal with an + * image contains multiple faces, input face can be specified as an image with a targetFace rectangle. + * It returns a persistedFaceId representing the added face. No image will be stored. Only the + * extracted face feature will be stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup + * Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + *
Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). + * * Higher face image quality means better recognition precision. Please consider high-quality + * faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. + * * Each person entry can hold up to 248 faces. + * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is + * from 1KB to 6MB. + * * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an + * error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to + * detect and add the face successfully. + * * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions + * will cause failures. + * * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting + * faces to/from different persons are processed in parallel. + * * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. + * Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face + * size. + * * Different 'detectionModel' values can be provided. To use and compare different detection models, + * please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param options The options parameters. + */ + addFaceFromStream( + personGroupId: string, + personId: string, + image: coreRestPipeline.RequestBodyType, + options?: PersonGroupPersonAddFaceFromStreamOptionalParams + ): Promise; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/snapshotOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/snapshotOperations.ts new file mode 100644 index 000000000000..e1e8dc96f858 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operationsInterfaces/snapshotOperations.ts @@ -0,0 +1,155 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + SnapshotObjectType, + SnapshotTakeOptionalParams, + SnapshotTakeResponse, + SnapshotListOptionalParams, + SnapshotListResponse, + SnapshotGetOptionalParams, + SnapshotGetResponse, + SnapshotUpdateOptionalParams, + SnapshotDeleteOptionalParams, + SnapshotApplyOptionalParams, + SnapshotApplyResponse, + SnapshotGetOperationStatusOptionalParams, + SnapshotGetOperationStatusResponse +} from "../models"; + +/** Interface representing a SnapshotOperations. */ +export interface SnapshotOperations { + /** + * Submit an operation to take a snapshot of face list, large face list, person group or large person + * group, with user-specified snapshot type, source object id, apply scope and an optional user + * data.
+ * The snapshot interfaces are for users to backup and restore their face data from one face + * subscription to another, inside same region or across regions. The workflow contains two phases, + * user first calls Snapshot - Take to create a copy of the source object and store it as a snapshot, + * then calls Snapshot - Apply to paste the snapshot to target subscription. The snapshots are stored + * in a centralized location (per Azure instance), so that they can be applied cross accounts and + * regions.
+ * Taking snapshot is an asynchronous operation. An operation id can be obtained from the + * "Operation-Location" field in response header, to be used in OperationStatus - Get for tracking the + * progress of creating the snapshot. The snapshot id will be included in the "resourceLocation" field + * in OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot taking time depends on the number of person and face entries in the source object. It could + * be in seconds, or up to several hours for 1,000,000 persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is created by Snapshot - + * Take. User can delete the snapshot using Snapshot - Delete by themselves any time before + * expiration.
+ * Taking snapshot for a certain object will not block any other operations against the object. All + * read-only operations (Get/List and Identify/FindSimilar/Verify) can be conducted as usual. For all + * writable operations, including Add/Update/Delete the source object or its persons/faces and Train, + * they are not blocked but not recommended because writable updates may not be reflected on the + * snapshot during its taking. After snapshot taking is completed, all readable and writable operations + * can work as normal. Snapshot will also include the training results of the source object, which + * means target subscription the snapshot applied to does not need re-train the target object before + * calling Identify/FindSimilar.
+ * * Free-tier subscription quota: 100 take operations per month. + * * S0-tier subscription quota: 100 take operations per day. + * @param objectId User specified source object id to take snapshot from. + * @param applyScope User specified array of target Face subscription ids for the snapshot. For each + * snapshot, only subscriptions included in the applyScope of Snapshot - Take can apply it. + * @param typeParam User specified type for the source object to take snapshot from. Currently + * FaceList, PersonGroup, LargeFaceList and LargePersonGroup are supported. + * @param options The options parameters. + */ + take( + objectId: string, + applyScope: string[], + typeParam: SnapshotObjectType, + options?: SnapshotTakeOptionalParams + ): Promise; + /** + * List all accessible snapshots with related information, including snapshots that were taken by the + * user, or snapshots to be applied to the user (subscription id was included in the applyScope in + * Snapshot - Take). + * @param options The options parameters. + */ + list(options?: SnapshotListOptionalParams): Promise; + /** + * Retrieve information about a snapshot. Snapshot is only accessible to the source subscription who + * took it, and target subscriptions included in the applyScope in Snapshot - Take. + * @param snapshotId Id referencing a particular snapshot. + * @param options The options parameters. + */ + get( + snapshotId: string, + options?: SnapshotGetOptionalParams + ): Promise; + /** + * Update the information of a snapshot. Only the source subscription who took the snapshot can update + * the snapshot. + * @param snapshotId Id referencing a particular snapshot. + * @param options The options parameters. + */ + update( + snapshotId: string, + options?: SnapshotUpdateOptionalParams + ): Promise; + /** + * Delete an existing snapshot according to the snapshotId. All object data and information in the + * snapshot will also be deleted. Only the source subscription who took the snapshot can delete the + * snapshot. If the user does not delete a snapshot with this API, the snapshot will still be + * automatically deleted in 48 hours after creation. + * @param snapshotId Id referencing a particular snapshot. + * @param options The options parameters. + */ + delete( + snapshotId: string, + options?: SnapshotDeleteOptionalParams + ): Promise; + /** + * Submit an operation to apply a snapshot to current subscription. For each snapshot, only + * subscriptions included in the applyScope of Snapshot - Take can apply it.
+ * The snapshot interfaces are for users to backup and restore their face data from one face + * subscription to another, inside same region or across regions. The workflow contains two phases, + * user first calls Snapshot - Take to create a copy of the source object and store it as a snapshot, + * then calls Snapshot - Apply to paste the snapshot to target subscription. The snapshots are stored + * in a centralized location (per Azure instance), so that they can be applied cross accounts and + * regions.
+ * Applying snapshot is an asynchronous operation. An operation id can be obtained from the + * "Operation-Location" field in response header, to be used in OperationStatus - Get for tracking the + * progress of applying the snapshot. The target object id will be included in the "resourceLocation" + * field in OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot applying time depends on the number of person and face entries in the snapshot object. It + * could be in seconds, or up to 1 hour for 1,000,000 persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is created by Snapshot - + * Take. So the target subscription is required to apply the snapshot in 48 hours since its + * creation.
+ * Applying a snapshot will not block any other operations against the target object, however it is not + * recommended because the correctness cannot be guaranteed during snapshot applying. After snapshot + * applying is completed, all operations towards the target object can work as normal. Snapshot also + * includes the training results of the source object, which means target subscription the snapshot + * applied to does not need re-train the target object before calling Identify/FindSimilar.
+ * One snapshot can be applied multiple times in parallel, while currently only CreateNew apply mode is + * supported, which means the apply operation will fail if target subscription already contains an + * object of same type and using the same objectId. Users can specify the "objectId" in request body to + * avoid such conflicts.
+ * * Free-tier subscription quota: 100 apply operations per month. + * * S0-tier subscription quota: 100 apply operations per day. + * @param snapshotId Id referencing a particular snapshot. + * @param objectId User specified target object id to be created from the snapshot. + * @param options The options parameters. + */ + apply( + snapshotId: string, + objectId: string, + options?: SnapshotApplyOptionalParams + ): Promise; + /** + * Retrieve the status of a take/apply snapshot operation. + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param options The options parameters. + */ + getOperationStatus( + operationId: string, + options?: SnapshotGetOperationStatusOptionalParams + ): Promise; +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/test/sampleTest.ts b/sdk/cognitiveservices/cognitiveservices-face/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/cognitiveservices/cognitiveservices-face/tsconfig.json b/sdk/cognitiveservices/cognitiveservices-face/tsconfig.json index 422b584abd5e..6e3251194117 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/tsconfig.json +++ b/sdk/cognitiveservices/cognitiveservices-face/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,9 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", + "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts"], "exclude": ["node_modules"] }