@azure-rest/ai-translation-text
Advanced tools
Comparing version 1.0.0-alpha.20240111.1 to 1.0.0-alpha.20240115.1
@@ -11,6 +11,6 @@ // Copyright (c) Microsoft Corporation. | ||
function isKeyCredential(credential) { | ||
return (credential === null || credential === void 0 ? void 0 : credential.key) !== undefined; | ||
return credential?.key !== undefined; | ||
} | ||
function isTranslatorKeyCredential(credential) { | ||
return (credential === null || credential === void 0 ? void 0 : credential.key) !== undefined; | ||
return credential?.key !== undefined; | ||
} | ||
@@ -41,3 +41,2 @@ /** Policy that sets the api-version (or equivalent) to reflect the library version. */ | ||
export default function createClient(endpoint, credential = undefined, options = {}) { | ||
var _a; | ||
let serviceEndpoint; | ||
@@ -53,3 +52,3 @@ if (!endpoint) { | ||
} | ||
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${serviceEndpoint}`; | ||
const baseUrl = options.baseUrl ?? `${serviceEndpoint}`; | ||
const userAgentInfo = `azsdk-js-ai-translation-text-rest/1.0.0-beta.2`; | ||
@@ -59,5 +58,8 @@ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix | ||
: `${userAgentInfo}`; | ||
options = Object.assign(Object.assign({}, options), { userAgentOptions: { | ||
options = { | ||
...options, | ||
userAgentOptions: { | ||
userAgentPrefix, | ||
} }); | ||
}, | ||
}; | ||
const client = getClient(baseUrl, options); | ||
@@ -64,0 +66,0 @@ client.pipeline.addPolicy(apiVersionPolicy); |
@@ -13,3 +13,3 @@ // Copyright (c) Microsoft Corporation. | ||
const lroOriginal = response.headers["x-ms-original-url"]; | ||
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url); | ||
const url = new URL(lroOriginal ?? response.request.url); | ||
const method = response.request.method; | ||
@@ -16,0 +16,0 @@ const pathDetails = responseMap[`${method} ${url.pathname}`]; |
@@ -60,6 +60,6 @@ 'use strict'; | ||
function isKeyCredential(credential) { | ||
return (credential === null || credential === void 0 ? void 0 : credential.key) !== undefined; | ||
return credential?.key !== undefined; | ||
} | ||
function isTranslatorKeyCredential(credential) { | ||
return (credential === null || credential === void 0 ? void 0 : credential.key) !== undefined; | ||
return credential?.key !== undefined; | ||
} | ||
@@ -90,3 +90,2 @@ /** Policy that sets the api-version (or equivalent) to reflect the library version. */ | ||
function createClient(endpoint, credential = undefined, options = {}) { | ||
var _a; | ||
let serviceEndpoint; | ||
@@ -102,3 +101,3 @@ if (!endpoint) { | ||
} | ||
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${serviceEndpoint}`; | ||
const baseUrl = options.baseUrl ?? `${serviceEndpoint}`; | ||
const userAgentInfo = `azsdk-js-ai-translation-text-rest/1.0.0-beta.2`; | ||
@@ -108,5 +107,8 @@ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix | ||
: `${userAgentInfo}`; | ||
options = Object.assign(Object.assign({}, options), { userAgentOptions: { | ||
options = { | ||
...options, | ||
userAgentOptions: { | ||
userAgentPrefix, | ||
} }); | ||
}, | ||
}; | ||
const client = coreClient.getClient(baseUrl, options); | ||
@@ -143,3 +145,3 @@ client.pipeline.addPolicy(apiVersionPolicy); | ||
const lroOriginal = response.headers["x-ms-original-url"]; | ||
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url); | ||
const url = new URL(lroOriginal ?? response.request.url); | ||
const method = response.request.method; | ||
@@ -146,0 +148,0 @@ const pathDetails = responseMap[`${method} ${url.pathname}`]; |
@@ -5,3 +5,3 @@ { | ||
"author": "Microsoft Corporation", | ||
"version": "1.0.0-alpha.20240111.1", | ||
"version": "1.0.0-alpha.20240115.1", | ||
"description": "An isomorphic client library for the Azure Cognitive Translator Service", | ||
@@ -8,0 +8,0 @@ "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/translation/ai-translation-text-rest/README.md", |
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
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
1076
132539