diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/LICENSE.txt b/sdk/cognitiveservices/cognitiveservices-anomalydetector/LICENSE.txt deleted file mode 100644 index ea8fb1516028..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2020 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. diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/README.md b/sdk/cognitiveservices/cognitiveservices-anomalydetector/README.md deleted file mode 100644 index 67c9e43f1335..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/README.md +++ /dev/null @@ -1,219 +0,0 @@ -## An isomorphic javascript sdk for - AnomalyDetectorClient - -This package contains an isomorphic SDK for AnomalyDetectorClient. - -### Currently supported environments - -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- Latest versions of Safari, Chrome, Edge, and Firefox. - -### How to Install - -```bash -npm install @azure/cognitiveservices-anomalydetector -``` - -### How to use - -#### nodejs - Authentication, client creation and entireDetect as an example written in TypeScript. - -##### Install @azure/ms-rest-azure-js - -```bash -npm install @azure/ms-rest-azure-js -``` - -##### Sample code -The following sample determines anamolies with the given time series. To know more, refer to the [Azure Documentation on Anomaly Detectors](https://docs.microsoft.com/azure/cognitive-services/anomaly-detector/) - -```javascript -const { AnomalyDetectorClient } = require("@azure/cognitiveservices-anomalydetector"); -const { CognitiveServicesCredentials } = require("@azure/ms-rest-azure-js"); - -async function main() { - const anomalyDetectorKey = process.env["anomalyDetectorKey"] || ""; - const anomalyDetectorEndPoint = - process.env["anomalyDetectorEndPoint"] || ""; - - const cognitiveServiceCredentials = new CognitiveServicesCredentials(anomalyDetectorKey); - - const client = new AnomalyDetectorClient(cognitiveServiceCredentials, anomalyDetectorEndPoint); - - const body = { - series: [ - { - timestamp: new Date("December 15, 2018"), - value: 1.01 - }, - { - timestamp: new Date("December 16, 2018"), - value: 1.02 - }, - { - timestamp: new Date("December 17, 2018"), - value: 1.03 - }, - { - timestamp: new Date("December 18, 2018"), - value: 1.04 - }, - { - timestamp: new Date("December 19, 2018"), - value: 1.05 - }, - { - timestamp: new Date("December 20, 2018"), - value: 1.06 - }, - { - timestamp: new Date("December 21, 2018"), - value: 1.07 - }, - { - timestamp: new Date("December 22, 2018"), - value: 1.08 - }, - { - timestamp: new Date("December 23, 2018"), - value: 1.09 - }, - { - timestamp: new Date("December 24, 2018"), - value: 1.1 - }, - { - timestamp: new Date("December 25, 2018"), - value: 1.11 - }, - { - timestamp: new Date("December 26, 2018"), - value: 1.12 - } - ], - granularity: "daily", - customInterval: 1, - period: 1, - maxAnomalyRatio: 0.3, - sensitivity: 1 - }; - - client - .entireDetect(body) - .then((result) => { - console.log("The result is:"); - console.log(result); - }) - .catch((err) => { - console.log("An error occurred:"); - console.error(err); - }); -} - -main(); -``` - -#### browser - Authentication, client creation and entireDetect as an example written in JavaScript. - -##### Sample code - -- index.html - -```html - - - - @azure/cognitiveservices-anomalydetector sample - - - - - - -``` - -## Related projects - -- [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-anomalydetector%2FREADME.png) diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/package.json b/sdk/cognitiveservices/cognitiveservices-anomalydetector/package.json deleted file mode 100644 index efb6a15b120d..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@azure/cognitiveservices-anomalydetector", - "author": "Microsoft Corporation", - "description": "AnomalyDetectorClient Library with typescript type definitions for node.js and browser.", - "version": "2.1.0", - "dependencies": { - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "license": "MIT", - "main": "./dist/cognitiveservices-anomalydetector.js", - "module": "./esm/anomalyDetectorClient.js", - "types": "./esm/anomalyDetectorClient.d.ts", - "devDependencies": { - "typescript": "^3.5.3", - "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-anomalydetector", - "repository": { - "type": "git", - "url": "https://github.com/Azure/azure-sdk-for-js.git" - }, - "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", - "src/**/*.ts", - "README.md", - "rollup.config.js", - "tsconfig.json" - ], - "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-anomalydetector.js.map'\" -o ./dist/cognitiveservices-anomalydetector.min.js ./dist/cognitiveservices-anomalydetector.js", - "prepack": "npm install && npm run build" - }, - "sideEffects": false, - "autoPublish": true -} diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/rollup.config.js b/sdk/cognitiveservices/cognitiveservices-anomalydetector/rollup.config.js deleted file mode 100644 index 4c53d6821d8e..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/rollup.config.js +++ /dev/null @@ -1,37 +0,0 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/anomalyDetectorClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/cognitiveservices-anomalydetector.js", - format: "umd", - name: "Azure.CognitiveservicesAnomalydetector", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@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. - * - * 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() - ] -}; - -export default config; diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/anomalyDetectorClient.ts b/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/anomalyDetectorClient.ts deleted file mode 100644 index d81adaa8a315..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/anomalyDetectorClient.ts +++ /dev/null @@ -1,209 +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"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as Parameters from "./models/parameters"; -import { AnomalyDetectorClientContext } from "./anomalyDetectorClientContext"; - -class AnomalyDetectorClient extends AnomalyDetectorClientContext { - /** - * Initializes a new instance of the AnomalyDetectorClient class. - * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus2.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) { - super(credentials, endpoint, options); - } - - /** - * This operation generates a model using an entire series, each point is detected with the same - * model. With this method, points before and after a certain point are used to determine whether - * it is an anomaly. The entire detection can give user an overall status of the time series. - * @summary Detect anomalies for the entire series in batch. - * @param body Time series points and period if needed. Advanced model parameters can also be set - * in the request. - * @param [options] The optional parameters - * @returns Promise - */ - entireDetect(body: Models.Request, options?: msRest.RequestOptionsBase): Promise; - /** - * @param body Time series points and period if needed. Advanced model parameters can also be set - * in the request. - * @param callback The callback - */ - entireDetect(body: Models.Request, callback: msRest.ServiceCallback): void; - /** - * @param body Time series points and period if needed. Advanced model parameters can also be set - * in the request. - * @param options The optional parameters - * @param callback The callback - */ - entireDetect(body: Models.Request, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - entireDetect(body: Models.Request, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - body, - options - }, - entireDetectOperationSpec, - callback) as Promise; - } - - /** - * This operation generates a model using points before the latest one. With this method, only - * historical points are used to determine whether the target point is an anomaly. The latest point - * detecting operation matches the scenario of real-time monitoring of business metrics. - * @summary Detect anomaly status of the latest point in time series. - * @param body Time series points and period if needed. Advanced model parameters can also be set - * in the request. - * @param [options] The optional parameters - * @returns Promise - */ - lastDetect(body: Models.Request, options?: msRest.RequestOptionsBase): Promise; - /** - * @param body Time series points and period if needed. Advanced model parameters can also be set - * in the request. - * @param callback The callback - */ - lastDetect(body: Models.Request, callback: msRest.ServiceCallback): void; - /** - * @param body Time series points and period if needed. Advanced model parameters can also be set - * in the request. - * @param options The optional parameters - * @param callback The callback - */ - lastDetect(body: Models.Request, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - lastDetect(body: Models.Request, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - body, - options - }, - lastDetectOperationSpec, - callback) as Promise; - } - - /** - * Evaluate change point score of every series point - * @summary Detect change point for the entire series - * @param body Time series points and granularity is needed. Advanced model parameters can also be - * set in the request if needed. - * @param [options] The optional parameters - * @returns Promise - */ - changePointDetect(body: Models.ChangePointDetectRequest, options?: msRest.RequestOptionsBase): Promise; - /** - * @param body Time series points and granularity is needed. Advanced model parameters can also be - * set in the request if needed. - * @param callback The callback - */ - changePointDetect(body: Models.ChangePointDetectRequest, callback: msRest.ServiceCallback): void; - /** - * @param body Time series points and granularity is needed. Advanced model parameters can also be - * set in the request if needed. - * @param options The optional parameters - * @param callback The callback - */ - changePointDetect(body: Models.ChangePointDetectRequest, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - changePointDetect(body: Models.ChangePointDetectRequest, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - body, - options - }, - changePointDetectOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const entireDetectOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "timeseries/entire/detect", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.Request, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.EntireDetectResponse - }, - default: { - bodyMapper: Mappers.APIError - } - }, - serializer -}; - -const lastDetectOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "timeseries/last/detect", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.Request, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.LastDetectResponse - }, - default: { - bodyMapper: Mappers.APIError - } - }, - serializer -}; - -const changePointDetectOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "timeseries/changePoint/detect", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.ChangePointDetectRequest, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.ChangePointDetectResponse - }, - default: { - bodyMapper: Mappers.APIError - } - }, - serializer -}; - -export { - AnomalyDetectorClient, - AnomalyDetectorClientContext, - Models as AnomalyDetectorModels, - Mappers as AnomalyDetectorMappers -}; diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/anomalyDetectorClientContext.ts b/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/anomalyDetectorClientContext.ts deleted file mode 100644 index f6ed770578e9..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/anomalyDetectorClientContext.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-anomalydetector"; -const packageVersion = "2.1.0"; - -export class AnomalyDetectorClientContext extends msRest.ServiceClient { - endpoint: string; - credentials: msRest.ServiceClientCredentials; - - /** - * Initializes a new instance of the AnomalyDetectorClientContext class. - * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus2.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}/anomalydetector/v1.0"; - this.requestContentType = "application/json; charset=utf-8"; - this.endpoint = endpoint; - this.credentials = credentials; - } -} diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/index.ts b/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/index.ts deleted file mode 100644 index 2a2dd8864f0a..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/index.ts +++ /dev/null @@ -1,295 +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"; - -/** - * Error information returned by the API. - */ -export interface APIError { - /** - * The error code. - */ - code?: any; - /** - * A message explaining the error reported by the service. - */ - message?: string; -} - -/** - * An interface representing Point. - */ -export interface Point { - /** - * Timestamp of a data point (ISO8601 format). - */ - timestamp: Date; - /** - * The measurement of that point, should be float. - */ - value: number; -} - -/** - * An interface representing Request. - */ -export interface Request { - /** - * Time series data points. Points should be sorted by timestamp in ascending order to match the - * anomaly detection result. If the data is not sorted correctly or there is duplicated - * timestamp, the API will not work. In such case, an error message will be returned. - */ - series: Point[]; - /** - * Possible values include: 'yearly', 'monthly', 'weekly', 'daily', 'hourly', 'minutely', - * 'secondly' - */ - granularity: Granularity; - /** - * Custom Interval is used to set non-standard time interval, for example, if the series is 5 - * minutes, request can be set as {"granularity":"minutely", "customInterval":5}. - */ - customInterval?: number; - /** - * Optional argument, periodic value of a time series. If the value is null or does not present, - * the API will determine the period automatically. - */ - period?: number; - /** - * Optional argument, advanced model parameter, max anomaly ratio in a time series. - */ - maxAnomalyRatio?: number; - /** - * Optional argument, advanced model parameter, between 0-99, the lower the value is, the larger - * the margin value will be which means less anomalies will be accepted. - */ - sensitivity?: number; -} - -/** - * An interface representing EntireDetectResponse. - */ -export interface EntireDetectResponse { - /** - * Frequency extracted from the series, zero means no recurrent pattern has been found. - */ - period: number; - /** - * ExpectedValues contain expected value for each input point. The index of the array is - * consistent with the input series. - */ - expectedValues: number[]; - /** - * UpperMargins contain upper margin of each input point. UpperMargin is used to calculate - * upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. Anomalies in - * response can be filtered by upperBoundary and lowerBoundary. By adjusting marginScale value, - * less significant anomalies can be filtered in client side. The index of the array is - * consistent with the input series. - */ - upperMargins: number[]; - /** - * LowerMargins contain lower margin of each input point. LowerMargin is used to calculate - * lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. Points between - * the boundary can be marked as normal ones in client side. The index of the array is consistent - * with the input series. - */ - lowerMargins: number[]; - /** - * IsAnomaly contains anomaly properties for each input point. True means an anomaly either - * negative or positive has been detected. The index of the array is consistent with the input - * series. - */ - isAnomaly: boolean[]; - /** - * IsNegativeAnomaly contains anomaly status in negative direction for each input point. True - * means a negative anomaly has been detected. A negative anomaly means the point is detected as - * an anomaly and its real value is smaller than the expected one. The index of the array is - * consistent with the input series. - */ - isNegativeAnomaly: boolean[]; - /** - * IsPositiveAnomaly contain anomaly status in positive direction for each input point. True - * means a positive anomaly has been detected. A positive anomaly means the point is detected as - * an anomaly and its real value is larger than the expected one. The index of the array is - * consistent with the input series. - */ - isPositiveAnomaly: boolean[]; -} - -/** - * An interface representing LastDetectResponse. - */ -export interface LastDetectResponse { - /** - * Frequency extracted from the series, zero means no recurrent pattern has been found. - */ - period: number; - /** - * Suggested input series points needed for detecting the latest point. - */ - suggestedWindow: number; - /** - * Expected value of the latest point. - */ - expectedValue: number; - /** - * Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals - * to expectedValue + (100 - marginScale)*upperMargin. If the value of latest point is between - * upperBoundary and lowerBoundary, it should be treated as normal value. By adjusting - * marginScale value, anomaly status of latest point can be changed. - */ - upperMargin: number; - /** - * Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals - * to expectedValue - (100 - marginScale)*lowerMargin. - */ - lowerMargin: number; - /** - * Anomaly status of the latest point, true means the latest point is an anomaly either in - * negative direction or positive direction. - */ - isAnomaly: boolean; - /** - * Anomaly status in negative direction of the latest point. True means the latest point is an - * anomaly and its real value is smaller than the expected one. - */ - isNegativeAnomaly: boolean; - /** - * Anomaly status in positive direction of the latest point. True means the latest point is an - * anomaly and its real value is larger than the expected one. - */ - isPositiveAnomaly: boolean; -} - -/** - * An interface representing ChangePointDetectRequest. - */ -export interface ChangePointDetectRequest { - /** - * Time series data points. Points should be sorted by timestamp in ascending order to match the - * change point detection result. - */ - series: Point[]; - /** - * Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity - * is used for verify whether input series is valid. Possible values include: 'yearly', - * 'monthly', 'weekly', 'daily', 'hourly', 'minutely', 'secondly' - */ - granularity: Granularity; - /** - * Custom Interval is used to set non-standard time interval, for example, if the series is 5 - * minutes, request can be set as {"granularity":"minutely", "customInterval":5}. - */ - customInterval?: number; - /** - * Optional argument, periodic value of a time series. If the value is null or does not present, - * the API will determine the period automatically. - */ - period?: number; - /** - * Optional argument, advanced model parameter, a default stableTrendWindow will be used in - * detection. - */ - stableTrendWindow?: number; - /** - * Optional argument, advanced model parameter, between 0.0-1.0, the lower the value is, the - * larger the trend error will be which means less change point will be accepted. - */ - threshold?: number; -} - -/** - * An interface representing ChangePointDetectResponse. - */ -export interface ChangePointDetectResponse { - /** - * Frequency extracted from the series, zero means no recurrent pattern has been found. - */ - period: number; - /** - * isChangePoint contains change point properties for each input point. True means an anomaly - * either negative or positive has been detected. The index of the array is consistent with the - * input series. - */ - isChangePoint: boolean[]; - /** - * the change point confidence of each point - */ - confidenceScores: number[]; -} - -/** - * Defines values for Granularity. - * Possible values include: 'yearly', 'monthly', 'weekly', 'daily', 'hourly', 'minutely', - * 'secondly' - * @readonly - * @enum {string} - */ -export type Granularity = 'yearly' | 'monthly' | 'weekly' | 'daily' | 'hourly' | 'minutely' | 'secondly'; - -/** - * Contains response data for the entireDetect operation. - */ -export type EntireDetectResponse2 = EntireDetectResponse & { - /** - * 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: EntireDetectResponse; - }; -}; - -/** - * Contains response data for the lastDetect operation. - */ -export type LastDetectResponse2 = LastDetectResponse & { - /** - * 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: LastDetectResponse; - }; -}; - -/** - * Contains response data for the changePointDetect operation. - */ -export type ChangePointDetectResponse2 = ChangePointDetectResponse & { - /** - * 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: ChangePointDetectResponse; - }; -}; diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/mappers.ts b/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/mappers.ts deleted file mode 100644 index 4b01013f1d28..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/mappers.ts +++ /dev/null @@ -1,380 +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"; - - -export const APIError: msRest.CompositeMapper = { - serializedName: "APIError", - type: { - name: "Composite", - className: "APIError", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "Object" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const Point: msRest.CompositeMapper = { - serializedName: "Point", - type: { - name: "Composite", - className: "Point", - modelProperties: { - timestamp: { - required: true, - serializedName: "timestamp", - type: { - name: "DateTime" - } - }, - value: { - required: true, - serializedName: "value", - type: { - name: "Number" - } - } - } - } -}; - -export const Request: msRest.CompositeMapper = { - serializedName: "Request", - type: { - name: "Composite", - className: "Request", - modelProperties: { - series: { - required: true, - serializedName: "series", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Point" - } - } - } - }, - granularity: { - required: true, - nullable: false, - serializedName: "granularity", - type: { - name: "Enum", - allowedValues: [ - "yearly", - "monthly", - "weekly", - "daily", - "hourly", - "minutely", - "secondly" - ] - } - }, - customInterval: { - serializedName: "customInterval", - type: { - name: "Number" - } - }, - period: { - serializedName: "period", - type: { - name: "Number" - } - }, - maxAnomalyRatio: { - serializedName: "maxAnomalyRatio", - type: { - name: "Number" - } - }, - sensitivity: { - serializedName: "sensitivity", - type: { - name: "Number" - } - } - } - } -}; - -export const EntireDetectResponse: msRest.CompositeMapper = { - serializedName: "EntireDetectResponse", - type: { - name: "Composite", - className: "EntireDetectResponse", - modelProperties: { - period: { - required: true, - serializedName: "period", - type: { - name: "Number" - } - }, - expectedValues: { - required: true, - serializedName: "expectedValues", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, - upperMargins: { - required: true, - serializedName: "upperMargins", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, - lowerMargins: { - required: true, - serializedName: "lowerMargins", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, - isAnomaly: { - required: true, - serializedName: "isAnomaly", - type: { - name: "Sequence", - element: { - type: { - name: "Boolean" - } - } - } - }, - isNegativeAnomaly: { - required: true, - serializedName: "isNegativeAnomaly", - type: { - name: "Sequence", - element: { - type: { - name: "Boolean" - } - } - } - }, - isPositiveAnomaly: { - required: true, - serializedName: "isPositiveAnomaly", - type: { - name: "Sequence", - element: { - type: { - name: "Boolean" - } - } - } - } - } - } -}; - -export const LastDetectResponse: msRest.CompositeMapper = { - serializedName: "LastDetectResponse", - type: { - name: "Composite", - className: "LastDetectResponse", - modelProperties: { - period: { - required: true, - serializedName: "period", - type: { - name: "Number" - } - }, - suggestedWindow: { - required: true, - serializedName: "suggestedWindow", - type: { - name: "Number" - } - }, - expectedValue: { - required: true, - serializedName: "expectedValue", - type: { - name: "Number" - } - }, - upperMargin: { - required: true, - serializedName: "upperMargin", - type: { - name: "Number" - } - }, - lowerMargin: { - required: true, - serializedName: "lowerMargin", - type: { - name: "Number" - } - }, - isAnomaly: { - required: true, - serializedName: "isAnomaly", - type: { - name: "Boolean" - } - }, - isNegativeAnomaly: { - required: true, - serializedName: "isNegativeAnomaly", - type: { - name: "Boolean" - } - }, - isPositiveAnomaly: { - required: true, - serializedName: "isPositiveAnomaly", - type: { - name: "Boolean" - } - } - } - } -}; - -export const ChangePointDetectRequest: msRest.CompositeMapper = { - serializedName: "ChangePointDetectRequest", - type: { - name: "Composite", - className: "ChangePointDetectRequest", - modelProperties: { - series: { - required: true, - serializedName: "series", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Point" - } - } - } - }, - granularity: { - required: true, - nullable: false, - serializedName: "granularity", - type: { - name: "Enum", - allowedValues: [ - "yearly", - "monthly", - "weekly", - "daily", - "hourly", - "minutely", - "secondly" - ] - } - }, - customInterval: { - serializedName: "customInterval", - type: { - name: "Number" - } - }, - period: { - serializedName: "period", - type: { - name: "Number" - } - }, - stableTrendWindow: { - serializedName: "stableTrendWindow", - type: { - name: "Number" - } - }, - threshold: { - serializedName: "threshold", - type: { - name: "Number" - } - } - } - } -}; - -export const ChangePointDetectResponse: msRest.CompositeMapper = { - serializedName: "ChangePointDetectResponse", - type: { - name: "Composite", - className: "ChangePointDetectResponse", - modelProperties: { - period: { - required: true, - serializedName: "period", - type: { - name: "Number" - } - }, - isChangePoint: { - required: true, - serializedName: "isChangePoint", - type: { - name: "Sequence", - element: { - type: { - name: "Boolean" - } - } - } - }, - confidenceScores: { - required: true, - serializedName: "confidenceScores", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - } - } - } -}; diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/parameters.ts b/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/parameters.ts deleted file mode 100644 index ef1746ab6352..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/src/models/parameters.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. - */ - -import * as msRest from "@azure/ms-rest-js"; - -export const endpoint: msRest.OperationURLParameter = { - parameterPath: "endpoint", - mapper: { - required: true, - serializedName: "Endpoint", - defaultValue: '', - type: { - name: "String" - } - }, - skipEncoding: true -}; diff --git a/sdk/cognitiveservices/cognitiveservices-anomalydetector/tsconfig.json b/sdk/cognitiveservices/cognitiveservices-anomalydetector/tsconfig.json deleted file mode 100644 index 422b584abd5e..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-anomalydetector/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "es6", - "moduleResolution": "node", - "strict": true, - "target": "es5", - "sourceMap": true, - "declarationMap": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], - "declaration": true, - "outDir": "./esm", - "importHelpers": true - }, - "include": ["./src/**/*.ts"], - "exclude": ["node_modules"] -} diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/LICENSE.txt b/sdk/cognitiveservices/cognitiveservices-formrecognizer/LICENSE.txt deleted file mode 100644 index b73b4a1293c3..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 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. diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/README.md b/sdk/cognitiveservices/cognitiveservices-formrecognizer/README.md deleted file mode 100644 index a6b02d3b360a..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/README.md +++ /dev/null @@ -1,106 +0,0 @@ -## An isomorphic javascript sdk for - FormRecognizerClient - -This package contains an isomorphic SDK for FormRecognizerClient. - -> Please note, this package is deprecated and not functional as it uses a version of the Form Recognizer service (`v1.0-preview`) that is no longer available. As of August 2020, you can instead use [@azure/ai-form-recognizer](https://www.npmjs.com/package/@azure/ai-form-recognizer). - -### Currently supported environments - -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- Latest versions of Safari, Chrome, Edge, and Firefox. - -See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. - -### How to Install - -```bash -npm install @azure/cognitiveservices-formrecognizer -``` - -### How to use - -#### nodejs - Authentication, client creation and getExtractedKeys as an example written in TypeScript. - -##### Install @azure/ms-rest-azure-js - - -```bash -npm install @azure/ms-rest-azure-js -``` - -##### Sample code -The following sample reads the scanned copy of a sample receipt. To know more, refer to the [Azure Documentation on Form Recognizer](https://docs.microsoft.com/azure/cognitive-services/form-recognizer/overview) - -```javascript -const { FormRecognizerClient } = require("@azure/cognitiveservices-formrecognizer"); -const { CognitiveServicesCredentials } = require("@azure/ms-rest-azure-js"); - -async function main() { - const formRecognizerKey = process.env["formRecognizerKey"] || ""; - const endPoint = process.env["endPoint"] || ""; - const cognitiveServiceCredentials = new CognitiveServicesCredentials(formRecognizerKey); - const client = new FormRecognizerClient(cognitiveServiceCredentials, endPoint); - - client - .batchReadReceipt( - "https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/contoso-receipt.png" - ) - .then((result) => { - console.log(result); - }) - .catch((err) => { - console.log("An error occurred:"); - console.error(err); - }); -} - -main(); -``` - -#### browser - Authentication, client creation and getExtractedKeys as an example written in JavaScript. - -##### Sample code - -- index.html - -```html - - - - @azure/cognitiveservices-formrecognizer sample - - - - - - -``` - -## Related projects - -- [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-formrecognizer%2FREADME.png) diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/package.json b/sdk/cognitiveservices/cognitiveservices-formrecognizer/package.json deleted file mode 100644 index df3be6d87f2b..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@azure/cognitiveservices-formrecognizer", - "author": "Microsoft Corporation", - "description": "FormRecognizerClient Library with typescript type definitions for node.js and browser.", - "version": "2.0.1", - "dependencies": { - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "license": "MIT", - "main": "./dist/cognitiveservices-formrecognizer.js", - "module": "./esm/formRecognizerClient.js", - "types": "./esm/formRecognizerClient.d.ts", - "devDependencies": { - "typescript": "^3.5.3", - "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-formrecognizer", - "repository": { - "type": "git", - "url": "https://github.com/Azure/azure-sdk-for-js.git" - }, - "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", - "src/**/*.ts", - "README.md", - "rollup.config.js", - "tsconfig.json" - ], - "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-formrecognizer.js.map'\" -o ./dist/cognitiveservices-formrecognizer.min.js ./dist/cognitiveservices-formrecognizer.js", - "prepack": "npm install && npm run build" - }, - "sideEffects": false, - "autoPublish": true -} diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/rollup.config.js b/sdk/cognitiveservices/cognitiveservices-formrecognizer/rollup.config.js deleted file mode 100644 index 3b609ef233a2..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/rollup.config.js +++ /dev/null @@ -1,37 +0,0 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/formRecognizerClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/cognitiveservices-formrecognizer.js", - format: "umd", - name: "Azure.CognitiveservicesFormrecognizer", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@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. - * - * 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() - ] -}; - -export default config; diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/formRecognizerClient.ts b/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/formRecognizerClient.ts deleted file mode 100644 index f8eaf77c3f56..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/formRecognizerClient.ts +++ /dev/null @@ -1,505 +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"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as Parameters from "./models/parameters"; -import { FormRecognizerClientContext } from "./formRecognizerClientContext"; - -class FormRecognizerClient extends FormRecognizerClientContext { - /** - * Initializes a new instance of the FormRecognizerClient class. - * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus2.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) { - super(credentials, endpoint, options); - } - - /** - * Create and train a custom model. The train request must include a source parameter that is - * either an externally accessible Azure Storage blob container Uri (preferably a Shared Access - * Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are - * specified, they must follow the Linux/Unix path format and be an absolute path rooted to the - * input mount configuration - * setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid - * source path would be '/input/contosodataset'. All data to be trained is expected to be directly - * under the source folder. Subfolders are not supported. Models are trained using documents that - * are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." - * Other type of content is ignored. - * @summary Train Model - * @param trainRequest Request object for training. - * @param [options] The optional parameters - * @returns Promise - */ - trainCustomModel(trainRequest: Models.TrainRequest, options?: msRest.RequestOptionsBase): Promise; - /** - * @param trainRequest Request object for training. - * @param callback The callback - */ - trainCustomModel(trainRequest: Models.TrainRequest, callback: msRest.ServiceCallback): void; - /** - * @param trainRequest Request object for training. - * @param options The optional parameters - * @param callback The callback - */ - trainCustomModel(trainRequest: Models.TrainRequest, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - trainCustomModel(trainRequest: Models.TrainRequest, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - trainRequest, - options - }, - trainCustomModelOperationSpec, - callback) as Promise; - } - - /** - * Retrieve the keys that were - * extracted during the training of the specified model. - * @summary Get Keys - * @param id Model identifier. - * @param [options] The optional parameters - * @returns Promise - */ - getExtractedKeys(id: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param id Model identifier. - * @param callback The callback - */ - getExtractedKeys(id: string, callback: msRest.ServiceCallback): void; - /** - * @param id Model identifier. - * @param options The optional parameters - * @param callback The callback - */ - getExtractedKeys(id: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getExtractedKeys(id: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - id, - options - }, - getExtractedKeysOperationSpec, - callback) as Promise; - } - - /** - * Get information about all trained custom models - * @summary Get Models - * @param [options] The optional parameters - * @returns Promise - */ - getCustomModels(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - getCustomModels(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - getCustomModels(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getCustomModels(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - options - }, - getCustomModelsOperationSpec, - callback) as Promise; - } - - /** - * Get information about a model. - * @summary Get Model - * @param id Model identifier. - * @param [options] The optional parameters - * @returns Promise - */ - getCustomModel(id: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param id Model identifier. - * @param callback The callback - */ - getCustomModel(id: string, callback: msRest.ServiceCallback): void; - /** - * @param id Model identifier. - * @param options The optional parameters - * @param callback The callback - */ - getCustomModel(id: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getCustomModel(id: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - id, - options - }, - getCustomModelOperationSpec, - callback) as Promise; - } - - /** - * Delete model artifacts. - * @summary Delete Model - * @param id The identifier of the model to delete. - * @param [options] The optional parameters - * @returns Promise - */ - deleteCustomModel(id: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param id The identifier of the model to delete. - * @param callback The callback - */ - deleteCustomModel(id: string, callback: msRest.ServiceCallback): void; - /** - * @param id The identifier of the model to delete. - * @param options The optional parameters - * @param callback The callback - */ - deleteCustomModel(id: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteCustomModel(id: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - id, - options - }, - deleteCustomModelOperationSpec, - callback); - } - - /** - * Extract key-value pairs from a given document. The input document must be of one of the - * supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is - * returned in JSON. - * @summary Analyze Form - * @param id Model Identifier to analyze the document with. - * @param formStream A pdf document or image (jpg,png) file to analyze. - * @param [options] The optional parameters - * @returns Promise - */ - analyzeWithCustomModel(id: string, formStream: msRest.HttpRequestBody, options?: Models.FormRecognizerClientAnalyzeWithCustomModelOptionalParams): Promise; - /** - * @param id Model Identifier to analyze the document with. - * @param formStream A pdf document or image (jpg,png) file to analyze. - * @param callback The callback - */ - analyzeWithCustomModel(id: string, formStream: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; - /** - * @param id Model Identifier to analyze the document with. - * @param formStream A pdf document or image (jpg,png) file to analyze. - * @param options The optional parameters - * @param callback The callback - */ - analyzeWithCustomModel(id: string, formStream: msRest.HttpRequestBody, options: Models.FormRecognizerClientAnalyzeWithCustomModelOptionalParams, callback: msRest.ServiceCallback): void; - analyzeWithCustomModel(id: string, formStream: msRest.HttpRequestBody, options?: Models.FormRecognizerClientAnalyzeWithCustomModelOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - id, - formStream, - options - }, - analyzeWithCustomModelOperationSpec, - callback) as Promise; - } - - /** - * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which - * contains the URL that you must use for your 'Get Read Receipt Result' operation. - * @param url Publicly reachable URL of an image. - * @param [options] The optional parameters - * @returns Promise - */ - batchReadReceipt(url: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param url Publicly reachable URL of an image. - * @param callback The callback - */ - batchReadReceipt(url: string, callback: msRest.ServiceCallback): void; - /** - * @param url Publicly reachable URL of an image. - * @param options The optional parameters - * @param callback The callback - */ - batchReadReceipt(url: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - batchReadReceipt(url: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - url, - options - }, - batchReadReceiptOperationSpec, - callback) as Promise; - } - - /** - * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The - * URL to this interface should be retrieved from the 'Operation-Location' field returned from the - * 'Batch Read Receipt' operation. - * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' - * operation. - * @param [options] The optional parameters - * @returns Promise - */ - getReadReceiptResult(operationId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' - * operation. - * @param callback The callback - */ - getReadReceiptResult(operationId: string, callback: msRest.ServiceCallback): void; - /** - * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' - * operation. - * @param options The optional parameters - * @param callback The callback - */ - getReadReceiptResult(operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getReadReceiptResult(operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - operationId, - options - }, - getReadReceiptResultOperationSpec, - callback) as Promise; - } - - /** - * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a - * field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must - * use for your 'Get Read Receipt Result' operation. - * @param image An image stream. - * @param [options] The optional parameters - * @returns Promise - */ - batchReadReceiptInStream(image: msRest.HttpRequestBody, options?: msRest.RequestOptionsBase): Promise; - /** - * @param image An image stream. - * @param callback The callback - */ - batchReadReceiptInStream(image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; - /** - * @param image An image stream. - * @param options The optional parameters - * @param callback The callback - */ - batchReadReceiptInStream(image: msRest.HttpRequestBody, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - batchReadReceiptInStream(image: msRest.HttpRequestBody, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - image, - options - }, - batchReadReceiptInStreamOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const trainCustomModelOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "custom/train", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: "trainRequest", - mapper: { - ...Mappers.TrainRequest, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.TrainResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const getExtractedKeysOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "custom/models/{id}/keys", - urlParameters: [ - Parameters.endpoint, - Parameters.id - ], - responses: { - 200: { - bodyMapper: Mappers.KeysResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const getCustomModelsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "custom/models", - urlParameters: [ - Parameters.endpoint - ], - responses: { - 200: { - bodyMapper: Mappers.ModelsResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const getCustomModelOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "custom/models/{id}", - urlParameters: [ - Parameters.endpoint, - Parameters.id - ], - responses: { - 200: { - bodyMapper: Mappers.ModelResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const deleteCustomModelOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "custom/models/{id}", - urlParameters: [ - Parameters.endpoint, - Parameters.id - ], - responses: { - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const analyzeWithCustomModelOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "custom/models/{id}/analyze", - urlParameters: [ - Parameters.endpoint, - Parameters.id - ], - queryParameters: [ - Parameters.keys - ], - formDataParameters: [ - Parameters.formStream - ], - contentType: "multipart/form-data", - responses: { - 200: { - bodyMapper: Mappers.AnalyzeResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const batchReadReceiptOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "prebuilt/receipt/asyncBatchAnalyze", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: { - url: "url" - }, - mapper: { - ...Mappers.ImageUrl, - required: true - } - }, - responses: { - 202: { - headersMapper: Mappers.BatchReadReceiptHeaders - }, - default: { - bodyMapper: Mappers.ComputerVisionError - } - }, - serializer -}; - -const getReadReceiptResultOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "prebuilt/receipt/operations/{operationId}", - urlParameters: [ - Parameters.endpoint, - Parameters.operationId - ], - responses: { - 200: { - bodyMapper: Mappers.ReadReceiptResult - }, - default: { - bodyMapper: Mappers.ComputerVisionError - } - }, - serializer -}; - -const batchReadReceiptInStreamOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "prebuilt/receipt/asyncBatchAnalyze", - urlParameters: [ - Parameters.endpoint - ], - requestBody: { - parameterPath: "image", - mapper: { - required: true, - serializedName: "Image", - type: { - name: "Stream" - } - } - }, - contentType: "application/octet-stream", - responses: { - 202: { - headersMapper: Mappers.BatchReadReceiptInStreamHeaders - }, - default: { - bodyMapper: Mappers.ComputerVisionError - } - }, - serializer -}; - -export { - FormRecognizerClient, - FormRecognizerClientContext, - Models as FormRecognizerModels, - Mappers as FormRecognizerMappers -}; diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/formRecognizerClientContext.ts b/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/formRecognizerClientContext.ts deleted file mode 100644 index 2db9cb247b44..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/formRecognizerClientContext.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-formrecognizer"; -const packageVersion = "2.0.1"; - -export class FormRecognizerClientContext extends msRest.ServiceClient { - endpoint: string; - credentials: msRest.ServiceClientCredentials; - - /** - * Initializes a new instance of the FormRecognizerClientContext class. - * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus2.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}/formrecognizer/v1.0-preview"; - this.requestContentType = "application/json; charset=utf-8"; - this.endpoint = endpoint; - this.credentials = credentials; - } -} diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/index.ts b/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/index.ts deleted file mode 100644 index 75e281d53d1e..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/index.ts +++ /dev/null @@ -1,712 +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"; - -/** - * Filters to be applied when traversing a data source. - */ -export interface TrainSourceFilter { - /** - * A case-sensitive prefix string to filter content - * under the source location. For e.g., when using a Azure Blob - * Uri use the prefix to restrict subfolders for content. - */ - prefix?: string; - /** - * A flag to indicate if sub folders within the set of - * prefix folders will also need to be included when searching - * for content to be preprocessed. - */ - includeSubFolders?: boolean; -} - -/** - * Contract to initiate a train request. - */ -export interface TrainRequest { - /** - * Get or set source path. - */ - source: string; - /** - * Get or set filter to further search the - * source path for content. - */ - sourceFilter?: TrainSourceFilter; -} - -/** - * An interface representing FormDocumentReport. - */ -export interface FormDocumentReport { - /** - * Reference to the data that the report is for. - */ - documentName?: string; - /** - * Total number of pages trained on. - */ - pages?: number; - /** - * List of errors per page. - */ - errors?: string[]; - /** - * Status of the training operation. Possible values include: 'success', 'partialSuccess', - * 'failure' - */ - status?: Status; -} - -/** - * Error reported during an operation. - */ -export interface FormOperationError { - /** - * Message reported during the train operation. - */ - errorMessage?: string; -} - -/** - * Response of the Train API call. - */ -export interface TrainResult { - /** - * Identifier of the model. - */ - modelId?: string; - /** - * List of documents used to train the model and the - * train operation error reported by each. - */ - trainingDocuments?: FormDocumentReport[]; - /** - * Errors returned during the training operation. - */ - errors?: FormOperationError[]; -} - -/** - * Result of an operation to get - * the keys extracted by a model. - */ -export interface KeysResult { - /** - * Object mapping ClusterIds to Key lists. - */ - clusters?: { [propertyName: string]: string[] }; -} - -/** - * Result of a model status query operation. - */ -export interface ModelResult { - /** - * Get or set model identifier. - */ - modelId?: string; - /** - * Get or set the status of model. Possible values include: 'created', 'ready', 'invalid' - */ - status?: Status1; - /** - * Get or set the created date time of the model. - */ - createdDateTime?: Date; - /** - * Get or set the model last updated datetime. - */ - lastUpdatedDateTime?: Date; -} - -/** - * Result of query operation to fetch multiple models. - */ -export interface ModelsResult { - /** - * Collection of models. - */ - modelsProperty?: ModelResult[]; -} - -/** - * An interface representing InnerError. - */ -export interface InnerError { - requestId?: string; -} - -/** - * An interface representing ErrorInformation. - */ -export interface ErrorInformation { - code?: string; - innerError?: InnerError; - message?: string; -} - -/** - * An interface representing ErrorResponse. - */ -export interface ErrorResponse { - error?: ErrorInformation; -} - -/** - * Canonical representation of single extracted text. - */ -export interface ExtractedToken { - /** - * String value of the extracted text. - */ - text?: string; - /** - * Bounding box of the extracted text. Represents the - * location of the extracted text as a pair of - * cartesian co-ordinates. The co-ordinate pairs are arranged by - * top-left, top-right, bottom-right and bottom-left endpoints box - * with origin reference from the bottom-left of the page. - */ - boundingBox?: number[]; - /** - * A measure of accuracy of the extracted text. - */ - confidence?: number; -} - -/** - * Representation of a key-value pair as a list - * of key and value tokens. - */ -export interface ExtractedKeyValuePair { - /** - * List of tokens for the extracted key in a key-value pair. - */ - key?: ExtractedToken[]; - /** - * List of tokens for the extracted value in a key-value pair. - */ - value?: ExtractedToken[]; -} - -/** - * Extraction information of a column in - * a table. - */ -export interface ExtractedTableColumn { - /** - * List of extracted tokens for the column header. - */ - header?: ExtractedToken[]; - /** - * Extracted text for each cell of a column. Each cell - * in the column can have a list of one or more tokens. - */ - entries?: ExtractedToken[][]; -} - -/** - * Extraction information about a table - * contained in a page. - */ -export interface ExtractedTable { - /** - * Table identifier. - */ - id?: string; - /** - * List of columns contained in the table. - */ - columns?: ExtractedTableColumn[]; -} - -/** - * Extraction information of a single page in a - * with a document. - */ -export interface ExtractedPage { - /** - * Page number. - */ - number?: number; - /** - * Height of the page (in pixels). - */ - height?: number; - /** - * Width of the page (in pixels). - */ - width?: number; - /** - * Cluster identifier. - */ - clusterId?: number; - /** - * List of Key-Value pairs extracted from the page. - */ - keyValuePairs?: ExtractedKeyValuePair[]; - /** - * List of Tables and their information extracted from the page. - */ - tables?: ExtractedTable[]; -} - -/** - * Analyze API call result. - */ -export interface AnalyzeResult { - /** - * Status of the analyze operation. Possible values include: 'success', 'partialSuccess', - * 'failure' - */ - status?: Status2; - /** - * Page level information extracted in the analyzed - * document. - */ - pages?: ExtractedPage[]; - /** - * List of errors reported during the analyze - * operation. - */ - errors?: FormOperationError[]; -} - -/** - * An object representing a recognized word. - */ -export interface Word { - /** - * Bounding box of a recognized word. - */ - boundingBox: number[]; - /** - * The text content of the word. - */ - text: string; - /** - * Qualitative confidence measure. Possible values include: 'High', 'Low' - */ - confidence?: TextRecognitionResultConfidenceClass; -} - -/** - * An object representing a recognized text line. - */ -export interface Line { - /** - * Bounding box of a recognized line. - */ - boundingBox?: number[]; - /** - * The text content of the line. - */ - text?: string; - /** - * List of words in the text line. - */ - words?: Word[]; -} - -/** - * An object representing a recognized text region - */ -export interface TextRecognitionResult { - /** - * The 1-based page number of the recognition result. - */ - page?: number; - /** - * The orientation of the image in degrees in the clockwise direction. Range between [0, 360). - */ - clockwiseOrientation?: number; - /** - * The width of the image in pixels or the PDF in inches. - */ - width?: number; - /** - * The height of the image in pixels or the PDF in inches. - */ - height?: number; - /** - * The unit used in the Width, Height and BoundingBox. For images, the unit is 'pixel'. For PDF, - * the unit is 'inch'. Possible values include: 'pixel', 'inch' - */ - unit?: TextRecognitionResultDimensionUnit; - /** - * A list of recognized text lines. - */ - lines: Line[]; -} - -/** - * Reference to an OCR word. - */ -export interface ElementReference { - ref?: string; -} - -/** - * Contains the possible cases for FieldValue. - */ -export type FieldValueUnion = FieldValue | StringValue | NumberValue; - -/** - * Base class representing a recognized field value. - */ -export interface FieldValue { - /** - * Polymorphic Discriminator - */ - valueType: "fieldValue"; - /** - * OCR text content of the recognized field. - */ - text?: string; - /** - * List of references to OCR words comprising the recognized field value. - */ - elements?: ElementReference[]; -} - -/** - * A set of extracted fields corresponding to a semantic object, such as a receipt, in the input - * document. - */ -export interface UnderstandingResult { - /** - * List of pages where the document is found. - */ - pages?: number[]; - /** - * Dictionary of recognized field values. - */ - fields?: { [propertyName: string]: FieldValueUnion }; -} - -/** - * Analysis result of the 'Batch Read Receipt' operation. - */ -export interface ReadReceiptResult { - /** - * Status of the read operation. Possible values include: 'Not Started', 'Running', 'Failed', - * 'Succeeded' - */ - status?: TextOperationStatusCodes; - /** - * Text recognition result of the 'Batch Read Receipt' operation. - */ - recognitionResults?: TextRecognitionResult[]; - /** - * Semantic understanding result of the 'Batch Read Receipt' operation. - */ - understandingResults?: UnderstandingResult[]; -} - -/** - * Recognized string field value. - */ -export interface StringValue { - /** - * Polymorphic Discriminator - */ - valueType: "stringValue"; - /** - * OCR text content of the recognized field. - */ - text?: string; - /** - * List of references to OCR words comprising the recognized field value. - */ - elements?: ElementReference[]; - /** - * String value of the recognized field. - */ - value?: string; -} - -/** - * Recognized numeric field value. - */ -export interface NumberValue { - /** - * Polymorphic Discriminator - */ - valueType: "numberValue"; - /** - * OCR text content of the recognized field. - */ - text?: string; - /** - * List of references to OCR words comprising the recognized field value. - */ - elements?: ElementReference[]; - /** - * Numeric value of the recognized field. - */ - value?: number; -} - -/** - * Details about the API request error. - */ -export interface ComputerVisionError { - /** - * The error code. - */ - code: any; - /** - * A message explaining the error reported by the service. - */ - message: string; - /** - * A unique request identifier. - */ - requestId?: string; -} - -/** - * An interface representing ImageUrl. - */ -export interface ImageUrl { - /** - * Publicly reachable URL of an image. - */ - url: string; -} - -/** - * Optional Parameters. - */ -export interface FormRecognizerClientAnalyzeWithCustomModelOptionalParams extends msRest.RequestOptionsBase { - /** - * An optional list of known keys to extract the values for. - */ - keys?: string[]; -} - -/** - * Defines headers for BatchReadReceipt operation. - */ -export interface BatchReadReceiptHeaders { - /** - * URL to query for status of the operation. The URL will expire in 48 hours. - */ - operationLocation: string; -} - -/** - * Defines headers for BatchReadReceiptInStream operation. - */ -export interface BatchReadReceiptInStreamHeaders { - /** - * URL to query for status of the operation. The URL will expire in 48 hours. - */ - operationLocation: string; -} - -/** - * Defines values for TextOperationStatusCodes. - * Possible values include: 'Not Started', 'Running', 'Failed', 'Succeeded' - * @readonly - * @enum {string} - */ -export type TextOperationStatusCodes = 'Not Started' | 'Running' | 'Failed' | 'Succeeded'; - -/** - * Defines values for TextRecognitionResultDimensionUnit. - * Possible values include: 'pixel', 'inch' - * @readonly - * @enum {string} - */ -export type TextRecognitionResultDimensionUnit = 'pixel' | 'inch'; - -/** - * Defines values for TextRecognitionResultConfidenceClass. - * Possible values include: 'High', 'Low' - * @readonly - * @enum {string} - */ -export type TextRecognitionResultConfidenceClass = 'High' | 'Low'; - -/** - * Defines values for Status. - * Possible values include: 'success', 'partialSuccess', 'failure' - * @readonly - * @enum {string} - */ -export type Status = 'success' | 'partialSuccess' | 'failure'; - -/** - * Defines values for Status1. - * Possible values include: 'created', 'ready', 'invalid' - * @readonly - * @enum {string} - */ -export type Status1 = 'created' | 'ready' | 'invalid'; - -/** - * Defines values for Status2. - * Possible values include: 'success', 'partialSuccess', 'failure' - * @readonly - * @enum {string} - */ -export type Status2 = 'success' | 'partialSuccess' | 'failure'; - -/** - * Contains response data for the trainCustomModel operation. - */ -export type TrainCustomModelResponse = TrainResult & { - /** - * 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: TrainResult; - }; -}; - -/** - * Contains response data for the getExtractedKeys operation. - */ -export type GetExtractedKeysResponse = KeysResult & { - /** - * 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: KeysResult; - }; -}; - -/** - * Contains response data for the getCustomModels operation. - */ -export type GetCustomModelsResponse = ModelsResult & { - /** - * 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: ModelsResult; - }; -}; - -/** - * Contains response data for the getCustomModel operation. - */ -export type GetCustomModelResponse = ModelResult & { - /** - * 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: ModelResult; - }; -}; - -/** - * Contains response data for the analyzeWithCustomModel operation. - */ -export type AnalyzeWithCustomModelResponse = AnalyzeResult & { - /** - * 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: AnalyzeResult; - }; -}; - -/** - * Contains response data for the batchReadReceipt operation. - */ -export type BatchReadReceiptResponse = BatchReadReceiptHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: BatchReadReceiptHeaders; - }; -}; - -/** - * Contains response data for the getReadReceiptResult operation. - */ -export type GetReadReceiptResultResponse = ReadReceiptResult & { - /** - * 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: ReadReceiptResult; - }; -}; - -/** - * Contains response data for the batchReadReceiptInStream operation. - */ -export type BatchReadReceiptInStreamResponse = BatchReadReceiptInStreamHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: BatchReadReceiptInStreamHeaders; - }; -}; diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/mappers.ts b/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/mappers.ts deleted file mode 100644 index 55e19dbf3760..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/mappers.ts +++ /dev/null @@ -1,934 +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"; - - -export const TrainSourceFilter: msRest.CompositeMapper = { - serializedName: "TrainSourceFilter", - type: { - name: "Composite", - className: "TrainSourceFilter", - modelProperties: { - prefix: { - serializedName: "prefix", - constraints: { - MaxLength: 128, - MinLength: 0 - }, - type: { - name: "String" - } - }, - includeSubFolders: { - serializedName: "includeSubFolders", - type: { - name: "Boolean" - } - } - } - } -}; - -export const TrainRequest: msRest.CompositeMapper = { - serializedName: "TrainRequest", - type: { - name: "Composite", - className: "TrainRequest", - modelProperties: { - source: { - required: true, - serializedName: "source", - constraints: { - MaxLength: 2048, - MinLength: 0 - }, - type: { - name: "String" - } - }, - sourceFilter: { - serializedName: "sourceFilter", - type: { - name: "Composite", - className: "TrainSourceFilter" - } - } - } - } -}; - -export const FormDocumentReport: msRest.CompositeMapper = { - serializedName: "FormDocumentReport", - type: { - name: "Composite", - className: "FormDocumentReport", - modelProperties: { - documentName: { - serializedName: "documentName", - type: { - name: "String" - } - }, - pages: { - serializedName: "pages", - type: { - name: "Number" - } - }, - errors: { - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - } - } - } -}; - -export const FormOperationError: msRest.CompositeMapper = { - serializedName: "FormOperationError", - type: { - name: "Composite", - className: "FormOperationError", - modelProperties: { - errorMessage: { - serializedName: "errorMessage", - type: { - name: "String" - } - } - } - } -}; - -export const TrainResult: msRest.CompositeMapper = { - serializedName: "TrainResult", - type: { - name: "Composite", - className: "TrainResult", - modelProperties: { - modelId: { - nullable: false, - serializedName: "modelId", - type: { - name: "Uuid" - } - }, - trainingDocuments: { - serializedName: "trainingDocuments", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FormDocumentReport" - } - } - } - }, - errors: { - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FormOperationError" - } - } - } - } - } - } -}; - -export const KeysResult: msRest.CompositeMapper = { - serializedName: "KeysResult", - type: { - name: "Composite", - className: "KeysResult", - modelProperties: { - clusters: { - serializedName: "clusters", - type: { - name: "Dictionary", - value: { - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } - } - } -}; - -export const ModelResult: msRest.CompositeMapper = { - serializedName: "ModelResult", - type: { - name: "Composite", - className: "ModelResult", - modelProperties: { - modelId: { - nullable: false, - serializedName: "modelId", - type: { - name: "Uuid" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - createdDateTime: { - serializedName: "createdDateTime", - type: { - name: "DateTime" - } - }, - lastUpdatedDateTime: { - serializedName: "lastUpdatedDateTime", - type: { - name: "DateTime" - } - } - } - } -}; - -export const ModelsResult: msRest.CompositeMapper = { - serializedName: "ModelsResult", - type: { - name: "Composite", - className: "ModelsResult", - modelProperties: { - modelsProperty: { - serializedName: "models", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ModelResult" - } - } - } - } - } - } -}; - -export const InnerError: msRest.CompositeMapper = { - serializedName: "InnerError", - type: { - name: "Composite", - className: "InnerError", - modelProperties: { - requestId: { - serializedName: "requestId", - type: { - name: "String" - } - } - } - } -}; - -export const ErrorInformation: msRest.CompositeMapper = { - serializedName: "ErrorInformation", - type: { - name: "Composite", - className: "ErrorInformation", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - innerError: { - serializedName: "innerError", - type: { - name: "Composite", - className: "InnerError" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorInformation" - } - } - } - } -}; - -export const ExtractedToken: msRest.CompositeMapper = { - serializedName: "ExtractedToken", - type: { - name: "Composite", - className: "ExtractedToken", - modelProperties: { - text: { - serializedName: "text", - type: { - name: "String" - } - }, - boundingBox: { - serializedName: "boundingBox", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, - confidence: { - serializedName: "confidence", - type: { - name: "Number" - } - } - } - } -}; - -export const ExtractedKeyValuePair: msRest.CompositeMapper = { - serializedName: "ExtractedKeyValuePair", - type: { - name: "Composite", - className: "ExtractedKeyValuePair", - modelProperties: { - key: { - serializedName: "key", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExtractedToken" - } - } - } - }, - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExtractedToken" - } - } - } - } - } - } -}; - -export const ExtractedTableColumn: msRest.CompositeMapper = { - serializedName: "ExtractedTableColumn", - type: { - name: "Composite", - className: "ExtractedTableColumn", - modelProperties: { - header: { - serializedName: "header", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExtractedToken" - } - } - } - }, - entries: { - serializedName: "entries", - type: { - name: "Sequence", - element: { - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExtractedToken" - } - } - } - } - } - } - } - } -}; - -export const ExtractedTable: msRest.CompositeMapper = { - serializedName: "ExtractedTable", - type: { - name: "Composite", - className: "ExtractedTable", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - columns: { - serializedName: "columns", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExtractedTableColumn" - } - } - } - } - } - } -}; - -export const ExtractedPage: msRest.CompositeMapper = { - serializedName: "ExtractedPage", - type: { - name: "Composite", - className: "ExtractedPage", - modelProperties: { - number: { - serializedName: "number", - type: { - name: "Number" - } - }, - height: { - serializedName: "height", - type: { - name: "Number" - } - }, - width: { - serializedName: "width", - type: { - name: "Number" - } - }, - clusterId: { - serializedName: "clusterId", - type: { - name: "Number" - } - }, - keyValuePairs: { - serializedName: "keyValuePairs", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExtractedKeyValuePair" - } - } - } - }, - tables: { - serializedName: "tables", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExtractedTable" - } - } - } - } - } - } -}; - -export const AnalyzeResult: msRest.CompositeMapper = { - serializedName: "AnalyzeResult", - type: { - name: "Composite", - className: "AnalyzeResult", - modelProperties: { - status: { - serializedName: "status", - type: { - name: "String" - } - }, - pages: { - serializedName: "pages", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExtractedPage" - } - } - } - }, - errors: { - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FormOperationError" - } - } - } - } - } - } -}; - -export const Word: msRest.CompositeMapper = { - serializedName: "Word", - type: { - name: "Composite", - className: "Word", - modelProperties: { - boundingBox: { - required: true, - serializedName: "boundingBox", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, - text: { - required: true, - serializedName: "text", - type: { - name: "String" - } - }, - confidence: { - nullable: true, - serializedName: "confidence", - type: { - name: "Enum", - allowedValues: [ - "High", - "Low" - ] - } - } - } - } -}; - -export const Line: msRest.CompositeMapper = { - serializedName: "Line", - type: { - name: "Composite", - className: "Line", - modelProperties: { - boundingBox: { - serializedName: "boundingBox", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, - text: { - serializedName: "text", - type: { - name: "String" - } - }, - words: { - serializedName: "words", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Word" - } - } - } - } - } - } -}; - -export const TextRecognitionResult: msRest.CompositeMapper = { - serializedName: "TextRecognitionResult", - type: { - name: "Composite", - className: "TextRecognitionResult", - modelProperties: { - page: { - serializedName: "page", - type: { - name: "Number" - } - }, - clockwiseOrientation: { - serializedName: "clockwiseOrientation", - type: { - name: "Number" - } - }, - width: { - serializedName: "width", - type: { - name: "Number" - } - }, - height: { - serializedName: "height", - type: { - name: "Number" - } - }, - unit: { - nullable: true, - serializedName: "unit", - type: { - name: "Enum", - allowedValues: [ - "pixel", - "inch" - ] - } - }, - lines: { - required: true, - serializedName: "lines", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Line" - } - } - } - } - } - } -}; - -export const ElementReference: msRest.CompositeMapper = { - serializedName: "elementReference", - type: { - name: "Composite", - className: "ElementReference", - modelProperties: { - ref: { - serializedName: "$ref", - type: { - name: "String" - } - } - } - } -}; - -export const FieldValue: msRest.CompositeMapper = { - serializedName: "fieldValue", - type: { - name: "Composite", - polymorphicDiscriminator: { - serializedName: "valueType", - clientName: "valueType" - }, - uberParent: "FieldValue", - className: "FieldValue", - modelProperties: { - text: { - serializedName: "text", - type: { - name: "String" - } - }, - elements: { - serializedName: "elements", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ElementReference" - } - } - } - }, - valueType: { - required: true, - serializedName: "valueType", - type: { - name: "String" - } - } - } - } -}; - -export const UnderstandingResult: msRest.CompositeMapper = { - serializedName: "understandingResult", - type: { - name: "Composite", - className: "UnderstandingResult", - modelProperties: { - pages: { - serializedName: "pages", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, - fields: { - serializedName: "fields", - type: { - name: "Dictionary", - value: { - type: { - name: "Composite", - className: "FieldValue" - } - } - } - } - } - } -}; - -export const ReadReceiptResult: msRest.CompositeMapper = { - serializedName: "readReceiptResult", - type: { - name: "Composite", - className: "ReadReceiptResult", - modelProperties: { - status: { - nullable: false, - serializedName: "status", - type: { - name: "Enum", - allowedValues: [ - "Not Started", - "Running", - "Failed", - "Succeeded" - ] - } - }, - recognitionResults: { - serializedName: "recognitionResults", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "TextRecognitionResult" - } - } - } - }, - understandingResults: { - serializedName: "understandingResults", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "UnderstandingResult" - } - } - } - } - } - } -}; - -export const StringValue: msRest.CompositeMapper = { - serializedName: "stringValue", - type: { - name: "Composite", - polymorphicDiscriminator: FieldValue.type.polymorphicDiscriminator, - uberParent: "FieldValue", - className: "StringValue", - modelProperties: { - ...FieldValue.type.modelProperties, - value: { - serializedName: "value", - type: { - name: "String" - } - } - } - } -}; - -export const NumberValue: msRest.CompositeMapper = { - serializedName: "numberValue", - type: { - name: "Composite", - polymorphicDiscriminator: FieldValue.type.polymorphicDiscriminator, - uberParent: "FieldValue", - className: "NumberValue", - modelProperties: { - ...FieldValue.type.modelProperties, - value: { - serializedName: "value", - type: { - name: "Number" - } - } - } - } -}; - -export const ComputerVisionError: msRest.CompositeMapper = { - serializedName: "ComputerVisionError", - type: { - name: "Composite", - className: "ComputerVisionError", - modelProperties: { - code: { - required: true, - serializedName: "code", - type: { - name: "Object" - } - }, - message: { - required: true, - serializedName: "message", - type: { - name: "String" - } - }, - requestId: { - serializedName: "requestId", - type: { - name: "String" - } - } - } - } -}; - -export const ImageUrl: msRest.CompositeMapper = { - serializedName: "ImageUrl", - type: { - name: "Composite", - className: "ImageUrl", - modelProperties: { - url: { - required: true, - serializedName: "url", - type: { - name: "String" - } - } - } - } -}; - -export const BatchReadReceiptHeaders: msRest.CompositeMapper = { - serializedName: "batchreadreceipt-headers", - type: { - name: "Composite", - className: "BatchReadReceiptHeaders", - modelProperties: { - operationLocation: { - serializedName: "operation-location", - type: { - name: "String" - } - } - } - } -}; - -export const BatchReadReceiptInStreamHeaders: msRest.CompositeMapper = { - serializedName: "batchreadreceiptinstream-headers", - type: { - name: "Composite", - className: "BatchReadReceiptInStreamHeaders", - modelProperties: { - operationLocation: { - serializedName: "operation-location", - type: { - name: "String" - } - } - } - } -}; - -export const discriminators = { - 'fieldValue' : FieldValue, - 'FieldValue.stringValue' : StringValue, - 'FieldValue.numberValue' : NumberValue - -}; diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/parameters.ts b/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/parameters.ts deleted file mode 100644 index 52c94df0e6a5..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/src/models/parameters.ts +++ /dev/null @@ -1,72 +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"; - -export const endpoint: msRest.OperationURLParameter = { - parameterPath: "endpoint", - mapper: { - required: true, - serializedName: "Endpoint", - defaultValue: '', - type: { - name: "String" - } - }, - skipEncoding: true -}; -export const formStream: msRest.OperationParameter = { - parameterPath: "formStream", - mapper: { - required: true, - serializedName: "form_stream", - type: { - name: "Stream" - } - } -}; -export const id: msRest.OperationURLParameter = { - parameterPath: "id", - mapper: { - required: true, - serializedName: "id", - type: { - name: "Uuid" - } - } -}; -export const keys: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "keys" - ], - mapper: { - serializedName: "keys", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - collectionFormat: msRest.QueryCollectionFormat.Csv -}; -export const operationId: msRest.OperationURLParameter = { - parameterPath: "operationId", - mapper: { - required: true, - serializedName: "operationId", - type: { - name: "String" - } - } -}; diff --git a/sdk/cognitiveservices/cognitiveservices-formrecognizer/tsconfig.json b/sdk/cognitiveservices/cognitiveservices-formrecognizer/tsconfig.json deleted file mode 100644 index 422b584abd5e..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-formrecognizer/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "es6", - "moduleResolution": "node", - "strict": true, - "target": "es5", - "sourceMap": true, - "declarationMap": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], - "declaration": true, - "outDir": "./esm", - "importHelpers": true - }, - "include": ["./src/**/*.ts"], - "exclude": ["node_modules"] -} diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/LICENSE.txt b/sdk/cognitiveservices/cognitiveservices-textanalytics/LICENSE.txt deleted file mode 100644 index b73b4a1293c3..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 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. diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/README.md b/sdk/cognitiveservices/cognitiveservices-textanalytics/README.md deleted file mode 100644 index 706b027271ec..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/README.md +++ /dev/null @@ -1,165 +0,0 @@ -## An isomorphic javascript sdk for - TextAnalyticsClient - -This package contains an isomorphic SDK for TextAnalyticsClient. - -> Please note, a newer package [@azure/ai-text-analytics](https://www.npmjs.com/package/@azure/ai-text-analytics) is available as of June, 2020 that uses Text Analytics API v3.0 or above. While this package will continue to receive critical bug fixes, it uses Text Analytics API v2.1, and we strongly encourage you to upgrade. - -### Currently supported environments - -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- Latest versions of Safari, Chrome, Edge, and Firefox. - -See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. - -### How to Install - -```bash -npm install @azure/cognitiveservices-textanalytics -``` - -### How to use - -#### nodejs - Authentication, client creation and detectLanguage as an example written in TypeScript. - -##### Install @azure/ms-rest-azure-js - -```bash -npm install @azure/ms-rest-azure-js -``` - -##### Sample code -The following sample detects the langauge in the provided text. In addition, it provides data such as Characters count, transaction count, etc. To know more, refer to the [Azure Documentation on Text Analytics](https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview) - -```javascript -const { TextAnalyticsClient } = require("@azure/cognitiveservices-textanalytics"); -const { CognitiveServicesCredentials } = require("@azure/ms-rest-azure-js"); - -async function main() { - const textAnalyticsKey = - process.env["textAnalyticsKey"] || ""; - const textAnalyticsEndPoint = - process.env["textAnalyticsEndPoint"] || ""; - const cognitiveServiceCredentials = new CognitiveServicesCredentials( - textAnalyticsKey - ); - const client = new TextAnalyticsClient( - cognitiveServiceCredentials, - textAnalyticsEndPoint - ); - const options = { - showStats: true, - languageBatchInput: { - documents: [ - { - id: "1", - text: "Sample Text" - }, - { - id: "2", - text: "Texto de ejemplo" - } - ] - } - }; - client - .detectLanguage(options) - .then(result => { - console.log("The result is:"); - result.documents.forEach(document => { - console.log(`Id: ${document.id}`); - console.log("Detected Languages:"); - document.detectedLanguages.forEach(dl => { - console.log(dl.name); - }); - console.log( - `Characters Count: ${document.statistics.charactersCount}` - ); - console.log( - `Transactions Count: ${document.statistics.transactionsCount}` - ); - }); - }) - .catch(err => { - console.log("An error occurred:"); - console.error(err); - }); -} - -main(); - -``` - -#### browser - Authentication, client creation and detectLanguage as an example written in JavaScript. - -##### Sample code - -- index.html -```html - - - - @azure/cognitiveservices-textanalytics sample - - - - - - -``` - -## Related projects - -- [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-textanalytics%2FREADME.png) diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/package.json b/sdk/cognitiveservices/cognitiveservices-textanalytics/package.json deleted file mode 100644 index 60835635f5e0..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@azure/cognitiveservices-textanalytics", - "author": "Microsoft Corporation", - "description": "TextAnalyticsClient Library with typescript type definitions for node.js and browser.", - "version": "4.0.0", - "dependencies": { - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "license": "MIT", - "main": "./dist/cognitiveservices-textanalytics.js", - "module": "./esm/textAnalyticsClient.js", - "types": "./esm/textAnalyticsClient.d.ts", - "devDependencies": { - "typescript": "^3.5.3", - "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-textanalytics", - "repository": { - "type": "git", - "url": "https://github.com/Azure/azure-sdk-for-js.git" - }, - "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", - "src/**/*.ts", - "README.md", - "rollup.config.js", - "tsconfig.json" - ], - "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-textanalytics.js.map'\" -o ./dist/cognitiveservices-textanalytics.min.js ./dist/cognitiveservices-textanalytics.js", - "prepack": "npm install && npm run build" - }, - "sideEffects": false, - "autoPublish": true -} diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/rollup.config.js b/sdk/cognitiveservices/cognitiveservices-textanalytics/rollup.config.js deleted file mode 100644 index 5f99399d86ae..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/rollup.config.js +++ /dev/null @@ -1,37 +0,0 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/textAnalyticsClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/cognitiveservices-textanalytics.js", - format: "umd", - name: "Azure.CognitiveservicesTextanalytics", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@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. - * - * 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() - ] -}; - -export default config; diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/index.ts b/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/index.ts deleted file mode 100644 index 3a71da695d0b..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/index.ts +++ /dev/null @@ -1,522 +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"; - -/** - * An interface representing MultiLanguageInput. - */ -export interface MultiLanguageInput { - /** - * This is the 2 letter ISO 639-1 representation of a language. For example, use "en" for - * English; "es" for Spanish etc., - */ - language?: string; - /** - * Unique, non-empty document identifier. - */ - id?: string; - text?: string; -} - -/** - * An interface representing MultiLanguageBatchInput. - */ -export interface MultiLanguageBatchInput { - documents?: MultiLanguageInput[]; -} - -/** - * An interface representing MatchRecord. - */ -export interface MatchRecord { - /** - * (optional) If a well-known item with Wikipedia link is recognized, a decimal number denoting - * the confidence level of the Wikipedia info will be returned. - */ - wikipediaScore?: number; - /** - * (optional) If an entity type is recognized, a decimal number denoting the confidence level of - * the entity type will be returned. - */ - entityTypeScore?: number; - /** - * Entity text as appears in the request. - */ - text?: string; - /** - * Start position (in Unicode characters) for the entity match text. - */ - offset?: number; - /** - * Length (in Unicode characters) for the entity match text. - */ - length?: number; -} - -/** - * An interface representing EntityRecord. - */ -export interface EntityRecord { - /** - * Entity formal name. - */ - name?: string; - /** - * List of instances this entity appears in the text. - */ - matches?: MatchRecord[]; - /** - * Wikipedia language for which the WikipediaId and WikipediaUrl refers to. - */ - wikipediaLanguage?: string; - /** - * Wikipedia unique identifier of the recognized entity. - */ - wikipediaId?: string; - /** - * URL for the entity's Wikipedia page. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly wikipediaUrl?: string; - /** - * Bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity - * Search API to fetch additional relevant information. - */ - bingId?: string; - /** - * Entity type from Named Entity Recognition model - */ - type?: string; - /** - * Entity sub type from Named Entity Recognition model - */ - subType?: string; -} - -/** - * An interface representing DocumentStatistics. - */ -export interface DocumentStatistics { - /** - * Number of text elements recognized in the document. - */ - charactersCount?: number; - /** - * Number of transactions for the document. - */ - transactionsCount?: number; -} - -/** - * An interface representing EntitiesBatchResultItem. - */ -export interface EntitiesBatchResultItem { - /** - * Unique, non-empty document identifier. - */ - id?: string; - /** - * Recognized entities in the document. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly entities?: EntityRecord[]; - /** - * (Optional) if showStats=true was specified in the request this field will contain information - * about the document payload. - */ - statistics?: DocumentStatistics; -} - -/** - * An interface representing ErrorRecord. - */ -export interface ErrorRecord { - /** - * Input document unique identifier the error refers to. - */ - id?: string; - /** - * Error message. - */ - message?: string; -} - -/** - * An interface representing RequestStatistics. - */ -export interface RequestStatistics { - /** - * Number of documents submitted in the request. - */ - documentsCount?: number; - /** - * Number of valid documents. This excludes empty, over-size limit or non-supported languages - * documents. - */ - validDocumentsCount?: number; - /** - * Number of invalid documents. This includes empty, over-size limit or non-supported languages - * documents. - */ - erroneousDocumentsCount?: number; - /** - * Number of transactions for the request. - */ - transactionsCount?: number; -} - -/** - * An interface representing EntitiesBatchResult. - */ -export interface EntitiesBatchResult { - /** - * Response by document - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly documents?: EntitiesBatchResultItem[]; - /** - * Errors and Warnings by document - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly errors?: ErrorRecord[]; - /** - * (Optional) if showStats=true was specified in the request this field will contain information - * about the request payload. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly statistics?: RequestStatistics; -} - -/** - * An interface representing InternalError. - */ -export interface InternalError { - code?: string; - message?: string; - innerError?: InternalError; -} - -/** - * An interface representing ErrorResponse. - */ -export interface ErrorResponse { - code?: string; - message?: string; - target?: string; - innerError?: InternalError; -} - -/** - * An interface representing KeyPhraseBatchResultItem. - */ -export interface KeyPhraseBatchResultItem { - /** - * Unique, non-empty document identifier. - */ - id?: string; - /** - * A list of representative words or phrases. The number of key phrases returned is proportional - * to the number of words in the input document. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly keyPhrases?: string[]; - /** - * (Optional) if showStats=true was specified in the request this field will contain information - * about the document payload. - */ - statistics?: DocumentStatistics; -} - -/** - * An interface representing KeyPhraseBatchResult. - */ -export interface KeyPhraseBatchResult { - /** - * Response by document - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly documents?: KeyPhraseBatchResultItem[]; - /** - * Errors and Warnings by document - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly errors?: ErrorRecord[]; - /** - * =(Optional) if showStats=true was specified in the request this field will contain information - * about the request payload. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly statistics?: RequestStatistics; -} - -/** - * An interface representing LanguageInput. - */ -export interface LanguageInput { - countryHint?: string; - /** - * Unique, non-empty document identifier. - */ - id?: string; - text?: string; -} - -/** - * An interface representing LanguageBatchInput. - */ -export interface LanguageBatchInput { - documents?: LanguageInput[]; -} - -/** - * An interface representing DetectedLanguage. - */ -export interface DetectedLanguage { - /** - * Long name of a detected language (e.g. English, French). - */ - name?: string; - /** - * A two letter representation of the detected language according to the ISO 639-1 standard (e.g. - * en, fr). - */ - iso6391Name?: string; - /** - * A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the - * identified language is true. - */ - score?: number; -} - -/** - * An interface representing LanguageBatchResultItem. - */ -export interface LanguageBatchResultItem { - /** - * Unique, non-empty document identifier. - */ - id?: string; - /** - * A list of extracted languages. - */ - detectedLanguages?: DetectedLanguage[]; - /** - * (Optional) if showStats=true was specified in the request this field will contain information - * about the document payload. - */ - statistics?: DocumentStatistics; -} - -/** - * An interface representing LanguageBatchResult. - */ -export interface LanguageBatchResult { - /** - * Response by document - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly documents?: LanguageBatchResultItem[]; - /** - * Errors and Warnings by document - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly errors?: ErrorRecord[]; - /** - * (Optional) if showStats=true was specified in the request this field will contain information - * about the request payload. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly statistics?: RequestStatistics; -} - -/** - * An interface representing SentimentBatchResultItem. - */ -export interface SentimentBatchResultItem { - /** - * Unique, non-empty document identifier. - */ - id?: string; - /** - * A decimal number between 0 and 1 denoting the sentiment of the document. A score above 0.7 - * usually refers to a positive document while a score below 0.3 normally has a negative - * connotation. Mid values refer to neutral text. - */ - score?: number; - /** - * (Optional) if showStats=true was specified in the request this field will contain information - * about the document payload. - */ - statistics?: DocumentStatistics; -} - -/** - * An interface representing SentimentBatchResult. - */ -export interface SentimentBatchResult { - /** - * Response by document - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly documents?: SentimentBatchResultItem[]; - /** - * Errors and Warnings by document - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly errors?: ErrorRecord[]; - /** - * (Optional) if showStats=true was specified in the request this field will contain information - * about the request payload. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly statistics?: RequestStatistics; -} - -/** - * Optional Parameters. - */ -export interface TextAnalyticsClientDetectLanguageOptionalParams extends msRest.RequestOptionsBase { - /** - * (optional) if set to true, response will contain input and document level statistics. - */ - showStats?: boolean; - /** - * Collection of documents to analyze. - */ - languageBatchInput?: LanguageBatchInput; -} - -/** - * Optional Parameters. - */ -export interface TextAnalyticsClientEntitiesOptionalParams extends msRest.RequestOptionsBase { - /** - * (optional) if set to true, response will contain input and document level statistics. - */ - showStats?: boolean; - /** - * Collection of documents to analyze. - */ - multiLanguageBatchInput?: MultiLanguageBatchInput; -} - -/** - * Optional Parameters. - */ -export interface TextAnalyticsClientKeyPhrasesOptionalParams extends msRest.RequestOptionsBase { - /** - * (optional) if set to true, response will contain input and document level statistics. - */ - showStats?: boolean; - /** - * Collection of documents to analyze. Documents can now contain a language field to indicate the - * text language - */ - multiLanguageBatchInput?: MultiLanguageBatchInput; -} - -/** - * Optional Parameters. - */ -export interface TextAnalyticsClientSentimentOptionalParams extends msRest.RequestOptionsBase { - /** - * (optional) if set to true, response will contain input and document level statistics. - */ - showStats?: boolean; - /** - * Collection of documents to analyze. - */ - multiLanguageBatchInput?: MultiLanguageBatchInput; -} - -/** - * Contains response data for the detectLanguage operation. - */ -export type DetectLanguageResponse = LanguageBatchResult & { - /** - * 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: LanguageBatchResult; - }; -}; - -/** - * Contains response data for the entities operation. - */ -export type EntitiesResponse = EntitiesBatchResult & { - /** - * 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: EntitiesBatchResult; - }; -}; - -/** - * Contains response data for the keyPhrases operation. - */ -export type KeyPhrasesResponse = KeyPhraseBatchResult & { - /** - * 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: KeyPhraseBatchResult; - }; -}; - -/** - * Contains response data for the sentiment operation. - */ -export type SentimentResponse = { - /** - * The parsed response body. - */ - body: any; - - /** - * 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: any; - }; -}; diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/mappers.ts b/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/mappers.ts deleted file mode 100644 index ba8d4976b59f..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/mappers.ts +++ /dev/null @@ -1,696 +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"; - - -export const MultiLanguageInput: msRest.CompositeMapper = { - serializedName: "MultiLanguageInput", - type: { - name: "Composite", - className: "MultiLanguageInput", - modelProperties: { - language: { - serializedName: "language", - type: { - name: "String" - } - }, - id: { - serializedName: "id", - type: { - name: "String" - } - }, - text: { - serializedName: "text", - type: { - name: "String" - } - } - } - } -}; - -export const MultiLanguageBatchInput: msRest.CompositeMapper = { - serializedName: "MultiLanguageBatchInput", - type: { - name: "Composite", - className: "MultiLanguageBatchInput", - modelProperties: { - documents: { - serializedName: "documents", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MultiLanguageInput" - } - } - } - } - } - } -}; - -export const MatchRecord: msRest.CompositeMapper = { - serializedName: "MatchRecord", - type: { - name: "Composite", - className: "MatchRecord", - modelProperties: { - wikipediaScore: { - serializedName: "wikipediaScore", - type: { - name: "Number" - } - }, - entityTypeScore: { - serializedName: "entityTypeScore", - type: { - name: "Number" - } - }, - text: { - serializedName: "text", - type: { - name: "String" - } - }, - offset: { - serializedName: "offset", - type: { - name: "Number" - } - }, - length: { - serializedName: "length", - type: { - name: "Number" - } - } - } - } -}; - -export const EntityRecord: msRest.CompositeMapper = { - serializedName: "EntityRecord", - type: { - name: "Composite", - className: "EntityRecord", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - matches: { - serializedName: "matches", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MatchRecord" - } - } - } - }, - wikipediaLanguage: { - serializedName: "wikipediaLanguage", - type: { - name: "String" - } - }, - wikipediaId: { - serializedName: "wikipediaId", - type: { - name: "String" - } - }, - wikipediaUrl: { - readOnly: true, - serializedName: "wikipediaUrl", - type: { - name: "String" - } - }, - bingId: { - serializedName: "bingId", - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - }, - subType: { - serializedName: "subType", - type: { - name: "String" - } - } - } - } -}; - -export const DocumentStatistics: msRest.CompositeMapper = { - serializedName: "DocumentStatistics", - type: { - name: "Composite", - className: "DocumentStatistics", - modelProperties: { - charactersCount: { - serializedName: "charactersCount", - type: { - name: "Number" - } - }, - transactionsCount: { - serializedName: "transactionsCount", - type: { - name: "Number" - } - } - } - } -}; - -export const EntitiesBatchResultItem: msRest.CompositeMapper = { - serializedName: "EntitiesBatchResultItem", - type: { - name: "Composite", - className: "EntitiesBatchResultItem", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - entities: { - readOnly: true, - serializedName: "entities", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "EntityRecord" - } - } - } - }, - statistics: { - serializedName: "statistics", - type: { - name: "Composite", - className: "DocumentStatistics" - } - } - } - } -}; - -export const ErrorRecord: msRest.CompositeMapper = { - serializedName: "ErrorRecord", - type: { - name: "Composite", - className: "ErrorRecord", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const RequestStatistics: msRest.CompositeMapper = { - serializedName: "RequestStatistics", - type: { - name: "Composite", - className: "RequestStatistics", - modelProperties: { - documentsCount: { - serializedName: "documentsCount", - type: { - name: "Number" - } - }, - validDocumentsCount: { - serializedName: "validDocumentsCount", - type: { - name: "Number" - } - }, - erroneousDocumentsCount: { - serializedName: "erroneousDocumentsCount", - type: { - name: "Number" - } - }, - transactionsCount: { - serializedName: "transactionsCount", - type: { - name: "Number" - } - } - } - } -}; - -export const EntitiesBatchResult: msRest.CompositeMapper = { - serializedName: "EntitiesBatchResult", - type: { - name: "Composite", - className: "EntitiesBatchResult", - modelProperties: { - documents: { - readOnly: true, - serializedName: "documents", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "EntitiesBatchResultItem" - } - } - } - }, - errors: { - readOnly: true, - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorRecord" - } - } - } - }, - statistics: { - readOnly: true, - serializedName: "statistics", - type: { - name: "Composite", - className: "RequestStatistics" - } - } - } - } -}; - -export const InternalError: msRest.CompositeMapper = { - serializedName: "InternalError", - type: { - name: "Composite", - className: "InternalError", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - }, - innerError: { - serializedName: "innerError", - type: { - name: "Composite", - className: "InternalError" - } - } - } - } -}; - -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - }, - target: { - serializedName: "target", - type: { - name: "String" - } - }, - innerError: { - serializedName: "innerError", - type: { - name: "Composite", - className: "InternalError" - } - } - } - } -}; - -export const KeyPhraseBatchResultItem: msRest.CompositeMapper = { - serializedName: "KeyPhraseBatchResultItem", - type: { - name: "Composite", - className: "KeyPhraseBatchResultItem", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - keyPhrases: { - readOnly: true, - serializedName: "keyPhrases", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - statistics: { - serializedName: "statistics", - type: { - name: "Composite", - className: "DocumentStatistics" - } - } - } - } -}; - -export const KeyPhraseBatchResult: msRest.CompositeMapper = { - serializedName: "KeyPhraseBatchResult", - type: { - name: "Composite", - className: "KeyPhraseBatchResult", - modelProperties: { - documents: { - readOnly: true, - serializedName: "documents", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "KeyPhraseBatchResultItem" - } - } - } - }, - errors: { - readOnly: true, - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorRecord" - } - } - } - }, - statistics: { - readOnly: true, - serializedName: "statistics", - type: { - name: "Composite", - className: "RequestStatistics" - } - } - } - } -}; - -export const LanguageInput: msRest.CompositeMapper = { - serializedName: "LanguageInput", - type: { - name: "Composite", - className: "LanguageInput", - modelProperties: { - countryHint: { - serializedName: "countryHint", - type: { - name: "String" - } - }, - id: { - serializedName: "id", - type: { - name: "String" - } - }, - text: { - serializedName: "text", - type: { - name: "String" - } - } - } - } -}; - -export const LanguageBatchInput: msRest.CompositeMapper = { - serializedName: "LanguageBatchInput", - type: { - name: "Composite", - className: "LanguageBatchInput", - modelProperties: { - documents: { - serializedName: "documents", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "LanguageInput" - } - } - } - } - } - } -}; - -export const DetectedLanguage: msRest.CompositeMapper = { - serializedName: "DetectedLanguage", - type: { - name: "Composite", - className: "DetectedLanguage", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - iso6391Name: { - serializedName: "iso6391Name", - type: { - name: "String" - } - }, - score: { - serializedName: "score", - type: { - name: "Number" - } - } - } - } -}; - -export const LanguageBatchResultItem: msRest.CompositeMapper = { - serializedName: "LanguageBatchResultItem", - type: { - name: "Composite", - className: "LanguageBatchResultItem", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - detectedLanguages: { - serializedName: "detectedLanguages", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DetectedLanguage" - } - } - } - }, - statistics: { - serializedName: "statistics", - type: { - name: "Composite", - className: "DocumentStatistics" - } - } - } - } -}; - -export const LanguageBatchResult: msRest.CompositeMapper = { - serializedName: "LanguageBatchResult", - type: { - name: "Composite", - className: "LanguageBatchResult", - modelProperties: { - documents: { - readOnly: true, - serializedName: "documents", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "LanguageBatchResultItem" - } - } - } - }, - errors: { - readOnly: true, - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorRecord" - } - } - } - }, - statistics: { - readOnly: true, - serializedName: "statistics", - type: { - name: "Composite", - className: "RequestStatistics" - } - } - } - } -}; - -export const SentimentBatchResultItem: msRest.CompositeMapper = { - serializedName: "SentimentBatchResultItem", - type: { - name: "Composite", - className: "SentimentBatchResultItem", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - score: { - serializedName: "score", - type: { - name: "Number" - } - }, - statistics: { - serializedName: "statistics", - type: { - name: "Composite", - className: "DocumentStatistics" - } - } - } - } -}; - -export const SentimentBatchResult: msRest.CompositeMapper = { - serializedName: "SentimentBatchResult", - type: { - name: "Composite", - className: "SentimentBatchResult", - modelProperties: { - documents: { - readOnly: true, - serializedName: "documents", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SentimentBatchResultItem" - } - } - } - }, - errors: { - readOnly: true, - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorRecord" - } - } - } - }, - statistics: { - readOnly: true, - serializedName: "statistics", - type: { - name: "Composite", - className: "RequestStatistics" - } - } - } - } -}; diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/parameters.ts b/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/parameters.ts deleted file mode 100644 index 91e0f034e416..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/models/parameters.ts +++ /dev/null @@ -1,36 +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"; - -export const endpoint: msRest.OperationURLParameter = { - parameterPath: "endpoint", - mapper: { - required: true, - serializedName: "Endpoint", - defaultValue: '', - type: { - name: "String" - } - }, - skipEncoding: true -}; -export const showStats: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "showStats" - ], - mapper: { - serializedName: "showStats", - type: { - name: "Boolean" - } - } -}; diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/textAnalyticsClient.ts b/sdk/cognitiveservices/cognitiveservices-textanalytics/src/textAnalyticsClient.ts deleted file mode 100644 index fca998335222..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/textAnalyticsClient.ts +++ /dev/null @@ -1,257 +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"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as Parameters from "./models/parameters"; -import { TextAnalyticsClientContext } from "./textAnalyticsClientContext"; - -class TextAnalyticsClient extends TextAnalyticsClientContext { - /** - * Initializes a new instance of the TextAnalyticsClient 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) { - super(credentials, endpoint, options); - } - - /** - * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 - * languages are supported. - * @summary The API returns the detected language and a numeric score between 0 and 1. - * @param [options] The optional parameters - * @returns Promise - */ - detectLanguage(options?: Models.TextAnalyticsClientDetectLanguageOptionalParams): Promise; - /** - * @param callback The callback - */ - detectLanguage(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - detectLanguage(options: Models.TextAnalyticsClientDetectLanguageOptionalParams, callback: msRest.ServiceCallback): void; - detectLanguage(options?: Models.TextAnalyticsClientDetectLanguageOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - options - }, - detectLanguageOperationSpec, - callback) as Promise; - } - - /** - * To get even more information on each recognized entity we recommend using the Bing Entity Search - * API by querying for the recognized entities names. See the Supported - * languages in Text Analytics API for the list of enabled languages. - * @summary The API returns a list of recognized entities in a given document. - * @param [options] The optional parameters - * @returns Promise - */ - entities(options?: Models.TextAnalyticsClientEntitiesOptionalParams): Promise; - /** - * @param callback The callback - */ - entities(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - entities(options: Models.TextAnalyticsClientEntitiesOptionalParams, callback: msRest.ServiceCallback): void; - entities(options?: Models.TextAnalyticsClientEntitiesOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - options - }, - entitiesOperationSpec, - callback) as Promise; - } - - /** - * See the Text - * Analytics Documentation for details about the languages that are supported by key phrase - * extraction. - * @summary The API returns a list of strings denoting the key talking points in the input text. - * @param [options] The optional parameters - * @returns Promise - */ - keyPhrases(options?: Models.TextAnalyticsClientKeyPhrasesOptionalParams): Promise; - /** - * @param callback The callback - */ - keyPhrases(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - keyPhrases(options: Models.TextAnalyticsClientKeyPhrasesOptionalParams, callback: msRest.ServiceCallback): void; - keyPhrases(options?: Models.TextAnalyticsClientKeyPhrasesOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - options - }, - keyPhrasesOperationSpec, - callback) as Promise; - } - - /** - * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative - * sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the Text - * Analytics Documentation for details about the languages that are supported by sentiment - * analysis. - * @summary The API returns a numeric score between 0 and 1. - * @param [options] The optional parameters - * @returns Promise - */ - sentiment(options?: Models.TextAnalyticsClientSentimentOptionalParams): Promise; - /** - * @param callback The callback - */ - sentiment(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - sentiment(options: Models.TextAnalyticsClientSentimentOptionalParams, callback: msRest.ServiceCallback): void; - sentiment(options?: Models.TextAnalyticsClientSentimentOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - options - }, - sentimentOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const detectLanguageOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "languages", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.showStats - ], - requestBody: { - parameterPath: [ - "options", - "languageBatchInput" - ], - mapper: Mappers.LanguageBatchInput - }, - responses: { - 200: { - bodyMapper: Mappers.LanguageBatchResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const entitiesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "entities", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.showStats - ], - requestBody: { - parameterPath: [ - "options", - "multiLanguageBatchInput" - ], - mapper: Mappers.MultiLanguageBatchInput - }, - responses: { - 200: { - bodyMapper: Mappers.EntitiesBatchResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const keyPhrasesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "keyPhrases", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.showStats - ], - requestBody: { - parameterPath: [ - "options", - "multiLanguageBatchInput" - ], - mapper: Mappers.MultiLanguageBatchInput - }, - responses: { - 200: { - bodyMapper: Mappers.KeyPhraseBatchResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const sentimentOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "sentiment", - urlParameters: [ - Parameters.endpoint - ], - queryParameters: [ - Parameters.showStats - ], - requestBody: { - parameterPath: [ - "options", - "multiLanguageBatchInput" - ], - mapper: Mappers.MultiLanguageBatchInput - }, - responses: { - 200: { - bodyMapper: Mappers.SentimentBatchResult - }, - 500: { - bodyMapper: Mappers.ErrorResponse - }, - default: {} - }, - serializer -}; - -export { - TextAnalyticsClient, - TextAnalyticsClientContext, - Models as TextAnalyticsModels, - Mappers as TextAnalyticsMappers -}; diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/textAnalyticsClientContext.ts b/sdk/cognitiveservices/cognitiveservices-textanalytics/src/textAnalyticsClientContext.ts deleted file mode 100644 index 9d3b8c238aef..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/src/textAnalyticsClientContext.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-textanalytics"; -const packageVersion = "4.0.0"; - -export class TextAnalyticsClientContext extends msRest.ServiceClient { - endpoint: string; - credentials: msRest.ServiceClientCredentials; - - /** - * Initializes a new instance of the TextAnalyticsClientContext 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}/text/analytics/v2.1"; - this.requestContentType = "application/json; charset=utf-8"; - this.endpoint = endpoint; - this.credentials = credentials; - } -} diff --git a/sdk/cognitiveservices/cognitiveservices-textanalytics/tsconfig.json b/sdk/cognitiveservices/cognitiveservices-textanalytics/tsconfig.json deleted file mode 100644 index 422b584abd5e..000000000000 --- a/sdk/cognitiveservices/cognitiveservices-textanalytics/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "es6", - "moduleResolution": "node", - "strict": true, - "target": "es5", - "sourceMap": true, - "declarationMap": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], - "declaration": true, - "outDir": "./esm", - "importHelpers": true - }, - "include": ["./src/**/*.ts"], - "exclude": ["node_modules"] -}