1 | import { __decorate } from "tslib";
|
2 | import { defaultPath } from "../decorators.js";
|
3 | import { _SPInstance, spInvokableFactory, _SPCollection } from "../spqueryable.js";
|
4 | import { hOP } from "@pnp/core";
|
5 | import { spPost } from "../operations.js";
|
6 | import { body } from "@pnp/queryable";
|
7 | let _Favorites = class _Favorites extends _SPInstance {
|
8 | get followedSites() {
|
9 | return FollowedSites(this);
|
10 | }
|
11 | get followedListItems() {
|
12 | return FollowedListItems(this);
|
13 | }
|
14 | };
|
15 | _Favorites = __decorate([
|
16 | defaultPath("_api/v2.1/favorites")
|
17 | ], _Favorites);
|
18 | export { _Favorites };
|
19 | export const Favorites = (baseUrl) => new _Favorites(baseUrl);
|
20 | let _FollowedSites = class _FollowedSites extends _SPCollection {
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | async add(tenantUrl, siteId, webId, webUrl) {
|
30 | const data = await spPost(FollowedListItems(this, "oneDrive.add"), body({
|
31 | value: [
|
32 | {
|
33 | id: [tenantUrl, webId, siteId].join(","),
|
34 | webUrl: webUrl,
|
35 | },
|
36 | ],
|
37 | }));
|
38 | return hOP(data, "value") ? data.value : data;
|
39 | }
|
40 | |
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | async remove(tenantUrl, siteId, webId, webUrl) {
|
49 | await spPost(FollowedListItems(this, "oneDrive.remove"), body({
|
50 | value: [
|
51 | {
|
52 | id: [tenantUrl, webId, siteId].join(","),
|
53 | webUrl: webUrl,
|
54 | },
|
55 | ],
|
56 | }));
|
57 | }
|
58 | };
|
59 | _FollowedSites = __decorate([
|
60 | defaultPath("followedSites")
|
61 | ], _FollowedSites);
|
62 | export { _FollowedSites };
|
63 | export const FollowedSites = spInvokableFactory(_FollowedSites);
|
64 | let _FollowedListItems = class _FollowedListItems extends _SPCollection {
|
65 | |
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | async add(siteId, webId, listId, listItemUniqueId) {
|
74 | const data = await spPost(FollowedListItems(this, "oneDrive.add"), body({
|
75 | value: [
|
76 | {
|
77 | siteId: siteId,
|
78 | webId: webId,
|
79 | listId: listId,
|
80 | listItemUniqueId: listItemUniqueId,
|
81 | },
|
82 | ],
|
83 | }));
|
84 | return hOP(data, "value") ? data.value : data;
|
85 | }
|
86 | |
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | async remove(siteId, webId, listId, listItemUniqueId) {
|
95 | await spPost(FollowedListItems(this, "oneDrive.remove"), body({
|
96 | value: [
|
97 | {
|
98 | siteId: siteId,
|
99 | webId: webId,
|
100 | listId: listId,
|
101 | listItemUniqueId: listItemUniqueId,
|
102 | },
|
103 | ],
|
104 | }));
|
105 | }
|
106 | };
|
107 | _FollowedListItems = __decorate([
|
108 | defaultPath("followedListItems")
|
109 | ], _FollowedListItems);
|
110 | export { _FollowedListItems };
|
111 | export const FollowedListItems = spInvokableFactory(_FollowedListItems);
|
112 |
|
\ | No newline at end of file |