@azure/communication-phone-numbers 1.3.0-alpha.20230517.1 → 1.3.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -18
- package/dist/index.js +421 -593
- package/dist/index.js.map +1 -1
- package/dist-esm/src/generated/src/index.js +1 -0
- package/dist-esm/src/generated/src/index.js.map +1 -1
- package/dist-esm/src/generated/src/lroImpl.js +11 -15
- package/dist-esm/src/generated/src/lroImpl.js.map +1 -1
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +110 -0
- package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/models/parameters.js +6 -2
- package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/operations/phoneNumbers.js +155 -76
- package/dist-esm/src/generated/src/operations/phoneNumbers.js.map +1 -1
- package/dist-esm/src/generated/src/operationsInterfaces/phoneNumbers.js.map +1 -1
- package/dist-esm/src/generated/src/pagingHelper.js +32 -0
- package/dist-esm/src/generated/src/pagingHelper.js.map +1 -0
- package/dist-esm/src/generated/src/phoneNumbersClient.js +4 -22
- package/dist-esm/src/generated/src/phoneNumbersClient.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/models/index.js +1 -6
- package/dist-esm/src/generated/src/siprouting/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/models/mappers.js +0 -166
- package/dist-esm/src/generated/src/siprouting/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/models/parameters.js +2 -48
- package/dist-esm/src/generated/src/siprouting/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/operations/sipRouting.js +1 -35
- package/dist-esm/src/generated/src/siprouting/operations/sipRouting.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/operationsInterfaces/sipRouting.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js +2 -2
- package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js.map +1 -1
- package/dist-esm/src/generated/src/tracing.js +1 -1
- package/dist-esm/src/generated/src/tracing.js.map +1 -1
- package/dist-esm/src/mappers.js +3 -31
- package/dist-esm/src/mappers.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/phoneNumbersClient.js +16 -3
- package/dist-esm/src/phoneNumbersClient.js.map +1 -1
- package/dist-esm/src/sipRoutingClient.js +63 -170
- package/dist-esm/src/sipRoutingClient.js.map +1 -1
- package/dist-esm/src/utils/constants.js +1 -1
- package/dist-esm/src/utils/constants.js.map +1 -1
- package/package.json +1 -2
- package/types/communication-phone-numbers.d.ts +53 -111
@@ -2,12 +2,12 @@
|
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
/// <reference lib="esnext.asynciterable" />
|
4
4
|
import { __rest } from "tslib";
|
5
|
+
import { createCommunicationAuthPolicy, isKeyCredential, parseClientArguments, } from "@azure/communication-common";
|
6
|
+
import { isTokenCredential } from "@azure/core-auth";
|
7
|
+
import { PhoneNumbersClient as PhoneNumbersGeneratedClient } from "./generated/src";
|
5
8
|
import { createPhoneNumbersPagingPolicy } from "./utils/customPipelinePolicies";
|
6
9
|
import { logger } from "./utils";
|
7
|
-
import { PhoneNumbersClient as PhoneNumbersGeneratedClient } from "./generated/src";
|
8
10
|
import { tracingClient } from "./generated/src/tracing";
|
9
|
-
import { createCommunicationAuthPolicy, isKeyCredential, parseClientArguments, } from "@azure/communication-common";
|
10
|
-
import { isTokenCredential } from "@azure/core-auth";
|
11
11
|
const isPhoneNumbersClientOptions = (options) => options && !isKeyCredential(options) && !isTokenCredential(options);
|
12
12
|
/**
|
13
13
|
* Client class for interacting with Azure Communication Services Phone Number Administration.
|
@@ -330,5 +330,18 @@ export class PhoneNumbersClient {
|
|
330
330
|
span.end();
|
331
331
|
}
|
332
332
|
}
|
333
|
+
/**
|
334
|
+
* Search for operator information about specified phone numbers.
|
335
|
+
*
|
336
|
+
* @param phoneNumbers - The phone numbers to search.
|
337
|
+
* @param options - Additional request options.
|
338
|
+
*/
|
339
|
+
searchOperatorInformation(phoneNumbers, options = {}) {
|
340
|
+
return tracingClient.withSpan("PhoneNumbersClient-searchOperatorInformation", options, (updatedOptions) => {
|
341
|
+
const params = updatedOptions;
|
342
|
+
params.phoneNumbers = phoneNumbers;
|
343
|
+
return this.client.phoneNumbers.operatorInformationSearch(params);
|
344
|
+
});
|
345
|
+
}
|
333
346
|
}
|
334
347
|
//# sourceMappingURL=phoneNumbersClient.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"phoneNumbersClient.js","sourceRoot":"","sources":["../../src/phoneNumbersClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;AAG5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,kBAAkB,IAAI,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAkC,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAwCrF,MAAM,2BAA2B,GAAG,CAAC,OAAY,EAAwC,EAAE,CACzF,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAoC7B,YACE,qBAA6B,EAC7B,mBAAiF,EACjF,eAA0C,EAAE;QAE5C,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,oBAAoB,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;QAC7F,MAAM,OAAO,GAAG,2BAA2B,CAAC,mBAAmB,CAAC;YAC9D,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAA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nB,UAAgC,EAAE;QAElC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,kCAAkC,EAClC,OAAO,CACR,CAAC;QAEF,IAAI;YACF,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,WAAW,oBACpD,cAAc,EACjB,CAAC;SACJ;QAAC,OAAO,CAAM,EAAE;YACf,IAAI,CAAC,SAAS,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YAEH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { CommonClientOptions } from \"@azure/core-client\";\nimport { createPhoneNumbersPagingPolicy } from \"./utils/customPipelinePolicies\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./utils\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { PhoneNumbersClient as PhoneNumbersGeneratedClient } from \"./generated/src\";\nimport { tracingClient } from \"./generated/src/tracing\";\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport {\n PhoneNumberAreaCode,\n PhoneNumberCapabilitiesRequest,\n PhoneNumberCountry,\n PhoneNumberLocality,\n PhoneNumberOffering,\n PhoneNumberSearchResult,\n PurchasedPhoneNumber,\n} from \"./generated/src/models/\";\nimport {\n GetPurchasedPhoneNumberOptions,\n ListAvailableCountriesOptions,\n ListGeographicAreaCodesOptions,\n ListLocalitiesOptions,\n ListOfferingsOptions,\n ListPurchasedPhoneNumbersOptions,\n ListTollFreeAreaCodesOptions,\n PurchasePhoneNumbersResult,\n ReleasePhoneNumberResult,\n SearchAvailablePhoneNumbersRequest,\n} from \"./models\";\nimport {\n BeginPurchasePhoneNumbersOptions,\n BeginReleasePhoneNumberOptions,\n BeginSearchAvailablePhoneNumbersOptions,\n BeginUpdatePhoneNumberCapabilitiesOptions,\n} from \"./lroModels\";\n\n/**\n * Client options used to configure the PhoneNumbersClient API requests.\n */\nexport interface PhoneNumbersClientOptions extends CommonClientOptions {\n /**\n * The accept language parameter to be used in the request header's \"accept-language\" property.\n */\n acceptLanguage?: string;\n}\n\nconst isPhoneNumbersClientOptions = (options: any): options is PhoneNumbersClientOptions =>\n options && !isKeyCredential(options) && !isTokenCredential(options);\n\n/**\n * Client class for interacting with Azure Communication Services Phone Number Administration.\n */\nexport class PhoneNumbersClient {\n /**\n * A reference to the auto-generated PhoneNumber HTTP client.\n */\n private readonly client: PhoneNumbersGeneratedClient;\n\n /**\n * The accept language parameter to be used in the request header's \"accept-language\" property.\n */\n private acceptLanguage: string | undefined;\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using a connection string.\n *\n * @param connectionString - Connection string to connect to an Azure Communication Service resource. (eg: endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret)\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(connectionString: string, options?: PhoneNumbersClientOptions);\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using an Azure KeyCredential.\n *\n * @param url - The endpoint of the service (eg: https://contoso.eastus.communications.azure.net)\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(url: string, credential: KeyCredential, options?: PhoneNumbersClientOptions);\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using a TokenCredential.\n * @param url - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential that is used to authenticate requests to the service.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(url: string, credential: TokenCredential, options?: PhoneNumbersClientOptions);\n\n public constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | PhoneNumbersClientOptions,\n maybeOptions: PhoneNumbersClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isPhoneNumbersClientOptions(credentialOrOptions)\n ? credentialOrOptions\n : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new PhoneNumbersGeneratedClient(url, {\n endpoint: url,\n ...internalPipelineOptions,\n });\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.client.pipeline.addPolicy(authPolicy);\n\n // This policy is temporary workarounds to address compatibility issues with Azure Core V2.\n const phoneNumbersPagingPolicy = createPhoneNumbersPagingPolicy(url);\n this.client.pipeline.addPolicy(phoneNumbersPagingPolicy);\n this.acceptLanguage = maybeOptions.acceptLanguage;\n }\n\n /**\n * Gets the details of a purchased phone number. Includes phone number, cost, country code, etc.\n *\n * @param phoneNumber - The E.164 formatted phone number being fetched. The leading plus can be either + or encoded as %2B.\n * @param options - Additional request options.\n */\n public getPurchasedPhoneNumber(\n phoneNumber: string,\n options: GetPurchasedPhoneNumberOptions = {}\n ): Promise<PurchasedPhoneNumber> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-getPurchasedPhoneNumber\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.getByNumber(phoneNumber, {\n ...updatedOptions,\n });\n }\n );\n }\n\n /**\n * Iterates the purchased phone numbers.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const purchased of client.listPhoneNumbers()) {\n * console.log(\"phone number: \", purchased.phoneNumber);\n * }\n * ```\n * List all purchased phone numbers.\n * @param options - The optional parameters.\n */\n public listPurchasedPhoneNumbers(\n options: ListPurchasedPhoneNumbersOptions = {}\n ): PagedAsyncIterableIterator<PurchasedPhoneNumber> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listPurchasedPhoneNumbers\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listPhoneNumbers({\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Starts the release of a purchased phone number.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const releasePoller = await client.beginReleasePhoneNumber(\"+14125550100\");\n *\n * // Serializing the poller\n * const serialized = releasePoller.toString();\n *\n * // Waiting until it's done\n * const results = await releasePoller.pollUntilDone();\n * console.log(results);\n * ```\n * @param phoneNumber - The E.164 formatted phone number being released. The leading plus can be either + or encoded as %2B.\n * @param options - Additional request options.\n */\n public beginReleasePhoneNumber(\n phoneNumber: string,\n options: BeginReleasePhoneNumberOptions = {}\n ): Promise<PollerLike<PollOperationState<ReleasePhoneNumberResult>, ReleasePhoneNumberResult>> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginReleasePhoneNumber\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginReleasePhoneNumber(phoneNumber, updatedOptions);\n }\n );\n }\n\n /**\n * Starts a search for phone numbers given some constraints such as name or area code.\n * The phone numbers that are found are reserved until you cancel, purchase or the reservation expires.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumberAdministrationClient(CONNECTION_STRING);\n * const searchPoller = await client.beginSearchAvailablePhoneNumbers(SEARCH_REQUEST);\n *\n * // Serializing the poller\n * const serialized = searchPoller.toString();\n *\n * // Waiting until it's done\n * const results = await searchPoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param search - Request properties to constraint the search scope.\n * @param options - Additional request options.\n */\n public beginSearchAvailablePhoneNumbers(\n search: SearchAvailablePhoneNumbersRequest,\n options: BeginSearchAvailablePhoneNumbersOptions = {}\n ): Promise<PollerLike<PollOperationState<PhoneNumberSearchResult>, PhoneNumberSearchResult>> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginSearchAvailablePhoneNumbers\",\n options,\n (updatedOptions) => {\n const { countryCode, phoneNumberType, assignmentType, capabilities, ...rest } = search;\n return this.client.phoneNumbers.beginSearchAvailablePhoneNumbers(\n countryCode,\n phoneNumberType,\n assignmentType,\n capabilities,\n {\n ...updatedOptions,\n ...rest,\n }\n );\n }\n );\n }\n\n /**\n * Starts the purchase of the phone number(s) in the search associated with a given id.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const purchasePoller = await client.beginPurchasePhoneNumbers(SEARCH_ID);\n *\n * // Serializing the poller\n * const serialized = purchasePoller.toString();\n *\n * // Waiting until it's done\n * const results = await purchasePoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param searchId - The id of the search to purchase. Returned from `beginSearchAvailablePhoneNumbers`\n * @param options - Additional request options.\n */\n public beginPurchasePhoneNumbers(\n searchId: string,\n options: BeginPurchasePhoneNumbersOptions = {}\n ): Promise<\n PollerLike<PollOperationState<PurchasePhoneNumbersResult>, PurchasePhoneNumbersResult>\n > {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginPurchasePhoneNumbers\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginPurchasePhoneNumbers({ ...updatedOptions, searchId });\n }\n );\n }\n\n /**\n * Starts the update of a purchased phone number's capabilities.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const updatePoller = await client.beginUpdatePhoneNumberCapabilities(\"+14125550100\", UPDATE_REQUEST);\n *\n * // Serializing the poller\n * const serialized = updatePoller.toString();\n *\n * // Waiting until it's done\n * const results = await updatePoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param phoneNumber - The E.164 formatted phone number being updated. The leading plus can be either + or encoded as %2B.\n * @param request - The updated properties which will be applied to the phone number.\n * @param options - Additional request options.\n */\n public beginUpdatePhoneNumberCapabilities(\n phoneNumber: string,\n request: PhoneNumberCapabilitiesRequest,\n options: BeginUpdatePhoneNumberCapabilitiesOptions = {}\n ): Promise<PollerLike<PollOperationState<PurchasedPhoneNumber>, PurchasedPhoneNumber>> {\n if (!phoneNumber) {\n throw Error(\"phone number can't be empty\");\n }\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginUpdatePhoneNumberCapabilities\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginUpdateCapabilities(phoneNumber, {\n ...updatedOptions,\n ...request,\n });\n }\n );\n }\n\n /**\n * Iterates the available countries.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const country of client.listAvailableCountries()) {\n * console.log(\"country: \", country.localizedName);\n * }\n * ```\n * List all available countries.\n * @param options - The optional parameters.\n */\n public listAvailableCountries(\n options: ListAvailableCountriesOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberCountry> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableCountries\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listAvailableCountries({\n ...updatedOptions,\n acceptLanguage: this.acceptLanguage,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available Toll-Free area codes.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const areaCodeItem of client.listTollFreeAreaCodes()) {\n * console.log(\"area code: \", areaCodeItem.areaCode);\n * }\n * ```\n * List all available Toll-Free area codes.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableTollFreeAreaCodes(\n countryCode: string,\n options: ListTollFreeAreaCodesOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberAreaCode> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableTollFreeAreaCodes\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listAreaCodes(countryCode, \"tollFree\", {\n ...updatedOptions,\n assignmentType: \"application\",\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available Geographic area codes.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const areaCodeItem of client.listGeographicAreaCodes()) {\n * console.log(\"area code: \", areaCodeItem.areaCode);\n * }\n * ```\n * List all available Geographic area codes.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableGeographicAreaCodes(\n countryCode: string,\n options: ListGeographicAreaCodesOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberAreaCode> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableGeographicFreeAreaCodes\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listAreaCodes(countryCode, \"geographic\", {\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available localities.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const locality of client.listAvailableLocalities()) {\n * console.log(\"locality: \", locality.localizedName);\n * }\n * ```\n * List all available localities.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableLocalities(\n countryCode: string,\n options: ListLocalitiesOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberLocality> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableLocalities\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listAvailableLocalities(countryCode, {\n ...updatedOptions,\n acceptLanguage: this.acceptLanguage,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available offerings.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const offering of client.listAvailableOfferings()) {\n * console.log(\"phone number type: \", offering.phoneNumberType);\n * console.log(\"cost: \", offering.cost.amount);\n * }\n * ```\n * List all available offerings.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableOfferings(\n countryCode: string,\n options: ListOfferingsOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberOffering> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listOfferings\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listOfferings(countryCode, {\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"phoneNumbersClient.js","sourceRoot":"","sources":["../../src/phoneNumbersClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;AAE5C,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAkC,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrF,OAAO,EAAE,kBAAkB,IAAI,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AA+BpF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAYxD,MAAM,2BAA2B,GAAG,CAAC,OAAY,EAAwC,EAAE,CACzF,OAA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MAAM,CAAC,YAAY,CAAC,uBAAuB,CAAC,WAAW,kCAC9D,cAAc,KACjB,cAAc,EAAE,IAAI,CAAC,cAAc,IACnC,CAAC;SACJ;QAAC,OAAO,CAAM,EAAE;YACf,IAAI,CAAC,SAAS,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YAEH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACI,sBAAsB,CAC3B,WAAmB,EACnB,UAAgC,EAAE;QAElC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,kCAAkC,EAClC,OAAO,CACR,CAAC;QAEF,IAAI;YACF,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,WAAW,oBACpD,cAAc,EACjB,CAAC;SACJ;QAAC,OAAO,CAAM,EAAE;YACf,IAAI,CAAC,SAAS,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YAEH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;IAED;;;;;OAKG;IACI,yBAAyB,CAC9B,YAAsB,EACtB,UAA4C,EAAE;QAE9C,OAAO,aAAa,CAAC,QAAQ,CAC3B,8CAA8C,EAC9C,OAAO,EACP,CAAC,cAAc,EAAE,EAAE;YACjB,MAAM,MAAM,GAAwD,cAAc,CAAC;YACnF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;YACnC,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC;QACpE,CAAC,CACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { PhoneNumbersClient as PhoneNumbersGeneratedClient } from \"./generated/src\";\nimport {\n OperatorInformationResult,\n PhoneNumberAreaCode,\n PhoneNumberCapabilitiesRequest,\n PhoneNumberCountry,\n PhoneNumberLocality,\n PhoneNumberOffering,\n PhoneNumberSearchResult,\n PhoneNumbersOperatorInformationSearchOptionalParams,\n PurchasedPhoneNumber,\n} from \"./generated/src/models/\";\nimport {\n GetPurchasedPhoneNumberOptions,\n ListAvailableCountriesOptions,\n ListGeographicAreaCodesOptions,\n ListLocalitiesOptions,\n ListOfferingsOptions,\n ListPurchasedPhoneNumbersOptions,\n ListTollFreeAreaCodesOptions,\n PurchasePhoneNumbersResult,\n ReleasePhoneNumberResult,\n SearchAvailablePhoneNumbersRequest,\n SearchOperatorInformationOptions,\n} from \"./models\";\nimport {\n BeginPurchasePhoneNumbersOptions,\n BeginReleasePhoneNumberOptions,\n BeginSearchAvailablePhoneNumbersOptions,\n BeginUpdatePhoneNumberCapabilitiesOptions,\n} from \"./lroModels\";\nimport { createPhoneNumbersPagingPolicy } from \"./utils/customPipelinePolicies\";\nimport { CommonClientOptions } from \"@azure/core-client\";\nimport { logger } from \"./utils\";\nimport { tracingClient } from \"./generated/src/tracing\";\n\n/**\n * Client options used to configure the PhoneNumbersClient API requests.\n */\nexport interface PhoneNumbersClientOptions extends CommonClientOptions {\n /**\n * The accept language parameter to be used in the request header's \"accept-language\" property.\n */\n acceptLanguage?: string;\n}\n\nconst isPhoneNumbersClientOptions = (options: any): options is PhoneNumbersClientOptions =>\n options && !isKeyCredential(options) && !isTokenCredential(options);\n\n/**\n * Client class for interacting with Azure Communication Services Phone Number Administration.\n */\nexport class PhoneNumbersClient {\n /**\n * A reference to the auto-generated PhoneNumber HTTP client.\n */\n private readonly client: PhoneNumbersGeneratedClient;\n\n /**\n * The accept language parameter to be used in the request header's \"accept-language\" property.\n */\n private acceptLanguage: string | undefined;\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using a connection string.\n *\n * @param connectionString - Connection string to connect to an Azure Communication Service resource. (eg: endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret)\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(connectionString: string, options?: PhoneNumbersClientOptions);\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using an Azure KeyCredential.\n *\n * @param url - The endpoint of the service (eg: https://contoso.eastus.communications.azure.net)\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(url: string, credential: KeyCredential, options?: PhoneNumbersClientOptions);\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using a TokenCredential.\n * @param url - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential that is used to authenticate requests to the service.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(url: string, credential: TokenCredential, options?: PhoneNumbersClientOptions);\n\n public constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | PhoneNumbersClientOptions,\n maybeOptions: PhoneNumbersClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isPhoneNumbersClientOptions(credentialOrOptions)\n ? credentialOrOptions\n : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new PhoneNumbersGeneratedClient(url, {\n endpoint: url,\n ...internalPipelineOptions,\n });\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.client.pipeline.addPolicy(authPolicy);\n\n // This policy is temporary workarounds to address compatibility issues with Azure Core V2.\n const phoneNumbersPagingPolicy = createPhoneNumbersPagingPolicy(url);\n this.client.pipeline.addPolicy(phoneNumbersPagingPolicy);\n this.acceptLanguage = maybeOptions.acceptLanguage;\n }\n\n /**\n * Gets the details of a purchased phone number. Includes phone number, cost, country code, etc.\n *\n * @param phoneNumber - The E.164 formatted phone number being fetched. The leading plus can be either + or encoded as %2B.\n * @param options - Additional request options.\n */\n public getPurchasedPhoneNumber(\n phoneNumber: string,\n options: GetPurchasedPhoneNumberOptions = {}\n ): Promise<PurchasedPhoneNumber> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-getPurchasedPhoneNumber\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.getByNumber(phoneNumber, {\n ...updatedOptions,\n });\n }\n );\n }\n\n /**\n * Iterates the purchased phone numbers.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const purchased of client.listPhoneNumbers()) {\n * console.log(\"phone number: \", purchased.phoneNumber);\n * }\n * ```\n * List all purchased phone numbers.\n * @param options - The optional parameters.\n */\n public listPurchasedPhoneNumbers(\n options: ListPurchasedPhoneNumbersOptions = {}\n ): PagedAsyncIterableIterator<PurchasedPhoneNumber> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listPurchasedPhoneNumbers\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listPhoneNumbers({\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Starts the release of a purchased phone number.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const releasePoller = await client.beginReleasePhoneNumber(\"+14125550100\");\n *\n * // Serializing the poller\n * const serialized = releasePoller.toString();\n *\n * // Waiting until it's done\n * const results = await releasePoller.pollUntilDone();\n * console.log(results);\n * ```\n * @param phoneNumber - The E.164 formatted phone number being released. The leading plus can be either + or encoded as %2B.\n * @param options - Additional request options.\n */\n public beginReleasePhoneNumber(\n phoneNumber: string,\n options: BeginReleasePhoneNumberOptions = {}\n ): Promise<PollerLike<PollOperationState<ReleasePhoneNumberResult>, ReleasePhoneNumberResult>> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginReleasePhoneNumber\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginReleasePhoneNumber(phoneNumber, updatedOptions);\n }\n );\n }\n\n /**\n * Starts a search for phone numbers given some constraints such as name or area code.\n * The phone numbers that are found are reserved until you cancel, purchase or the reservation expires.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumberAdministrationClient(CONNECTION_STRING);\n * const searchPoller = await client.beginSearchAvailablePhoneNumbers(SEARCH_REQUEST);\n *\n * // Serializing the poller\n * const serialized = searchPoller.toString();\n *\n * // Waiting until it's done\n * const results = await searchPoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param search - Request properties to constraint the search scope.\n * @param options - Additional request options.\n */\n public beginSearchAvailablePhoneNumbers(\n search: SearchAvailablePhoneNumbersRequest,\n options: BeginSearchAvailablePhoneNumbersOptions = {}\n ): Promise<PollerLike<PollOperationState<PhoneNumberSearchResult>, PhoneNumberSearchResult>> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginSearchAvailablePhoneNumbers\",\n options,\n (updatedOptions) => {\n const { countryCode, phoneNumberType, assignmentType, capabilities, ...rest } = search;\n return this.client.phoneNumbers.beginSearchAvailablePhoneNumbers(\n countryCode,\n phoneNumberType,\n assignmentType,\n capabilities,\n {\n ...updatedOptions,\n ...rest,\n }\n );\n }\n );\n }\n\n /**\n * Starts the purchase of the phone number(s) in the search associated with a given id.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const purchasePoller = await client.beginPurchasePhoneNumbers(SEARCH_ID);\n *\n * // Serializing the poller\n * const serialized = purchasePoller.toString();\n *\n * // Waiting until it's done\n * const results = await purchasePoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param searchId - The id of the search to purchase. Returned from `beginSearchAvailablePhoneNumbers`\n * @param options - Additional request options.\n */\n public beginPurchasePhoneNumbers(\n searchId: string,\n options: BeginPurchasePhoneNumbersOptions = {}\n ): Promise<\n PollerLike<PollOperationState<PurchasePhoneNumbersResult>, PurchasePhoneNumbersResult>\n > {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginPurchasePhoneNumbers\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginPurchasePhoneNumbers({ ...updatedOptions, searchId });\n }\n );\n }\n\n /**\n * Starts the update of a purchased phone number's capabilities.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const updatePoller = await client.beginUpdatePhoneNumberCapabilities(\"+14125550100\", UPDATE_REQUEST);\n *\n * // Serializing the poller\n * const serialized = updatePoller.toString();\n *\n * // Waiting until it's done\n * const results = await updatePoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param phoneNumber - The E.164 formatted phone number being updated. The leading plus can be either + or encoded as %2B.\n * @param request - The updated properties which will be applied to the phone number.\n * @param options - Additional request options.\n */\n public beginUpdatePhoneNumberCapabilities(\n phoneNumber: string,\n request: PhoneNumberCapabilitiesRequest,\n options: BeginUpdatePhoneNumberCapabilitiesOptions = {}\n ): Promise<PollerLike<PollOperationState<PurchasedPhoneNumber>, PurchasedPhoneNumber>> {\n if (!phoneNumber) {\n throw Error(\"phone number can't be empty\");\n }\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginUpdatePhoneNumberCapabilities\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginUpdateCapabilities(phoneNumber, {\n ...updatedOptions,\n ...request,\n });\n }\n );\n }\n\n /**\n * Iterates the available countries.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const country of client.listAvailableCountries()) {\n * console.log(\"country: \", country.localizedName);\n * }\n * ```\n * List all available countries.\n * @param options - The optional parameters.\n */\n public listAvailableCountries(\n options: ListAvailableCountriesOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberCountry> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableCountries\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listAvailableCountries({\n ...updatedOptions,\n acceptLanguage: this.acceptLanguage,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available Toll-Free area codes.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const areaCodeItem of client.listTollFreeAreaCodes()) {\n * console.log(\"area code: \", areaCodeItem.areaCode);\n * }\n * ```\n * List all available Toll-Free area codes.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableTollFreeAreaCodes(\n countryCode: string,\n options: ListTollFreeAreaCodesOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberAreaCode> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableTollFreeAreaCodes\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listAreaCodes(countryCode, \"tollFree\", {\n ...updatedOptions,\n assignmentType: \"application\",\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available Geographic area codes.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const areaCodeItem of client.listGeographicAreaCodes()) {\n * console.log(\"area code: \", areaCodeItem.areaCode);\n * }\n * ```\n * List all available Geographic area codes.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableGeographicAreaCodes(\n countryCode: string,\n options: ListGeographicAreaCodesOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberAreaCode> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableGeographicFreeAreaCodes\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listAreaCodes(countryCode, \"geographic\", {\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available localities.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const locality of client.listAvailableLocalities()) {\n * console.log(\"locality: \", locality.localizedName);\n * }\n * ```\n * List all available localities.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableLocalities(\n countryCode: string,\n options: ListLocalitiesOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberLocality> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableLocalities\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listAvailableLocalities(countryCode, {\n ...updatedOptions,\n acceptLanguage: this.acceptLanguage,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available offerings.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const offering of client.listAvailableOfferings()) {\n * console.log(\"phone number type: \", offering.phoneNumberType);\n * console.log(\"cost: \", offering.cost.amount);\n * }\n * ```\n * List all available offerings.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableOfferings(\n countryCode: string,\n options: ListOfferingsOptions = {}\n ): PagedAsyncIterableIterator<PhoneNumberOffering> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listOfferings\",\n options\n );\n\n try {\n return this.client.phoneNumbers.listOfferings(countryCode, {\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Search for operator information about specified phone numbers.\n *\n * @param phoneNumbers - The phone numbers to search.\n * @param options - Additional request options.\n */\n public searchOperatorInformation(\n phoneNumbers: string[],\n options: SearchOperatorInformationOptions = {}\n ): Promise<OperatorInformationResult> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-searchOperatorInformation\",\n options,\n (updatedOptions) => {\n const params: PhoneNumbersOperatorInformationSearchOptionalParams = updatedOptions;\n params.phoneNumbers = phoneNumbers;\n return this.client.phoneNumbers.operatorInformationSearch(params);\n }\n );\n }\n}\n"]}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await
|
3
|
+
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
4
4
|
import { createCommunicationAuthPolicy, isKeyCredential, parseClientArguments, } from "@azure/communication-common";
|
5
5
|
import { isTokenCredential } from "@azure/core-auth";
|
6
|
-
import { SipRoutingClient as SipRoutingGeneratedClient } from "./generated/src/siprouting/sipRoutingClient";
|
7
|
-
import { transformFromRestModel, transformIntoRestModel, transformDomainsFromRestModel, transformDomainsIntoRestModel, } from "./mappers";
|
8
6
|
import { logger } from "./utils";
|
7
|
+
import { SipRoutingClient as SipRoutingGeneratedClient } from "./generated/src/siprouting/sipRoutingClient";
|
8
|
+
import { transformFromRestModel, transformIntoRestModel } from "./mappers";
|
9
9
|
import { tracingClient } from "./generated/src/tracing";
|
10
10
|
export * from "./models";
|
11
11
|
/**
|
@@ -35,18 +35,31 @@ export class SipRoutingClient {
|
|
35
35
|
* @param options - The options parameters.
|
36
36
|
*/
|
37
37
|
listTrunks(options = {}) {
|
38
|
-
const
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
38
|
+
const { span, updatedOptions } = tracingClient.startSpan("SipRoutingClient-listTrunks", options);
|
39
|
+
try {
|
40
|
+
const iter = this.listTrunksPagingAll(Object.assign({}, updatedOptions));
|
41
|
+
return {
|
42
|
+
next() {
|
43
|
+
return iter.next();
|
44
|
+
},
|
45
|
+
[Symbol.asyncIterator]() {
|
46
|
+
return this;
|
47
|
+
},
|
48
|
+
byPage: () => {
|
49
|
+
return this.listTrunksPagingPage(Object.assign({}, updatedOptions));
|
50
|
+
},
|
51
|
+
};
|
52
|
+
}
|
53
|
+
catch (e) {
|
54
|
+
span.setStatus({
|
55
|
+
status: "error",
|
56
|
+
error: e,
|
57
|
+
});
|
58
|
+
throw e;
|
59
|
+
}
|
60
|
+
finally {
|
61
|
+
span.end();
|
62
|
+
}
|
50
63
|
}
|
51
64
|
/**
|
52
65
|
* Gets the SIP trunk.
|
@@ -63,100 +76,36 @@ export class SipRoutingClient {
|
|
63
76
|
throw { code: "NotFound", message: "Not Found" };
|
64
77
|
});
|
65
78
|
}
|
66
|
-
/**
|
67
|
-
* Gets the SIP domains.
|
68
|
-
* @param options - The options parameters.
|
69
|
-
*/
|
70
|
-
listDomains(options = {}) {
|
71
|
-
const iter = this.listDomainsPagingAll(options);
|
72
|
-
return {
|
73
|
-
next() {
|
74
|
-
return iter.next();
|
75
|
-
},
|
76
|
-
[Symbol.asyncIterator]() {
|
77
|
-
return this;
|
78
|
-
},
|
79
|
-
byPage: () => {
|
80
|
-
return this.listDomainsPagingPage(options);
|
81
|
-
},
|
82
|
-
};
|
83
|
-
}
|
84
|
-
/**
|
85
|
-
* Gets the SIP domain.
|
86
|
-
* @param domainName - The domain's name (ex: contoso.com).
|
87
|
-
* @param options - The options parameters.
|
88
|
-
*/
|
89
|
-
async getDomain(domainName, options = {}) {
|
90
|
-
return tracingClient.withSpan("SipRoutingClient-listDomains", options, async (updatedOptions) => {
|
91
|
-
const domains = await this.getDomainsInternal(updatedOptions);
|
92
|
-
const domain = domains.find((value) => value.domainName === domainName);
|
93
|
-
if (domain) {
|
94
|
-
return domain;
|
95
|
-
}
|
96
|
-
throw { code: "NotFound", message: "Not Found" };
|
97
|
-
});
|
98
|
-
}
|
99
79
|
/**
|
100
80
|
* Lists the SIP trunk routes.
|
101
81
|
* @param options - The options parameters.
|
102
82
|
*/
|
103
83
|
listRoutes(options = {}) {
|
104
|
-
const
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
/**
|
118
|
-
* Sets the SIP domains.
|
119
|
-
* @param domains - The SIP domains to be set.
|
120
|
-
* @param options - The options parameters.
|
121
|
-
*/
|
122
|
-
async setDomains(domains, options = {}) {
|
123
|
-
return tracingClient.withSpan("SipRoutingClient-setDomains", options, async (updatedOptions) => {
|
124
|
-
const update = { domains: transformDomainsIntoRestModel(domains) };
|
125
|
-
let config = await this.client.sipRouting.get(updatedOptions);
|
126
|
-
const storedDomains = transformDomainsFromRestModel(config.domains).map((domain) => domain.domainName);
|
127
|
-
const setDomains = domains.map((domain) => domain.domainName);
|
128
|
-
storedDomains.forEach((storedDomain) => {
|
129
|
-
const shouldDeleteStoredDomain = !setDomains.find((value) => value === storedDomain);
|
130
|
-
if (shouldDeleteStoredDomain) {
|
131
|
-
update.domains[storedDomain] = null;
|
132
|
-
}
|
133
|
-
});
|
134
|
-
const isPatchNeeded = Object.keys(update.domains).length > 0;
|
135
|
-
if (isPatchNeeded) {
|
136
|
-
const payload = Object.assign(Object.assign({}, updatedOptions), update);
|
137
|
-
config = await this.client.sipRouting.update(payload);
|
138
|
-
}
|
139
|
-
return transformDomainsFromRestModel(config.domains);
|
140
|
-
});
|
141
|
-
}
|
142
|
-
/**
|
143
|
-
* Sets the SIP domain.
|
144
|
-
* @param domain - The SIP domain to be set.
|
145
|
-
* @param options - The options parameters.
|
146
|
-
*/
|
147
|
-
async setDomain(domain, options = {}) {
|
148
|
-
return tracingClient.withSpan("SipRoutingClient-setDomain", options, async (updatedOptions) => {
|
149
|
-
const update = {
|
150
|
-
domains: transformDomainsIntoRestModel([domain]),
|
84
|
+
const { span, updatedOptions } = tracingClient.startSpan("SipRoutingClient-listRoutes", options);
|
85
|
+
try {
|
86
|
+
const iter = this.listRoutesPagingAll(Object.assign({}, updatedOptions));
|
87
|
+
return {
|
88
|
+
next() {
|
89
|
+
return iter.next();
|
90
|
+
},
|
91
|
+
[Symbol.asyncIterator]() {
|
92
|
+
return this;
|
93
|
+
},
|
94
|
+
byPage: () => {
|
95
|
+
return this.listRoutesPagingPage(Object.assign({}, updatedOptions));
|
96
|
+
},
|
151
97
|
};
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
}
|
158
|
-
throw
|
159
|
-
}
|
98
|
+
}
|
99
|
+
catch (e) {
|
100
|
+
span.setStatus({
|
101
|
+
status: "error",
|
102
|
+
error: e,
|
103
|
+
});
|
104
|
+
throw e;
|
105
|
+
}
|
106
|
+
finally {
|
107
|
+
span.end();
|
108
|
+
}
|
160
109
|
}
|
161
110
|
/**
|
162
111
|
* Sets the SIP trunks.
|
@@ -165,19 +114,19 @@ export class SipRoutingClient {
|
|
165
114
|
*/
|
166
115
|
async setTrunks(trunks, options = {}) {
|
167
116
|
return tracingClient.withSpan("SipRoutingClient-setTrunks", options, async (updatedOptions) => {
|
168
|
-
const
|
117
|
+
const patch = { trunks: transformIntoRestModel(trunks) };
|
169
118
|
let config = await this.client.sipRouting.get(updatedOptions);
|
170
119
|
const storedFqdns = transformFromRestModel(config.trunks).map((trunk) => trunk.fqdn);
|
171
120
|
const setFqdns = trunks.map((trunk) => trunk.fqdn);
|
172
121
|
storedFqdns.forEach((storedFqdn) => {
|
173
122
|
const shouldDeleteStoredTrunk = !setFqdns.find((value) => value === storedFqdn);
|
174
123
|
if (shouldDeleteStoredTrunk) {
|
175
|
-
|
124
|
+
patch.trunks[storedFqdn] = null;
|
176
125
|
}
|
177
126
|
});
|
178
|
-
const isPatchNeeded = Object.keys(
|
127
|
+
const isPatchNeeded = Object.keys(patch.trunks).length > 0;
|
179
128
|
if (isPatchNeeded) {
|
180
|
-
const payload = Object.assign(Object.assign({}, updatedOptions),
|
129
|
+
const payload = Object.assign(Object.assign({}, updatedOptions), patch);
|
181
130
|
config = await this.client.sipRouting.update(payload);
|
182
131
|
}
|
183
132
|
return transformFromRestModel(config.trunks);
|
@@ -190,10 +139,10 @@ export class SipRoutingClient {
|
|
190
139
|
*/
|
191
140
|
async setTrunk(trunk, options = {}) {
|
192
141
|
return tracingClient.withSpan("SipRoutingClient-setTrunk", options, async (updatedOptions) => {
|
193
|
-
const
|
142
|
+
const patch = {
|
194
143
|
trunks: transformIntoRestModel([trunk]),
|
195
144
|
};
|
196
|
-
const payload = Object.assign(Object.assign({}, updatedOptions),
|
145
|
+
const payload = Object.assign(Object.assign({}, updatedOptions), patch);
|
197
146
|
const config = await this.client.sipRouting.update(payload);
|
198
147
|
const storedTrunk = transformFromRestModel(config.trunks).find((value) => value.fqdn === trunk.fqdn);
|
199
148
|
if (storedTrunk) {
|
@@ -209,10 +158,10 @@ export class SipRoutingClient {
|
|
209
158
|
*/
|
210
159
|
async setRoutes(routes, options = {}) {
|
211
160
|
return tracingClient.withSpan("SipRoutingClient-setRoutes", options, async (updatedOptions) => {
|
212
|
-
const
|
161
|
+
const patch = {
|
213
162
|
routes: routes,
|
214
163
|
};
|
215
|
-
const payload = Object.assign(Object.assign({}, updatedOptions),
|
164
|
+
const payload = Object.assign(Object.assign({}, updatedOptions), patch);
|
216
165
|
const config = await this.client.sipRouting.update(payload);
|
217
166
|
const storedRoutes = config.routes || (await this.getRoutesInternal(updatedOptions));
|
218
167
|
return storedRoutes;
|
@@ -227,26 +176,10 @@ export class SipRoutingClient {
|
|
227
176
|
return tracingClient.withSpan("SipRoutingClient-deleteTrunk", options, async (updatedOptions) => {
|
228
177
|
const trunks = {};
|
229
178
|
trunks[fqdn] = null;
|
230
|
-
const
|
179
|
+
const patch = {
|
231
180
|
trunks: trunks,
|
232
181
|
};
|
233
|
-
const payload = Object.assign(Object.assign({}, updatedOptions),
|
234
|
-
await this.client.sipRouting.update(payload);
|
235
|
-
});
|
236
|
-
}
|
237
|
-
/**
|
238
|
-
* Deletes the SIP domain.
|
239
|
-
* @param domainName - The domain's name (ex: contoso.com).
|
240
|
-
* @param options - The options parameters.
|
241
|
-
*/
|
242
|
-
async deleteDomain(domainName, options = {}) {
|
243
|
-
return tracingClient.withSpan("SipRoutingClient-deleteDomain", options, async (updatedOptions) => {
|
244
|
-
const domains = {};
|
245
|
-
domains[domainName] = null;
|
246
|
-
const update = {
|
247
|
-
domains: domains,
|
248
|
-
};
|
249
|
-
const payload = Object.assign(Object.assign({}, updatedOptions), update);
|
182
|
+
const payload = Object.assign(Object.assign({}, updatedOptions), patch);
|
250
183
|
await this.client.sipRouting.update(payload);
|
251
184
|
});
|
252
185
|
}
|
@@ -255,17 +188,8 @@ export class SipRoutingClient {
|
|
255
188
|
return config.routes || [];
|
256
189
|
}
|
257
190
|
async getTrunksInternal(options) {
|
258
|
-
const { includeHealth } = options, requestOptions = __rest(options, ["includeHealth"]);
|
259
|
-
let updatedOptions = requestOptions;
|
260
|
-
if (includeHealth) {
|
261
|
-
updatedOptions = Object.assign(Object.assign({}, requestOptions), { expand: "trunks/health" });
|
262
|
-
}
|
263
|
-
const config = await this.client.sipRouting.get(updatedOptions);
|
264
|
-
return transformFromRestModel(config.trunks);
|
265
|
-
}
|
266
|
-
async getDomainsInternal(options = {}) {
|
267
191
|
const config = await this.client.sipRouting.get(options);
|
268
|
-
return
|
192
|
+
return transformFromRestModel(config.trunks);
|
269
193
|
}
|
270
194
|
listRoutesPagingAll(options) {
|
271
195
|
return __asyncGenerator(this, arguments, function* listRoutesPagingAll_1() {
|
@@ -317,43 +241,12 @@ export class SipRoutingClient {
|
|
317
241
|
}
|
318
242
|
});
|
319
243
|
}
|
320
|
-
listDomainsPagingAll(options) {
|
321
|
-
return __asyncGenerator(this, arguments, function* listDomainsPagingAll_1() {
|
322
|
-
var _a, e_3, _b, _c;
|
323
|
-
try {
|
324
|
-
for (var _d = true, _e = __asyncValues(this.listDomainsPagingPage(options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
325
|
-
_c = _f.value;
|
326
|
-
_d = false;
|
327
|
-
try {
|
328
|
-
const page = _c;
|
329
|
-
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
330
|
-
}
|
331
|
-
finally {
|
332
|
-
_d = true;
|
333
|
-
}
|
334
|
-
}
|
335
|
-
}
|
336
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
337
|
-
finally {
|
338
|
-
try {
|
339
|
-
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
340
|
-
}
|
341
|
-
finally { if (e_3) throw e_3.error; }
|
342
|
-
}
|
343
|
-
});
|
344
|
-
}
|
345
244
|
listTrunksPagingPage(options = {}) {
|
346
245
|
return __asyncGenerator(this, arguments, function* listTrunksPagingPage_1() {
|
347
246
|
const apiResult = yield __await(this.getTrunksInternal(options));
|
348
247
|
yield yield __await(apiResult);
|
349
248
|
});
|
350
249
|
}
|
351
|
-
listDomainsPagingPage(options = {}) {
|
352
|
-
return __asyncGenerator(this, arguments, function* listDomainsPagingPage_1() {
|
353
|
-
const apiResult = yield __await(this.getDomainsInternal(options));
|
354
|
-
yield yield __await(apiResult);
|
355
|
-
});
|
356
|
-
}
|
357
250
|
listRoutesPagingPage(options = {}) {
|
358
251
|
return __asyncGenerator(this, arguments, function* listRoutesPagingPage_1() {
|
359
252
|
const apiResult = yield __await(this.getRoutesInternal(options));
|
@@ -1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AClB,CAAC;KAAA;IAEc,oBAAoB,CACjC,UAAgC,EAAE;;YAElC,MAAM,SAAS,GAAG,cAAM,IAAI,CAAC,iBAAiB,CAAC,OAA2B,CAAC,CAAA,CAAC;YAC5E,oBAAM,SAAS,CAAA,CAAC;QAClB,CAAC;KAAA;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { SipRoutingClient as SipRoutingGeneratedClient } from \"./generated/src/siprouting/sipRoutingClient\";\nimport {\n SipConfigurationUpdate,\n SipRoutingError,\n SipRoutingGetOptionalParams,\n} from \"./generated/src/siprouting/models\";\nimport {\n GetSipTrunkOptions,\n ListSipRoutesOptions,\n ListSipTrunksOptions,\n ListSipDomainsOptions,\n SipDomain,\n SipTrunk,\n SipTrunkRoute,\n} from \"./models\";\nimport {\n transformFromRestModel,\n transformIntoRestModel,\n transformDomainsFromRestModel,\n transformDomainsIntoRestModel,\n} from \"./mappers\";\nimport { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./utils\";\nimport { tracingClient } from \"./generated/src/tracing\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nexport * from \"./models\";\n\n/**\n * Client options used to configure the SipRoutingClient API requests.\n */\nexport interface SipRoutingClientOptions extends CommonClientOptions {}\n\n/**\n * Checks whether the type of a value is SipClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isSipClientOptions = (options: any): options is SipRoutingClientOptions =>\n options && !isKeyCredential(options) && !isTokenCredential(options);\n\n/**\n * Client class for interacting with Azure Communication Services SIP Routing Administration.\n */\nexport class SipRoutingClient {\n /**\n * A reference to the auto-generated SipRouting HTTP client.\n */\n private readonly client: SipRoutingGeneratedClient;\n\n /**\n * Initializes a new instance of the SipRoutingClient class using a connection string.\n *\n * @param connectionString - Connection string to connect to an Azure Communication Service resource. (eg: endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret)\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(connectionString: string, options?: SipRoutingClientOptions);\n\n /**\n * Initializes a new instance of the SipRoutingClient class using an Azure KeyCredential.\n *\n * @param endpoint - The endpoint of the service (eg: https://contoso.eastus.communications.azure.net).\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(\n endpoint: string,\n credential: KeyCredential,\n options?: SipRoutingClientOptions\n );\n\n /**\n * Initializes a new instance of the SipRoutingClient class using a TokenCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential that is used to authenticate requests to the service.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(\n endpoint: string,\n credential: TokenCredential,\n options?: SipRoutingClientOptions\n );\n\n public constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | SipRoutingClientOptions,\n maybeOptions: SipRoutingClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isSipClientOptions(credentialOrOptions) ? credentialOrOptions : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new SipRoutingGeneratedClient(url, {\n endpoint: url,\n ...internalPipelineOptions,\n });\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Lists the SIP trunks.\n * @param options - The options parameters.\n */\n public listTrunks(options: ListSipTrunksOptions = {}): PagedAsyncIterableIterator<SipTrunk> {\n const iter = this.listTrunksPagingAll(options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listTrunksPagingPage(options);\n },\n };\n }\n\n /**\n * Gets the SIP trunk.\n * @param fqdn - The trunk's FQDN.\n * @param options - The options parameters.\n */\n public async getTrunk(fqdn: string, options: GetSipTrunkOptions = {}): Promise<SipTrunk> {\n return tracingClient.withSpan(\"SipRoutingClient-getTrunk\", options, async (updatedOptions) => {\n const trunks = await this.getTrunksInternal(updatedOptions);\n const trunk = trunks.find((value: SipTrunk) => value.fqdn === fqdn);\n if (trunk) {\n return trunk;\n }\n throw { code: \"NotFound\", message: \"Not Found\" } as SipRoutingError;\n });\n }\n\n /**\n * Gets the SIP domains.\n * @param options - The options parameters.\n */\n public listDomains(options: ListSipDomainsOptions = {}): PagedAsyncIterableIterator<SipDomain> {\n const iter = this.listDomainsPagingAll(options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listDomainsPagingPage(options);\n },\n };\n }\n\n /**\n * Gets the SIP domain.\n * @param domainName - The domain's name (ex: contoso.com).\n * @param options - The options parameters.\n */\n public async getDomain(domainName: string, options: OperationOptions = {}): Promise<SipDomain> {\n return tracingClient.withSpan(\n \"SipRoutingClient-listDomains\",\n options,\n async (updatedOptions) => {\n const domains = await this.getDomainsInternal(updatedOptions);\n const domain = domains.find((value: SipDomain) => value.domainName === domainName);\n if (domain) {\n return domain;\n }\n\n throw { code: \"NotFound\", message: \"Not Found\" } as SipRoutingError;\n }\n );\n }\n\n /**\n * Lists the SIP trunk routes.\n * @param options - The options parameters.\n */\n public listRoutes(options: ListSipRoutesOptions = {}): PagedAsyncIterableIterator<SipTrunkRoute> {\n const iter = this.listRoutesPagingAll(options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listRoutesPagingPage(options);\n },\n };\n }\n\n /**\n * Sets the SIP domains.\n * @param domains - The SIP domains to be set.\n * @param options - The options parameters.\n */\n public async setDomains(\n domains: SipDomain[],\n options: OperationOptions = {}\n ): Promise<SipDomain[]> {\n return tracingClient.withSpan(\n \"SipRoutingClient-setDomains\",\n options,\n async (updatedOptions) => {\n const update: SipConfigurationUpdate = { domains: transformDomainsIntoRestModel(domains) };\n let config = await this.client.sipRouting.get(updatedOptions);\n const storedDomains = transformDomainsFromRestModel(config.domains).map(\n (domain) => domain.domainName\n );\n const setDomains = domains.map((domain) => domain.domainName);\n storedDomains.forEach((storedDomain) => {\n const shouldDeleteStoredDomain = !setDomains.find((value) => value === storedDomain);\n if (shouldDeleteStoredDomain) {\n update.domains![storedDomain] = null;\n }\n });\n\n const isPatchNeeded = Object.keys(update.domains!).length > 0;\n if (isPatchNeeded) {\n const payload = {\n ...updatedOptions,\n ...update,\n };\n config = await this.client.sipRouting.update(payload);\n }\n\n return transformDomainsFromRestModel(config.domains);\n }\n );\n }\n\n /**\n * Sets the SIP domain.\n * @param domain - The SIP domain to be set.\n * @param options - The options parameters.\n */\n public async setDomain(domain: SipDomain, options: OperationOptions = {}): Promise<SipDomain> {\n return tracingClient.withSpan(\"SipRoutingClient-setDomain\", options, async (updatedOptions) => {\n const update: SipConfigurationUpdate = {\n domains: transformDomainsIntoRestModel([domain]),\n };\n const payload = {\n ...updatedOptions,\n ...update,\n };\n const config = await this.client.sipRouting.update(payload);\n const storedDomains = transformDomainsFromRestModel(config.domains).find(\n (value: SipDomain) => value.domainName === domain.domainName\n );\n if (storedDomains) {\n return storedDomains;\n }\n\n throw { code: \"NotFound\", message: \"Not Found\" } as SipRoutingError;\n });\n }\n\n /**\n * Sets the SIP trunks.\n * @param trunks - The SIP trunks to be set.\n * @param options - The options parameters.\n */\n public async setTrunks(trunks: SipTrunk[], options: OperationOptions = {}): Promise<SipTrunk[]> {\n return tracingClient.withSpan(\"SipRoutingClient-setTrunks\", options, async (updatedOptions) => {\n const update: SipConfigurationUpdate = { trunks: transformIntoRestModel(trunks) };\n let config = await this.client.sipRouting.get(updatedOptions);\n const storedFqdns = transformFromRestModel(config.trunks).map((trunk) => trunk.fqdn);\n const setFqdns = trunks.map((trunk) => trunk.fqdn);\n storedFqdns.forEach((storedFqdn) => {\n const shouldDeleteStoredTrunk = !setFqdns.find((value) => value === storedFqdn);\n if (shouldDeleteStoredTrunk) {\n update.trunks![storedFqdn] = null;\n }\n });\n\n const isPatchNeeded = Object.keys(update.trunks!).length > 0;\n if (isPatchNeeded) {\n const payload = {\n ...updatedOptions,\n ...update,\n };\n config = await this.client.sipRouting.update(payload);\n }\n\n return transformFromRestModel(config.trunks);\n });\n }\n\n /**\n * Sets the SIP trunk.\n * @param trunk - The SIP trunk to be set.\n * @param options - The options parameters.\n */\n public async setTrunk(trunk: SipTrunk, options: OperationOptions = {}): Promise<SipTrunk> {\n return tracingClient.withSpan(\"SipRoutingClient-setTrunk\", options, async (updatedOptions) => {\n const update: SipConfigurationUpdate = {\n trunks: transformIntoRestModel([trunk]),\n };\n const payload = {\n ...updatedOptions,\n ...update,\n };\n const config = await this.client.sipRouting.update(payload);\n const storedTrunk = transformFromRestModel(config.trunks).find(\n (value: SipTrunk) => value.fqdn === trunk.fqdn\n );\n if (storedTrunk) {\n return storedTrunk;\n }\n\n throw { code: \"NotFound\", message: \"Not Found\" } as SipRoutingError;\n });\n }\n\n /**\n * Sets the SIP trunk routes.\n * @param routes - The SIP trunk routes to be set.\n * @param options - The options parameters.\n */\n public async setRoutes(\n routes: SipTrunkRoute[],\n options: OperationOptions = {}\n ): Promise<SipTrunkRoute[]> {\n return tracingClient.withSpan(\"SipRoutingClient-setRoutes\", options, async (updatedOptions) => {\n const update: SipConfigurationUpdate = {\n routes: routes,\n };\n const payload = {\n ...updatedOptions,\n ...update,\n };\n const config = await this.client.sipRouting.update(payload);\n const storedRoutes = config.routes || (await this.getRoutesInternal(updatedOptions));\n return storedRoutes;\n });\n }\n\n /**\n * Deletes the SIP trunk.\n * @param fqdn - The trunk's FQDN.\n * @param options - The options parameters.\n */\n public async deleteTrunk(fqdn: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"SipRoutingClient-deleteTrunk\",\n options,\n async (updatedOptions) => {\n const trunks: any = {};\n trunks[fqdn] = null;\n const update: SipConfigurationUpdate = {\n trunks: trunks,\n };\n\n const payload = {\n ...updatedOptions,\n ...update,\n };\n await this.client.sipRouting.update(payload);\n }\n );\n }\n\n /**\n * Deletes the SIP domain.\n * @param domainName - The domain's name (ex: contoso.com).\n * @param options - The options parameters.\n */\n public async deleteDomain(domainName: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"SipRoutingClient-deleteDomain\",\n options,\n async (updatedOptions) => {\n const domains: any = {};\n domains[domainName] = null;\n const update: SipConfigurationUpdate = {\n domains: domains,\n };\n\n const payload = {\n ...updatedOptions,\n ...update,\n };\n await this.client.sipRouting.update(payload);\n }\n );\n }\n\n private async getRoutesInternal(options: OperationOptions): Promise<SipTrunkRoute[]> {\n const config = await this.client.sipRouting.get(options);\n return config.routes || [];\n }\n\n private async getTrunksInternal(options: GetSipTrunkOptions): Promise<SipTrunk[]> {\n const { includeHealth, ...requestOptions } = options;\n let updatedOptions = requestOptions;\n\n if (includeHealth) {\n updatedOptions = {\n ...requestOptions,\n expand: \"trunks/health\",\n } as SipRoutingGetOptionalParams;\n }\n\n const config = await this.client.sipRouting.get(updatedOptions);\n return transformFromRestModel(config.trunks);\n }\n\n private async getDomainsInternal(options: OperationOptions = {}): Promise<SipDomain[]> {\n const config = await this.client.sipRouting.get(options);\n return transformDomainsFromRestModel(config.domains);\n }\n\n private async *listRoutesPagingAll(\n options?: ListSipRoutesOptions\n ): AsyncIterableIterator<SipTrunkRoute> {\n for await (const page of this.listRoutesPagingPage(options)) {\n yield* page;\n }\n }\n\n private async *listTrunksPagingAll(\n options?: ListSipTrunksOptions\n ): AsyncIterableIterator<SipTrunk> {\n for await (const page of this.listTrunksPagingPage(options)) {\n yield* page;\n }\n }\n\n private async *listDomainsPagingAll(\n options?: ListSipDomainsOptions\n ): AsyncIterableIterator<SipDomain> {\n for await (const page of this.listDomainsPagingPage(options)) {\n yield* page;\n }\n }\n\n private async *listTrunksPagingPage(\n options: ListSipTrunksOptions = {}\n ): AsyncIterableIterator<SipTrunk[]> {\n const apiResult = await this.getTrunksInternal(options as GetSipTrunkOptions);\n yield apiResult;\n }\n\n private async *listDomainsPagingPage(\n options: ListSipDomainsOptions = {}\n ): AsyncIterableIterator<SipDomain[]> {\n const apiResult = await this.getDomainsInternal(options as OperationOptions);\n yield apiResult;\n }\n\n private async *listRoutesPagingPage(\n options: ListSipRoutesOptions = {}\n ): AsyncIterableIterator<SipTrunkRoute[]> {\n const apiResult = await this.getRoutesInternal(options as OperationOptions);\n yield apiResult;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"sipRoutingClient.js","sourceRoot":"","sources":["../../src/sipRoutingClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAkC,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,gBAAgB,IAAI,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAG5G,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,cAAc,UAAU,CAAC;AAOzB;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,OAAY,EAAsC,EAAE,CAC9E,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAuC3B,YACE,qBAA6B,EAC7B,mBAA+E,EAC/E,eAAwC,EAAE;QAE1C,MAAM,EAAE,GAAG,EAAE,UAAU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QACH,CAAC;KAAA;IAEc,mBAAmB,CAChC,OAA8B;;;;gBAE9B,KAAyB,eAAA,KAAA,cAAA,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA,IAAA;oBAAlC,cAAkC;oBAAlC,WAAkC;;wBAAhD,MAAM,IAAI,KAAA,CAAA;wBACnB,cAAA,KAAK,CAAC,CAAC,iBAAA,cAAA,IAAI,CAAA,CAAA,CAAA,CAAC;;;;;iBACb;;;;;;;;;QACH,CAAC;KAAA;IAEc,oBAAoB,CACjC,UAAgC,EAAE;;YAElC,MAAM,SAAS,GAAG,cAAM,IAAI,CAAC,iBAAiB,CAAC,OAA2B,CAAC,CAAA,CAAC;YAC5E,oBAAM,SAAS,CAAA,CAAC;QAClB,CAAC;KAAA;IAEc,oBAAoB,CACjC,UAAgC,EAAE;;YAElC,MAAM,SAAS,GAAG,cAAM,IAAI,CAAC,iBAAiB,CAAC,OAA2B,CAAC,CAAA,CAAC;YAC5E,oBAAM,SAAS,CAAA,CAAC;QAClB,CAAC;KAAA;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./utils\";\nimport { SipRoutingClient as SipRoutingGeneratedClient } from \"./generated/src/siprouting/sipRoutingClient\";\nimport { SipConfigurationUpdate, SipRoutingError } from \"./generated/src/siprouting/models\";\nimport { ListSipRoutesOptions, ListSipTrunksOptions, SipTrunk, SipTrunkRoute } from \"./models\";\nimport { transformFromRestModel, transformIntoRestModel } from \"./mappers\";\nimport { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"./generated/src/tracing\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nexport * from \"./models\";\n\n/**\n * Client options used to configure the SipRoutingClient API requests.\n */\nexport interface SipRoutingClientOptions extends CommonClientOptions {}\n\n/**\n * Checks whether the type of a value is SipClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isSipClientOptions = (options: any): options is SipRoutingClientOptions =>\n options && !isKeyCredential(options) && !isTokenCredential(options);\n\n/**\n * Client class for interacting with Azure Communication Services SIP Routing Administration.\n */\nexport class SipRoutingClient {\n /**\n * A reference to the auto-generated SipRouting HTTP client.\n */\n private readonly client: SipRoutingGeneratedClient;\n\n /**\n * Initializes a new instance of the SipRoutingClient class using a connection string.\n *\n * @param connectionString - Connection string to connect to an Azure Communication Service resource. (eg: endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret)\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(connectionString: string, options?: SipRoutingClientOptions);\n\n /**\n * Initializes a new instance of the SipRoutingClient class using an Azure KeyCredential.\n *\n * @param endpoint - The endpoint of the service (eg: https://contoso.eastus.communications.azure.net).\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(\n endpoint: string,\n credential: KeyCredential,\n options?: SipRoutingClientOptions\n );\n\n /**\n * Initializes a new instance of the SipRoutingClient class using a TokenCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential that is used to authenticate requests to the service.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(\n endpoint: string,\n credential: TokenCredential,\n options?: SipRoutingClientOptions\n );\n\n public constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | SipRoutingClientOptions,\n maybeOptions: SipRoutingClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isSipClientOptions(credentialOrOptions) ? credentialOrOptions : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new SipRoutingGeneratedClient(url, {\n endpoint: url,\n ...internalPipelineOptions,\n });\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Lists the SIP trunks.\n * @param options - The options parameters.\n */\n public listTrunks(options: ListSipTrunksOptions = {}): PagedAsyncIterableIterator<SipTrunk> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"SipRoutingClient-listTrunks\",\n options\n );\n\n try {\n const iter = this.listTrunksPagingAll({ ...updatedOptions });\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listTrunksPagingPage({ ...updatedOptions });\n },\n };\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Gets the SIP trunk.\n * @param fqdn - The trunk's FQDN.\n * @param options - The options parameters.\n */\n public async getTrunk(fqdn: string, options: OperationOptions = {}): Promise<SipTrunk> {\n return tracingClient.withSpan(\"SipRoutingClient-getTrunk\", options, async (updatedOptions) => {\n const trunks = await this.getTrunksInternal(updatedOptions);\n const trunk = trunks.find((value: SipTrunk) => value.fqdn === fqdn);\n if (trunk) {\n return trunk;\n }\n throw { code: \"NotFound\", message: \"Not Found\" } as SipRoutingError;\n });\n }\n\n /**\n * Lists the SIP trunk routes.\n * @param options - The options parameters.\n */\n public listRoutes(options: ListSipRoutesOptions = {}): PagedAsyncIterableIterator<SipTrunkRoute> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"SipRoutingClient-listRoutes\",\n options\n );\n\n try {\n const iter = this.listRoutesPagingAll({ ...updatedOptions });\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listRoutesPagingPage({ ...updatedOptions });\n },\n };\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Sets the SIP trunks.\n * @param trunks - The SIP trunks to be set.\n * @param options - The options parameters.\n */\n public async setTrunks(trunks: SipTrunk[], options: OperationOptions = {}): Promise<SipTrunk[]> {\n return tracingClient.withSpan(\"SipRoutingClient-setTrunks\", options, async (updatedOptions) => {\n const patch: SipConfigurationUpdate = { trunks: transformIntoRestModel(trunks) };\n let config = await this.client.sipRouting.get(updatedOptions);\n const storedFqdns = transformFromRestModel(config.trunks).map((trunk) => trunk.fqdn);\n const setFqdns = trunks.map((trunk) => trunk.fqdn);\n storedFqdns.forEach((storedFqdn) => {\n const shouldDeleteStoredTrunk = !setFqdns.find((value) => value === storedFqdn);\n if (shouldDeleteStoredTrunk) {\n patch.trunks![storedFqdn] = null;\n }\n });\n\n const isPatchNeeded = Object.keys(patch.trunks!).length > 0;\n if (isPatchNeeded) {\n const payload = {\n ...updatedOptions,\n ...patch,\n };\n config = await this.client.sipRouting.update(payload);\n }\n\n return transformFromRestModel(config.trunks);\n });\n }\n\n /**\n * Sets the SIP trunk.\n * @param trunk - The SIP trunk to be set.\n * @param options - The options parameters.\n */\n public async setTrunk(trunk: SipTrunk, options: OperationOptions = {}): Promise<SipTrunk> {\n return tracingClient.withSpan(\"SipRoutingClient-setTrunk\", options, async (updatedOptions) => {\n const patch: SipConfigurationUpdate = {\n trunks: transformIntoRestModel([trunk]),\n };\n const payload = {\n ...updatedOptions,\n ...patch,\n };\n const config = await this.client.sipRouting.update(payload);\n const storedTrunk = transformFromRestModel(config.trunks).find(\n (value: SipTrunk) => value.fqdn === trunk.fqdn\n );\n if (storedTrunk) {\n return storedTrunk;\n }\n\n throw { code: \"NotFound\", message: \"Not Found\" } as SipRoutingError;\n });\n }\n\n /**\n * Sets the SIP trunk routes.\n * @param routes - The SIP trunk routes to be set.\n * @param options - The options parameters.\n */\n public async setRoutes(\n routes: SipTrunkRoute[],\n options: OperationOptions = {}\n ): Promise<SipTrunkRoute[]> {\n return tracingClient.withSpan(\"SipRoutingClient-setRoutes\", options, async (updatedOptions) => {\n const patch: SipConfigurationUpdate = {\n routes: routes,\n };\n const payload = {\n ...updatedOptions,\n ...patch,\n };\n const config = await this.client.sipRouting.update(payload);\n const storedRoutes = config.routes || (await this.getRoutesInternal(updatedOptions));\n return storedRoutes;\n });\n }\n\n /**\n * Deletes the SIP trunk.\n * @param fqdn - The trunk's FQDN.\n * @param options - The options parameters.\n */\n public async deleteTrunk(fqdn: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"SipRoutingClient-deleteTrunk\",\n options,\n async (updatedOptions) => {\n const trunks: any = {};\n trunks[fqdn] = null;\n const patch: SipConfigurationUpdate = {\n trunks: trunks,\n };\n\n const payload = {\n ...updatedOptions,\n ...patch,\n };\n await this.client.sipRouting.update(payload);\n }\n );\n }\n\n private async getRoutesInternal(options: OperationOptions): Promise<SipTrunkRoute[]> {\n const config = await this.client.sipRouting.get(options);\n return config.routes || [];\n }\n\n private async getTrunksInternal(options: OperationOptions): Promise<SipTrunk[]> {\n const config = await this.client.sipRouting.get(options);\n return transformFromRestModel(config.trunks);\n }\n\n private async *listRoutesPagingAll(\n options?: ListSipRoutesOptions\n ): AsyncIterableIterator<SipTrunkRoute> {\n for await (const page of this.listRoutesPagingPage(options)) {\n yield* page;\n }\n }\n\n private async *listTrunksPagingAll(\n options?: ListSipTrunksOptions\n ): AsyncIterableIterator<SipTrunk> {\n for await (const page of this.listTrunksPagingPage(options)) {\n yield* page;\n }\n }\n\n private async *listTrunksPagingPage(\n options: ListSipTrunksOptions = {}\n ): AsyncIterableIterator<SipTrunk[]> {\n const apiResult = await this.getTrunksInternal(options as OperationOptions);\n yield apiResult;\n }\n\n private async *listRoutesPagingPage(\n options: ListSipRoutesOptions = {}\n ): AsyncIterableIterator<SipTrunkRoute[]> {\n const apiResult = await this.getRoutesInternal(options as OperationOptions);\n yield apiResult;\n }\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,OAAO,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.2.1\";\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@azure/communication-phone-numbers",
|
3
|
-
"version": "1.3.0-
|
3
|
+
"version": "1.3.0-beta.1",
|
4
4
|
"description": "SDK for Azure Communication service which facilitates phone number management.",
|
5
5
|
"sdk-type": "client",
|
6
6
|
"main": "dist/index.js",
|
@@ -19,7 +19,6 @@
|
|
19
19
|
"extract-api": "tsc -p . && api-extractor run --local",
|
20
20
|
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
21
21
|
"generate:client": "autorest --typescript ./swagger/README.md && rushx format",
|
22
|
-
"generate:siproutingclient": "autorest --typescript ./swagger/README-SipRouting.md && rushx format",
|
23
22
|
"integration-test:browser": "dev-tool run test:browser",
|
24
23
|
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
|
25
24
|
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|