@azure/communication-phone-numbers 1.3.0-alpha.20240827.1 → 1.3.0-alpha.20240829.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAQH,MAAM,UAAU,aAAa,CAAI,MAQhC;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAC/C,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,UAAU;QAC9B,WAAW,EAAE,IAAI,CAAC,IAAK;QACvB,kBAAkB,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;QACrD,eAAe,EAAE,CACf,IAAY,EACZ,OAA2C,EAC3C,EAAE;YACF,MAAM,EAAE,WAAW,KAAkB,IAAI,EAAjB,QAAQ,UAAK,IAAI,EAAnC,eAA4B,CAAO,CAAC;YAC1C,OAAO,eAAe,CAAC,IAAI,kCACtB,QAAQ,KACX,UAAU,EAAE,KAAK,EACjB,IAAI,EACJ,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,IACjC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { LongRunningOperation, LroResponse } from \"@azure/core-lro\";\n\nexport function createLroSpec<T>(inputs: {\n sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;\n args: Record<string, unknown>;\n spec: {\n readonly requestBody?: unknown;\n readonly path?: string;\n readonly httpMethod: string;\n } & Record<string, any>;\n}): LongRunningOperation<T> {\n const { args, spec, sendOperationFn } = inputs;\n return {\n requestMethod: spec.httpMethod,\n requestPath: spec.path!,\n sendInitialRequest: () => sendOperationFn(args, spec),\n sendPollRequest: (\n path: string,\n options?: { abortSignal?: AbortSignalLike },\n ) => {\n const { requestBody, ...restSpec } = spec;\n return sendOperationFn(args, {\n ...restSpec,\n httpMethod: \"GET\",\n path,\n abortSignal: options?.abortSignal,\n });\n },\n };\n}\n"]}
1
+ {"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAQH,MAAM,UAAU,aAAa,CAAI,MAQhC;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAC/C,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,UAAU;QAC9B,WAAW,EAAE,IAAI,CAAC,IAAK;QACvB,kBAAkB,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;QACrD,eAAe,EAAE,CACf,IAAY,EACZ,OAA2C,EAC3C,EAAE;YACF,MAAM,EAAE,WAAW,KAAkB,IAAI,EAAjB,QAAQ,UAAK,IAAI,EAAnC,eAA4B,CAAO,CAAC;YAC1C,OAAO,eAAe,CAAC,IAAI,kCACtB,QAAQ,KACX,UAAU,EAAE,KAAK,EACjB,IAAI,EACJ,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,IACjC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { LongRunningOperation, LroResponse } from \"@azure/core-lro\";\n\nexport function createLroSpec<T>(inputs: {\n sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;\n args: Record<string, unknown>;\n spec: {\n readonly requestBody?: unknown;\n readonly path?: string;\n readonly httpMethod: string;\n } & Record<string, any>;\n}): LongRunningOperation<T> {\n const { args, spec, sendOperationFn } = inputs;\n return {\n requestMethod: spec.httpMethod,\n requestPath: spec.path!,\n sendInitialRequest: () => sendOperationFn(args, spec),\n sendPollRequest: (\n path: string,\n options?: { abortSignal?: AbortSignalLike },\n ) => {\n const { requestBody, ...restSpec } = spec;\n return sendOperationFn(args, {\n ...restSpec,\n httpMethod: \"GET\",\n path,\n abortSignal: options?.abortSignal,\n });\n },\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  export * from "./models";
4
4
  export * from "./phoneNumbersClient";
5
5
  export * from "./lroModels";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./models\";\nexport * from \"./phoneNumbersClient\";\nexport * from \"./lroModels\";\nexport * from \"./sipRoutingClient\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./models\";\nexport * from \"./phoneNumbersClient\";\nexport * from \"./lroModels\";\nexport * from \"./sipRoutingClient\";\n"]}
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  export {};
4
4
  //# sourceMappingURL=lroModels.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lroModels.js","sourceRoot":"","sources":["../../src/lroModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-client\";\n\n/**\n * Additional options for the search available phone numbers operation.\n */\nexport interface BeginSearchAvailablePhoneNumbersOptions extends OperationOptions {}\n\n/**\n * Additional options for the release phone number operation.\n */\nexport interface BeginReleasePhoneNumberOptions extends OperationOptions {}\n\n/**\n * Additional options for the purchase phone number operation.\n */\nexport interface BeginPurchasePhoneNumbersOptions extends OperationOptions {}\n\n/**\n * Additional options for the update phone number capabilities operation.\n */\nexport interface BeginUpdatePhoneNumberCapabilitiesOptions extends OperationOptions {}\n"]}
1
+ {"version":3,"file":"lroModels.js","sourceRoot":"","sources":["../../src/lroModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { OperationOptions } from \"@azure/core-client\";\n\n/**\n * Additional options for the search available phone numbers operation.\n */\nexport interface BeginSearchAvailablePhoneNumbersOptions extends OperationOptions {}\n\n/**\n * Additional options for the release phone number operation.\n */\nexport interface BeginReleasePhoneNumberOptions extends OperationOptions {}\n\n/**\n * Additional options for the purchase phone number operation.\n */\nexport interface BeginPurchasePhoneNumbersOptions extends OperationOptions {}\n\n/**\n * Additional options for the update phone number capabilities operation.\n */\nexport interface BeginUpdatePhoneNumberCapabilitiesOptions extends OperationOptions {}\n"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  /**
4
4
  * @internal
5
5
  * Transforming SIP trunks REST model to SDK model
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../src/mappers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAA4D;IAE5D,MAAM,MAAM,GAAe,EAAE,CAAC;IAE9B,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAY,EAAE,EAAE;YAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAc,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAkB;IAGvD,MAAM,MAAM,GAA6C,EAAE,CAAC;IAE5D,MAAM,CAAC,OAAO,CAAC,CAAC,KAAe,EAAE,EAAE;QACjC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EAAkB,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { SipTrunk } from \"./models\";\nimport { TrunkUpdate as RestSipTrunk } from \"./generated/src/siprouting/models\";\n\n/**\n * @internal\n * Transforming SIP trunks REST model to SDK model\n */\nexport function transformFromRestModel(\n trunks: { [propertyName: string]: RestSipTrunk } | undefined,\n): SipTrunk[] {\n const result: SipTrunk[] = [];\n\n if (trunks) {\n Object.keys(trunks).forEach((fqdn: string) => {\n const port = trunks[fqdn].sipSignalingPort;\n result.push({ fqdn: fqdn, sipSignalingPort: port } as SipTrunk);\n });\n }\n\n return result;\n}\n\n/**\n * @internal\n * Transforming SIP trunks SDK model to REST model\n */\nexport function transformIntoRestModel(trunks: SipTrunk[]): {\n [propertyName: string]: RestSipTrunk;\n} {\n const result: { [propertyName: string]: RestSipTrunk } = {};\n\n trunks.forEach((trunk: SipTrunk) => {\n result[trunk.fqdn] = { sipSignalingPort: trunk.sipSignalingPort } as RestSipTrunk;\n });\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../src/mappers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAA4D;IAE5D,MAAM,MAAM,GAAe,EAAE,CAAC;IAE9B,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAY,EAAE,EAAE;YAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAc,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAkB;IAGvD,MAAM,MAAM,GAA6C,EAAE,CAAC;IAE5D,MAAM,CAAC,OAAO,CAAC,CAAC,KAAe,EAAE,EAAE;QACjC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EAAkB,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { SipTrunk } from \"./models\";\nimport { TrunkUpdate as RestSipTrunk } from \"./generated/src/siprouting/models\";\n\n/**\n * @internal\n * Transforming SIP trunks REST model to SDK model\n */\nexport function transformFromRestModel(\n trunks: { [propertyName: string]: RestSipTrunk } | undefined,\n): SipTrunk[] {\n const result: SipTrunk[] = [];\n\n if (trunks) {\n Object.keys(trunks).forEach((fqdn: string) => {\n const port = trunks[fqdn].sipSignalingPort;\n result.push({ fqdn: fqdn, sipSignalingPort: port } as SipTrunk);\n });\n }\n\n return result;\n}\n\n/**\n * @internal\n * Transforming SIP trunks SDK model to REST model\n */\nexport function transformIntoRestModel(trunks: SipTrunk[]): {\n [propertyName: string]: RestSipTrunk;\n} {\n const result: { [propertyName: string]: RestSipTrunk } = {};\n\n trunks.forEach((trunk: SipTrunk) => {\n result[trunk.fqdn] = { sipSignalingPort: trunk.sipSignalingPort } as RestSipTrunk;\n });\n\n return result;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  export {};
4
4
  //# sourceMappingURL=models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-client\";\nimport {\n PhoneNumberAssignmentType,\n PhoneNumberSearchRequest,\n PhoneNumbersListAreaCodesOptionalParams,\n PhoneNumberType,\n} from \"./generated/src/models/\";\n\n/**\n * The result of the phone numbers purchase operation.\n */\nexport interface PurchasePhoneNumbersResult {}\n\n/**\n * The result of the phone number release operation.\n */\nexport interface ReleasePhoneNumberResult {}\n\n/**\n * Additional options for the get phone number request.\n */\nexport type GetPurchasedPhoneNumberOptions = OperationOptions;\n\n/**\n * Additional options that can be passed to the list phone numbers request.\n */\nexport interface ListPurchasedPhoneNumbersOptions extends OperationOptions {}\n\n/**\n * Represents a phone number search request to find phone numbers.\n * Found phone numbers are temporarily held for a following purchase.\n */\nexport interface SearchAvailablePhoneNumbersRequest extends PhoneNumberSearchRequest {\n /**\n * The ISO 3166-2 country code, e.g. US, representing the location of the search.\n */\n countryCode: string;\n}\n\n/**\n * Additional options that can be passed to the available countries request.\n */\nexport interface ListAvailableCountriesOptions extends OperationOptions {}\n\n/**\n * Additional options that can be passed to the Toll-Free area codes request.\n */\nexport interface ListTollFreeAreaCodesOptions\n extends Omit<\n PhoneNumbersListAreaCodesOptionalParams,\n \"assignmentType\" | \"locality\" | \"administrativeDivision\"\n > {}\n\n/**\n * Additional options that can be passed to the Geographic area codes request.\n */\nexport interface ListGeographicAreaCodesOptions extends PhoneNumbersListAreaCodesOptionalParams {}\n\n/**\n * Additional options that can be passed to the available localities request.\n */\nexport interface ListLocalitiesOptions extends OperationOptions {\n administrativeDivision?: string;\n}\n\n/**\n * Additional options for the search operator information request.\n */\nexport interface SearchOperatorInformationOptions extends OperationOptions {\n includeAdditionalOperatorDetails: boolean;\n}\n\n/**\n * Additional options that can be passed to list SIP routes.\n */\nexport interface ListSipRoutesOptions extends OperationOptions {}\n\n/**\n * Additional options that can be passed to list SIP trunks.\n */\nexport interface ListSipTrunksOptions extends OperationOptions {}\n\n/**\n * Additional options that can be passed to the available offerings request.\n */\nexport interface ListOfferingsOptions extends OperationOptions {\n phoneNumberType?: PhoneNumberType;\n assignmentType?: PhoneNumberAssignmentType;\n}\n\nexport {\n PhoneNumberAdministrativeDivision,\n PhoneNumberAssignmentType,\n PhoneNumberAreaCode,\n PhoneNumberCapabilities,\n PhoneNumberCapabilitiesRequest,\n PhoneNumberCapabilityType,\n PhoneNumberCost,\n PhoneNumberCountry,\n PhoneNumbersListAreaCodesOptionalParams,\n PhoneNumberLocality,\n PhoneNumberOffering,\n PhoneNumberSearchRequest,\n PhoneNumberSearchResult,\n PhoneNumberSearchResultError,\n PhoneNumberType,\n PurchasedPhoneNumber,\n OperatorDetails,\n OperatorInformation,\n OperatorInformationOptions,\n OperatorInformationResult,\n OperatorNumberType,\n} from \"./generated/src/models/\";\n\nexport { SipRoutingError, SipTrunkRoute } from \"./generated/src/siprouting/models\";\n\n/**\n * Represents a SIP trunk for routing calls. See RFC 4904.\n */\nexport interface SipTrunk {\n /**\n * Gets or sets FQDN of the trunk.\n */\n fqdn: string;\n /**\n * Gets or sets SIP signaling port of the trunk.\n */\n sipSignalingPort: number;\n}\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { OperationOptions } from \"@azure/core-client\";\nimport {\n PhoneNumberAssignmentType,\n PhoneNumberSearchRequest,\n PhoneNumbersListAreaCodesOptionalParams,\n PhoneNumberType,\n} from \"./generated/src/models/\";\n\n/**\n * The result of the phone numbers purchase operation.\n */\nexport interface PurchasePhoneNumbersResult {}\n\n/**\n * The result of the phone number release operation.\n */\nexport interface ReleasePhoneNumberResult {}\n\n/**\n * Additional options for the get phone number request.\n */\nexport type GetPurchasedPhoneNumberOptions = OperationOptions;\n\n/**\n * Additional options that can be passed to the list phone numbers request.\n */\nexport interface ListPurchasedPhoneNumbersOptions extends OperationOptions {}\n\n/**\n * Represents a phone number search request to find phone numbers.\n * Found phone numbers are temporarily held for a following purchase.\n */\nexport interface SearchAvailablePhoneNumbersRequest extends PhoneNumberSearchRequest {\n /**\n * The ISO 3166-2 country code, e.g. US, representing the location of the search.\n */\n countryCode: string;\n}\n\n/**\n * Additional options that can be passed to the available countries request.\n */\nexport interface ListAvailableCountriesOptions extends OperationOptions {}\n\n/**\n * Additional options that can be passed to the Toll-Free area codes request.\n */\nexport interface ListTollFreeAreaCodesOptions\n extends Omit<\n PhoneNumbersListAreaCodesOptionalParams,\n \"assignmentType\" | \"locality\" | \"administrativeDivision\"\n > {}\n\n/**\n * Additional options that can be passed to the Geographic area codes request.\n */\nexport interface ListGeographicAreaCodesOptions extends PhoneNumbersListAreaCodesOptionalParams {}\n\n/**\n * Additional options that can be passed to the available localities request.\n */\nexport interface ListLocalitiesOptions extends OperationOptions {\n administrativeDivision?: string;\n}\n\n/**\n * Additional options for the search operator information request.\n */\nexport interface SearchOperatorInformationOptions extends OperationOptions {\n includeAdditionalOperatorDetails: boolean;\n}\n\n/**\n * Additional options that can be passed to list SIP routes.\n */\nexport interface ListSipRoutesOptions extends OperationOptions {}\n\n/**\n * Additional options that can be passed to list SIP trunks.\n */\nexport interface ListSipTrunksOptions extends OperationOptions {}\n\n/**\n * Additional options that can be passed to the available offerings request.\n */\nexport interface ListOfferingsOptions extends OperationOptions {\n phoneNumberType?: PhoneNumberType;\n assignmentType?: PhoneNumberAssignmentType;\n}\n\nexport {\n PhoneNumberAdministrativeDivision,\n PhoneNumberAssignmentType,\n PhoneNumberAreaCode,\n PhoneNumberCapabilities,\n PhoneNumberCapabilitiesRequest,\n PhoneNumberCapabilityType,\n PhoneNumberCost,\n PhoneNumberCountry,\n PhoneNumbersListAreaCodesOptionalParams,\n PhoneNumberLocality,\n PhoneNumberOffering,\n PhoneNumberSearchRequest,\n PhoneNumberSearchResult,\n PhoneNumberSearchResultError,\n PhoneNumberType,\n PurchasedPhoneNumber,\n OperatorDetails,\n OperatorInformation,\n OperatorInformationOptions,\n OperatorInformationResult,\n OperatorNumberType,\n} from \"./generated/src/models/\";\n\nexport { SipRoutingError, SipTrunkRoute } from \"./generated/src/siprouting/models\";\n\n/**\n * Represents a SIP trunk for routing calls. See RFC 4904.\n */\nexport interface SipTrunk {\n /**\n * Gets or sets FQDN of the trunk.\n */\n fqdn: string;\n /**\n * Gets or sets SIP signaling port of the trunk.\n */\n sipSignalingPort: number;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  /// <reference lib="esnext.asynciterable" />
4
4
  import { __rest } from "tslib";
5
5
  import { createCommunicationAuthPolicy, isKeyCredential, parseClientArguments, } from "@azure/communication-common";
@@ -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;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,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,CAAC,YAAY,CAAC;QAEjB,MAAM,uBAAuB,mCACxB,OAAO,GACP;YACD,cAAc,EAAE;gBACd,MAAM,EAAE,MAAM,CAAC,IAAI;aACpB;SACF,CACF,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,2BAA2B,CAAC,GAAG,kBAC/C,QAAQ,EAAE,GAAG,IACV,uBAAuB,EAC1B,CAAC;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EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,kCAAkC,EAClC,OAAO,CACR,CAAC;QAEF,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,WAAW,oBACpD,cAAc,EACjB,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;IAED;;;;;OAKG;IACI,yBAAyB,CAC9B,YAAsB,EACtB,UAA4C,EAAE,gCAAgC,EAAE,KAAK,EAAE;QAEvF,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,8CAA8C,EAC9C,OAAO,CACR,CAAC;QAEF,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC,YAAY,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
+ {"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,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAoC7B,YACE,qBAA6B,EAC7B,mBAAiF,EACjF,eAA0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ACL,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,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
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";
@@ -1 +1 @@
1
- {"version":3,"file":"sipRoutingClient.js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AAoB;kFACjC,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;kFACjC,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
+ {"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;AAG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ourcesContent":["// 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,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  export const SDK_VERSION = "1.2.1";
4
4
  //# sourceMappingURL=constants.js.map
@@ -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,OAAO,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.2.1\";\n"]}
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"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  /**
4
4
  * Creates a `PipelinePolicy` that converts relative URL values in the `nextLink` property to absolute URLs.
5
5
  *
@@ -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,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"]}
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"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  export * from "./constants";
4
4
  export * from "./logger";
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./constants\";\nexport * from \"./logger\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./constants\";\nexport * from \"./logger\";\n"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  import { createClientLogger } from "@azure/logger";
4
4
  /**
5
5
  * The \@azure\/logger configuration for this package.
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The \\@azure\\/logger configuration for this package.\n */\nexport const logger = createClientLogger(\"communication-phone-numbers\");\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The \\@azure\\/logger configuration for this package.\n */\nexport const logger = createClientLogger(\"communication-phone-numbers\");\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/communication-phone-numbers",
3
- "version": "1.3.0-alpha.20240827.1",
3
+ "version": "1.3.0-alpha.20240829.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",