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.
- package/dist/cjs/operations/drive/listDrives.d.ts +11 -2
- package/dist/cjs/operations/drive/listDrives.d.ts.map +1 -1
- package/dist/cjs/operations/drive/listDrives.js +14 -10
- package/dist/cjs/operations/driveItem/{listDriveItemChildren.d.ts → listDriveItems.d.ts} +7 -3
- package/dist/cjs/operations/driveItem/listDriveItems.d.ts.map +1 -0
- package/dist/cjs/operations/driveItem/{listDriveItemChildren.js → listDriveItems.js} +5 -5
- package/dist/cjs/operations/site/listSites.d.ts +10 -1
- package/dist/cjs/operations/site/listSites.d.ts.map +1 -1
- package/dist/cjs/operations/site/listSites.js +14 -12
- package/dist/cjs/operations/workbookPivotTable/refreshAllWorkbookPivotTables.d.ts +17 -2
- package/dist/cjs/operations/workbookPivotTable/refreshAllWorkbookPivotTables.d.ts.map +1 -1
- package/dist/cjs/operations/workbookPivotTable/refreshAllWorkbookPivotTables.js +18 -3
- package/dist/cjs/operations/workbookPivotTable/refreshWorkbookPivotTable.d.ts +19 -2
- package/dist/cjs/operations/workbookPivotTable/refreshWorkbookPivotTable.d.ts.map +1 -1
- package/dist/cjs/operations/workbookPivotTable/refreshWorkbookPivotTable.js +20 -3
- package/dist/cjs/services/workbookPivotTable.d.ts +16 -0
- package/dist/cjs/services/workbookPivotTable.d.ts.map +1 -0
- package/dist/cjs/services/workbookPivotTable.js +29 -0
- package/dist/{esm/tasks/listDriveItems.d.ts → cjs/tasks/iterateDriveItems.d.ts} +3 -3
- package/dist/cjs/tasks/iterateDriveItems.d.ts.map +1 -0
- package/dist/cjs/tasks/{listDriveItems.js → iterateDriveItems.js} +14 -20
- package/dist/cjs/tasks/iterateDrives.d.ts +17 -0
- package/dist/cjs/tasks/iterateDrives.d.ts.map +1 -0
- package/dist/cjs/tasks/iterateDrives.js +39 -0
- package/dist/cjs/tasks/iterateSites.d.ts +17 -0
- package/dist/cjs/tasks/iterateSites.d.ts.map +1 -0
- package/dist/cjs/tasks/iterateSites.js +39 -0
- package/dist/esm/operations/drive/listDrives.d.ts +11 -2
- package/dist/esm/operations/drive/listDrives.d.ts.map +1 -1
- package/dist/esm/operations/drive/listDrives.js +14 -10
- package/dist/esm/operations/driveItem/{listDriveItemChildren.d.ts → listDriveItems.d.ts} +7 -3
- package/dist/esm/operations/driveItem/listDriveItems.d.ts.map +1 -0
- package/dist/esm/operations/driveItem/{listDriveItemChildren.js → listDriveItems.js} +4 -4
- package/dist/esm/operations/site/listSites.d.ts +10 -1
- package/dist/esm/operations/site/listSites.d.ts.map +1 -1
- package/dist/esm/operations/site/listSites.js +14 -12
- package/dist/esm/operations/workbookPivotTable/refreshAllWorkbookPivotTables.d.ts +17 -2
- package/dist/esm/operations/workbookPivotTable/refreshAllWorkbookPivotTables.d.ts.map +1 -1
- package/dist/esm/operations/workbookPivotTable/refreshAllWorkbookPivotTables.js +17 -2
- package/dist/esm/operations/workbookPivotTable/refreshWorkbookPivotTable.d.ts +19 -2
- package/dist/esm/operations/workbookPivotTable/refreshWorkbookPivotTable.d.ts.map +1 -1
- package/dist/esm/operations/workbookPivotTable/refreshWorkbookPivotTable.js +19 -2
- package/dist/esm/services/workbookPivotTable.d.ts +16 -0
- package/dist/esm/services/workbookPivotTable.d.ts.map +1 -0
- package/dist/esm/services/workbookPivotTable.js +26 -0
- package/dist/{cjs/tasks/listDriveItems.d.ts → esm/tasks/iterateDriveItems.d.ts} +3 -3
- package/dist/esm/tasks/iterateDriveItems.d.ts.map +1 -0
- package/dist/esm/tasks/{listDriveItems.js → iterateDriveItems.js} +13 -19
- package/dist/esm/tasks/iterateDrives.d.ts +17 -0
- package/dist/esm/tasks/iterateDrives.d.ts.map +1 -0
- package/dist/esm/tasks/iterateDrives.js +33 -0
- package/dist/esm/tasks/iterateSites.d.ts +17 -0
- package/dist/esm/tasks/iterateSites.d.ts.map +1 -0
- package/dist/esm/tasks/iterateSites.js +33 -0
- package/docs/api/README.md +8 -5
- package/docs/api/{WorkbookPivotTable.md → WorkbookPivotTable-1.md} +2 -2
- package/docs/api/getWorkbookPivotTable.md +2 -2
- package/docs/api/iterateDriveItems.md +32 -0
- package/docs/api/iterateDrives.md +32 -0
- package/docs/api/iterateSites.md +32 -0
- package/docs/api/listDriveItems.md +40 -10
- package/docs/api/listDrives.md +37 -6
- package/docs/api/listSites.md +37 -6
- package/docs/api/refreshAllWorkbookPivotTables.md +50 -0
- package/docs/api/refreshWorkbookPivotTable.md +52 -0
- package/docs/api/workbookPivotTable.md +32 -0
- package/package.json +125 -50
- package/dist/cjs/operations/driveItem/listDriveItemChildren.d.ts.map +0 -1
- package/dist/cjs/tasks/listDriveItems.d.ts.map +0 -1
- package/dist/esm/operations/driveItem/listDriveItemChildren.d.ts.map +0 -1
- package/dist/esm/tasks/listDriveItems.d.ts.map +0 -1
- package/docs/api/listDriveItemChildren.md +0 -47
- package/docs/api/refreshAllWorkbookWorksheetPivotTables.md +0 -31
- 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<
|
|
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;
|
|
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"}
|
|
@@ -9,25 +9,29 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* Retrieve the list of accessible Drives in a Site.
|
|
11
11
|
* @param siteRef Reference to the site.
|
|
12
|
+
* @param take Maximum number of items to retrieve. Defaults to 1000.
|
|
12
13
|
* @returns Array of drives available for the specified site, each including its metadata and reference information.
|
|
13
14
|
* @see https://learn.microsoft.com/en-us/graph/api/drive-list
|
|
14
15
|
*/
|
|
15
|
-
export default function listDrives(siteRef) {
|
|
16
|
+
export default function listDrives(siteRef, take = 1000) {
|
|
16
17
|
return operation({
|
|
17
18
|
context: siteRef.context,
|
|
18
19
|
method: "GET",
|
|
19
|
-
path: generatePath(
|
|
20
|
+
path: generatePath(`/sites/{site-id}/drives?$top=${take}`, siteRef),
|
|
20
21
|
headers: {},
|
|
21
22
|
body: null,
|
|
22
23
|
responseTransform: (response) => {
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const result = response;
|
|
25
|
+
return {
|
|
26
|
+
drives: result.value.map((drive) => {
|
|
27
|
+
const driveRef = createDriveRef(siteRef, drive.id);
|
|
28
|
+
return {
|
|
29
|
+
...drive,
|
|
30
|
+
...driveRef,
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
33
|
+
nextLink: result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null,
|
|
34
|
+
};
|
|
31
35
|
},
|
|
32
36
|
});
|
|
33
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Retrieve the metadata for items in a drive or folder.
|
|
3
|
-
* @module
|
|
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
|
|
22
|
-
//# sourceMappingURL=
|
|
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,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Retrieve the metadata for items in a drive or folder.
|
|
3
|
-
* @module
|
|
3
|
+
* @module listDriveItems
|
|
4
4
|
* @category Operations
|
|
5
5
|
*/
|
|
6
6
|
import { createDriveItemRef } from "../../services/driveItem.js";
|
|
@@ -13,7 +13,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
13
13
|
* @returns Array of drive items, each including its metadata and reference information.
|
|
14
14
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-list-children
|
|
15
15
|
*/
|
|
16
|
-
export default function
|
|
16
|
+
export default function listDriveItems(parentRef, take = 1000) {
|
|
17
17
|
const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
|
|
18
18
|
return operation({
|
|
19
19
|
context: parentRef.context,
|
|
@@ -24,14 +24,14 @@ export default function listDriveItemChildren(parentRef, take = 1000) {
|
|
|
24
24
|
responseTransform: (response) => {
|
|
25
25
|
const result = response;
|
|
26
26
|
return {
|
|
27
|
-
|
|
27
|
+
items: result.value.map((item) => {
|
|
28
28
|
const itemRef = createDriveItemRef(parentRef, item.id);
|
|
29
29
|
return {
|
|
30
30
|
...item,
|
|
31
31
|
...itemRef,
|
|
32
32
|
};
|
|
33
33
|
}),
|
|
34
|
-
"@odata.nextLink"
|
|
34
|
+
nextLink: result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null,
|
|
35
35
|
};
|
|
36
36
|
},
|
|
37
37
|
});
|
|
@@ -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<
|
|
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
|
|
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"}
|
|
@@ -9,27 +9,29 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* List sites in your company geography.
|
|
11
11
|
* @param contextRef Reference to the context.
|
|
12
|
+
* @param take Maximum number of items to retrieve. Defaults to 1000.
|
|
12
13
|
* @returns Array of sites, each including its metadata and reference information.
|
|
13
14
|
* @see https://learn.microsoft.com/en-us/graph/api/site-list
|
|
14
15
|
*/
|
|
15
|
-
export default function listSites(contextRef) {
|
|
16
|
+
export default function listSites(contextRef, take = 1000) {
|
|
16
17
|
return operation({
|
|
17
18
|
context: contextRef.context,
|
|
18
19
|
method: "GET",
|
|
19
|
-
path: generatePath(
|
|
20
|
+
path: generatePath(`/sites?search=*&$top=${take}`, {}), // TODO: Implement search parameter properly. Without this not all are shown.
|
|
20
21
|
headers: {},
|
|
21
22
|
body: null,
|
|
22
23
|
responseTransform: (response) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
const result = response;
|
|
25
|
+
return {
|
|
26
|
+
sites: result.value.map((site) => {
|
|
27
|
+
const siteRef = createSiteRef(contextRef, site.id);
|
|
28
|
+
return {
|
|
29
|
+
...site,
|
|
30
|
+
...siteRef,
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
33
|
+
nextLink: result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null,
|
|
34
|
+
};
|
|
33
35
|
},
|
|
34
36
|
});
|
|
35
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Refresh all pivot tables in a worksheet.
|
|
3
|
-
* @module
|
|
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
|
|
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
|
|
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,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Refresh all pivot tables in a worksheet.
|
|
3
|
-
* @module
|
|
3
|
+
* @module refreshAllWorkbookPivotTables
|
|
4
4
|
* @category Operations
|
|
5
5
|
*/
|
|
6
6
|
import { operation } from "../../services/operationInvoker.js";
|
|
@@ -10,8 +10,23 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
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
|
|
29
|
+
export default function refreshAllWorkbookPivotTables(worksheetRef) {
|
|
15
30
|
return operation({
|
|
16
31
|
context: worksheetRef.context,
|
|
17
32
|
method: "POST",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Refresh a specific pivot table in a worksheet.
|
|
3
|
-
* @module
|
|
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
|
|
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
|
|
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,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Refresh a specific pivot table in a worksheet.
|
|
3
|
-
* @module
|
|
3
|
+
* @module refreshWorkbookPivotTable
|
|
4
4
|
* @category Operations
|
|
5
5
|
*/
|
|
6
6
|
import { operation } from "../../services/operationInvoker.js";
|
|
@@ -10,8 +10,25 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
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
|
|
31
|
+
export default function refreshWorkbookPivotTable(pivotTableRef) {
|
|
15
32
|
return operation({
|
|
16
33
|
context: pivotTableRef.context,
|
|
17
34
|
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,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for working with workbook pivot tables and their references.
|
|
3
|
+
* @module workbookPivotTable
|
|
4
|
+
* @category Services
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Creates a reference to a workbook pivot table.
|
|
8
|
+
* @param worksheetRef Reference to the worksheet containing the pivot table.
|
|
9
|
+
* @param pivotTableId ID of the pivot table.
|
|
10
|
+
* @returns Reference to the workbook pivot table.
|
|
11
|
+
* @throws Error if the pivot table ID is missing.
|
|
12
|
+
*/
|
|
13
|
+
export function createWorkbookPivotTableRef(worksheetRef, pivotTableId) {
|
|
14
|
+
if (!pivotTableId) {
|
|
15
|
+
throw new Error("TableId is missing");
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
context: worksheetRef.context,
|
|
19
|
+
siteId: worksheetRef.siteId,
|
|
20
|
+
driveId: worksheetRef.driveId,
|
|
21
|
+
itemId: worksheetRef.itemId,
|
|
22
|
+
worksheetId: worksheetRef.worksheetId,
|
|
23
|
+
sessionId: worksheetRef.sessionId,
|
|
24
|
+
pivotTableId: pivotTableId,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* List drive items in a drive or a drive item.
|
|
3
|
-
* @module
|
|
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
|
|
17
|
-
//# sourceMappingURL=
|
|
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,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* List drive items in a drive or a drive item.
|
|
3
|
-
* @module
|
|
3
|
+
* @module iterateDriveItems
|
|
4
4
|
* @category Tasks
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import listDriveItems from "../operations/driveItem/listDriveItems.js";
|
|
7
7
|
import { createDriveItemRef } from "../services/driveItem.js";
|
|
8
8
|
import { executeHttpRequest } from "../services/http.js";
|
|
9
9
|
/**
|
|
@@ -13,31 +13,25 @@ import { executeHttpRequest } from "../services/http.js";
|
|
|
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 async function*
|
|
17
|
-
let
|
|
18
|
-
for (const item of
|
|
19
|
-
|
|
20
|
-
yield {
|
|
21
|
-
...item,
|
|
22
|
-
...itemRef,
|
|
23
|
-
};
|
|
16
|
+
export default async function* iterateDriveItems(parentRef, maxPerChunk = 1000) {
|
|
17
|
+
let { items, nextLink } = await listDriveItems(parentRef, maxPerChunk);
|
|
18
|
+
for (const item of items) {
|
|
19
|
+
yield item;
|
|
24
20
|
}
|
|
25
|
-
while (
|
|
21
|
+
while (nextLink) {
|
|
26
22
|
const accessToken = await parentRef.context.generateAccessToken();
|
|
27
23
|
const response = await executeHttpRequest({
|
|
28
|
-
url:
|
|
24
|
+
url: nextLink.toString(),
|
|
29
25
|
method: "GET",
|
|
30
26
|
headers: {
|
|
31
27
|
authorization: `Bearer ${accessToken}`,
|
|
32
28
|
},
|
|
33
29
|
});
|
|
34
|
-
result = response.data;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
...itemRef,
|
|
40
|
-
};
|
|
30
|
+
const result = response.data;
|
|
31
|
+
const newItems = result.value.map((item) => (createDriveItemRef(parentRef, item.id) ? { ...item, ...createDriveItemRef(parentRef, item.id) } : item));
|
|
32
|
+
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
33
|
+
for (const item of newItems) {
|
|
34
|
+
yield item;
|
|
41
35
|
}
|
|
42
36
|
}
|
|
43
37
|
}
|
|
@@ -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,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List drives in a site as an async iterable.
|
|
3
|
+
* @module iterateDrives
|
|
4
|
+
* @category Tasks
|
|
5
|
+
*/
|
|
6
|
+
import listDrives from "../operations/drive/listDrives.js";
|
|
7
|
+
/**
|
|
8
|
+
* List drives in a site as an async iterable.
|
|
9
|
+
* @param siteRef Reference to the site.
|
|
10
|
+
* @param maxPerChunk Number of items to fetch per request. DO NOT SET EXCEPT FOR ADVANCED TUNING.
|
|
11
|
+
* @returns Async iterable of drives.
|
|
12
|
+
* @remarks `pageSize` should only be set for advanced performance tuning.
|
|
13
|
+
*/
|
|
14
|
+
export default async function* iterateDrives(siteRef, maxPerChunk = 1000) {
|
|
15
|
+
let { drives, nextLink } = await listDrives(siteRef, maxPerChunk);
|
|
16
|
+
for (const drive of drives) {
|
|
17
|
+
yield drive;
|
|
18
|
+
}
|
|
19
|
+
while (nextLink) {
|
|
20
|
+
const accessToken = await siteRef.context.generateAccessToken();
|
|
21
|
+
const response = await fetch(nextLink, {
|
|
22
|
+
headers: {
|
|
23
|
+
authorization: `Bearer ${accessToken}`,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const result = (await response.json());
|
|
27
|
+
drives = result.value;
|
|
28
|
+
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
29
|
+
for (const drive of drives) {
|
|
30
|
+
yield drive;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -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,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List sites in your company geography as an async iterable.
|
|
3
|
+
* @module iterateSites
|
|
4
|
+
* @category Tasks
|
|
5
|
+
*/
|
|
6
|
+
import listSites from "../operations/site/listSites.js";
|
|
7
|
+
/**
|
|
8
|
+
* List sites in your company geography as an async iterable.
|
|
9
|
+
* @param contextRef Reference to the context.
|
|
10
|
+
* @param maxPerChunk Number of items to fetch per request. DO NOT SET EXCEPT FOR ADVANCED TUNING.
|
|
11
|
+
* @returns Async iterable of sites.
|
|
12
|
+
* @remarks `pageSize` should only be set for advanced performance tuning.
|
|
13
|
+
*/
|
|
14
|
+
export default async function* iterateSites(contextRef, maxPerChunk = 1000) {
|
|
15
|
+
let { sites, nextLink } = await listSites(contextRef, maxPerChunk);
|
|
16
|
+
for (const site of sites) {
|
|
17
|
+
yield site;
|
|
18
|
+
}
|
|
19
|
+
while (nextLink) {
|
|
20
|
+
const accessToken = await contextRef.context.generateAccessToken();
|
|
21
|
+
const response = await fetch(nextLink, {
|
|
22
|
+
headers: {
|
|
23
|
+
authorization: `Bearer ${accessToken}`,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const result = (await response.json());
|
|
27
|
+
sites = result.value;
|
|
28
|
+
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
29
|
+
for (const site of sites) {
|
|
30
|
+
yield site;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|