universal-social-sdk 1.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.
@@ -0,0 +1,664 @@
1
+ import * as axios from 'axios';
2
+
3
+ declare class Instagram {
4
+ static uploadPhoto(input: {
5
+ igUserId?: string;
6
+ imageUrl: string;
7
+ caption?: string;
8
+ }): Promise<unknown>;
9
+ static uploadVideo(input: {
10
+ igUserId?: string;
11
+ videoUrl: string;
12
+ caption?: string;
13
+ }): Promise<unknown>;
14
+ static uploadReel(input: {
15
+ igUserId?: string;
16
+ mediaPath?: string;
17
+ videoUrl: string;
18
+ caption?: string;
19
+ }): Promise<unknown>;
20
+ static uploadStoryPhoto(input: {
21
+ igUserId?: string;
22
+ imageUrl: string;
23
+ }): Promise<unknown>;
24
+ static uploadStoryVideo(input: {
25
+ igUserId?: string;
26
+ videoUrl: string;
27
+ }): Promise<unknown>;
28
+ static publishCarousel(input: {
29
+ igUserId?: string;
30
+ caption?: string;
31
+ items: Array<{
32
+ imageUrl?: string;
33
+ videoUrl?: string;
34
+ }>;
35
+ }): Promise<unknown>;
36
+ static commentOnMedia(input: {
37
+ mediaId: string;
38
+ message: string;
39
+ }): Promise<unknown>;
40
+ static replyToComment(input: {
41
+ commentId: string;
42
+ message: string;
43
+ }): Promise<unknown>;
44
+ static hideComment(input: {
45
+ commentId: string;
46
+ hide: boolean;
47
+ }): Promise<unknown>;
48
+ static deleteComment(input: {
49
+ commentId: string;
50
+ }): Promise<unknown>;
51
+ static deleteMedia(input: {
52
+ mediaId: string;
53
+ }): Promise<unknown>;
54
+ static sendPrivateReply(input: {
55
+ commentId: string;
56
+ message: string;
57
+ }): Promise<unknown>;
58
+ static getMediaInsights(input: {
59
+ mediaId: string;
60
+ metrics?: string[];
61
+ }): Promise<unknown>;
62
+ static getAccountInsights(input: {
63
+ igUserId?: string;
64
+ metrics?: string[];
65
+ period?: "day" | "week" | "days_28";
66
+ }): Promise<unknown>;
67
+ static getPublishingLimit(input: {
68
+ igUserId?: string;
69
+ }): Promise<unknown>;
70
+ static scheduleReel(input: {
71
+ igUserId?: string;
72
+ videoUrl: string;
73
+ caption?: string;
74
+ publishAt: Date | string;
75
+ }): Promise<unknown>;
76
+ }
77
+
78
+ interface PostTweetInput {
79
+ text: string;
80
+ mediaIds?: string[];
81
+ }
82
+ interface ReplyTweetInput {
83
+ text: string;
84
+ inReplyToTweetId: string;
85
+ }
86
+ interface QuoteTweetInput {
87
+ text: string;
88
+ quoteTweetId: string;
89
+ }
90
+ interface PostMediaInput {
91
+ mediaPath: string;
92
+ text: string;
93
+ }
94
+ interface PollTweetInput {
95
+ text: string;
96
+ options: string[];
97
+ durationMinutes: number;
98
+ }
99
+ declare class X {
100
+ static postTweet(input: PostTweetInput): Promise<any>;
101
+ static postThread(input: {
102
+ tweets: string[];
103
+ }): Promise<unknown[]>;
104
+ static replyTweet(input: ReplyTweetInput): Promise<any>;
105
+ static quoteTweet(input: QuoteTweetInput): Promise<any>;
106
+ static deleteTweet(input: {
107
+ tweetId: string;
108
+ }): Promise<any>;
109
+ static retweet(input: {
110
+ userId: string;
111
+ tweetId: string;
112
+ }): Promise<any>;
113
+ static unretweet(input: {
114
+ userId: string;
115
+ tweetId: string;
116
+ }): Promise<any>;
117
+ static likeTweet(input: {
118
+ userId: string;
119
+ tweetId: string;
120
+ }): Promise<any>;
121
+ static unlikeTweet(input: {
122
+ userId: string;
123
+ tweetId: string;
124
+ }): Promise<any>;
125
+ static uploadMedia(input: {
126
+ mediaPath: string;
127
+ }): Promise<string>;
128
+ static postPhoto(input: PostMediaInput): Promise<any>;
129
+ static postVideo(input: PostMediaInput): Promise<any>;
130
+ static postPoll(input: PollTweetInput): Promise<any>;
131
+ static sendDirectMessage(input: {
132
+ recipientId: string;
133
+ text: string;
134
+ }): Promise<any>;
135
+ static getTweetAnalytics(input: {
136
+ tweetId: string;
137
+ }): Promise<any>;
138
+ static scheduleTweet(input: {
139
+ text: string;
140
+ publishAt: Date | string;
141
+ }): Promise<any>;
142
+ }
143
+
144
+ declare class Facebook {
145
+ static publishToPage(input: {
146
+ pageId?: string;
147
+ message: string;
148
+ link?: string;
149
+ photoUrl?: string;
150
+ }): Promise<unknown>;
151
+ static publishPhoto(input: {
152
+ pageId?: string;
153
+ url: string;
154
+ caption?: string;
155
+ }): Promise<unknown>;
156
+ static publishVideo(input: {
157
+ pageId?: string;
158
+ fileUrl: string;
159
+ description?: string;
160
+ title?: string;
161
+ }): Promise<unknown>;
162
+ static publishCarousel(input: {
163
+ pageId?: string;
164
+ message: string;
165
+ photoUrls: string[];
166
+ }): Promise<unknown>;
167
+ static publishStory(input: {
168
+ pageId?: string;
169
+ photoUrl: string;
170
+ }): Promise<unknown>;
171
+ static schedulePost(input: {
172
+ pageId?: string;
173
+ message: string;
174
+ publishAt: Date | string;
175
+ }): Promise<unknown>;
176
+ static commentOnPost(input: {
177
+ postId: string;
178
+ message: string;
179
+ }): Promise<unknown>;
180
+ static replyToComment(input: {
181
+ commentId: string;
182
+ message: string;
183
+ }): Promise<unknown>;
184
+ static likeObject(input: {
185
+ objectId: string;
186
+ }): Promise<unknown>;
187
+ static deletePost(input: {
188
+ objectId: string;
189
+ }): Promise<unknown>;
190
+ static sendPageMessage(input: {
191
+ recipientPsid: string;
192
+ message: string;
193
+ pageId?: string;
194
+ }): Promise<unknown>;
195
+ static getPostInsights(input: {
196
+ postId: string;
197
+ metrics?: string[];
198
+ }): Promise<unknown>;
199
+ static getPageInsights(input: {
200
+ pageId?: string;
201
+ metrics?: string[];
202
+ period?: "day" | "week" | "days_28";
203
+ }): Promise<unknown>;
204
+ static uploadResumableVideo(input: {
205
+ pageId?: string;
206
+ fileSize: number;
207
+ startOffset?: number;
208
+ }): Promise<unknown>;
209
+ static listPublishedPosts(input: {
210
+ pageId?: string;
211
+ limit?: number;
212
+ }): Promise<unknown>;
213
+ static scheduleInProcess(input: {
214
+ publishAt: Date | string;
215
+ action: () => Promise<unknown>;
216
+ }): Promise<unknown>;
217
+ }
218
+
219
+ declare class LinkedIn {
220
+ static createTextPost(input: {
221
+ author?: string;
222
+ text: string;
223
+ visibility?: "PUBLIC" | "CONNECTIONS";
224
+ }): Promise<unknown>;
225
+ static createImagePost(input: {
226
+ author?: string;
227
+ text: string;
228
+ mediaUrn: string;
229
+ }): Promise<unknown>;
230
+ static createVideoPost(input: {
231
+ author?: string;
232
+ text: string;
233
+ mediaUrn: string;
234
+ }): Promise<unknown>;
235
+ static createCarouselPost(input: {
236
+ author?: string;
237
+ text: string;
238
+ mediaUrns: string[];
239
+ }): Promise<unknown>;
240
+ static schedulePost(input: {
241
+ author?: string;
242
+ text: string;
243
+ publishAt: Date | string;
244
+ }): Promise<unknown>;
245
+ static commentOnPost(input: {
246
+ actor?: string;
247
+ objectUrn: string;
248
+ message: string;
249
+ }): Promise<unknown>;
250
+ static replyToComment(input: {
251
+ actor?: string;
252
+ parentCommentUrn: string;
253
+ message: string;
254
+ }): Promise<unknown>;
255
+ static deleteComment(input: {
256
+ encodedCommentUrn: string;
257
+ }): Promise<unknown>;
258
+ static likePost(input: {
259
+ actor?: string;
260
+ objectUrn: string;
261
+ }): Promise<unknown>;
262
+ static unlikePost(input: {
263
+ actorUrn?: string;
264
+ encodedObjectUrn: string;
265
+ }): Promise<unknown>;
266
+ static sendDirectMessage(input: {
267
+ actor?: string;
268
+ recipientUrn: string;
269
+ text: string;
270
+ }): Promise<unknown>;
271
+ static getPostAnalytics(input: {
272
+ postUrn: string;
273
+ }): Promise<unknown>;
274
+ static getOrganizationAnalytics(input: {
275
+ orgUrn?: string;
276
+ }): Promise<unknown>;
277
+ static registerUpload(input: {
278
+ owner?: string;
279
+ mediaType: "image" | "video";
280
+ fileSize: number;
281
+ }): Promise<{
282
+ value: {
283
+ uploadMechanism: Record<string, unknown>;
284
+ asset: string;
285
+ };
286
+ }>;
287
+ static uploadBinary(input: {
288
+ uploadUrl: string;
289
+ mediaPath: string;
290
+ }): Promise<axios.AxiosResponse<any, any, {}>>;
291
+ static deletePost(input: {
292
+ encodedPostUrn: string;
293
+ }): Promise<unknown>;
294
+ }
295
+
296
+ declare class YouTube {
297
+ static createVideoUploadSession(input: {
298
+ title: string;
299
+ description?: string;
300
+ privacyStatus?: "private" | "public" | "unlisted";
301
+ }): Promise<unknown>;
302
+ static uploadBinary(input: {
303
+ uploadUrl: string;
304
+ mediaPath: string;
305
+ }): Promise<axios.AxiosResponse<any, any, {}>>;
306
+ static listMyVideos(input: {
307
+ maxResults?: number;
308
+ }): Promise<unknown>;
309
+ static updateVideoMetadata(input: {
310
+ videoId: string;
311
+ title?: string;
312
+ description?: string;
313
+ privacyStatus?: "private" | "public" | "unlisted";
314
+ }): Promise<unknown>;
315
+ static deleteVideo(input: {
316
+ videoId: string;
317
+ }): Promise<unknown>;
318
+ static commentOnVideo(input: {
319
+ videoId: string;
320
+ text: string;
321
+ }): Promise<unknown>;
322
+ static replyToComment(input: {
323
+ parentCommentId: string;
324
+ text: string;
325
+ }): Promise<unknown>;
326
+ static likeVideo(input: {
327
+ videoId: string;
328
+ }): Promise<unknown>;
329
+ static unlikeVideo(input: {
330
+ videoId: string;
331
+ }): Promise<unknown>;
332
+ static createPlaylist(input: {
333
+ title: string;
334
+ description?: string;
335
+ privacyStatus?: "private" | "public" | "unlisted";
336
+ }): Promise<unknown>;
337
+ static addVideoToPlaylist(input: {
338
+ playlistId: string;
339
+ videoId: string;
340
+ }): Promise<unknown>;
341
+ static getChannelAnalytics(input: {
342
+ startDate: string;
343
+ endDate: string;
344
+ metrics?: string;
345
+ }): Promise<any>;
346
+ static scheduleVideoMetadataUpdate(input: {
347
+ videoId: string;
348
+ title?: string;
349
+ description?: string;
350
+ privacyStatus?: "private" | "public" | "unlisted";
351
+ publishAt: Date | string;
352
+ }): Promise<unknown>;
353
+ }
354
+
355
+ declare class TikTok {
356
+ static createPost(input: {
357
+ text: string;
358
+ visibility?: "PUBLIC_TO_EVERYONE" | "MUTUAL_FOLLOW_FRIENDS" | "SELF_ONLY";
359
+ }): Promise<unknown>;
360
+ static createVideoPost(input: {
361
+ title: string;
362
+ videoUrl: string;
363
+ visibility?: "PUBLIC_TO_EVERYONE" | "MUTUAL_FOLLOW_FRIENDS" | "SELF_ONLY";
364
+ }): Promise<unknown>;
365
+ static getPostStatus(input: {
366
+ publishId: string;
367
+ }): Promise<unknown>;
368
+ static listVideos(input: {
369
+ maxCount?: number;
370
+ }): Promise<unknown>;
371
+ static deleteVideo(input: {
372
+ videoId: string;
373
+ }): Promise<unknown>;
374
+ static commentOnVideo(input: {
375
+ videoId: string;
376
+ text: string;
377
+ }): Promise<unknown>;
378
+ static replyToComment(input: {
379
+ commentId: string;
380
+ text: string;
381
+ }): Promise<unknown>;
382
+ static likeVideo(input: {
383
+ videoId: string;
384
+ }): Promise<unknown>;
385
+ static unlikeVideo(input: {
386
+ videoId: string;
387
+ }): Promise<unknown>;
388
+ static getVideoAnalytics(input: {
389
+ videoIds: string[];
390
+ }): Promise<unknown>;
391
+ static getProfileAnalytics(input: {
392
+ fields?: string[];
393
+ }): Promise<unknown>;
394
+ static scheduleVideoPost(input: {
395
+ title: string;
396
+ videoUrl: string;
397
+ publishAt: Date | string;
398
+ }): Promise<unknown>;
399
+ }
400
+
401
+ declare class Pinterest {
402
+ static createPin(input: {
403
+ boardId?: string;
404
+ title: string;
405
+ description?: string;
406
+ link?: string;
407
+ mediaSourceUrl: string;
408
+ }): Promise<unknown>;
409
+ static createVideoPin(input: {
410
+ boardId?: string;
411
+ title: string;
412
+ description?: string;
413
+ mediaSourceUrl: string;
414
+ }): Promise<unknown>;
415
+ static updatePin(input: {
416
+ pinId: string;
417
+ title?: string;
418
+ description?: string;
419
+ link?: string;
420
+ }): Promise<unknown>;
421
+ static deletePin(input: {
422
+ pinId: string;
423
+ }): Promise<unknown>;
424
+ static listPins(input: {
425
+ boardId?: string;
426
+ pageSize?: number;
427
+ }): Promise<unknown>;
428
+ static createBoard(input: {
429
+ name: string;
430
+ description?: string;
431
+ privacy?: "PUBLIC" | "PROTECTED" | "SECRET";
432
+ }): Promise<unknown>;
433
+ static listBoards(input: {
434
+ pageSize?: number;
435
+ }): Promise<unknown>;
436
+ static commentOnPin(input: {
437
+ pinId: string;
438
+ text: string;
439
+ }): Promise<unknown>;
440
+ static replyToComment(input: {
441
+ pinId: string;
442
+ commentId: string;
443
+ text: string;
444
+ }): Promise<unknown>;
445
+ static getPinAnalytics(input: {
446
+ pinId: string;
447
+ startDate: string;
448
+ endDate: string;
449
+ }): Promise<unknown>;
450
+ static getAccountAnalytics(input: {
451
+ startDate: string;
452
+ endDate: string;
453
+ }): Promise<unknown>;
454
+ static schedulePin(input: {
455
+ title: string;
456
+ mediaSourceUrl: string;
457
+ boardId?: string;
458
+ publishAt: Date | string;
459
+ }): Promise<unknown>;
460
+ }
461
+
462
+ declare class Bluesky {
463
+ static postText(input: {
464
+ text: string;
465
+ }): Promise<unknown>;
466
+ static postWithLink(input: {
467
+ text: string;
468
+ url: string;
469
+ }): Promise<unknown>;
470
+ static replyToPost(input: {
471
+ text: string;
472
+ rootUri: string;
473
+ rootCid: string;
474
+ parentUri: string;
475
+ parentCid: string;
476
+ }): Promise<unknown>;
477
+ static likePost(input: {
478
+ subjectUri: string;
479
+ subjectCid: string;
480
+ }): Promise<unknown>;
481
+ static repost(input: {
482
+ subjectUri: string;
483
+ subjectCid: string;
484
+ }): Promise<unknown>;
485
+ static deleteRecord(input: {
486
+ uri: string;
487
+ }): Promise<unknown>;
488
+ static getAuthorFeed(input: {
489
+ actorDidOrHandle: string;
490
+ limit?: number;
491
+ }): Promise<unknown>;
492
+ static searchPosts(input: {
493
+ query: string;
494
+ limit?: number;
495
+ }): Promise<unknown>;
496
+ static getPostThread(input: {
497
+ uri: string;
498
+ depth?: number;
499
+ }): Promise<unknown>;
500
+ static getNotificationFeed(input: {
501
+ limit?: number;
502
+ }): Promise<unknown>;
503
+ static schedulePost(input: {
504
+ text: string;
505
+ publishAt: Date | string;
506
+ }): Promise<unknown>;
507
+ }
508
+
509
+ declare class Mastodon {
510
+ static createStatus(input: {
511
+ text: string;
512
+ visibility?: "public" | "unlisted" | "private" | "direct";
513
+ }): Promise<unknown>;
514
+ static uploadMedia(input: {
515
+ mediaPath: string;
516
+ description?: string;
517
+ }): Promise<axios.AxiosResponse<any, any, {}>>;
518
+ static createMediaStatus(input: {
519
+ text: string;
520
+ mediaIds: string[];
521
+ visibility?: "public" | "unlisted" | "private" | "direct";
522
+ }): Promise<unknown>;
523
+ static replyToStatus(input: {
524
+ statusId: string;
525
+ text: string;
526
+ }): Promise<unknown>;
527
+ static deleteStatus(input: {
528
+ statusId: string;
529
+ }): Promise<unknown>;
530
+ static favouriteStatus(input: {
531
+ statusId: string;
532
+ }): Promise<unknown>;
533
+ static unfavouriteStatus(input: {
534
+ statusId: string;
535
+ }): Promise<unknown>;
536
+ static boostStatus(input: {
537
+ statusId: string;
538
+ }): Promise<unknown>;
539
+ static unboostStatus(input: {
540
+ statusId: string;
541
+ }): Promise<unknown>;
542
+ static listMyStatuses(input: {
543
+ limit?: number;
544
+ }): Promise<unknown>;
545
+ static getStatusContext(input: {
546
+ statusId: string;
547
+ }): Promise<unknown>;
548
+ static getAccountAnalytics(input: {
549
+ instanceScope?: "day" | "week" | "month";
550
+ }): Promise<unknown>;
551
+ static scheduleStatus(input: {
552
+ text: string;
553
+ publishAt: Date | string;
554
+ }): Promise<unknown>;
555
+ }
556
+
557
+ declare class Threads {
558
+ static postText(input: {
559
+ threadsUserId?: string;
560
+ text: string;
561
+ }): Promise<unknown>;
562
+ static postImage(input: {
563
+ threadsUserId?: string;
564
+ text?: string;
565
+ imageUrl: string;
566
+ }): Promise<unknown>;
567
+ static postVideo(input: {
568
+ threadsUserId?: string;
569
+ text?: string;
570
+ videoUrl: string;
571
+ }): Promise<unknown>;
572
+ static replyToThread(input: {
573
+ threadsUserId?: string;
574
+ threadId: string;
575
+ text: string;
576
+ }): Promise<unknown>;
577
+ static deleteThread(input: {
578
+ threadId: string;
579
+ }): Promise<unknown>;
580
+ static getThread(input: {
581
+ threadId: string;
582
+ fields?: string[];
583
+ }): Promise<unknown>;
584
+ static listMyThreads(input: {
585
+ threadsUserId?: string;
586
+ limit?: number;
587
+ }): Promise<unknown>;
588
+ static getThreadInsights(input: {
589
+ threadId: string;
590
+ metrics?: string[];
591
+ }): Promise<unknown>;
592
+ static getAccountInsights(input: {
593
+ threadsUserId?: string;
594
+ metrics?: string[];
595
+ period?: "day" | "week" | "days_28";
596
+ }): Promise<unknown>;
597
+ static likeThread(input: {
598
+ threadId: string;
599
+ }): Promise<unknown>;
600
+ static unlikeThread(input: {
601
+ threadId: string;
602
+ }): Promise<unknown>;
603
+ static scheduleTextPost(input: {
604
+ threadsUserId?: string;
605
+ text: string;
606
+ publishAt: Date | string;
607
+ }): Promise<unknown>;
608
+ }
609
+
610
+ type Platform = "x" | "facebook" | "instagram" | "linkedin" | "youtube" | "tiktok" | "pinterest" | "bluesky" | "mastodon" | "threads";
611
+ interface BaseResult<T = unknown> {
612
+ ok: boolean;
613
+ platform: Platform;
614
+ endpoint: string;
615
+ data: T;
616
+ }
617
+ interface RetryOptions {
618
+ retries?: number;
619
+ baseDelayMs?: number;
620
+ }
621
+ interface MediaUploadOptions {
622
+ mediaPath: string;
623
+ mimeType?: string;
624
+ fileName?: string;
625
+ onProgress?: (percent: number) => void;
626
+ }
627
+ interface ScheduleOptions {
628
+ publishAt: Date | string;
629
+ }
630
+ interface AnalyticsRange {
631
+ since?: string;
632
+ until?: string;
633
+ }
634
+
635
+ declare class SocialError extends Error {
636
+ readonly platform: Platform;
637
+ readonly endpoint: string;
638
+ readonly statusCode?: number;
639
+ readonly details?: unknown;
640
+ readonly cause?: unknown;
641
+ constructor(params: {
642
+ platform: Platform;
643
+ endpoint: string;
644
+ message: string;
645
+ statusCode?: number;
646
+ details?: unknown;
647
+ cause?: unknown;
648
+ });
649
+ toJSON(): {
650
+ name: string;
651
+ message: string;
652
+ platform: Platform;
653
+ endpoint: string;
654
+ statusCode: number | undefined;
655
+ details: unknown;
656
+ };
657
+ static normalize(params: {
658
+ platform: Platform;
659
+ endpoint: string;
660
+ error: unknown;
661
+ }): SocialError;
662
+ }
663
+
664
+ export { type AnalyticsRange, type BaseResult, Bluesky, Facebook, Instagram, LinkedIn, Mastodon, type MediaUploadOptions, Pinterest, type Platform, type RetryOptions, type ScheduleOptions, SocialError, Threads, TikTok, X, YouTube };