@azure-rest/ai-translation-text
Advanced tools
Comparing version 1.0.0-alpha.20240429.1 to 1.0.0-alpha.20240604.1
# Release History | ||
## 1.0.0-beta.2 (Unreleased) | ||
## 1.0.0 (2024-05-21) | ||
@@ -8,8 +8,2 @@ ### Features Added | ||
### Breaking Changes | ||
### Bugs Fixed | ||
### Other Changes | ||
## 1.0.0-beta.1 (2023-04-18) | ||
@@ -16,0 +10,0 @@ Initial release |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import TextTranslationClient from "./custom/customClient"; | ||
export * from "./custom/customClient"; | ||
export * from "./parameters"; | ||
export * from "./responses"; | ||
export * from "./clientDefinitions"; | ||
export * from "./isUnexpected"; | ||
export * from "./models"; | ||
export * from "./outputModels"; | ||
export * from "./serializeHelper"; | ||
import TextTranslationClient from "./customClient"; | ||
export * from "./customClient"; | ||
export * from "./generated/parameters"; | ||
export * from "./generated/responses"; | ||
export * from "./generated/clientDefinitions"; | ||
export * from "./generated/isUnexpected"; | ||
export * from "./generated/models"; | ||
export * from "./generated/outputModels"; | ||
export * from "./generated/serializeHelper"; | ||
export default TextTranslationClient; | ||
//# sourceMappingURL=index.js.map |
@@ -89,11 +89,29 @@ 'use strict'; | ||
} | ||
/** | ||
* Initialize a new instance of `TextTranslationClient` | ||
* @param endpoint type: string, Supported Text Translation endpoints (protocol and hostname, for example: | ||
* https://api.cognitive.microsofttranslator.com). | ||
* @param options type: ClientOptions, the parameter for all optional parameters | ||
*/ | ||
function createClient(endpoint, credential = undefined, options = {}) { | ||
var _a, _b, _c, _d; | ||
function isCredentials(credential) { | ||
return (isKeyCredential(credential) || | ||
isTranslatorKeyCredential(credential) || | ||
isTokenCredential(credential) || | ||
isTranslatorTokenCredential(credential)); | ||
} | ||
// Implementation | ||
function createClient(arg1, arg2, arg3) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
let serviceEndpoint; | ||
let endpoint; | ||
let options; | ||
let credential; | ||
if (typeof arg1 === "string") { | ||
endpoint = arg1; | ||
} | ||
if (typeof arg1 !== "string" && isCredentials(arg1)) { | ||
credential = arg1; | ||
options = arg2; | ||
} | ||
else if (isCredentials(arg2)) { | ||
credential = arg2; | ||
options = arg3; | ||
} | ||
if (!options) { | ||
options = {}; | ||
} | ||
options.apiVersion = (_a = options.apiVersion) !== null && _a !== void 0 ? _a : "3.0"; | ||
@@ -110,3 +128,3 @@ if (!endpoint) { | ||
const baseUrl = (_b = options.baseUrl) !== null && _b !== void 0 ? _b : `${serviceEndpoint}`; | ||
const userAgentInfo = `azsdk-js-ai-translation-text-rest/1.0.0-beta.2`; | ||
const userAgentInfo = `azsdk-js-ai-translation-text-rest/1.0.0`; | ||
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix | ||
@@ -132,3 +150,3 @@ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` | ||
credential: credential, | ||
scopes: DEFAULT_SCOPE, | ||
scopes: (_f = (_e = options === null || options === void 0 ? void 0 : options.credentials) === null || _e === void 0 ? void 0 : _e.scopes) !== null && _f !== void 0 ? _f : DEFAULT_SCOPE, | ||
})); | ||
@@ -139,3 +157,3 @@ } | ||
credential: credential.tokenCredential, | ||
scopes: DEFAULT_SCOPE, | ||
scopes: (_h = (_g = options === null || options === void 0 ? void 0 : options.credentials) === null || _g === void 0 ? void 0 : _g.scopes) !== null && _h !== void 0 ? _h : DEFAULT_SCOPE, | ||
})); | ||
@@ -187,3 +205,4 @@ client.pipeline.addPolicy(new TranslatorTokenCredentialAuthenticationPolicy(credential)); | ||
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { | ||
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) { | ||
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && | ||
((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) { | ||
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length; | ||
@@ -190,0 +209,0 @@ // If the current part of the candidate is a "template" part |
@@ -5,3 +5,3 @@ { | ||
"author": "Microsoft Corporation", | ||
"version": "1.0.0-alpha.20240429.1", | ||
"version": "1.0.0-alpha.20240604.1", | ||
"description": "An isomorphic client library for the Azure Cognitive Translator Service", | ||
@@ -96,3 +96,3 @@ "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/translation/ai-translation-text-rest/README.md", | ||
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb", | ||
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb", | ||
"@azure/eslint-plugin-azure-sdk": "^3.0.0", | ||
"@azure-tools/test-credential": "^1.0.0", | ||
@@ -99,0 +99,0 @@ "@azure/identity": "^4.0.1", |
@@ -53,13 +53,9 @@ import { Client } from '@azure-rest/core-client'; | ||
/** Common properties of language script */ | ||
export declare interface CommonScriptModelOutput { | ||
/** Code identifying the script. */ | ||
code: string; | ||
/** Display name of the script in the locale requested via Accept-Language header. */ | ||
name: string; | ||
/** Display name of the language in the locale native for the language. */ | ||
nativeName: string; | ||
/** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ | ||
dir: string; | ||
} | ||
/** | ||
* Initialize a new instance of `TextTranslationClient` | ||
* @param credential type: TranslatorCredential | TranslatorTokenCredential | KeyCredential |TokenCredential, credentials | ||
* used to authenticate the service with. | ||
* @param options type: ClientOptions, the parameter for all optional parameters | ||
*/ | ||
declare function createClient(credential: TranslatorCredential | TranslatorTokenCredential | KeyCredential | TokenCredential, options?: ClientOptions): TextTranslationClient; | ||
@@ -72,3 +68,13 @@ /** | ||
*/ | ||
declare function createClient(endpoint: undefined | string, credential?: undefined | TranslatorCredential | TranslatorTokenCredential | KeyCredential | TokenCredential, options?: ClientOptions): TextTranslationClient; | ||
declare function createClient(endpoint: string, options?: ClientOptions): TextTranslationClient; | ||
/** | ||
* Initialize a new instance of `TextTranslationClient` | ||
* @param endpoint type: string, Supported Text Translation endpoints (protocol and hostname, for example: | ||
* https://api.cognitive.microsofttranslator.com). | ||
* @param credential type: TranslatorCredential | TranslatorTokenCredential | KeyCredential |TokenCredential, credentials | ||
* used to authenticate the service with. | ||
* @param options type: ClientOptions, the parameter for all optional parameters | ||
*/ | ||
declare function createClient(endpoint: string, credential: TranslatorCredential | TranslatorTokenCredential | KeyCredential | TokenCredential, options?: ClientOptions): TextTranslationClient; | ||
export default createClient; | ||
@@ -273,8 +279,8 @@ | ||
export declare interface GetLanguages { | ||
export declare interface GetSupportedLanguages { | ||
/** Gets the set of languages currently supported by other operations of the Translator. */ | ||
get(options?: GetLanguagesParameters): StreamableMethod<GetLanguages200Response | GetLanguagesDefaultResponse>; | ||
get(options?: GetSupportedLanguagesParameters): StreamableMethod<GetSupportedLanguages200Response | GetSupportedLanguagesDefaultResponse>; | ||
} | ||
export declare interface GetLanguages200Headers { | ||
export declare interface GetSupportedLanguages200Headers { | ||
/** Value generated by the service to identify the request. It is used for troubleshooting purposes. */ | ||
@@ -291,9 +297,9 @@ "x-requestid": string; | ||
/** The request has succeeded. */ | ||
export declare interface GetLanguages200Response extends HttpResponse { | ||
export declare interface GetSupportedLanguages200Response extends HttpResponse { | ||
status: "200"; | ||
body: GetLanguagesResultOutput; | ||
headers: RawHttpHeaders & GetLanguages200Headers; | ||
body: GetSupportedLanguagesResultOutput; | ||
headers: RawHttpHeaders & GetSupportedLanguages200Headers; | ||
} | ||
export declare interface GetLanguagesDefaultHeaders { | ||
export declare interface GetSupportedLanguagesDefaultHeaders { | ||
/** Value generated by the service to identify the request. It is used for troubleshooting purposes. */ | ||
@@ -303,13 +309,13 @@ "x-requestid": string; | ||
export declare interface GetLanguagesDefaultResponse extends HttpResponse { | ||
export declare interface GetSupportedLanguagesDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
headers: RawHttpHeaders & GetLanguagesDefaultHeaders; | ||
headers: RawHttpHeaders & GetSupportedLanguagesDefaultHeaders; | ||
} | ||
export declare interface GetLanguagesHeaderParam { | ||
headers?: RawHttpHeadersInput & GetLanguagesHeaders; | ||
export declare interface GetSupportedLanguagesHeaderParam { | ||
headers?: RawHttpHeadersInput & GetSupportedLanguagesHeaders; | ||
} | ||
export declare interface GetLanguagesHeaders { | ||
export declare interface GetSupportedLanguagesHeaders { | ||
/** A client-generated GUID to uniquely identify the request. */ | ||
@@ -333,9 +339,9 @@ "X-ClientTraceId"?: string; | ||
export declare type GetLanguagesParameters = GetLanguagesQueryParam & GetLanguagesHeaderParam & RequestParameters; | ||
export declare type GetSupportedLanguagesParameters = GetSupportedLanguagesQueryParam & GetSupportedLanguagesHeaderParam & RequestParameters; | ||
export declare interface GetLanguagesQueryParam { | ||
queryParameters?: GetLanguagesQueryParamProperties; | ||
export declare interface GetSupportedLanguagesQueryParam { | ||
queryParameters?: GetSupportedLanguagesQueryParamProperties; | ||
} | ||
export declare interface GetLanguagesQueryParamProperties { | ||
export declare interface GetSupportedLanguagesQueryParamProperties { | ||
/** | ||
@@ -352,3 +358,3 @@ * A comma-separated list of names defining the group of languages to return. | ||
/** Response for the languages API. */ | ||
export declare interface GetLanguagesResultOutput { | ||
export declare interface GetSupportedLanguagesResultOutput { | ||
/** Languages that support translate API. */ | ||
@@ -368,3 +374,3 @@ translation?: Record<string, TranslationLanguageOutput>; | ||
export declare function isUnexpected(response: GetLanguages200Response | GetLanguagesDefaultResponse): response is GetLanguagesDefaultResponse; | ||
export declare function isUnexpected(response: GetSupportedLanguages200Response | GetSupportedLanguagesDefaultResponse): response is GetSupportedLanguagesDefaultResponse; | ||
@@ -381,2 +387,17 @@ export declare function isUnexpected(response: Translate200Response | TranslateDefaultResponse): response is TranslateDefaultResponse; | ||
/** Language Directionality */ | ||
export declare type LanguageDirectionalityOutput = "ltr" | "rtl"; | ||
/** Common properties of language script */ | ||
export declare interface LanguageScriptOutput { | ||
/** Code identifying the script. */ | ||
code: string; | ||
/** Display name of the script in the locale requested via Accept-Language header. */ | ||
name: string; | ||
/** Display name of the language in the locale native for the language. */ | ||
nativeName: string; | ||
/** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ | ||
dir: LanguageDirectionalityOutput; | ||
} | ||
export declare interface LookupDictionaryEntries { | ||
@@ -504,5 +525,11 @@ /** Lookup Dictionary Entries */ | ||
/** Translator profanity actions */ | ||
export declare type ProfanityAction = "NoAction" | "Marked" | "Deleted"; | ||
/** Translator profanity markers */ | ||
export declare type ProfanityMarker = "Asterisk" | "Tag"; | ||
export declare interface Routes { | ||
/** Resource for '/languages' has methods for the following verbs: get */ | ||
(path: "/languages"): GetLanguages; | ||
(path: "/languages"): GetSupportedLanguages; | ||
/** Resource for '/translate' has methods for the following verbs: post */ | ||
@@ -521,3 +548,3 @@ (path: "/translate"): Translate; | ||
/** An object returning sentence boundaries in the input and output texts. */ | ||
export declare interface SentenceLengthOutput { | ||
export declare interface SentenceBoundariesOutput { | ||
/** | ||
@@ -542,3 +569,3 @@ * An integer array representing the lengths of the sentences in the input text. | ||
/** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ | ||
dir: string; | ||
dir: LanguageDirectionalityOutput; | ||
/** List of languages with alterative translations and examples for the query expressed in the source language. */ | ||
@@ -561,3 +588,3 @@ translations: Array<TargetDictionaryLanguageOutput>; | ||
/** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ | ||
dir: string; | ||
dir: LanguageDirectionalityOutput; | ||
/** Language code identifying the target language. */ | ||
@@ -571,2 +598,5 @@ code: string; | ||
/** Alias for TextType */ | ||
export declare type TextType = string | "Plain" | "Html"; | ||
export declare interface Translate { | ||
@@ -640,3 +670,3 @@ /** Translate Text */ | ||
*/ | ||
translations: Array<TranslationOutput>; | ||
translations: Array<TranslationTextOutput>; | ||
/** | ||
@@ -687,3 +717,3 @@ * Input text in the default script of the source language. sourceText property is present only when | ||
*/ | ||
textType?: string; | ||
textType?: TextType; | ||
/** | ||
@@ -699,3 +729,3 @@ * A string specifying the category (domain) of the translation. This parameter is used to get translations | ||
*/ | ||
profanityAction?: string; | ||
profanityAction?: ProfanityAction; | ||
/** | ||
@@ -705,3 +735,3 @@ * Specifies how profanities should be marked in translations. | ||
*/ | ||
profanityMarker?: string; | ||
profanityMarker?: ProfanityMarker; | ||
/** | ||
@@ -750,7 +780,7 @@ * Specifies whether to include alignment projection from source text to translated text. | ||
/** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ | ||
dir: string; | ||
dir: LanguageDirectionalityOutput; | ||
} | ||
/** Translation result */ | ||
export declare interface TranslationOutput { | ||
export declare interface TranslationTextOutput { | ||
/** A string representing the language code of the target language. */ | ||
@@ -765,3 +795,3 @@ to: string; | ||
/** Sentence boundaries in the input and output texts. */ | ||
sentLen?: SentenceLengthOutput; | ||
sentLen?: SentenceBoundariesOutput; | ||
} | ||
@@ -781,5 +811,5 @@ | ||
/** Script definition with list of script into which given script can be translitered. */ | ||
export declare interface TransliterableScriptOutput extends CommonScriptModelOutput { | ||
export declare interface TransliterableScriptOutput extends LanguageScriptOutput { | ||
/** List of scripts available to convert text to. */ | ||
toScripts: Array<CommonScriptModelOutput>; | ||
toScripts: Array<LanguageScriptOutput>; | ||
} | ||
@@ -786,0 +816,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167632
30
1297