@azure/arm-healthbot 2.0.1-alpha.20221128.1 → 2.1.1-alpha.20221130.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +15 -3
  2. package/dist/index.js +140 -40
  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/healthbotClient.d.ts +2 -0
  7. package/dist-esm/src/healthbotClient.d.ts.map +1 -1
  8. package/dist-esm/src/healthbotClient.js +49 -18
  9. package/dist-esm/src/healthbotClient.js.map +1 -1
  10. package/dist-esm/src/index.d.ts +1 -0
  11. package/dist-esm/src/index.d.ts.map +1 -1
  12. package/dist-esm/src/index.js +1 -0
  13. package/dist-esm/src/index.js.map +1 -1
  14. package/dist-esm/src/models/index.d.ts +8 -4
  15. package/dist-esm/src/models/index.d.ts.map +1 -1
  16. package/dist-esm/src/models/index.js +4 -0
  17. package/dist-esm/src/models/index.js.map +1 -1
  18. package/dist-esm/src/operations/bots.d.ts.map +1 -1
  19. package/dist-esm/src/operations/bots.js +37 -14
  20. package/dist-esm/src/operations/bots.js.map +1 -1
  21. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  22. package/dist-esm/src/operations/operations.js +19 -7
  23. package/dist-esm/src/operations/operations.js.map +1 -1
  24. package/dist-esm/src/pagingHelper.d.ts +13 -0
  25. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  26. package/dist-esm/src/pagingHelper.js +32 -0
  27. package/dist-esm/src/pagingHelper.js.map +1 -0
  28. package/dist-esm/test/sampleTest.js +11 -13
  29. package/dist-esm/test/sampleTest.js.map +1 -1
  30. package/package.json +12 -8
  31. package/review/arm-healthbot.api.md +9 -10
  32. package/src/healthbotClient.ts +60 -20
  33. package/src/index.ts +1 -0
  34. package/src/models/index.ts +8 -4
  35. package/src/operations/bots.ts +46 -17
  36. package/src/operations/operations.ts +21 -8
  37. package/src/pagingHelper.ts +39 -0
  38. package/types/arm-healthbot.d.ts +19 -4
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+ const pageMap = new WeakMap();
9
+ /**
10
+ * Given a result page from a pageable operation, returns a
11
+ * continuation token that can be used to begin paging from
12
+ * that point later.
13
+ * @param page A result object from calling .byPage() on a paged operation.
14
+ * @returns The continuation token that can be passed into byPage().
15
+ */
16
+ export function getContinuationToken(page) {
17
+ var _a;
18
+ if (typeof page !== "object" || page === null) {
19
+ return undefined;
20
+ }
21
+ return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
22
+ }
23
+ export function setContinuationToken(page, continuationToken) {
24
+ var _a;
25
+ if (typeof page !== "object" || page === null || !continuationToken) {
26
+ return;
27
+ }
28
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
29
+ pageInfo.continuationToken = continuationToken;
30
+ pageMap.set(page, pageInfo);
31
+ }
32
+ //# sourceMappingURL=pagingHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagingHelper.js","sourceRoot":"","sources":["../../src/pagingHelper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,OAAO,GAAG,IAAI,OAAO,EAAoB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAa;;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;QAC7C,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,0CAAE,iBAAiB,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,iBAAqC;;IAErC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,iBAAiB,EAAE;QACnE,OAAO;KACR;IACD,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;IACzC,QAAQ,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
@@ -6,24 +6,22 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
  import { __awaiter } from "tslib";
9
- import { record } from "@azure-tools/test-recorder";
10
- const recorderEnvSetup = {
11
- replaceableVariables: {
12
- AZURE_CLIENT_ID: "azure_client_id",
13
- AZURE_CLIENT_SECRET: "azure_client_secret",
14
- AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
15
- SUBSCRIPTION_ID: "azure_subscription_id"
16
- },
17
- customizationsOnRecordings: [
18
- (recording) => recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`)
19
- ],
20
- queryParametersToSkip: []
9
+ import { Recorder } from "@azure-tools/test-recorder";
10
+ const replaceableVariables = {
11
+ AZURE_CLIENT_ID: "azure_client_id",
12
+ AZURE_CLIENT_SECRET: "azure_client_secret",
13
+ AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
14
+ SUBSCRIPTION_ID: "azure_subscription_id"
15
+ };
16
+ const recorderOptions = {
17
+ envSetupForPlayback: replaceableVariables
21
18
  };
22
19
  describe("My test", () => {
23
20
  let recorder;
24
21
  beforeEach(function () {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
- recorder = record(this, recorderEnvSetup);
23
+ recorder = new Recorder(this.currentTest);
24
+ yield recorder.start(recorderOptions);
27
25
  });
28
26
  });
29
27
  afterEach(function () {
@@ -1 +1 @@
1
- {"version":3,"file":"sampleTest.js","sourceRoot":"","sources":["../../test/sampleTest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,EAEL,MAAM,EAGP,MAAM,4BAA4B,CAAC;AAGpC,MAAM,gBAAgB,GAA6B;IACjD,oBAAoB,EAAE;QACpB,eAAe,EAAE,iBAAiB;QAClC,mBAAmB,EAAE,qBAAqB;QAC1C,eAAe,EAAE,sCAAsC;QACvD,eAAe,EAAE,uBAAuB;KACzC;IACD,0BAA0B,EAAE;QAC1B,CAAC,SAAc,EAAO,EAAE,CACtB,SAAS,CAAC,OAAO,CACf,yBAAyB,EACzB,+BAA+B,CAChC;KACJ;IACD,qBAAqB,EAAE,EAAE;CAC1B,CAAC;AAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,IAAI,QAAkB,CAAC;IAEvB,UAAU,CAAC;;YACT,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAC5C,CAAC;KAAA,CAAC,CAAC;IAEH,SAAS,CAAC;;YACR,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;KAAA,CAAC,CAAC;IAEH,EAAE,CAAC,aAAa,EAAE;;YAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;KAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"sampleTest.js","sourceRoot":"","sources":["../../test/sampleTest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,EACL,QAAQ,EAGT,MAAM,4BAA4B,CAAC;AAIpC,MAAM,oBAAoB,GAA2B;IACnD,eAAe,EAAE,iBAAiB;IAClC,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,sCAAsC;IACvD,eAAe,EAAE,uBAAuB;CACzC,CAAC;AAEF,MAAM,eAAe,GAAyB;IAC5C,mBAAmB,EAAE,oBAAoB;CAC1C,CAAC;AAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,IAAI,QAAkB,CAAC;IAEvB,UAAU,CAAC;;YACT,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACxC,CAAC;KAAA,CAAC,CAAC;IAEH,SAAS,CAAC;;YACR,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;KAAA,CAAC,CAAC;IAEH,EAAE,CAAC,aAAa,EAAE;;YAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;KAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "mgmt",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "A generated SDK for HealthbotClient.",
6
- "version": "2.0.1-alpha.20221128.1",
6
+ "version": "2.1.1-alpha.20221130.1",
7
7
  "engines": {
8
8
  "node": ">=14.0.0"
9
9
  },
@@ -11,7 +11,7 @@
11
11
  "@azure/core-lro": "^2.2.0",
12
12
  "@azure/abort-controller": "^1.0.0",
13
13
  "@azure/core-paging": "^1.2.0",
14
- "@azure/core-client": "^1.5.0",
14
+ "@azure/core-client": "^1.6.1",
15
15
  "@azure/core-auth": "^1.3.0",
16
16
  "@azure/core-rest-pipeline": "^1.8.0",
17
17
  "tslib": "^2.2.0"
@@ -36,13 +36,18 @@
36
36
  "mkdirp": "^1.0.4",
37
37
  "rollup": "^2.66.1",
38
38
  "rollup-plugin-sourcemaps": "^0.6.3",
39
- "typescript": "~4.2.0",
39
+ "typescript": "~4.8.0",
40
40
  "uglify-js": "^3.4.9",
41
41
  "rimraf": "^3.0.0",
42
42
  "@azure/identity": "^2.0.1",
43
- "@azure-tools/test-recorder": "^1.0.0",
43
+ "@azure-tools/test-recorder": "^2.0.0",
44
+ "@azure-tools/test-credential": ">=1.0.0-alpha <1.0.0-alphb",
44
45
  "mocha": "^7.1.1",
45
- "cross-env": "^7.0.2"
46
+ "@types/chai": "^4.2.8",
47
+ "chai": "^4.2.0",
48
+ "cross-env": "^7.0.2",
49
+ "@types/node": "^14.0.0",
50
+ "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb"
46
51
  },
47
52
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot",
48
53
  "repository": {
@@ -93,9 +98,8 @@
93
98
  "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
94
99
  "unit-test:browser": "echo skipped",
95
100
  "integration-test": "npm run integration-test:node && npm run integration-test:browser",
96
- "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
97
- "integration-test:browser": "echo skipped",
98
- "docs": "echo skipped"
101
+ "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
102
+ "integration-test:browser": "echo skipped"
99
103
  },
100
104
  "sideEffects": false,
101
105
  "//metadata": {
@@ -112,11 +112,14 @@ export interface ErrorModel {
112
112
  }
113
113
 
114
114
  // @public
115
- export type HealthBot = TrackedResource & {
116
- sku: Sku;
115
+ export function getContinuationToken(page: unknown): string | undefined;
116
+
117
+ // @public
118
+ export interface HealthBot extends TrackedResource {
117
119
  identity?: Identity;
118
120
  properties?: HealthBotProperties;
119
- };
121
+ sku: Sku;
122
+ }
120
123
 
121
124
  // @public (undocumented)
122
125
  export class HealthbotClient extends coreClient.ServiceClient {
@@ -172,13 +175,9 @@ export type IdentityType = string;
172
175
 
173
176
  // @public
174
177
  export enum KnownIdentityType {
175
- // (undocumented)
176
178
  Application = "Application",
177
- // (undocumented)
178
179
  Key = "Key",
179
- // (undocumented)
180
180
  ManagedIdentity = "ManagedIdentity",
181
- // (undocumented)
182
181
  User = "User"
183
182
  }
184
183
 
@@ -248,12 +247,12 @@ export interface SystemData {
248
247
  }
249
248
 
250
249
  // @public
251
- export type TrackedResource = Resource & {
250
+ export interface TrackedResource extends Resource {
251
+ location: string;
252
252
  tags?: {
253
253
  [propertyName: string]: string;
254
254
  };
255
- location: string;
256
- };
255
+ }
257
256
 
258
257
  // @public
259
258
  export interface UserAssignedIdentity {
@@ -8,6 +8,11 @@
8
8
 
9
9
  import * as coreClient from "@azure/core-client";
10
10
  import * as coreRestPipeline from "@azure/core-rest-pipeline";
11
+ import {
12
+ PipelineRequest,
13
+ PipelineResponse,
14
+ SendRequest
15
+ } from "@azure/core-rest-pipeline";
11
16
  import * as coreAuth from "@azure/core-auth";
12
17
  import { BotsImpl, OperationsImpl } from "./operations";
13
18
  import { Bots, Operations } from "./operationsInterfaces";
@@ -45,47 +50,53 @@ export class HealthbotClient extends coreClient.ServiceClient {
45
50
  credential: credentials
46
51
  };
47
52
 
48
- const packageDetails = `azsdk-js-arm-healthbot/2.0.1`;
53
+ const packageDetails = `azsdk-js-arm-healthbot/2.1.1`;
49
54
  const userAgentPrefix =
50
55
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
51
56
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
52
57
  : `${packageDetails}`;
53
58
 
54
- if (!options.credentialScopes) {
55
- options.credentialScopes = ["https://management.azure.com/.default"];
56
- }
57
59
  const optionsWithDefaults = {
58
60
  ...defaults,
59
61
  ...options,
60
62
  userAgentOptions: {
61
63
  userAgentPrefix
62
64
  },
63
- baseUri:
65
+ endpoint:
64
66
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
65
67
  };
66
68
  super(optionsWithDefaults);
67
69
 
70
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
68
71
  if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
69
72
  const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
70
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
73
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
71
74
  (pipelinePolicy) =>
72
75
  pipelinePolicy.name ===
73
76
  coreRestPipeline.bearerTokenAuthenticationPolicyName
74
77
  );
75
- if (!bearerTokenAuthenticationPolicyFound) {
76
- this.pipeline.removePolicy({
77
- name: coreRestPipeline.bearerTokenAuthenticationPolicyName
78
- });
79
- this.pipeline.addPolicy(
80
- coreRestPipeline.bearerTokenAuthenticationPolicy({
81
- scopes: `${optionsWithDefaults.baseUri}/.default`,
82
- challengeCallbacks: {
83
- authorizeRequestOnChallenge:
84
- coreClient.authorizeRequestOnClaimChallenge
85
- }
86
- })
87
- );
88
- }
78
+ }
79
+ if (
80
+ !options ||
81
+ !options.pipeline ||
82
+ options.pipeline.getOrderedPolicies().length == 0 ||
83
+ !bearerTokenAuthenticationPolicyFound
84
+ ) {
85
+ this.pipeline.removePolicy({
86
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
87
+ });
88
+ this.pipeline.addPolicy(
89
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
90
+ credential: credentials,
91
+ scopes:
92
+ optionsWithDefaults.credentialScopes ??
93
+ `${optionsWithDefaults.endpoint}/.default`,
94
+ challengeCallbacks: {
95
+ authorizeRequestOnChallenge:
96
+ coreClient.authorizeRequestOnClaimChallenge
97
+ }
98
+ })
99
+ );
89
100
  }
90
101
  // Parameter assignments
91
102
  this.subscriptionId = subscriptionId;
@@ -95,6 +106,35 @@ export class HealthbotClient extends coreClient.ServiceClient {
95
106
  this.apiVersion = options.apiVersion || "2021-06-10";
96
107
  this.bots = new BotsImpl(this);
97
108
  this.operations = new OperationsImpl(this);
109
+ this.addCustomApiVersionPolicy(options.apiVersion);
110
+ }
111
+
112
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
113
+ private addCustomApiVersionPolicy(apiVersion?: string) {
114
+ if (!apiVersion) {
115
+ return;
116
+ }
117
+ const apiVersionPolicy = {
118
+ name: "CustomApiVersionPolicy",
119
+ async sendRequest(
120
+ request: PipelineRequest,
121
+ next: SendRequest
122
+ ): Promise<PipelineResponse> {
123
+ const param = request.url.split("?");
124
+ if (param.length > 1) {
125
+ const newParams = param[1].split("&").map((item) => {
126
+ if (item.indexOf("api-version") > -1) {
127
+ return "api-version=" + apiVersion;
128
+ } else {
129
+ return item;
130
+ }
131
+ });
132
+ request.url = param[0] + "?" + newParams.join("&");
133
+ }
134
+ return next(request);
135
+ }
136
+ };
137
+ this.pipeline.addPolicy(apiVersionPolicy);
98
138
  }
99
139
 
100
140
  bots: Bots;
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  /// <reference lib="esnext.asynciterable" />
10
+ export { getContinuationToken } from "./pagingHelper";
10
11
  export * from "./models";
11
12
  export { HealthbotClient } from "./healthbotClient";
12
13
  export * from "./operationsInterfaces";
@@ -222,28 +222,32 @@ export interface ValidationResult {
222
222
  }
223
223
 
224
224
  /** The resource model definition for a ARM tracked top level resource */
225
- export type TrackedResource = Resource & {
225
+ export interface TrackedResource extends Resource {
226
226
  /** Resource tags. */
227
227
  tags?: { [propertyName: string]: string };
228
228
  /** The geo-location where the resource lives */
229
229
  location: string;
230
- };
230
+ }
231
231
 
232
232
  /** Azure Health Bot resource definition */
233
- export type HealthBot = TrackedResource & {
233
+ export interface HealthBot extends TrackedResource {
234
234
  /** SKU of the Azure Health Bot. */
235
235
  sku: Sku;
236
236
  /** The identity of the Azure Health Bot. */
237
237
  identity?: Identity;
238
238
  /** The set of properties specific to Azure Health Bot resource. */
239
239
  properties?: HealthBotProperties;
240
- };
240
+ }
241
241
 
242
242
  /** Known values of {@link IdentityType} that the service accepts. */
243
243
  export enum KnownIdentityType {
244
+ /** User */
244
245
  User = "User",
246
+ /** Application */
245
247
  Application = "Application",
248
+ /** ManagedIdentity */
246
249
  ManagedIdentity = "ManagedIdentity",
250
+ /** Key */
247
251
  Key = "Key"
248
252
  }
249
253
 
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { Bots } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,8 +19,10 @@ import {
18
19
  HealthBot,
19
20
  BotsListByResourceGroupNextOptionalParams,
20
21
  BotsListByResourceGroupOptionalParams,
22
+ BotsListByResourceGroupResponse,
21
23
  BotsListNextOptionalParams,
22
24
  BotsListOptionalParams,
25
+ BotsListResponse,
23
26
  BotsCreateOptionalParams,
24
27
  BotsCreateResponse,
25
28
  BotsGetOptionalParams,
@@ -28,8 +31,6 @@ import {
28
31
  BotsUpdateOptionalParams,
29
32
  BotsUpdateResponse,
30
33
  BotsDeleteOptionalParams,
31
- BotsListByResourceGroupResponse,
32
- BotsListResponse,
33
34
  BotsListByResourceGroupNextResponse,
34
35
  BotsListNextResponse
35
36
  } from "../models";
@@ -64,19 +65,33 @@ export class BotsImpl implements Bots {
64
65
  [Symbol.asyncIterator]() {
65
66
  return this;
66
67
  },
67
- byPage: () => {
68
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
68
+ byPage: (settings?: PageSettings) => {
69
+ if (settings?.maxPageSize) {
70
+ throw new Error("maxPageSize is not supported by this operation.");
71
+ }
72
+ return this.listByResourceGroupPagingPage(
73
+ resourceGroupName,
74
+ options,
75
+ settings
76
+ );
69
77
  }
70
78
  };
71
79
  }
72
80
 
73
81
  private async *listByResourceGroupPagingPage(
74
82
  resourceGroupName: string,
75
- options?: BotsListByResourceGroupOptionalParams
83
+ options?: BotsListByResourceGroupOptionalParams,
84
+ settings?: PageSettings
76
85
  ): AsyncIterableIterator<HealthBot[]> {
77
- let result = await this._listByResourceGroup(resourceGroupName, options);
78
- yield result.value || [];
79
- let continuationToken = result.nextLink;
86
+ let result: BotsListByResourceGroupResponse;
87
+ let continuationToken = settings?.continuationToken;
88
+ if (!continuationToken) {
89
+ result = await this._listByResourceGroup(resourceGroupName, options);
90
+ let page = result.value || [];
91
+ continuationToken = result.nextLink;
92
+ setContinuationToken(page, continuationToken);
93
+ yield page;
94
+ }
80
95
  while (continuationToken) {
81
96
  result = await this._listByResourceGroupNext(
82
97
  resourceGroupName,
@@ -84,7 +99,9 @@ export class BotsImpl implements Bots {
84
99
  options
85
100
  );
86
101
  continuationToken = result.nextLink;
87
- yield result.value || [];
102
+ let page = result.value || [];
103
+ setContinuationToken(page, continuationToken);
104
+ yield page;
88
105
  }
89
106
  }
90
107
 
@@ -115,22 +132,34 @@ export class BotsImpl implements Bots {
115
132
  [Symbol.asyncIterator]() {
116
133
  return this;
117
134
  },
118
- byPage: () => {
119
- return this.listPagingPage(options);
135
+ byPage: (settings?: PageSettings) => {
136
+ if (settings?.maxPageSize) {
137
+ throw new Error("maxPageSize is not supported by this operation.");
138
+ }
139
+ return this.listPagingPage(options, settings);
120
140
  }
121
141
  };
122
142
  }
123
143
 
124
144
  private async *listPagingPage(
125
- options?: BotsListOptionalParams
145
+ options?: BotsListOptionalParams,
146
+ settings?: PageSettings
126
147
  ): AsyncIterableIterator<HealthBot[]> {
127
- let result = await this._list(options);
128
- yield result.value || [];
129
- let continuationToken = result.nextLink;
148
+ let result: BotsListResponse;
149
+ let continuationToken = settings?.continuationToken;
150
+ if (!continuationToken) {
151
+ result = await this._list(options);
152
+ let page = result.value || [];
153
+ continuationToken = result.nextLink;
154
+ setContinuationToken(page, continuationToken);
155
+ yield page;
156
+ }
130
157
  while (continuationToken) {
131
158
  result = await this._listNext(continuationToken, options);
132
159
  continuationToken = result.nextLink;
133
- yield result.value || [];
160
+ let page = result.value || [];
161
+ setContinuationToken(page, continuationToken);
162
+ yield page;
134
163
  }
135
164
  }
136
165
 
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { Operations } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -48,22 +49,34 @@ export class OperationsImpl implements Operations {
48
49
  [Symbol.asyncIterator]() {
49
50
  return this;
50
51
  },
51
- byPage: () => {
52
- return this.listPagingPage(options);
52
+ byPage: (settings?: PageSettings) => {
53
+ if (settings?.maxPageSize) {
54
+ throw new Error("maxPageSize is not supported by this operation.");
55
+ }
56
+ return this.listPagingPage(options, settings);
53
57
  }
54
58
  };
55
59
  }
56
60
 
57
61
  private async *listPagingPage(
58
- options?: OperationsListOptionalParams
62
+ options?: OperationsListOptionalParams,
63
+ settings?: PageSettings
59
64
  ): AsyncIterableIterator<OperationDetail[]> {
60
- let result = await this._list(options);
61
- yield result.value || [];
62
- let continuationToken = result.nextLink;
65
+ let result: OperationsListResponse;
66
+ let continuationToken = settings?.continuationToken;
67
+ if (!continuationToken) {
68
+ result = await this._list(options);
69
+ let page = result.value || [];
70
+ continuationToken = result.nextLink;
71
+ setContinuationToken(page, continuationToken);
72
+ yield page;
73
+ }
63
74
  while (continuationToken) {
64
75
  result = await this._listNext(continuationToken, options);
65
76
  continuationToken = result.nextLink;
66
- yield result.value || [];
77
+ let page = result.value || [];
78
+ setContinuationToken(page, continuationToken);
79
+ yield page;
67
80
  }
68
81
  }
69
82
 
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+
9
+ export interface PageInfo {
10
+ continuationToken?: string;
11
+ }
12
+
13
+ const pageMap = new WeakMap<object, PageInfo>();
14
+
15
+ /**
16
+ * Given a result page from a pageable operation, returns a
17
+ * continuation token that can be used to begin paging from
18
+ * that point later.
19
+ * @param page A result object from calling .byPage() on a paged operation.
20
+ * @returns The continuation token that can be passed into byPage().
21
+ */
22
+ export function getContinuationToken(page: unknown): string | undefined {
23
+ if (typeof page !== "object" || page === null) {
24
+ return undefined;
25
+ }
26
+ return pageMap.get(page)?.continuationToken;
27
+ }
28
+
29
+ export function setContinuationToken(
30
+ page: unknown,
31
+ continuationToken: string | undefined
32
+ ): void {
33
+ if (typeof page !== "object" || page === null || !continuationToken) {
34
+ return;
35
+ }
36
+ const pageInfo = pageMap.get(page) ?? {};
37
+ pageInfo.continuationToken = continuationToken;
38
+ pageMap.set(page, pageInfo);
39
+ }
@@ -199,15 +199,24 @@ export declare interface ErrorModel {
199
199
  error?: ErrorError;
200
200
  }
201
201
 
202
+ /**
203
+ * Given a result page from a pageable operation, returns a
204
+ * continuation token that can be used to begin paging from
205
+ * that point later.
206
+ * @param page A result object from calling .byPage() on a paged operation.
207
+ * @returns The continuation token that can be passed into byPage().
208
+ */
209
+ export declare function getContinuationToken(page: unknown): string | undefined;
210
+
202
211
  /** Azure Health Bot resource definition */
203
- export declare type HealthBot = TrackedResource & {
212
+ export declare interface HealthBot extends TrackedResource {
204
213
  /** SKU of the Azure Health Bot. */
205
214
  sku: Sku;
206
215
  /** The identity of the Azure Health Bot. */
207
216
  identity?: Identity;
208
217
  /** The set of properties specific to Azure Health Bot resource. */
209
218
  properties?: HealthBotProperties;
210
- };
219
+ }
211
220
 
212
221
  export declare class HealthbotClient extends coreClient.ServiceClient {
213
222
  $host: string;
@@ -220,6 +229,8 @@ export declare class HealthbotClient extends coreClient.ServiceClient {
220
229
  * @param options The parameter options
221
230
  */
222
231
  constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: HealthbotClientOptionalParams);
232
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
233
+ private addCustomApiVersionPolicy;
223
234
  bots: Bots;
224
235
  operations: Operations;
225
236
  }
@@ -299,9 +310,13 @@ export declare type IdentityType = string;
299
310
 
300
311
  /** Known values of {@link IdentityType} that the service accepts. */
301
312
  export declare enum KnownIdentityType {
313
+ /** User */
302
314
  User = "User",
315
+ /** Application */
303
316
  Application = "Application",
317
+ /** ManagedIdentity */
304
318
  ManagedIdentity = "ManagedIdentity",
319
+ /** Key */
305
320
  Key = "Key"
306
321
  }
307
322
 
@@ -407,14 +422,14 @@ export declare interface SystemData {
407
422
  }
408
423
 
409
424
  /** The resource model definition for a ARM tracked top level resource */
410
- export declare type TrackedResource = Resource & {
425
+ export declare interface TrackedResource extends Resource {
411
426
  /** Resource tags. */
412
427
  tags?: {
413
428
  [propertyName: string]: string;
414
429
  };
415
430
  /** The geo-location where the resource lives */
416
431
  location: string;
417
- };
432
+ }
418
433
 
419
434
  /** The details of the user assigned managed identity used by the Video Analyzer resource. */
420
435
  export declare interface UserAssignedIdentity {