@azure/arm-search 3.0.2-alpha.20221128.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +11 -10
  2. package/dist/index.js +193 -67
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist-esm/src/index.d.ts +1 -0
  7. package/dist-esm/src/index.d.ts.map +1 -1
  8. package/dist-esm/src/index.js +1 -0
  9. package/dist-esm/src/index.js.map +1 -1
  10. package/dist-esm/src/models/index.d.ts +17 -12
  11. package/dist-esm/src/models/index.d.ts.map +1 -1
  12. package/dist-esm/src/models/index.js +5 -0
  13. package/dist-esm/src/models/index.js.map +1 -1
  14. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  15. package/dist-esm/src/operations/operations.js +8 -4
  16. package/dist-esm/src/operations/operations.js.map +1 -1
  17. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -1
  18. package/dist-esm/src/operations/privateEndpointConnections.js +19 -8
  19. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -1
  20. package/dist-esm/src/operations/privateLinkResources.d.ts.map +1 -1
  21. package/dist-esm/src/operations/privateLinkResources.js +8 -4
  22. package/dist-esm/src/operations/privateLinkResources.js.map +1 -1
  23. package/dist-esm/src/operations/queryKeys.d.ts.map +1 -1
  24. package/dist-esm/src/operations/queryKeys.js +19 -8
  25. package/dist-esm/src/operations/queryKeys.js.map +1 -1
  26. package/dist-esm/src/operations/services.d.ts.map +1 -1
  27. package/dist-esm/src/operations/services.js +37 -16
  28. package/dist-esm/src/operations/services.js.map +1 -1
  29. package/dist-esm/src/operations/sharedPrivateLinkResources.d.ts.map +1 -1
  30. package/dist-esm/src/operations/sharedPrivateLinkResources.js +19 -8
  31. package/dist-esm/src/operations/sharedPrivateLinkResources.js.map +1 -1
  32. package/dist-esm/src/pagingHelper.d.ts +13 -0
  33. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  34. package/dist-esm/src/pagingHelper.js +32 -0
  35. package/dist-esm/src/pagingHelper.js.map +1 -0
  36. package/dist-esm/src/searchManagementClient.d.ts +2 -0
  37. package/dist-esm/src/searchManagementClient.d.ts.map +1 -1
  38. package/dist-esm/src/searchManagementClient.js +49 -18
  39. package/dist-esm/src/searchManagementClient.js.map +1 -1
  40. package/dist-esm/test/search_examples.d.ts.map +1 -1
  41. package/dist-esm/test/search_examples.js +50 -31
  42. package/dist-esm/test/search_examples.js.map +1 -1
  43. package/package.json +13 -9
  44. package/review/arm-search.api.md +34 -36
  45. package/src/index.ts +1 -0
  46. package/src/models/index.ts +17 -12
  47. package/src/operations/operations.ts +10 -5
  48. package/src/operations/privateEndpointConnections.ts +27 -14
  49. package/src/operations/privateLinkResources.ts +11 -5
  50. package/src/operations/queryKeys.ts +27 -14
  51. package/src/operations/services.ts +46 -19
  52. package/src/operations/sharedPrivateLinkResources.ts +27 -14
  53. package/src/pagingHelper.ts +39 -0
  54. package/src/searchManagementClient.ts +60 -20
  55. package/types/arm-search.d.ts +28 -12
package/CHANGELOG.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # Release History
2
+
3
+ ## 3.1.0 (2022-12-07)
4
+
5
+ **Features**
2
6
 
3
- ## 3.0.2 (Unreleased)
4
-
5
- ### Features Added
6
-
7
- ### Breaking Changes
8
-
9
- ### Bugs Fixed
10
-
11
- ### Other Changes
12
-
7
+ - Added Interface PrivateEndpointConnection
8
+ - Added Interface PrivateLinkResource
9
+ - Added Interface SearchService
10
+ - Added Interface SearchServiceUpdate
11
+ - Added Interface SharedPrivateLinkResource
12
+ - Added Interface TrackedResource
13
+
13
14
  ## 3.0.1 (2022-04-29)
14
15
 
15
16
  **Features**
package/dist/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var tslib = require('tslib');
5
6
  var coreClient = require('@azure/core-client');
6
7
  var coreRestPipeline = require('@azure/core-rest-pipeline');
7
- var tslib = require('tslib');
8
8
  var coreLro = require('@azure/core-lro');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -28,6 +28,38 @@ function _interopNamespace(e) {
28
28
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
29
29
  var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
30
30
 
31
+ /*
32
+ * Copyright (c) Microsoft Corporation.
33
+ * Licensed under the MIT License.
34
+ *
35
+ * Code generated by Microsoft (R) AutoRest Code Generator.
36
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
37
+ */
38
+ const pageMap = new WeakMap();
39
+ /**
40
+ * Given the last `.value` produced by the `byPage` iterator,
41
+ * returns a continuation token that can be used to begin paging from
42
+ * that point later.
43
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
44
+ * @returns The continuation token that can be passed into byPage() during future calls.
45
+ */
46
+ function getContinuationToken(page) {
47
+ var _a;
48
+ if (typeof page !== "object" || page === null) {
49
+ return undefined;
50
+ }
51
+ return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
52
+ }
53
+ function setContinuationToken(page, continuationToken) {
54
+ var _a;
55
+ if (typeof page !== "object" || page === null || !continuationToken) {
56
+ return;
57
+ }
58
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
59
+ pageInfo.continuationToken = continuationToken;
60
+ pageMap.set(page, pageInfo);
61
+ }
62
+
31
63
  /*
32
64
  * Copyright (c) Microsoft Corporation.
33
65
  * Licensed under the MIT License.
@@ -38,14 +70,19 @@ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipelin
38
70
  /** Known values of {@link UnavailableNameReason} that the service accepts. */
39
71
  exports.KnownUnavailableNameReason = void 0;
40
72
  (function (KnownUnavailableNameReason) {
73
+ /** Invalid */
41
74
  KnownUnavailableNameReason["Invalid"] = "Invalid";
75
+ /** AlreadyExists */
42
76
  KnownUnavailableNameReason["AlreadyExists"] = "AlreadyExists";
43
77
  })(exports.KnownUnavailableNameReason || (exports.KnownUnavailableNameReason = {}));
44
78
  /** Known values of {@link SharedPrivateLinkResourceAsyncOperationResult} that the service accepts. */
45
79
  exports.KnownSharedPrivateLinkResourceAsyncOperationResult = void 0;
46
80
  (function (KnownSharedPrivateLinkResourceAsyncOperationResult) {
81
+ /** Running */
47
82
  KnownSharedPrivateLinkResourceAsyncOperationResult["Running"] = "Running";
83
+ /** Succeeded */
48
84
  KnownSharedPrivateLinkResourceAsyncOperationResult["Succeeded"] = "Succeeded";
85
+ /** Failed */
49
86
  KnownSharedPrivateLinkResourceAsyncOperationResult["Failed"] = "Failed";
50
87
  })(exports.KnownSharedPrivateLinkResourceAsyncOperationResult || (exports.KnownSharedPrivateLinkResourceAsyncOperationResult = {}));
51
88
 
@@ -1302,14 +1339,18 @@ class OperationsImpl {
1302
1339
  [Symbol.asyncIterator]() {
1303
1340
  return this;
1304
1341
  },
1305
- byPage: () => {
1306
- return this.listPagingPage(options);
1342
+ byPage: (settings) => {
1343
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1344
+ throw new Error("maxPageSize is not supported by this operation.");
1345
+ }
1346
+ return this.listPagingPage(options, settings);
1307
1347
  }
1308
1348
  };
1309
1349
  }
1310
- listPagingPage(options) {
1350
+ listPagingPage(options, _settings) {
1311
1351
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1312
- let result = yield tslib.__await(this._list(options));
1352
+ let result;
1353
+ result = yield tslib.__await(this._list(options));
1313
1354
  yield yield tslib.__await(result.value || []);
1314
1355
  });
1315
1356
  }
@@ -1479,20 +1520,31 @@ class QueryKeysImpl {
1479
1520
  [Symbol.asyncIterator]() {
1480
1521
  return this;
1481
1522
  },
1482
- byPage: () => {
1483
- return this.listBySearchServicePagingPage(resourceGroupName, searchServiceName, options);
1523
+ byPage: (settings) => {
1524
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1525
+ throw new Error("maxPageSize is not supported by this operation.");
1526
+ }
1527
+ return this.listBySearchServicePagingPage(resourceGroupName, searchServiceName, options, settings);
1484
1528
  }
1485
1529
  };
1486
1530
  }
1487
- listBySearchServicePagingPage(resourceGroupName, searchServiceName, options) {
1531
+ listBySearchServicePagingPage(resourceGroupName, searchServiceName, options, settings) {
1488
1532
  return tslib.__asyncGenerator(this, arguments, function* listBySearchServicePagingPage_1() {
1489
- let result = yield tslib.__await(this._listBySearchService(resourceGroupName, searchServiceName, options));
1490
- yield yield tslib.__await(result.value || []);
1491
- let continuationToken = result.nextLink;
1533
+ let result;
1534
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1535
+ if (!continuationToken) {
1536
+ result = yield tslib.__await(this._listBySearchService(resourceGroupName, searchServiceName, options));
1537
+ let page = result.value || [];
1538
+ continuationToken = result.nextLink;
1539
+ setContinuationToken(page, continuationToken);
1540
+ yield yield tslib.__await(page);
1541
+ }
1492
1542
  while (continuationToken) {
1493
1543
  result = yield tslib.__await(this._listBySearchServiceNext(resourceGroupName, searchServiceName, continuationToken, options));
1494
1544
  continuationToken = result.nextLink;
1495
- yield yield tslib.__await(result.value || []);
1545
+ let page = result.value || [];
1546
+ setContinuationToken(page, continuationToken);
1547
+ yield yield tslib.__await(page);
1496
1548
  }
1497
1549
  });
1498
1550
  }
@@ -1642,7 +1694,6 @@ const listBySearchServiceNextOperationSpec = {
1642
1694
  bodyMapper: CloudError
1643
1695
  }
1644
1696
  },
1645
- queryParameters: [apiVersion],
1646
1697
  urlParameters: [
1647
1698
  $host,
1648
1699
  resourceGroupName,
@@ -1714,20 +1765,31 @@ class ServicesImpl {
1714
1765
  [Symbol.asyncIterator]() {
1715
1766
  return this;
1716
1767
  },
1717
- byPage: () => {
1718
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
1768
+ byPage: (settings) => {
1769
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1770
+ throw new Error("maxPageSize is not supported by this operation.");
1771
+ }
1772
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
1719
1773
  }
1720
1774
  };
1721
1775
  }
1722
- listByResourceGroupPagingPage(resourceGroupName, options) {
1776
+ listByResourceGroupPagingPage(resourceGroupName, options, settings) {
1723
1777
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
1724
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
1725
- yield yield tslib.__await(result.value || []);
1726
- let continuationToken = result.nextLink;
1778
+ let result;
1779
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1780
+ if (!continuationToken) {
1781
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
1782
+ let page = result.value || [];
1783
+ continuationToken = result.nextLink;
1784
+ setContinuationToken(page, continuationToken);
1785
+ yield yield tslib.__await(page);
1786
+ }
1727
1787
  while (continuationToken) {
1728
1788
  result = yield tslib.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
1729
1789
  continuationToken = result.nextLink;
1730
- yield yield tslib.__await(result.value || []);
1790
+ let page = result.value || [];
1791
+ setContinuationToken(page, continuationToken);
1792
+ yield yield tslib.__await(page);
1731
1793
  }
1732
1794
  });
1733
1795
  }
@@ -1762,20 +1824,31 @@ class ServicesImpl {
1762
1824
  [Symbol.asyncIterator]() {
1763
1825
  return this;
1764
1826
  },
1765
- byPage: () => {
1766
- return this.listBySubscriptionPagingPage(options);
1827
+ byPage: (settings) => {
1828
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1829
+ throw new Error("maxPageSize is not supported by this operation.");
1830
+ }
1831
+ return this.listBySubscriptionPagingPage(options, settings);
1767
1832
  }
1768
1833
  };
1769
1834
  }
1770
- listBySubscriptionPagingPage(options) {
1835
+ listBySubscriptionPagingPage(options, settings) {
1771
1836
  return tslib.__asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() {
1772
- let result = yield tslib.__await(this._listBySubscription(options));
1773
- yield yield tslib.__await(result.value || []);
1774
- let continuationToken = result.nextLink;
1837
+ let result;
1838
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1839
+ if (!continuationToken) {
1840
+ result = yield tslib.__await(this._listBySubscription(options));
1841
+ let page = result.value || [];
1842
+ continuationToken = result.nextLink;
1843
+ setContinuationToken(page, continuationToken);
1844
+ yield yield tslib.__await(page);
1845
+ }
1775
1846
  while (continuationToken) {
1776
1847
  result = yield tslib.__await(this._listBySubscriptionNext(continuationToken, options));
1777
1848
  continuationToken = result.nextLink;
1778
- yield yield tslib.__await(result.value || []);
1849
+ let page = result.value || [];
1850
+ setContinuationToken(page, continuationToken);
1851
+ yield yield tslib.__await(page);
1779
1852
  }
1780
1853
  });
1781
1854
  }
@@ -2122,7 +2195,6 @@ const listByResourceGroupNextOperationSpec = {
2122
2195
  bodyMapper: CloudError
2123
2196
  }
2124
2197
  },
2125
- queryParameters: [apiVersion],
2126
2198
  urlParameters: [
2127
2199
  $host,
2128
2200
  resourceGroupName,
@@ -2143,7 +2215,6 @@ const listBySubscriptionNextOperationSpec = {
2143
2215
  bodyMapper: CloudError
2144
2216
  }
2145
2217
  },
2146
- queryParameters: [apiVersion],
2147
2218
  urlParameters: [
2148
2219
  $host,
2149
2220
  subscriptionId,
@@ -2187,14 +2258,18 @@ class PrivateLinkResourcesImpl {
2187
2258
  [Symbol.asyncIterator]() {
2188
2259
  return this;
2189
2260
  },
2190
- byPage: () => {
2191
- return this.listSupportedPagingPage(resourceGroupName, searchServiceName, options);
2261
+ byPage: (settings) => {
2262
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2263
+ throw new Error("maxPageSize is not supported by this operation.");
2264
+ }
2265
+ return this.listSupportedPagingPage(resourceGroupName, searchServiceName, options, settings);
2192
2266
  }
2193
2267
  };
2194
2268
  }
2195
- listSupportedPagingPage(resourceGroupName, searchServiceName, options) {
2269
+ listSupportedPagingPage(resourceGroupName, searchServiceName, options, _settings) {
2196
2270
  return tslib.__asyncGenerator(this, arguments, function* listSupportedPagingPage_1() {
2197
- let result = yield tslib.__await(this._listSupported(resourceGroupName, searchServiceName, options));
2271
+ let result;
2272
+ result = yield tslib.__await(this._listSupported(resourceGroupName, searchServiceName, options));
2198
2273
  yield yield tslib.__await(result.value || []);
2199
2274
  });
2200
2275
  }
@@ -2286,20 +2361,31 @@ class PrivateEndpointConnectionsImpl {
2286
2361
  [Symbol.asyncIterator]() {
2287
2362
  return this;
2288
2363
  },
2289
- byPage: () => {
2290
- return this.listByServicePagingPage(resourceGroupName, searchServiceName, options);
2364
+ byPage: (settings) => {
2365
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2366
+ throw new Error("maxPageSize is not supported by this operation.");
2367
+ }
2368
+ return this.listByServicePagingPage(resourceGroupName, searchServiceName, options, settings);
2291
2369
  }
2292
2370
  };
2293
2371
  }
2294
- listByServicePagingPage(resourceGroupName, searchServiceName, options) {
2372
+ listByServicePagingPage(resourceGroupName, searchServiceName, options, settings) {
2295
2373
  return tslib.__asyncGenerator(this, arguments, function* listByServicePagingPage_1() {
2296
- let result = yield tslib.__await(this._listByService(resourceGroupName, searchServiceName, options));
2297
- yield yield tslib.__await(result.value || []);
2298
- let continuationToken = result.nextLink;
2374
+ let result;
2375
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2376
+ if (!continuationToken) {
2377
+ result = yield tslib.__await(this._listByService(resourceGroupName, searchServiceName, options));
2378
+ let page = result.value || [];
2379
+ continuationToken = result.nextLink;
2380
+ setContinuationToken(page, continuationToken);
2381
+ yield yield tslib.__await(page);
2382
+ }
2299
2383
  while (continuationToken) {
2300
2384
  result = yield tslib.__await(this._listByServiceNext(resourceGroupName, searchServiceName, continuationToken, options));
2301
2385
  continuationToken = result.nextLink;
2302
- yield yield tslib.__await(result.value || []);
2386
+ let page = result.value || [];
2387
+ setContinuationToken(page, continuationToken);
2388
+ yield yield tslib.__await(page);
2303
2389
  }
2304
2390
  });
2305
2391
  }
@@ -2509,7 +2595,6 @@ const listByServiceNextOperationSpec$1 = {
2509
2595
  bodyMapper: CloudError
2510
2596
  }
2511
2597
  },
2512
- queryParameters: [apiVersion],
2513
2598
  urlParameters: [
2514
2599
  $host,
2515
2600
  resourceGroupName,
@@ -2555,20 +2640,31 @@ class SharedPrivateLinkResourcesImpl {
2555
2640
  [Symbol.asyncIterator]() {
2556
2641
  return this;
2557
2642
  },
2558
- byPage: () => {
2559
- return this.listByServicePagingPage(resourceGroupName, searchServiceName, options);
2643
+ byPage: (settings) => {
2644
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2645
+ throw new Error("maxPageSize is not supported by this operation.");
2646
+ }
2647
+ return this.listByServicePagingPage(resourceGroupName, searchServiceName, options, settings);
2560
2648
  }
2561
2649
  };
2562
2650
  }
2563
- listByServicePagingPage(resourceGroupName, searchServiceName, options) {
2651
+ listByServicePagingPage(resourceGroupName, searchServiceName, options, settings) {
2564
2652
  return tslib.__asyncGenerator(this, arguments, function* listByServicePagingPage_1() {
2565
- let result = yield tslib.__await(this._listByService(resourceGroupName, searchServiceName, options));
2566
- yield yield tslib.__await(result.value || []);
2567
- let continuationToken = result.nextLink;
2653
+ let result;
2654
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2655
+ if (!continuationToken) {
2656
+ result = yield tslib.__await(this._listByService(resourceGroupName, searchServiceName, options));
2657
+ let page = result.value || [];
2658
+ continuationToken = result.nextLink;
2659
+ setContinuationToken(page, continuationToken);
2660
+ yield yield tslib.__await(page);
2661
+ }
2568
2662
  while (continuationToken) {
2569
2663
  result = yield tslib.__await(this._listByServiceNext(resourceGroupName, searchServiceName, continuationToken, options));
2570
2664
  continuationToken = result.nextLink;
2571
- yield yield tslib.__await(result.value || []);
2665
+ let page = result.value || [];
2666
+ setContinuationToken(page, continuationToken);
2667
+ yield yield tslib.__await(page);
2572
2668
  }
2573
2669
  });
2574
2670
  }
@@ -2886,7 +2982,6 @@ const listByServiceNextOperationSpec = {
2886
2982
  bodyMapper: CloudError
2887
2983
  }
2888
2984
  },
2889
- queryParameters: [apiVersion],
2890
2985
  urlParameters: [
2891
2986
  $host,
2892
2987
  resourceGroupName,
@@ -2914,7 +3009,7 @@ class SearchManagementClient extends coreClient__namespace.ServiceClient {
2914
3009
  * @param options The parameter options
2915
3010
  */
2916
3011
  constructor(credentials, subscriptionId, options) {
2917
- var _a, _b;
3012
+ var _a, _b, _c;
2918
3013
  if (credentials === undefined) {
2919
3014
  throw new Error("'credentials' cannot be null");
2920
3015
  }
@@ -2929,32 +3024,34 @@ class SearchManagementClient extends coreClient__namespace.ServiceClient {
2929
3024
  requestContentType: "application/json; charset=utf-8",
2930
3025
  credential: credentials
2931
3026
  };
2932
- const packageDetails = `azsdk-js-arm-search/3.0.2`;
3027
+ const packageDetails = `azsdk-js-arm-search/3.1.0`;
2933
3028
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
2934
3029
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
2935
3030
  : `${packageDetails}`;
2936
- if (!options.credentialScopes) {
2937
- options.credentialScopes = ["https://management.azure.com/.default"];
2938
- }
2939
3031
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
2940
3032
  userAgentPrefix
2941
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
3033
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
2942
3034
  super(optionsWithDefaults);
3035
+ let bearerTokenAuthenticationPolicyFound = false;
2943
3036
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
2944
3037
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
2945
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
3038
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
2946
3039
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
2947
- if (!bearerTokenAuthenticationPolicyFound) {
2948
- this.pipeline.removePolicy({
2949
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
2950
- });
2951
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
2952
- scopes: `${optionsWithDefaults.baseUri}/.default`,
2953
- challengeCallbacks: {
2954
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
2955
- }
2956
- }));
2957
- }
3040
+ }
3041
+ if (!options ||
3042
+ !options.pipeline ||
3043
+ options.pipeline.getOrderedPolicies().length == 0 ||
3044
+ !bearerTokenAuthenticationPolicyFound) {
3045
+ this.pipeline.removePolicy({
3046
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
3047
+ });
3048
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
3049
+ credential: credentials,
3050
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
3051
+ challengeCallbacks: {
3052
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
3053
+ }
3054
+ }));
2958
3055
  }
2959
3056
  // Parameter assignments
2960
3057
  this.subscriptionId = subscriptionId;
@@ -2968,8 +3065,37 @@ class SearchManagementClient extends coreClient__namespace.ServiceClient {
2968
3065
  this.privateLinkResources = new PrivateLinkResourcesImpl(this);
2969
3066
  this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this);
2970
3067
  this.sharedPrivateLinkResources = new SharedPrivateLinkResourcesImpl(this);
3068
+ this.addCustomApiVersionPolicy(options.apiVersion);
3069
+ }
3070
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
3071
+ addCustomApiVersionPolicy(apiVersion) {
3072
+ if (!apiVersion) {
3073
+ return;
3074
+ }
3075
+ const apiVersionPolicy = {
3076
+ name: "CustomApiVersionPolicy",
3077
+ sendRequest(request, next) {
3078
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3079
+ const param = request.url.split("?");
3080
+ if (param.length > 1) {
3081
+ const newParams = param[1].split("&").map((item) => {
3082
+ if (item.indexOf("api-version") > -1) {
3083
+ return "api-version=" + apiVersion;
3084
+ }
3085
+ else {
3086
+ return item;
3087
+ }
3088
+ });
3089
+ request.url = param[0] + "?" + newParams.join("&");
3090
+ }
3091
+ return next(request);
3092
+ });
3093
+ }
3094
+ };
3095
+ this.pipeline.addPolicy(apiVersionPolicy);
2971
3096
  }
2972
3097
  }
2973
3098
 
2974
3099
  exports.SearchManagementClient = SearchManagementClient;
3100
+ exports.getContinuationToken = getContinuationToken;
2975
3101
  //# sourceMappingURL=index.js.map