@azure/communication-phone-numbers 1.3.0-beta.2 → 1.3.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. package/dist/index.js +523 -497
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/generated/src/lroImpl.js +1 -1
  4. package/dist-esm/src/generated/src/lroImpl.js.map +1 -1
  5. package/dist-esm/src/generated/src/models/index.js.map +1 -1
  6. package/dist-esm/src/generated/src/models/mappers.js +314 -290
  7. package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
  8. package/dist-esm/src/generated/src/models/parameters.js +70 -75
  9. package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
  10. package/dist-esm/src/generated/src/operations/phoneNumbers.js +129 -125
  11. package/dist-esm/src/generated/src/operations/phoneNumbers.js.map +1 -1
  12. package/dist-esm/src/generated/src/operationsInterfaces/phoneNumbers.js.map +1 -1
  13. package/dist-esm/src/generated/src/pagingHelper.js.map +1 -1
  14. package/dist-esm/src/generated/src/phoneNumbersClient.js +4 -4
  15. package/dist-esm/src/generated/src/phoneNumbersClient.js.map +1 -1
  16. package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js.map +1 -1
  17. package/dist-esm/src/generated/src/tracing.js +1 -1
  18. package/dist-esm/src/generated/src/tracing.js.map +1 -1
  19. package/dist-esm/src/mappers.js.map +1 -1
  20. package/dist-esm/src/models.js.map +1 -1
  21. package/dist-esm/src/phoneNumbersClient.js +15 -9
  22. package/dist-esm/src/phoneNumbersClient.js.map +1 -1
  23. package/dist-esm/src/sipRoutingClient.js.map +1 -1
  24. package/dist-esm/src/utils/customPipelinePolicies.js.map +1 -1
  25. package/package.json +10 -14
  26. package/types/communication-phone-numbers.d.ts +12 -6
@@ -336,15 +336,21 @@ export class PhoneNumbersClient {
336
336
  * @param phoneNumbers - The phone numbers to search.
337
337
  * @param options - Additional request options.
338
338
  */
339
- searchOperatorInformation(phoneNumbers, options = { formatOnly: false }) {
340
- return tracingClient.withSpan("PhoneNumbersClient-searchOperatorInformation", options, (updatedOptions) => {
341
- const params = updatedOptions;
342
- params.phoneNumbers = phoneNumbers;
343
- if (options.formatOnly) {
344
- params.options = "FormatOnly";
345
- }
346
- return this.client.phoneNumbers.operatorInformationSearch(params);
347
- });
339
+ searchOperatorInformation(phoneNumbers, options = { includeAdditionalOperatorDetails: false }) {
340
+ const { span, updatedOptions } = tracingClient.startSpan("PhoneNumbersClient-searchOperatorInformation", options);
341
+ try {
342
+ return this.client.phoneNumbers.operatorInformationSearch(phoneNumbers, Object.assign(Object.assign({}, updatedOptions), { options: { includeAdditionalOperatorDetails: options.includeAdditionalOperatorDetails } }));
343
+ }
344
+ catch (e) {
345
+ span.setStatus({
346
+ status: "error",
347
+ error: e,
348
+ });
349
+ throw e;
350
+ }
351
+ finally {
352
+ span.end();
353
+ }
348
354
  }
349
355
  }
350
356
  //# 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;;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,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,kBAAkB;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O,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,UAAU,EAAE,KAAK,EAAE;QAEjE,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,IAAI,OAAO,CAAC,UAAU,EAAE;gBACtB,MAAM,CAAC,OAAO,GAAG,YAAY,CAAC;aAC/B;YACD,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 = { formatOnly: false }\n ): Promise<OperatorInformationResult> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-searchOperatorInformation\",\n options,\n (updatedOptions) => {\n const params: PhoneNumbersOperatorInformationSearchOptionalParams = updatedOptions;\n params.phoneNumbers = phoneNumbers;\n if (options.formatOnly) {\n params.options = \"FormatOnly\";\n }\n return this.client.phoneNumbers.operatorInformationSearch(params);\n }\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;AA8BpF,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,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,C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,kCACjE,cAAc,KACjB,OAAO,EAAE,EAAE,gCAAgC,EAAE,OAAO,CAAC,gCAAgC,EAAE,IACvF,CAAC;QACL,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YAEH,MAAM,CAAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC;IACH,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 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 = { includeAdditionalOperatorDetails: false },\n ): Promise<OperatorInformationResult> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-searchOperatorInformation\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.operatorInformationSearch(phoneNumbers, {\n ...updatedOptions,\n options: { includeAdditionalOperatorDetails: options.includeAdditionalOperatorDetails },\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 +1 @@
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,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AM,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
+ {"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,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B,CAChC,OAA8B;;;;gBAE9B,KAAyB,eAAA,KAAA,cAAA,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA,IAAA,+DAAE,CAAC;oBAArC,cAAkC;oBAAlC,WAAkC;oBAAhD,MAAM,IAAI,KAAA,CAAA;oBACnB,cAAA,KAAK,CAAC,CAAC,iBAAA,cAAA,IAAI,CAAA,CAAA,CAAA,CAAC;gBACd,CAAC;;;;;;;;;QACH,CAAC;KAAA;IAEc,mBAAmB,CAChC,OAA8B;;;;gBAE9B,KAAyB,eAAA,KAAA,cAAA,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA,IAAA,+DAAE,CAAC;oBAArC,cAAkC;oBAAlC,WAAkC;oBAAhD,MAAM,IAAI,KAAA,CAAA;oBACnB,cAAA,KAAK,CAAC,CAAC,iBAAA,cAAA,IAAI,CAAA,CAAA,CAAA,CAAC;gBACd,CAAC;;;;;;;;;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":"customPipelinePolicies.js","sourceRoot":"","sources":["../../../src/utils/customPipelinePolicies.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAAC,IAAY;IACzD,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,MAAM,QAAQ,GAA0B,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5D,IAAI,QAAQ,GAAW,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,UAAU,0CAAE,QAAQ,CAAC;YAEtD,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBAC1C,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;gBACjE,MAAM,YAAY,GAAG,GAAG,IAAI,GAAG,QAAQ,EAAE,CAAC;gBAC1C,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG,YAAY,CAAC;aAC7C;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { FullOperationResponse } from \"@azure/core-client\";\nimport {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates a `PipelinePolicy` that converts relative URL values in the `nextLink` property to absolute URLs.\n *\n * This is necessary because the Core V2 library does not support paging with relative links at time of writing.\n *\n * @param host - The base URL of the resource.\n * @returns the `PipelinePolicy` that addresses the issue.\n */\nexport function createPhoneNumbersPagingPolicy(host: string): PipelinePolicy {\n return {\n name: \"phoneNumbersPagingPolicy\",\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const response: FullOperationResponse = await next(request);\n let nextLink: string = response?.parsedBody?.nextLink;\n\n if (nextLink && !nextLink.startsWith(host)) {\n nextLink = host.endsWith(\"/\") ? nextLink.substring(1) : nextLink;\n const absolutePath = `${host}${nextLink}`;\n response.parsedBody.nextLink = absolutePath;\n }\n\n return response;\n },\n };\n}\n"]}
1
+ {"version":3,"file":"customPipelinePolicies.js","sourceRoot":"","sources":["../../../src/utils/customPipelinePolicies.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAAC,IAAY;IACzD,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,MAAM,QAAQ,GAA0B,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5D,IAAI,QAAQ,GAAW,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,UAAU,0CAAE,QAAQ,CAAC;YAEtD,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3C,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;gBACjE,MAAM,YAAY,GAAG,GAAG,IAAI,GAAG,QAAQ,EAAE,CAAC;gBAC1C,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG,YAAY,CAAC;YAC9C,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { FullOperationResponse } from \"@azure/core-client\";\nimport {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates a `PipelinePolicy` that converts relative URL values in the `nextLink` property to absolute URLs.\n *\n * This is necessary because the Core V2 library does not support paging with relative links at time of writing.\n *\n * @param host - The base URL of the resource.\n * @returns the `PipelinePolicy` that addresses the issue.\n */\nexport function createPhoneNumbersPagingPolicy(host: string): PipelinePolicy {\n return {\n name: \"phoneNumbersPagingPolicy\",\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const response: FullOperationResponse = await next(request);\n let nextLink: string = response?.parsedBody?.nextLink;\n\n if (nextLink && !nextLink.startsWith(host)) {\n nextLink = host.endsWith(\"/\") ? nextLink.substring(1) : nextLink;\n const absolutePath = `${host}${nextLink}`;\n response.parsedBody.nextLink = absolutePath;\n }\n\n return response;\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/communication-phone-numbers",
3
- "version": "1.3.0-beta.2",
3
+ "version": "1.3.0-beta.4",
4
4
  "description": "SDK for Azure Communication service which facilitates phone number management.",
5
5
  "sdk-type": "client",
6
6
  "main": "dist/index.js",
@@ -13,11 +13,11 @@
13
13
  "build:samples": "echo Obsolete.",
14
14
  "build:test": "tsc -p . && dev-tool run bundle",
15
15
  "bundle": "dev-tool run bundle",
16
- "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
17
- "clean": "rimraf dist dist-* temp types *.tgz *.log",
16
+ "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
17
+ "clean": "rimraf --glob dist dist-* temp types *.tgz *.log",
18
18
  "execute:samples": "dev-tool samples run samples-dev",
19
19
  "extract-api": "tsc -p . && api-extractor run --local",
20
- "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
20
+ "format": "dev-tool run vendored 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
22
  "integration-test:browser": "dev-tool run test:browser",
23
23
  "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
@@ -25,7 +25,7 @@
25
25
  "lint:fix": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js --fix --fix-type [problem,suggestion]",
26
26
  "lint": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js",
27
27
  "pack": "npm pack 2>&1",
28
- "test": "rimraf dist-test && npm run build:test && npm run unit-test && npm run integration-test",
28
+ "test": "rimraf --glob dist-test && npm run build:test && npm run unit-test && npm run integration-test",
29
29
  "test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
30
30
  "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
31
31
  "test:watch": "npm run test -- --watch --reporter min",
@@ -66,25 +66,23 @@
66
66
  "@azure/core-lro": "^2.2.4",
67
67
  "@azure/core-paging": "^1.1.1",
68
68
  "@azure/core-tracing": "^1.0.0",
69
+ "@azure/core-util": "^1.6.1",
69
70
  "@azure/logger": "^1.0.0",
70
71
  "events": "^3.0.0",
71
- "tslib": "^2.2.0",
72
- "uuid": "^8.3.0"
72
+ "tslib": "^2.2.0"
73
73
  },
74
74
  "devDependencies": {
75
- "@azure/core-util": "^1.0.0",
76
75
  "@azure/dev-tool": "^1.0.0",
77
76
  "@azure/eslint-plugin-azure-sdk": "^3.0.0",
78
77
  "@azure/test-utils": "^1.0.0",
79
78
  "@azure-tools/test-credential": "^1.0.0",
80
79
  "@azure-tools/test-recorder": "^3.0.0",
81
- "@azure/identity": "^3.3.0",
80
+ "@azure/identity": "^4.0.1",
82
81
  "@microsoft/api-extractor": "^7.31.1",
83
82
  "@types/chai": "^4.1.6",
84
83
  "@types/mocha": "^10.0.0",
85
84
  "@types/sinon": "^17.0.0",
86
85
  "@types/node": "^18.0.0",
87
- "@types/uuid": "^8.0.0",
88
86
  "chai": "^4.2.0",
89
87
  "cross-env": "^7.0.2",
90
88
  "dotenv": "^16.0.0",
@@ -99,13 +97,11 @@
99
97
  "karma-mocha": "^2.0.1",
100
98
  "karma-sourcemap-loader": "^0.3.8",
101
99
  "karma": "^6.2.0",
102
- "mocha-junit-reporter": "^2.0.0",
103
100
  "mocha": "^10.0.0",
104
101
  "c8": "^8.0.0",
105
- "prettier": "^2.5.1",
106
- "rimraf": "^3.0.0",
102
+ "rimraf": "^5.0.5",
107
103
  "sinon": "^17.0.0",
108
- "typescript": "~5.2.0",
104
+ "typescript": "~5.3.3",
109
105
  "ts-node": "^10.0.0",
110
106
  "esm": "^3.2.18"
111
107
  },
@@ -92,7 +92,7 @@ export declare interface ListTollFreeAreaCodesOptions extends Omit<PhoneNumbersL
92
92
  /** Represents metadata describing the operator of a phone number */
93
93
  export declare interface OperatorDetails {
94
94
  /** Name of the phone operator */
95
- name?: string;
95
+ name: string;
96
96
  /** Mobile Network Code */
97
97
  mobileNetworkCode?: string;
98
98
  /** Mobile Country Code */
@@ -102,20 +102,26 @@ export declare interface OperatorDetails {
102
102
  /** Represents metadata about a phone number that is controlled/provided by that phone number's operator. */
103
103
  export declare interface OperatorInformation {
104
104
  /** E.164 formatted string representation of the phone number */
105
- phoneNumber?: string;
105
+ phoneNumber: string;
106
106
  /** National format of the phone number */
107
107
  nationalFormat?: string;
108
108
  /** International format of the phone number */
109
109
  internationalFormat?: string;
110
- /** Type of service associated with the phone number */
111
- numberType?: OperatorNumberType;
112
110
  /** ISO 3166-1 two character ('alpha-2') code associated with the phone number. */
113
111
  isoCountryCode?: string;
112
+ /** Type of service associated with the phone number */
113
+ numberType?: OperatorNumberType;
114
114
  /** Represents metadata describing the operator of a phone number */
115
115
  operatorDetails?: OperatorDetails;
116
116
  }
117
117
 
118
- /** Represents a search result containing operator information associated with the requested phone numbers */
118
+ /** Represents options to modify a search request for operator information */
119
+ export declare interface OperatorInformationOptions {
120
+ /** Includes the fields operatorDetails, numberType, and isoCountryCode in the response. Please note: use of this option will result in additional costs */
121
+ includeAdditionalOperatorDetails?: boolean;
122
+ }
123
+
124
+ /** Represents a search result containing format and operator information associated with the requested phone numbers */
119
125
  export declare interface OperatorInformationResult {
120
126
  /**
121
127
  * Results of a search.
@@ -544,7 +550,7 @@ export declare interface SearchAvailablePhoneNumbersRequest extends PhoneNumberS
544
550
  * Additional options for the search operator information request.
545
551
  */
546
552
  export declare interface SearchOperatorInformationOptions extends OperationOptions {
547
- formatOnly: boolean;
553
+ includeAdditionalOperatorDetails: boolean;
548
554
  }
549
555
 
550
556
  /**