microsoft-graph 2.37.0 → 3.0.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 (74) hide show
  1. package/dist/cjs/operations/drive/listDrives.d.ts +11 -2
  2. package/dist/cjs/operations/drive/listDrives.d.ts.map +1 -1
  3. package/dist/cjs/operations/drive/listDrives.js +14 -10
  4. package/dist/cjs/operations/driveItem/{listDriveItemChildren.d.ts → listDriveItems.d.ts} +7 -3
  5. package/dist/cjs/operations/driveItem/listDriveItems.d.ts.map +1 -0
  6. package/dist/cjs/operations/driveItem/{listDriveItemChildren.js → listDriveItems.js} +5 -5
  7. package/dist/cjs/operations/site/listSites.d.ts +10 -1
  8. package/dist/cjs/operations/site/listSites.d.ts.map +1 -1
  9. package/dist/cjs/operations/site/listSites.js +14 -12
  10. package/dist/cjs/operations/workbookPivotTable/refreshAllWorkbookPivotTables.d.ts +17 -2
  11. package/dist/cjs/operations/workbookPivotTable/refreshAllWorkbookPivotTables.d.ts.map +1 -1
  12. package/dist/cjs/operations/workbookPivotTable/refreshAllWorkbookPivotTables.js +18 -3
  13. package/dist/cjs/operations/workbookPivotTable/refreshWorkbookPivotTable.d.ts +19 -2
  14. package/dist/cjs/operations/workbookPivotTable/refreshWorkbookPivotTable.d.ts.map +1 -1
  15. package/dist/cjs/operations/workbookPivotTable/refreshWorkbookPivotTable.js +20 -3
  16. package/dist/cjs/services/workbookPivotTable.d.ts +16 -0
  17. package/dist/cjs/services/workbookPivotTable.d.ts.map +1 -0
  18. package/dist/cjs/services/workbookPivotTable.js +29 -0
  19. package/dist/{esm/tasks/listDriveItems.d.ts → cjs/tasks/iterateDriveItems.d.ts} +3 -3
  20. package/dist/cjs/tasks/iterateDriveItems.d.ts.map +1 -0
  21. package/dist/cjs/tasks/{listDriveItems.js → iterateDriveItems.js} +14 -20
  22. package/dist/cjs/tasks/iterateDrives.d.ts +17 -0
  23. package/dist/cjs/tasks/iterateDrives.d.ts.map +1 -0
  24. package/dist/cjs/tasks/iterateDrives.js +39 -0
  25. package/dist/cjs/tasks/iterateSites.d.ts +17 -0
  26. package/dist/cjs/tasks/iterateSites.d.ts.map +1 -0
  27. package/dist/cjs/tasks/iterateSites.js +39 -0
  28. package/dist/esm/operations/drive/listDrives.d.ts +11 -2
  29. package/dist/esm/operations/drive/listDrives.d.ts.map +1 -1
  30. package/dist/esm/operations/drive/listDrives.js +14 -10
  31. package/dist/esm/operations/driveItem/{listDriveItemChildren.d.ts → listDriveItems.d.ts} +7 -3
  32. package/dist/esm/operations/driveItem/listDriveItems.d.ts.map +1 -0
  33. package/dist/esm/operations/driveItem/{listDriveItemChildren.js → listDriveItems.js} +4 -4
  34. package/dist/esm/operations/site/listSites.d.ts +10 -1
  35. package/dist/esm/operations/site/listSites.d.ts.map +1 -1
  36. package/dist/esm/operations/site/listSites.js +14 -12
  37. package/dist/esm/operations/workbookPivotTable/refreshAllWorkbookPivotTables.d.ts +17 -2
  38. package/dist/esm/operations/workbookPivotTable/refreshAllWorkbookPivotTables.d.ts.map +1 -1
  39. package/dist/esm/operations/workbookPivotTable/refreshAllWorkbookPivotTables.js +17 -2
  40. package/dist/esm/operations/workbookPivotTable/refreshWorkbookPivotTable.d.ts +19 -2
  41. package/dist/esm/operations/workbookPivotTable/refreshWorkbookPivotTable.d.ts.map +1 -1
  42. package/dist/esm/operations/workbookPivotTable/refreshWorkbookPivotTable.js +19 -2
  43. package/dist/esm/services/workbookPivotTable.d.ts +16 -0
  44. package/dist/esm/services/workbookPivotTable.d.ts.map +1 -0
  45. package/dist/esm/services/workbookPivotTable.js +26 -0
  46. package/dist/{cjs/tasks/listDriveItems.d.ts → esm/tasks/iterateDriveItems.d.ts} +3 -3
  47. package/dist/esm/tasks/iterateDriveItems.d.ts.map +1 -0
  48. package/dist/esm/tasks/{listDriveItems.js → iterateDriveItems.js} +13 -19
  49. package/dist/esm/tasks/iterateDrives.d.ts +17 -0
  50. package/dist/esm/tasks/iterateDrives.d.ts.map +1 -0
  51. package/dist/esm/tasks/iterateDrives.js +33 -0
  52. package/dist/esm/tasks/iterateSites.d.ts +17 -0
  53. package/dist/esm/tasks/iterateSites.d.ts.map +1 -0
  54. package/dist/esm/tasks/iterateSites.js +33 -0
  55. package/docs/api/README.md +8 -5
  56. package/docs/api/{WorkbookPivotTable.md → WorkbookPivotTable-1.md} +2 -2
  57. package/docs/api/getWorkbookPivotTable.md +2 -2
  58. package/docs/api/iterateDriveItems.md +32 -0
  59. package/docs/api/iterateDrives.md +32 -0
  60. package/docs/api/iterateSites.md +32 -0
  61. package/docs/api/listDriveItems.md +40 -10
  62. package/docs/api/listDrives.md +37 -6
  63. package/docs/api/listSites.md +37 -6
  64. package/docs/api/refreshAllWorkbookPivotTables.md +50 -0
  65. package/docs/api/refreshWorkbookPivotTable.md +52 -0
  66. package/docs/api/workbookPivotTable.md +32 -0
  67. package/package.json +125 -50
  68. package/dist/cjs/operations/driveItem/listDriveItemChildren.d.ts.map +0 -1
  69. package/dist/cjs/tasks/listDriveItems.d.ts.map +0 -1
  70. package/dist/esm/operations/driveItem/listDriveItemChildren.d.ts.map +0 -1
  71. package/dist/esm/tasks/listDriveItems.d.ts.map +0 -1
  72. package/docs/api/listDriveItemChildren.md +0 -47
  73. package/docs/api/refreshAllWorkbookWorksheetPivotTables.md +0 -31
  74. package/docs/api/refreshWorkbookWorksheetPivotTable.md +0 -31
@@ -3,15 +3,24 @@
3
3
  * @module listDrives
4
4
  * @category Operations
5
5
  */
6
- import type { DriveItem } from "@microsoft/microsoft-graph-types";
6
+ import type { Drive, DriveItem } from "@microsoft/microsoft-graph-types";
7
7
  import type { DriveRef } from "../../models/Drive.ts";
8
8
  import type { GraphOperation } from "../../models/GraphOperation.ts";
9
9
  import type { SiteRef } from "../../models/Site.ts";
10
+ export type ListDrivesResponse = {
11
+ value: (DriveItem & DriveRef)[];
12
+ "@odata.nextLink": string | null;
13
+ };
14
+ export type DriveList = {
15
+ drives: (Drive & DriveRef)[];
16
+ nextLink: URL | null;
17
+ };
10
18
  /**
11
19
  * Retrieve the list of accessible Drives in a Site.
12
20
  * @param siteRef Reference to the site.
21
+ * @param take Maximum number of items to retrieve. Defaults to 1000.
13
22
  * @returns Array of drives available for the specified site, each including its metadata and reference information.
14
23
  * @see https://learn.microsoft.com/en-us/graph/api/drive-list
15
24
  */
16
- export default function listDrives(siteRef: SiteRef): GraphOperation<(DriveItem & DriveRef)[]>;
25
+ export default function listDrives(siteRef: SiteRef, take?: number): GraphOperation<DriveList>;
17
26
  //# sourceMappingURL=listDrives.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"listDrives.d.ts","sourceRoot":"","sources":["../../../../src/operations/drive/listDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAW,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAKpD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,CAAC,CAAC,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC,CAkB7F"}
1
+ {"version":3,"file":"listDrives.d.ts","sourceRoot":"","sources":["../../../../src/operations/drive/listDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAW,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAKpD,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,CAAC,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC;IAChC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC;IAC7B,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,SAAO,GAAG,cAAc,CAAC,SAAS,CAAC,CAwB3F"}
@@ -12,25 +12,29 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
12
12
  /**
13
13
  * Retrieve the list of accessible Drives in a Site.
14
14
  * @param siteRef Reference to the site.
15
+ * @param take Maximum number of items to retrieve. Defaults to 1000.
15
16
  * @returns Array of drives available for the specified site, each including its metadata and reference information.
16
17
  * @see https://learn.microsoft.com/en-us/graph/api/drive-list
17
18
  */
18
- function listDrives(siteRef) {
19
+ function listDrives(siteRef, take = 1000) {
19
20
  return (0, operationInvoker_ts_1.operation)({
20
21
  context: siteRef.context,
21
22
  method: "GET",
22
- path: (0, templatedPaths_ts_1.generatePath)("/sites/{site-id}/drives", siteRef),
23
+ path: (0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives?$top=${take}`, siteRef),
23
24
  headers: {},
24
25
  body: null,
25
26
  responseTransform: (response) => {
26
- const list = response;
27
- return list.value.map((drive) => {
28
- const ref = (0, drive_ts_1.createDriveRef)(siteRef, drive.id);
29
- return {
30
- ...drive,
31
- ...ref,
32
- };
33
- });
27
+ const result = response;
28
+ return {
29
+ drives: result.value.map((drive) => {
30
+ const driveRef = (0, drive_ts_1.createDriveRef)(siteRef, drive.id);
31
+ return {
32
+ ...drive,
33
+ ...driveRef,
34
+ };
35
+ }),
36
+ nextLink: result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null,
37
+ };
34
38
  },
35
39
  });
36
40
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Retrieve the metadata for items in a drive or folder.
3
- * @module listDriveItemChildren
3
+ * @module listDriveItems
4
4
  * @category Operations
5
5
  */
6
6
  import type { DriveItem } from "@microsoft/microsoft-graph-types";
@@ -11,6 +11,10 @@ export type ListDriveItemResponse = {
11
11
  value: (DriveItem & DriveItemRef)[];
12
12
  "@odata.nextLink": string | null;
13
13
  };
14
+ export type DriveItemList = {
15
+ items: (DriveItem & DriveItemRef)[];
16
+ nextLink: URL | null;
17
+ };
14
18
  /**
15
19
  * Retrieve the metadata for items in a drive or folder.
16
20
  * @param parentRef Reference to the parent drive or folder. Defaults to the root drive.
@@ -18,5 +22,5 @@ export type ListDriveItemResponse = {
18
22
  * @returns Array of drive items, each including its metadata and reference information.
19
23
  * @see https://learn.microsoft.com/en-us/graph/api/driveitem-list-children
20
24
  */
21
- export default function listDriveItemChildren(parentRef: DriveRef | DriveItemRef, take?: number): GraphOperation<ListDriveItemResponse>;
22
- //# sourceMappingURL=listDriveItemChildren.d.ts.map
25
+ export default function listDriveItems(parentRef: DriveRef | DriveItemRef, take?: number): GraphOperation<DriveItemList>;
26
+ //# sourceMappingURL=listDriveItems.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listDriveItems.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/listDriveItems.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE,MAAM,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE,CAAC;IACpC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE,CAAC;IACpC,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,IAAI,SAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAyBrH"}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  /**
3
3
  * Retrieve the metadata for items in a drive or folder.
4
- * @module listDriveItemChildren
4
+ * @module listDriveItems
5
5
  * @category Operations
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.default = listDriveItemChildren;
8
+ exports.default = listDriveItems;
9
9
  const driveItem_ts_1 = require("../../services/driveItem.js");
10
10
  const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
11
11
  const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
@@ -16,7 +16,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
16
16
  * @returns Array of drive items, each including its metadata and reference information.
17
17
  * @see https://learn.microsoft.com/en-us/graph/api/driveitem-list-children
18
18
  */
19
- function listDriveItemChildren(parentRef, take = 1000) {
19
+ function listDriveItems(parentRef, take = 1000) {
20
20
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
21
21
  return (0, operationInvoker_ts_1.operation)({
22
22
  context: parentRef.context,
@@ -27,14 +27,14 @@ function listDriveItemChildren(parentRef, take = 1000) {
27
27
  responseTransform: (response) => {
28
28
  const result = response;
29
29
  return {
30
- value: result.value.map((item) => {
30
+ items: result.value.map((item) => {
31
31
  const itemRef = (0, driveItem_ts_1.createDriveItemRef)(parentRef, item.id);
32
32
  return {
33
33
  ...item,
34
34
  ...itemRef,
35
35
  };
36
36
  }),
37
- "@odata.nextLink": result["@odata.nextLink"] ?? null,
37
+ nextLink: result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null,
38
38
  };
39
39
  },
40
40
  });
@@ -7,11 +7,20 @@ import type { Site } from "@microsoft/microsoft-graph-types";
7
7
  import type { ContextRef } from "../../models/Context.ts";
8
8
  import type { GraphOperation } from "../../models/GraphOperation.ts";
9
9
  import type { SiteRef } from "../../models/Site.ts";
10
+ export type ListSitesResponse = {
11
+ value: (Site & SiteRef)[];
12
+ "@odata.nextLink": string | null;
13
+ };
14
+ export type SiteList = {
15
+ sites: (Site & SiteRef)[];
16
+ nextLink: URL | null;
17
+ };
10
18
  /**
11
19
  * List sites in your company geography.
12
20
  * @param contextRef Reference to the context.
21
+ * @param take Maximum number of items to retrieve. Defaults to 1000.
13
22
  * @returns Array of sites, each including its metadata and reference information.
14
23
  * @see https://learn.microsoft.com/en-us/graph/api/site-list
15
24
  */
16
- export default function listSites(contextRef: ContextRef): GraphOperation<(Site & SiteRef)[]>;
25
+ export default function listSites(contextRef: ContextRef, take?: number): GraphOperation<SiteList>;
17
26
  //# sourceMappingURL=listSites.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"listSites.d.ts","sourceRoot":"","sources":["../../../../src/operations/site/listSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAK5D;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,cAAc,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,CAAC,CAuB5F"}
1
+ {"version":3,"file":"listSites.d.ts","sourceRoot":"","sources":["../../../../src/operations/site/listSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAK5D,MAAM,MAAM,iBAAiB,GAAG;IAC/B,KAAK,EAAE,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,CAAC;IAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACtB,KAAK,EAAE,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,CAAC;IAC1B,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,SAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,CAuB/F"}
@@ -12,27 +12,29 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
12
12
  /**
13
13
  * List sites in your company geography.
14
14
  * @param contextRef Reference to the context.
15
+ * @param take Maximum number of items to retrieve. Defaults to 1000.
15
16
  * @returns Array of sites, each including its metadata and reference information.
16
17
  * @see https://learn.microsoft.com/en-us/graph/api/site-list
17
18
  */
18
- function listSites(contextRef) {
19
+ function listSites(contextRef, take = 1000) {
19
20
  return (0, operationInvoker_ts_1.operation)({
20
21
  context: contextRef.context,
21
22
  method: "GET",
22
- path: (0, templatedPaths_ts_1.generatePath)("/sites", {}),
23
+ path: (0, templatedPaths_ts_1.generatePath)(`/sites?search=*&$top=${take}`, {}), // TODO: Implement search parameter properly. Without this not all are shown.
23
24
  headers: {},
24
25
  body: null,
25
26
  responseTransform: (response) => {
26
- const list = response;
27
- const sites = list.value.map((site) => {
28
- const siteId = site.id;
29
- const siteRef = (0, site_ts_1.createSiteRef)(contextRef, siteId);
30
- return {
31
- ...site,
32
- ...siteRef,
33
- };
34
- });
35
- return sites;
27
+ const result = response;
28
+ return {
29
+ sites: result.value.map((site) => {
30
+ const siteRef = (0, site_ts_1.createSiteRef)(contextRef, site.id);
31
+ return {
32
+ ...site,
33
+ ...siteRef,
34
+ };
35
+ }),
36
+ nextLink: result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null,
37
+ };
36
38
  },
37
39
  });
38
40
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Refresh all pivot tables in a worksheet.
3
- * @module refreshAllWorkbookWorksheetPivotTables
3
+ * @module refreshAllWorkbookPivotTables
4
4
  * @category Operations
5
5
  */
6
6
  import type { GraphOperation } from "../../models/GraphOperation.ts";
@@ -10,6 +10,21 @@ import type { WorkbookWorksheetRef } from "../../models/WorkbookWorksheet.ts";
10
10
  * @param worksheetRef Reference to the worksheet.
11
11
  * @returns void (no response body)
12
12
  * @see https://learn.microsoft.com/en-us/graph/api/workbookpivottable-refreshall
13
+ * @example
14
+ * const tenantId = getEnvironmentVariable("AZURE_TENANT_ID") as AzureTenantId;
15
+ * const clientId = getEnvironmentVariable("AZURE_CLIENT_ID") as AzureClientId;
16
+ * const clientSecret = getEnvironmentVariable("AZURE_CLIENT_SECRET") as AzureClientSecret;
17
+ * const siteId = getEnvironmentVariable("SHAREPOINT_SITE_ID") as SiteId;
18
+ * const driveId = getEnvironmentVariable("SHAREPOINT_DRIVE_ID") as DriveId;
19
+ * const driveItemPath = "/path/to/your/workbook.xlsx" as DriveItemPath;
20
+ * const worksheetName = "Sheet1" as WorkbookWorksheetName;
21
+ *
22
+ * const contextRef = createClientSecretContext(tenantId, clientId, clientSecret);
23
+ * const siteRef = createSiteRef(contextRef, siteId);
24
+ * const driveRef = createDriveRef(siteRef, driveId);
25
+ * const driveItemRef = await getDriveItemByPath(driveRef, driveItemPath);
26
+ * const worksheetRef = await getWorkbookWorksheetByName(driveItemRef, worksheetName);
27
+ * await refreshAllWorkbookPivotTables(worksheetRef);
13
28
  */
14
- export default function refreshAllWorkbookWorksheetPivotTables(worksheetRef: WorkbookWorksheetRef): GraphOperation<void>;
29
+ export default function refreshAllWorkbookPivotTables(worksheetRef: WorkbookWorksheetRef): GraphOperation<void>;
15
30
  //# sourceMappingURL=refreshAllWorkbookPivotTables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refreshAllWorkbookPivotTables.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookPivotTable/refreshAllWorkbookPivotTables.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAI9E;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,sCAAsC,CAAC,YAAY,EAAE,oBAAoB,GAAG,cAAc,CAAC,IAAI,CAAC,CAWvH"}
1
+ {"version":3,"file":"refreshAllWorkbookPivotTables.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookPivotTable/refreshAllWorkbookPivotTables.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAI9E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,6BAA6B,CAAC,YAAY,EAAE,oBAAoB,GAAG,cAAc,CAAC,IAAI,CAAC,CAW9G"}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  /**
3
3
  * Refresh all pivot tables in a worksheet.
4
- * @module refreshAllWorkbookWorksheetPivotTables
4
+ * @module refreshAllWorkbookPivotTables
5
5
  * @category Operations
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.default = refreshAllWorkbookWorksheetPivotTables;
8
+ exports.default = refreshAllWorkbookPivotTables;
9
9
  const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
10
10
  const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
11
11
  /**
@@ -13,8 +13,23 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
13
13
  * @param worksheetRef Reference to the worksheet.
14
14
  * @returns void (no response body)
15
15
  * @see https://learn.microsoft.com/en-us/graph/api/workbookpivottable-refreshall
16
+ * @example
17
+ * const tenantId = getEnvironmentVariable("AZURE_TENANT_ID") as AzureTenantId;
18
+ * const clientId = getEnvironmentVariable("AZURE_CLIENT_ID") as AzureClientId;
19
+ * const clientSecret = getEnvironmentVariable("AZURE_CLIENT_SECRET") as AzureClientSecret;
20
+ * const siteId = getEnvironmentVariable("SHAREPOINT_SITE_ID") as SiteId;
21
+ * const driveId = getEnvironmentVariable("SHAREPOINT_DRIVE_ID") as DriveId;
22
+ * const driveItemPath = "/path/to/your/workbook.xlsx" as DriveItemPath;
23
+ * const worksheetName = "Sheet1" as WorkbookWorksheetName;
24
+ *
25
+ * const contextRef = createClientSecretContext(tenantId, clientId, clientSecret);
26
+ * const siteRef = createSiteRef(contextRef, siteId);
27
+ * const driveRef = createDriveRef(siteRef, driveId);
28
+ * const driveItemRef = await getDriveItemByPath(driveRef, driveItemPath);
29
+ * const worksheetRef = await getWorkbookWorksheetByName(driveItemRef, worksheetName);
30
+ * await refreshAllWorkbookPivotTables(worksheetRef);
16
31
  */
17
- function refreshAllWorkbookWorksheetPivotTables(worksheetRef) {
32
+ function refreshAllWorkbookPivotTables(worksheetRef) {
18
33
  return (0, operationInvoker_ts_1.operation)({
19
34
  context: worksheetRef.context,
20
35
  method: "POST",
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Refresh a specific pivot table in a worksheet.
3
- * @module refreshWorkbookWorksheetPivotTable
3
+ * @module refreshWorkbookPivotTable
4
4
  * @category Operations
5
5
  */
6
6
  import type { GraphOperation } from "../../models/GraphOperation.ts";
@@ -10,6 +10,23 @@ import type { WorkbookPivotTableRef } from "../../models/WorkbookPivotTable.ts";
10
10
  * @param pivotTableRef Reference to the pivot table.
11
11
  * @returns void (no response body)
12
12
  * @see https://learn.microsoft.com/en-us/graph/api/workbookpivottable-refresh
13
+ * @example
14
+ * const tenantId = getEnvironmentVariable("AZURE_TENANT_ID") as AzureTenantId;
15
+ * const clientId = getEnvironmentVariable("AZURE_CLIENT_ID") as AzureClientId;
16
+ * const clientSecret = getEnvironmentVariable("AZURE_CLIENT_SECRET") as AzureClientSecret;
17
+ * const siteId = getEnvironmentVariable("SHAREPOINT_SITE_ID") as SiteId;
18
+ * const driveId = getEnvironmentVariable("SHAREPOINT_DRIVE_ID") as DriveId;
19
+ * const driveItemPath = "/path/to/your/workbook.xlsx" as DriveItemPath;
20
+ * const worksheetName = "Sheet1" as WorkbookWorksheetName;
21
+ * const pivotTableId = "PivotTable1" as WorkbookPivotTableId;
22
+ *
23
+ * const contextRef = createClientSecretContext(tenantId, clientId, clientSecret);
24
+ * const siteRef = createSiteRef(contextRef, siteId);
25
+ * const driveRef = createDriveRef(siteRef, driveId);
26
+ * const driveItemRef = await getDriveItemByPath(driveRef, driveItemPath);
27
+ * const worksheetRef = await getWorkbookWorksheetByName(driveItemRef, worksheetName);
28
+ * const pivotTableRef = createWorkbookPivotTableRef(worksheetRef, pivotTableId);
29
+ * await refreshWorkbookPivotTable(pivotTableRef);
13
30
  */
14
- export default function refreshWorkbookWorksheetPivotTable(pivotTableRef: WorkbookPivotTableRef): GraphOperation<void>;
31
+ export default function refreshWorkbookPivotTable(pivotTableRef: WorkbookPivotTableRef): GraphOperation<void>;
15
32
  //# sourceMappingURL=refreshWorkbookPivotTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refreshWorkbookPivotTable.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookPivotTable/refreshWorkbookPivotTable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAIhF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,kCAAkC,CAAC,aAAa,EAAE,qBAAqB,GAAG,cAAc,CAAC,IAAI,CAAC,CAWrH"}
1
+ {"version":3,"file":"refreshWorkbookPivotTable.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookPivotTable/refreshWorkbookPivotTable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAIhF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,aAAa,EAAE,qBAAqB,GAAG,cAAc,CAAC,IAAI,CAAC,CAW5G"}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  /**
3
3
  * Refresh a specific pivot table in a worksheet.
4
- * @module refreshWorkbookWorksheetPivotTable
4
+ * @module refreshWorkbookPivotTable
5
5
  * @category Operations
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.default = refreshWorkbookWorksheetPivotTable;
8
+ exports.default = refreshWorkbookPivotTable;
9
9
  const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
10
10
  const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
11
11
  /**
@@ -13,8 +13,25 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
13
13
  * @param pivotTableRef Reference to the pivot table.
14
14
  * @returns void (no response body)
15
15
  * @see https://learn.microsoft.com/en-us/graph/api/workbookpivottable-refresh
16
+ * @example
17
+ * const tenantId = getEnvironmentVariable("AZURE_TENANT_ID") as AzureTenantId;
18
+ * const clientId = getEnvironmentVariable("AZURE_CLIENT_ID") as AzureClientId;
19
+ * const clientSecret = getEnvironmentVariable("AZURE_CLIENT_SECRET") as AzureClientSecret;
20
+ * const siteId = getEnvironmentVariable("SHAREPOINT_SITE_ID") as SiteId;
21
+ * const driveId = getEnvironmentVariable("SHAREPOINT_DRIVE_ID") as DriveId;
22
+ * const driveItemPath = "/path/to/your/workbook.xlsx" as DriveItemPath;
23
+ * const worksheetName = "Sheet1" as WorkbookWorksheetName;
24
+ * const pivotTableId = "PivotTable1" as WorkbookPivotTableId;
25
+ *
26
+ * const contextRef = createClientSecretContext(tenantId, clientId, clientSecret);
27
+ * const siteRef = createSiteRef(contextRef, siteId);
28
+ * const driveRef = createDriveRef(siteRef, driveId);
29
+ * const driveItemRef = await getDriveItemByPath(driveRef, driveItemPath);
30
+ * const worksheetRef = await getWorkbookWorksheetByName(driveItemRef, worksheetName);
31
+ * const pivotTableRef = createWorkbookPivotTableRef(worksheetRef, pivotTableId);
32
+ * await refreshWorkbookPivotTable(pivotTableRef);
16
33
  */
17
- function refreshWorkbookWorksheetPivotTable(pivotTableRef) {
34
+ function refreshWorkbookPivotTable(pivotTableRef) {
18
35
  return (0, operationInvoker_ts_1.operation)({
19
36
  context: pivotTableRef.context,
20
37
  method: "POST",
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Utilities for working with workbook pivot tables and their references.
3
+ * @module workbookPivotTable
4
+ * @category Services
5
+ */
6
+ import type { WorkbookPivotTableId, WorkbookPivotTableRef } from "../models/WorkbookPivotTable.ts";
7
+ import type { WorkbookWorksheetRef } from "../models/WorkbookWorksheet.ts";
8
+ /**
9
+ * Creates a reference to a workbook pivot table.
10
+ * @param worksheetRef Reference to the worksheet containing the pivot table.
11
+ * @param pivotTableId ID of the pivot table.
12
+ * @returns Reference to the workbook pivot table.
13
+ * @throws Error if the pivot table ID is missing.
14
+ */
15
+ export declare function createWorkbookPivotTableRef(worksheetRef: WorkbookWorksheetRef, pivotTableId: WorkbookPivotTableId | undefined): WorkbookPivotTableRef;
16
+ //# sourceMappingURL=workbookPivotTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbookPivotTable.d.ts","sourceRoot":"","sources":["../../../src/services/workbookPivotTable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,oBAAoB,GAAG,SAAS,GAAG,qBAAqB,CAcrJ"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * Utilities for working with workbook pivot tables and their references.
4
+ * @module workbookPivotTable
5
+ * @category Services
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.createWorkbookPivotTableRef = createWorkbookPivotTableRef;
9
+ /**
10
+ * Creates a reference to a workbook pivot table.
11
+ * @param worksheetRef Reference to the worksheet containing the pivot table.
12
+ * @param pivotTableId ID of the pivot table.
13
+ * @returns Reference to the workbook pivot table.
14
+ * @throws Error if the pivot table ID is missing.
15
+ */
16
+ function createWorkbookPivotTableRef(worksheetRef, pivotTableId) {
17
+ if (!pivotTableId) {
18
+ throw new Error("TableId is missing");
19
+ }
20
+ return {
21
+ context: worksheetRef.context,
22
+ siteId: worksheetRef.siteId,
23
+ driveId: worksheetRef.driveId,
24
+ itemId: worksheetRef.itemId,
25
+ worksheetId: worksheetRef.worksheetId,
26
+ sessionId: worksheetRef.sessionId,
27
+ pivotTableId: pivotTableId,
28
+ };
29
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * List drive items in a drive or a drive item.
3
- * @module listDriveItems
3
+ * @module iterateDriveItems
4
4
  * @category Tasks
5
5
  */
6
6
  import type { DriveItem } from "@microsoft/microsoft-graph-types";
@@ -13,5 +13,5 @@ import type { DriveItemRef } from "../models/DriveItem.ts";
13
13
  * @returns Async iterable of drive items.
14
14
  * @remarks `pageSize` should only be set for advanced performance tuning.
15
15
  */
16
- export default function listDriveItems(parentRef: DriveRef | DriveItemRef, maxPerChunk?: number): AsyncGenerator<DriveItem & DriveItemRef>;
17
- //# sourceMappingURL=listDriveItems.d.ts.map
16
+ export default function iterateDriveItems(parentRef: DriveRef | DriveItemRef, maxPerChunk?: number): AsyncGenerator<DriveItem & DriveItemRef>;
17
+ //# sourceMappingURL=iterateDriveItems.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterateDriveItems.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateDriveItems.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKxE;;;;;;GAMG;AACH,wBAA+B,iBAAiB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CA0BjJ"}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  /**
3
3
  * List drive items in a drive or a drive item.
4
- * @module listDriveItems
4
+ * @module iterateDriveItems
5
5
  * @category Tasks
6
6
  */
7
7
  var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.default = listDriveItems;
12
- const listDriveItemChildren_ts_1 = __importDefault(require("../operations/driveItem/listDriveItemChildren.js"));
11
+ exports.default = iterateDriveItems;
12
+ const listDriveItems_ts_1 = __importDefault(require("../operations/driveItem/listDriveItems.js"));
13
13
  const driveItem_ts_1 = require("../services/driveItem.js");
14
14
  const http_ts_1 = require("../services/http.js");
15
15
  /**
@@ -19,31 +19,25 @@ const http_ts_1 = require("../services/http.js");
19
19
  * @returns Async iterable of drive items.
20
20
  * @remarks `pageSize` should only be set for advanced performance tuning.
21
21
  */
22
- async function* listDriveItems(parentRef, maxPerChunk = 1000) {
23
- let result = await (0, listDriveItemChildren_ts_1.default)(parentRef, maxPerChunk);
24
- for (const item of result.value) {
25
- const itemRef = (0, driveItem_ts_1.createDriveItemRef)(parentRef, item.id);
26
- yield {
27
- ...item,
28
- ...itemRef,
29
- };
22
+ async function* iterateDriveItems(parentRef, maxPerChunk = 1000) {
23
+ let { items, nextLink } = await (0, listDriveItems_ts_1.default)(parentRef, maxPerChunk);
24
+ for (const item of items) {
25
+ yield item;
30
26
  }
31
- while (result["@odata.nextLink"]) {
27
+ while (nextLink) {
32
28
  const accessToken = await parentRef.context.generateAccessToken();
33
29
  const response = await (0, http_ts_1.executeHttpRequest)({
34
- url: result["@odata.nextLink"],
30
+ url: nextLink.toString(),
35
31
  method: "GET",
36
32
  headers: {
37
33
  authorization: `Bearer ${accessToken}`,
38
34
  },
39
35
  });
40
- result = response.data;
41
- for (const item of result.value) {
42
- const itemRef = (0, driveItem_ts_1.createDriveItemRef)(parentRef, item.id);
43
- yield {
44
- ...item,
45
- ...itemRef,
46
- };
36
+ const result = response.data;
37
+ const newItems = result.value.map((item) => ((0, driveItem_ts_1.createDriveItemRef)(parentRef, item.id) ? { ...item, ...(0, driveItem_ts_1.createDriveItemRef)(parentRef, item.id) } : item));
38
+ nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
39
+ for (const item of newItems) {
40
+ yield item;
47
41
  }
48
42
  }
49
43
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * List drives in a site as an async iterable.
3
+ * @module iterateDrives
4
+ * @category Tasks
5
+ */
6
+ import type { DriveItem } from "@microsoft/microsoft-graph-types";
7
+ import type { DriveRef } from "../models/Drive.ts";
8
+ import type { SiteRef } from "../models/Site.ts";
9
+ /**
10
+ * List drives in a site as an async iterable.
11
+ * @param siteRef Reference to the site.
12
+ * @param maxPerChunk Number of items to fetch per request. DO NOT SET EXCEPT FOR ADVANCED TUNING.
13
+ * @returns Async iterable of drives.
14
+ * @remarks `pageSize` should only be set for advanced performance tuning.
15
+ */
16
+ export default function iterateDrives(siteRef: SiteRef, maxPerChunk?: number): AsyncGenerator<DriveItem & DriveRef>;
17
+ //# sourceMappingURL=iterateDrives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterateDrives.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;GAMG;AACH,wBAA+B,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,SAAS,GAAG,QAAQ,CAAC,CAuBvH"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * List drives in a site as an async iterable.
4
+ * @module iterateDrives
5
+ * @category Tasks
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.default = iterateDrives;
12
+ const listDrives_ts_1 = __importDefault(require("../operations/drive/listDrives.js"));
13
+ /**
14
+ * List drives in a site as an async iterable.
15
+ * @param siteRef Reference to the site.
16
+ * @param maxPerChunk Number of items to fetch per request. DO NOT SET EXCEPT FOR ADVANCED TUNING.
17
+ * @returns Async iterable of drives.
18
+ * @remarks `pageSize` should only be set for advanced performance tuning.
19
+ */
20
+ async function* iterateDrives(siteRef, maxPerChunk = 1000) {
21
+ let { drives, nextLink } = await (0, listDrives_ts_1.default)(siteRef, maxPerChunk);
22
+ for (const drive of drives) {
23
+ yield drive;
24
+ }
25
+ while (nextLink) {
26
+ const accessToken = await siteRef.context.generateAccessToken();
27
+ const response = await fetch(nextLink, {
28
+ headers: {
29
+ authorization: `Bearer ${accessToken}`,
30
+ },
31
+ });
32
+ const result = (await response.json());
33
+ drives = result.value;
34
+ nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
35
+ for (const drive of drives) {
36
+ yield drive;
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * List sites in your company geography as an async iterable.
3
+ * @module iterateSites
4
+ * @category Tasks
5
+ */
6
+ import type { Site } from "@microsoft/microsoft-graph-types";
7
+ import type { ContextRef } from "../models/Context.ts";
8
+ import type { SiteRef } from "../models/Site.ts";
9
+ /**
10
+ * List sites in your company geography as an async iterable.
11
+ * @param contextRef Reference to the context.
12
+ * @param maxPerChunk Number of items to fetch per request. DO NOT SET EXCEPT FOR ADVANCED TUNING.
13
+ * @returns Async iterable of sites.
14
+ * @remarks `pageSize` should only be set for advanced performance tuning.
15
+ */
16
+ export default function iterateSites(contextRef: ContextRef, maxPerChunk?: number): AsyncGenerator<Site & SiteRef>;
17
+ //# sourceMappingURL=iterateSites.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterateSites.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;GAMG;AACH,wBAA+B,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAuBtH"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * List sites in your company geography as an async iterable.
4
+ * @module iterateSites
5
+ * @category Tasks
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.default = iterateSites;
12
+ const listSites_ts_1 = __importDefault(require("../operations/site/listSites.js"));
13
+ /**
14
+ * List sites in your company geography as an async iterable.
15
+ * @param contextRef Reference to the context.
16
+ * @param maxPerChunk Number of items to fetch per request. DO NOT SET EXCEPT FOR ADVANCED TUNING.
17
+ * @returns Async iterable of sites.
18
+ * @remarks `pageSize` should only be set for advanced performance tuning.
19
+ */
20
+ async function* iterateSites(contextRef, maxPerChunk = 1000) {
21
+ let { sites, nextLink } = await (0, listSites_ts_1.default)(contextRef, maxPerChunk);
22
+ for (const site of sites) {
23
+ yield site;
24
+ }
25
+ while (nextLink) {
26
+ const accessToken = await contextRef.context.generateAccessToken();
27
+ const response = await fetch(nextLink, {
28
+ headers: {
29
+ authorization: `Bearer ${accessToken}`,
30
+ },
31
+ });
32
+ const result = (await response.json());
33
+ sites = result.value;
34
+ nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
35
+ for (const site of sites) {
36
+ yield site;
37
+ }
38
+ }
39
+ }