diff --git a/sdk/cognitiveservices/cognitiveservices-face/README.md b/sdk/cognitiveservices/cognitiveservices-face/README.md index 343c6a481fcb..be40e0f4a6e1 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/README.md +++ b/sdk/cognitiveservices/cognitiveservices-face/README.md @@ -1,100 +1,102 @@ ## An isomorphic javascript sdk for - FaceClient -This package contains an isomorphic SDK for FaceClient. +This package contains an isomorphic SDK (runs both in node.js and in browsers) for FaceClient. ### Currently supported environments -- Node.js version 6.x.x or higher -- Browser JavaScript +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites +You must have an [Azure subscription](https://azure.microsoft.com/free/). + +### How to install + +To use this SDK in your project, you will need to install two packages. +- `@azure/cognitiveservices-face` that contains the client. +- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory. + +Install both packages using the below command: ```bash -npm install @azure/cognitiveservices-face +npm install --save @azure/cognitiveservices-face @azure/identity ``` +> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. +If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. ### How to use -#### nodejs - Authentication, client creation and list personGroupPerson as an example written in TypeScript. +- If you are writing a client side browser application, + - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions. + - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below. +- If you are writing a server side application, + - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples) + - Complete the set up steps required by the credential if any. + - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below. -##### Install @azure/ms-rest-azure-js - -```bash -npm install @azure/ms-rest-azure-js -``` +In the below samples, we pass the credential and the Azure subscription id to instantiate the client. +Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. +#### nodejs - Authentication, client creation, and list personGroupPerson as an example written in JavaScript. ##### 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) ```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 { DefaultAzureCredential } = require("@azure/identity"); +const { FaceClient } = require("@azure/cognitiveservices-face"); +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples +// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead. +const creds = new DefaultAzureCredential(); +const client = new FaceClient(creds, subscriptionId); +const personGroupId = "testpersonGroupId"; +const start = "teststart"; +const top = 1; +client.personGroupPerson.list(personGroupId, start, top).then((result) => { + console.log("The result is:"); + console.log(result); +}).catch((err) => { + console.log("An error occurred:"); + console.error(err); +}); ``` -#### browser - Authentication, client creation and list personGroupPerson as an example written in JavaScript. +#### browser - Authentication, client creation, and list personGroupPerson as an example written in JavaScript. + +In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser. + - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser. + - Note down the client Id from the previous step and use it in the browser sample below. ##### Sample code - index.html + ```html @azure/cognitiveservices-face sample - @@ -105,4 +107,4 @@ main(); - [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) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/cognitiveservices/cognitiveservices-face/README.png) diff --git a/sdk/cognitiveservices/cognitiveservices-face/package.json b/sdk/cognitiveservices/cognitiveservices-face/package.json index 4b07761a3a37..8e28dc25e4ed 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/package.json +++ b/sdk/cognitiveservices/cognitiveservices-face/package.json @@ -4,7 +4,8 @@ "description": "FaceClient Library with typescript type definitions for node.js and browser.", "version": "4.2.0", "dependencies": { - "@azure/ms-rest-js": "^2.0.4", + "@azure/ms-rest-js": "^2.2.0", + "@azure/core-auth": "^1.1.4", "tslib": "^1.10.0" }, "keywords": [ @@ -19,13 +20,13 @@ "module": "./esm/faceClient.js", "types": "./esm/faceClient.d.ts", "devDependencies": { - "typescript": "^3.5.3", + "typescript": "^3.6.0", "rollup": "^1.18.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.6.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitiveservices/cognitiveservices-face", + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/cognitiveservices-face", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" diff --git a/sdk/cognitiveservices/cognitiveservices-face/rollup.config.js b/sdk/cognitiveservices/cognitiveservices-face/rollup.config.js index 7473944f8d56..11e8f0ddd355 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/rollup.config.js +++ b/sdk/cognitiveservices/cognitiveservices-face/rollup.config.js @@ -21,8 +21,8 @@ const config = { "@azure/ms-rest-azure-js": "msRestAzure" }, banner: `/* - * 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. diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/faceClient.ts b/sdk/cognitiveservices/cognitiveservices-face/src/faceClient.ts index 9638aeeb2bd1..263bc28650a1 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/faceClient.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/faceClient.ts @@ -1,7 +1,6 @@ /* - * 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 @@ -30,9 +29,14 @@ class FaceClient extends FaceClientContext { * @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. + * Credentials implementing the TokenCredential interface from the @azure/identity package are + * recommended. For more information about these credentials, see + * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the + * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and + * @azure/ms-rest-browserauth are also supported. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) { + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, endpoint: string, options?: msRest.ServiceClientOptions) { super(credentials, endpoint, options); this.face = new operations.Face(this); this.personGroupPerson = new operations.PersonGroupPerson(this); diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/faceClientContext.ts b/sdk/cognitiveservices/cognitiveservices-face/src/faceClientContext.ts index 1374033faf53..f720dd4da1df 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/faceClientContext.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/faceClientContext.ts @@ -1,7 +1,6 @@ /* - * 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 @@ -15,16 +14,21 @@ const packageVersion = "4.2.0"; export class FaceClientContext extends msRest.ServiceClient { endpoint: string; - credentials: msRest.ServiceClientCredentials; + credentials: msRest.ServiceClientCredentials | TokenCredential; /** * 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. + * Credentials implementing the TokenCredential interface from the @azure/identity package are + * recommended. For more information about these credentials, see + * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the + * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and + * @azure/ms-rest-browserauth are also supported. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) { + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, endpoint: string, options?: msRest.ServiceClientOptions) { if (endpoint == undefined) { throw new Error("'endpoint' cannot be null."); } diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/faceListOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/faceListOperationsMappers.ts index 5267f02f0159..c47d6ea74f26 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/faceListOperationsMappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/faceListOperationsMappers.ts @@ -1,6 +1,6 @@ /* - * 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. @@ -15,6 +15,7 @@ export { LargePersonGroup, MetaDataContract, NameAndUserDataContract, + NonNullableNameAndNullableUserDataContract, PersistedFace, Person, PersonGroup diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/faceMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/faceMappers.ts index 2b055e4650d3..489f8ccf386b 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/faceMappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/faceMappers.ts @@ -1,6 +1,6 @@ /* - * 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. diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/index.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/index.ts index 3665d7bd22f9..c4e1a724b378 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/index.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/index.ts @@ -1,6 +1,6 @@ /* - * 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. @@ -454,7 +454,7 @@ export interface IdentifyRequest { */ largePersonGroupId?: string; /** - * The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). Default value: 1. + * The range of maxNumOfCandidatesReturned is between 1 and 100 (default is 1). Default value: 1. */ maxNumOfCandidatesReturned?: number; /** @@ -574,11 +574,11 @@ export interface PersistedFace { * A combination of user defined name and user specified data for the person, * largePersonGroup/personGroup, and largeFaceList/faceList. */ -export interface NameAndUserDataContract { +export interface NonNullableNameAndNullableUserDataContract { /** * User defined name, maximum length is 128. */ - name?: string; + name: string; /** * User specified data. Length should not exceed 16KB. */ @@ -589,7 +589,7 @@ export interface NameAndUserDataContract { * A combination of user defined name and user specified data and recognition model name for * largePersonGroup/personGroup, and largeFaceList/faceList. */ -export interface MetaDataContract extends NameAndUserDataContract { +export interface MetaDataContract extends NonNullableNameAndNullableUserDataContract { /** * Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', * 'recognition_04'. Default value: 'recognition_01'. @@ -621,6 +621,21 @@ export interface PersonGroup extends MetaDataContract { 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. */ @@ -903,7 +918,7 @@ export interface FaceIdentifyOptionalParams extends msRest.RequestOptionsBase { */ largePersonGroupId?: string; /** - * The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). Default value: 1. + * The range of maxNumOfCandidatesReturned is between 1 and 100 (default is 1). Default value: 1. */ maxNumOfCandidatesReturned?: number; /** @@ -1141,10 +1156,6 @@ export interface PersonGroupPersonAddFaceFromStreamOptionalParams extends msRest * Optional Parameters. */ export interface PersonGroupCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ - name?: string; /** * User specified data. Length should not exceed 16KB. */ @@ -1204,10 +1215,6 @@ export interface PersonGroupListOptionalParams extends msRest.RequestOptionsBase * Optional Parameters. */ export interface FaceListCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ - name?: string; /** * User specified data. Length should not exceed 16KB. */ @@ -1411,10 +1418,6 @@ export interface LargePersonGroupPersonAddFaceFromStreamOptionalParams extends m * Optional Parameters. */ export interface LargePersonGroupCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ - name?: string; /** * User specified data. Length should not exceed 16KB. */ @@ -1474,10 +1477,6 @@ export interface LargePersonGroupListOptionalParams extends msRest.RequestOption * Optional Parameters. */ export interface LargeFaceListCreateOptionalParams extends msRest.RequestOptionsBase { - /** - * User defined name, maximum length is 128. - */ - name?: string; /** * User specified data. Length should not exceed 16KB. */ @@ -1523,6 +1522,15 @@ export interface LargeFaceListListOptionalParams extends msRest.RequestOptionsBa * value: false. */ returnRecognitionModel?: boolean; + /** + * 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. + */ + top?: number; } /** diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/largeFaceListOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/largeFaceListOperationsMappers.ts index bbed40fc997b..4311eda60d8d 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/largeFaceListOperationsMappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/largeFaceListOperationsMappers.ts @@ -1,6 +1,6 @@ /* - * 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. @@ -15,6 +15,7 @@ export { LargePersonGroup, MetaDataContract, NameAndUserDataContract, + NonNullableNameAndNullableUserDataContract, PersistedFace, Person, PersonGroup, diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupOperationsMappers.ts index 96323652e5c0..6382dabc41fb 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupOperationsMappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupOperationsMappers.ts @@ -1,6 +1,6 @@ /* - * 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. @@ -14,6 +14,7 @@ export { LargePersonGroup, MetaDataContract, NameAndUserDataContract, + NonNullableNameAndNullableUserDataContract, PersistedFace, Person, PersonGroup, diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupPersonMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupPersonMappers.ts index b158abde514a..5df2bb20e07b 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupPersonMappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/largePersonGroupPersonMappers.ts @@ -1,6 +1,6 @@ /* - * 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. @@ -9,14 +9,9 @@ export { APIError, ErrorModel, - FaceList, ImageUrl, - LargeFaceList, - LargePersonGroup, - MetaDataContract, NameAndUserDataContract, PersistedFace, Person, - PersonGroup, 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 2cbaa0c930d9..a515db5376d7 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/mappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/mappers.ts @@ -1,6 +1,6 @@ /* - * 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. @@ -1091,7 +1091,7 @@ export const IdentifyRequest: msRest.CompositeMapper = { serializedName: "maxNumOfCandidatesReturned", defaultValue: 1, constraints: { - InclusiveMaximum: 5, + InclusiveMaximum: 100, InclusiveMinimum: 1 }, type: { @@ -1280,16 +1280,18 @@ export const PersistedFace: msRest.CompositeMapper = { } }; -export const NameAndUserDataContract: msRest.CompositeMapper = { - serializedName: "NameAndUserDataContract", +export const NonNullableNameAndNullableUserDataContract: msRest.CompositeMapper = { + serializedName: "NonNullableNameAndNullableUserDataContract", type: { name: "Composite", - className: "NameAndUserDataContract", + className: "NonNullableNameAndNullableUserDataContract", modelProperties: { name: { + required: true, serializedName: "name", constraints: { - MaxLength: 128 + MaxLength: 128, + MinLength: 1 }, type: { name: "String" @@ -1314,7 +1316,7 @@ export const MetaDataContract: msRest.CompositeMapper = { name: "Composite", className: "MetaDataContract", modelProperties: { - ...NameAndUserDataContract.type.modelProperties, + ...NonNullableNameAndNullableUserDataContract.type.modelProperties, recognitionModel: { nullable: false, serializedName: "recognitionModel", @@ -1383,6 +1385,34 @@ export const PersonGroup: msRest.CompositeMapper = { } }; +export const NameAndUserDataContract: msRest.CompositeMapper = { + serializedName: "NameAndUserDataContract", + type: { + name: "Composite", + className: "NameAndUserDataContract", + modelProperties: { + name: { + serializedName: "name", + constraints: { + MaxLength: 128 + }, + type: { + name: "String" + } + }, + userData: { + serializedName: "userData", + constraints: { + MaxLength: 16384 + }, + type: { + name: "String" + } + } + } + } +}; + export const Person: msRest.CompositeMapper = { serializedName: "Person", type: { diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/parameters.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/parameters.ts index 30ee8d9ce8e1..dbed7d61222b 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/parameters.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/parameters.ts @@ -1,7 +1,6 @@ /* - * 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 diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupOperationsMappers.ts index 96323652e5c0..6382dabc41fb 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupOperationsMappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupOperationsMappers.ts @@ -1,6 +1,6 @@ /* - * 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. @@ -14,6 +14,7 @@ export { LargePersonGroup, MetaDataContract, NameAndUserDataContract, + NonNullableNameAndNullableUserDataContract, PersistedFace, Person, PersonGroup, diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupPersonMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupPersonMappers.ts index b158abde514a..5df2bb20e07b 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupPersonMappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/personGroupPersonMappers.ts @@ -1,6 +1,6 @@ /* - * 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. @@ -9,14 +9,9 @@ export { APIError, ErrorModel, - FaceList, ImageUrl, - LargeFaceList, - LargePersonGroup, - MetaDataContract, NameAndUserDataContract, PersistedFace, Person, - PersonGroup, UpdateFaceRequest } from "../models/mappers"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/models/snapshotOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/src/models/snapshotOperationsMappers.ts index d8f46446e597..be8e553e18a7 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/models/snapshotOperationsMappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/models/snapshotOperationsMappers.ts @@ -1,6 +1,6 @@ /* - * 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. diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/face.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/face.ts index b42961adbef7..8fc87f73d088 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/face.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/face.ts @@ -1,7 +1,6 @@ /* - * 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 diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/faceListOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/faceListOperations.ts index a4c56423ceb2..67d0637cfd99 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/faceListOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/faceListOperations.ts @@ -1,7 +1,6 @@ /* - * 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 @@ -52,25 +51,29 @@ export class FaceListOperations { * 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 */ - create(faceListId: string, options?: Models.FaceListCreateOptionalParams): Promise; + 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, callback: msRest.ServiceCallback): void; + 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, options: Models.FaceListCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(faceListId: string, options?: Models.FaceListCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + 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 { return this.client.sendOperationRequest( { faceListId, + name, options }, createOperationSpec, @@ -349,10 +352,7 @@ const createOperationSpec: msRest.OperationSpec = { ], requestBody: { parameterPath: { - name: [ - "options", - "name" - ], + name: "name", userData: [ "options", "userData" diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/index.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/index.ts index 3a6f9ae466be..5668f8550fe4 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/index.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/index.ts @@ -1,7 +1,6 @@ /* - * 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 diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largeFaceListOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largeFaceListOperations.ts index 0680b5e8b4f0..a2b75407bd12 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largeFaceListOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largeFaceListOperations.ts @@ -1,7 +1,6 @@ /* - * 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 @@ -55,25 +54,29 @@ export class LargeFaceListOperations { * * 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 optional parameters * @returns Promise */ - create(largeFaceListId: string, options?: Models.LargeFaceListCreateOptionalParams): Promise; + 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, callback: msRest.ServiceCallback): void; + 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, options: Models.LargeFaceListCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(largeFaceListId: string, options?: Models.LargeFaceListCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + 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 { return this.client.sendOperationRequest( { largeFaceListId, + name, options }, createOperationSpec, @@ -523,10 +526,7 @@ const createOperationSpec: msRest.OperationSpec = { ], requestBody: { parameterPath: { - name: [ - "options", - "name" - ], + name: "name", userData: [ "options", "userData" @@ -644,7 +644,9 @@ const listOperationSpec: msRest.OperationSpec = { Parameters.endpoint ], queryParameters: [ - Parameters.returnRecognitionModel + Parameters.returnRecognitionModel, + Parameters.start0, + Parameters.top0 ], responses: { 200: { diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupOperations.ts index bac253f0eece..23078e8e9ee5 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupOperations.ts @@ -1,7 +1,6 @@ /* - * 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 @@ -54,25 +53,29 @@ export class LargePersonGroupOperations { * * 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 optional parameters * @returns Promise */ - create(largePersonGroupId: string, options?: Models.LargePersonGroupCreateOptionalParams): Promise; + 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, callback: msRest.ServiceCallback): void; + 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, options: Models.LargePersonGroupCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(largePersonGroupId: string, options?: Models.LargePersonGroupCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + 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 { return this.client.sendOperationRequest( { largePersonGroupId, + name, options }, createOperationSpec, @@ -273,10 +276,7 @@ const createOperationSpec: msRest.OperationSpec = { ], requestBody: { parameterPath: { - name: [ - "options", - "name" - ], + name: "name", userData: [ "options", "userData" diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupPerson.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupPerson.ts index 2491b447ce31..a0910b0770c7 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupPerson.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/largePersonGroupPerson.ts @@ -1,7 +1,6 @@ /* - * 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 diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupOperations.ts index cc3645853228..1fb548d43079 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupOperations.ts @@ -1,7 +1,6 @@ /* - * 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 @@ -53,25 +52,29 @@ export class PersonGroupOperations { * * 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 optional parameters * @returns Promise */ - create(personGroupId: string, options?: Models.PersonGroupCreateOptionalParams): Promise; + 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, callback: msRest.ServiceCallback): void; + 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, options: Models.PersonGroupCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(personGroupId: string, options?: Models.PersonGroupCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + 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 { return this.client.sendOperationRequest( { personGroupId, + name, options }, createOperationSpec, @@ -270,10 +273,7 @@ const createOperationSpec: msRest.OperationSpec = { ], requestBody: { parameterPath: { - name: [ - "options", - "name" - ], + name: "name", userData: [ "options", "userData" diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupPerson.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupPerson.ts index e5d3f35f90e6..a87c682a928a 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupPerson.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/personGroupPerson.ts @@ -1,7 +1,6 @@ /* - * 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 diff --git a/sdk/cognitiveservices/cognitiveservices-face/src/operations/snapshotOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/src/operations/snapshotOperations.ts index 3d68784865ed..c6afb673264c 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/src/operations/snapshotOperations.ts +++ b/sdk/cognitiveservices/cognitiveservices-face/src/operations/snapshotOperations.ts @@ -1,7 +1,6 @@ /* - * 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 @@ -332,7 +331,8 @@ const takeOperationSpec: msRest.OperationSpec = { headersMapper: Mappers.SnapshotTakeHeaders }, default: { - bodyMapper: Mappers.APIError + bodyMapper: Mappers.APIError, + headersMapper: Mappers.SnapshotTakeHeaders } }, serializer @@ -461,7 +461,8 @@ const applyOperationSpec: msRest.OperationSpec = { headersMapper: Mappers.SnapshotApplyHeaders }, default: { - bodyMapper: Mappers.APIError + bodyMapper: Mappers.APIError, + headersMapper: Mappers.SnapshotApplyHeaders } }, serializer