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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/README.md +37 -44
  2. package/dist/index.js +492 -678
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/generated/src/index.js +1 -0
  5. package/dist-esm/src/generated/src/index.js.map +1 -1
  6. package/dist-esm/src/generated/src/lroImpl.js +11 -15
  7. package/dist-esm/src/generated/src/lroImpl.js.map +1 -1
  8. package/dist-esm/src/generated/src/models/index.js.map +1 -1
  9. package/dist-esm/src/generated/src/models/mappers.js +122 -0
  10. package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
  11. package/dist-esm/src/generated/src/models/parameters.js +15 -2
  12. package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
  13. package/dist-esm/src/generated/src/operations/phoneNumbers.js +170 -116
  14. package/dist-esm/src/generated/src/operations/phoneNumbers.js.map +1 -1
  15. package/dist-esm/src/generated/src/operationsInterfaces/phoneNumbers.js.map +1 -1
  16. package/dist-esm/src/generated/src/pagingHelper.js +32 -0
  17. package/dist-esm/src/generated/src/pagingHelper.js.map +1 -0
  18. package/dist-esm/src/generated/src/phoneNumbersClient.js +4 -22
  19. package/dist-esm/src/generated/src/phoneNumbersClient.js.map +1 -1
  20. package/dist-esm/src/generated/src/siprouting/models/index.js +1 -6
  21. package/dist-esm/src/generated/src/siprouting/models/index.js.map +1 -1
  22. package/dist-esm/src/generated/src/siprouting/models/mappers.js +0 -166
  23. package/dist-esm/src/generated/src/siprouting/models/mappers.js.map +1 -1
  24. package/dist-esm/src/generated/src/siprouting/models/parameters.js +2 -48
  25. package/dist-esm/src/generated/src/siprouting/models/parameters.js.map +1 -1
  26. package/dist-esm/src/generated/src/siprouting/operations/sipRouting.js +1 -35
  27. package/dist-esm/src/generated/src/siprouting/operations/sipRouting.js.map +1 -1
  28. package/dist-esm/src/generated/src/siprouting/operationsInterfaces/sipRouting.js.map +1 -1
  29. package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js +2 -2
  30. package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js.map +1 -1
  31. package/dist-esm/src/generated/src/tracing.js +1 -1
  32. package/dist-esm/src/generated/src/tracing.js.map +1 -1
  33. package/dist-esm/src/mappers.js +3 -31
  34. package/dist-esm/src/mappers.js.map +1 -1
  35. package/dist-esm/src/models.js.map +1 -1
  36. package/dist-esm/src/phoneNumbersClient.js +19 -3
  37. package/dist-esm/src/phoneNumbersClient.js.map +1 -1
  38. package/dist-esm/src/sipRoutingClient.js +69 -192
  39. package/dist-esm/src/sipRoutingClient.js.map +1 -1
  40. package/dist-esm/src/utils/constants.js +1 -1
  41. package/dist-esm/src/utils/constants.js.map +1 -1
  42. package/package.json +15 -14
  43. package/types/communication-phone-numbers.d.ts +58 -131
package/dist/index.js CHANGED
@@ -3,16 +3,14 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
- var coreTracing = require('@azure/core-tracing');
7
6
  var communicationCommon = require('@azure/communication-common');
8
7
  var coreAuth = require('@azure/core-auth');
8
+ var coreTracing = require('@azure/core-tracing');
9
9
  var logger$1 = require('@azure/logger');
10
10
  var coreClient = require('@azure/core-client');
11
- var coreRestPipeline = require('@azure/core-rest-pipeline');
12
11
  var coreLro = require('@azure/core-lro');
13
12
 
14
- function _interopNamespace(e) {
15
- if (e && e.__esModule) return e;
13
+ function _interopNamespaceDefault(e) {
16
14
  var n = Object.create(null);
17
15
  if (e) {
18
16
  Object.keys(e).forEach(function (k) {
@@ -25,46 +23,30 @@ function _interopNamespace(e) {
25
23
  }
26
24
  });
27
25
  }
28
- n["default"] = e;
26
+ n.default = e;
29
27
  return Object.freeze(n);
30
28
  }
31
29
 
32
- var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
33
- var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
30
+ var coreClient__namespace = /*#__PURE__*/_interopNamespaceDefault(coreClient);
34
31
 
35
- // Copyright (c) Microsoft Corporation.
36
- // Licensed under the MIT license.
37
- /**
38
- * Creates a `PipelinePolicy` that converts relative URL values in the `nextLink` property to absolute URLs.
39
- *
40
- * This is necessary because the Core V2 library does not support paging with relative links at time of writing.
32
+ /*
33
+ * Copyright (c) Microsoft Corporation.
34
+ * Licensed under the MIT License.
41
35
  *
42
- * @param host - The base URL of the resource.
43
- * @returns the `PipelinePolicy` that addresses the issue.
36
+ * Code generated by Microsoft (R) AutoRest Code Generator.
37
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
44
38
  */
45
- function createPhoneNumbersPagingPolicy(host) {
46
- return {
47
- name: "phoneNumbersPagingPolicy",
48
- async sendRequest(request, next) {
49
- var _a;
50
- const response = await next(request);
51
- let nextLink = (_a = response === null || response === void 0 ? void 0 : response.parsedBody) === null || _a === void 0 ? void 0 : _a.nextLink;
52
- if (nextLink && !nextLink.startsWith(host)) {
53
- nextLink = host.endsWith("/") ? nextLink.substring(1) : nextLink;
54
- const absolutePath = `${host}${nextLink}`;
55
- response.parsedBody.nextLink = absolutePath;
56
- }
57
- return response;
58
- },
59
- };
39
+ const pageMap = new WeakMap();
40
+ function setContinuationToken(page, continuationToken) {
41
+ var _a;
42
+ if (typeof page !== "object" || page === null || !continuationToken) {
43
+ return;
44
+ }
45
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
46
+ pageInfo.continuationToken = continuationToken;
47
+ pageMap.set(page, pageInfo);
60
48
  }
61
49
 
62
- // Copyright (c) Microsoft Corporation.
63
- /**
64
- * The \@azure\/logger configuration for this package.
65
- */
66
- const logger = logger$1.createClientLogger("communication-phone-numbers");
67
-
68
50
  /*
69
51
  * Copyright (c) Microsoft Corporation.
70
52
  * Licensed under the MIT License.
@@ -75,7 +57,7 @@ const logger = logger$1.createClientLogger("communication-phone-numbers");
75
57
  const tracingClient = coreTracing.createTracingClient({
76
58
  namespace: "Microsoft.Communication",
77
59
  packageName: "@azure/communication-phone-numbers",
78
- packageVersion: "1.3.0-alpha.20230820.1"
60
+ packageVersion: "1.2.1"
79
61
  });
80
62
 
81
63
  /*
@@ -524,6 +506,18 @@ const PhoneNumberSearchResult = {
524
506
  type: {
525
507
  name: "DateTime"
526
508
  }
509
+ },
510
+ errorCode: {
511
+ serializedName: "errorCode",
512
+ type: {
513
+ name: "Number"
514
+ }
515
+ },
516
+ error: {
517
+ serializedName: "error",
518
+ type: {
519
+ name: "String"
520
+ }
527
521
  }
528
522
  }
529
523
  }
@@ -709,6 +703,116 @@ const PurchasedPhoneNumbers = {
709
703
  }
710
704
  }
711
705
  };
706
+ const OperatorInformationRequest = {
707
+ type: {
708
+ name: "Composite",
709
+ className: "OperatorInformationRequest",
710
+ modelProperties: {
711
+ phoneNumbers: {
712
+ serializedName: "phoneNumbers",
713
+ type: {
714
+ name: "Sequence",
715
+ element: {
716
+ type: {
717
+ name: "String"
718
+ }
719
+ }
720
+ }
721
+ }
722
+ }
723
+ }
724
+ };
725
+ const OperatorInformationResult = {
726
+ type: {
727
+ name: "Composite",
728
+ className: "OperatorInformationResult",
729
+ modelProperties: {
730
+ values: {
731
+ serializedName: "values",
732
+ type: {
733
+ name: "Sequence",
734
+ element: {
735
+ type: {
736
+ name: "Composite",
737
+ className: "OperatorInformation"
738
+ }
739
+ }
740
+ }
741
+ }
742
+ }
743
+ }
744
+ };
745
+ const OperatorInformation = {
746
+ type: {
747
+ name: "Composite",
748
+ className: "OperatorInformation",
749
+ modelProperties: {
750
+ phoneNumber: {
751
+ serializedName: "phoneNumber",
752
+ type: {
753
+ name: "String"
754
+ }
755
+ },
756
+ nationalFormat: {
757
+ serializedName: "nationalFormat",
758
+ type: {
759
+ name: "String"
760
+ }
761
+ },
762
+ internationalFormat: {
763
+ serializedName: "internationalFormat",
764
+ type: {
765
+ name: "String"
766
+ }
767
+ },
768
+ numberType: {
769
+ serializedName: "numberType",
770
+ type: {
771
+ name: "String"
772
+ }
773
+ },
774
+ isoCountryCode: {
775
+ serializedName: "isoCountryCode",
776
+ type: {
777
+ name: "String"
778
+ }
779
+ },
780
+ operatorDetails: {
781
+ serializedName: "operatorDetails",
782
+ type: {
783
+ name: "Composite",
784
+ className: "OperatorDetails"
785
+ }
786
+ }
787
+ }
788
+ }
789
+ };
790
+ const OperatorDetails = {
791
+ type: {
792
+ name: "Composite",
793
+ className: "OperatorDetails",
794
+ modelProperties: {
795
+ name: {
796
+ serializedName: "name",
797
+ type: {
798
+ name: "String"
799
+ }
800
+ },
801
+ mobileNetworkCode: {
802
+ serializedName: "mobileNetworkCode",
803
+ type: {
804
+ name: "String"
805
+ }
806
+ },
807
+ mobileCountryCode: {
808
+ serializedName: "mobileCountryCode",
809
+ type: {
810
+ name: "String"
811
+ }
812
+ }
813
+ }
814
+ }
815
+ };
712
816
  const PhoneNumbersSearchAvailablePhoneNumbersHeaders = {
713
817
  type: {
714
818
  name: "Composite",
@@ -842,31 +946,35 @@ const PhoneNumbersReleasePhoneNumberHeaders = {
842
946
 
843
947
  var Mappers$1 = /*#__PURE__*/Object.freeze({
844
948
  __proto__: null,
845
- PhoneNumberAreaCodes: PhoneNumberAreaCodes,
846
- PhoneNumberAreaCode: PhoneNumberAreaCode,
847
- CommunicationErrorResponse: CommunicationErrorResponse$1,
848
949
  CommunicationError: CommunicationError,
950
+ CommunicationErrorResponse: CommunicationErrorResponse$1,
951
+ OfferingsResponse: OfferingsResponse,
952
+ OperatorDetails: OperatorDetails,
953
+ OperatorInformation: OperatorInformation,
954
+ OperatorInformationRequest: OperatorInformationRequest,
955
+ OperatorInformationResult: OperatorInformationResult,
956
+ PhoneNumberAdministrativeDivision: PhoneNumberAdministrativeDivision,
957
+ PhoneNumberAreaCode: PhoneNumberAreaCode,
958
+ PhoneNumberAreaCodes: PhoneNumberAreaCodes,
959
+ PhoneNumberCapabilities: PhoneNumberCapabilities,
960
+ PhoneNumberCapabilitiesRequest: PhoneNumberCapabilitiesRequest,
961
+ PhoneNumberCost: PhoneNumberCost,
849
962
  PhoneNumberCountries: PhoneNumberCountries,
850
963
  PhoneNumberCountry: PhoneNumberCountry,
851
964
  PhoneNumberLocalities: PhoneNumberLocalities,
852
965
  PhoneNumberLocality: PhoneNumberLocality,
853
- PhoneNumberAdministrativeDivision: PhoneNumberAdministrativeDivision,
854
- OfferingsResponse: OfferingsResponse,
855
966
  PhoneNumberOffering: PhoneNumberOffering,
856
- PhoneNumberCapabilities: PhoneNumberCapabilities,
857
- PhoneNumberCost: PhoneNumberCost,
967
+ PhoneNumberOperation: PhoneNumberOperation,
968
+ PhoneNumberPurchaseRequest: PhoneNumberPurchaseRequest,
858
969
  PhoneNumberSearchRequest: PhoneNumberSearchRequest,
859
970
  PhoneNumberSearchResult: PhoneNumberSearchResult,
860
- PhoneNumberPurchaseRequest: PhoneNumberPurchaseRequest,
861
- PhoneNumberOperation: PhoneNumberOperation,
862
- PhoneNumberCapabilitiesRequest: PhoneNumberCapabilitiesRequest,
863
- PurchasedPhoneNumber: PurchasedPhoneNumber,
864
- PurchasedPhoneNumbers: PurchasedPhoneNumbers,
865
- PhoneNumbersSearchAvailablePhoneNumbersHeaders: PhoneNumbersSearchAvailablePhoneNumbersHeaders,
866
- PhoneNumbersPurchasePhoneNumbersHeaders: PhoneNumbersPurchasePhoneNumbersHeaders,
867
971
  PhoneNumbersGetOperationHeaders: PhoneNumbersGetOperationHeaders,
972
+ PhoneNumbersPurchasePhoneNumbersHeaders: PhoneNumbersPurchasePhoneNumbersHeaders,
973
+ PhoneNumbersReleasePhoneNumberHeaders: PhoneNumbersReleasePhoneNumberHeaders,
974
+ PhoneNumbersSearchAvailablePhoneNumbersHeaders: PhoneNumbersSearchAvailablePhoneNumbersHeaders,
868
975
  PhoneNumbersUpdateCapabilitiesHeaders: PhoneNumbersUpdateCapabilitiesHeaders,
869
- PhoneNumbersReleasePhoneNumberHeaders: PhoneNumbersReleasePhoneNumberHeaders
976
+ PurchasedPhoneNumber: PurchasedPhoneNumber,
977
+ PurchasedPhoneNumbers: PurchasedPhoneNumbers
870
978
  });
871
979
 
872
980
  /*
@@ -970,7 +1078,7 @@ const administrativeDivision = {
970
1078
  const apiVersion$1 = {
971
1079
  parameterPath: "apiVersion",
972
1080
  mapper: {
973
- defaultValue: "2022-12-01",
1081
+ defaultValue: "2023-05-01-preview",
974
1082
  isConstant: true,
975
1083
  serializedName: "api-version",
976
1084
  type: {
@@ -1028,7 +1136,7 @@ const operationId = {
1028
1136
  }
1029
1137
  }
1030
1138
  };
1031
- const contentType1$1 = {
1139
+ const contentType1 = {
1032
1140
  parameterPath: ["options", "contentType"],
1033
1141
  mapper: {
1034
1142
  defaultValue: "application/merge-patch+json",
@@ -1059,6 +1167,15 @@ const top = {
1059
1167
  }
1060
1168
  }
1061
1169
  };
1170
+ const options = {
1171
+ parameterPath: ["options", "options"],
1172
+ mapper: {
1173
+ serializedName: "options",
1174
+ type: {
1175
+ name: "String"
1176
+ }
1177
+ }
1178
+ };
1062
1179
  const nextLink = {
1063
1180
  parameterPath: "nextLink",
1064
1181
  mapper: {
@@ -1078,21 +1195,17 @@ const nextLink = {
1078
1195
  * Code generated by Microsoft (R) AutoRest Code Generator.
1079
1196
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1080
1197
  */
1081
- class LroImpl {
1082
- constructor(sendOperationFn, args, spec, requestPath = spec.path, requestMethod = spec.httpMethod) {
1083
- this.sendOperationFn = sendOperationFn;
1084
- this.args = args;
1085
- this.spec = spec;
1086
- this.requestPath = requestPath;
1087
- this.requestMethod = requestMethod;
1088
- }
1089
- async sendInitialRequest() {
1090
- return this.sendOperationFn(this.args, this.spec);
1091
- }
1092
- async sendPollRequest(path) {
1093
- const _a = this.spec, restSpec = tslib.__rest(_a, ["requestBody"]);
1094
- return this.sendOperationFn(this.args, Object.assign(Object.assign({}, restSpec), { path, httpMethod: "GET" }));
1095
- }
1198
+ function createLroSpec(inputs) {
1199
+ const { args, spec, sendOperationFn } = inputs;
1200
+ return {
1201
+ requestMethod: spec.httpMethod,
1202
+ requestPath: spec.path,
1203
+ sendInitialRequest: () => sendOperationFn(args, spec),
1204
+ sendPollRequest: (path, options) => {
1205
+ const restSpec = tslib.__rest(spec, ["requestBody"]);
1206
+ return sendOperationFn(args, Object.assign(Object.assign({}, restSpec), { httpMethod: "GET", path, abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal }));
1207
+ }
1208
+ };
1096
1209
  }
1097
1210
 
1098
1211
  /*
@@ -1127,20 +1240,31 @@ class PhoneNumbersImpl {
1127
1240
  [Symbol.asyncIterator]() {
1128
1241
  return this;
1129
1242
  },
1130
- byPage: () => {
1131
- return this.listAreaCodesPagingPage(countryCode, phoneNumberType, options);
1243
+ byPage: (settings) => {
1244
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1245
+ throw new Error("maxPageSize is not supported by this operation.");
1246
+ }
1247
+ return this.listAreaCodesPagingPage(countryCode, phoneNumberType, options, settings);
1132
1248
  }
1133
1249
  };
1134
1250
  }
1135
- listAreaCodesPagingPage(countryCode, phoneNumberType, options) {
1251
+ listAreaCodesPagingPage(countryCode, phoneNumberType, options, settings) {
1136
1252
  return tslib.__asyncGenerator(this, arguments, function* listAreaCodesPagingPage_1() {
1137
- let result = yield tslib.__await(this._listAreaCodes(countryCode, phoneNumberType, options));
1138
- yield yield tslib.__await(result.areaCodes || []);
1139
- let continuationToken = result.nextLink;
1253
+ let result;
1254
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1255
+ if (!continuationToken) {
1256
+ result = yield tslib.__await(this._listAreaCodes(countryCode, phoneNumberType, options));
1257
+ let page = result.areaCodes || [];
1258
+ continuationToken = result.nextLink;
1259
+ setContinuationToken(page, continuationToken);
1260
+ yield yield tslib.__await(page);
1261
+ }
1140
1262
  while (continuationToken) {
1141
- result = yield tslib.__await(this._listAreaCodesNext(countryCode, phoneNumberType, continuationToken, options));
1263
+ result = yield tslib.__await(this._listAreaCodesNext(countryCode, continuationToken, options));
1142
1264
  continuationToken = result.nextLink;
1143
- yield yield tslib.__await(result.areaCodes || []);
1265
+ let page = result.areaCodes || [];
1266
+ setContinuationToken(page, continuationToken);
1267
+ yield yield tslib.__await(page);
1144
1268
  }
1145
1269
  });
1146
1270
  }
@@ -1148,16 +1272,11 @@ class PhoneNumbersImpl {
1148
1272
  return tslib.__asyncGenerator(this, arguments, function* listAreaCodesPagingAll_1() {
1149
1273
  var _a, e_1, _b, _c;
1150
1274
  try {
1151
- for (var _d = true, _e = tslib.__asyncValues(this.listAreaCodesPagingPage(countryCode, phoneNumberType, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
1275
+ for (var _d = true, _e = tslib.__asyncValues(this.listAreaCodesPagingPage(countryCode, phoneNumberType, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
1152
1276
  _c = _f.value;
1153
1277
  _d = false;
1154
- try {
1155
- const page = _c;
1156
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1157
- }
1158
- finally {
1159
- _d = true;
1160
- }
1278
+ const page = _c;
1279
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1161
1280
  }
1162
1281
  }
1163
1282
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -1182,20 +1301,31 @@ class PhoneNumbersImpl {
1182
1301
  [Symbol.asyncIterator]() {
1183
1302
  return this;
1184
1303
  },
1185
- byPage: () => {
1186
- return this.listAvailableCountriesPagingPage(options);
1304
+ byPage: (settings) => {
1305
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1306
+ throw new Error("maxPageSize is not supported by this operation.");
1307
+ }
1308
+ return this.listAvailableCountriesPagingPage(options, settings);
1187
1309
  }
1188
1310
  };
1189
1311
  }
1190
- listAvailableCountriesPagingPage(options) {
1312
+ listAvailableCountriesPagingPage(options, settings) {
1191
1313
  return tslib.__asyncGenerator(this, arguments, function* listAvailableCountriesPagingPage_1() {
1192
- let result = yield tslib.__await(this._listAvailableCountries(options));
1193
- yield yield tslib.__await(result.countries || []);
1194
- let continuationToken = result.nextLink;
1314
+ let result;
1315
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1316
+ if (!continuationToken) {
1317
+ result = yield tslib.__await(this._listAvailableCountries(options));
1318
+ let page = result.countries || [];
1319
+ continuationToken = result.nextLink;
1320
+ setContinuationToken(page, continuationToken);
1321
+ yield yield tslib.__await(page);
1322
+ }
1195
1323
  while (continuationToken) {
1196
1324
  result = yield tslib.__await(this._listAvailableCountriesNext(continuationToken, options));
1197
1325
  continuationToken = result.nextLink;
1198
- yield yield tslib.__await(result.countries || []);
1326
+ let page = result.countries || [];
1327
+ setContinuationToken(page, continuationToken);
1328
+ yield yield tslib.__await(page);
1199
1329
  }
1200
1330
  });
1201
1331
  }
@@ -1203,16 +1333,11 @@ class PhoneNumbersImpl {
1203
1333
  return tslib.__asyncGenerator(this, arguments, function* listAvailableCountriesPagingAll_1() {
1204
1334
  var _a, e_2, _b, _c;
1205
1335
  try {
1206
- for (var _d = true, _e = tslib.__asyncValues(this.listAvailableCountriesPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
1336
+ for (var _d = true, _e = tslib.__asyncValues(this.listAvailableCountriesPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
1207
1337
  _c = _f.value;
1208
1338
  _d = false;
1209
- try {
1210
- const page = _c;
1211
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1212
- }
1213
- finally {
1214
- _d = true;
1215
- }
1339
+ const page = _c;
1340
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1216
1341
  }
1217
1342
  }
1218
1343
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1238,20 +1363,31 @@ class PhoneNumbersImpl {
1238
1363
  [Symbol.asyncIterator]() {
1239
1364
  return this;
1240
1365
  },
1241
- byPage: () => {
1242
- return this.listAvailableLocalitiesPagingPage(countryCode, options);
1366
+ byPage: (settings) => {
1367
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1368
+ throw new Error("maxPageSize is not supported by this operation.");
1369
+ }
1370
+ return this.listAvailableLocalitiesPagingPage(countryCode, options, settings);
1243
1371
  }
1244
1372
  };
1245
1373
  }
1246
- listAvailableLocalitiesPagingPage(countryCode, options) {
1374
+ listAvailableLocalitiesPagingPage(countryCode, options, settings) {
1247
1375
  return tslib.__asyncGenerator(this, arguments, function* listAvailableLocalitiesPagingPage_1() {
1248
- let result = yield tslib.__await(this._listAvailableLocalities(countryCode, options));
1249
- yield yield tslib.__await(result.phoneNumberLocalities || []);
1250
- let continuationToken = result.nextLink;
1376
+ let result;
1377
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1378
+ if (!continuationToken) {
1379
+ result = yield tslib.__await(this._listAvailableLocalities(countryCode, options));
1380
+ let page = result.phoneNumberLocalities || [];
1381
+ continuationToken = result.nextLink;
1382
+ setContinuationToken(page, continuationToken);
1383
+ yield yield tslib.__await(page);
1384
+ }
1251
1385
  while (continuationToken) {
1252
1386
  result = yield tslib.__await(this._listAvailableLocalitiesNext(countryCode, continuationToken, options));
1253
1387
  continuationToken = result.nextLink;
1254
- yield yield tslib.__await(result.phoneNumberLocalities || []);
1388
+ let page = result.phoneNumberLocalities || [];
1389
+ setContinuationToken(page, continuationToken);
1390
+ yield yield tslib.__await(page);
1255
1391
  }
1256
1392
  });
1257
1393
  }
@@ -1259,16 +1395,11 @@ class PhoneNumbersImpl {
1259
1395
  return tslib.__asyncGenerator(this, arguments, function* listAvailableLocalitiesPagingAll_1() {
1260
1396
  var _a, e_3, _b, _c;
1261
1397
  try {
1262
- for (var _d = true, _e = tslib.__asyncValues(this.listAvailableLocalitiesPagingPage(countryCode, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
1398
+ for (var _d = true, _e = tslib.__asyncValues(this.listAvailableLocalitiesPagingPage(countryCode, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
1263
1399
  _c = _f.value;
1264
1400
  _d = false;
1265
- try {
1266
- const page = _c;
1267
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1268
- }
1269
- finally {
1270
- _d = true;
1271
- }
1401
+ const page = _c;
1402
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1272
1403
  }
1273
1404
  }
1274
1405
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -1294,20 +1425,31 @@ class PhoneNumbersImpl {
1294
1425
  [Symbol.asyncIterator]() {
1295
1426
  return this;
1296
1427
  },
1297
- byPage: () => {
1298
- return this.listOfferingsPagingPage(countryCode, options);
1428
+ byPage: (settings) => {
1429
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1430
+ throw new Error("maxPageSize is not supported by this operation.");
1431
+ }
1432
+ return this.listOfferingsPagingPage(countryCode, options, settings);
1299
1433
  }
1300
1434
  };
1301
1435
  }
1302
- listOfferingsPagingPage(countryCode, options) {
1436
+ listOfferingsPagingPage(countryCode, options, settings) {
1303
1437
  return tslib.__asyncGenerator(this, arguments, function* listOfferingsPagingPage_1() {
1304
- let result = yield tslib.__await(this._listOfferings(countryCode, options));
1305
- yield yield tslib.__await(result.phoneNumberOfferings || []);
1306
- let continuationToken = result.nextLink;
1438
+ let result;
1439
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1440
+ if (!continuationToken) {
1441
+ result = yield tslib.__await(this._listOfferings(countryCode, options));
1442
+ let page = result.phoneNumberOfferings || [];
1443
+ continuationToken = result.nextLink;
1444
+ setContinuationToken(page, continuationToken);
1445
+ yield yield tslib.__await(page);
1446
+ }
1307
1447
  while (continuationToken) {
1308
1448
  result = yield tslib.__await(this._listOfferingsNext(countryCode, continuationToken, options));
1309
1449
  continuationToken = result.nextLink;
1310
- yield yield tslib.__await(result.phoneNumberOfferings || []);
1450
+ let page = result.phoneNumberOfferings || [];
1451
+ setContinuationToken(page, continuationToken);
1452
+ yield yield tslib.__await(page);
1311
1453
  }
1312
1454
  });
1313
1455
  }
@@ -1315,16 +1457,11 @@ class PhoneNumbersImpl {
1315
1457
  return tslib.__asyncGenerator(this, arguments, function* listOfferingsPagingAll_1() {
1316
1458
  var _a, e_4, _b, _c;
1317
1459
  try {
1318
- for (var _d = true, _e = tslib.__asyncValues(this.listOfferingsPagingPage(countryCode, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
1460
+ for (var _d = true, _e = tslib.__asyncValues(this.listOfferingsPagingPage(countryCode, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
1319
1461
  _c = _f.value;
1320
1462
  _d = false;
1321
- try {
1322
- const page = _c;
1323
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1324
- }
1325
- finally {
1326
- _d = true;
1327
- }
1463
+ const page = _c;
1464
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1328
1465
  }
1329
1466
  }
1330
1467
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
@@ -1349,20 +1486,31 @@ class PhoneNumbersImpl {
1349
1486
  [Symbol.asyncIterator]() {
1350
1487
  return this;
1351
1488
  },
1352
- byPage: () => {
1353
- return this.listPhoneNumbersPagingPage(options);
1489
+ byPage: (settings) => {
1490
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1491
+ throw new Error("maxPageSize is not supported by this operation.");
1492
+ }
1493
+ return this.listPhoneNumbersPagingPage(options, settings);
1354
1494
  }
1355
1495
  };
1356
1496
  }
1357
- listPhoneNumbersPagingPage(options) {
1497
+ listPhoneNumbersPagingPage(options, settings) {
1358
1498
  return tslib.__asyncGenerator(this, arguments, function* listPhoneNumbersPagingPage_1() {
1359
- let result = yield tslib.__await(this._listPhoneNumbers(options));
1360
- yield yield tslib.__await(result.phoneNumbers || []);
1361
- let continuationToken = result.nextLink;
1499
+ let result;
1500
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1501
+ if (!continuationToken) {
1502
+ result = yield tslib.__await(this._listPhoneNumbers(options));
1503
+ let page = result.phoneNumbers || [];
1504
+ continuationToken = result.nextLink;
1505
+ setContinuationToken(page, continuationToken);
1506
+ yield yield tslib.__await(page);
1507
+ }
1362
1508
  while (continuationToken) {
1363
1509
  result = yield tslib.__await(this._listPhoneNumbersNext(continuationToken, options));
1364
1510
  continuationToken = result.nextLink;
1365
- yield yield tslib.__await(result.phoneNumbers || []);
1511
+ let page = result.phoneNumbers || [];
1512
+ setContinuationToken(page, continuationToken);
1513
+ yield yield tslib.__await(page);
1366
1514
  }
1367
1515
  });
1368
1516
  }
@@ -1370,16 +1518,11 @@ class PhoneNumbersImpl {
1370
1518
  return tslib.__asyncGenerator(this, arguments, function* listPhoneNumbersPagingAll_1() {
1371
1519
  var _a, e_5, _b, _c;
1372
1520
  try {
1373
- for (var _d = true, _e = tslib.__asyncValues(this.listPhoneNumbersPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
1521
+ for (var _d = true, _e = tslib.__asyncValues(this.listPhoneNumbersPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
1374
1522
  _c = _f.value;
1375
1523
  _d = false;
1376
- try {
1377
- const page = _c;
1378
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1379
- }
1380
- finally {
1381
- _d = true;
1382
- }
1524
+ const page = _c;
1525
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1383
1526
  }
1384
1527
  }
1385
1528
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
@@ -1446,7 +1589,7 @@ class PhoneNumbersImpl {
1446
1589
  return this.client.sendOperationRequest(args, spec);
1447
1590
  });
1448
1591
  };
1449
- const sendOperation = async (args, spec) => {
1592
+ const sendOperationFn = async (args, spec) => {
1450
1593
  var _a;
1451
1594
  let currentRawResponse = undefined;
1452
1595
  const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
@@ -1465,7 +1608,17 @@ class PhoneNumbersImpl {
1465
1608
  }
1466
1609
  };
1467
1610
  };
1468
- const lro = new LroImpl(sendOperation, { countryCode, phoneNumberType, assignmentType, capabilities, options }, searchAvailablePhoneNumbersOperationSpec);
1611
+ const lro = createLroSpec({
1612
+ sendOperationFn,
1613
+ args: {
1614
+ countryCode,
1615
+ phoneNumberType,
1616
+ assignmentType,
1617
+ capabilities,
1618
+ options
1619
+ },
1620
+ spec: searchAvailablePhoneNumbersOperationSpec
1621
+ });
1469
1622
  const poller = new coreLro.LroEngine(lro, {
1470
1623
  resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
1471
1624
  intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
@@ -1507,7 +1660,7 @@ class PhoneNumbersImpl {
1507
1660
  return this.client.sendOperationRequest(args, spec);
1508
1661
  });
1509
1662
  };
1510
- const sendOperation = async (args, spec) => {
1663
+ const sendOperationFn = async (args, spec) => {
1511
1664
  var _a;
1512
1665
  let currentRawResponse = undefined;
1513
1666
  const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
@@ -1526,7 +1679,11 @@ class PhoneNumbersImpl {
1526
1679
  }
1527
1680
  };
1528
1681
  };
1529
- const lro = new LroImpl(sendOperation, { options }, purchasePhoneNumbersOperationSpec);
1682
+ const lro = createLroSpec({
1683
+ sendOperationFn,
1684
+ args: { options },
1685
+ spec: purchasePhoneNumbersOperationSpec
1686
+ });
1530
1687
  const poller = new coreLro.LroEngine(lro, {
1531
1688
  resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
1532
1689
  intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs
@@ -1574,7 +1731,7 @@ class PhoneNumbersImpl {
1574
1731
  return this.client.sendOperationRequest(args, spec);
1575
1732
  });
1576
1733
  };
1577
- const sendOperation = async (args, spec) => {
1734
+ const sendOperationFn = async (args, spec) => {
1578
1735
  var _a;
1579
1736
  let currentRawResponse = undefined;
1580
1737
  const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
@@ -1593,7 +1750,11 @@ class PhoneNumbersImpl {
1593
1750
  }
1594
1751
  };
1595
1752
  };
1596
- const lro = new LroImpl(sendOperation, { phoneNumber, options }, updateCapabilitiesOperationSpec);
1753
+ const lro = createLroSpec({
1754
+ sendOperationFn,
1755
+ args: { phoneNumber, options },
1756
+ spec: updateCapabilitiesOperationSpec
1757
+ });
1597
1758
  const poller = new coreLro.LroEngine(lro, {
1598
1759
  resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
1599
1760
  intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
@@ -1634,7 +1795,7 @@ class PhoneNumbersImpl {
1634
1795
  return this.client.sendOperationRequest(args, spec);
1635
1796
  });
1636
1797
  };
1637
- const sendOperation = async (args, spec) => {
1798
+ const sendOperationFn = async (args, spec) => {
1638
1799
  var _a;
1639
1800
  let currentRawResponse = undefined;
1640
1801
  const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
@@ -1653,7 +1814,11 @@ class PhoneNumbersImpl {
1653
1814
  }
1654
1815
  };
1655
1816
  };
1656
- const lro = new LroImpl(sendOperation, { phoneNumber, options }, releasePhoneNumberOperationSpec);
1817
+ const lro = createLroSpec({
1818
+ sendOperationFn,
1819
+ args: { phoneNumber, options },
1820
+ spec: releasePhoneNumberOperationSpec
1821
+ });
1657
1822
  const poller = new coreLro.LroEngine(lro, {
1658
1823
  resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
1659
1824
  intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs
@@ -1679,16 +1844,24 @@ class PhoneNumbersImpl {
1679
1844
  return this.client.sendOperationRequest({ options }, listPhoneNumbersOperationSpec);
1680
1845
  });
1681
1846
  }
1847
+ /**
1848
+ * Searches for number format and operator information for a given list of phone numbers.
1849
+ * @param options The options parameters.
1850
+ */
1851
+ async operatorInformationSearch(options) {
1852
+ return tracingClient.withSpan("PhoneNumbersClient.operatorInformationSearch", options !== null && options !== void 0 ? options : {}, async (options) => {
1853
+ return this.client.sendOperationRequest({ options }, operatorInformationSearchOperationSpec);
1854
+ });
1855
+ }
1682
1856
  /**
1683
1857
  * ListAreaCodesNext
1684
1858
  * @param countryCode The ISO 3166-2 country code, e.g. US.
1685
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
1686
1859
  * @param nextLink The nextLink from the previous successful call to the ListAreaCodes method.
1687
1860
  * @param options The options parameters.
1688
1861
  */
1689
- async _listAreaCodesNext(countryCode, phoneNumberType, nextLink, options) {
1862
+ async _listAreaCodesNext(countryCode, nextLink, options) {
1690
1863
  return tracingClient.withSpan("PhoneNumbersClient._listAreaCodesNext", options !== null && options !== void 0 ? options : {}, async (options) => {
1691
- return this.client.sendOperationRequest({ countryCode, phoneNumberType, nextLink, options }, listAreaCodesNextOperationSpec);
1864
+ return this.client.sendOperationRequest({ countryCode, nextLink, options }, listAreaCodesNextOperationSpec);
1692
1865
  });
1693
1866
  }
1694
1867
  /**
@@ -1971,7 +2144,7 @@ const updateCapabilitiesOperationSpec = {
1971
2144
  },
1972
2145
  queryParameters: [apiVersion$1],
1973
2146
  urlParameters: [endpoint$1, phoneNumber],
1974
- headerParameters: [accept$1, contentType1$1],
2147
+ headerParameters: [accept$1, contentType1],
1975
2148
  mediaType: "json",
1976
2149
  serializer: serializer$1
1977
2150
  };
@@ -2032,6 +2205,27 @@ const listPhoneNumbersOperationSpec = {
2032
2205
  headerParameters: [accept$1],
2033
2206
  serializer: serializer$1
2034
2207
  };
2208
+ const operatorInformationSearchOperationSpec = {
2209
+ path: "/operatorInformation/:search",
2210
+ httpMethod: "POST",
2211
+ responses: {
2212
+ 200: {
2213
+ bodyMapper: OperatorInformationResult
2214
+ },
2215
+ default: {
2216
+ bodyMapper: CommunicationErrorResponse$1
2217
+ }
2218
+ },
2219
+ requestBody: {
2220
+ parameterPath: { phoneNumbers: ["options", "phoneNumbers"] },
2221
+ mapper: Object.assign(Object.assign({}, OperatorInformationRequest), { required: true })
2222
+ },
2223
+ queryParameters: [apiVersion$1, options],
2224
+ urlParameters: [endpoint$1],
2225
+ headerParameters: [accept$1, contentType$1],
2226
+ mediaType: "json",
2227
+ serializer: serializer$1
2228
+ };
2035
2229
  const listAreaCodesNextOperationSpec = {
2036
2230
  path: "{nextLink}",
2037
2231
  httpMethod: "GET",
@@ -2043,15 +2237,6 @@ const listAreaCodesNextOperationSpec = {
2043
2237
  bodyMapper: CommunicationErrorResponse$1
2044
2238
  }
2045
2239
  },
2046
- queryParameters: [
2047
- phoneNumberType,
2048
- skip,
2049
- maxPageSize,
2050
- assignmentType,
2051
- locality,
2052
- administrativeDivision,
2053
- apiVersion$1
2054
- ],
2055
2240
  urlParameters: [
2056
2241
  endpoint$1,
2057
2242
  countryCode,
@@ -2071,11 +2256,6 @@ const listAvailableCountriesNextOperationSpec = {
2071
2256
  bodyMapper: CommunicationErrorResponse$1
2072
2257
  }
2073
2258
  },
2074
- queryParameters: [
2075
- skip,
2076
- maxPageSize,
2077
- apiVersion$1
2078
- ],
2079
2259
  urlParameters: [endpoint$1, nextLink],
2080
2260
  headerParameters: [accept$1, acceptLanguage],
2081
2261
  serializer: serializer$1
@@ -2091,12 +2271,6 @@ const listAvailableLocalitiesNextOperationSpec = {
2091
2271
  bodyMapper: CommunicationErrorResponse$1
2092
2272
  }
2093
2273
  },
2094
- queryParameters: [
2095
- skip,
2096
- maxPageSize,
2097
- administrativeDivision,
2098
- apiVersion$1
2099
- ],
2100
2274
  urlParameters: [
2101
2275
  endpoint$1,
2102
2276
  countryCode,
@@ -2116,13 +2290,6 @@ const listOfferingsNextOperationSpec = {
2116
2290
  bodyMapper: CommunicationErrorResponse$1
2117
2291
  }
2118
2292
  },
2119
- queryParameters: [
2120
- skip,
2121
- maxPageSize,
2122
- assignmentType,
2123
- apiVersion$1,
2124
- phoneNumberType1
2125
- ],
2126
2293
  urlParameters: [
2127
2294
  endpoint$1,
2128
2295
  countryCode,
@@ -2142,7 +2309,6 @@ const listPhoneNumbersNextOperationSpec = {
2142
2309
  bodyMapper: CommunicationErrorResponse$1
2143
2310
  }
2144
2311
  },
2145
- queryParameters: [skip, apiVersion$1, top],
2146
2312
  urlParameters: [endpoint$1, nextLink],
2147
2313
  headerParameters: [accept$1],
2148
2314
  serializer: serializer$1
@@ -2155,11 +2321,10 @@ const listPhoneNumbersNextOperationSpec = {
2155
2321
  * Code generated by Microsoft (R) AutoRest Code Generator.
2156
2322
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
2157
2323
  */
2158
- class PhoneNumbersClient$1 extends coreClient__namespace.ServiceClient {
2324
+ let PhoneNumbersClient$1 = class PhoneNumbersClient extends coreClient__namespace.ServiceClient {
2159
2325
  /**
2160
2326
  * Initializes a new instance of the PhoneNumbersClient class.
2161
- * @param endpoint The communication resource, for example
2162
- * https://resourcename.communication.azure.com.
2327
+ * @param endpoint The communication resource, for example https://resourcename.communication.azure.com
2163
2328
  * @param options The parameter options
2164
2329
  */
2165
2330
  constructor(endpoint, options) {
@@ -2174,34 +2339,18 @@ class PhoneNumbersClient$1 extends coreClient__namespace.ServiceClient {
2174
2339
  const defaults = {
2175
2340
  requestContentType: "application/json; charset=utf-8"
2176
2341
  };
2177
- const packageDetails = `azsdk-js-communication-phone-numbers/1.3.0-alpha.20230820.1`;
2342
+ const packageDetails = `azsdk-js-communication-phone-numbers/1.2.1`;
2178
2343
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
2179
2344
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
2180
2345
  : `${packageDetails}`;
2181
2346
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
2182
2347
  userAgentPrefix
2183
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
2348
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
2184
2349
  super(optionsWithDefaults);
2185
- if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
2186
- const pipelinePolicies = options.pipeline.getOrderedPolicies();
2187
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
2188
- coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
2189
- if (!bearerTokenAuthenticationPolicyFound) {
2190
- this.pipeline.removePolicy({
2191
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
2192
- });
2193
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
2194
- scopes: `${optionsWithDefaults.baseUri}/.default`,
2195
- challengeCallbacks: {
2196
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
2197
- }
2198
- }));
2199
- }
2200
- }
2201
2350
  // Parameter assignments
2202
2351
  this.endpoint = endpoint;
2203
2352
  // Assigning values to Constant parameters
2204
- this.apiVersion = options.apiVersion || "2022-12-01";
2353
+ this.apiVersion = options.apiVersion || "2023-05-01-preview";
2205
2354
  this.phoneNumbers = new PhoneNumbersImpl(this);
2206
2355
  this.addCustomApiVersionPolicy(options.apiVersion);
2207
2356
  }
@@ -2230,10 +2379,46 @@ class PhoneNumbersClient$1 extends coreClient__namespace.ServiceClient {
2230
2379
  };
2231
2380
  this.pipeline.addPolicy(apiVersionPolicy);
2232
2381
  }
2233
- }
2382
+ };
2234
2383
 
2235
2384
  // Copyright (c) Microsoft Corporation.
2236
- const isPhoneNumbersClientOptions = (options) => options && !communicationCommon.isKeyCredential(options) && !coreAuth.isTokenCredential(options);
2385
+ // Licensed under the MIT license.
2386
+ /**
2387
+ * Creates a `PipelinePolicy` that converts relative URL values in the `nextLink` property to absolute URLs.
2388
+ *
2389
+ * This is necessary because the Core V2 library does not support paging with relative links at time of writing.
2390
+ *
2391
+ * @param host - The base URL of the resource.
2392
+ * @returns the `PipelinePolicy` that addresses the issue.
2393
+ */
2394
+ function createPhoneNumbersPagingPolicy(host) {
2395
+ return {
2396
+ name: "phoneNumbersPagingPolicy",
2397
+ async sendRequest(request, next) {
2398
+ var _a;
2399
+ const response = await next(request);
2400
+ let nextLink = (_a = response === null || response === void 0 ? void 0 : response.parsedBody) === null || _a === void 0 ? void 0 : _a.nextLink;
2401
+ if (nextLink && !nextLink.startsWith(host)) {
2402
+ nextLink = host.endsWith("/") ? nextLink.substring(1) : nextLink;
2403
+ const absolutePath = `${host}${nextLink}`;
2404
+ response.parsedBody.nextLink = absolutePath;
2405
+ }
2406
+ return response;
2407
+ },
2408
+ };
2409
+ }
2410
+
2411
+ // Copyright (c) Microsoft Corporation.
2412
+ // Licensed under the MIT license.
2413
+ /**
2414
+ * The \@azure\/logger configuration for this package.
2415
+ */
2416
+ const logger = logger$1.createClientLogger("communication-phone-numbers");
2417
+
2418
+ // Copyright (c) Microsoft Corporation.
2419
+ // Licensed under the MIT license.
2420
+ /// <reference lib="esnext.asynciterable" />
2421
+ const isPhoneNumbersClientOptions = (options) => options && !communicationCommon.isKeyCredential(options) && !coreAuth.isTokenCredential(options);
2237
2422
  /**
2238
2423
  * Client class for interacting with Azure Communication Services Phone Number Administration.
2239
2424
  */
@@ -2555,6 +2740,22 @@ class PhoneNumbersClient {
2555
2740
  span.end();
2556
2741
  }
2557
2742
  }
2743
+ /**
2744
+ * Search for operator information about specified phone numbers.
2745
+ *
2746
+ * @param phoneNumbers - The phone numbers to search.
2747
+ * @param options - Additional request options.
2748
+ */
2749
+ searchOperatorInformation(phoneNumbers, options = { formatOnly: false }) {
2750
+ return tracingClient.withSpan("PhoneNumbersClient-searchOperatorInformation", options, (updatedOptions) => {
2751
+ const params = updatedOptions;
2752
+ params.phoneNumbers = phoneNumbers;
2753
+ if (options.formatOnly) {
2754
+ params.options = "FormatOnly";
2755
+ }
2756
+ return this.client.phoneNumbers.operatorInformationSearch(params);
2757
+ });
2758
+ }
2558
2759
  }
2559
2760
 
2560
2761
  /*
@@ -2569,13 +2770,6 @@ const SipConfiguration = {
2569
2770
  name: "Composite",
2570
2771
  className: "SipConfiguration",
2571
2772
  modelProperties: {
2572
- domains: {
2573
- serializedName: "domains",
2574
- type: {
2575
- name: "Dictionary",
2576
- value: { type: { name: "Composite", className: "SipDomain" } }
2577
- }
2578
- },
2579
2773
  trunks: {
2580
2774
  serializedName: "trunks",
2581
2775
  type: {
@@ -2601,21 +2795,6 @@ const SipConfiguration = {
2601
2795
  }
2602
2796
  }
2603
2797
  };
2604
- const SipDomain = {
2605
- type: {
2606
- name: "Composite",
2607
- className: "SipDomain",
2608
- modelProperties: {
2609
- enabled: {
2610
- serializedName: "enabled",
2611
- required: true,
2612
- type: {
2613
- name: "Boolean"
2614
- }
2615
- }
2616
- }
2617
- }
2618
- };
2619
2798
  const SipTrunk = {
2620
2799
  type: {
2621
2800
  name: "Composite",
@@ -2627,100 +2806,6 @@ const SipTrunk = {
2627
2806
  type: {
2628
2807
  name: "Number"
2629
2808
  }
2630
- },
2631
- enabled: {
2632
- serializedName: "enabled",
2633
- required: true,
2634
- type: {
2635
- name: "Boolean"
2636
- }
2637
- },
2638
- health: {
2639
- serializedName: "health",
2640
- type: {
2641
- name: "Composite",
2642
- className: "SipTrunkHealth"
2643
- }
2644
- }
2645
- }
2646
- }
2647
- };
2648
- const SipTrunkHealth = {
2649
- type: {
2650
- name: "Composite",
2651
- className: "SipTrunkHealth",
2652
- modelProperties: {
2653
- tls: {
2654
- serializedName: "tls",
2655
- type: {
2656
- name: "Composite",
2657
- className: "SipTrunkTls"
2658
- }
2659
- },
2660
- ping: {
2661
- serializedName: "ping",
2662
- type: {
2663
- name: "Composite",
2664
- className: "SipTrunkPing"
2665
- }
2666
- },
2667
- activity: {
2668
- serializedName: "overall",
2669
- type: {
2670
- name: "Composite",
2671
- className: "SipTrunkActivity"
2672
- }
2673
- }
2674
- }
2675
- }
2676
- };
2677
- const SipTrunkTls = {
2678
- type: {
2679
- name: "Composite",
2680
- className: "SipTrunkTls",
2681
- modelProperties: {
2682
- status: {
2683
- serializedName: "status",
2684
- required: true,
2685
- type: {
2686
- name: "String"
2687
- }
2688
- }
2689
- }
2690
- }
2691
- };
2692
- const SipTrunkPing = {
2693
- type: {
2694
- name: "Composite",
2695
- className: "SipTrunkPing",
2696
- modelProperties: {
2697
- status: {
2698
- serializedName: "status",
2699
- required: true,
2700
- type: {
2701
- name: "String"
2702
- }
2703
- }
2704
- }
2705
- }
2706
- };
2707
- const SipTrunkActivity = {
2708
- type: {
2709
- name: "Composite",
2710
- className: "SipTrunkActivity",
2711
- modelProperties: {
2712
- status: {
2713
- serializedName: "status",
2714
- required: true,
2715
- type: {
2716
- name: "String"
2717
- }
2718
- },
2719
- inactiveReason: {
2720
- serializedName: "reason",
2721
- type: {
2722
- name: "String"
2723
- }
2724
2809
  }
2725
2810
  }
2726
2811
  }
@@ -2845,13 +2930,6 @@ const SipConfigurationUpdate = {
2845
2930
  name: "Composite",
2846
2931
  className: "SipConfigurationUpdate",
2847
2932
  modelProperties: {
2848
- domains: {
2849
- serializedName: "domains",
2850
- type: {
2851
- name: "Dictionary",
2852
- value: { type: { name: "Composite", className: "DomainPatch" } }
2853
- }
2854
- },
2855
2933
  trunks: {
2856
2934
  serializedName: "trunks",
2857
2935
  type: {
@@ -2877,20 +2955,6 @@ const SipConfigurationUpdate = {
2877
2955
  }
2878
2956
  }
2879
2957
  };
2880
- const DomainPatch = {
2881
- type: {
2882
- name: "Composite",
2883
- className: "DomainPatch",
2884
- modelProperties: {
2885
- enabled: {
2886
- serializedName: "enabled",
2887
- type: {
2888
- name: "Boolean"
2889
- }
2890
- }
2891
- }
2892
- }
2893
- };
2894
2958
  const TrunkUpdate = {
2895
2959
  type: {
2896
2960
  name: "Composite",
@@ -2901,35 +2965,6 @@ const TrunkUpdate = {
2901
2965
  type: {
2902
2966
  name: "Number"
2903
2967
  }
2904
- },
2905
- enabled: {
2906
- serializedName: "enabled",
2907
- type: {
2908
- name: "Boolean"
2909
- }
2910
- }
2911
- }
2912
- }
2913
- };
2914
- const RoutesForNumber = {
2915
- type: {
2916
- name: "Composite",
2917
- className: "RoutesForNumber",
2918
- modelProperties: {
2919
- matchingRoutes: {
2920
- constraints: {
2921
- MaxItems: 250
2922
- },
2923
- serializedName: "matchingRoutes",
2924
- type: {
2925
- name: "Sequence",
2926
- element: {
2927
- type: {
2928
- name: "Composite",
2929
- className: "SipTrunkRoute"
2930
- }
2931
- }
2932
- }
2933
2968
  }
2934
2969
  }
2935
2970
  }
@@ -2965,22 +3000,15 @@ const SipRoutingUpdateExceptionHeaders = {
2965
3000
 
2966
3001
  var Mappers = /*#__PURE__*/Object.freeze({
2967
3002
  __proto__: null,
2968
- SipConfiguration: SipConfiguration,
2969
- SipDomain: SipDomain,
2970
- SipTrunk: SipTrunk,
2971
- SipTrunkHealth: SipTrunkHealth,
2972
- SipTrunkTls: SipTrunkTls,
2973
- SipTrunkPing: SipTrunkPing,
2974
- SipTrunkActivity: SipTrunkActivity,
2975
- SipTrunkRoute: SipTrunkRoute,
2976
3003
  CommunicationErrorResponse: CommunicationErrorResponse,
2977
- SipRoutingError: SipRoutingError,
3004
+ SipConfiguration: SipConfiguration,
2978
3005
  SipConfigurationUpdate: SipConfigurationUpdate,
2979
- DomainPatch: DomainPatch,
2980
- TrunkUpdate: TrunkUpdate,
2981
- RoutesForNumber: RoutesForNumber,
3006
+ SipRoutingError: SipRoutingError,
2982
3007
  SipRoutingGetExceptionHeaders: SipRoutingGetExceptionHeaders,
2983
- SipRoutingUpdateExceptionHeaders: SipRoutingUpdateExceptionHeaders
3008
+ SipRoutingUpdateExceptionHeaders: SipRoutingUpdateExceptionHeaders,
3009
+ SipTrunk: SipTrunk,
3010
+ SipTrunkRoute: SipTrunkRoute,
3011
+ TrunkUpdate: TrunkUpdate
2984
3012
  });
2985
3013
 
2986
3014
  /*
@@ -3015,7 +3043,7 @@ const endpoint = {
3015
3043
  const apiVersion = {
3016
3044
  parameterPath: "apiVersion",
3017
3045
  mapper: {
3018
- defaultValue: "2023-04-01-preview",
3046
+ defaultValue: "2023-03-01",
3019
3047
  isConstant: true,
3020
3048
  serializedName: "api-version",
3021
3049
  type: {
@@ -3023,15 +3051,6 @@ const apiVersion = {
3023
3051
  }
3024
3052
  }
3025
3053
  };
3026
- const expand = {
3027
- parameterPath: ["options", "expand"],
3028
- mapper: {
3029
- serializedName: "expand",
3030
- type: {
3031
- name: "String"
3032
- }
3033
- }
3034
- };
3035
3054
  const contentType = {
3036
3055
  parameterPath: ["options", "contentType"],
3037
3056
  mapper: {
@@ -3043,27 +3062,6 @@ const contentType = {
3043
3062
  }
3044
3063
  }
3045
3064
  };
3046
- const contentType1 = {
3047
- parameterPath: ["options", "contentType"],
3048
- mapper: {
3049
- defaultValue: "application/json",
3050
- isConstant: true,
3051
- serializedName: "Content-Type",
3052
- type: {
3053
- name: "String"
3054
- }
3055
- }
3056
- };
3057
- const targetPhoneNumber = {
3058
- parameterPath: "targetPhoneNumber",
3059
- mapper: {
3060
- serializedName: "targetPhoneNumber",
3061
- required: true,
3062
- type: {
3063
- name: "String"
3064
- }
3065
- }
3066
- };
3067
3065
 
3068
3066
  /*
3069
3067
  * Copyright (c) Microsoft Corporation.
@@ -3095,14 +3093,6 @@ class SipRoutingImpl {
3095
3093
  update(options) {
3096
3094
  return this.client.sendOperationRequest({ options }, updateOperationSpec);
3097
3095
  }
3098
- /**
3099
- * Gets the list of routes matching the target phone number, ordered by priority.
3100
- * @param targetPhoneNumber Phone number to test routing patterns against
3101
- * @param options The options parameters.
3102
- */
3103
- testRoutesWithNumber(targetPhoneNumber, options) {
3104
- return this.client.sendOperationRequest({ targetPhoneNumber, options }, testRoutesWithNumberOperationSpec);
3105
- }
3106
3096
  }
3107
3097
  // Operation Specifications
3108
3098
  const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
@@ -3118,7 +3108,7 @@ const getOperationSpec = {
3118
3108
  headersMapper: SipRoutingGetExceptionHeaders
3119
3109
  }
3120
3110
  },
3121
- queryParameters: [apiVersion, expand],
3111
+ queryParameters: [apiVersion],
3122
3112
  urlParameters: [endpoint],
3123
3113
  headerParameters: [accept],
3124
3114
  serializer
@@ -3137,7 +3127,6 @@ const updateOperationSpec = {
3137
3127
  },
3138
3128
  requestBody: {
3139
3129
  parameterPath: {
3140
- domains: ["options", "domains"],
3141
3130
  trunks: ["options", "trunks"],
3142
3131
  routes: ["options", "routes"]
3143
3132
  },
@@ -3149,31 +3138,6 @@ const updateOperationSpec = {
3149
3138
  mediaType: "json",
3150
3139
  serializer
3151
3140
  };
3152
- const testRoutesWithNumberOperationSpec = {
3153
- path: "/sip:testRoutesWithNumber",
3154
- httpMethod: "POST",
3155
- responses: {
3156
- 200: {
3157
- bodyMapper: RoutesForNumber
3158
- },
3159
- default: {
3160
- bodyMapper: CommunicationErrorResponse
3161
- }
3162
- },
3163
- requestBody: {
3164
- parameterPath: {
3165
- domains: ["options", "domains"],
3166
- trunks: ["options", "trunks"],
3167
- routes: ["options", "routes"]
3168
- },
3169
- mapper: SipConfiguration
3170
- },
3171
- queryParameters: [apiVersion, targetPhoneNumber],
3172
- urlParameters: [endpoint],
3173
- headerParameters: [accept, contentType1],
3174
- mediaType: "json",
3175
- serializer
3176
- };
3177
3141
 
3178
3142
  /*
3179
3143
  * Copyright (c) Microsoft Corporation.
@@ -3199,7 +3163,7 @@ class SipRoutingClientContext extends coreClient__namespace.ServiceClient {
3199
3163
  const defaults = {
3200
3164
  requestContentType: "application/json; charset=utf-8"
3201
3165
  };
3202
- const packageDetails = `azsdk-js-communication-phone-numbers/1.3.0-alpha.20230820.1`;
3166
+ const packageDetails = `azsdk-js-communication-phone-numbers/1.2.1`;
3203
3167
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
3204
3168
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
3205
3169
  : `${packageDetails}`;
@@ -3210,7 +3174,7 @@ class SipRoutingClientContext extends coreClient__namespace.ServiceClient {
3210
3174
  // Parameter assignments
3211
3175
  this.endpoint = endpoint;
3212
3176
  // Assigning values to Constant parameters
3213
- this.apiVersion = options.apiVersion || "2023-04-01-preview";
3177
+ this.apiVersion = options.apiVersion || "2023-03-01";
3214
3178
  }
3215
3179
  }
3216
3180
 
@@ -3221,7 +3185,7 @@ class SipRoutingClientContext extends coreClient__namespace.ServiceClient {
3221
3185
  * Code generated by Microsoft (R) AutoRest Code Generator.
3222
3186
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
3223
3187
  */
3224
- class SipRoutingClient$1 extends SipRoutingClientContext {
3188
+ let SipRoutingClient$1 = class SipRoutingClient extends SipRoutingClientContext {
3225
3189
  /**
3226
3190
  * Initializes a new instance of the SipRoutingClient class.
3227
3191
  * @param endpoint The communication resource, for example https://resourcename.communication.azure.com
@@ -3231,7 +3195,7 @@ class SipRoutingClient$1 extends SipRoutingClientContext {
3231
3195
  super(endpoint, options);
3232
3196
  this.sipRouting = new SipRoutingImpl(this);
3233
3197
  }
3234
- }
3198
+ };
3235
3199
 
3236
3200
  // Copyright (c) Microsoft Corporation.
3237
3201
  // Licensed under the MIT license.
@@ -3243,7 +3207,8 @@ function transformFromRestModel(trunks) {
3243
3207
  const result = [];
3244
3208
  if (trunks) {
3245
3209
  Object.keys(trunks).forEach((fqdn) => {
3246
- result.push(Object.assign({ fqdn: fqdn }, trunks[fqdn]));
3210
+ const port = trunks[fqdn].sipSignalingPort;
3211
+ result.push({ fqdn: fqdn, sipSignalingPort: port });
3247
3212
  });
3248
3213
  }
3249
3214
  return result;
@@ -3255,41 +3220,13 @@ function transformFromRestModel(trunks) {
3255
3220
  function transformIntoRestModel(trunks) {
3256
3221
  const result = {};
3257
3222
  trunks.forEach((trunk) => {
3258
- result[trunk.fqdn] = {
3259
- sipSignalingPort: trunk.sipSignalingPort,
3260
- enabled: trunk.enabled,
3261
- };
3262
- });
3263
- return result;
3264
- }
3265
- /**
3266
- * @internal
3267
- * Transforming SIP domains REST model to SDK model
3268
- */
3269
- function transformDomainsFromRestModel(domains) {
3270
- const result = [];
3271
- if (domains) {
3272
- Object.keys(domains).forEach((domain) => {
3273
- const currentDomain = domains[domain];
3274
- const enabledFlag = currentDomain.enabled;
3275
- result.push({ domainName: domain, enabled: enabledFlag });
3276
- });
3277
- }
3278
- return result;
3279
- }
3280
- /**
3281
- * @internal
3282
- * Transforming SIP domains SDK model to REST model
3283
- */
3284
- function transformDomainsIntoRestModel(domains) {
3285
- const result = {};
3286
- domains.forEach((domain) => {
3287
- result[domain.domainName] = { enabled: domain.enabled };
3223
+ result[trunk.fqdn] = { sipSignalingPort: trunk.sipSignalingPort };
3288
3224
  });
3289
3225
  return result;
3290
3226
  }
3291
3227
 
3292
3228
  // Copyright (c) Microsoft Corporation.
3229
+ // Licensed under the MIT license.
3293
3230
  /**
3294
3231
  * Checks whether the type of a value is SipClientOptions or not.
3295
3232
  *
@@ -3317,18 +3254,31 @@ class SipRoutingClient {
3317
3254
  * @param options - The options parameters.
3318
3255
  */
3319
3256
  listTrunks(options = {}) {
3320
- const iter = this.listTrunksPagingAll(options);
3321
- return {
3322
- next() {
3323
- return iter.next();
3324
- },
3325
- [Symbol.asyncIterator]() {
3326
- return this;
3327
- },
3328
- byPage: () => {
3329
- return this.listTrunksPagingPage(options);
3330
- },
3331
- };
3257
+ const { span, updatedOptions } = tracingClient.startSpan("SipRoutingClient-listTrunks", options);
3258
+ try {
3259
+ const iter = this.listTrunksPagingAll(Object.assign({}, updatedOptions));
3260
+ return {
3261
+ next() {
3262
+ return iter.next();
3263
+ },
3264
+ [Symbol.asyncIterator]() {
3265
+ return this;
3266
+ },
3267
+ byPage: () => {
3268
+ return this.listTrunksPagingPage(Object.assign({}, updatedOptions));
3269
+ },
3270
+ };
3271
+ }
3272
+ catch (e) {
3273
+ span.setStatus({
3274
+ status: "error",
3275
+ error: e,
3276
+ });
3277
+ throw e;
3278
+ }
3279
+ finally {
3280
+ span.end();
3281
+ }
3332
3282
  }
3333
3283
  /**
3334
3284
  * Gets the SIP trunk.
@@ -3345,100 +3295,36 @@ class SipRoutingClient {
3345
3295
  throw { code: "NotFound", message: "Not Found" };
3346
3296
  });
3347
3297
  }
3348
- /**
3349
- * Gets the SIP domains.
3350
- * @param options - The options parameters.
3351
- */
3352
- listDomains(options = {}) {
3353
- const iter = this.listDomainsPagingAll(options);
3354
- return {
3355
- next() {
3356
- return iter.next();
3357
- },
3358
- [Symbol.asyncIterator]() {
3359
- return this;
3360
- },
3361
- byPage: () => {
3362
- return this.listDomainsPagingPage(options);
3363
- },
3364
- };
3365
- }
3366
- /**
3367
- * Gets the SIP domain.
3368
- * @param domainName - The domain's name (ex: contoso.com).
3369
- * @param options - The options parameters.
3370
- */
3371
- async getDomain(domainName, options = {}) {
3372
- return tracingClient.withSpan("SipRoutingClient-listDomains", options, async (updatedOptions) => {
3373
- const domains = await this.getDomainsInternal(updatedOptions);
3374
- const domain = domains.find((value) => value.domainName === domainName);
3375
- if (domain) {
3376
- return domain;
3377
- }
3378
- throw { code: "NotFound", message: "Not Found" };
3379
- });
3380
- }
3381
3298
  /**
3382
3299
  * Lists the SIP trunk routes.
3383
3300
  * @param options - The options parameters.
3384
3301
  */
3385
3302
  listRoutes(options = {}) {
3386
- const iter = this.listRoutesPagingAll(options);
3387
- return {
3388
- next() {
3389
- return iter.next();
3390
- },
3391
- [Symbol.asyncIterator]() {
3392
- return this;
3393
- },
3394
- byPage: () => {
3395
- return this.listRoutesPagingPage(options);
3396
- },
3397
- };
3398
- }
3399
- /**
3400
- * Sets the SIP domains.
3401
- * @param domains - The SIP domains to be set.
3402
- * @param options - The options parameters.
3403
- */
3404
- async setDomains(domains, options = {}) {
3405
- return tracingClient.withSpan("SipRoutingClient-setDomains", options, async (updatedOptions) => {
3406
- const update = { domains: transformDomainsIntoRestModel(domains) };
3407
- let config = await this.client.sipRouting.get(updatedOptions);
3408
- const storedDomains = transformDomainsFromRestModel(config.domains).map((domain) => domain.domainName);
3409
- const setDomains = domains.map((domain) => domain.domainName);
3410
- storedDomains.forEach((storedDomain) => {
3411
- const shouldDeleteStoredDomain = !setDomains.find((value) => value === storedDomain);
3412
- if (shouldDeleteStoredDomain) {
3413
- update.domains[storedDomain] = null;
3414
- }
3415
- });
3416
- const isPatchNeeded = Object.keys(update.domains).length > 0;
3417
- if (isPatchNeeded) {
3418
- const payload = Object.assign(Object.assign({}, updatedOptions), update);
3419
- config = await this.client.sipRouting.update(payload);
3420
- }
3421
- return transformDomainsFromRestModel(config.domains);
3422
- });
3423
- }
3424
- /**
3425
- * Sets the SIP domain.
3426
- * @param domain - The SIP domain to be set.
3427
- * @param options - The options parameters.
3428
- */
3429
- async setDomain(domain, options = {}) {
3430
- return tracingClient.withSpan("SipRoutingClient-setDomain", options, async (updatedOptions) => {
3431
- const update = {
3432
- domains: transformDomainsIntoRestModel([domain]),
3303
+ const { span, updatedOptions } = tracingClient.startSpan("SipRoutingClient-listRoutes", options);
3304
+ try {
3305
+ const iter = this.listRoutesPagingAll(Object.assign({}, updatedOptions));
3306
+ return {
3307
+ next() {
3308
+ return iter.next();
3309
+ },
3310
+ [Symbol.asyncIterator]() {
3311
+ return this;
3312
+ },
3313
+ byPage: () => {
3314
+ return this.listRoutesPagingPage(Object.assign({}, updatedOptions));
3315
+ },
3433
3316
  };
3434
- const payload = Object.assign(Object.assign({}, updatedOptions), update);
3435
- const config = await this.client.sipRouting.update(payload);
3436
- const storedDomains = transformDomainsFromRestModel(config.domains).find((value) => value.domainName === domain.domainName);
3437
- if (storedDomains) {
3438
- return storedDomains;
3439
- }
3440
- throw { code: "NotFound", message: "Not Found" };
3441
- });
3317
+ }
3318
+ catch (e) {
3319
+ span.setStatus({
3320
+ status: "error",
3321
+ error: e,
3322
+ });
3323
+ throw e;
3324
+ }
3325
+ finally {
3326
+ span.end();
3327
+ }
3442
3328
  }
3443
3329
  /**
3444
3330
  * Sets the SIP trunks.
@@ -3447,19 +3333,19 @@ class SipRoutingClient {
3447
3333
  */
3448
3334
  async setTrunks(trunks, options = {}) {
3449
3335
  return tracingClient.withSpan("SipRoutingClient-setTrunks", options, async (updatedOptions) => {
3450
- const update = { trunks: transformIntoRestModel(trunks) };
3336
+ const patch = { trunks: transformIntoRestModel(trunks) };
3451
3337
  let config = await this.client.sipRouting.get(updatedOptions);
3452
3338
  const storedFqdns = transformFromRestModel(config.trunks).map((trunk) => trunk.fqdn);
3453
3339
  const setFqdns = trunks.map((trunk) => trunk.fqdn);
3454
3340
  storedFqdns.forEach((storedFqdn) => {
3455
3341
  const shouldDeleteStoredTrunk = !setFqdns.find((value) => value === storedFqdn);
3456
3342
  if (shouldDeleteStoredTrunk) {
3457
- update.trunks[storedFqdn] = null;
3343
+ patch.trunks[storedFqdn] = null;
3458
3344
  }
3459
3345
  });
3460
- const isPatchNeeded = Object.keys(update.trunks).length > 0;
3346
+ const isPatchNeeded = Object.keys(patch.trunks).length > 0;
3461
3347
  if (isPatchNeeded) {
3462
- const payload = Object.assign(Object.assign({}, updatedOptions), update);
3348
+ const payload = Object.assign(Object.assign({}, updatedOptions), patch);
3463
3349
  config = await this.client.sipRouting.update(payload);
3464
3350
  }
3465
3351
  return transformFromRestModel(config.trunks);
@@ -3472,10 +3358,10 @@ class SipRoutingClient {
3472
3358
  */
3473
3359
  async setTrunk(trunk, options = {}) {
3474
3360
  return tracingClient.withSpan("SipRoutingClient-setTrunk", options, async (updatedOptions) => {
3475
- const update = {
3361
+ const patch = {
3476
3362
  trunks: transformIntoRestModel([trunk]),
3477
3363
  };
3478
- const payload = Object.assign(Object.assign({}, updatedOptions), update);
3364
+ const payload = Object.assign(Object.assign({}, updatedOptions), patch);
3479
3365
  const config = await this.client.sipRouting.update(payload);
3480
3366
  const storedTrunk = transformFromRestModel(config.trunks).find((value) => value.fqdn === trunk.fqdn);
3481
3367
  if (storedTrunk) {
@@ -3491,10 +3377,10 @@ class SipRoutingClient {
3491
3377
  */
3492
3378
  async setRoutes(routes, options = {}) {
3493
3379
  return tracingClient.withSpan("SipRoutingClient-setRoutes", options, async (updatedOptions) => {
3494
- const update = {
3380
+ const patch = {
3495
3381
  routes: routes,
3496
3382
  };
3497
- const payload = Object.assign(Object.assign({}, updatedOptions), update);
3383
+ const payload = Object.assign(Object.assign({}, updatedOptions), patch);
3498
3384
  const config = await this.client.sipRouting.update(payload);
3499
3385
  const storedRoutes = config.routes || (await this.getRoutesInternal(updatedOptions));
3500
3386
  return storedRoutes;
@@ -3509,66 +3395,30 @@ class SipRoutingClient {
3509
3395
  return tracingClient.withSpan("SipRoutingClient-deleteTrunk", options, async (updatedOptions) => {
3510
3396
  const trunks = {};
3511
3397
  trunks[fqdn] = null;
3512
- const update = {
3398
+ const patch = {
3513
3399
  trunks: trunks,
3514
3400
  };
3515
- const payload = Object.assign(Object.assign({}, updatedOptions), update);
3401
+ const payload = Object.assign(Object.assign({}, updatedOptions), patch);
3516
3402
  await this.client.sipRouting.update(payload);
3517
3403
  });
3518
3404
  }
3519
- /**
3520
- * Deletes the SIP domain.
3521
- * @param domainName - The domain's name (ex: contoso.com).
3522
- * @param options - The options parameters.
3523
- */
3524
- async deleteDomain(domainName, options = {}) {
3525
- return tracingClient.withSpan("SipRoutingClient-deleteDomain", options, async (updatedOptions) => {
3526
- const domains = {};
3527
- domains[domainName] = null;
3528
- const update = {
3529
- domains: domains,
3530
- };
3531
- const payload = Object.assign(Object.assign({}, updatedOptions), update);
3532
- await this.client.sipRouting.update(payload);
3533
- });
3534
- }
3535
- async matchNumberToRoutes(phoneNumber, options) {
3536
- var _a;
3537
- const config = await this.client.sipRouting.get(options);
3538
- const apiResult = await this.client.sipRouting.testRoutesWithNumber(phoneNumber, config);
3539
- return (_a = apiResult.matchingRoutes) !== null && _a !== void 0 ? _a : [];
3540
- }
3541
3405
  async getRoutesInternal(options) {
3542
3406
  const config = await this.client.sipRouting.get(options);
3543
3407
  return config.routes || [];
3544
3408
  }
3545
3409
  async getTrunksInternal(options) {
3546
- const { includeHealth } = options, requestOptions = tslib.__rest(options, ["includeHealth"]);
3547
- let updatedOptions = requestOptions;
3548
- if (includeHealth) {
3549
- updatedOptions = Object.assign(Object.assign({}, requestOptions), { expand: "trunks/health" });
3550
- }
3551
- const config = await this.client.sipRouting.get(updatedOptions);
3552
- return transformFromRestModel(config.trunks);
3553
- }
3554
- async getDomainsInternal(options = {}) {
3555
3410
  const config = await this.client.sipRouting.get(options);
3556
- return transformDomainsFromRestModel(config.domains);
3411
+ return transformFromRestModel(config.trunks);
3557
3412
  }
3558
3413
  listRoutesPagingAll(options) {
3559
3414
  return tslib.__asyncGenerator(this, arguments, function* listRoutesPagingAll_1() {
3560
3415
  var _a, e_1, _b, _c;
3561
3416
  try {
3562
- for (var _d = true, _e = tslib.__asyncValues(this.listRoutesPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
3417
+ for (var _d = true, _e = tslib.__asyncValues(this.listRoutesPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
3563
3418
  _c = _f.value;
3564
3419
  _d = false;
3565
- try {
3566
- const page = _c;
3567
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
3568
- }
3569
- finally {
3570
- _d = true;
3571
- }
3420
+ const page = _c;
3421
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
3572
3422
  }
3573
3423
  }
3574
3424
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -3584,16 +3434,11 @@ class SipRoutingClient {
3584
3434
  return tslib.__asyncGenerator(this, arguments, function* listTrunksPagingAll_1() {
3585
3435
  var _a, e_2, _b, _c;
3586
3436
  try {
3587
- for (var _d = true, _e = tslib.__asyncValues(this.listTrunksPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
3437
+ for (var _d = true, _e = tslib.__asyncValues(this.listTrunksPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
3588
3438
  _c = _f.value;
3589
3439
  _d = false;
3590
- try {
3591
- const page = _c;
3592
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
3593
- }
3594
- finally {
3595
- _d = true;
3596
- }
3440
+ const page = _c;
3441
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
3597
3442
  }
3598
3443
  }
3599
3444
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -3605,43 +3450,12 @@ class SipRoutingClient {
3605
3450
  }
3606
3451
  });
3607
3452
  }
3608
- listDomainsPagingAll(options) {
3609
- return tslib.__asyncGenerator(this, arguments, function* listDomainsPagingAll_1() {
3610
- var _a, e_3, _b, _c;
3611
- try {
3612
- for (var _d = true, _e = tslib.__asyncValues(this.listDomainsPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
3613
- _c = _f.value;
3614
- _d = false;
3615
- try {
3616
- const page = _c;
3617
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
3618
- }
3619
- finally {
3620
- _d = true;
3621
- }
3622
- }
3623
- }
3624
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
3625
- finally {
3626
- try {
3627
- if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
3628
- }
3629
- finally { if (e_3) throw e_3.error; }
3630
- }
3631
- });
3632
- }
3633
3453
  listTrunksPagingPage(options = {}) {
3634
3454
  return tslib.__asyncGenerator(this, arguments, function* listTrunksPagingPage_1() {
3635
3455
  const apiResult = yield tslib.__await(this.getTrunksInternal(options));
3636
3456
  yield yield tslib.__await(apiResult);
3637
3457
  });
3638
3458
  }
3639
- listDomainsPagingPage(options = {}) {
3640
- return tslib.__asyncGenerator(this, arguments, function* listDomainsPagingPage_1() {
3641
- const apiResult = yield tslib.__await(this.getDomainsInternal(options));
3642
- yield yield tslib.__await(apiResult);
3643
- });
3644
- }
3645
3459
  listRoutesPagingPage(options = {}) {
3646
3460
  return tslib.__asyncGenerator(this, arguments, function* listRoutesPagingPage_1() {
3647
3461
  const apiResult = yield tslib.__await(this.getRoutesInternal(options));