@azure/arm-healthcareapis 2.1.2-alpha.20221128.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/CHANGELOG.md +22 -10
  2. package/dist/index.js +316 -95
  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/healthcareApisManagementClient.d.ts +2 -0
  7. package/dist-esm/src/healthcareApisManagementClient.d.ts.map +1 -1
  8. package/dist-esm/src/healthcareApisManagementClient.js +49 -18
  9. package/dist-esm/src/healthcareApisManagementClient.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 +82 -29
  15. package/dist-esm/src/models/index.d.ts.map +1 -1
  16. package/dist-esm/src/models/index.js +48 -0
  17. package/dist-esm/src/models/index.js.map +1 -1
  18. package/dist-esm/src/models/mappers.d.ts.map +1 -1
  19. package/dist-esm/src/models/mappers.js +0 -1
  20. package/dist-esm/src/models/mappers.js.map +1 -1
  21. package/dist-esm/src/operations/dicomServices.d.ts.map +1 -1
  22. package/dist-esm/src/operations/dicomServices.js +19 -7
  23. package/dist-esm/src/operations/dicomServices.js.map +1 -1
  24. package/dist-esm/src/operations/fhirDestinations.d.ts.map +1 -1
  25. package/dist-esm/src/operations/fhirDestinations.js +19 -7
  26. package/dist-esm/src/operations/fhirDestinations.js.map +1 -1
  27. package/dist-esm/src/operations/fhirServices.d.ts.map +1 -1
  28. package/dist-esm/src/operations/fhirServices.js +19 -7
  29. package/dist-esm/src/operations/fhirServices.js.map +1 -1
  30. package/dist-esm/src/operations/iotConnectors.d.ts.map +1 -1
  31. package/dist-esm/src/operations/iotConnectors.js +19 -7
  32. package/dist-esm/src/operations/iotConnectors.js.map +1 -1
  33. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  34. package/dist-esm/src/operations/operations.js +19 -7
  35. package/dist-esm/src/operations/operations.js.map +1 -1
  36. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -1
  37. package/dist-esm/src/operations/privateEndpointConnections.js +8 -4
  38. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -1
  39. package/dist-esm/src/operations/services.d.ts.map +1 -1
  40. package/dist-esm/src/operations/services.js +37 -14
  41. package/dist-esm/src/operations/services.js.map +1 -1
  42. package/dist-esm/src/operations/workspacePrivateEndpointConnections.d.ts.map +1 -1
  43. package/dist-esm/src/operations/workspacePrivateEndpointConnections.js +8 -4
  44. package/dist-esm/src/operations/workspacePrivateEndpointConnections.js.map +1 -1
  45. package/dist-esm/src/operations/workspacePrivateLinkResources.d.ts.map +1 -1
  46. package/dist-esm/src/operations/workspacePrivateLinkResources.js +8 -4
  47. package/dist-esm/src/operations/workspacePrivateLinkResources.js.map +1 -1
  48. package/dist-esm/src/operations/workspaces.d.ts.map +1 -1
  49. package/dist-esm/src/operations/workspaces.js +37 -14
  50. package/dist-esm/src/operations/workspaces.js.map +1 -1
  51. package/dist-esm/src/pagingHelper.d.ts +13 -0
  52. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  53. package/dist-esm/src/pagingHelper.js +32 -0
  54. package/dist-esm/src/pagingHelper.js.map +1 -0
  55. package/dist-esm/test/sampleTest.js +11 -13
  56. package/dist-esm/test/sampleTest.js.map +1 -1
  57. package/package.json +13 -9
  58. package/review/arm-healthcareapis.api.md +52 -92
  59. package/src/healthcareApisManagementClient.ts +60 -20
  60. package/src/index.ts +1 -0
  61. package/src/models/index.ts +158 -109
  62. package/src/models/mappers.ts +0 -1
  63. package/src/operations/dicomServices.ts +26 -12
  64. package/src/operations/fhirDestinations.ts +27 -13
  65. package/src/operations/fhirServices.ts +26 -12
  66. package/src/operations/iotConnectors.ts +26 -12
  67. package/src/operations/operations.ts +21 -8
  68. package/src/operations/privateEndpointConnections.ts +11 -5
  69. package/src/operations/services.ts +46 -17
  70. package/src/operations/workspacePrivateEndpointConnections.ts +11 -5
  71. package/src/operations/workspacePrivateLinkResources.ts +11 -5
  72. package/src/operations/workspaces.ts +45 -16
  73. package/src/pagingHelper.ts +39 -0
  74. package/types/arm-healthcareapis.d.ts +93 -29
@@ -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 { FhirServices } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -66,11 +67,15 @@ export class FhirServicesImpl implements FhirServices {
66
67
  [Symbol.asyncIterator]() {
67
68
  return this;
68
69
  },
69
- byPage: () => {
70
+ byPage: (settings?: PageSettings) => {
71
+ if (settings?.maxPageSize) {
72
+ throw new Error("maxPageSize is not supported by this operation.");
73
+ }
70
74
  return this.listByWorkspacePagingPage(
71
75
  resourceGroupName,
72
76
  workspaceName,
73
- options
77
+ options,
78
+ settings
74
79
  );
75
80
  }
76
81
  };
@@ -79,15 +84,22 @@ export class FhirServicesImpl implements FhirServices {
79
84
  private async *listByWorkspacePagingPage(
80
85
  resourceGroupName: string,
81
86
  workspaceName: string,
82
- options?: FhirServicesListByWorkspaceOptionalParams
87
+ options?: FhirServicesListByWorkspaceOptionalParams,
88
+ settings?: PageSettings
83
89
  ): AsyncIterableIterator<FhirService[]> {
84
- let result = await this._listByWorkspace(
85
- resourceGroupName,
86
- workspaceName,
87
- options
88
- );
89
- yield result.value || [];
90
- let continuationToken = result.nextLink;
90
+ let result: FhirServicesListByWorkspaceResponse;
91
+ let continuationToken = settings?.continuationToken;
92
+ if (!continuationToken) {
93
+ result = await this._listByWorkspace(
94
+ resourceGroupName,
95
+ workspaceName,
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._listByWorkspaceNext(
93
105
  resourceGroupName,
@@ -96,7 +108,9 @@ export class FhirServicesImpl implements FhirServices {
96
108
  options
97
109
  );
98
110
  continuationToken = result.nextLink;
99
- yield result.value || [];
111
+ let page = result.value || [];
112
+ setContinuationToken(page, continuationToken);
113
+ yield page;
100
114
  }
101
115
  }
102
116
 
@@ -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 { IotConnectors } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -66,11 +67,15 @@ export class IotConnectorsImpl implements IotConnectors {
66
67
  [Symbol.asyncIterator]() {
67
68
  return this;
68
69
  },
69
- byPage: () => {
70
+ byPage: (settings?: PageSettings) => {
71
+ if (settings?.maxPageSize) {
72
+ throw new Error("maxPageSize is not supported by this operation.");
73
+ }
70
74
  return this.listByWorkspacePagingPage(
71
75
  resourceGroupName,
72
76
  workspaceName,
73
- options
77
+ options,
78
+ settings
74
79
  );
75
80
  }
76
81
  };
@@ -79,15 +84,22 @@ export class IotConnectorsImpl implements IotConnectors {
79
84
  private async *listByWorkspacePagingPage(
80
85
  resourceGroupName: string,
81
86
  workspaceName: string,
82
- options?: IotConnectorsListByWorkspaceOptionalParams
87
+ options?: IotConnectorsListByWorkspaceOptionalParams,
88
+ settings?: PageSettings
83
89
  ): AsyncIterableIterator<IotConnector[]> {
84
- let result = await this._listByWorkspace(
85
- resourceGroupName,
86
- workspaceName,
87
- options
88
- );
89
- yield result.value || [];
90
- let continuationToken = result.nextLink;
90
+ let result: IotConnectorsListByWorkspaceResponse;
91
+ let continuationToken = settings?.continuationToken;
92
+ if (!continuationToken) {
93
+ result = await this._listByWorkspace(
94
+ resourceGroupName,
95
+ workspaceName,
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._listByWorkspaceNext(
93
105
  resourceGroupName,
@@ -96,7 +108,9 @@ export class IotConnectorsImpl implements IotConnectors {
96
108
  options
97
109
  );
98
110
  continuationToken = result.nextLink;
99
- yield result.value || [];
111
+ let page = result.value || [];
112
+ setContinuationToken(page, continuationToken);
113
+ yield page;
100
114
  }
101
115
  }
102
116
 
@@ -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
 
@@ -6,7 +6,7 @@
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
10
  import { PrivateEndpointConnections } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
@@ -63,11 +63,15 @@ export class PrivateEndpointConnectionsImpl
63
63
  [Symbol.asyncIterator]() {
64
64
  return this;
65
65
  },
66
- byPage: () => {
66
+ byPage: (settings?: PageSettings) => {
67
+ if (settings?.maxPageSize) {
68
+ throw new Error("maxPageSize is not supported by this operation.");
69
+ }
67
70
  return this.listByServicePagingPage(
68
71
  resourceGroupName,
69
72
  resourceName,
70
- options
73
+ options,
74
+ settings
71
75
  );
72
76
  }
73
77
  };
@@ -76,9 +80,11 @@ export class PrivateEndpointConnectionsImpl
76
80
  private async *listByServicePagingPage(
77
81
  resourceGroupName: string,
78
82
  resourceName: string,
79
- options?: PrivateEndpointConnectionsListByServiceOptionalParams
83
+ options?: PrivateEndpointConnectionsListByServiceOptionalParams,
84
+ _settings?: PageSettings
80
85
  ): AsyncIterableIterator<PrivateEndpointConnectionDescription[]> {
81
- let result = await this._listByService(
86
+ let result: PrivateEndpointConnectionsListByServiceResponse;
87
+ result = await this._listByService(
82
88
  resourceGroupName,
83
89
  resourceName,
84
90
  options
@@ -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 { Services } 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
  ServicesDescription,
19
20
  ServicesListNextOptionalParams,
20
21
  ServicesListOptionalParams,
22
+ ServicesListResponse,
21
23
  ServicesListByResourceGroupNextOptionalParams,
22
24
  ServicesListByResourceGroupOptionalParams,
25
+ ServicesListByResourceGroupResponse,
23
26
  ServicesGetOptionalParams,
24
27
  ServicesGetResponse,
25
28
  ServicesCreateOrUpdateOptionalParams,
@@ -28,8 +31,6 @@ import {
28
31
  ServicesUpdateOptionalParams,
29
32
  ServicesUpdateResponse,
30
33
  ServicesDeleteOptionalParams,
31
- ServicesListResponse,
32
- ServicesListByResourceGroupResponse,
33
34
  CheckNameAvailabilityParameters,
34
35
  ServicesCheckNameAvailabilityOptionalParams,
35
36
  ServicesCheckNameAvailabilityResponse,
@@ -65,22 +66,34 @@ export class ServicesImpl implements Services {
65
66
  [Symbol.asyncIterator]() {
66
67
  return this;
67
68
  },
68
- byPage: () => {
69
- return this.listPagingPage(options);
69
+ byPage: (settings?: PageSettings) => {
70
+ if (settings?.maxPageSize) {
71
+ throw new Error("maxPageSize is not supported by this operation.");
72
+ }
73
+ return this.listPagingPage(options, settings);
70
74
  }
71
75
  };
72
76
  }
73
77
 
74
78
  private async *listPagingPage(
75
- options?: ServicesListOptionalParams
79
+ options?: ServicesListOptionalParams,
80
+ settings?: PageSettings
76
81
  ): AsyncIterableIterator<ServicesDescription[]> {
77
- let result = await this._list(options);
78
- yield result.value || [];
79
- let continuationToken = result.nextLink;
82
+ let result: ServicesListResponse;
83
+ let continuationToken = settings?.continuationToken;
84
+ if (!continuationToken) {
85
+ result = await this._list(options);
86
+ let page = result.value || [];
87
+ continuationToken = result.nextLink;
88
+ setContinuationToken(page, continuationToken);
89
+ yield page;
90
+ }
80
91
  while (continuationToken) {
81
92
  result = await this._listNext(continuationToken, options);
82
93
  continuationToken = result.nextLink;
83
- yield result.value || [];
94
+ let page = result.value || [];
95
+ setContinuationToken(page, continuationToken);
96
+ yield page;
84
97
  }
85
98
  }
86
99
 
@@ -109,19 +122,33 @@ export class ServicesImpl implements Services {
109
122
  [Symbol.asyncIterator]() {
110
123
  return this;
111
124
  },
112
- byPage: () => {
113
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
125
+ byPage: (settings?: PageSettings) => {
126
+ if (settings?.maxPageSize) {
127
+ throw new Error("maxPageSize is not supported by this operation.");
128
+ }
129
+ return this.listByResourceGroupPagingPage(
130
+ resourceGroupName,
131
+ options,
132
+ settings
133
+ );
114
134
  }
115
135
  };
116
136
  }
117
137
 
118
138
  private async *listByResourceGroupPagingPage(
119
139
  resourceGroupName: string,
120
- options?: ServicesListByResourceGroupOptionalParams
140
+ options?: ServicesListByResourceGroupOptionalParams,
141
+ settings?: PageSettings
121
142
  ): AsyncIterableIterator<ServicesDescription[]> {
122
- let result = await this._listByResourceGroup(resourceGroupName, options);
123
- yield result.value || [];
124
- let continuationToken = result.nextLink;
143
+ let result: ServicesListByResourceGroupResponse;
144
+ let continuationToken = settings?.continuationToken;
145
+ if (!continuationToken) {
146
+ result = await this._listByResourceGroup(resourceGroupName, options);
147
+ let page = result.value || [];
148
+ continuationToken = result.nextLink;
149
+ setContinuationToken(page, continuationToken);
150
+ yield page;
151
+ }
125
152
  while (continuationToken) {
126
153
  result = await this._listByResourceGroupNext(
127
154
  resourceGroupName,
@@ -129,7 +156,9 @@ export class ServicesImpl implements Services {
129
156
  options
130
157
  );
131
158
  continuationToken = result.nextLink;
132
- yield result.value || [];
159
+ let page = result.value || [];
160
+ setContinuationToken(page, continuationToken);
161
+ yield page;
133
162
  }
134
163
  }
135
164
 
@@ -6,7 +6,7 @@
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
10
  import { WorkspacePrivateEndpointConnections } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
@@ -62,11 +62,15 @@ export class WorkspacePrivateEndpointConnectionsImpl
62
62
  [Symbol.asyncIterator]() {
63
63
  return this;
64
64
  },
65
- byPage: () => {
65
+ byPage: (settings?: PageSettings) => {
66
+ if (settings?.maxPageSize) {
67
+ throw new Error("maxPageSize is not supported by this operation.");
68
+ }
66
69
  return this.listByWorkspacePagingPage(
67
70
  resourceGroupName,
68
71
  workspaceName,
69
- options
72
+ options,
73
+ settings
70
74
  );
71
75
  }
72
76
  };
@@ -75,9 +79,11 @@ export class WorkspacePrivateEndpointConnectionsImpl
75
79
  private async *listByWorkspacePagingPage(
76
80
  resourceGroupName: string,
77
81
  workspaceName: string,
78
- options?: WorkspacePrivateEndpointConnectionsListByWorkspaceOptionalParams
82
+ options?: WorkspacePrivateEndpointConnectionsListByWorkspaceOptionalParams,
83
+ _settings?: PageSettings
79
84
  ): AsyncIterableIterator<PrivateEndpointConnectionDescription[]> {
80
- let result = await this._listByWorkspace(
85
+ let result: WorkspacePrivateEndpointConnectionsListByWorkspaceResponse;
86
+ result = await this._listByWorkspace(
81
87
  resourceGroupName,
82
88
  workspaceName,
83
89
  options
@@ -6,7 +6,7 @@
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
10
  import { WorkspacePrivateLinkResources } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
@@ -57,11 +57,15 @@ export class WorkspacePrivateLinkResourcesImpl
57
57
  [Symbol.asyncIterator]() {
58
58
  return this;
59
59
  },
60
- byPage: () => {
60
+ byPage: (settings?: PageSettings) => {
61
+ if (settings?.maxPageSize) {
62
+ throw new Error("maxPageSize is not supported by this operation.");
63
+ }
61
64
  return this.listByWorkspacePagingPage(
62
65
  resourceGroupName,
63
66
  workspaceName,
64
- options
67
+ options,
68
+ settings
65
69
  );
66
70
  }
67
71
  };
@@ -70,9 +74,11 @@ export class WorkspacePrivateLinkResourcesImpl
70
74
  private async *listByWorkspacePagingPage(
71
75
  resourceGroupName: string,
72
76
  workspaceName: string,
73
- options?: WorkspacePrivateLinkResourcesListByWorkspaceOptionalParams
77
+ options?: WorkspacePrivateLinkResourcesListByWorkspaceOptionalParams,
78
+ _settings?: PageSettings
74
79
  ): AsyncIterableIterator<PrivateLinkResourceDescription[]> {
75
- let result = await this._listByWorkspace(
80
+ let result: WorkspacePrivateLinkResourcesListByWorkspaceResponse;
81
+ result = await this._listByWorkspace(
76
82
  resourceGroupName,
77
83
  workspaceName,
78
84
  options
@@ -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 { Workspaces } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,9 +19,9 @@ import {
18
19
  Workspace,
19
20
  WorkspacesListBySubscriptionNextOptionalParams,
20
21
  WorkspacesListBySubscriptionOptionalParams,
22
+ WorkspacesListBySubscriptionResponse,
21
23
  WorkspacesListByResourceGroupNextOptionalParams,
22
24
  WorkspacesListByResourceGroupOptionalParams,
23
- WorkspacesListBySubscriptionResponse,
24
25
  WorkspacesListByResourceGroupResponse,
25
26
  WorkspacesGetOptionalParams,
26
27
  WorkspacesGetResponse,
@@ -62,22 +63,34 @@ export class WorkspacesImpl implements Workspaces {
62
63
  [Symbol.asyncIterator]() {
63
64
  return this;
64
65
  },
65
- byPage: () => {
66
- return this.listBySubscriptionPagingPage(options);
66
+ byPage: (settings?: PageSettings) => {
67
+ if (settings?.maxPageSize) {
68
+ throw new Error("maxPageSize is not supported by this operation.");
69
+ }
70
+ return this.listBySubscriptionPagingPage(options, settings);
67
71
  }
68
72
  };
69
73
  }
70
74
 
71
75
  private async *listBySubscriptionPagingPage(
72
- options?: WorkspacesListBySubscriptionOptionalParams
76
+ options?: WorkspacesListBySubscriptionOptionalParams,
77
+ settings?: PageSettings
73
78
  ): AsyncIterableIterator<Workspace[]> {
74
- let result = await this._listBySubscription(options);
75
- yield result.value || [];
76
- let continuationToken = result.nextLink;
79
+ let result: WorkspacesListBySubscriptionResponse;
80
+ let continuationToken = settings?.continuationToken;
81
+ if (!continuationToken) {
82
+ result = await this._listBySubscription(options);
83
+ let page = result.value || [];
84
+ continuationToken = result.nextLink;
85
+ setContinuationToken(page, continuationToken);
86
+ yield page;
87
+ }
77
88
  while (continuationToken) {
78
89
  result = await this._listBySubscriptionNext(continuationToken, options);
79
90
  continuationToken = result.nextLink;
80
- yield result.value || [];
91
+ let page = result.value || [];
92
+ setContinuationToken(page, continuationToken);
93
+ yield page;
81
94
  }
82
95
  }
83
96
 
@@ -106,19 +119,33 @@ export class WorkspacesImpl implements Workspaces {
106
119
  [Symbol.asyncIterator]() {
107
120
  return this;
108
121
  },
109
- byPage: () => {
110
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
122
+ byPage: (settings?: PageSettings) => {
123
+ if (settings?.maxPageSize) {
124
+ throw new Error("maxPageSize is not supported by this operation.");
125
+ }
126
+ return this.listByResourceGroupPagingPage(
127
+ resourceGroupName,
128
+ options,
129
+ settings
130
+ );
111
131
  }
112
132
  };
113
133
  }
114
134
 
115
135
  private async *listByResourceGroupPagingPage(
116
136
  resourceGroupName: string,
117
- options?: WorkspacesListByResourceGroupOptionalParams
137
+ options?: WorkspacesListByResourceGroupOptionalParams,
138
+ settings?: PageSettings
118
139
  ): AsyncIterableIterator<Workspace[]> {
119
- let result = await this._listByResourceGroup(resourceGroupName, options);
120
- yield result.value || [];
121
- let continuationToken = result.nextLink;
140
+ let result: WorkspacesListByResourceGroupResponse;
141
+ let continuationToken = settings?.continuationToken;
142
+ if (!continuationToken) {
143
+ result = await this._listByResourceGroup(resourceGroupName, options);
144
+ let page = result.value || [];
145
+ continuationToken = result.nextLink;
146
+ setContinuationToken(page, continuationToken);
147
+ yield page;
148
+ }
122
149
  while (continuationToken) {
123
150
  result = await this._listByResourceGroupNext(
124
151
  resourceGroupName,
@@ -126,7 +153,9 @@ export class WorkspacesImpl implements Workspaces {
126
153
  options
127
154
  );
128
155
  continuationToken = result.nextLink;
129
- yield result.value || [];
156
+ let page = result.value || [];
157
+ setContinuationToken(page, continuationToken);
158
+ yield page;
130
159
  }
131
160
  }
132
161
 
@@ -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
+ }