@azure/communication-phone-numbers 1.3.0-alpha.20230517.1 → 1.3.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -18
- package/dist/index.js +421 -593
- package/dist/index.js.map +1 -1
- package/dist-esm/src/generated/src/index.js +1 -0
- package/dist-esm/src/generated/src/index.js.map +1 -1
- package/dist-esm/src/generated/src/lroImpl.js +11 -15
- package/dist-esm/src/generated/src/lroImpl.js.map +1 -1
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +110 -0
- package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/models/parameters.js +6 -2
- package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/operations/phoneNumbers.js +155 -76
- package/dist-esm/src/generated/src/operations/phoneNumbers.js.map +1 -1
- package/dist-esm/src/generated/src/operationsInterfaces/phoneNumbers.js.map +1 -1
- package/dist-esm/src/generated/src/pagingHelper.js +32 -0
- package/dist-esm/src/generated/src/pagingHelper.js.map +1 -0
- package/dist-esm/src/generated/src/phoneNumbersClient.js +4 -22
- package/dist-esm/src/generated/src/phoneNumbersClient.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/models/index.js +1 -6
- package/dist-esm/src/generated/src/siprouting/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/models/mappers.js +0 -166
- package/dist-esm/src/generated/src/siprouting/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/models/parameters.js +2 -48
- package/dist-esm/src/generated/src/siprouting/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/operations/sipRouting.js +1 -35
- package/dist-esm/src/generated/src/siprouting/operations/sipRouting.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/operationsInterfaces/sipRouting.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js +2 -2
- package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js.map +1 -1
- package/dist-esm/src/generated/src/tracing.js +1 -1
- package/dist-esm/src/generated/src/tracing.js.map +1 -1
- package/dist-esm/src/mappers.js +3 -31
- package/dist-esm/src/mappers.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/phoneNumbersClient.js +16 -3
- package/dist-esm/src/phoneNumbersClient.js.map +1 -1
- package/dist-esm/src/sipRoutingClient.js +63 -170
- package/dist-esm/src/sipRoutingClient.js.map +1 -1
- package/dist-esm/src/utils/constants.js +1 -1
- package/dist-esm/src/utils/constants.js.map +1 -1
- package/package.json +1 -2
- package/types/communication-phone-numbers.d.ts +53 -111
package/dist/index.js
CHANGED
@@ -3,12 +3,11 @@
|
|
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
13
|
function _interopNamespace(e) {
|
@@ -30,41 +29,25 @@ function _interopNamespace(e) {
|
|
30
29
|
}
|
31
30
|
|
32
31
|
var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
|
33
|
-
var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
|
34
32
|
|
35
|
-
|
36
|
-
|
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.
|
33
|
+
/*
|
34
|
+
* Copyright (c) Microsoft Corporation.
|
35
|
+
* Licensed under the MIT License.
|
41
36
|
*
|
42
|
-
*
|
43
|
-
*
|
37
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
38
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
44
39
|
*/
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
const absolutePath = `${host}${nextLink}`;
|
55
|
-
response.parsedBody.nextLink = absolutePath;
|
56
|
-
}
|
57
|
-
return response;
|
58
|
-
},
|
59
|
-
};
|
40
|
+
const pageMap = new WeakMap();
|
41
|
+
function setContinuationToken(page, continuationToken) {
|
42
|
+
var _a;
|
43
|
+
if (typeof page !== "object" || page === null || !continuationToken) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
|
47
|
+
pageInfo.continuationToken = continuationToken;
|
48
|
+
pageMap.set(page, pageInfo);
|
60
49
|
}
|
61
50
|
|
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
51
|
/*
|
69
52
|
* Copyright (c) Microsoft Corporation.
|
70
53
|
* Licensed under the MIT License.
|
@@ -75,7 +58,7 @@ const logger = logger$1.createClientLogger("communication-phone-numbers");
|
|
75
58
|
const tracingClient = coreTracing.createTracingClient({
|
76
59
|
namespace: "Microsoft.Communication",
|
77
60
|
packageName: "@azure/communication-phone-numbers",
|
78
|
-
packageVersion: "1.
|
61
|
+
packageVersion: "1.2.1"
|
79
62
|
});
|
80
63
|
|
81
64
|
/*
|
@@ -524,6 +507,18 @@ const PhoneNumberSearchResult = {
|
|
524
507
|
type: {
|
525
508
|
name: "DateTime"
|
526
509
|
}
|
510
|
+
},
|
511
|
+
errorCode: {
|
512
|
+
serializedName: "errorCode",
|
513
|
+
type: {
|
514
|
+
name: "Number"
|
515
|
+
}
|
516
|
+
},
|
517
|
+
error: {
|
518
|
+
serializedName: "error",
|
519
|
+
type: {
|
520
|
+
name: "String"
|
521
|
+
}
|
527
522
|
}
|
528
523
|
}
|
529
524
|
}
|
@@ -709,6 +704,104 @@ const PurchasedPhoneNumbers = {
|
|
709
704
|
}
|
710
705
|
}
|
711
706
|
};
|
707
|
+
const OperatorInformationRequest = {
|
708
|
+
type: {
|
709
|
+
name: "Composite",
|
710
|
+
className: "OperatorInformationRequest",
|
711
|
+
modelProperties: {
|
712
|
+
phoneNumbers: {
|
713
|
+
serializedName: "phoneNumbers",
|
714
|
+
type: {
|
715
|
+
name: "Sequence",
|
716
|
+
element: {
|
717
|
+
type: {
|
718
|
+
name: "String"
|
719
|
+
}
|
720
|
+
}
|
721
|
+
}
|
722
|
+
}
|
723
|
+
}
|
724
|
+
}
|
725
|
+
};
|
726
|
+
const OperatorInformationResult = {
|
727
|
+
type: {
|
728
|
+
name: "Composite",
|
729
|
+
className: "OperatorInformationResult",
|
730
|
+
modelProperties: {
|
731
|
+
values: {
|
732
|
+
serializedName: "values",
|
733
|
+
type: {
|
734
|
+
name: "Sequence",
|
735
|
+
element: {
|
736
|
+
type: {
|
737
|
+
name: "Composite",
|
738
|
+
className: "OperatorInformation"
|
739
|
+
}
|
740
|
+
}
|
741
|
+
}
|
742
|
+
}
|
743
|
+
}
|
744
|
+
}
|
745
|
+
};
|
746
|
+
const OperatorInformation = {
|
747
|
+
type: {
|
748
|
+
name: "Composite",
|
749
|
+
className: "OperatorInformation",
|
750
|
+
modelProperties: {
|
751
|
+
phoneNumber: {
|
752
|
+
serializedName: "phoneNumber",
|
753
|
+
type: {
|
754
|
+
name: "String"
|
755
|
+
}
|
756
|
+
},
|
757
|
+
numberType: {
|
758
|
+
serializedName: "numberType",
|
759
|
+
type: {
|
760
|
+
name: "String"
|
761
|
+
}
|
762
|
+
},
|
763
|
+
isoCountryCode: {
|
764
|
+
serializedName: "isoCountryCode",
|
765
|
+
type: {
|
766
|
+
name: "String"
|
767
|
+
}
|
768
|
+
},
|
769
|
+
operatorDetails: {
|
770
|
+
serializedName: "operatorDetails",
|
771
|
+
type: {
|
772
|
+
name: "Composite",
|
773
|
+
className: "OperatorDetails"
|
774
|
+
}
|
775
|
+
}
|
776
|
+
}
|
777
|
+
}
|
778
|
+
};
|
779
|
+
const OperatorDetails = {
|
780
|
+
type: {
|
781
|
+
name: "Composite",
|
782
|
+
className: "OperatorDetails",
|
783
|
+
modelProperties: {
|
784
|
+
name: {
|
785
|
+
serializedName: "name",
|
786
|
+
type: {
|
787
|
+
name: "String"
|
788
|
+
}
|
789
|
+
},
|
790
|
+
mobileNetworkCode: {
|
791
|
+
serializedName: "mobileNetworkCode",
|
792
|
+
type: {
|
793
|
+
name: "String"
|
794
|
+
}
|
795
|
+
},
|
796
|
+
mobileCountryCode: {
|
797
|
+
serializedName: "mobileCountryCode",
|
798
|
+
type: {
|
799
|
+
name: "String"
|
800
|
+
}
|
801
|
+
}
|
802
|
+
}
|
803
|
+
}
|
804
|
+
};
|
712
805
|
const PhoneNumbersSearchAvailablePhoneNumbersHeaders = {
|
713
806
|
type: {
|
714
807
|
name: "Composite",
|
@@ -862,6 +955,10 @@ var Mappers$1 = /*#__PURE__*/Object.freeze({
|
|
862
955
|
PhoneNumberCapabilitiesRequest: PhoneNumberCapabilitiesRequest,
|
863
956
|
PurchasedPhoneNumber: PurchasedPhoneNumber,
|
864
957
|
PurchasedPhoneNumbers: PurchasedPhoneNumbers,
|
958
|
+
OperatorInformationRequest: OperatorInformationRequest,
|
959
|
+
OperatorInformationResult: OperatorInformationResult,
|
960
|
+
OperatorInformation: OperatorInformation,
|
961
|
+
OperatorDetails: OperatorDetails,
|
865
962
|
PhoneNumbersSearchAvailablePhoneNumbersHeaders: PhoneNumbersSearchAvailablePhoneNumbersHeaders,
|
866
963
|
PhoneNumbersPurchasePhoneNumbersHeaders: PhoneNumbersPurchasePhoneNumbersHeaders,
|
867
964
|
PhoneNumbersGetOperationHeaders: PhoneNumbersGetOperationHeaders,
|
@@ -970,7 +1067,7 @@ const administrativeDivision = {
|
|
970
1067
|
const apiVersion$1 = {
|
971
1068
|
parameterPath: "apiVersion",
|
972
1069
|
mapper: {
|
973
|
-
defaultValue: "
|
1070
|
+
defaultValue: "2023-05-01-preview",
|
974
1071
|
isConstant: true,
|
975
1072
|
serializedName: "api-version",
|
976
1073
|
type: {
|
@@ -1028,7 +1125,7 @@ const operationId = {
|
|
1028
1125
|
}
|
1029
1126
|
}
|
1030
1127
|
};
|
1031
|
-
const contentType1
|
1128
|
+
const contentType1 = {
|
1032
1129
|
parameterPath: ["options", "contentType"],
|
1033
1130
|
mapper: {
|
1034
1131
|
defaultValue: "application/merge-patch+json",
|
@@ -1078,21 +1175,17 @@ const nextLink = {
|
|
1078
1175
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
1079
1176
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
1080
1177
|
*/
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
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
|
-
}
|
1178
|
+
function createLroSpec(inputs) {
|
1179
|
+
const { args, spec, sendOperationFn } = inputs;
|
1180
|
+
return {
|
1181
|
+
requestMethod: spec.httpMethod,
|
1182
|
+
requestPath: spec.path,
|
1183
|
+
sendInitialRequest: () => sendOperationFn(args, spec),
|
1184
|
+
sendPollRequest: (path, options) => {
|
1185
|
+
const restSpec = tslib.__rest(spec, ["requestBody"]);
|
1186
|
+
return sendOperationFn(args, Object.assign(Object.assign({}, restSpec), { httpMethod: "GET", path, abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal }));
|
1187
|
+
}
|
1188
|
+
};
|
1096
1189
|
}
|
1097
1190
|
|
1098
1191
|
/*
|
@@ -1127,20 +1220,31 @@ class PhoneNumbersImpl {
|
|
1127
1220
|
[Symbol.asyncIterator]() {
|
1128
1221
|
return this;
|
1129
1222
|
},
|
1130
|
-
byPage: () => {
|
1131
|
-
|
1223
|
+
byPage: (settings) => {
|
1224
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
1225
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
1226
|
+
}
|
1227
|
+
return this.listAreaCodesPagingPage(countryCode, phoneNumberType, options, settings);
|
1132
1228
|
}
|
1133
1229
|
};
|
1134
1230
|
}
|
1135
|
-
listAreaCodesPagingPage(countryCode, phoneNumberType, options) {
|
1231
|
+
listAreaCodesPagingPage(countryCode, phoneNumberType, options, settings) {
|
1136
1232
|
return tslib.__asyncGenerator(this, arguments, function* listAreaCodesPagingPage_1() {
|
1137
|
-
let result
|
1138
|
-
|
1139
|
-
|
1233
|
+
let result;
|
1234
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
1235
|
+
if (!continuationToken) {
|
1236
|
+
result = yield tslib.__await(this._listAreaCodes(countryCode, phoneNumberType, options));
|
1237
|
+
let page = result.areaCodes || [];
|
1238
|
+
continuationToken = result.nextLink;
|
1239
|
+
setContinuationToken(page, continuationToken);
|
1240
|
+
yield yield tslib.__await(page);
|
1241
|
+
}
|
1140
1242
|
while (continuationToken) {
|
1141
|
-
result = yield tslib.__await(this._listAreaCodesNext(countryCode,
|
1243
|
+
result = yield tslib.__await(this._listAreaCodesNext(countryCode, continuationToken, options));
|
1142
1244
|
continuationToken = result.nextLink;
|
1143
|
-
|
1245
|
+
let page = result.areaCodes || [];
|
1246
|
+
setContinuationToken(page, continuationToken);
|
1247
|
+
yield yield tslib.__await(page);
|
1144
1248
|
}
|
1145
1249
|
});
|
1146
1250
|
}
|
@@ -1182,20 +1286,31 @@ class PhoneNumbersImpl {
|
|
1182
1286
|
[Symbol.asyncIterator]() {
|
1183
1287
|
return this;
|
1184
1288
|
},
|
1185
|
-
byPage: () => {
|
1186
|
-
|
1289
|
+
byPage: (settings) => {
|
1290
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
1291
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
1292
|
+
}
|
1293
|
+
return this.listAvailableCountriesPagingPage(options, settings);
|
1187
1294
|
}
|
1188
1295
|
};
|
1189
1296
|
}
|
1190
|
-
listAvailableCountriesPagingPage(options) {
|
1297
|
+
listAvailableCountriesPagingPage(options, settings) {
|
1191
1298
|
return tslib.__asyncGenerator(this, arguments, function* listAvailableCountriesPagingPage_1() {
|
1192
|
-
let result
|
1193
|
-
|
1194
|
-
|
1299
|
+
let result;
|
1300
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
1301
|
+
if (!continuationToken) {
|
1302
|
+
result = yield tslib.__await(this._listAvailableCountries(options));
|
1303
|
+
let page = result.countries || [];
|
1304
|
+
continuationToken = result.nextLink;
|
1305
|
+
setContinuationToken(page, continuationToken);
|
1306
|
+
yield yield tslib.__await(page);
|
1307
|
+
}
|
1195
1308
|
while (continuationToken) {
|
1196
1309
|
result = yield tslib.__await(this._listAvailableCountriesNext(continuationToken, options));
|
1197
1310
|
continuationToken = result.nextLink;
|
1198
|
-
|
1311
|
+
let page = result.countries || [];
|
1312
|
+
setContinuationToken(page, continuationToken);
|
1313
|
+
yield yield tslib.__await(page);
|
1199
1314
|
}
|
1200
1315
|
});
|
1201
1316
|
}
|
@@ -1238,20 +1353,31 @@ class PhoneNumbersImpl {
|
|
1238
1353
|
[Symbol.asyncIterator]() {
|
1239
1354
|
return this;
|
1240
1355
|
},
|
1241
|
-
byPage: () => {
|
1242
|
-
|
1356
|
+
byPage: (settings) => {
|
1357
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
1358
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
1359
|
+
}
|
1360
|
+
return this.listAvailableLocalitiesPagingPage(countryCode, options, settings);
|
1243
1361
|
}
|
1244
1362
|
};
|
1245
1363
|
}
|
1246
|
-
listAvailableLocalitiesPagingPage(countryCode, options) {
|
1364
|
+
listAvailableLocalitiesPagingPage(countryCode, options, settings) {
|
1247
1365
|
return tslib.__asyncGenerator(this, arguments, function* listAvailableLocalitiesPagingPage_1() {
|
1248
|
-
let result
|
1249
|
-
|
1250
|
-
|
1366
|
+
let result;
|
1367
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
1368
|
+
if (!continuationToken) {
|
1369
|
+
result = yield tslib.__await(this._listAvailableLocalities(countryCode, options));
|
1370
|
+
let page = result.phoneNumberLocalities || [];
|
1371
|
+
continuationToken = result.nextLink;
|
1372
|
+
setContinuationToken(page, continuationToken);
|
1373
|
+
yield yield tslib.__await(page);
|
1374
|
+
}
|
1251
1375
|
while (continuationToken) {
|
1252
1376
|
result = yield tslib.__await(this._listAvailableLocalitiesNext(countryCode, continuationToken, options));
|
1253
1377
|
continuationToken = result.nextLink;
|
1254
|
-
|
1378
|
+
let page = result.phoneNumberLocalities || [];
|
1379
|
+
setContinuationToken(page, continuationToken);
|
1380
|
+
yield yield tslib.__await(page);
|
1255
1381
|
}
|
1256
1382
|
});
|
1257
1383
|
}
|
@@ -1294,20 +1420,31 @@ class PhoneNumbersImpl {
|
|
1294
1420
|
[Symbol.asyncIterator]() {
|
1295
1421
|
return this;
|
1296
1422
|
},
|
1297
|
-
byPage: () => {
|
1298
|
-
|
1423
|
+
byPage: (settings) => {
|
1424
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
1425
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
1426
|
+
}
|
1427
|
+
return this.listOfferingsPagingPage(countryCode, options, settings);
|
1299
1428
|
}
|
1300
1429
|
};
|
1301
1430
|
}
|
1302
|
-
listOfferingsPagingPage(countryCode, options) {
|
1431
|
+
listOfferingsPagingPage(countryCode, options, settings) {
|
1303
1432
|
return tslib.__asyncGenerator(this, arguments, function* listOfferingsPagingPage_1() {
|
1304
|
-
let result
|
1305
|
-
|
1306
|
-
|
1433
|
+
let result;
|
1434
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
1435
|
+
if (!continuationToken) {
|
1436
|
+
result = yield tslib.__await(this._listOfferings(countryCode, options));
|
1437
|
+
let page = result.phoneNumberOfferings || [];
|
1438
|
+
continuationToken = result.nextLink;
|
1439
|
+
setContinuationToken(page, continuationToken);
|
1440
|
+
yield yield tslib.__await(page);
|
1441
|
+
}
|
1307
1442
|
while (continuationToken) {
|
1308
1443
|
result = yield tslib.__await(this._listOfferingsNext(countryCode, continuationToken, options));
|
1309
1444
|
continuationToken = result.nextLink;
|
1310
|
-
|
1445
|
+
let page = result.phoneNumberOfferings || [];
|
1446
|
+
setContinuationToken(page, continuationToken);
|
1447
|
+
yield yield tslib.__await(page);
|
1311
1448
|
}
|
1312
1449
|
});
|
1313
1450
|
}
|
@@ -1349,20 +1486,31 @@ class PhoneNumbersImpl {
|
|
1349
1486
|
[Symbol.asyncIterator]() {
|
1350
1487
|
return this;
|
1351
1488
|
},
|
1352
|
-
byPage: () => {
|
1353
|
-
|
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
|
1360
|
-
|
1361
|
-
|
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
|
-
|
1511
|
+
let page = result.phoneNumbers || [];
|
1512
|
+
setContinuationToken(page, continuationToken);
|
1513
|
+
yield yield tslib.__await(page);
|
1366
1514
|
}
|
1367
1515
|
});
|
1368
1516
|
}
|
@@ -1446,7 +1594,7 @@ class PhoneNumbersImpl {
|
|
1446
1594
|
return this.client.sendOperationRequest(args, spec);
|
1447
1595
|
});
|
1448
1596
|
};
|
1449
|
-
const
|
1597
|
+
const sendOperationFn = async (args, spec) => {
|
1450
1598
|
var _a;
|
1451
1599
|
let currentRawResponse = undefined;
|
1452
1600
|
const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
|
@@ -1465,7 +1613,17 @@ class PhoneNumbersImpl {
|
|
1465
1613
|
}
|
1466
1614
|
};
|
1467
1615
|
};
|
1468
|
-
const lro =
|
1616
|
+
const lro = createLroSpec({
|
1617
|
+
sendOperationFn,
|
1618
|
+
args: {
|
1619
|
+
countryCode,
|
1620
|
+
phoneNumberType,
|
1621
|
+
assignmentType,
|
1622
|
+
capabilities,
|
1623
|
+
options
|
1624
|
+
},
|
1625
|
+
spec: searchAvailablePhoneNumbersOperationSpec
|
1626
|
+
});
|
1469
1627
|
const poller = new coreLro.LroEngine(lro, {
|
1470
1628
|
resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
|
1471
1629
|
intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
|
@@ -1507,7 +1665,7 @@ class PhoneNumbersImpl {
|
|
1507
1665
|
return this.client.sendOperationRequest(args, spec);
|
1508
1666
|
});
|
1509
1667
|
};
|
1510
|
-
const
|
1668
|
+
const sendOperationFn = async (args, spec) => {
|
1511
1669
|
var _a;
|
1512
1670
|
let currentRawResponse = undefined;
|
1513
1671
|
const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
|
@@ -1526,7 +1684,11 @@ class PhoneNumbersImpl {
|
|
1526
1684
|
}
|
1527
1685
|
};
|
1528
1686
|
};
|
1529
|
-
const lro =
|
1687
|
+
const lro = createLroSpec({
|
1688
|
+
sendOperationFn,
|
1689
|
+
args: { options },
|
1690
|
+
spec: purchasePhoneNumbersOperationSpec
|
1691
|
+
});
|
1530
1692
|
const poller = new coreLro.LroEngine(lro, {
|
1531
1693
|
resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
|
1532
1694
|
intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs
|
@@ -1574,7 +1736,7 @@ class PhoneNumbersImpl {
|
|
1574
1736
|
return this.client.sendOperationRequest(args, spec);
|
1575
1737
|
});
|
1576
1738
|
};
|
1577
|
-
const
|
1739
|
+
const sendOperationFn = async (args, spec) => {
|
1578
1740
|
var _a;
|
1579
1741
|
let currentRawResponse = undefined;
|
1580
1742
|
const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
|
@@ -1593,7 +1755,11 @@ class PhoneNumbersImpl {
|
|
1593
1755
|
}
|
1594
1756
|
};
|
1595
1757
|
};
|
1596
|
-
const lro =
|
1758
|
+
const lro = createLroSpec({
|
1759
|
+
sendOperationFn,
|
1760
|
+
args: { phoneNumber, options },
|
1761
|
+
spec: updateCapabilitiesOperationSpec
|
1762
|
+
});
|
1597
1763
|
const poller = new coreLro.LroEngine(lro, {
|
1598
1764
|
resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
|
1599
1765
|
intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
|
@@ -1634,7 +1800,7 @@ class PhoneNumbersImpl {
|
|
1634
1800
|
return this.client.sendOperationRequest(args, spec);
|
1635
1801
|
});
|
1636
1802
|
};
|
1637
|
-
const
|
1803
|
+
const sendOperationFn = async (args, spec) => {
|
1638
1804
|
var _a;
|
1639
1805
|
let currentRawResponse = undefined;
|
1640
1806
|
const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
|
@@ -1653,7 +1819,11 @@ class PhoneNumbersImpl {
|
|
1653
1819
|
}
|
1654
1820
|
};
|
1655
1821
|
};
|
1656
|
-
const lro =
|
1822
|
+
const lro = createLroSpec({
|
1823
|
+
sendOperationFn,
|
1824
|
+
args: { phoneNumber, options },
|
1825
|
+
spec: releasePhoneNumberOperationSpec
|
1826
|
+
});
|
1657
1827
|
const poller = new coreLro.LroEngine(lro, {
|
1658
1828
|
resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
|
1659
1829
|
intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs
|
@@ -1679,16 +1849,24 @@ class PhoneNumbersImpl {
|
|
1679
1849
|
return this.client.sendOperationRequest({ options }, listPhoneNumbersOperationSpec);
|
1680
1850
|
});
|
1681
1851
|
}
|
1852
|
+
/**
|
1853
|
+
* Searches for operator information for a given list of phone numbers.
|
1854
|
+
* @param options The options parameters.
|
1855
|
+
*/
|
1856
|
+
async operatorInformationSearch(options) {
|
1857
|
+
return tracingClient.withSpan("PhoneNumbersClient.operatorInformationSearch", options !== null && options !== void 0 ? options : {}, async (options) => {
|
1858
|
+
return this.client.sendOperationRequest({ options }, operatorInformationSearchOperationSpec);
|
1859
|
+
});
|
1860
|
+
}
|
1682
1861
|
/**
|
1683
1862
|
* ListAreaCodesNext
|
1684
1863
|
* @param countryCode The ISO 3166-2 country code, e.g. US.
|
1685
|
-
* @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
|
1686
1864
|
* @param nextLink The nextLink from the previous successful call to the ListAreaCodes method.
|
1687
1865
|
* @param options The options parameters.
|
1688
1866
|
*/
|
1689
|
-
async _listAreaCodesNext(countryCode,
|
1867
|
+
async _listAreaCodesNext(countryCode, nextLink, options) {
|
1690
1868
|
return tracingClient.withSpan("PhoneNumbersClient._listAreaCodesNext", options !== null && options !== void 0 ? options : {}, async (options) => {
|
1691
|
-
return this.client.sendOperationRequest({ countryCode,
|
1869
|
+
return this.client.sendOperationRequest({ countryCode, nextLink, options }, listAreaCodesNextOperationSpec);
|
1692
1870
|
});
|
1693
1871
|
}
|
1694
1872
|
/**
|
@@ -1971,7 +2149,7 @@ const updateCapabilitiesOperationSpec = {
|
|
1971
2149
|
},
|
1972
2150
|
queryParameters: [apiVersion$1],
|
1973
2151
|
urlParameters: [endpoint$1, phoneNumber],
|
1974
|
-
headerParameters: [accept$1, contentType1
|
2152
|
+
headerParameters: [accept$1, contentType1],
|
1975
2153
|
mediaType: "json",
|
1976
2154
|
serializer: serializer$1
|
1977
2155
|
};
|
@@ -2032,6 +2210,27 @@ const listPhoneNumbersOperationSpec = {
|
|
2032
2210
|
headerParameters: [accept$1],
|
2033
2211
|
serializer: serializer$1
|
2034
2212
|
};
|
2213
|
+
const operatorInformationSearchOperationSpec = {
|
2214
|
+
path: "/operatorInformation/:search",
|
2215
|
+
httpMethod: "POST",
|
2216
|
+
responses: {
|
2217
|
+
200: {
|
2218
|
+
bodyMapper: OperatorInformationResult
|
2219
|
+
},
|
2220
|
+
default: {
|
2221
|
+
bodyMapper: CommunicationErrorResponse$1
|
2222
|
+
}
|
2223
|
+
},
|
2224
|
+
requestBody: {
|
2225
|
+
parameterPath: { phoneNumbers: ["options", "phoneNumbers"] },
|
2226
|
+
mapper: Object.assign(Object.assign({}, OperatorInformationRequest), { required: true })
|
2227
|
+
},
|
2228
|
+
queryParameters: [apiVersion$1],
|
2229
|
+
urlParameters: [endpoint$1],
|
2230
|
+
headerParameters: [accept$1, contentType$1],
|
2231
|
+
mediaType: "json",
|
2232
|
+
serializer: serializer$1
|
2233
|
+
};
|
2035
2234
|
const listAreaCodesNextOperationSpec = {
|
2036
2235
|
path: "{nextLink}",
|
2037
2236
|
httpMethod: "GET",
|
@@ -2043,15 +2242,6 @@ const listAreaCodesNextOperationSpec = {
|
|
2043
2242
|
bodyMapper: CommunicationErrorResponse$1
|
2044
2243
|
}
|
2045
2244
|
},
|
2046
|
-
queryParameters: [
|
2047
|
-
phoneNumberType,
|
2048
|
-
skip,
|
2049
|
-
maxPageSize,
|
2050
|
-
assignmentType,
|
2051
|
-
locality,
|
2052
|
-
administrativeDivision,
|
2053
|
-
apiVersion$1
|
2054
|
-
],
|
2055
2245
|
urlParameters: [
|
2056
2246
|
endpoint$1,
|
2057
2247
|
countryCode,
|
@@ -2071,11 +2261,6 @@ const listAvailableCountriesNextOperationSpec = {
|
|
2071
2261
|
bodyMapper: CommunicationErrorResponse$1
|
2072
2262
|
}
|
2073
2263
|
},
|
2074
|
-
queryParameters: [
|
2075
|
-
skip,
|
2076
|
-
maxPageSize,
|
2077
|
-
apiVersion$1
|
2078
|
-
],
|
2079
2264
|
urlParameters: [endpoint$1, nextLink],
|
2080
2265
|
headerParameters: [accept$1, acceptLanguage],
|
2081
2266
|
serializer: serializer$1
|
@@ -2091,12 +2276,6 @@ const listAvailableLocalitiesNextOperationSpec = {
|
|
2091
2276
|
bodyMapper: CommunicationErrorResponse$1
|
2092
2277
|
}
|
2093
2278
|
},
|
2094
|
-
queryParameters: [
|
2095
|
-
skip,
|
2096
|
-
maxPageSize,
|
2097
|
-
administrativeDivision,
|
2098
|
-
apiVersion$1
|
2099
|
-
],
|
2100
2279
|
urlParameters: [
|
2101
2280
|
endpoint$1,
|
2102
2281
|
countryCode,
|
@@ -2116,13 +2295,6 @@ const listOfferingsNextOperationSpec = {
|
|
2116
2295
|
bodyMapper: CommunicationErrorResponse$1
|
2117
2296
|
}
|
2118
2297
|
},
|
2119
|
-
queryParameters: [
|
2120
|
-
skip,
|
2121
|
-
maxPageSize,
|
2122
|
-
assignmentType,
|
2123
|
-
apiVersion$1,
|
2124
|
-
phoneNumberType1
|
2125
|
-
],
|
2126
2298
|
urlParameters: [
|
2127
2299
|
endpoint$1,
|
2128
2300
|
countryCode,
|
@@ -2142,7 +2314,6 @@ const listPhoneNumbersNextOperationSpec = {
|
|
2142
2314
|
bodyMapper: CommunicationErrorResponse$1
|
2143
2315
|
}
|
2144
2316
|
},
|
2145
|
-
queryParameters: [skip, apiVersion$1, top],
|
2146
2317
|
urlParameters: [endpoint$1, nextLink],
|
2147
2318
|
headerParameters: [accept$1],
|
2148
2319
|
serializer: serializer$1
|
@@ -2158,8 +2329,7 @@ const listPhoneNumbersNextOperationSpec = {
|
|
2158
2329
|
class PhoneNumbersClient$1 extends coreClient__namespace.ServiceClient {
|
2159
2330
|
/**
|
2160
2331
|
* Initializes a new instance of the PhoneNumbersClient class.
|
2161
|
-
* @param endpoint The communication resource, for example
|
2162
|
-
* https://resourcename.communication.azure.com.
|
2332
|
+
* @param endpoint The communication resource, for example https://resourcename.communication.azure.com
|
2163
2333
|
* @param options The parameter options
|
2164
2334
|
*/
|
2165
2335
|
constructor(endpoint, options) {
|
@@ -2174,34 +2344,18 @@ class PhoneNumbersClient$1 extends coreClient__namespace.ServiceClient {
|
|
2174
2344
|
const defaults = {
|
2175
2345
|
requestContentType: "application/json; charset=utf-8"
|
2176
2346
|
};
|
2177
|
-
const packageDetails = `azsdk-js-communication-phone-numbers/1.
|
2347
|
+
const packageDetails = `azsdk-js-communication-phone-numbers/1.2.1`;
|
2178
2348
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
2179
2349
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
2180
2350
|
: `${packageDetails}`;
|
2181
2351
|
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
2182
2352
|
userAgentPrefix
|
2183
|
-
},
|
2353
|
+
}, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
|
2184
2354
|
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
2355
|
// Parameter assignments
|
2202
2356
|
this.endpoint = endpoint;
|
2203
2357
|
// Assigning values to Constant parameters
|
2204
|
-
this.apiVersion = options.apiVersion || "
|
2358
|
+
this.apiVersion = options.apiVersion || "2023-05-01-preview";
|
2205
2359
|
this.phoneNumbers = new PhoneNumbersImpl(this);
|
2206
2360
|
this.addCustomApiVersionPolicy(options.apiVersion);
|
2207
2361
|
}
|
@@ -2232,6 +2386,39 @@ class PhoneNumbersClient$1 extends coreClient__namespace.ServiceClient {
|
|
2232
2386
|
}
|
2233
2387
|
}
|
2234
2388
|
|
2389
|
+
// Copyright (c) Microsoft Corporation.
|
2390
|
+
// Licensed under the MIT license.
|
2391
|
+
/**
|
2392
|
+
* Creates a `PipelinePolicy` that converts relative URL values in the `nextLink` property to absolute URLs.
|
2393
|
+
*
|
2394
|
+
* This is necessary because the Core V2 library does not support paging with relative links at time of writing.
|
2395
|
+
*
|
2396
|
+
* @param host - The base URL of the resource.
|
2397
|
+
* @returns the `PipelinePolicy` that addresses the issue.
|
2398
|
+
*/
|
2399
|
+
function createPhoneNumbersPagingPolicy(host) {
|
2400
|
+
return {
|
2401
|
+
name: "phoneNumbersPagingPolicy",
|
2402
|
+
async sendRequest(request, next) {
|
2403
|
+
var _a;
|
2404
|
+
const response = await next(request);
|
2405
|
+
let nextLink = (_a = response === null || response === void 0 ? void 0 : response.parsedBody) === null || _a === void 0 ? void 0 : _a.nextLink;
|
2406
|
+
if (nextLink && !nextLink.startsWith(host)) {
|
2407
|
+
nextLink = host.endsWith("/") ? nextLink.substring(1) : nextLink;
|
2408
|
+
const absolutePath = `${host}${nextLink}`;
|
2409
|
+
response.parsedBody.nextLink = absolutePath;
|
2410
|
+
}
|
2411
|
+
return response;
|
2412
|
+
},
|
2413
|
+
};
|
2414
|
+
}
|
2415
|
+
|
2416
|
+
// Copyright (c) Microsoft Corporation.
|
2417
|
+
/**
|
2418
|
+
* The \@azure\/logger configuration for this package.
|
2419
|
+
*/
|
2420
|
+
const logger = logger$1.createClientLogger("communication-phone-numbers");
|
2421
|
+
|
2235
2422
|
// Copyright (c) Microsoft Corporation.
|
2236
2423
|
const isPhoneNumbersClientOptions = (options) => options && !communicationCommon.isKeyCredential(options) && !coreAuth.isTokenCredential(options);
|
2237
2424
|
/**
|
@@ -2555,6 +2742,19 @@ class PhoneNumbersClient {
|
|
2555
2742
|
span.end();
|
2556
2743
|
}
|
2557
2744
|
}
|
2745
|
+
/**
|
2746
|
+
* Search for operator information about specified phone numbers.
|
2747
|
+
*
|
2748
|
+
* @param phoneNumbers - The phone numbers to search.
|
2749
|
+
* @param options - Additional request options.
|
2750
|
+
*/
|
2751
|
+
searchOperatorInformation(phoneNumbers, options = {}) {
|
2752
|
+
return tracingClient.withSpan("PhoneNumbersClient-searchOperatorInformation", options, (updatedOptions) => {
|
2753
|
+
const params = updatedOptions;
|
2754
|
+
params.phoneNumbers = phoneNumbers;
|
2755
|
+
return this.client.phoneNumbers.operatorInformationSearch(params);
|
2756
|
+
});
|
2757
|
+
}
|
2558
2758
|
}
|
2559
2759
|
|
2560
2760
|
/*
|
@@ -2569,13 +2769,6 @@ const SipConfiguration = {
|
|
2569
2769
|
name: "Composite",
|
2570
2770
|
className: "SipConfiguration",
|
2571
2771
|
modelProperties: {
|
2572
|
-
domains: {
|
2573
|
-
serializedName: "domains",
|
2574
|
-
type: {
|
2575
|
-
name: "Dictionary",
|
2576
|
-
value: { type: { name: "Composite", className: "SipDomain" } }
|
2577
|
-
}
|
2578
|
-
},
|
2579
2772
|
trunks: {
|
2580
2773
|
serializedName: "trunks",
|
2581
2774
|
type: {
|
@@ -2601,134 +2794,25 @@ const SipConfiguration = {
|
|
2601
2794
|
}
|
2602
2795
|
}
|
2603
2796
|
};
|
2604
|
-
const
|
2797
|
+
const SipTrunk = {
|
2605
2798
|
type: {
|
2606
2799
|
name: "Composite",
|
2607
|
-
className: "
|
2800
|
+
className: "SipTrunk",
|
2608
2801
|
modelProperties: {
|
2609
|
-
|
2610
|
-
serializedName: "
|
2802
|
+
sipSignalingPort: {
|
2803
|
+
serializedName: "sipSignalingPort",
|
2611
2804
|
required: true,
|
2612
2805
|
type: {
|
2613
|
-
name: "
|
2806
|
+
name: "Number"
|
2614
2807
|
}
|
2615
2808
|
}
|
2616
2809
|
}
|
2617
2810
|
}
|
2618
2811
|
};
|
2619
|
-
const
|
2812
|
+
const SipTrunkRoute = {
|
2620
2813
|
type: {
|
2621
2814
|
name: "Composite",
|
2622
|
-
className: "
|
2623
|
-
modelProperties: {
|
2624
|
-
sipSignalingPort: {
|
2625
|
-
serializedName: "sipSignalingPort",
|
2626
|
-
required: true,
|
2627
|
-
type: {
|
2628
|
-
name: "Number"
|
2629
|
-
}
|
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
|
-
}
|
2725
|
-
}
|
2726
|
-
}
|
2727
|
-
};
|
2728
|
-
const SipTrunkRoute = {
|
2729
|
-
type: {
|
2730
|
-
name: "Composite",
|
2731
|
-
className: "SipTrunkRoute",
|
2815
|
+
className: "SipTrunkRoute",
|
2732
2816
|
modelProperties: {
|
2733
2817
|
description: {
|
2734
2818
|
constraints: {
|
@@ -2845,13 +2929,6 @@ const SipConfigurationUpdate = {
|
|
2845
2929
|
name: "Composite",
|
2846
2930
|
className: "SipConfigurationUpdate",
|
2847
2931
|
modelProperties: {
|
2848
|
-
domains: {
|
2849
|
-
serializedName: "domains",
|
2850
|
-
type: {
|
2851
|
-
name: "Dictionary",
|
2852
|
-
value: { type: { name: "Composite", className: "DomainPatch" } }
|
2853
|
-
}
|
2854
|
-
},
|
2855
2932
|
trunks: {
|
2856
2933
|
serializedName: "trunks",
|
2857
2934
|
type: {
|
@@ -2877,20 +2954,6 @@ const SipConfigurationUpdate = {
|
|
2877
2954
|
}
|
2878
2955
|
}
|
2879
2956
|
};
|
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
2957
|
const TrunkUpdate = {
|
2895
2958
|
type: {
|
2896
2959
|
name: "Composite",
|
@@ -2901,35 +2964,6 @@ const TrunkUpdate = {
|
|
2901
2964
|
type: {
|
2902
2965
|
name: "Number"
|
2903
2966
|
}
|
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
2967
|
}
|
2934
2968
|
}
|
2935
2969
|
}
|
@@ -2966,19 +3000,12 @@ const SipRoutingUpdateExceptionHeaders = {
|
|
2966
3000
|
var Mappers = /*#__PURE__*/Object.freeze({
|
2967
3001
|
__proto__: null,
|
2968
3002
|
SipConfiguration: SipConfiguration,
|
2969
|
-
SipDomain: SipDomain,
|
2970
3003
|
SipTrunk: SipTrunk,
|
2971
|
-
SipTrunkHealth: SipTrunkHealth,
|
2972
|
-
SipTrunkTls: SipTrunkTls,
|
2973
|
-
SipTrunkPing: SipTrunkPing,
|
2974
|
-
SipTrunkActivity: SipTrunkActivity,
|
2975
3004
|
SipTrunkRoute: SipTrunkRoute,
|
2976
3005
|
CommunicationErrorResponse: CommunicationErrorResponse,
|
2977
3006
|
SipRoutingError: SipRoutingError,
|
2978
3007
|
SipConfigurationUpdate: SipConfigurationUpdate,
|
2979
|
-
DomainPatch: DomainPatch,
|
2980
3008
|
TrunkUpdate: TrunkUpdate,
|
2981
|
-
RoutesForNumber: RoutesForNumber,
|
2982
3009
|
SipRoutingGetExceptionHeaders: SipRoutingGetExceptionHeaders,
|
2983
3010
|
SipRoutingUpdateExceptionHeaders: SipRoutingUpdateExceptionHeaders
|
2984
3011
|
});
|
@@ -3015,7 +3042,7 @@ const endpoint = {
|
|
3015
3042
|
const apiVersion = {
|
3016
3043
|
parameterPath: "apiVersion",
|
3017
3044
|
mapper: {
|
3018
|
-
defaultValue: "2023-
|
3045
|
+
defaultValue: "2023-03-01",
|
3019
3046
|
isConstant: true,
|
3020
3047
|
serializedName: "api-version",
|
3021
3048
|
type: {
|
@@ -3023,15 +3050,6 @@ const apiVersion = {
|
|
3023
3050
|
}
|
3024
3051
|
}
|
3025
3052
|
};
|
3026
|
-
const expand = {
|
3027
|
-
parameterPath: ["options", "expand"],
|
3028
|
-
mapper: {
|
3029
|
-
serializedName: "expand",
|
3030
|
-
type: {
|
3031
|
-
name: "String"
|
3032
|
-
}
|
3033
|
-
}
|
3034
|
-
};
|
3035
3053
|
const contentType = {
|
3036
3054
|
parameterPath: ["options", "contentType"],
|
3037
3055
|
mapper: {
|
@@ -3043,27 +3061,6 @@ const contentType = {
|
|
3043
3061
|
}
|
3044
3062
|
}
|
3045
3063
|
};
|
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
3064
|
|
3068
3065
|
/*
|
3069
3066
|
* Copyright (c) Microsoft Corporation.
|
@@ -3095,14 +3092,6 @@ class SipRoutingImpl {
|
|
3095
3092
|
update(options) {
|
3096
3093
|
return this.client.sendOperationRequest({ options }, updateOperationSpec);
|
3097
3094
|
}
|
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
3095
|
}
|
3107
3096
|
// Operation Specifications
|
3108
3097
|
const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
@@ -3118,7 +3107,7 @@ const getOperationSpec = {
|
|
3118
3107
|
headersMapper: SipRoutingGetExceptionHeaders
|
3119
3108
|
}
|
3120
3109
|
},
|
3121
|
-
queryParameters: [apiVersion
|
3110
|
+
queryParameters: [apiVersion],
|
3122
3111
|
urlParameters: [endpoint],
|
3123
3112
|
headerParameters: [accept],
|
3124
3113
|
serializer
|
@@ -3137,7 +3126,6 @@ const updateOperationSpec = {
|
|
3137
3126
|
},
|
3138
3127
|
requestBody: {
|
3139
3128
|
parameterPath: {
|
3140
|
-
domains: ["options", "domains"],
|
3141
3129
|
trunks: ["options", "trunks"],
|
3142
3130
|
routes: ["options", "routes"]
|
3143
3131
|
},
|
@@ -3149,31 +3137,6 @@ const updateOperationSpec = {
|
|
3149
3137
|
mediaType: "json",
|
3150
3138
|
serializer
|
3151
3139
|
};
|
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
3140
|
|
3178
3141
|
/*
|
3179
3142
|
* Copyright (c) Microsoft Corporation.
|
@@ -3199,7 +3162,7 @@ class SipRoutingClientContext extends coreClient__namespace.ServiceClient {
|
|
3199
3162
|
const defaults = {
|
3200
3163
|
requestContentType: "application/json; charset=utf-8"
|
3201
3164
|
};
|
3202
|
-
const packageDetails = `azsdk-js-communication-phone-numbers/1.
|
3165
|
+
const packageDetails = `azsdk-js-communication-phone-numbers/1.2.1`;
|
3203
3166
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
3204
3167
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
3205
3168
|
: `${packageDetails}`;
|
@@ -3210,7 +3173,7 @@ class SipRoutingClientContext extends coreClient__namespace.ServiceClient {
|
|
3210
3173
|
// Parameter assignments
|
3211
3174
|
this.endpoint = endpoint;
|
3212
3175
|
// Assigning values to Constant parameters
|
3213
|
-
this.apiVersion = options.apiVersion || "2023-
|
3176
|
+
this.apiVersion = options.apiVersion || "2023-03-01";
|
3214
3177
|
}
|
3215
3178
|
}
|
3216
3179
|
|
@@ -3243,7 +3206,8 @@ function transformFromRestModel(trunks) {
|
|
3243
3206
|
const result = [];
|
3244
3207
|
if (trunks) {
|
3245
3208
|
Object.keys(trunks).forEach((fqdn) => {
|
3246
|
-
|
3209
|
+
const port = trunks[fqdn].sipSignalingPort;
|
3210
|
+
result.push({ fqdn: fqdn, sipSignalingPort: port });
|
3247
3211
|
});
|
3248
3212
|
}
|
3249
3213
|
return result;
|
@@ -3255,36 +3219,7 @@ function transformFromRestModel(trunks) {
|
|
3255
3219
|
function transformIntoRestModel(trunks) {
|
3256
3220
|
const result = {};
|
3257
3221
|
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 };
|
3222
|
+
result[trunk.fqdn] = { sipSignalingPort: trunk.sipSignalingPort };
|
3288
3223
|
});
|
3289
3224
|
return result;
|
3290
3225
|
}
|
@@ -3317,18 +3252,31 @@ class SipRoutingClient {
|
|
3317
3252
|
* @param options - The options parameters.
|
3318
3253
|
*/
|
3319
3254
|
listTrunks(options = {}) {
|
3320
|
-
const
|
3321
|
-
|
3322
|
-
|
3323
|
-
|
3324
|
-
|
3325
|
-
|
3326
|
-
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3255
|
+
const { span, updatedOptions } = tracingClient.startSpan("SipRoutingClient-listTrunks", options);
|
3256
|
+
try {
|
3257
|
+
const iter = this.listTrunksPagingAll(Object.assign({}, updatedOptions));
|
3258
|
+
return {
|
3259
|
+
next() {
|
3260
|
+
return iter.next();
|
3261
|
+
},
|
3262
|
+
[Symbol.asyncIterator]() {
|
3263
|
+
return this;
|
3264
|
+
},
|
3265
|
+
byPage: () => {
|
3266
|
+
return this.listTrunksPagingPage(Object.assign({}, updatedOptions));
|
3267
|
+
},
|
3268
|
+
};
|
3269
|
+
}
|
3270
|
+
catch (e) {
|
3271
|
+
span.setStatus({
|
3272
|
+
status: "error",
|
3273
|
+
error: e,
|
3274
|
+
});
|
3275
|
+
throw e;
|
3276
|
+
}
|
3277
|
+
finally {
|
3278
|
+
span.end();
|
3279
|
+
}
|
3332
3280
|
}
|
3333
3281
|
/**
|
3334
3282
|
* Gets the SIP trunk.
|
@@ -3345,100 +3293,36 @@ class SipRoutingClient {
|
|
3345
3293
|
throw { code: "NotFound", message: "Not Found" };
|
3346
3294
|
});
|
3347
3295
|
}
|
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
3296
|
/**
|
3382
3297
|
* Lists the SIP trunk routes.
|
3383
3298
|
* @param options - The options parameters.
|
3384
3299
|
*/
|
3385
3300
|
listRoutes(options = {}) {
|
3386
|
-
const
|
3387
|
-
|
3388
|
-
|
3389
|
-
|
3390
|
-
|
3391
|
-
|
3392
|
-
|
3393
|
-
|
3394
|
-
|
3395
|
-
|
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]),
|
3301
|
+
const { span, updatedOptions } = tracingClient.startSpan("SipRoutingClient-listRoutes", options);
|
3302
|
+
try {
|
3303
|
+
const iter = this.listRoutesPagingAll(Object.assign({}, updatedOptions));
|
3304
|
+
return {
|
3305
|
+
next() {
|
3306
|
+
return iter.next();
|
3307
|
+
},
|
3308
|
+
[Symbol.asyncIterator]() {
|
3309
|
+
return this;
|
3310
|
+
},
|
3311
|
+
byPage: () => {
|
3312
|
+
return this.listRoutesPagingPage(Object.assign({}, updatedOptions));
|
3313
|
+
},
|
3433
3314
|
};
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
|
3439
|
-
}
|
3440
|
-
throw
|
3441
|
-
}
|
3315
|
+
}
|
3316
|
+
catch (e) {
|
3317
|
+
span.setStatus({
|
3318
|
+
status: "error",
|
3319
|
+
error: e,
|
3320
|
+
});
|
3321
|
+
throw e;
|
3322
|
+
}
|
3323
|
+
finally {
|
3324
|
+
span.end();
|
3325
|
+
}
|
3442
3326
|
}
|
3443
3327
|
/**
|
3444
3328
|
* Sets the SIP trunks.
|
@@ -3447,19 +3331,19 @@ class SipRoutingClient {
|
|
3447
3331
|
*/
|
3448
3332
|
async setTrunks(trunks, options = {}) {
|
3449
3333
|
return tracingClient.withSpan("SipRoutingClient-setTrunks", options, async (updatedOptions) => {
|
3450
|
-
const
|
3334
|
+
const patch = { trunks: transformIntoRestModel(trunks) };
|
3451
3335
|
let config = await this.client.sipRouting.get(updatedOptions);
|
3452
3336
|
const storedFqdns = transformFromRestModel(config.trunks).map((trunk) => trunk.fqdn);
|
3453
3337
|
const setFqdns = trunks.map((trunk) => trunk.fqdn);
|
3454
3338
|
storedFqdns.forEach((storedFqdn) => {
|
3455
3339
|
const shouldDeleteStoredTrunk = !setFqdns.find((value) => value === storedFqdn);
|
3456
3340
|
if (shouldDeleteStoredTrunk) {
|
3457
|
-
|
3341
|
+
patch.trunks[storedFqdn] = null;
|
3458
3342
|
}
|
3459
3343
|
});
|
3460
|
-
const isPatchNeeded = Object.keys(
|
3344
|
+
const isPatchNeeded = Object.keys(patch.trunks).length > 0;
|
3461
3345
|
if (isPatchNeeded) {
|
3462
|
-
const payload = Object.assign(Object.assign({}, updatedOptions),
|
3346
|
+
const payload = Object.assign(Object.assign({}, updatedOptions), patch);
|
3463
3347
|
config = await this.client.sipRouting.update(payload);
|
3464
3348
|
}
|
3465
3349
|
return transformFromRestModel(config.trunks);
|
@@ -3472,10 +3356,10 @@ class SipRoutingClient {
|
|
3472
3356
|
*/
|
3473
3357
|
async setTrunk(trunk, options = {}) {
|
3474
3358
|
return tracingClient.withSpan("SipRoutingClient-setTrunk", options, async (updatedOptions) => {
|
3475
|
-
const
|
3359
|
+
const patch = {
|
3476
3360
|
trunks: transformIntoRestModel([trunk]),
|
3477
3361
|
};
|
3478
|
-
const payload = Object.assign(Object.assign({}, updatedOptions),
|
3362
|
+
const payload = Object.assign(Object.assign({}, updatedOptions), patch);
|
3479
3363
|
const config = await this.client.sipRouting.update(payload);
|
3480
3364
|
const storedTrunk = transformFromRestModel(config.trunks).find((value) => value.fqdn === trunk.fqdn);
|
3481
3365
|
if (storedTrunk) {
|
@@ -3491,10 +3375,10 @@ class SipRoutingClient {
|
|
3491
3375
|
*/
|
3492
3376
|
async setRoutes(routes, options = {}) {
|
3493
3377
|
return tracingClient.withSpan("SipRoutingClient-setRoutes", options, async (updatedOptions) => {
|
3494
|
-
const
|
3378
|
+
const patch = {
|
3495
3379
|
routes: routes,
|
3496
3380
|
};
|
3497
|
-
const payload = Object.assign(Object.assign({}, updatedOptions),
|
3381
|
+
const payload = Object.assign(Object.assign({}, updatedOptions), patch);
|
3498
3382
|
const config = await this.client.sipRouting.update(payload);
|
3499
3383
|
const storedRoutes = config.routes || (await this.getRoutesInternal(updatedOptions));
|
3500
3384
|
return storedRoutes;
|
@@ -3509,26 +3393,10 @@ class SipRoutingClient {
|
|
3509
3393
|
return tracingClient.withSpan("SipRoutingClient-deleteTrunk", options, async (updatedOptions) => {
|
3510
3394
|
const trunks = {};
|
3511
3395
|
trunks[fqdn] = null;
|
3512
|
-
const
|
3396
|
+
const patch = {
|
3513
3397
|
trunks: trunks,
|
3514
3398
|
};
|
3515
|
-
const payload = Object.assign(Object.assign({}, updatedOptions),
|
3516
|
-
await this.client.sipRouting.update(payload);
|
3517
|
-
});
|
3518
|
-
}
|
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);
|
3399
|
+
const payload = Object.assign(Object.assign({}, updatedOptions), patch);
|
3532
3400
|
await this.client.sipRouting.update(payload);
|
3533
3401
|
});
|
3534
3402
|
}
|
@@ -3537,17 +3405,8 @@ class SipRoutingClient {
|
|
3537
3405
|
return config.routes || [];
|
3538
3406
|
}
|
3539
3407
|
async getTrunksInternal(options) {
|
3540
|
-
const { includeHealth } = options, requestOptions = tslib.__rest(options, ["includeHealth"]);
|
3541
|
-
let updatedOptions = requestOptions;
|
3542
|
-
if (includeHealth) {
|
3543
|
-
updatedOptions = Object.assign(Object.assign({}, requestOptions), { expand: "trunks/health" });
|
3544
|
-
}
|
3545
|
-
const config = await this.client.sipRouting.get(updatedOptions);
|
3546
|
-
return transformFromRestModel(config.trunks);
|
3547
|
-
}
|
3548
|
-
async getDomainsInternal(options = {}) {
|
3549
3408
|
const config = await this.client.sipRouting.get(options);
|
3550
|
-
return
|
3409
|
+
return transformFromRestModel(config.trunks);
|
3551
3410
|
}
|
3552
3411
|
listRoutesPagingAll(options) {
|
3553
3412
|
return tslib.__asyncGenerator(this, arguments, function* listRoutesPagingAll_1() {
|
@@ -3599,43 +3458,12 @@ class SipRoutingClient {
|
|
3599
3458
|
}
|
3600
3459
|
});
|
3601
3460
|
}
|
3602
|
-
listDomainsPagingAll(options) {
|
3603
|
-
return tslib.__asyncGenerator(this, arguments, function* listDomainsPagingAll_1() {
|
3604
|
-
var _a, e_3, _b, _c;
|
3605
|
-
try {
|
3606
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listDomainsPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
3607
|
-
_c = _f.value;
|
3608
|
-
_d = false;
|
3609
|
-
try {
|
3610
|
-
const page = _c;
|
3611
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
3612
|
-
}
|
3613
|
-
finally {
|
3614
|
-
_d = true;
|
3615
|
-
}
|
3616
|
-
}
|
3617
|
-
}
|
3618
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
3619
|
-
finally {
|
3620
|
-
try {
|
3621
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
3622
|
-
}
|
3623
|
-
finally { if (e_3) throw e_3.error; }
|
3624
|
-
}
|
3625
|
-
});
|
3626
|
-
}
|
3627
3461
|
listTrunksPagingPage(options = {}) {
|
3628
3462
|
return tslib.__asyncGenerator(this, arguments, function* listTrunksPagingPage_1() {
|
3629
3463
|
const apiResult = yield tslib.__await(this.getTrunksInternal(options));
|
3630
3464
|
yield yield tslib.__await(apiResult);
|
3631
3465
|
});
|
3632
3466
|
}
|
3633
|
-
listDomainsPagingPage(options = {}) {
|
3634
|
-
return tslib.__asyncGenerator(this, arguments, function* listDomainsPagingPage_1() {
|
3635
|
-
const apiResult = yield tslib.__await(this.getDomainsInternal(options));
|
3636
|
-
yield yield tslib.__await(apiResult);
|
3637
|
-
});
|
3638
|
-
}
|
3639
3467
|
listRoutesPagingPage(options = {}) {
|
3640
3468
|
return tslib.__asyncGenerator(this, arguments, function* listRoutesPagingPage_1() {
|
3641
3469
|
const apiResult = yield tslib.__await(this.getRoutesInternal(options));
|