@azure/arm-cognitiveservices 7.3.0 → 7.3.1-alpha.20221122.7

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 (50) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/index.js +199 -70
  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/cognitiveServicesManagementClient.d.ts.map +1 -1
  7. package/dist-esm/src/cognitiveServicesManagementClient.js +4 -7
  8. package/dist-esm/src/cognitiveServicesManagementClient.js.map +1 -1
  9. package/dist-esm/src/index.d.ts +1 -0
  10. package/dist-esm/src/index.d.ts.map +1 -1
  11. package/dist-esm/src/index.js +1 -0
  12. package/dist-esm/src/index.js.map +1 -1
  13. package/dist-esm/src/operations/accounts.d.ts.map +1 -1
  14. package/dist-esm/src/operations/accounts.js +55 -21
  15. package/dist-esm/src/operations/accounts.js.map +1 -1
  16. package/dist-esm/src/operations/commitmentPlans.d.ts.map +1 -1
  17. package/dist-esm/src/operations/commitmentPlans.js +19 -7
  18. package/dist-esm/src/operations/commitmentPlans.js.map +1 -1
  19. package/dist-esm/src/operations/commitmentTiers.d.ts.map +1 -1
  20. package/dist-esm/src/operations/commitmentTiers.js +19 -7
  21. package/dist-esm/src/operations/commitmentTiers.js.map +1 -1
  22. package/dist-esm/src/operations/deletedAccounts.d.ts.map +1 -1
  23. package/dist-esm/src/operations/deletedAccounts.js +19 -7
  24. package/dist-esm/src/operations/deletedAccounts.js.map +1 -1
  25. package/dist-esm/src/operations/deployments.d.ts.map +1 -1
  26. package/dist-esm/src/operations/deployments.js +19 -7
  27. package/dist-esm/src/operations/deployments.js.map +1 -1
  28. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  29. package/dist-esm/src/operations/operations.js +19 -7
  30. package/dist-esm/src/operations/operations.js.map +1 -1
  31. package/dist-esm/src/operations/resourceSkus.d.ts.map +1 -1
  32. package/dist-esm/src/operations/resourceSkus.js +19 -7
  33. package/dist-esm/src/operations/resourceSkus.js.map +1 -1
  34. package/dist-esm/src/pagingHelper.d.ts +13 -0
  35. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  36. package/dist-esm/src/pagingHelper.js +32 -0
  37. package/dist-esm/src/pagingHelper.js.map +1 -0
  38. package/package.json +5 -5
  39. package/review/arm-cognitiveservices.api.md +3 -0
  40. package/src/cognitiveServicesManagementClient.ts +5 -6
  41. package/src/index.ts +1 -0
  42. package/src/operations/accounts.ts +67 -29
  43. package/src/operations/commitmentPlans.ts +26 -8
  44. package/src/operations/commitmentTiers.ts +21 -8
  45. package/src/operations/deletedAccounts.ts +22 -9
  46. package/src/operations/deployments.ts +26 -8
  47. package/src/operations/operations.ts +21 -8
  48. package/src/operations/resourceSkus.ts +21 -8
  49. package/src/pagingHelper.ts +39 -0
  50. package/types/arm-cognitiveservices.d.ts +9 -0
@@ -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"}
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 CognitiveServicesManagementClient.",
6
- "version": "7.3.0",
6
+ "version": "7.3.1-alpha.20221122.7",
7
7
  "engines": {
8
8
  "node": ">=14.0.0"
9
9
  },
@@ -36,18 +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.6.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
43
  "@azure-tools/test-recorder": "^2.0.0",
44
- "@azure-tools/test-credential": "^1.0.0",
44
+ "@azure-tools/test-credential": ">=1.0.0-alpha <1.0.0-alphb",
45
45
  "mocha": "^7.1.1",
46
46
  "@types/chai": "^4.2.8",
47
47
  "chai": "^4.2.0",
48
48
  "cross-env": "^7.0.2",
49
49
  "@types/node": "^14.0.0",
50
- "@azure/dev-tool": "^1.0.0"
50
+ "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb"
51
51
  },
52
52
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitiveservices/arm-cognitiveservices",
53
53
  "repository": {
@@ -119,4 +119,4 @@
119
119
  "disableDocsMs": true,
120
120
  "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-cognitiveservices?view=azure-node-preview"
121
121
  }
122
- }
122
+ }
@@ -605,6 +605,9 @@ export interface ErrorResponse {
605
605
  error?: ErrorDetail;
606
606
  }
607
607
 
608
+ // @public
609
+ export function getContinuationToken(page: unknown): string | undefined;
610
+
608
611
  // @public
609
612
  export type HostingModel = string;
610
613
 
@@ -78,22 +78,19 @@ export class CognitiveServicesManagementClient extends coreClient.ServiceClient
78
78
  credential: credentials
79
79
  };
80
80
 
81
- const packageDetails = `azsdk-js-arm-cognitiveservices/7.3.0`;
81
+ const packageDetails = `azsdk-js-arm-cognitiveservices/7.3.1`;
82
82
  const userAgentPrefix =
83
83
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
84
84
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
85
85
  : `${packageDetails}`;
86
86
 
87
- if (!options.credentialScopes) {
88
- options.credentialScopes = ["https://management.azure.com/.default"];
89
- }
90
87
  const optionsWithDefaults = {
91
88
  ...defaults,
92
89
  ...options,
93
90
  userAgentOptions: {
94
91
  userAgentPrefix
95
92
  },
96
- baseUri:
93
+ endpoint:
97
94
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
98
95
  };
99
96
  super(optionsWithDefaults);
@@ -119,7 +116,9 @@ export class CognitiveServicesManagementClient extends coreClient.ServiceClient
119
116
  this.pipeline.addPolicy(
120
117
  coreRestPipeline.bearerTokenAuthenticationPolicy({
121
118
  credential: credentials,
122
- scopes: `${optionsWithDefaults.credentialScopes}`,
119
+ scopes:
120
+ optionsWithDefaults.credentialScopes ??
121
+ `${optionsWithDefaults.endpoint}/.default`,
123
122
  challengeCallbacks: {
124
123
  authorizeRequestOnChallenge:
125
124
  coreClient.authorizeRequestOnClaimChallenge
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 { CognitiveServicesManagementClient } from "./cognitiveServicesManagementClient";
12
13
  export * from "./operationsInterfaces";
@@ -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 { Accounts } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,11 +19,14 @@ import {
18
19
  Account,
19
20
  AccountsListByResourceGroupNextOptionalParams,
20
21
  AccountsListByResourceGroupOptionalParams,
22
+ AccountsListByResourceGroupResponse,
21
23
  AccountsListNextOptionalParams,
22
24
  AccountsListOptionalParams,
25
+ AccountsListResponse,
23
26
  AccountModel,
24
27
  AccountsListModelsNextOptionalParams,
25
28
  AccountsListModelsOptionalParams,
29
+ AccountsListModelsResponse,
26
30
  AccountsCreateOptionalParams,
27
31
  AccountsCreateResponse,
28
32
  AccountsUpdateOptionalParams,
@@ -30,8 +34,6 @@ import {
30
34
  AccountsDeleteOptionalParams,
31
35
  AccountsGetOptionalParams,
32
36
  AccountsGetResponse,
33
- AccountsListByResourceGroupResponse,
34
- AccountsListResponse,
35
37
  AccountsListKeysOptionalParams,
36
38
  AccountsListKeysResponse,
37
39
  KeyName,
@@ -41,7 +43,6 @@ import {
41
43
  AccountsListSkusResponse,
42
44
  AccountsListUsagesOptionalParams,
43
45
  AccountsListUsagesResponse,
44
- AccountsListModelsResponse,
45
46
  AccountsListByResourceGroupNextResponse,
46
47
  AccountsListNextResponse,
47
48
  AccountsListModelsNextResponse
@@ -77,19 +78,33 @@ export class AccountsImpl implements Accounts {
77
78
  [Symbol.asyncIterator]() {
78
79
  return this;
79
80
  },
80
- byPage: () => {
81
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
81
+ byPage: (settings?: PageSettings) => {
82
+ if (settings?.maxPageSize) {
83
+ throw new Error("maxPageSize is not supported by this operation.");
84
+ }
85
+ return this.listByResourceGroupPagingPage(
86
+ resourceGroupName,
87
+ options,
88
+ settings
89
+ );
82
90
  }
83
91
  };
84
92
  }
85
93
 
86
94
  private async *listByResourceGroupPagingPage(
87
95
  resourceGroupName: string,
88
- options?: AccountsListByResourceGroupOptionalParams
96
+ options?: AccountsListByResourceGroupOptionalParams,
97
+ settings?: PageSettings
89
98
  ): AsyncIterableIterator<Account[]> {
90
- let result = await this._listByResourceGroup(resourceGroupName, options);
91
- yield result.value || [];
92
- let continuationToken = result.nextLink;
99
+ let result: AccountsListByResourceGroupResponse;
100
+ let continuationToken = settings?.continuationToken;
101
+ if (!continuationToken) {
102
+ result = await this._listByResourceGroup(resourceGroupName, options);
103
+ let page = result.value || [];
104
+ continuationToken = result.nextLink;
105
+ setContinuationToken(page, continuationToken);
106
+ yield page;
107
+ }
93
108
  while (continuationToken) {
94
109
  result = await this._listByResourceGroupNext(
95
110
  resourceGroupName,
@@ -97,7 +112,9 @@ export class AccountsImpl implements Accounts {
97
112
  options
98
113
  );
99
114
  continuationToken = result.nextLink;
100
- yield result.value || [];
115
+ let page = result.value || [];
116
+ setContinuationToken(page, continuationToken);
117
+ yield page;
101
118
  }
102
119
  }
103
120
 
@@ -128,22 +145,34 @@ export class AccountsImpl implements Accounts {
128
145
  [Symbol.asyncIterator]() {
129
146
  return this;
130
147
  },
131
- byPage: () => {
132
- return this.listPagingPage(options);
148
+ byPage: (settings?: PageSettings) => {
149
+ if (settings?.maxPageSize) {
150
+ throw new Error("maxPageSize is not supported by this operation.");
151
+ }
152
+ return this.listPagingPage(options, settings);
133
153
  }
134
154
  };
135
155
  }
136
156
 
137
157
  private async *listPagingPage(
138
- options?: AccountsListOptionalParams
158
+ options?: AccountsListOptionalParams,
159
+ settings?: PageSettings
139
160
  ): AsyncIterableIterator<Account[]> {
140
- let result = await this._list(options);
141
- yield result.value || [];
142
- let continuationToken = result.nextLink;
161
+ let result: AccountsListResponse;
162
+ let continuationToken = settings?.continuationToken;
163
+ if (!continuationToken) {
164
+ result = await this._list(options);
165
+ let page = result.value || [];
166
+ continuationToken = result.nextLink;
167
+ setContinuationToken(page, continuationToken);
168
+ yield page;
169
+ }
143
170
  while (continuationToken) {
144
171
  result = await this._listNext(continuationToken, options);
145
172
  continuationToken = result.nextLink;
146
- yield result.value || [];
173
+ let page = result.value || [];
174
+ setContinuationToken(page, continuationToken);
175
+ yield page;
147
176
  }
148
177
  }
149
178
 
@@ -178,11 +207,15 @@ export class AccountsImpl implements Accounts {
178
207
  [Symbol.asyncIterator]() {
179
208
  return this;
180
209
  },
181
- byPage: () => {
210
+ byPage: (settings?: PageSettings) => {
211
+ if (settings?.maxPageSize) {
212
+ throw new Error("maxPageSize is not supported by this operation.");
213
+ }
182
214
  return this.listModelsPagingPage(
183
215
  resourceGroupName,
184
216
  accountName,
185
- options
217
+ options,
218
+ settings
186
219
  );
187
220
  }
188
221
  };
@@ -191,15 +224,18 @@ export class AccountsImpl implements Accounts {
191
224
  private async *listModelsPagingPage(
192
225
  resourceGroupName: string,
193
226
  accountName: string,
194
- options?: AccountsListModelsOptionalParams
227
+ options?: AccountsListModelsOptionalParams,
228
+ settings?: PageSettings
195
229
  ): AsyncIterableIterator<AccountModel[]> {
196
- let result = await this._listModels(
197
- resourceGroupName,
198
- accountName,
199
- options
200
- );
201
- yield result.value || [];
202
- let continuationToken = result.nextLink;
230
+ let result: AccountsListModelsResponse;
231
+ let continuationToken = settings?.continuationToken;
232
+ if (!continuationToken) {
233
+ result = await this._listModels(resourceGroupName, accountName, options);
234
+ let page = result.value || [];
235
+ continuationToken = result.nextLink;
236
+ setContinuationToken(page, continuationToken);
237
+ yield page;
238
+ }
203
239
  while (continuationToken) {
204
240
  result = await this._listModelsNext(
205
241
  resourceGroupName,
@@ -208,7 +244,9 @@ export class AccountsImpl implements Accounts {
208
244
  options
209
245
  );
210
246
  continuationToken = result.nextLink;
211
- yield result.value || [];
247
+ let page = result.value || [];
248
+ setContinuationToken(page, continuationToken);
249
+ yield page;
212
250
  }
213
251
  }
214
252
 
@@ -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 { CommitmentPlans } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -59,8 +60,16 @@ export class CommitmentPlansImpl implements CommitmentPlans {
59
60
  [Symbol.asyncIterator]() {
60
61
  return this;
61
62
  },
62
- byPage: () => {
63
- return this.listPagingPage(resourceGroupName, accountName, options);
63
+ byPage: (settings?: PageSettings) => {
64
+ if (settings?.maxPageSize) {
65
+ throw new Error("maxPageSize is not supported by this operation.");
66
+ }
67
+ return this.listPagingPage(
68
+ resourceGroupName,
69
+ accountName,
70
+ options,
71
+ settings
72
+ );
64
73
  }
65
74
  };
66
75
  }
@@ -68,11 +77,18 @@ export class CommitmentPlansImpl implements CommitmentPlans {
68
77
  private async *listPagingPage(
69
78
  resourceGroupName: string,
70
79
  accountName: string,
71
- options?: CommitmentPlansListOptionalParams
80
+ options?: CommitmentPlansListOptionalParams,
81
+ settings?: PageSettings
72
82
  ): AsyncIterableIterator<CommitmentPlan[]> {
73
- let result = await this._list(resourceGroupName, accountName, options);
74
- yield result.value || [];
75
- let continuationToken = result.nextLink;
83
+ let result: CommitmentPlansListResponse;
84
+ let continuationToken = settings?.continuationToken;
85
+ if (!continuationToken) {
86
+ result = await this._list(resourceGroupName, accountName, options);
87
+ let page = result.value || [];
88
+ continuationToken = result.nextLink;
89
+ setContinuationToken(page, continuationToken);
90
+ yield page;
91
+ }
76
92
  while (continuationToken) {
77
93
  result = await this._listNext(
78
94
  resourceGroupName,
@@ -81,7 +97,9 @@ export class CommitmentPlansImpl implements CommitmentPlans {
81
97
  options
82
98
  );
83
99
  continuationToken = result.nextLink;
84
- yield result.value || [];
100
+ let page = result.value || [];
101
+ setContinuationToken(page, continuationToken);
102
+ yield page;
85
103
  }
86
104
  }
87
105
 
@@ -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 { CommitmentTiers } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -50,23 +51,35 @@ export class CommitmentTiersImpl implements CommitmentTiers {
50
51
  [Symbol.asyncIterator]() {
51
52
  return this;
52
53
  },
53
- byPage: () => {
54
- return this.listPagingPage(location, options);
54
+ byPage: (settings?: PageSettings) => {
55
+ if (settings?.maxPageSize) {
56
+ throw new Error("maxPageSize is not supported by this operation.");
57
+ }
58
+ return this.listPagingPage(location, options, settings);
55
59
  }
56
60
  };
57
61
  }
58
62
 
59
63
  private async *listPagingPage(
60
64
  location: string,
61
- options?: CommitmentTiersListOptionalParams
65
+ options?: CommitmentTiersListOptionalParams,
66
+ settings?: PageSettings
62
67
  ): AsyncIterableIterator<CommitmentTier[]> {
63
- let result = await this._list(location, options);
64
- yield result.value || [];
65
- let continuationToken = result.nextLink;
68
+ let result: CommitmentTiersListResponse;
69
+ let continuationToken = settings?.continuationToken;
70
+ if (!continuationToken) {
71
+ result = await this._list(location, options);
72
+ let page = result.value || [];
73
+ continuationToken = result.nextLink;
74
+ setContinuationToken(page, continuationToken);
75
+ yield page;
76
+ }
66
77
  while (continuationToken) {
67
78
  result = await this._listNext(location, continuationToken, options);
68
79
  continuationToken = result.nextLink;
69
- yield result.value || [];
80
+ let page = result.value || [];
81
+ setContinuationToken(page, continuationToken);
82
+ yield page;
70
83
  }
71
84
  }
72
85
 
@@ -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 { DeletedAccounts } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,10 +19,10 @@ import {
18
19
  Account,
19
20
  DeletedAccountsListNextOptionalParams,
20
21
  DeletedAccountsListOptionalParams,
22
+ DeletedAccountsListResponse,
21
23
  DeletedAccountsGetOptionalParams,
22
24
  DeletedAccountsGetResponse,
23
25
  DeletedAccountsPurgeOptionalParams,
24
- DeletedAccountsListResponse,
25
26
  DeletedAccountsListNextResponse
26
27
  } from "../models";
27
28
 
@@ -53,22 +54,34 @@ export class DeletedAccountsImpl implements DeletedAccounts {
53
54
  [Symbol.asyncIterator]() {
54
55
  return this;
55
56
  },
56
- byPage: () => {
57
- return this.listPagingPage(options);
57
+ byPage: (settings?: PageSettings) => {
58
+ if (settings?.maxPageSize) {
59
+ throw new Error("maxPageSize is not supported by this operation.");
60
+ }
61
+ return this.listPagingPage(options, settings);
58
62
  }
59
63
  };
60
64
  }
61
65
 
62
66
  private async *listPagingPage(
63
- options?: DeletedAccountsListOptionalParams
67
+ options?: DeletedAccountsListOptionalParams,
68
+ settings?: PageSettings
64
69
  ): AsyncIterableIterator<Account[]> {
65
- let result = await this._list(options);
66
- yield result.value || [];
67
- let continuationToken = result.nextLink;
70
+ let result: DeletedAccountsListResponse;
71
+ let continuationToken = settings?.continuationToken;
72
+ if (!continuationToken) {
73
+ result = await this._list(options);
74
+ let page = result.value || [];
75
+ continuationToken = result.nextLink;
76
+ setContinuationToken(page, continuationToken);
77
+ yield page;
78
+ }
68
79
  while (continuationToken) {
69
80
  result = await this._listNext(continuationToken, options);
70
81
  continuationToken = result.nextLink;
71
- yield result.value || [];
82
+ let page = result.value || [];
83
+ setContinuationToken(page, continuationToken);
84
+ yield page;
72
85
  }
73
86
  }
74
87
 
@@ -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 { Deployments } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -59,8 +60,16 @@ export class DeploymentsImpl implements Deployments {
59
60
  [Symbol.asyncIterator]() {
60
61
  return this;
61
62
  },
62
- byPage: () => {
63
- return this.listPagingPage(resourceGroupName, accountName, options);
63
+ byPage: (settings?: PageSettings) => {
64
+ if (settings?.maxPageSize) {
65
+ throw new Error("maxPageSize is not supported by this operation.");
66
+ }
67
+ return this.listPagingPage(
68
+ resourceGroupName,
69
+ accountName,
70
+ options,
71
+ settings
72
+ );
64
73
  }
65
74
  };
66
75
  }
@@ -68,11 +77,18 @@ export class DeploymentsImpl implements Deployments {
68
77
  private async *listPagingPage(
69
78
  resourceGroupName: string,
70
79
  accountName: string,
71
- options?: DeploymentsListOptionalParams
80
+ options?: DeploymentsListOptionalParams,
81
+ settings?: PageSettings
72
82
  ): AsyncIterableIterator<Deployment[]> {
73
- let result = await this._list(resourceGroupName, accountName, options);
74
- yield result.value || [];
75
- let continuationToken = result.nextLink;
83
+ let result: DeploymentsListResponse;
84
+ let continuationToken = settings?.continuationToken;
85
+ if (!continuationToken) {
86
+ result = await this._list(resourceGroupName, accountName, options);
87
+ let page = result.value || [];
88
+ continuationToken = result.nextLink;
89
+ setContinuationToken(page, continuationToken);
90
+ yield page;
91
+ }
76
92
  while (continuationToken) {
77
93
  result = await this._listNext(
78
94
  resourceGroupName,
@@ -81,7 +97,9 @@ export class DeploymentsImpl implements Deployments {
81
97
  options
82
98
  );
83
99
  continuationToken = result.nextLink;
84
- yield result.value || [];
100
+ let page = result.value || [];
101
+ setContinuationToken(page, continuationToken);
102
+ yield page;
85
103
  }
86
104
  }
87
105
 
@@ -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<Operation[]> {
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
 
@@ -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 { ResourceSkus } 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 ResourceSkusImpl implements ResourceSkus {
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?: ResourceSkusListOptionalParams
62
+ options?: ResourceSkusListOptionalParams,
63
+ settings?: PageSettings
59
64
  ): AsyncIterableIterator<ResourceSku[]> {
60
- let result = await this._list(options);
61
- yield result.value || [];
62
- let continuationToken = result.nextLink;
65
+ let result: ResourceSkusListResponse;
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