@azure/arm-education 1.0.0-beta.1 → 1.0.0-beta.3

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 (95) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +1 -1
  3. package/README.md +4 -3
  4. package/dist/index.js +233 -79
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/dist-esm/samples-dev/grantsGetSample.js +9 -2
  9. package/dist-esm/samples-dev/grantsGetSample.js.map +1 -1
  10. package/dist-esm/samples-dev/grantsListAllSample.js +9 -2
  11. package/dist-esm/samples-dev/grantsListAllSample.js.map +1 -1
  12. package/dist-esm/samples-dev/grantsListSample.js +9 -2
  13. package/dist-esm/samples-dev/grantsListSample.js.map +1 -1
  14. package/dist-esm/samples-dev/joinRequestsApproveSample.js +8 -1
  15. package/dist-esm/samples-dev/joinRequestsApproveSample.js.map +1 -1
  16. package/dist-esm/samples-dev/joinRequestsDenySample.js +8 -1
  17. package/dist-esm/samples-dev/joinRequestsDenySample.js.map +1 -1
  18. package/dist-esm/samples-dev/joinRequestsGetSample.js +8 -1
  19. package/dist-esm/samples-dev/joinRequestsGetSample.js.map +1 -1
  20. package/dist-esm/samples-dev/joinRequestsListSample.js +8 -1
  21. package/dist-esm/samples-dev/joinRequestsListSample.js.map +1 -1
  22. package/dist-esm/samples-dev/labsCreateOrUpdateSample.js +8 -1
  23. package/dist-esm/samples-dev/labsCreateOrUpdateSample.js.map +1 -1
  24. package/dist-esm/samples-dev/labsDeleteSample.js +8 -1
  25. package/dist-esm/samples-dev/labsDeleteSample.js.map +1 -1
  26. package/dist-esm/samples-dev/labsGenerateInviteCodeSample.js +8 -1
  27. package/dist-esm/samples-dev/labsGenerateInviteCodeSample.js.map +1 -1
  28. package/dist-esm/samples-dev/labsGetSample.js +9 -2
  29. package/dist-esm/samples-dev/labsGetSample.js.map +1 -1
  30. package/dist-esm/samples-dev/labsListAllSample.js +9 -2
  31. package/dist-esm/samples-dev/labsListAllSample.js.map +1 -1
  32. package/dist-esm/samples-dev/labsListSample.js +9 -2
  33. package/dist-esm/samples-dev/labsListSample.js.map +1 -1
  34. package/dist-esm/samples-dev/operationsListSample.js +8 -1
  35. package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
  36. package/dist-esm/samples-dev/redeemInvitationCodeSample.js +8 -1
  37. package/dist-esm/samples-dev/redeemInvitationCodeSample.js.map +1 -1
  38. package/dist-esm/samples-dev/studentLabsGetSample.js +8 -1
  39. package/dist-esm/samples-dev/studentLabsGetSample.js.map +1 -1
  40. package/dist-esm/samples-dev/studentLabsListAllSample.js +8 -1
  41. package/dist-esm/samples-dev/studentLabsListAllSample.js.map +1 -1
  42. package/dist-esm/samples-dev/studentsCreateOrUpdateSample.js +8 -1
  43. package/dist-esm/samples-dev/studentsCreateOrUpdateSample.js.map +1 -1
  44. package/dist-esm/samples-dev/studentsDeleteSample.js +8 -1
  45. package/dist-esm/samples-dev/studentsDeleteSample.js.map +1 -1
  46. package/dist-esm/samples-dev/studentsGetSample.js +8 -1
  47. package/dist-esm/samples-dev/studentsGetSample.js.map +1 -1
  48. package/dist-esm/samples-dev/studentsListSample.js +8 -1
  49. package/dist-esm/samples-dev/studentsListSample.js.map +1 -1
  50. package/dist-esm/src/educationManagementClient.d.ts +2 -0
  51. package/dist-esm/src/educationManagementClient.d.ts.map +1 -1
  52. package/dist-esm/src/educationManagementClient.js +49 -18
  53. package/dist-esm/src/educationManagementClient.js.map +1 -1
  54. package/dist-esm/src/index.d.ts +1 -0
  55. package/dist-esm/src/index.d.ts.map +1 -1
  56. package/dist-esm/src/index.js +1 -0
  57. package/dist-esm/src/index.js.map +1 -1
  58. package/dist-esm/src/models/index.d.ts +38 -26
  59. package/dist-esm/src/models/index.d.ts.map +1 -1
  60. package/dist-esm/src/models/index.js +25 -0
  61. package/dist-esm/src/models/index.js.map +1 -1
  62. package/dist-esm/src/operations/grants.d.ts.map +1 -1
  63. package/dist-esm/src/operations/grants.js +37 -16
  64. package/dist-esm/src/operations/grants.js.map +1 -1
  65. package/dist-esm/src/operations/joinRequests.d.ts.map +1 -1
  66. package/dist-esm/src/operations/joinRequests.js +19 -8
  67. package/dist-esm/src/operations/joinRequests.js.map +1 -1
  68. package/dist-esm/src/operations/labs.d.ts.map +1 -1
  69. package/dist-esm/src/operations/labs.js +37 -20
  70. package/dist-esm/src/operations/labs.js.map +1 -1
  71. package/dist-esm/src/operations/studentLabs.d.ts.map +1 -1
  72. package/dist-esm/src/operations/studentLabs.js +19 -8
  73. package/dist-esm/src/operations/studentLabs.js.map +1 -1
  74. package/dist-esm/src/operations/students.d.ts.map +1 -1
  75. package/dist-esm/src/operations/students.js +19 -8
  76. package/dist-esm/src/operations/students.js.map +1 -1
  77. package/dist-esm/src/pagingHelper.d.ts +13 -0
  78. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  79. package/dist-esm/src/pagingHelper.js +32 -0
  80. package/dist-esm/src/pagingHelper.js.map +1 -0
  81. package/dist-esm/test/sampleTest.js +11 -13
  82. package/dist-esm/test/sampleTest.js.map +1 -1
  83. package/package.json +17 -12
  84. package/review/arm-education.api.md +35 -61
  85. package/src/educationManagementClient.ts +60 -20
  86. package/src/index.ts +1 -0
  87. package/src/models/index.ts +44 -38
  88. package/src/operations/grants.ts +46 -22
  89. package/src/operations/joinRequests.ts +27 -14
  90. package/src/operations/labs.ts +52 -31
  91. package/src/operations/studentLabs.ts +21 -9
  92. package/src/operations/students.ts +27 -14
  93. package/src/pagingHelper.ts +39 -0
  94. package/types/arm-education.d.ts +49 -26
  95. package/types/tsdoc-metadata.json +1 -1
@@ -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 { Grants } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -16,9 +17,9 @@ import {
16
17
  GrantDetails,
17
18
  GrantsListAllNextOptionalParams,
18
19
  GrantsListAllOptionalParams,
20
+ GrantsListAllResponse,
19
21
  GrantsListNextOptionalParams,
20
22
  GrantsListOptionalParams,
21
- GrantsListAllResponse,
22
23
  GrantsListResponse,
23
24
  GrantsGetOptionalParams,
24
25
  GrantsGetResponse,
@@ -54,22 +55,34 @@ export class GrantsImpl implements Grants {
54
55
  [Symbol.asyncIterator]() {
55
56
  return this;
56
57
  },
57
- byPage: () => {
58
- return this.listAllPagingPage(options);
58
+ byPage: (settings?: PageSettings) => {
59
+ if (settings?.maxPageSize) {
60
+ throw new Error("maxPageSize is not supported by this operation.");
61
+ }
62
+ return this.listAllPagingPage(options, settings);
59
63
  }
60
64
  };
61
65
  }
62
66
 
63
67
  private async *listAllPagingPage(
64
- options?: GrantsListAllOptionalParams
68
+ options?: GrantsListAllOptionalParams,
69
+ settings?: PageSettings
65
70
  ): AsyncIterableIterator<GrantDetails[]> {
66
- let result = await this._listAll(options);
67
- yield result.value || [];
68
- let continuationToken = result.nextLink;
71
+ let result: GrantsListAllResponse;
72
+ let continuationToken = settings?.continuationToken;
73
+ if (!continuationToken) {
74
+ result = await this._listAll(options);
75
+ let page = result.value || [];
76
+ continuationToken = result.nextLink;
77
+ setContinuationToken(page, continuationToken);
78
+ yield page;
79
+ }
69
80
  while (continuationToken) {
70
81
  result = await this._listAllNext(continuationToken, options);
71
82
  continuationToken = result.nextLink;
72
- yield result.value || [];
83
+ let page = result.value || [];
84
+ setContinuationToken(page, continuationToken);
85
+ yield page;
73
86
  }
74
87
  }
75
88
 
@@ -104,11 +117,15 @@ export class GrantsImpl implements Grants {
104
117
  [Symbol.asyncIterator]() {
105
118
  return this;
106
119
  },
107
- byPage: () => {
120
+ byPage: (settings?: PageSettings) => {
121
+ if (settings?.maxPageSize) {
122
+ throw new Error("maxPageSize is not supported by this operation.");
123
+ }
108
124
  return this.listPagingPage(
109
125
  billingAccountName,
110
126
  billingProfileName,
111
- options
127
+ options,
128
+ settings
112
129
  );
113
130
  }
114
131
  };
@@ -117,15 +134,22 @@ export class GrantsImpl implements Grants {
117
134
  private async *listPagingPage(
118
135
  billingAccountName: string,
119
136
  billingProfileName: string,
120
- options?: GrantsListOptionalParams
137
+ options?: GrantsListOptionalParams,
138
+ settings?: PageSettings
121
139
  ): AsyncIterableIterator<GrantDetails[]> {
122
- let result = await this._list(
123
- billingAccountName,
124
- billingProfileName,
125
- options
126
- );
127
- yield result.value || [];
128
- let continuationToken = result.nextLink;
140
+ let result: GrantsListResponse;
141
+ let continuationToken = settings?.continuationToken;
142
+ if (!continuationToken) {
143
+ result = await this._list(
144
+ billingAccountName,
145
+ billingProfileName,
146
+ options
147
+ );
148
+ let page = result.value || [];
149
+ continuationToken = result.nextLink;
150
+ setContinuationToken(page, continuationToken);
151
+ yield page;
152
+ }
129
153
  while (continuationToken) {
130
154
  result = await this._listNext(
131
155
  billingAccountName,
@@ -134,7 +158,9 @@ export class GrantsImpl implements Grants {
134
158
  options
135
159
  );
136
160
  continuationToken = result.nextLink;
137
- yield result.value || [];
161
+ let page = result.value || [];
162
+ setContinuationToken(page, continuationToken);
163
+ yield page;
138
164
  }
139
165
  }
140
166
 
@@ -302,7 +328,6 @@ const listAllNextOperationSpec: coreClient.OperationSpec = {
302
328
  bodyMapper: Mappers.ErrorResponseBody
303
329
  }
304
330
  },
305
- queryParameters: [Parameters.apiVersion, Parameters.includeAllocatedBudget],
306
331
  urlParameters: [Parameters.$host, Parameters.nextLink],
307
332
  headerParameters: [Parameters.accept],
308
333
  serializer
@@ -318,7 +343,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
318
343
  bodyMapper: Mappers.ErrorResponseBody
319
344
  }
320
345
  },
321
- queryParameters: [Parameters.apiVersion, Parameters.includeAllocatedBudget],
322
346
  urlParameters: [
323
347
  Parameters.$host,
324
348
  Parameters.billingAccountName,
@@ -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 { JoinRequests } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -63,12 +64,16 @@ export class JoinRequestsImpl implements JoinRequests {
63
64
  [Symbol.asyncIterator]() {
64
65
  return this;
65
66
  },
66
- byPage: () => {
67
+ byPage: (settings?: PageSettings) => {
68
+ if (settings?.maxPageSize) {
69
+ throw new Error("maxPageSize is not supported by this operation.");
70
+ }
67
71
  return this.listPagingPage(
68
72
  billingAccountName,
69
73
  billingProfileName,
70
74
  invoiceSectionName,
71
- options
75
+ options,
76
+ settings
72
77
  );
73
78
  }
74
79
  };
@@ -78,16 +83,23 @@ export class JoinRequestsImpl implements JoinRequests {
78
83
  billingAccountName: string,
79
84
  billingProfileName: string,
80
85
  invoiceSectionName: string,
81
- options?: JoinRequestsListOptionalParams
86
+ options?: JoinRequestsListOptionalParams,
87
+ settings?: PageSettings
82
88
  ): AsyncIterableIterator<JoinRequestDetails[]> {
83
- let result = await this._list(
84
- billingAccountName,
85
- billingProfileName,
86
- invoiceSectionName,
87
- options
88
- );
89
- yield result.value || [];
90
- let continuationToken = result.nextLink;
89
+ let result: JoinRequestsListResponse;
90
+ let continuationToken = settings?.continuationToken;
91
+ if (!continuationToken) {
92
+ result = await this._list(
93
+ billingAccountName,
94
+ billingProfileName,
95
+ invoiceSectionName,
96
+ options
97
+ );
98
+ let page = result.value || [];
99
+ continuationToken = result.nextLink;
100
+ setContinuationToken(page, continuationToken);
101
+ yield page;
102
+ }
91
103
  while (continuationToken) {
92
104
  result = await this._listNext(
93
105
  billingAccountName,
@@ -97,7 +109,9 @@ export class JoinRequestsImpl implements JoinRequests {
97
109
  options
98
110
  );
99
111
  continuationToken = result.nextLink;
100
- yield result.value || [];
112
+ let page = result.value || [];
113
+ setContinuationToken(page, continuationToken);
114
+ yield page;
101
115
  }
102
116
  }
103
117
 
@@ -345,7 +359,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
345
359
  bodyMapper: Mappers.ErrorResponseBody
346
360
  }
347
361
  },
348
- queryParameters: [Parameters.apiVersion, Parameters.includeDenied],
349
362
  urlParameters: [
350
363
  Parameters.$host,
351
364
  Parameters.billingAccountName,
@@ -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 { Labs } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -16,9 +17,9 @@ import {
16
17
  LabDetails,
17
18
  LabsListAllNextOptionalParams,
18
19
  LabsListAllOptionalParams,
20
+ LabsListAllResponse,
19
21
  LabsListNextOptionalParams,
20
22
  LabsListOptionalParams,
21
- LabsListAllResponse,
22
23
  LabsListResponse,
23
24
  LabsGetOptionalParams,
24
25
  LabsGetResponse,
@@ -68,11 +69,15 @@ export class LabsImpl implements Labs {
68
69
  [Symbol.asyncIterator]() {
69
70
  return this;
70
71
  },
71
- byPage: () => {
72
+ byPage: (settings?: PageSettings) => {
73
+ if (settings?.maxPageSize) {
74
+ throw new Error("maxPageSize is not supported by this operation.");
75
+ }
72
76
  return this.listAllPagingPage(
73
77
  billingAccountName,
74
78
  billingProfileName,
75
- options
79
+ options,
80
+ settings
76
81
  );
77
82
  }
78
83
  };
@@ -81,15 +86,22 @@ export class LabsImpl implements Labs {
81
86
  private async *listAllPagingPage(
82
87
  billingAccountName: string,
83
88
  billingProfileName: string,
84
- options?: LabsListAllOptionalParams
89
+ options?: LabsListAllOptionalParams,
90
+ settings?: PageSettings
85
91
  ): AsyncIterableIterator<LabDetails[]> {
86
- let result = await this._listAll(
87
- billingAccountName,
88
- billingProfileName,
89
- options
90
- );
91
- yield result.value || [];
92
- let continuationToken = result.nextLink;
92
+ let result: LabsListAllResponse;
93
+ let continuationToken = settings?.continuationToken;
94
+ if (!continuationToken) {
95
+ result = await this._listAll(
96
+ billingAccountName,
97
+ billingProfileName,
98
+ options
99
+ );
100
+ let page = result.value || [];
101
+ continuationToken = result.nextLink;
102
+ setContinuationToken(page, continuationToken);
103
+ yield page;
104
+ }
93
105
  while (continuationToken) {
94
106
  result = await this._listAllNext(
95
107
  billingAccountName,
@@ -98,7 +110,9 @@ export class LabsImpl implements Labs {
98
110
  options
99
111
  );
100
112
  continuationToken = result.nextLink;
101
- yield result.value || [];
113
+ let page = result.value || [];
114
+ setContinuationToken(page, continuationToken);
115
+ yield page;
102
116
  }
103
117
  }
104
118
 
@@ -143,12 +157,16 @@ export class LabsImpl implements Labs {
143
157
  [Symbol.asyncIterator]() {
144
158
  return this;
145
159
  },
146
- byPage: () => {
160
+ byPage: (settings?: PageSettings) => {
161
+ if (settings?.maxPageSize) {
162
+ throw new Error("maxPageSize is not supported by this operation.");
163
+ }
147
164
  return this.listPagingPage(
148
165
  billingAccountName,
149
166
  billingProfileName,
150
167
  invoiceSectionName,
151
- options
168
+ options,
169
+ settings
152
170
  );
153
171
  }
154
172
  };
@@ -158,16 +176,23 @@ export class LabsImpl implements Labs {
158
176
  billingAccountName: string,
159
177
  billingProfileName: string,
160
178
  invoiceSectionName: string,
161
- options?: LabsListOptionalParams
179
+ options?: LabsListOptionalParams,
180
+ settings?: PageSettings
162
181
  ): AsyncIterableIterator<LabDetails[]> {
163
- let result = await this._list(
164
- billingAccountName,
165
- billingProfileName,
166
- invoiceSectionName,
167
- options
168
- );
169
- yield result.value || [];
170
- let continuationToken = result.nextLink;
182
+ let result: LabsListResponse;
183
+ let continuationToken = settings?.continuationToken;
184
+ if (!continuationToken) {
185
+ result = await this._list(
186
+ billingAccountName,
187
+ billingProfileName,
188
+ invoiceSectionName,
189
+ options
190
+ );
191
+ let page = result.value || [];
192
+ continuationToken = result.nextLink;
193
+ setContinuationToken(page, continuationToken);
194
+ yield page;
195
+ }
171
196
  while (continuationToken) {
172
197
  result = await this._listNext(
173
198
  billingAccountName,
@@ -177,7 +202,9 @@ export class LabsImpl implements Labs {
177
202
  options
178
203
  );
179
204
  continuationToken = result.nextLink;
180
- yield result.value || [];
205
+ let page = result.value || [];
206
+ setContinuationToken(page, continuationToken);
207
+ yield page;
181
208
  }
182
209
  }
183
210
 
@@ -532,11 +559,6 @@ const listAllNextOperationSpec: coreClient.OperationSpec = {
532
559
  bodyMapper: Mappers.ErrorResponseBody
533
560
  }
534
561
  },
535
- queryParameters: [
536
- Parameters.apiVersion,
537
- Parameters.includeBudget,
538
- Parameters.includeDeleted
539
- ],
540
562
  urlParameters: [
541
563
  Parameters.$host,
542
564
  Parameters.billingAccountName,
@@ -557,7 +579,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
557
579
  bodyMapper: Mappers.ErrorResponseBody
558
580
  }
559
581
  },
560
- queryParameters: [Parameters.apiVersion, Parameters.includeBudget],
561
582
  urlParameters: [
562
583
  Parameters.$host,
563
584
  Parameters.billingAccountName,
@@ -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 { StudentLabs } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -50,22 +51,34 @@ export class StudentLabsImpl implements StudentLabs {
50
51
  [Symbol.asyncIterator]() {
51
52
  return this;
52
53
  },
53
- byPage: () => {
54
- return this.listAllPagingPage(options);
54
+ byPage: (settings?: PageSettings) => {
55
+ if (settings?.maxPageSize) {
56
+ throw new Error("maxPageSize is not supported by this operation.");
57
+ }
58
+ return this.listAllPagingPage(options, settings);
55
59
  }
56
60
  };
57
61
  }
58
62
 
59
63
  private async *listAllPagingPage(
60
- options?: StudentLabsListAllOptionalParams
64
+ options?: StudentLabsListAllOptionalParams,
65
+ settings?: PageSettings
61
66
  ): AsyncIterableIterator<StudentLabDetails[]> {
62
- let result = await this._listAll(options);
63
- yield result.value || [];
64
- let continuationToken = result.nextLink;
67
+ let result: StudentLabsListAllResponse;
68
+ let continuationToken = settings?.continuationToken;
69
+ if (!continuationToken) {
70
+ result = await this._listAll(options);
71
+ let page = result.value || [];
72
+ continuationToken = result.nextLink;
73
+ setContinuationToken(page, continuationToken);
74
+ yield page;
75
+ }
65
76
  while (continuationToken) {
66
77
  result = await this._listAllNext(continuationToken, options);
67
78
  continuationToken = result.nextLink;
68
- yield result.value || [];
79
+ let page = result.value || [];
80
+ setContinuationToken(page, continuationToken);
81
+ yield page;
69
82
  }
70
83
  }
71
84
 
@@ -163,7 +176,6 @@ const listAllNextOperationSpec: coreClient.OperationSpec = {
163
176
  bodyMapper: Mappers.ErrorResponseBody
164
177
  }
165
178
  },
166
- queryParameters: [Parameters.apiVersion],
167
179
  urlParameters: [Parameters.$host, Parameters.nextLink],
168
180
  headerParameters: [Parameters.accept],
169
181
  serializer
@@ -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 { Students } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -64,12 +65,16 @@ export class StudentsImpl implements Students {
64
65
  [Symbol.asyncIterator]() {
65
66
  return this;
66
67
  },
67
- byPage: () => {
68
+ byPage: (settings?: PageSettings) => {
69
+ if (settings?.maxPageSize) {
70
+ throw new Error("maxPageSize is not supported by this operation.");
71
+ }
68
72
  return this.listPagingPage(
69
73
  billingAccountName,
70
74
  billingProfileName,
71
75
  invoiceSectionName,
72
- options
76
+ options,
77
+ settings
73
78
  );
74
79
  }
75
80
  };
@@ -79,16 +84,23 @@ export class StudentsImpl implements Students {
79
84
  billingAccountName: string,
80
85
  billingProfileName: string,
81
86
  invoiceSectionName: string,
82
- options?: StudentsListOptionalParams
87
+ options?: StudentsListOptionalParams,
88
+ settings?: PageSettings
83
89
  ): AsyncIterableIterator<StudentDetails[]> {
84
- let result = await this._list(
85
- billingAccountName,
86
- billingProfileName,
87
- invoiceSectionName,
88
- options
89
- );
90
- yield result.value || [];
91
- let continuationToken = result.nextLink;
90
+ let result: StudentsListResponse;
91
+ let continuationToken = settings?.continuationToken;
92
+ if (!continuationToken) {
93
+ result = await this._list(
94
+ billingAccountName,
95
+ billingProfileName,
96
+ invoiceSectionName,
97
+ options
98
+ );
99
+ let page = result.value || [];
100
+ continuationToken = result.nextLink;
101
+ setContinuationToken(page, continuationToken);
102
+ yield page;
103
+ }
92
104
  while (continuationToken) {
93
105
  result = await this._listNext(
94
106
  billingAccountName,
@@ -98,7 +110,9 @@ export class StudentsImpl implements Students {
98
110
  options
99
111
  );
100
112
  continuationToken = result.nextLink;
101
- yield result.value || [];
113
+ let page = result.value || [];
114
+ setContinuationToken(page, continuationToken);
115
+ yield page;
102
116
  }
103
117
  }
104
118
 
@@ -358,7 +372,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
358
372
  bodyMapper: Mappers.ErrorResponseBody
359
373
  }
360
374
  },
361
- queryParameters: [Parameters.apiVersion, Parameters.includeDeleted],
362
375
  urlParameters: [
363
376
  Parameters.$host,
364
377
  Parameters.billingAccountName,
@@ -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 the last `.value` produced by the `byPage` iterator,
17
+ * returns a continuation token that can be used to begin paging from
18
+ * that point later.
19
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
20
+ * @returns The continuation token that can be passed into byPage() during future calls.
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
+ }