@azure/arm-maps 3.1.0-beta.1 → 3.1.0

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 (91) hide show
  1. package/CHANGELOG.md +42 -27
  2. package/LICENSE +1 -1
  3. package/README.md +2 -2
  4. package/dist/index.js +399 -113
  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/accountsCreateOrUpdateSample.js +63 -12
  9. package/dist-esm/samples-dev/accountsCreateOrUpdateSample.js.map +1 -1
  10. package/dist-esm/samples-dev/accountsDeleteSample.js +12 -4
  11. package/dist-esm/samples-dev/accountsDeleteSample.js.map +1 -1
  12. package/dist-esm/samples-dev/accountsGetSample.js +12 -4
  13. package/dist-esm/samples-dev/accountsGetSample.js.map +1 -1
  14. package/dist-esm/samples-dev/accountsListByResourceGroupSample.js +24 -9
  15. package/dist-esm/samples-dev/accountsListByResourceGroupSample.js.map +1 -1
  16. package/dist-esm/samples-dev/accountsListBySubscriptionSample.js +23 -8
  17. package/dist-esm/samples-dev/accountsListBySubscriptionSample.js.map +1 -1
  18. package/dist-esm/samples-dev/accountsListKeysSample.js +12 -4
  19. package/dist-esm/samples-dev/accountsListKeysSample.js.map +1 -1
  20. package/dist-esm/samples-dev/accountsListSasSample.js +12 -4
  21. package/dist-esm/samples-dev/accountsListSasSample.js.map +1 -1
  22. package/dist-esm/samples-dev/accountsRegenerateKeysSample.js +12 -4
  23. package/dist-esm/samples-dev/accountsRegenerateKeysSample.js.map +1 -1
  24. package/dist-esm/samples-dev/accountsUpdateSample.js +63 -16
  25. package/dist-esm/samples-dev/accountsUpdateSample.js.map +1 -1
  26. package/dist-esm/samples-dev/creatorsCreateOrUpdateSample.js +12 -4
  27. package/dist-esm/samples-dev/creatorsCreateOrUpdateSample.js.map +1 -1
  28. package/dist-esm/samples-dev/creatorsDeleteSample.js +12 -4
  29. package/dist-esm/samples-dev/creatorsDeleteSample.js.map +1 -1
  30. package/dist-esm/samples-dev/creatorsGetSample.js +12 -4
  31. package/dist-esm/samples-dev/creatorsGetSample.js.map +1 -1
  32. package/dist-esm/samples-dev/creatorsListByAccountSample.js +24 -9
  33. package/dist-esm/samples-dev/creatorsListByAccountSample.js.map +1 -1
  34. package/dist-esm/samples-dev/creatorsUpdateSample.js +12 -4
  35. package/dist-esm/samples-dev/creatorsUpdateSample.js.map +1 -1
  36. package/dist-esm/samples-dev/mapsListOperationsSample.js +22 -9
  37. package/dist-esm/samples-dev/mapsListOperationsSample.js.map +1 -1
  38. package/dist-esm/samples-dev/mapsListSubscriptionOperationsSample.js +23 -8
  39. package/dist-esm/samples-dev/mapsListSubscriptionOperationsSample.js.map +1 -1
  40. package/dist-esm/src/azureMapsManagementClient.d.ts +4 -1
  41. package/dist-esm/src/azureMapsManagementClient.d.ts.map +1 -1
  42. package/dist-esm/src/azureMapsManagementClient.js +57 -28
  43. package/dist-esm/src/azureMapsManagementClient.js.map +1 -1
  44. package/dist-esm/src/index.d.ts +1 -0
  45. package/dist-esm/src/index.d.ts.map +1 -1
  46. package/dist-esm/src/index.js +1 -0
  47. package/dist-esm/src/index.js.map +1 -1
  48. package/dist-esm/src/models/index.d.ts +161 -56
  49. package/dist-esm/src/models/index.d.ts.map +1 -1
  50. package/dist-esm/src/models/index.js +45 -0
  51. package/dist-esm/src/models/index.js.map +1 -1
  52. package/dist-esm/src/models/mappers.d.ts +4 -1
  53. package/dist-esm/src/models/mappers.d.ts.map +1 -1
  54. package/dist-esm/src/models/mappers.js +109 -17
  55. package/dist-esm/src/models/mappers.js.map +1 -1
  56. package/dist-esm/src/models/parameters.js +1 -1
  57. package/dist-esm/src/models/parameters.js.map +1 -1
  58. package/dist-esm/src/operations/accounts.d.ts.map +1 -1
  59. package/dist-esm/src/operations/accounts.js +61 -26
  60. package/dist-esm/src/operations/accounts.js.map +1 -1
  61. package/dist-esm/src/operations/creators.d.ts.map +1 -1
  62. package/dist-esm/src/operations/creators.js +31 -13
  63. package/dist-esm/src/operations/creators.js.map +1 -1
  64. package/dist-esm/src/operations/maps.d.ts.map +1 -1
  65. package/dist-esm/src/operations/maps.js +61 -26
  66. package/dist-esm/src/operations/maps.js.map +1 -1
  67. package/dist-esm/src/pagingHelper.d.ts +13 -0
  68. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  69. package/dist-esm/src/pagingHelper.js +32 -0
  70. package/dist-esm/src/pagingHelper.js.map +1 -0
  71. package/dist-esm/test/maps_operations_test.spec.d.ts +4 -0
  72. package/dist-esm/test/maps_operations_test.spec.d.ts.map +1 -0
  73. package/dist-esm/test/maps_operations_test.spec.js +140 -0
  74. package/dist-esm/test/maps_operations_test.spec.js.map +1 -0
  75. package/package.json +20 -15
  76. package/review/arm-maps.api.md +78 -35
  77. package/src/azureMapsManagementClient.ts +78 -24
  78. package/src/index.ts +1 -0
  79. package/src/models/index.ts +146 -38
  80. package/src/models/mappers.ts +112 -19
  81. package/src/models/parameters.ts +1 -1
  82. package/src/operations/accounts.ts +46 -19
  83. package/src/operations/creators.ts +26 -13
  84. package/src/operations/maps.ts +41 -18
  85. package/src/pagingHelper.ts +39 -0
  86. package/types/arm-maps.d.ts +169 -44
  87. package/types/tsdoc-metadata.json +1 -1
  88. package/dist-esm/test/sampleTest.d.ts +0 -2
  89. package/dist-esm/test/sampleTest.d.ts.map +0 -1
  90. package/dist-esm/test/sampleTest.js +0 -40
  91. 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 { Accounts } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -16,8 +17,10 @@ import {
16
17
  MapsAccount,
17
18
  AccountsListByResourceGroupNextOptionalParams,
18
19
  AccountsListByResourceGroupOptionalParams,
20
+ AccountsListByResourceGroupResponse,
19
21
  AccountsListBySubscriptionNextOptionalParams,
20
22
  AccountsListBySubscriptionOptionalParams,
23
+ AccountsListBySubscriptionResponse,
21
24
  AccountsCreateOrUpdateOptionalParams,
22
25
  AccountsCreateOrUpdateResponse,
23
26
  MapsAccountUpdateParameters,
@@ -26,8 +29,6 @@ import {
26
29
  AccountsDeleteOptionalParams,
27
30
  AccountsGetOptionalParams,
28
31
  AccountsGetResponse,
29
- AccountsListByResourceGroupResponse,
30
- AccountsListBySubscriptionResponse,
31
32
  AccountSasParameters,
32
33
  AccountsListSasOptionalParams,
33
34
  AccountsListSasResponse,
@@ -70,19 +71,33 @@ export class AccountsImpl implements Accounts {
70
71
  [Symbol.asyncIterator]() {
71
72
  return this;
72
73
  },
73
- byPage: () => {
74
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
74
+ byPage: (settings?: PageSettings) => {
75
+ if (settings?.maxPageSize) {
76
+ throw new Error("maxPageSize is not supported by this operation.");
77
+ }
78
+ return this.listByResourceGroupPagingPage(
79
+ resourceGroupName,
80
+ options,
81
+ settings
82
+ );
75
83
  }
76
84
  };
77
85
  }
78
86
 
79
87
  private async *listByResourceGroupPagingPage(
80
88
  resourceGroupName: string,
81
- options?: AccountsListByResourceGroupOptionalParams
89
+ options?: AccountsListByResourceGroupOptionalParams,
90
+ settings?: PageSettings
82
91
  ): AsyncIterableIterator<MapsAccount[]> {
83
- let result = await this._listByResourceGroup(resourceGroupName, options);
84
- yield result.value || [];
85
- let continuationToken = result.nextLink;
92
+ let result: AccountsListByResourceGroupResponse;
93
+ let continuationToken = settings?.continuationToken;
94
+ if (!continuationToken) {
95
+ result = await this._listByResourceGroup(resourceGroupName, options);
96
+ let page = result.value || [];
97
+ continuationToken = result.nextLink;
98
+ setContinuationToken(page, continuationToken);
99
+ yield page;
100
+ }
86
101
  while (continuationToken) {
87
102
  result = await this._listByResourceGroupNext(
88
103
  resourceGroupName,
@@ -90,7 +105,9 @@ export class AccountsImpl implements Accounts {
90
105
  options
91
106
  );
92
107
  continuationToken = result.nextLink;
93
- yield result.value || [];
108
+ let page = result.value || [];
109
+ setContinuationToken(page, continuationToken);
110
+ yield page;
94
111
  }
95
112
  }
96
113
 
@@ -121,22 +138,34 @@ export class AccountsImpl implements Accounts {
121
138
  [Symbol.asyncIterator]() {
122
139
  return this;
123
140
  },
124
- byPage: () => {
125
- return this.listBySubscriptionPagingPage(options);
141
+ byPage: (settings?: PageSettings) => {
142
+ if (settings?.maxPageSize) {
143
+ throw new Error("maxPageSize is not supported by this operation.");
144
+ }
145
+ return this.listBySubscriptionPagingPage(options, settings);
126
146
  }
127
147
  };
128
148
  }
129
149
 
130
150
  private async *listBySubscriptionPagingPage(
131
- options?: AccountsListBySubscriptionOptionalParams
151
+ options?: AccountsListBySubscriptionOptionalParams,
152
+ settings?: PageSettings
132
153
  ): AsyncIterableIterator<MapsAccount[]> {
133
- let result = await this._listBySubscription(options);
134
- yield result.value || [];
135
- let continuationToken = result.nextLink;
154
+ let result: AccountsListBySubscriptionResponse;
155
+ let continuationToken = settings?.continuationToken;
156
+ if (!continuationToken) {
157
+ result = await this._listBySubscription(options);
158
+ let page = result.value || [];
159
+ continuationToken = result.nextLink;
160
+ setContinuationToken(page, continuationToken);
161
+ yield page;
162
+ }
136
163
  while (continuationToken) {
137
164
  result = await this._listBySubscriptionNext(continuationToken, options);
138
165
  continuationToken = result.nextLink;
139
- yield result.value || [];
166
+ let page = result.value || [];
167
+ setContinuationToken(page, continuationToken);
168
+ yield page;
140
169
  }
141
170
  }
142
171
 
@@ -562,7 +591,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
562
591
  bodyMapper: Mappers.ErrorResponse
563
592
  }
564
593
  },
565
- queryParameters: [Parameters.apiVersion],
566
594
  urlParameters: [
567
595
  Parameters.$host,
568
596
  Parameters.subscriptionId,
@@ -583,7 +611,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
583
611
  bodyMapper: Mappers.ErrorResponse
584
612
  }
585
613
  },
586
- queryParameters: [Parameters.apiVersion],
587
614
  urlParameters: [
588
615
  Parameters.$host,
589
616
  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 { Creators } 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 CreatorsImpl implements Creators {
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.listByAccountPagingPage(
69
73
  resourceGroupName,
70
74
  accountName,
71
- options
75
+ options,
76
+ settings
72
77
  );
73
78
  }
74
79
  };
@@ -77,15 +82,22 @@ export class CreatorsImpl implements Creators {
77
82
  private async *listByAccountPagingPage(
78
83
  resourceGroupName: string,
79
84
  accountName: string,
80
- options?: CreatorsListByAccountOptionalParams
85
+ options?: CreatorsListByAccountOptionalParams,
86
+ settings?: PageSettings
81
87
  ): AsyncIterableIterator<Creator[]> {
82
- let result = await this._listByAccount(
83
- resourceGroupName,
84
- accountName,
85
- options
86
- );
87
- yield result.value || [];
88
- let continuationToken = result.nextLink;
88
+ let result: CreatorsListByAccountResponse;
89
+ let continuationToken = settings?.continuationToken;
90
+ if (!continuationToken) {
91
+ result = await this._listByAccount(
92
+ resourceGroupName,
93
+ accountName,
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._listByAccountNext(
91
103
  resourceGroupName,
@@ -94,7 +106,9 @@ export class CreatorsImpl implements Creators {
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
 
@@ -370,7 +384,6 @@ const listByAccountNextOperationSpec: coreClient.OperationSpec = {
370
384
  bodyMapper: Mappers.ErrorResponse
371
385
  }
372
386
  },
373
- queryParameters: [Parameters.apiVersion],
374
387
  urlParameters: [
375
388
  Parameters.$host,
376
389
  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 { Maps } 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
  OperationDetail,
17
18
  MapsListOperationsNextOptionalParams,
18
19
  MapsListOperationsOptionalParams,
20
+ MapsListOperationsResponse,
19
21
  MapsListSubscriptionOperationsNextOptionalParams,
20
22
  MapsListSubscriptionOperationsOptionalParams,
21
- MapsListOperationsResponse,
22
23
  MapsListSubscriptionOperationsResponse,
23
24
  MapsListOperationsNextResponse,
24
25
  MapsListSubscriptionOperationsNextResponse
@@ -52,22 +53,34 @@ export class MapsImpl implements Maps {
52
53
  [Symbol.asyncIterator]() {
53
54
  return this;
54
55
  },
55
- byPage: () => {
56
- return this.listOperationsPagingPage(options);
56
+ byPage: (settings?: PageSettings) => {
57
+ if (settings?.maxPageSize) {
58
+ throw new Error("maxPageSize is not supported by this operation.");
59
+ }
60
+ return this.listOperationsPagingPage(options, settings);
57
61
  }
58
62
  };
59
63
  }
60
64
 
61
65
  private async *listOperationsPagingPage(
62
- options?: MapsListOperationsOptionalParams
66
+ options?: MapsListOperationsOptionalParams,
67
+ settings?: PageSettings
63
68
  ): AsyncIterableIterator<OperationDetail[]> {
64
- let result = await this._listOperations(options);
65
- yield result.value || [];
66
- let continuationToken = result.nextLink;
69
+ let result: MapsListOperationsResponse;
70
+ let continuationToken = settings?.continuationToken;
71
+ if (!continuationToken) {
72
+ result = await this._listOperations(options);
73
+ let page = result.value || [];
74
+ continuationToken = result.nextLink;
75
+ setContinuationToken(page, continuationToken);
76
+ yield page;
77
+ }
67
78
  while (continuationToken) {
68
79
  result = await this._listOperationsNext(continuationToken, options);
69
80
  continuationToken = result.nextLink;
70
- yield result.value || [];
81
+ let page = result.value || [];
82
+ setContinuationToken(page, continuationToken);
83
+ yield page;
71
84
  }
72
85
  }
73
86
 
@@ -94,25 +107,37 @@ export class MapsImpl implements Maps {
94
107
  [Symbol.asyncIterator]() {
95
108
  return this;
96
109
  },
97
- byPage: () => {
98
- return this.listSubscriptionOperationsPagingPage(options);
110
+ byPage: (settings?: PageSettings) => {
111
+ if (settings?.maxPageSize) {
112
+ throw new Error("maxPageSize is not supported by this operation.");
113
+ }
114
+ return this.listSubscriptionOperationsPagingPage(options, settings);
99
115
  }
100
116
  };
101
117
  }
102
118
 
103
119
  private async *listSubscriptionOperationsPagingPage(
104
- options?: MapsListSubscriptionOperationsOptionalParams
120
+ options?: MapsListSubscriptionOperationsOptionalParams,
121
+ settings?: PageSettings
105
122
  ): AsyncIterableIterator<OperationDetail[]> {
106
- let result = await this._listSubscriptionOperations(options);
107
- yield result.value || [];
108
- let continuationToken = result.nextLink;
123
+ let result: MapsListSubscriptionOperationsResponse;
124
+ let continuationToken = settings?.continuationToken;
125
+ if (!continuationToken) {
126
+ result = await this._listSubscriptionOperations(options);
127
+ let page = result.value || [];
128
+ continuationToken = result.nextLink;
129
+ setContinuationToken(page, continuationToken);
130
+ yield page;
131
+ }
109
132
  while (continuationToken) {
110
133
  result = await this._listSubscriptionOperationsNext(
111
134
  continuationToken,
112
135
  options
113
136
  );
114
137
  continuationToken = result.nextLink;
115
- yield result.value || [];
138
+ let page = result.value || [];
139
+ setContinuationToken(page, continuationToken);
140
+ yield page;
116
141
  }
117
142
  }
118
143
 
@@ -229,7 +254,6 @@ const listOperationsNextOperationSpec: coreClient.OperationSpec = {
229
254
  bodyMapper: Mappers.ErrorResponse
230
255
  }
231
256
  },
232
- queryParameters: [Parameters.apiVersion],
233
257
  urlParameters: [Parameters.$host, Parameters.nextLink],
234
258
  headerParameters: [Parameters.accept],
235
259
  serializer
@@ -245,7 +269,6 @@ const listSubscriptionOperationsNextOperationSpec: coreClient.OperationSpec = {
245
269
  bodyMapper: Mappers.ErrorResponse
246
270
  }
247
271
  },
248
- queryParameters: [Parameters.apiVersion],
249
272
  urlParameters: [
250
273
  Parameters.$host,
251
274
  Parameters.subscriptionId,
@@ -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
+ }