@azure/arm-education 1.0.0-beta.2 → 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 (90) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/dist/index.js +179 -78
  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.map +1 -1
  51. package/dist-esm/src/educationManagementClient.js +20 -18
  52. package/dist-esm/src/educationManagementClient.js.map +1 -1
  53. package/dist-esm/src/index.d.ts +1 -0
  54. package/dist-esm/src/index.d.ts.map +1 -1
  55. package/dist-esm/src/index.js +1 -0
  56. package/dist-esm/src/index.js.map +1 -1
  57. package/dist-esm/src/models/index.d.ts +0 -14
  58. package/dist-esm/src/models/index.d.ts.map +1 -1
  59. package/dist-esm/src/operations/grants.d.ts.map +1 -1
  60. package/dist-esm/src/operations/grants.js +37 -16
  61. package/dist-esm/src/operations/grants.js.map +1 -1
  62. package/dist-esm/src/operations/joinRequests.d.ts.map +1 -1
  63. package/dist-esm/src/operations/joinRequests.js +19 -8
  64. package/dist-esm/src/operations/joinRequests.js.map +1 -1
  65. package/dist-esm/src/operations/labs.d.ts.map +1 -1
  66. package/dist-esm/src/operations/labs.js +37 -20
  67. package/dist-esm/src/operations/labs.js.map +1 -1
  68. package/dist-esm/src/operations/studentLabs.d.ts.map +1 -1
  69. package/dist-esm/src/operations/studentLabs.js +19 -8
  70. package/dist-esm/src/operations/studentLabs.js.map +1 -1
  71. package/dist-esm/src/operations/students.d.ts.map +1 -1
  72. package/dist-esm/src/operations/students.js +19 -8
  73. package/dist-esm/src/operations/students.js.map +1 -1
  74. package/dist-esm/src/pagingHelper.d.ts +13 -0
  75. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  76. package/dist-esm/src/pagingHelper.js +32 -0
  77. package/dist-esm/src/pagingHelper.js.map +1 -0
  78. package/package.json +8 -6
  79. package/review/arm-education.api.md +3 -7
  80. package/src/educationManagementClient.ts +26 -20
  81. package/src/index.ts +1 -0
  82. package/src/models/index.ts +6 -26
  83. package/src/operations/grants.ts +46 -22
  84. package/src/operations/joinRequests.ts +27 -14
  85. package/src/operations/labs.ts +52 -31
  86. package/src/operations/studentLabs.ts +21 -9
  87. package/src/operations/students.ts +27 -14
  88. package/src/pagingHelper.ts +39 -0
  89. package/types/arm-education.d.ts +9 -14
  90. 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 { 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
+ }
@@ -80,6 +80,15 @@ export declare interface ErrorResponseBody {
80
80
  error?: ErrorResponse;
81
81
  }
82
82
 
83
+ /**
84
+ * Given the last `.value` produced by the `byPage` iterator,
85
+ * returns a continuation token that can be used to begin paging from
86
+ * that point later.
87
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
88
+ * @returns The continuation token that can be passed into byPage() during future calls.
89
+ */
90
+ export declare function getContinuationToken(page: unknown): string | undefined;
91
+
83
92
  /** Grant details. */
84
93
  export declare interface GrantDetails extends Resource {
85
94
  /**
@@ -162,8 +171,6 @@ export declare type GrantsGetResponse = GrantDetails;
162
171
 
163
172
  /** Optional parameters. */
164
173
  export declare interface GrantsListAllNextOptionalParams extends coreClient.OperationOptions {
165
- /** May be used to include information about budget that has been allocated. */
166
- includeAllocatedBudget?: boolean;
167
174
  }
168
175
 
169
176
  /** Contains response data for the listAllNext operation. */
@@ -180,8 +187,6 @@ export declare type GrantsListAllResponse = GrantListResponse;
180
187
 
181
188
  /** Optional parameters. */
182
189
  export declare interface GrantsListNextOptionalParams extends coreClient.OperationOptions {
183
- /** May be used to include information about budget that has been allocated. */
184
- includeAllocatedBudget?: boolean;
185
190
  }
186
191
 
187
192
  /** Contains response data for the listNext operation. */
@@ -304,8 +309,6 @@ export declare type JoinRequestsGetResponse = JoinRequestDetails;
304
309
 
305
310
  /** Optional parameters. */
306
311
  export declare interface JoinRequestsListNextOptionalParams extends coreClient.OperationOptions {
307
- /** Include denied */
308
- includeDenied?: boolean;
309
312
  }
310
313
 
311
314
  /** Contains response data for the listNext operation. */
@@ -555,10 +558,6 @@ export declare type LabsGetResponse = LabDetails;
555
558
 
556
559
  /** Optional parameters. */
557
560
  export declare interface LabsListAllNextOptionalParams extends coreClient.OperationOptions {
558
- /** May be used to include budget information. */
559
- includeBudget?: boolean;
560
- /** May be used to show deleted items. */
561
- includeDeleted?: boolean;
562
561
  }
563
562
 
564
563
  /** Contains response data for the listAllNext operation. */
@@ -577,8 +576,6 @@ export declare type LabsListAllResponse = LabListResult;
577
576
 
578
577
  /** Optional parameters. */
579
578
  export declare interface LabsListNextOptionalParams extends coreClient.OperationOptions {
580
- /** May be used to include budget information. */
581
- includeBudget?: boolean;
582
579
  }
583
580
 
584
581
  /** Contains response data for the listNext operation. */
@@ -965,8 +962,6 @@ export declare type StudentsGetResponse = StudentDetails;
965
962
 
966
963
  /** Optional parameters. */
967
964
  export declare interface StudentsListNextOptionalParams extends coreClient.OperationOptions {
968
- /** May be used to show deleted items. */
969
- includeDeleted?: boolean;
970
965
  }
971
966
 
972
967
  /** Contains response data for the listNext operation. */
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.18.11"
8
+ "packageVersion": "7.34.2"
9
9
  }
10
10
  ]
11
11
  }