@azure/arm-securitydevops 1.0.0-alpha.20230201.1 → 1.0.0-beta.2

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 (136) hide show
  1. package/CHANGELOG.md +7 -7
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/dist/index.js +252 -102
  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/azureDevOpsConnectorCreateOrUpdateSample.js +11 -3
  9. package/dist-esm/samples-dev/azureDevOpsConnectorCreateOrUpdateSample.js.map +1 -1
  10. package/dist-esm/samples-dev/azureDevOpsConnectorDeleteSample.js +11 -3
  11. package/dist-esm/samples-dev/azureDevOpsConnectorDeleteSample.js.map +1 -1
  12. package/dist-esm/samples-dev/azureDevOpsConnectorGetSample.js +11 -3
  13. package/dist-esm/samples-dev/azureDevOpsConnectorGetSample.js.map +1 -1
  14. package/dist-esm/samples-dev/azureDevOpsConnectorListByResourceGroupSample.js +11 -3
  15. package/dist-esm/samples-dev/azureDevOpsConnectorListByResourceGroupSample.js.map +1 -1
  16. package/dist-esm/samples-dev/azureDevOpsConnectorListBySubscriptionSample.js +10 -2
  17. package/dist-esm/samples-dev/azureDevOpsConnectorListBySubscriptionSample.js.map +1 -1
  18. package/dist-esm/samples-dev/azureDevOpsConnectorStatsGetSample.js +11 -3
  19. package/dist-esm/samples-dev/azureDevOpsConnectorStatsGetSample.js.map +1 -1
  20. package/dist-esm/samples-dev/azureDevOpsConnectorUpdateSample.js +11 -3
  21. package/dist-esm/samples-dev/azureDevOpsConnectorUpdateSample.js.map +1 -1
  22. package/dist-esm/samples-dev/azureDevOpsOrgCreateOrUpdateSample.js +11 -3
  23. package/dist-esm/samples-dev/azureDevOpsOrgCreateOrUpdateSample.js.map +1 -1
  24. package/dist-esm/samples-dev/azureDevOpsOrgGetSample.js +11 -3
  25. package/dist-esm/samples-dev/azureDevOpsOrgGetSample.js.map +1 -1
  26. package/dist-esm/samples-dev/azureDevOpsOrgListSample.js +11 -3
  27. package/dist-esm/samples-dev/azureDevOpsOrgListSample.js.map +1 -1
  28. package/dist-esm/samples-dev/azureDevOpsOrgUpdateSample.js +11 -3
  29. package/dist-esm/samples-dev/azureDevOpsOrgUpdateSample.js.map +1 -1
  30. package/dist-esm/samples-dev/azureDevOpsProjectCreateOrUpdateSample.js +11 -3
  31. package/dist-esm/samples-dev/azureDevOpsProjectCreateOrUpdateSample.js.map +1 -1
  32. package/dist-esm/samples-dev/azureDevOpsProjectGetSample.js +11 -3
  33. package/dist-esm/samples-dev/azureDevOpsProjectGetSample.js.map +1 -1
  34. package/dist-esm/samples-dev/azureDevOpsProjectListSample.js +11 -3
  35. package/dist-esm/samples-dev/azureDevOpsProjectListSample.js.map +1 -1
  36. package/dist-esm/samples-dev/azureDevOpsProjectUpdateSample.js +11 -3
  37. package/dist-esm/samples-dev/azureDevOpsProjectUpdateSample.js.map +1 -1
  38. package/dist-esm/samples-dev/azureDevOpsRepoCreateOrUpdateSample.js +11 -3
  39. package/dist-esm/samples-dev/azureDevOpsRepoCreateOrUpdateSample.js.map +1 -1
  40. package/dist-esm/samples-dev/azureDevOpsRepoGetSample.js +11 -3
  41. package/dist-esm/samples-dev/azureDevOpsRepoGetSample.js.map +1 -1
  42. package/dist-esm/samples-dev/azureDevOpsRepoListByConnectorSample.js +11 -3
  43. package/dist-esm/samples-dev/azureDevOpsRepoListByConnectorSample.js.map +1 -1
  44. package/dist-esm/samples-dev/azureDevOpsRepoListSample.js +11 -3
  45. package/dist-esm/samples-dev/azureDevOpsRepoListSample.js.map +1 -1
  46. package/dist-esm/samples-dev/azureDevOpsRepoUpdateSample.js +11 -3
  47. package/dist-esm/samples-dev/azureDevOpsRepoUpdateSample.js.map +1 -1
  48. package/dist-esm/samples-dev/gitHubConnectorCreateOrUpdateSample.js +11 -3
  49. package/dist-esm/samples-dev/gitHubConnectorCreateOrUpdateSample.js.map +1 -1
  50. package/dist-esm/samples-dev/gitHubConnectorDeleteSample.js +11 -3
  51. package/dist-esm/samples-dev/gitHubConnectorDeleteSample.js.map +1 -1
  52. package/dist-esm/samples-dev/gitHubConnectorGetSample.js +11 -3
  53. package/dist-esm/samples-dev/gitHubConnectorGetSample.js.map +1 -1
  54. package/dist-esm/samples-dev/gitHubConnectorListByResourceGroupSample.js +11 -3
  55. package/dist-esm/samples-dev/gitHubConnectorListByResourceGroupSample.js.map +1 -1
  56. package/dist-esm/samples-dev/gitHubConnectorListBySubscriptionSample.js +10 -2
  57. package/dist-esm/samples-dev/gitHubConnectorListBySubscriptionSample.js.map +1 -1
  58. package/dist-esm/samples-dev/gitHubConnectorStatsGetSample.js +11 -3
  59. package/dist-esm/samples-dev/gitHubConnectorStatsGetSample.js.map +1 -1
  60. package/dist-esm/samples-dev/gitHubConnectorUpdateSample.js +11 -3
  61. package/dist-esm/samples-dev/gitHubConnectorUpdateSample.js.map +1 -1
  62. package/dist-esm/samples-dev/gitHubOwnerCreateOrUpdateSample.js +11 -3
  63. package/dist-esm/samples-dev/gitHubOwnerCreateOrUpdateSample.js.map +1 -1
  64. package/dist-esm/samples-dev/gitHubOwnerGetSample.js +11 -3
  65. package/dist-esm/samples-dev/gitHubOwnerGetSample.js.map +1 -1
  66. package/dist-esm/samples-dev/gitHubOwnerListSample.js +11 -3
  67. package/dist-esm/samples-dev/gitHubOwnerListSample.js.map +1 -1
  68. package/dist-esm/samples-dev/gitHubOwnerUpdateSample.js +11 -3
  69. package/dist-esm/samples-dev/gitHubOwnerUpdateSample.js.map +1 -1
  70. package/dist-esm/samples-dev/gitHubRepoCreateOrUpdateSample.js +11 -3
  71. package/dist-esm/samples-dev/gitHubRepoCreateOrUpdateSample.js.map +1 -1
  72. package/dist-esm/samples-dev/gitHubRepoGetSample.js +11 -3
  73. package/dist-esm/samples-dev/gitHubRepoGetSample.js.map +1 -1
  74. package/dist-esm/samples-dev/gitHubRepoListByConnectorSample.js +11 -3
  75. package/dist-esm/samples-dev/gitHubRepoListByConnectorSample.js.map +1 -1
  76. package/dist-esm/samples-dev/gitHubRepoListSample.js +11 -3
  77. package/dist-esm/samples-dev/gitHubRepoListSample.js.map +1 -1
  78. package/dist-esm/samples-dev/gitHubRepoUpdateSample.js +11 -3
  79. package/dist-esm/samples-dev/gitHubRepoUpdateSample.js.map +1 -1
  80. package/dist-esm/samples-dev/operationsListSample.js +10 -2
  81. package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
  82. package/dist-esm/src/index.d.ts +1 -0
  83. package/dist-esm/src/index.d.ts.map +1 -1
  84. package/dist-esm/src/index.js +1 -0
  85. package/dist-esm/src/index.js.map +1 -1
  86. package/dist-esm/src/microsoftSecurityDevOps.d.ts.map +1 -1
  87. package/dist-esm/src/microsoftSecurityDevOps.js +3 -6
  88. package/dist-esm/src/microsoftSecurityDevOps.js.map +1 -1
  89. package/dist-esm/src/operations/azureDevOpsConnectorOperations.d.ts.map +1 -1
  90. package/dist-esm/src/operations/azureDevOpsConnectorOperations.js +37 -16
  91. package/dist-esm/src/operations/azureDevOpsConnectorOperations.js.map +1 -1
  92. package/dist-esm/src/operations/azureDevOpsOrgOperations.d.ts.map +1 -1
  93. package/dist-esm/src/operations/azureDevOpsOrgOperations.js +19 -8
  94. package/dist-esm/src/operations/azureDevOpsOrgOperations.js.map +1 -1
  95. package/dist-esm/src/operations/azureDevOpsProjectOperations.d.ts.map +1 -1
  96. package/dist-esm/src/operations/azureDevOpsProjectOperations.js +19 -8
  97. package/dist-esm/src/operations/azureDevOpsProjectOperations.js.map +1 -1
  98. package/dist-esm/src/operations/azureDevOpsRepoOperations.d.ts.map +1 -1
  99. package/dist-esm/src/operations/azureDevOpsRepoOperations.js +37 -16
  100. package/dist-esm/src/operations/azureDevOpsRepoOperations.js.map +1 -1
  101. package/dist-esm/src/operations/gitHubConnectorOperations.d.ts.map +1 -1
  102. package/dist-esm/src/operations/gitHubConnectorOperations.js +37 -16
  103. package/dist-esm/src/operations/gitHubConnectorOperations.js.map +1 -1
  104. package/dist-esm/src/operations/gitHubOwnerOperations.d.ts.map +1 -1
  105. package/dist-esm/src/operations/gitHubOwnerOperations.js +19 -8
  106. package/dist-esm/src/operations/gitHubOwnerOperations.js.map +1 -1
  107. package/dist-esm/src/operations/gitHubRepoOperations.d.ts.map +1 -1
  108. package/dist-esm/src/operations/gitHubRepoOperations.js +37 -16
  109. package/dist-esm/src/operations/gitHubRepoOperations.js.map +1 -1
  110. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  111. package/dist-esm/src/operations/operations.js +19 -8
  112. package/dist-esm/src/operations/operations.js.map +1 -1
  113. package/dist-esm/src/pagingHelper.d.ts +13 -0
  114. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  115. package/dist-esm/src/pagingHelper.js +32 -0
  116. package/dist-esm/src/pagingHelper.js.map +1 -0
  117. package/dist-esm/test/securitydevops_examples.spec.js +3 -51
  118. package/dist-esm/test/securitydevops_examples.spec.js.map +1 -1
  119. package/package.json +8 -6
  120. package/review/arm-securitydevops.api.md +3 -0
  121. package/src/index.ts +1 -0
  122. package/src/microsoftSecurityDevOps.ts +4 -5
  123. package/src/operations/azureDevOpsConnectorOperations.ts +46 -19
  124. package/src/operations/azureDevOpsOrgOperations.ts +26 -13
  125. package/src/operations/azureDevOpsProjectOperations.ts +27 -14
  126. package/src/operations/azureDevOpsRepoOperations.ts +53 -28
  127. package/src/operations/gitHubConnectorOperations.ts +46 -19
  128. package/src/operations/gitHubOwnerOperations.ts +26 -13
  129. package/src/operations/gitHubRepoOperations.ts +52 -27
  130. package/src/operations/operations.ts +21 -9
  131. package/src/pagingHelper.ts +39 -0
  132. package/types/arm-securitydevops.d.ts +9 -0
  133. package/dist-esm/test/sampleTest.d.ts +0 -2
  134. package/dist-esm/test/sampleTest.d.ts.map +0 -1
  135. package/dist-esm/test/sampleTest.js +0 -38
  136. package/dist-esm/test/sampleTest.js.map +0 -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 { AzureDevOpsRepoOperations } 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
  AzureDevOpsRepo,
19
20
  AzureDevOpsRepoListByConnectorNextOptionalParams,
20
21
  AzureDevOpsRepoListByConnectorOptionalParams,
22
+ AzureDevOpsRepoListByConnectorResponse,
21
23
  AzureDevOpsRepoListNextOptionalParams,
22
24
  AzureDevOpsRepoListOptionalParams,
23
- AzureDevOpsRepoListByConnectorResponse,
24
25
  AzureDevOpsRepoListOperationResponse,
25
26
  AzureDevOpsRepoGetOptionalParams,
26
27
  AzureDevOpsRepoGetResponse,
@@ -68,11 +69,15 @@ export class AzureDevOpsRepoOperationsImpl
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.listByConnectorPagingPage(
73
77
  resourceGroupName,
74
78
  azureDevOpsConnectorName,
75
- options
79
+ options,
80
+ settings
76
81
  );
77
82
  }
78
83
  };
@@ -81,15 +86,22 @@ export class AzureDevOpsRepoOperationsImpl
81
86
  private async *listByConnectorPagingPage(
82
87
  resourceGroupName: string,
83
88
  azureDevOpsConnectorName: string,
84
- options?: AzureDevOpsRepoListByConnectorOptionalParams
89
+ options?: AzureDevOpsRepoListByConnectorOptionalParams,
90
+ settings?: PageSettings
85
91
  ): AsyncIterableIterator<AzureDevOpsRepo[]> {
86
- let result = await this._listByConnector(
87
- resourceGroupName,
88
- azureDevOpsConnectorName,
89
- options
90
- );
91
- yield result.value || [];
92
- let continuationToken = result.nextLink;
92
+ let result: AzureDevOpsRepoListByConnectorResponse;
93
+ let continuationToken = settings?.continuationToken;
94
+ if (!continuationToken) {
95
+ result = await this._listByConnector(
96
+ resourceGroupName,
97
+ azureDevOpsConnectorName,
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._listByConnectorNext(
95
107
  resourceGroupName,
@@ -98,7 +110,9 @@ export class AzureDevOpsRepoOperationsImpl
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
 
@@ -144,13 +158,17 @@ export class AzureDevOpsRepoOperationsImpl
144
158
  [Symbol.asyncIterator]() {
145
159
  return this;
146
160
  },
147
- byPage: () => {
161
+ byPage: (settings?: PageSettings) => {
162
+ if (settings?.maxPageSize) {
163
+ throw new Error("maxPageSize is not supported by this operation.");
164
+ }
148
165
  return this.listPagingPage(
149
166
  resourceGroupName,
150
167
  azureDevOpsConnectorName,
151
168
  azureDevOpsOrgName,
152
169
  azureDevOpsProjectName,
153
- options
170
+ options,
171
+ settings
154
172
  );
155
173
  }
156
174
  };
@@ -161,17 +179,24 @@ export class AzureDevOpsRepoOperationsImpl
161
179
  azureDevOpsConnectorName: string,
162
180
  azureDevOpsOrgName: string,
163
181
  azureDevOpsProjectName: string,
164
- options?: AzureDevOpsRepoListOptionalParams
182
+ options?: AzureDevOpsRepoListOptionalParams,
183
+ settings?: PageSettings
165
184
  ): AsyncIterableIterator<AzureDevOpsRepo[]> {
166
- let result = await this._list(
167
- resourceGroupName,
168
- azureDevOpsConnectorName,
169
- azureDevOpsOrgName,
170
- azureDevOpsProjectName,
171
- options
172
- );
173
- yield result.value || [];
174
- let continuationToken = result.nextLink;
185
+ let result: AzureDevOpsRepoListOperationResponse;
186
+ let continuationToken = settings?.continuationToken;
187
+ if (!continuationToken) {
188
+ result = await this._list(
189
+ resourceGroupName,
190
+ azureDevOpsConnectorName,
191
+ azureDevOpsOrgName,
192
+ azureDevOpsProjectName,
193
+ options
194
+ );
195
+ let page = result.value || [];
196
+ continuationToken = result.nextLink;
197
+ setContinuationToken(page, continuationToken);
198
+ yield page;
199
+ }
175
200
  while (continuationToken) {
176
201
  result = await this._listNext(
177
202
  resourceGroupName,
@@ -182,7 +207,9 @@ export class AzureDevOpsRepoOperationsImpl
182
207
  options
183
208
  );
184
209
  continuationToken = result.nextLink;
185
- yield result.value || [];
210
+ let page = result.value || [];
211
+ setContinuationToken(page, continuationToken);
212
+ yield page;
186
213
  }
187
214
  }
188
215
 
@@ -707,7 +734,6 @@ const listByConnectorNextOperationSpec: coreClient.OperationSpec = {
707
734
  bodyMapper: Mappers.ErrorResponse
708
735
  }
709
736
  },
710
- queryParameters: [Parameters.apiVersion],
711
737
  urlParameters: [
712
738
  Parameters.$host,
713
739
  Parameters.subscriptionId,
@@ -729,7 +755,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
729
755
  bodyMapper: Mappers.ErrorResponse
730
756
  }
731
757
  },
732
- queryParameters: [Parameters.apiVersion],
733
758
  urlParameters: [
734
759
  Parameters.$host,
735
760
  Parameters.subscriptionId,
@@ -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 { GitHubConnectorOperations } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,9 +19,10 @@ import {
18
19
  GitHubConnector,
19
20
  GitHubConnectorListByResourceGroupNextOptionalParams,
20
21
  GitHubConnectorListByResourceGroupOptionalParams,
22
+ GitHubConnectorListByResourceGroupResponse,
21
23
  GitHubConnectorListBySubscriptionNextOptionalParams,
22
24
  GitHubConnectorListBySubscriptionOptionalParams,
23
- GitHubConnectorListByResourceGroupResponse,
25
+ GitHubConnectorListBySubscriptionResponse,
24
26
  GitHubConnectorGetOptionalParams,
25
27
  GitHubConnectorGetResponse,
26
28
  GitHubConnectorCreateOrUpdateOptionalParams,
@@ -28,7 +30,6 @@ import {
28
30
  GitHubConnectorUpdateOptionalParams,
29
31
  GitHubConnectorUpdateResponse,
30
32
  GitHubConnectorDeleteOptionalParams,
31
- GitHubConnectorListBySubscriptionResponse,
32
33
  GitHubConnectorListByResourceGroupNextResponse,
33
34
  GitHubConnectorListBySubscriptionNextResponse
34
35
  } from "../models";
@@ -63,19 +64,33 @@ export class GitHubConnectorOperationsImpl
63
64
  [Symbol.asyncIterator]() {
64
65
  return this;
65
66
  },
66
- byPage: () => {
67
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
67
+ byPage: (settings?: PageSettings) => {
68
+ if (settings?.maxPageSize) {
69
+ throw new Error("maxPageSize is not supported by this operation.");
70
+ }
71
+ return this.listByResourceGroupPagingPage(
72
+ resourceGroupName,
73
+ options,
74
+ settings
75
+ );
68
76
  }
69
77
  };
70
78
  }
71
79
 
72
80
  private async *listByResourceGroupPagingPage(
73
81
  resourceGroupName: string,
74
- options?: GitHubConnectorListByResourceGroupOptionalParams
82
+ options?: GitHubConnectorListByResourceGroupOptionalParams,
83
+ settings?: PageSettings
75
84
  ): AsyncIterableIterator<GitHubConnector[]> {
76
- let result = await this._listByResourceGroup(resourceGroupName, options);
77
- yield result.value || [];
78
- let continuationToken = result.nextLink;
85
+ let result: GitHubConnectorListByResourceGroupResponse;
86
+ let continuationToken = settings?.continuationToken;
87
+ if (!continuationToken) {
88
+ result = await this._listByResourceGroup(resourceGroupName, options);
89
+ let page = result.value || [];
90
+ continuationToken = result.nextLink;
91
+ setContinuationToken(page, continuationToken);
92
+ yield page;
93
+ }
79
94
  while (continuationToken) {
80
95
  result = await this._listByResourceGroupNext(
81
96
  resourceGroupName,
@@ -83,7 +98,9 @@ export class GitHubConnectorOperationsImpl
83
98
  options
84
99
  );
85
100
  continuationToken = result.nextLink;
86
- yield result.value || [];
101
+ let page = result.value || [];
102
+ setContinuationToken(page, continuationToken);
103
+ yield page;
87
104
  }
88
105
  }
89
106
 
@@ -114,22 +131,34 @@ export class GitHubConnectorOperationsImpl
114
131
  [Symbol.asyncIterator]() {
115
132
  return this;
116
133
  },
117
- byPage: () => {
118
- return this.listBySubscriptionPagingPage(options);
134
+ byPage: (settings?: PageSettings) => {
135
+ if (settings?.maxPageSize) {
136
+ throw new Error("maxPageSize is not supported by this operation.");
137
+ }
138
+ return this.listBySubscriptionPagingPage(options, settings);
119
139
  }
120
140
  };
121
141
  }
122
142
 
123
143
  private async *listBySubscriptionPagingPage(
124
- options?: GitHubConnectorListBySubscriptionOptionalParams
144
+ options?: GitHubConnectorListBySubscriptionOptionalParams,
145
+ settings?: PageSettings
125
146
  ): AsyncIterableIterator<GitHubConnector[]> {
126
- let result = await this._listBySubscription(options);
127
- yield result.value || [];
128
- let continuationToken = result.nextLink;
147
+ let result: GitHubConnectorListBySubscriptionResponse;
148
+ let continuationToken = settings?.continuationToken;
149
+ if (!continuationToken) {
150
+ result = await this._listBySubscription(options);
151
+ let page = result.value || [];
152
+ continuationToken = result.nextLink;
153
+ setContinuationToken(page, continuationToken);
154
+ yield page;
155
+ }
129
156
  while (continuationToken) {
130
157
  result = await this._listBySubscriptionNext(continuationToken, options);
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
 
@@ -642,7 +671,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
642
671
  bodyMapper: Mappers.ErrorResponse
643
672
  }
644
673
  },
645
- queryParameters: [Parameters.apiVersion],
646
674
  urlParameters: [
647
675
  Parameters.$host,
648
676
  Parameters.subscriptionId,
@@ -663,7 +691,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
663
691
  bodyMapper: Mappers.ErrorResponse
664
692
  }
665
693
  },
666
- queryParameters: [Parameters.apiVersion],
667
694
  urlParameters: [
668
695
  Parameters.$host,
669
696
  Parameters.subscriptionId,
@@ -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 { GitHubOwnerOperations } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -64,11 +65,15 @@ export class GitHubOwnerOperationsImpl implements GitHubOwnerOperations {
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
  resourceGroupName,
70
74
  gitHubConnectorName,
71
- options
75
+ options,
76
+ settings
72
77
  );
73
78
  }
74
79
  };
@@ -77,15 +82,22 @@ export class GitHubOwnerOperationsImpl implements GitHubOwnerOperations {
77
82
  private async *listPagingPage(
78
83
  resourceGroupName: string,
79
84
  gitHubConnectorName: string,
80
- options?: GitHubOwnerListOptionalParams
85
+ options?: GitHubOwnerListOptionalParams,
86
+ settings?: PageSettings
81
87
  ): AsyncIterableIterator<GitHubOwner[]> {
82
- let result = await this._list(
83
- resourceGroupName,
84
- gitHubConnectorName,
85
- options
86
- );
87
- yield result.value || [];
88
- let continuationToken = result.nextLink;
88
+ let result: GitHubOwnerListOperationResponse;
89
+ let continuationToken = settings?.continuationToken;
90
+ if (!continuationToken) {
91
+ result = await this._list(
92
+ resourceGroupName,
93
+ gitHubConnectorName,
94
+ options
95
+ );
96
+ let page = result.value || [];
97
+ continuationToken = result.nextLink;
98
+ setContinuationToken(page, continuationToken);
99
+ yield page;
100
+ }
89
101
  while (continuationToken) {
90
102
  result = await this._listNext(
91
103
  resourceGroupName,
@@ -94,7 +106,9 @@ export class GitHubOwnerOperationsImpl implements GitHubOwnerOperations {
94
106
  options
95
107
  );
96
108
  continuationToken = result.nextLink;
97
- yield result.value || [];
109
+ let page = result.value || [];
110
+ setContinuationToken(page, continuationToken);
111
+ yield page;
98
112
  }
99
113
  }
100
114
 
@@ -490,7 +504,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
490
504
  bodyMapper: Mappers.ErrorResponse
491
505
  }
492
506
  },
493
- queryParameters: [Parameters.apiVersion],
494
507
  urlParameters: [
495
508
  Parameters.$host,
496
509
  Parameters.subscriptionId,
@@ -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 { GitHubRepoOperations } 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
  GitHubRepo,
19
20
  GitHubRepoListByConnectorNextOptionalParams,
20
21
  GitHubRepoListByConnectorOptionalParams,
22
+ GitHubRepoListByConnectorResponse,
21
23
  GitHubRepoListNextOptionalParams,
22
24
  GitHubRepoListOptionalParams,
23
- GitHubRepoListByConnectorResponse,
24
25
  GitHubRepoListOperationResponse,
25
26
  GitHubRepoGetOptionalParams,
26
27
  GitHubRepoGetResponse,
@@ -68,11 +69,15 @@ export class GitHubRepoOperationsImpl implements GitHubRepoOperations {
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.listByConnectorPagingPage(
73
77
  resourceGroupName,
74
78
  gitHubConnectorName,
75
- options
79
+ options,
80
+ settings
76
81
  );
77
82
  }
78
83
  };
@@ -81,15 +86,22 @@ export class GitHubRepoOperationsImpl implements GitHubRepoOperations {
81
86
  private async *listByConnectorPagingPage(
82
87
  resourceGroupName: string,
83
88
  gitHubConnectorName: string,
84
- options?: GitHubRepoListByConnectorOptionalParams
89
+ options?: GitHubRepoListByConnectorOptionalParams,
90
+ settings?: PageSettings
85
91
  ): AsyncIterableIterator<GitHubRepo[]> {
86
- let result = await this._listByConnector(
87
- resourceGroupName,
88
- gitHubConnectorName,
89
- options
90
- );
91
- yield result.value || [];
92
- let continuationToken = result.nextLink;
92
+ let result: GitHubRepoListByConnectorResponse;
93
+ let continuationToken = settings?.continuationToken;
94
+ if (!continuationToken) {
95
+ result = await this._listByConnector(
96
+ resourceGroupName,
97
+ gitHubConnectorName,
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._listByConnectorNext(
95
107
  resourceGroupName,
@@ -98,7 +110,9 @@ export class GitHubRepoOperationsImpl implements GitHubRepoOperations {
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
 
@@ -142,12 +156,16 @@ export class GitHubRepoOperationsImpl implements GitHubRepoOperations {
142
156
  [Symbol.asyncIterator]() {
143
157
  return this;
144
158
  },
145
- byPage: () => {
159
+ byPage: (settings?: PageSettings) => {
160
+ if (settings?.maxPageSize) {
161
+ throw new Error("maxPageSize is not supported by this operation.");
162
+ }
146
163
  return this.listPagingPage(
147
164
  resourceGroupName,
148
165
  gitHubConnectorName,
149
166
  gitHubOwnerName,
150
- options
167
+ options,
168
+ settings
151
169
  );
152
170
  }
153
171
  };
@@ -157,16 +175,23 @@ export class GitHubRepoOperationsImpl implements GitHubRepoOperations {
157
175
  resourceGroupName: string,
158
176
  gitHubConnectorName: string,
159
177
  gitHubOwnerName: string,
160
- options?: GitHubRepoListOptionalParams
178
+ options?: GitHubRepoListOptionalParams,
179
+ settings?: PageSettings
161
180
  ): AsyncIterableIterator<GitHubRepo[]> {
162
- let result = await this._list(
163
- resourceGroupName,
164
- gitHubConnectorName,
165
- gitHubOwnerName,
166
- options
167
- );
168
- yield result.value || [];
169
- let continuationToken = result.nextLink;
181
+ let result: GitHubRepoListOperationResponse;
182
+ let continuationToken = settings?.continuationToken;
183
+ if (!continuationToken) {
184
+ result = await this._list(
185
+ resourceGroupName,
186
+ gitHubConnectorName,
187
+ gitHubOwnerName,
188
+ options
189
+ );
190
+ let page = result.value || [];
191
+ continuationToken = result.nextLink;
192
+ setContinuationToken(page, continuationToken);
193
+ yield page;
194
+ }
170
195
  while (continuationToken) {
171
196
  result = await this._listNext(
172
197
  resourceGroupName,
@@ -176,7 +201,9 @@ export class GitHubRepoOperationsImpl implements GitHubRepoOperations {
176
201
  options
177
202
  );
178
203
  continuationToken = result.nextLink;
179
- yield result.value || [];
204
+ let page = result.value || [];
205
+ setContinuationToken(page, continuationToken);
206
+ yield page;
180
207
  }
181
208
  }
182
209
 
@@ -671,7 +698,6 @@ const listByConnectorNextOperationSpec: coreClient.OperationSpec = {
671
698
  bodyMapper: Mappers.ErrorResponse
672
699
  }
673
700
  },
674
- queryParameters: [Parameters.apiVersion],
675
701
  urlParameters: [
676
702
  Parameters.$host,
677
703
  Parameters.subscriptionId,
@@ -693,7 +719,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
693
719
  bodyMapper: Mappers.ErrorResponse
694
720
  }
695
721
  },
696
- queryParameters: [Parameters.apiVersion],
697
722
  urlParameters: [
698
723
  Parameters.$host,
699
724
  Parameters.subscriptionId,
@@ -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
 
@@ -130,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
130
143
  bodyMapper: Mappers.ErrorResponse
131
144
  }
132
145
  },
133
- queryParameters: [Parameters.apiVersion],
134
146
  urlParameters: [Parameters.$host, Parameters.nextLink],
135
147
  headerParameters: [Parameters.accept],
136
148
  serializer
@@ -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
+ }
@@ -714,6 +714,15 @@ export declare interface ErrorResponse {
714
714
  error?: ErrorDetail;
715
715
  }
716
716
 
717
+ /**
718
+ * Given the last `.value` produced by the `byPage` iterator,
719
+ * returns a continuation token that can be used to begin paging from
720
+ * that point later.
721
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
722
+ * @returns The continuation token that can be passed into byPage() during future calls.
723
+ */
724
+ export declare function getContinuationToken(page: unknown): string | undefined;
725
+
717
726
  /** Represents an ARM resource for /subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.SecurityDevOps/gitHubConnectors. */
718
727
  export declare interface GitHubConnector extends TrackedResource {
719
728
  /** Properties of the ARM resource for /subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.SecurityDevOps/gitHubConnectors. */
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=sampleTest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sampleTest.d.ts","sourceRoot":"","sources":["../../test/sampleTest.ts"],"names":[],"mappings":""}