UNPKG

8.26 kBTypeScriptView Raw
1import { _SPInstance, ISPQueryable, SPInit } from "../spqueryable.js";
2export declare class _Social extends _SPInstance implements ISocial {
3 get my(): IMySocial;
4 getFollowedSitesUri(): Promise<string>;
5 getFollowedDocumentsUri(): Promise<string>;
6 follow(actorInfo: ISocialActorInfo): Promise<SocialFollowResult>;
7 isFollowed(actorInfo: ISocialActorInfo): Promise<boolean>;
8 stopFollowing(actorInfo: ISocialActorInfo): Promise<void>;
9 private createSocialActorInfoRequestBody;
10}
11/**
12 * Get a new Social instance for the particular Url
13 */
14export declare const Social: (baseUrl: SPInit) => ISocial;
15/**
16 * Current user's Social instance
17 */
18export declare class _MySocial extends _SPInstance {
19 followed(types: SocialActorTypes): Promise<ISocialActor[]>;
20 followedCount(types: SocialActorTypes): Promise<number>;
21 followers(): Promise<ISocialActor[]>;
22 suggestions(): Promise<ISocialActor[]>;
23}
24/**
25 * Invokable factory for IMySocial instances
26 */
27export declare const MySocial: (baseUrl: string | ISPQueryable, path?: string) => IMySocial;
28/**
29 * Describes the public methods for the Social interface
30 */
31export interface ISocial {
32 /**
33 * Access to the curren't user's social data
34 */
35 readonly my: IMySocial;
36 /**
37 * Get a list of followed sites for the current user.
38 */
39 getFollowedSitesUri(): Promise<string>;
40 /**
41 * Get a list of followed documents for the current user.
42 */
43 getFollowedDocumentsUri(): Promise<string>;
44 /**
45 * Follow an actor for the current user.
46 *
47 * @param actorInfo Provide the actor to follow.
48 */
49 follow(actorInfo: ISocialActorInfo): Promise<SocialFollowResult>;
50 /**
51 * Check if the current user is following the actor.
52 *
53 * @param actorInfo Provide the actor to check.
54 */
55 isFollowed(actorInfo: ISocialActorInfo): Promise<boolean>;
56 /**
57 * Stop following an actor for the current user.
58 *
59 * @param actorInfo Provide the actor to stop following.
60 */
61 stopFollowing(actorInfo: ISocialActorInfo): Promise<void>;
62}
63/**
64 * Defines the public methods exposed by the my endpoint
65 */
66export interface IMySocial {
67 /**
68 * Allow access to the v2 invokable
69 */
70 (this: IMySocial): Promise<IMySocialData>;
71 /**
72 * Gets users, documents, sites, and tags that the current user is following.
73 *
74 * @param types Bitwise set of SocialActorTypes to retrieve
75 */
76 followed(types: SocialActorTypes): Promise<ISocialActor[]>;
77 /**
78 * Gets the count of users, documents, sites, and tags that the current user is following.
79 *
80 * @param types Bitwise set of SocialActorTypes to retrieve
81 */
82 followedCount(types: SocialActorTypes): Promise<number>;
83 /**
84 * Gets the users who are following the current user.
85 */
86 followers(): Promise<ISocialActor[]>;
87 /**
88 * Gets users who the current user might want to follow.
89 */
90 suggestions(): Promise<ISocialActor[]>;
91}
92/**
93 * Social actor info
94 *
95 */
96export interface ISocialActorInfo {
97 AccountName?: string;
98 ActorType: SocialActorType;
99 ContentUri?: string;
100 Id?: string;
101 TagGuid?: string;
102}
103/**
104 * Social actor type
105 *
106 */
107export declare const enum SocialActorType {
108 User = 0,
109 Document = 1,
110 Site = 2,
111 Tag = 3
112}
113/**
114 * Social actor type
115 *
116 */
117export declare const enum SocialActorTypes {
118 None = 0,
119 User = 1,
120 Document = 2,
121 Site = 4,
122 Tag = 8,
123 /**
124 * The set excludes documents and sites that do not have feeds.
125 */
126 ExcludeContentWithoutFeeds = 268435456,
127 /**
128 * The set includes group sites
129 */
130 IncludeGroupsSites = 536870912,
131 /**
132 * The set includes only items created within the last 24 hours
133 */
134 WithinLast24Hours = 1073741824
135}
136/**
137 * Result from following
138 *
139 */
140export declare const enum SocialFollowResult {
141 Ok = 0,
142 AlreadyFollowing = 1,
143 LimitReached = 2,
144 InternalError = 3
145}
146/**
147 * Specifies an exception or status code.
148 */
149export declare const enum SocialStatusCode {
150 /**
151 * The operation completed successfully
152 */
153 OK = 0,
154 /**
155 * The request is invalid.
156 */
157 InvalidRequest = 1,
158 /**
159 * The current user is not authorized to perform the operation.
160 */
161 AccessDenied = 2,
162 /**
163 * The target of the operation was not found.
164 */
165 ItemNotFound = 3,
166 /**
167 * The operation is invalid for the target's current state.
168 */
169 InvalidOperation = 4,
170 /**
171 * The operation completed without modifying the target.
172 */
173 ItemNotModified = 5,
174 /**
175 * The operation failed because an internal error occurred.
176 */
177 InternalError = 6,
178 /**
179 * The operation failed because the server could not access the distributed cache.
180 */
181 CacheReadError = 7,
182 /**
183 * The operation succeeded but the server could not update the distributed cache.
184 */
185 CacheUpdateError = 8,
186 /**
187 * No personal site exists for the current user, and no further information is available.
188 */
189 PersonalSiteNotFound = 9,
190 /**
191 * No personal site exists for the current user, and a previous attempt to create one failed.
192 */
193 FailedToCreatePersonalSite = 10,
194 /**
195 * No personal site exists for the current user, and a previous attempt to create one was not authorized.
196 */
197 NotAuthorizedToCreatePersonalSite = 11,
198 /**
199 * No personal site exists for the current user, and no attempt should be made to create one.
200 */
201 CannotCreatePersonalSite = 12,
202 /**
203 * The operation was rejected because an internal limit had been reached.
204 */
205 LimitReached = 13,
206 /**
207 * The operation failed because an error occurred during the processing of the specified attachment.
208 */
209 AttachmentError = 14,
210 /**
211 * The operation succeeded with recoverable errors; the returned data is incomplete.
212 */
213 PartialData = 15,
214 /**
215 * A required SharePoint feature is not enabled.
216 */
217 FeatureDisabled = 16,
218 /**
219 * The site's storage quota has been exceeded.
220 */
221 StorageQuotaExceeded = 17,
222 /**
223 * The operation failed because the server could not access the database.
224 */
225 DatabaseError = 18
226}
227export interface ISocialActor {
228 /**
229 * Gets the actor type.
230 */
231 ActorType: SocialActorType;
232 /**
233 * Gets the actor's unique identifier.
234 */
235 Id: string;
236 /**
237 * Gets the actor's canonical URI.
238 */
239 Uri: string;
240 /**
241 * Gets the actor's display name.
242 */
243 Name: string;
244 /**
245 * Returns true if the current user is following the actor, false otherwise.
246 */
247 IsFollowed: boolean;
248 /**
249 * Gets a code that indicates recoverable errors that occurred during actor retrieval
250 */
251 Status: SocialStatusCode;
252 /**
253 * Returns true if the Actor can potentially be followed, false otherwise.
254 */
255 CanFollow: boolean;
256 /**
257 * Gets the actor's image URI. Only valid when ActorType is User, Document, or Site
258 */
259 ImageUri: string;
260 /**
261 * Gets the actor's account name. Only valid when ActorType is User
262 */
263 AccountName: string;
264 /**
265 * Gets the actor's email address. Only valid when ActorType is User
266 */
267 EmailAddress: string;
268 /**
269 * Gets the actor's title. Only valid when ActorType is User
270 */
271 Title: string;
272 /**
273 * Gets the text of the actor's most recent post. Only valid when ActorType is User
274 */
275 StatusText: string;
276 /**
277 * Gets the URI of the actor's personal site. Only valid when ActorType is User
278 */
279 PersonalSiteUri: string;
280 /**
281 * Gets the URI of the actor's followed content folder. Only valid when this represents the current user
282 */
283 FollowedContentUri: string;
284 /**
285 * Gets the actor's content URI. Only valid when ActorType is Document, or Site
286 */
287 ContentUri: string;
288 /**
289 * Gets the actor's library URI. Only valid when ActorType is Document
290 */
291 LibraryUri: string;
292 /**
293 * Gets the actor's tag GUID. Only valid when ActorType is Tag
294 */
295 TagGuid: string;
296}
297/**
298 * Defines the properties returned from the my endpoint
299 */
300export interface IMySocialData {
301 SocialActor: ISocialActor;
302 MyFollowedDocumentsUri: string;
303 MyFollowedSitesUri: string;
304}
305//# sourceMappingURL=types.d.ts.map
\No newline at end of file