@azure/arm-deviceprovisioningservices 5.0.0 → 5.0.1

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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
1
  # Release History
2
+
3
+ ## 5.0.1 (2022-04-27)
4
+
5
+ **Features**
6
+
7
+ - Bug fix
2
8
 
3
9
  ## 5.0.0 (2022-04-25)
4
10
 
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) {
@@ -3235,7 +3235,7 @@ class IotDpsClient extends coreClient__namespace.ServiceClient {
3235
3235
  requestContentType: "application/json; charset=utf-8",
3236
3236
  credential: credentials
3237
3237
  };
3238
- const packageDetails = `azsdk-js-arm-deviceprovisioningservices/5.0.0`;
3238
+ const packageDetails = `azsdk-js-arm-deviceprovisioningservices/5.0.1`;
3239
3239
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
3240
3240
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
3241
3241
  : `${packageDetails}`;
@@ -3270,6 +3270,34 @@ class IotDpsClient extends coreClient__namespace.ServiceClient {
3270
3270
  this.operations = new OperationsImpl(this);
3271
3271
  this.dpsCertificate = new DpsCertificateImpl(this);
3272
3272
  this.iotDpsResource = new IotDpsResourceImpl(this);
3273
+ this.addCustomApiVersionPolicy(options.apiVersion);
3274
+ }
3275
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
3276
+ addCustomApiVersionPolicy(apiVersion) {
3277
+ if (!apiVersion) {
3278
+ return;
3279
+ }
3280
+ const apiVersionPolicy = {
3281
+ name: "CustomApiVersionPolicy",
3282
+ sendRequest(request, next) {
3283
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3284
+ const param = request.url.split("?");
3285
+ if (param.length > 1) {
3286
+ const newParams = param[1].split("&").map((item) => {
3287
+ if (item.indexOf("api-version") > -1) {
3288
+ return item.replace(/(?<==).*$/, apiVersion);
3289
+ }
3290
+ else {
3291
+ return item;
3292
+ }
3293
+ });
3294
+ request.url = param[0] + "?" + newParams.join("&");
3295
+ }
3296
+ return next(request);
3297
+ });
3298
+ }
3299
+ };
3300
+ this.pipeline.addPolicy(apiVersionPolicy);
3273
3301
  }
3274
3302
  }
3275
3303