1 | import { __decorate } from "tslib";
|
2 | import { _SPInstance, } from "../spqueryable.js";
|
3 | import { defaultPath } from "../decorators.js";
|
4 | import { hOP } from "@pnp/core";
|
5 | import { body } from "@pnp/queryable";
|
6 | import { spPost } from "../operations.js";
|
7 | let _Social = class _Social extends _SPInstance {
|
8 | get my() {
|
9 | return MySocial(this);
|
10 | }
|
11 | async getFollowedSitesUri() {
|
12 | const r = await SocialCloneFactory(this, "FollowedSitesUri")();
|
13 | return r.FollowedSitesUri || r;
|
14 | }
|
15 | async getFollowedDocumentsUri() {
|
16 | const r = await SocialCloneFactory(this, "FollowedDocumentsUri")();
|
17 | return r.FollowedDocumentsUri || r;
|
18 | }
|
19 | async follow(actorInfo) {
|
20 | return await spPost(SocialCloneFactory(this, "follow"), this.createSocialActorInfoRequestBody(actorInfo));
|
21 | }
|
22 | async isFollowed(actorInfo) {
|
23 | return await spPost(SocialCloneFactory(this, "isfollowed"), this.createSocialActorInfoRequestBody(actorInfo));
|
24 | }
|
25 | async stopFollowing(actorInfo) {
|
26 | return await spPost(SocialCloneFactory(this, "stopfollowing"), this.createSocialActorInfoRequestBody(actorInfo));
|
27 | }
|
28 | createSocialActorInfoRequestBody(actorInfo) {
|
29 | return body({
|
30 | "actor": {
|
31 | Id: null,
|
32 | ...actorInfo,
|
33 | },
|
34 | });
|
35 | }
|
36 | };
|
37 | _Social = __decorate([
|
38 | defaultPath("_api/social.following")
|
39 | ], _Social);
|
40 | export { _Social };
|
41 |
|
42 |
|
43 |
|
44 | export const Social = (baseUrl) => new _Social(baseUrl);
|
45 | const SocialCloneFactory = (baseUrl, paths) => new _Social(baseUrl, paths);
|
46 |
|
47 |
|
48 |
|
49 | let _MySocial = class _MySocial extends _SPInstance {
|
50 | async followed(types) {
|
51 | const r = await MySocialCloneFactory(this, `followed(types=${types})`)();
|
52 | return hOP(r, "Followed") ? r.Followed.results : r;
|
53 | }
|
54 | async followedCount(types) {
|
55 | const r = await MySocialCloneFactory(this, `followedcount(types=${types})`)();
|
56 | return r.FollowedCount || r;
|
57 | }
|
58 | async followers() {
|
59 | const r = await MySocialCloneFactory(this, "followers")();
|
60 | return hOP(r, "Followers") ? r.Followers.results : r;
|
61 | }
|
62 | async suggestions() {
|
63 | const r = await MySocialCloneFactory(this, "suggestions")();
|
64 | return hOP(r, "Suggestions") ? r.Suggestions.results : r;
|
65 | }
|
66 | };
|
67 | _MySocial = __decorate([
|
68 | defaultPath("my")
|
69 | ], _MySocial);
|
70 | export { _MySocial };
|
71 |
|
72 |
|
73 |
|
74 | export const MySocial = (baseUrl, path) => new _MySocial(baseUrl, path);
|
75 | const MySocialCloneFactory = (baseUrl, path) => new _MySocial(baseUrl, path);
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | export var SocialActorType;
|
81 | (function (SocialActorType) {
|
82 | SocialActorType[SocialActorType["User"] = 0] = "User";
|
83 | SocialActorType[SocialActorType["Document"] = 1] = "Document";
|
84 | SocialActorType[SocialActorType["Site"] = 2] = "Site";
|
85 | SocialActorType[SocialActorType["Tag"] = 3] = "Tag";
|
86 | })(SocialActorType || (SocialActorType = {}));
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | export var SocialActorTypes;
|
93 | (function (SocialActorTypes) {
|
94 | SocialActorTypes[SocialActorTypes["None"] = 0] = "None";
|
95 | SocialActorTypes[SocialActorTypes["User"] = 1] = "User";
|
96 | SocialActorTypes[SocialActorTypes["Document"] = 2] = "Document";
|
97 | SocialActorTypes[SocialActorTypes["Site"] = 4] = "Site";
|
98 | SocialActorTypes[SocialActorTypes["Tag"] = 8] = "Tag";
|
99 | |
100 |
|
101 |
|
102 | SocialActorTypes[SocialActorTypes["ExcludeContentWithoutFeeds"] = 268435456] = "ExcludeContentWithoutFeeds";
|
103 | |
104 |
|
105 |
|
106 | SocialActorTypes[SocialActorTypes["IncludeGroupsSites"] = 536870912] = "IncludeGroupsSites";
|
107 | |
108 |
|
109 |
|
110 | SocialActorTypes[SocialActorTypes["WithinLast24Hours"] = 1073741824] = "WithinLast24Hours";
|
111 | })(SocialActorTypes || (SocialActorTypes = {}));
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 | export var SocialFollowResult;
|
118 | (function (SocialFollowResult) {
|
119 | SocialFollowResult[SocialFollowResult["Ok"] = 0] = "Ok";
|
120 | SocialFollowResult[SocialFollowResult["AlreadyFollowing"] = 1] = "AlreadyFollowing";
|
121 | SocialFollowResult[SocialFollowResult["LimitReached"] = 2] = "LimitReached";
|
122 | SocialFollowResult[SocialFollowResult["InternalError"] = 3] = "InternalError";
|
123 | })(SocialFollowResult || (SocialFollowResult = {}));
|
124 |
|
125 |
|
126 |
|
127 | export var SocialStatusCode;
|
128 | (function (SocialStatusCode) {
|
129 | |
130 |
|
131 |
|
132 | SocialStatusCode[SocialStatusCode["OK"] = 0] = "OK";
|
133 | |
134 |
|
135 |
|
136 | SocialStatusCode[SocialStatusCode["InvalidRequest"] = 1] = "InvalidRequest";
|
137 | |
138 |
|
139 |
|
140 | SocialStatusCode[SocialStatusCode["AccessDenied"] = 2] = "AccessDenied";
|
141 | |
142 |
|
143 |
|
144 | SocialStatusCode[SocialStatusCode["ItemNotFound"] = 3] = "ItemNotFound";
|
145 | |
146 |
|
147 |
|
148 | SocialStatusCode[SocialStatusCode["InvalidOperation"] = 4] = "InvalidOperation";
|
149 | |
150 |
|
151 |
|
152 | SocialStatusCode[SocialStatusCode["ItemNotModified"] = 5] = "ItemNotModified";
|
153 | |
154 |
|
155 |
|
156 | SocialStatusCode[SocialStatusCode["InternalError"] = 6] = "InternalError";
|
157 | |
158 |
|
159 |
|
160 | SocialStatusCode[SocialStatusCode["CacheReadError"] = 7] = "CacheReadError";
|
161 | |
162 |
|
163 |
|
164 | SocialStatusCode[SocialStatusCode["CacheUpdateError"] = 8] = "CacheUpdateError";
|
165 | |
166 |
|
167 |
|
168 | SocialStatusCode[SocialStatusCode["PersonalSiteNotFound"] = 9] = "PersonalSiteNotFound";
|
169 | |
170 |
|
171 |
|
172 | SocialStatusCode[SocialStatusCode["FailedToCreatePersonalSite"] = 10] = "FailedToCreatePersonalSite";
|
173 | |
174 |
|
175 |
|
176 | SocialStatusCode[SocialStatusCode["NotAuthorizedToCreatePersonalSite"] = 11] = "NotAuthorizedToCreatePersonalSite";
|
177 | |
178 |
|
179 |
|
180 | SocialStatusCode[SocialStatusCode["CannotCreatePersonalSite"] = 12] = "CannotCreatePersonalSite";
|
181 | |
182 |
|
183 |
|
184 | SocialStatusCode[SocialStatusCode["LimitReached"] = 13] = "LimitReached";
|
185 | |
186 |
|
187 |
|
188 | SocialStatusCode[SocialStatusCode["AttachmentError"] = 14] = "AttachmentError";
|
189 | |
190 |
|
191 |
|
192 | SocialStatusCode[SocialStatusCode["PartialData"] = 15] = "PartialData";
|
193 | |
194 |
|
195 |
|
196 | SocialStatusCode[SocialStatusCode["FeatureDisabled"] = 16] = "FeatureDisabled";
|
197 | |
198 |
|
199 |
|
200 | SocialStatusCode[SocialStatusCode["StorageQuotaExceeded"] = 17] = "StorageQuotaExceeded";
|
201 | |
202 |
|
203 |
|
204 | SocialStatusCode[SocialStatusCode["DatabaseError"] = 18] = "DatabaseError";
|
205 | })(SocialStatusCode || (SocialStatusCode = {}));
|
206 |
|
\ | No newline at end of file |