@azure/ai-text-analytics
Advanced tools
Comparing version 1.0.0-dev.20200124.1 to 1.0.0-dev.20200128.1
@@ -1,4 +0,4 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
export const SDK_VERSION = "1.0.0-preview.1"; | ||
//# sourceMappingURL=constants.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
export { TextAnalyticsClient } from "./textAnalyticsClient"; | ||
export { CognitiveServicesCredential } from "./cognitiveServicesCredential"; | ||
export { TextAnalyticsApiKeyCredential } from "./textAnalyticsApiKeyCredential"; | ||
//# sourceMappingURL=index.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// Licensed under the MIT license. | ||
import { createClientLogger } from "@azure/logger"; | ||
@@ -4,0 +4,0 @@ /** |
@@ -25,11 +25,11 @@ // Copyright (c) Microsoft Corporation. | ||
* ```ts | ||
* import { TextAnalyticsClient, CognitiveServicesCredential } from "@azure/ai-text-analytics"; | ||
* import { TextAnalyticsClient, TextAnalyticsApiKeyCredential } from "@azure/ai-text-analytics"; | ||
* | ||
* const client = new TextAnalyticsClient( | ||
* "<service endpoint>", | ||
* new CognitiveServicesCredential("<subscription key>") | ||
* new TextAnalyticsApiKeyCredential("<api key>") | ||
* ); | ||
* ``` | ||
* @param {string} endpointUrl The URL to the TextAnalytics endpoint | ||
* @param {TokenCredential | CognitiveServicesCredential} credential Used to authenticate requests to the service. | ||
* @param {TokenCredential | TextAnalyticsApiKeyCredential} credential Used to authenticate requests to the service. | ||
* @param {TextAnalyticsClientOptions} [options] Used to configure the TextAnalytics client. | ||
@@ -43,11 +43,10 @@ */ | ||
const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`; | ||
if (pipelineOptions.userAgentOptions) { | ||
pipelineOptions.userAgentOptions.userAgentPrefix !== undefined | ||
? `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}` | ||
: libInfo; | ||
if (!pipelineOptions.userAgentOptions) { | ||
pipelineOptions.userAgentOptions = {}; | ||
} | ||
if (pipelineOptions.userAgentOptions.userAgentPrefix) { | ||
pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`; | ||
} | ||
else { | ||
pipelineOptions.userAgentOptions = { | ||
userAgentPrefix: libInfo | ||
}; | ||
pipelineOptions.userAgentOptions.userAgentPrefix = libInfo; | ||
} | ||
@@ -54,0 +53,0 @@ const authPolicy = isTokenCredential(credential) |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// Licensed under the MIT license. | ||
import { getTracer } from "@azure/core-tracing"; | ||
@@ -7,2 +7,3 @@ import { SpanKind } from "@opentelemetry/types"; | ||
* Creates a span using the global tracer. | ||
* @ignore | ||
* @param name The name of the operation being performed. | ||
@@ -9,0 +10,0 @@ * @param tracingOptions The options for the underlying http request. |
@@ -6,2 +6,3 @@ // Copyright (c) Microsoft Corporation. | ||
* return a sorted array of results. | ||
* @ignore | ||
* @param sortedArray An array of entries sorted by `id` | ||
@@ -8,0 +9,0 @@ * @param unsortedArray An array of entries that contain `id` but are not sorted |
@@ -11,4 +11,4 @@ 'use strict'; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
const SDK_VERSION = "1.0.0-preview.1"; | ||
@@ -1392,2 +1392,3 @@ | ||
* return a sorted array of results. | ||
* @ignore | ||
* @param sortedArray An array of entries sorted by `id` | ||
@@ -1524,2 +1525,3 @@ * @param unsortedArray An array of entries that contain `id` but are not sorted | ||
* Creates a span using the global tracer. | ||
* @ignore | ||
* @param name The name of the operation being performed. | ||
@@ -1557,11 +1559,11 @@ * @param tracingOptions The options for the underlying http request. | ||
* ```ts | ||
* import { TextAnalyticsClient, CognitiveServicesCredential } from "@azure/ai-text-analytics"; | ||
* import { TextAnalyticsClient, TextAnalyticsApiKeyCredential } from "@azure/ai-text-analytics"; | ||
* | ||
* const client = new TextAnalyticsClient( | ||
* "<service endpoint>", | ||
* new CognitiveServicesCredential("<subscription key>") | ||
* new TextAnalyticsApiKeyCredential("<api key>") | ||
* ); | ||
* ``` | ||
* @param {string} endpointUrl The URL to the TextAnalytics endpoint | ||
* @param {TokenCredential | CognitiveServicesCredential} credential Used to authenticate requests to the service. | ||
* @param {TokenCredential | TextAnalyticsApiKeyCredential} credential Used to authenticate requests to the service. | ||
* @param {TextAnalyticsClientOptions} [options] Used to configure the TextAnalytics client. | ||
@@ -1575,11 +1577,10 @@ */ | ||
const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`; | ||
if (pipelineOptions.userAgentOptions) { | ||
pipelineOptions.userAgentOptions.userAgentPrefix !== undefined | ||
? `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}` | ||
: libInfo; | ||
if (!pipelineOptions.userAgentOptions) { | ||
pipelineOptions.userAgentOptions = {}; | ||
} | ||
if (pipelineOptions.userAgentOptions.userAgentPrefix) { | ||
pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`; | ||
} | ||
else { | ||
pipelineOptions.userAgentOptions = { | ||
userAgentPrefix: libInfo | ||
}; | ||
pipelineOptions.userAgentOptions.userAgentPrefix = libInfo; | ||
} | ||
@@ -1813,24 +1814,48 @@ const authPolicy = coreHttp.isTokenCredential(credential) | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Copyright (c) Microsoft Corporation. | ||
const API_KEY_HEADER_NAME = "Ocp-Apim-Subscription-Key"; | ||
/** | ||
* Creates a new CognitiveServicesCredential object. | ||
* | ||
* @param {string} subscriptionKey The CognitiveServices subscription key | ||
* This class is used to authenticate to Text Analytics using an API Key retrieved | ||
* from the Azure portal. Sometimes this is referred to as a "Subscription Key". | ||
*/ | ||
class CognitiveServicesCredential extends coreHttp.ApiKeyCredentials { | ||
constructor(subscriptionKey) { | ||
if (!subscriptionKey || (subscriptionKey && typeof subscriptionKey.valueOf() !== "string")) { | ||
throw new Error("subscriptionKey cannot be null or undefined and must be of type string."); | ||
class TextAnalyticsApiKeyCredential { | ||
/** | ||
* Creates a new apiKeyCredential object. | ||
* | ||
* @param {string} apiKey The Text Analytics API key for authentication. | ||
*/ | ||
constructor(apiKey) { | ||
this.updateKey(apiKey); | ||
} | ||
/** | ||
* Updates the API Key used for authentication. Use this method to roll credentials. | ||
* @param apiKey The Text Analytics API key for authentication. | ||
*/ | ||
updateKey(apiKey) { | ||
if (!apiKey || typeof apiKey !== "string") { | ||
throw new Error("apiKey must be a non-empty string"); | ||
} | ||
const options = { | ||
inHeader: { | ||
"Ocp-Apim-Subscription-Key": subscriptionKey | ||
this.apiKey = apiKey; | ||
} | ||
/* eslint-disable @azure/azure-sdk/ts-use-interface-parameters */ | ||
/** | ||
* Signs a request with the provided API Key. | ||
* | ||
* @param {WebResource} webResource The WebResource to be signed. | ||
* @returns {Promise<WebResource>} The signed request object. | ||
*/ | ||
signRequest(webResource) { | ||
return tslib.__awaiter(this, void 0, void 0, function* () { | ||
if (!webResource) { | ||
throw new Error("webResource cannot be null or undefined."); | ||
} | ||
}; | ||
super(options); | ||
webResource.headers.set(API_KEY_HEADER_NAME, this.apiKey); | ||
return webResource; | ||
}); | ||
} | ||
} | ||
/* eslint-enable @azure/azure-sdk/ts-use-interface-parameters */ | ||
exports.CognitiveServicesCredential = CognitiveServicesCredential; | ||
exports.TextAnalyticsApiKeyCredential = TextAnalyticsApiKeyCredential; | ||
exports.TextAnalyticsClient = TextAnalyticsClient$1; | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,3 @@ { | ||
"description": "An isomorphic client library for the Azure Text Analytics service.", | ||
"version": "1.0.0-dev.20200124.1", | ||
"version": "1.0.0-dev.20200128.1", | ||
"keywords": [ | ||
@@ -45,3 +45,3 @@ "node", | ||
"check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", | ||
"clean": "rimraf browser dist dist-esm test-dist types *.tgz *.log", | ||
"clean": "rimraf browser dist dist-esm test-dist temp types *.tgz *.log", | ||
"execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/", | ||
@@ -55,4 +55,4 @@ "execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/samples/typescript/src/", | ||
"integration-test": "npm run integration-test:node && npm run integration-test:browser", | ||
"lint:fix": "eslint \"src/**/*.ts\" \"test/**/*.ts\" -c ../../.eslintrc.json --fix --fix-type [problem,suggestion]", | ||
"lint": "eslint -c ../../.eslintrc.json src test --ext .ts -f html -o textAnalytics-lintReport.html || exit 0", | ||
"lint:fix": "eslint \"src/**/*.ts\" \"test/**/*.ts\" --fix --fix-type [problem,suggestion]", | ||
"lint": "eslint src test --ext .ts -f html -o textAnalytics-lintReport.html || exit 0", | ||
"pack": "npm pack 2>&1", | ||
@@ -59,0 +59,0 @@ "prebuild": "npm run clean", |
@@ -50,8 +50,10 @@ # Azure TextAnalytics client library for JavaScript | ||
TextAnalytics uses both AAD and subscription keys for authentication. | ||
TextAnalytics uses both AAD and API keys for authentication. | ||
#### Using a Subscription Key | ||
#### Using an API Key | ||
Use the [Azure CLI][azure_cli] snippet below to get the subscription key from the Text Analytics resource. | ||
Use the [Azure CLI][azure_cli] snippet below to get the API key from the Text Analytics resource. | ||
**Note:** Sometimes the API key is referred to as a "subscription key" or "subscription API key". | ||
```PowerShell | ||
@@ -61,12 +63,12 @@ az cognitiveservices account keys list --resource-group <your-resource-group-name> --name <your-resource-name> | ||
Alternatively, you can get the endpoint and subscription key from the resource information in the [Azure Portal][azure_portal]. | ||
Alternatively, you can get the endpoint and API key from the resource information in the [Azure Portal][azure_portal]. | ||
Once you have a subscription key, you can use it as follows: | ||
Once you have an API key, you can use it as follows: | ||
```js | ||
const { TextAnalyticsClient, CognitiveServicesCredential } = require("@azure/ai-text-analytics"); | ||
const { TextAnalyticsClient, TextAnalyticsApiKeyCredential } = require("@azure/ai-text-analytics"); | ||
const client = new TextAnalyticsClient( | ||
"<endpoint>", | ||
new CognitiveServicesCredential("<subscription key>") | ||
new TextAnalyticsApiKeyCredential("<API key>") | ||
); | ||
@@ -77,3 +79,3 @@ ``` | ||
Client subscription key authentication is used in most of the examples, but you can also authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, | ||
Client API key authentication is used in most of the examples, but you can also authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, | ||
or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: | ||
@@ -80,0 +82,0 @@ |
@@ -46,3 +46,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
export interface AnalyzeSentimentErrorResult extends TextAnalyticsErrorResult {} | ||
export type AnalyzeSentimentErrorResult = TextAnalyticsErrorResult | ||
@@ -49,0 +49,0 @@ export function makeAnalyzeSentimentResult( |
@@ -1,4 +0,4 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
export const SDK_VERSION: string = "1.0.0-preview.1"; |
@@ -35,3 +35,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
export interface DetectLanguageErrorResult extends TextAnalyticsErrorResult {} | ||
export type DetectLanguageErrorResult = TextAnalyticsErrorResult | ||
@@ -38,0 +38,0 @@ export function makeDetectLanguageResult( |
@@ -32,3 +32,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
export interface ExtractKeyPhrasesErrorResult extends TextAnalyticsErrorResult {} | ||
export type ExtractKeyPhrasesErrorResult = TextAnalyticsErrorResult | ||
@@ -35,0 +35,0 @@ export function makeExtractKeyPhrasesResult( |
@@ -15,3 +15,3 @@ // Copyright (c) Microsoft Corporation. | ||
} from "./textAnalyticsClient"; | ||
export { CognitiveServicesCredential } from "./cognitiveServicesCredential"; | ||
export { TextAnalyticsApiKeyCredential } from "./textAnalyticsApiKeyCredential"; | ||
export { | ||
@@ -18,0 +18,0 @@ DetectLanguageResult, |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// Licensed under the MIT license. | ||
@@ -4,0 +4,0 @@ import { createClientLogger } from "@azure/logger"; |
@@ -31,3 +31,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
export interface RecognizeEntitiesErrorResult extends TextAnalyticsErrorResult {} | ||
export type RecognizeEntitiesErrorResult = TextAnalyticsErrorResult | ||
@@ -34,0 +34,0 @@ export function makeRecognizeEntitiesResult( |
@@ -33,3 +33,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
export interface RecognizeLinkedEntitiesErrorResult extends TextAnalyticsErrorResult {} | ||
export type RecognizeLinkedEntitiesErrorResult = TextAnalyticsErrorResult | ||
@@ -36,0 +36,0 @@ export function makeRecognizeLinkedEntitiesResult( |
@@ -1,4 +0,6 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
/* eslint @typescript-eslint/no-empty-interface: 0 */ | ||
// d.ts shims provide types for things we use internally but are not part | ||
@@ -5,0 +7,0 @@ // of this package's surface area. |
@@ -42,3 +42,3 @@ // Copyright (c) Microsoft Corporation. | ||
} from "./recognizeLinkedEntitiesResultCollection"; | ||
import { CognitiveServicesCredential } from "./cognitiveServicesCredential"; | ||
import { TextAnalyticsApiKeyCredential } from "./textAnalyticsApiKeyCredential"; | ||
import { createSpan } from "./tracing"; | ||
@@ -84,3 +84,3 @@ import { CanonicalCode } from "@opentelemetry/types"; | ||
*/ | ||
export interface DetectLanguagesOptions extends TextAnalyticsOperationOptions {} | ||
export type DetectLanguagesOptions = TextAnalyticsOperationOptions | ||
@@ -90,3 +90,3 @@ /** | ||
*/ | ||
export interface RecognizeEntitiesOptions extends TextAnalyticsOperationOptions {} | ||
export type RecognizeEntitiesOptions = TextAnalyticsOperationOptions | ||
@@ -96,3 +96,3 @@ /** | ||
*/ | ||
export interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {} | ||
export type AnalyzeSentimentOptions = TextAnalyticsOperationOptions | ||
@@ -102,3 +102,3 @@ /** | ||
*/ | ||
export interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions {} | ||
export type ExtractKeyPhrasesOptions = TextAnalyticsOperationOptions | ||
@@ -108,3 +108,3 @@ /** | ||
*/ | ||
export interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions {} | ||
export type RecognizeLinkedEntitiesOptions = TextAnalyticsOperationOptions | ||
@@ -114,3 +114,3 @@ /** | ||
*/ | ||
export interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions {} | ||
export type RecognizePiiEntitiesOptions = TextAnalyticsOperationOptions | ||
@@ -148,11 +148,11 @@ /** | ||
* ```ts | ||
* import { TextAnalyticsClient, CognitiveServicesCredential } from "@azure/ai-text-analytics"; | ||
* import { TextAnalyticsClient, TextAnalyticsApiKeyCredential } from "@azure/ai-text-analytics"; | ||
* | ||
* const client = new TextAnalyticsClient( | ||
* "<service endpoint>", | ||
* new CognitiveServicesCredential("<subscription key>") | ||
* new TextAnalyticsApiKeyCredential("<api key>") | ||
* ); | ||
* ``` | ||
* @param {string} endpointUrl The URL to the TextAnalytics endpoint | ||
* @param {TokenCredential | CognitiveServicesCredential} credential Used to authenticate requests to the service. | ||
* @param {TokenCredential | TextAnalyticsApiKeyCredential} credential Used to authenticate requests to the service. | ||
* @param {TextAnalyticsClientOptions} [options] Used to configure the TextAnalytics client. | ||
@@ -162,3 +162,3 @@ */ | ||
endpointUrl: string, | ||
credential: TokenCredential | CognitiveServicesCredential, | ||
credential: TokenCredential | TextAnalyticsApiKeyCredential, | ||
options: TextAnalyticsClientOptions = {} | ||
@@ -172,10 +172,9 @@ ) { | ||
const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`; | ||
if (pipelineOptions.userAgentOptions) { | ||
pipelineOptions.userAgentOptions.userAgentPrefix !== undefined | ||
? `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}` | ||
: libInfo; | ||
if (!pipelineOptions.userAgentOptions) { | ||
pipelineOptions.userAgentOptions = {}; | ||
} | ||
if (pipelineOptions.userAgentOptions.userAgentPrefix) { | ||
pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`; | ||
} else { | ||
pipelineOptions.userAgentOptions = { | ||
userAgentPrefix: libInfo | ||
}; | ||
pipelineOptions.userAgentOptions.userAgentPrefix = libInfo; | ||
} | ||
@@ -182,0 +181,0 @@ |
@@ -27,2 +27,7 @@ // Copyright (c) Microsoft Corporation. | ||
readonly statistics?: TextDocumentStatistics; | ||
/** | ||
* Discriminant to determine if that this is an error result. | ||
*/ | ||
readonly error?: undefined; | ||
} | ||
@@ -49,3 +54,3 @@ | ||
statistics?: TextDocumentStatistics | ||
): TextAnalyticsResult { | ||
): TextAnalyticsSuccessResult { | ||
return { | ||
@@ -52,0 +57,0 @@ id, |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// Licensed under the MIT license. | ||
@@ -12,2 +12,3 @@ import { getTracer } from "@azure/core-tracing"; | ||
* Creates a span using the global tracer. | ||
* @ignore | ||
* @param name The name of the operation being performed. | ||
@@ -14,0 +15,0 @@ * @param tracingOptions The options for the underlying http request. |
@@ -11,2 +11,3 @@ // Copyright (c) Microsoft Corporation. | ||
* return a sorted array of results. | ||
* @ignore | ||
* @param sortedArray An array of entries sorted by `id` | ||
@@ -13,0 +14,0 @@ * @param unsortedArray An array of entries that contain `id` but are not sorted |
@@ -1,5 +0,6 @@ | ||
import { ApiKeyCredentials } from '@azure/core-http'; | ||
import { OperationOptions } from '@azure/core-http'; | ||
import { PipelineOptions } from '@azure/core-http'; | ||
import { ServiceClientCredentials } from '@azure/core-http'; | ||
import { TokenCredential } from '@azure/identity'; | ||
import { WebResource } from '@azure/core-http'; | ||
@@ -9,4 +10,3 @@ /** | ||
*/ | ||
export declare interface AnalyzeSentimentErrorResult extends TextAnalyticsErrorResult { | ||
} | ||
export declare type AnalyzeSentimentErrorResult = TextAnalyticsErrorResult; | ||
@@ -16,4 +16,3 @@ /** | ||
*/ | ||
export declare interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions { | ||
} | ||
export declare type AnalyzeSentimentOptions = TextAnalyticsOperationOptions; | ||
@@ -64,11 +63,2 @@ /** | ||
/** | ||
* Creates a new CognitiveServicesCredential object. | ||
* | ||
* @param {string} subscriptionKey The CognitiveServices subscription key | ||
*/ | ||
export declare class CognitiveServicesCredential extends ApiKeyCredentials { | ||
constructor(subscriptionKey: string); | ||
} | ||
/** | ||
* An interface representing DetectedLanguage. | ||
@@ -96,4 +86,3 @@ */ | ||
*/ | ||
export declare interface DetectLanguageErrorResult extends TextAnalyticsErrorResult { | ||
} | ||
export declare type DetectLanguageErrorResult = TextAnalyticsErrorResult; | ||
@@ -138,4 +127,3 @@ /** | ||
*/ | ||
export declare interface DetectLanguagesOptions extends TextAnalyticsOperationOptions { | ||
} | ||
export declare type DetectLanguagesOptions = TextAnalyticsOperationOptions; | ||
@@ -207,4 +195,3 @@ /** | ||
*/ | ||
export declare interface ExtractKeyPhrasesErrorResult extends TextAnalyticsErrorResult { | ||
} | ||
export declare type ExtractKeyPhrasesErrorResult = TextAnalyticsErrorResult; | ||
@@ -214,4 +201,3 @@ /** | ||
*/ | ||
export declare interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions { | ||
} | ||
export declare type ExtractKeyPhrasesOptions = TextAnalyticsOperationOptions; | ||
@@ -349,4 +335,3 @@ /** | ||
*/ | ||
export declare interface RecognizeEntitiesErrorResult extends TextAnalyticsErrorResult { | ||
} | ||
export declare type RecognizeEntitiesErrorResult = TextAnalyticsErrorResult; | ||
@@ -356,4 +341,3 @@ /** | ||
*/ | ||
export declare interface RecognizeEntitiesOptions extends TextAnalyticsOperationOptions { | ||
} | ||
export declare type RecognizeEntitiesOptions = TextAnalyticsOperationOptions; | ||
@@ -397,4 +381,3 @@ /** | ||
*/ | ||
export declare interface RecognizeLinkedEntitiesErrorResult extends TextAnalyticsErrorResult { | ||
} | ||
export declare type RecognizeLinkedEntitiesErrorResult = TextAnalyticsErrorResult; | ||
@@ -404,4 +387,3 @@ /** | ||
*/ | ||
export declare interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions { | ||
} | ||
export declare type RecognizeLinkedEntitiesOptions = TextAnalyticsOperationOptions; | ||
@@ -445,4 +427,3 @@ /** | ||
*/ | ||
export declare interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions { | ||
} | ||
export declare type RecognizePiiEntitiesOptions = TextAnalyticsOperationOptions; | ||
@@ -495,2 +476,31 @@ /** | ||
/** | ||
* This class is used to authenticate to Text Analytics using an API Key retrieved | ||
* from the Azure portal. Sometimes this is referred to as a "Subscription Key". | ||
*/ | ||
export declare class TextAnalyticsApiKeyCredential implements ServiceClientCredentials { | ||
/** | ||
* Used to authenticate to Text Analytics | ||
*/ | ||
private apiKey; | ||
/** | ||
* Creates a new apiKeyCredential object. | ||
* | ||
* @param {string} apiKey The Text Analytics API key for authentication. | ||
*/ | ||
constructor(apiKey: string); | ||
/** | ||
* Updates the API Key used for authentication. Use this method to roll credentials. | ||
* @param apiKey The Text Analytics API key for authentication. | ||
*/ | ||
updateKey(apiKey: string): void; | ||
/** | ||
* Signs a request with the provided API Key. | ||
* | ||
* @param {WebResource} webResource The WebResource to be signed. | ||
* @returns {Promise<WebResource>} The signed request object. | ||
*/ | ||
signRequest(webResource: WebResource): Promise<WebResource>; | ||
} | ||
/** | ||
* Client class for interacting with Azure Text Analytics. | ||
@@ -517,14 +527,14 @@ */ | ||
* ```ts | ||
* import { TextAnalyticsClient, CognitiveServicesCredential } from "@azure/ai-text-analytics"; | ||
* import { TextAnalyticsClient, TextAnalyticsApiKeyCredential } from "@azure/ai-text-analytics"; | ||
* | ||
* const client = new TextAnalyticsClient( | ||
* "<service endpoint>", | ||
* new CognitiveServicesCredential("<subscription key>") | ||
* new TextAnalyticsApiKeyCredential("<api key>") | ||
* ); | ||
* ``` | ||
* @param {string} endpointUrl The URL to the TextAnalytics endpoint | ||
* @param {TokenCredential | CognitiveServicesCredential} credential Used to authenticate requests to the service. | ||
* @param {TokenCredential | TextAnalyticsApiKeyCredential} credential Used to authenticate requests to the service. | ||
* @param {TextAnalyticsClientOptions} [options] Used to configure the TextAnalytics client. | ||
*/ | ||
constructor(endpointUrl: string, credential: TokenCredential | CognitiveServicesCredential, options?: TextAnalyticsClientOptions); | ||
constructor(endpointUrl: string, credential: TokenCredential | TextAnalyticsApiKeyCredential, options?: TextAnalyticsClientOptions); | ||
/** | ||
@@ -781,2 +791,6 @@ * Runs a predictive model to determine the language that the passed-in | ||
readonly statistics?: TextDocumentStatistics; | ||
/** | ||
* Discriminant to determine if that this is an error result. | ||
*/ | ||
readonly error?: undefined; | ||
} | ||
@@ -783,0 +797,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
442154
8140
174