@posty5/social-publisher-post 2.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/README.md +957 -0
- package/dist/index.d.mts +835 -0
- package/dist/index.d.ts +835 -0
- package/dist/index.js +444 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +442 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,835 @@
|
|
|
1
|
+
import { IPaginationResponse, HttpClient, IPaginationParams } from '@posty5/core';
|
|
2
|
+
|
|
3
|
+
type SocialPublisherPostStatusType = "pending" | "processing" | "processingInPlatform" | "failedByPlatform" | "done" | "error" | "canceled" | "needsMaintenance" | "invalidVideoURL" | "invalidPostVideoURL" | "retrying";
|
|
4
|
+
type SocialPublisherPostType = "shortVideo";
|
|
5
|
+
type SocialPublisherPostAccountType = "youtube" | "facebook" | "instagram" | "tiktok";
|
|
6
|
+
type SocialPublisherPostScheduleType = "now" | "schedule";
|
|
7
|
+
type SocialPublisherPostSourceType = "video-file" | "video-url" | "facebook-video" | "youtube-video" | "tiktok-video";
|
|
8
|
+
type SocialPublisherAccountPlatformType = "youtube" | "facebook" | "tiktok";
|
|
9
|
+
type SocialPublisherAccountAccountType = "facebook" | "instagram" | "youtube" | "tiktok";
|
|
10
|
+
type SocialPublisherAccountStatusType = "active" | "inactive" | "authenticationExpired";
|
|
11
|
+
|
|
12
|
+
interface IYouTubeConfig {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
tags: string[];
|
|
16
|
+
madeForKids?: boolean;
|
|
17
|
+
defaultLanguage?: string;
|
|
18
|
+
defaultAudioLanguage?: string;
|
|
19
|
+
categoryId?: string;
|
|
20
|
+
localizationLanguages?: string[];
|
|
21
|
+
}
|
|
22
|
+
interface ITikTokConfig {
|
|
23
|
+
caption: string;
|
|
24
|
+
disable_duet: boolean;
|
|
25
|
+
disable_stitch: boolean;
|
|
26
|
+
disable_comment: boolean;
|
|
27
|
+
privacy_level: string;
|
|
28
|
+
}
|
|
29
|
+
interface IFacebookPageConfig {
|
|
30
|
+
description: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
}
|
|
33
|
+
interface IInstagramConfig {
|
|
34
|
+
description: string;
|
|
35
|
+
share_to_feed?: boolean;
|
|
36
|
+
is_published_to_both_feed_and_story?: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface IScheduleConfig {
|
|
39
|
+
type: SocialPublisherPostScheduleType;
|
|
40
|
+
scheduledAt?: Date;
|
|
41
|
+
}
|
|
42
|
+
interface ICreateSocialPublisherPostRequest {
|
|
43
|
+
/** Workspace ID */
|
|
44
|
+
workspaceId: string;
|
|
45
|
+
source: SocialPublisherPostSourceType;
|
|
46
|
+
isAllowYouTube: boolean;
|
|
47
|
+
isAllowTiktok: boolean;
|
|
48
|
+
isAllowFacebookPage: boolean;
|
|
49
|
+
isAllowInstagram: boolean;
|
|
50
|
+
youtube?: IYouTubeConfig;
|
|
51
|
+
tiktok?: ITikTokConfig;
|
|
52
|
+
facebook?: IFacebookPageConfig;
|
|
53
|
+
instagram?: IInstagramConfig;
|
|
54
|
+
videoURL?: string;
|
|
55
|
+
thumbURL?: string;
|
|
56
|
+
postURL?: string;
|
|
57
|
+
schedule?: IScheduleConfig;
|
|
58
|
+
/**
|
|
59
|
+
* Tag (optional)
|
|
60
|
+
* Use this field to filter posts by tag.
|
|
61
|
+
* You can pass any custom value from your system.
|
|
62
|
+
*/
|
|
63
|
+
tag?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Reference ID (optional)
|
|
66
|
+
* Use this field to filter posts by reference ID.
|
|
67
|
+
* You can pass any custom identifier from your system.
|
|
68
|
+
*/
|
|
69
|
+
refId?: string;
|
|
70
|
+
}
|
|
71
|
+
interface ICreateSocialPublisherAccountPostRequest {
|
|
72
|
+
/** Account ID */
|
|
73
|
+
accountId: string;
|
|
74
|
+
source: SocialPublisherPostSourceType;
|
|
75
|
+
isAllowYouTube: boolean;
|
|
76
|
+
isAllowTiktok: boolean;
|
|
77
|
+
isAllowFacebookPage: boolean;
|
|
78
|
+
isAllowInstagram: boolean;
|
|
79
|
+
youtube?: IYouTubeConfig;
|
|
80
|
+
tiktok?: ITikTokConfig;
|
|
81
|
+
facebook?: IFacebookPageConfig;
|
|
82
|
+
instagram?: IInstagramConfig;
|
|
83
|
+
videoURL?: string;
|
|
84
|
+
thumbURL?: string;
|
|
85
|
+
postURL?: string;
|
|
86
|
+
schedule?: IScheduleConfig;
|
|
87
|
+
/**
|
|
88
|
+
* Tag (optional)
|
|
89
|
+
* Use this field to filter posts by tag.
|
|
90
|
+
* You can pass any custom value from your system.
|
|
91
|
+
*/
|
|
92
|
+
tag?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Reference ID (optional)
|
|
95
|
+
* Use this field to filter posts by reference ID.
|
|
96
|
+
* You can pass any custom identifier from your system.
|
|
97
|
+
*/
|
|
98
|
+
refId?: string;
|
|
99
|
+
}
|
|
100
|
+
interface IPostSetting {
|
|
101
|
+
/** Workspace ID */
|
|
102
|
+
workspaceId: string;
|
|
103
|
+
isAllowYouTube: boolean;
|
|
104
|
+
isAllowTiktok: boolean;
|
|
105
|
+
isAllowFacebookPage: boolean;
|
|
106
|
+
isAllowInstagram: boolean;
|
|
107
|
+
youtube?: IYouTubeConfig;
|
|
108
|
+
tiktok?: ITikTokConfig;
|
|
109
|
+
facebook?: IFacebookPageConfig;
|
|
110
|
+
instagram?: IInstagramConfig;
|
|
111
|
+
schedule?: IScheduleConfig;
|
|
112
|
+
source: SocialPublisherPostSourceType;
|
|
113
|
+
}
|
|
114
|
+
interface IAccountPostSetting {
|
|
115
|
+
/** Account ID */
|
|
116
|
+
accountId: string;
|
|
117
|
+
isAllowYouTube: boolean;
|
|
118
|
+
isAllowTiktok: boolean;
|
|
119
|
+
isAllowFacebookPage: boolean;
|
|
120
|
+
isAllowInstagram: boolean;
|
|
121
|
+
youtube?: IYouTubeConfig;
|
|
122
|
+
tiktok?: ITikTokConfig;
|
|
123
|
+
facebook?: IFacebookPageConfig;
|
|
124
|
+
instagram?: IInstagramConfig;
|
|
125
|
+
schedule?: IScheduleConfig;
|
|
126
|
+
source: SocialPublisherPostSourceType;
|
|
127
|
+
}
|
|
128
|
+
interface IGenerateUploadUrlsRequest {
|
|
129
|
+
thumbFileType?: string;
|
|
130
|
+
videoFileType?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Simplified options for the unified publish() method
|
|
134
|
+
* This provides a more user-friendly API compared to the detailed IPostSetting
|
|
135
|
+
*/
|
|
136
|
+
interface IPublishOptions {
|
|
137
|
+
/**
|
|
138
|
+
* Workspace ID (required)
|
|
139
|
+
*/
|
|
140
|
+
workspaceId: string;
|
|
141
|
+
/**
|
|
142
|
+
* Video source (required)
|
|
143
|
+
* Can be:
|
|
144
|
+
* - File object (will be uploaded)
|
|
145
|
+
* - Direct video URL (http://... or https://...)
|
|
146
|
+
* - Facebook video URL (auto-detected for repost)
|
|
147
|
+
* - TikTok video URL (auto-detected for repost)
|
|
148
|
+
* - YouTube Shorts URL (auto-detected for repost)
|
|
149
|
+
*/
|
|
150
|
+
video: File | string;
|
|
151
|
+
/**
|
|
152
|
+
* Optional thumbnail
|
|
153
|
+
* Can be:
|
|
154
|
+
* - File object (will be uploaded)
|
|
155
|
+
* - URL string (will be used directly)
|
|
156
|
+
*/
|
|
157
|
+
thumbnail?: File | string;
|
|
158
|
+
/**
|
|
159
|
+
* Platforms to publish to (required)
|
|
160
|
+
* At least one platform must be specified
|
|
161
|
+
*/
|
|
162
|
+
platforms: Array<"youtube" | "tiktok" | "facebook" | "instagram">;
|
|
163
|
+
/**
|
|
164
|
+
* YouTube-specific configuration
|
|
165
|
+
* Required if 'youtube' is in platforms array
|
|
166
|
+
*/
|
|
167
|
+
youtube?: IYouTubeConfig;
|
|
168
|
+
/**
|
|
169
|
+
* TikTok-specific configuration
|
|
170
|
+
* Required if 'tiktok' is in platforms array
|
|
171
|
+
*/
|
|
172
|
+
tiktok?: ITikTokConfig;
|
|
173
|
+
/**
|
|
174
|
+
* Facebook Page-specific configuration
|
|
175
|
+
* Required if 'facebook' is in platforms array
|
|
176
|
+
*/
|
|
177
|
+
facebook?: IFacebookPageConfig;
|
|
178
|
+
/**
|
|
179
|
+
* Instagram-specific configuration
|
|
180
|
+
* Required if 'instagram' is in platforms array
|
|
181
|
+
*/
|
|
182
|
+
instagram?: IInstagramConfig;
|
|
183
|
+
/**
|
|
184
|
+
* Optional scheduling
|
|
185
|
+
* - 'now': Publish immediately (default)
|
|
186
|
+
* - Date: Schedule for specific date/time
|
|
187
|
+
*/
|
|
188
|
+
schedule?: "now" | Date;
|
|
189
|
+
/**
|
|
190
|
+
* Optional tag for categorization
|
|
191
|
+
*/
|
|
192
|
+
tag?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Optional reference ID for external systems
|
|
195
|
+
*/
|
|
196
|
+
refId?: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Options for publishing to an account
|
|
200
|
+
*/
|
|
201
|
+
interface IPublishToAccountOptions {
|
|
202
|
+
/**
|
|
203
|
+
* Account ID (required)
|
|
204
|
+
*/
|
|
205
|
+
accountId: string;
|
|
206
|
+
/**
|
|
207
|
+
* Video source (required)
|
|
208
|
+
* Can be:
|
|
209
|
+
* - File object (will be uploaded)
|
|
210
|
+
* - Direct video URL (http://... or https://...)
|
|
211
|
+
* - Facebook video URL (auto-detected for repost)
|
|
212
|
+
* - TikTok video URL (auto-detected for repost)
|
|
213
|
+
* - YouTube Shorts URL (auto-detected for repost)
|
|
214
|
+
*/
|
|
215
|
+
video: File | string;
|
|
216
|
+
/**
|
|
217
|
+
* Optional thumbnail
|
|
218
|
+
* Can be:
|
|
219
|
+
* - File object (will be uploaded)
|
|
220
|
+
* - URL string (will be used directly)
|
|
221
|
+
*/
|
|
222
|
+
thumbnail?: File | string;
|
|
223
|
+
/**
|
|
224
|
+
* Platforms to publish to (required)
|
|
225
|
+
* At least one platform must be specified
|
|
226
|
+
*/
|
|
227
|
+
platforms: Array<"youtube" | "tiktok" | "facebook" | "instagram">;
|
|
228
|
+
/**
|
|
229
|
+
* YouTube-specific configuration
|
|
230
|
+
* Required if 'youtube' is in platforms array
|
|
231
|
+
*/
|
|
232
|
+
youtube?: IYouTubeConfig;
|
|
233
|
+
/**
|
|
234
|
+
* TikTok-specific configuration
|
|
235
|
+
* Required if 'tiktok' is in platforms array
|
|
236
|
+
*/
|
|
237
|
+
tiktok?: ITikTokConfig;
|
|
238
|
+
/**
|
|
239
|
+
* Facebook Page-specific configuration
|
|
240
|
+
* Required if 'facebook' is in platforms array
|
|
241
|
+
*/
|
|
242
|
+
facebook?: IFacebookPageConfig;
|
|
243
|
+
/**
|
|
244
|
+
* Instagram-specific configuration
|
|
245
|
+
* Required if 'instagram' is in platforms array
|
|
246
|
+
*/
|
|
247
|
+
instagram?: IInstagramConfig;
|
|
248
|
+
/**
|
|
249
|
+
* Optional scheduling
|
|
250
|
+
* - 'now': Publish immediately (default)
|
|
251
|
+
* - Date: Schedule for specific date/time
|
|
252
|
+
*/
|
|
253
|
+
schedule?: "now" | Date;
|
|
254
|
+
/**
|
|
255
|
+
* Optional tag for categorization
|
|
256
|
+
*/
|
|
257
|
+
tag?: string;
|
|
258
|
+
/**
|
|
259
|
+
* Optional reference ID for external systems
|
|
260
|
+
*/
|
|
261
|
+
refId?: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Base interface for quick publish options
|
|
265
|
+
* Contains common fields shared across all platform-specific publish methods
|
|
266
|
+
*/
|
|
267
|
+
interface IQuickPublishBaseOptions {
|
|
268
|
+
/**
|
|
269
|
+
* Workspace ID (required)
|
|
270
|
+
* The workspace where the post will be created
|
|
271
|
+
*/
|
|
272
|
+
workspaceId: string;
|
|
273
|
+
/**
|
|
274
|
+
* Video source (required)
|
|
275
|
+
* Can be:
|
|
276
|
+
* - File object: Will be uploaded to cloud storage
|
|
277
|
+
* - URL string: Direct video URL or platform URL (Facebook, TikTok, YouTube)
|
|
278
|
+
*
|
|
279
|
+
* Supported formats: .mp4, .mov, .avi, .mkv, .webm
|
|
280
|
+
*/
|
|
281
|
+
video: File | string;
|
|
282
|
+
/**
|
|
283
|
+
* Optional thumbnail image
|
|
284
|
+
* Can be:
|
|
285
|
+
* - File object: Will be uploaded to cloud storage
|
|
286
|
+
* - URL string: Direct image URL
|
|
287
|
+
*
|
|
288
|
+
* If not provided, platforms may auto-generate a thumbnail
|
|
289
|
+
*/
|
|
290
|
+
thumbnail?: File | string;
|
|
291
|
+
/**
|
|
292
|
+
* Optional scheduling
|
|
293
|
+
* - 'now': Publish immediately (default)
|
|
294
|
+
* - Date object: Schedule for specific date/time
|
|
295
|
+
*
|
|
296
|
+
* @default 'now'
|
|
297
|
+
*/
|
|
298
|
+
schedule?: "now" | Date;
|
|
299
|
+
/**
|
|
300
|
+
* Optional tag for categorization
|
|
301
|
+
* Use this to group and filter posts by custom tags
|
|
302
|
+
*
|
|
303
|
+
* @example 'campaign-2024', 'product-launch', 'seasonal'
|
|
304
|
+
*/
|
|
305
|
+
tag?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Optional reference ID for external systems
|
|
308
|
+
* Use this to link posts with your external system's identifiers
|
|
309
|
+
*
|
|
310
|
+
* @example 'external-id-123', 'crm-campaign-456'
|
|
311
|
+
*/
|
|
312
|
+
refId?: string;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Quick publish options for YouTube only
|
|
316
|
+
* Extends base options with YouTube-specific fields
|
|
317
|
+
*/
|
|
318
|
+
interface IQuickPublishYouTubeOptions extends IQuickPublishBaseOptions {
|
|
319
|
+
/**
|
|
320
|
+
* Video title (required)
|
|
321
|
+
* Maximum 100 characters
|
|
322
|
+
*
|
|
323
|
+
* @example 'How to Build a Web App in 2024'
|
|
324
|
+
*/
|
|
325
|
+
title: string;
|
|
326
|
+
/**
|
|
327
|
+
* Video description (required)
|
|
328
|
+
* Maximum 5000 characters
|
|
329
|
+
* Supports line breaks and URLs
|
|
330
|
+
*
|
|
331
|
+
* @example 'In this tutorial, we will build...'
|
|
332
|
+
*/
|
|
333
|
+
description: string;
|
|
334
|
+
/**
|
|
335
|
+
* Video tags (required)
|
|
336
|
+
* Array of keywords for video discovery
|
|
337
|
+
* Maximum 500 characters total
|
|
338
|
+
*
|
|
339
|
+
* @example ['tutorial', 'web development', 'javascript']
|
|
340
|
+
*/
|
|
341
|
+
tags: string[];
|
|
342
|
+
/**
|
|
343
|
+
* Whether the video is made for kids
|
|
344
|
+
* Required by YouTube's COPPA compliance
|
|
345
|
+
*
|
|
346
|
+
* @default false
|
|
347
|
+
*/
|
|
348
|
+
madeForKids?: boolean;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Quick publish options for TikTok only
|
|
352
|
+
* Extends base options with TikTok-specific fields
|
|
353
|
+
*/
|
|
354
|
+
interface IQuickPublishTikTokOptions extends IQuickPublishBaseOptions {
|
|
355
|
+
/**
|
|
356
|
+
* Video caption (required)
|
|
357
|
+
* Maximum 2200 characters
|
|
358
|
+
* Supports hashtags and mentions
|
|
359
|
+
*
|
|
360
|
+
* @example 'Check out this amazing tutorial! #coding #webdev'
|
|
361
|
+
*/
|
|
362
|
+
caption: string;
|
|
363
|
+
/**
|
|
364
|
+
* Privacy level for the video
|
|
365
|
+
* - 'public': Visible to everyone
|
|
366
|
+
* - 'friends': Visible to friends only
|
|
367
|
+
* - 'private': Only visible to you
|
|
368
|
+
*
|
|
369
|
+
* @default 'public'
|
|
370
|
+
*/
|
|
371
|
+
privacy_level?: string;
|
|
372
|
+
/**
|
|
373
|
+
* Disable duet feature
|
|
374
|
+
* If true, other users cannot create duets with this video
|
|
375
|
+
*
|
|
376
|
+
* @default false
|
|
377
|
+
*/
|
|
378
|
+
disable_duet?: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Disable stitch feature
|
|
381
|
+
* If true, other users cannot create stitches with this video
|
|
382
|
+
*
|
|
383
|
+
* @default false
|
|
384
|
+
*/
|
|
385
|
+
disable_stitch?: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Disable comments
|
|
388
|
+
* If true, users cannot comment on this video
|
|
389
|
+
*
|
|
390
|
+
* @default false
|
|
391
|
+
*/
|
|
392
|
+
disable_comment?: boolean;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Quick publish options for Facebook only
|
|
396
|
+
* Extends base options with Facebook-specific fields
|
|
397
|
+
*/
|
|
398
|
+
interface IQuickPublishFacebookOptions extends IQuickPublishBaseOptions {
|
|
399
|
+
/**
|
|
400
|
+
* Video title (required)
|
|
401
|
+
* Maximum 255 characters
|
|
402
|
+
*
|
|
403
|
+
* @example 'Amazing Product Demo'
|
|
404
|
+
*/
|
|
405
|
+
title: string;
|
|
406
|
+
/**
|
|
407
|
+
* Video description (required)
|
|
408
|
+
* Maximum 63,206 characters
|
|
409
|
+
* Supports line breaks, mentions, and hashtags
|
|
410
|
+
*
|
|
411
|
+
* @example 'Check out our new product features...'
|
|
412
|
+
*/
|
|
413
|
+
description: string;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Quick publish options for Instagram only
|
|
417
|
+
* Extends base options with Instagram-specific fields
|
|
418
|
+
*/
|
|
419
|
+
interface IQuickPublishInstagramOptions extends IQuickPublishBaseOptions {
|
|
420
|
+
/**
|
|
421
|
+
* Video caption/description (required)
|
|
422
|
+
* Maximum 2,200 characters
|
|
423
|
+
* Supports hashtags and mentions
|
|
424
|
+
*
|
|
425
|
+
* @example 'New video is live! Check it out 🎥 #instagram #video'
|
|
426
|
+
*/
|
|
427
|
+
description: string;
|
|
428
|
+
/**
|
|
429
|
+
* Share to Instagram feed
|
|
430
|
+
* If true, video will appear in main feed
|
|
431
|
+
*
|
|
432
|
+
* @default false
|
|
433
|
+
*/
|
|
434
|
+
share_to_feed?: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Publish to both feed and story
|
|
437
|
+
* If true, video will appear in both feed and story
|
|
438
|
+
*
|
|
439
|
+
* @default false
|
|
440
|
+
*/
|
|
441
|
+
is_published_to_both_feed_and_story?: boolean;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Quick publish options for all platforms with universal caption
|
|
445
|
+
* Extends base options with a single caption field used across all platforms
|
|
446
|
+
*/
|
|
447
|
+
interface IQuickPublishAllOptions extends IQuickPublishBaseOptions {
|
|
448
|
+
/**
|
|
449
|
+
* Universal caption for all platforms (required)
|
|
450
|
+
* This caption will be used as:
|
|
451
|
+
* - YouTube: title and description
|
|
452
|
+
* - TikTok: caption
|
|
453
|
+
* - Facebook: title and description
|
|
454
|
+
* - Instagram: description
|
|
455
|
+
*
|
|
456
|
+
* Keep it concise for best results across all platforms
|
|
457
|
+
*
|
|
458
|
+
* @example 'Check out my new video!'
|
|
459
|
+
*/
|
|
460
|
+
caption: string;
|
|
461
|
+
}
|
|
462
|
+
interface IListParams {
|
|
463
|
+
caption?: string;
|
|
464
|
+
numbering?: string;
|
|
465
|
+
currentStatus?: string;
|
|
466
|
+
workspaceId?: string;
|
|
467
|
+
refId?: string;
|
|
468
|
+
tag?: string;
|
|
469
|
+
"youtube.postInfo.isAllow"?: boolean;
|
|
470
|
+
"facebook.postInfo.isAllow"?: boolean;
|
|
471
|
+
"instagram.postInfo.isAllow"?: boolean;
|
|
472
|
+
"tiktok.postInfo.isAllow"?: boolean;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
interface IUploadConfig {
|
|
476
|
+
url: string;
|
|
477
|
+
fields: Record<string, string>;
|
|
478
|
+
}
|
|
479
|
+
interface IGenerateUploadUrlsResponse {
|
|
480
|
+
postId: string;
|
|
481
|
+
thumb: {
|
|
482
|
+
/**
|
|
483
|
+
* Public URL to access file from Cloud Bucket
|
|
484
|
+
*/
|
|
485
|
+
fileURL: string | undefined;
|
|
486
|
+
/**
|
|
487
|
+
* Upload URL to upload file to Cloud Bucket (Signed URL)
|
|
488
|
+
*/
|
|
489
|
+
uploadFileURL: string | undefined;
|
|
490
|
+
/**
|
|
491
|
+
* Path in Cloud Bucket
|
|
492
|
+
*/
|
|
493
|
+
bucketFilePath: string | undefined;
|
|
494
|
+
};
|
|
495
|
+
video: {
|
|
496
|
+
/**
|
|
497
|
+
* Public URL to access file from Cloud Bucket
|
|
498
|
+
*/
|
|
499
|
+
fileURL: string | undefined;
|
|
500
|
+
/**
|
|
501
|
+
* Upload URL to upload file to Cloud Bucket (Signed URL)
|
|
502
|
+
*/
|
|
503
|
+
uploadFileURL: string | undefined;
|
|
504
|
+
/**
|
|
505
|
+
* Path in Cloud Bucket
|
|
506
|
+
*/
|
|
507
|
+
bucketFilePath: string | undefined;
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
interface ISocialPublisherPostStatusLog {
|
|
511
|
+
status: SocialPublisherPostStatusType;
|
|
512
|
+
error: string;
|
|
513
|
+
changedAt: Date;
|
|
514
|
+
}
|
|
515
|
+
interface ISocialPublisherPostInfo {
|
|
516
|
+
platformAccountId: string;
|
|
517
|
+
currentError: string;
|
|
518
|
+
isAllow: boolean;
|
|
519
|
+
currentStatus: SocialPublisherPostStatusType;
|
|
520
|
+
currentStatusChangedAt: Date;
|
|
521
|
+
publishId: string;
|
|
522
|
+
videoId: string;
|
|
523
|
+
videoURL: string;
|
|
524
|
+
statusHistory: {
|
|
525
|
+
status: SocialPublisherPostStatusType;
|
|
526
|
+
changedAt: Date;
|
|
527
|
+
}[];
|
|
528
|
+
socialPublisherAccountId: string | any;
|
|
529
|
+
}
|
|
530
|
+
interface ISocialPublisherPostPlatform {
|
|
531
|
+
postInfo: ISocialPublisherPostInfo;
|
|
532
|
+
}
|
|
533
|
+
interface ISocialPublisherPostResponse {
|
|
534
|
+
_id: string;
|
|
535
|
+
numbering: string;
|
|
536
|
+
caption: string;
|
|
537
|
+
createdAt: Date;
|
|
538
|
+
currentStatus: SocialPublisherPostStatusType;
|
|
539
|
+
isAllow: {
|
|
540
|
+
tiktok: boolean;
|
|
541
|
+
facebookPage: boolean;
|
|
542
|
+
instagram: boolean;
|
|
543
|
+
youtube: boolean;
|
|
544
|
+
};
|
|
545
|
+
workspace: {
|
|
546
|
+
_id: string;
|
|
547
|
+
name: string;
|
|
548
|
+
};
|
|
549
|
+
schedule: {
|
|
550
|
+
type: "schedule" | "now";
|
|
551
|
+
scheduledAt: Date;
|
|
552
|
+
executedAt: Date;
|
|
553
|
+
};
|
|
554
|
+
updatedAt: Date;
|
|
555
|
+
isToWorkspace: boolean;
|
|
556
|
+
account: {
|
|
557
|
+
name: string;
|
|
558
|
+
platform: string;
|
|
559
|
+
thumbnail: string;
|
|
560
|
+
};
|
|
561
|
+
refId: string;
|
|
562
|
+
tag: string;
|
|
563
|
+
}
|
|
564
|
+
interface ISocialPublisherPostStatusResponse {
|
|
565
|
+
_id: string;
|
|
566
|
+
numbering: string;
|
|
567
|
+
type: "shortVideo";
|
|
568
|
+
source: SocialPublisherPostSourceType;
|
|
569
|
+
sourceURLs: {
|
|
570
|
+
/**
|
|
571
|
+
* Thumbnail URL, can be null if didn't upload any thumbnail or passed URL
|
|
572
|
+
*/
|
|
573
|
+
thumbURL?: string | null;
|
|
574
|
+
/**
|
|
575
|
+
* Video URL, can be null if didn't upload any video or passed URL
|
|
576
|
+
*/
|
|
577
|
+
videoURL?: string;
|
|
578
|
+
/**
|
|
579
|
+
* Post URL, can be null if didn't upload any post or passed URL for platforms like facebook, tiktok, youtube
|
|
580
|
+
*/
|
|
581
|
+
postURL?: string;
|
|
582
|
+
};
|
|
583
|
+
currentStatus: SocialPublisherPostStatusType;
|
|
584
|
+
currentError: string;
|
|
585
|
+
currentStatusChangedAt: string;
|
|
586
|
+
statusHistoryGrouped: IBaseStatusHistoryGroupedDay<SocialPublisherPostStatusType>[];
|
|
587
|
+
tiktok?: ISocialPublisherPostTikTokPostDetails;
|
|
588
|
+
facebook?: ISocialPublisherPostFacebookPagePostDetails;
|
|
589
|
+
instagram?: ISocialPublisherPostInstagramPostDetails;
|
|
590
|
+
youtube?: ISocialPublisherPostYouTubePostDetails;
|
|
591
|
+
workspace: ISocialPublisherWorkspace;
|
|
592
|
+
createdAt: Date;
|
|
593
|
+
startedAt: Date;
|
|
594
|
+
schedule: {
|
|
595
|
+
type: "schedule" | "now";
|
|
596
|
+
scheduledAt: Date;
|
|
597
|
+
executedAt: Date;
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
interface ISocialPublisherWorkspace {
|
|
601
|
+
_id: string;
|
|
602
|
+
name: string;
|
|
603
|
+
description: string;
|
|
604
|
+
createdAt: Date;
|
|
605
|
+
account: {
|
|
606
|
+
youtube?: ISocialPublisherAccount;
|
|
607
|
+
tiktok?: ISocialPublisherAccount;
|
|
608
|
+
facebook?: ISocialPublisherAccount;
|
|
609
|
+
instagram?: ISocialPublisherAccount;
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
interface ISocialPublisherAccount {
|
|
613
|
+
_id: string;
|
|
614
|
+
status: SocialPublisherAccountStatusType;
|
|
615
|
+
link: string;
|
|
616
|
+
name: string;
|
|
617
|
+
thumbnail: string;
|
|
618
|
+
platformAccountId: string;
|
|
619
|
+
}
|
|
620
|
+
interface ISocialPublisherPostAccount {
|
|
621
|
+
tags: string[];
|
|
622
|
+
postInfo: {
|
|
623
|
+
isAllow: boolean;
|
|
624
|
+
currentStatus: SocialPublisherPostStatusType;
|
|
625
|
+
statusHistoryGrouped: IBaseStatusHistoryGroupedDay<SocialPublisherPostStatusType>[];
|
|
626
|
+
videoURL: string;
|
|
627
|
+
socialPublisherAccount: ISocialPublisherAccount;
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
interface ISocialPublisherPostTikTokPostDetails extends ISocialPublisherPostAccount {
|
|
631
|
+
caption: string;
|
|
632
|
+
disable_duet: boolean;
|
|
633
|
+
disable_stitch: boolean;
|
|
634
|
+
disable_comment: boolean;
|
|
635
|
+
privacy_level: string;
|
|
636
|
+
}
|
|
637
|
+
interface ISocialPublisherPostFacebookPagePostDetails extends ISocialPublisherPostAccount {
|
|
638
|
+
description: string;
|
|
639
|
+
title: string;
|
|
640
|
+
}
|
|
641
|
+
interface ISocialPublisherPostInstagramPostDetails extends ISocialPublisherPostAccount {
|
|
642
|
+
description: string;
|
|
643
|
+
share_to_feed: boolean;
|
|
644
|
+
is_published_to_both_feed_and_story: boolean;
|
|
645
|
+
}
|
|
646
|
+
interface ISocialPublisherPostYouTubePostDetails extends ISocialPublisherPostAccount {
|
|
647
|
+
title: string;
|
|
648
|
+
description: string;
|
|
649
|
+
tags: string[];
|
|
650
|
+
madeForKids: boolean;
|
|
651
|
+
defaultLanguage: string;
|
|
652
|
+
defaultAudioLanguage: string;
|
|
653
|
+
categoryId: string;
|
|
654
|
+
localizationLanguages: string[];
|
|
655
|
+
localizations: any;
|
|
656
|
+
}
|
|
657
|
+
interface ISocialPublisherPostNextPreviousResponse {
|
|
658
|
+
nextId?: string;
|
|
659
|
+
previousId?: string;
|
|
660
|
+
}
|
|
661
|
+
interface IDefaultSettingsResponse {
|
|
662
|
+
[key: string]: any;
|
|
663
|
+
}
|
|
664
|
+
type ISearchSocialPublisherPostResponse = IPaginationResponse<ISocialPublisherPostResponse>;
|
|
665
|
+
interface IBaseStatusHistoryGroupedDay<StatusType> {
|
|
666
|
+
day: Date;
|
|
667
|
+
history: IBaseStatusHistoryGroupedItem<StatusType>[];
|
|
668
|
+
}
|
|
669
|
+
interface IBaseStatusHistoryGroupedItem<StatusType> {
|
|
670
|
+
time: Date;
|
|
671
|
+
status: StatusType;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Social Publisher Post Client
|
|
676
|
+
*/
|
|
677
|
+
declare class SocialPublisherPostClient {
|
|
678
|
+
private http;
|
|
679
|
+
private basePath;
|
|
680
|
+
readonly maxVideoUploadSizeBytes: number;
|
|
681
|
+
readonly maxImageUploadSizeBytes: number;
|
|
682
|
+
constructor(http: HttpClient);
|
|
683
|
+
/**
|
|
684
|
+
* Search posts
|
|
685
|
+
* @param params - Search parameters (optional)
|
|
686
|
+
* @param pagination - Pagination parameters
|
|
687
|
+
*/
|
|
688
|
+
list(params?: IListParams, pagination?: IPaginationParams): Promise<ISearchSocialPublisherPostResponse>;
|
|
689
|
+
/**
|
|
690
|
+
* Get default settings
|
|
691
|
+
*/
|
|
692
|
+
getDefaultSettings(): Promise<IDefaultSettingsResponse>;
|
|
693
|
+
/**
|
|
694
|
+
* Get post status
|
|
695
|
+
* @param id - Post ID
|
|
696
|
+
*/
|
|
697
|
+
getStatus(id: string): Promise<ISocialPublisherPostStatusResponse>;
|
|
698
|
+
/**
|
|
699
|
+
* Generate upload signed URLs for video and thumbnail
|
|
700
|
+
* @param data - File information
|
|
701
|
+
*/
|
|
702
|
+
private generateUploadUrls;
|
|
703
|
+
/**
|
|
704
|
+
* Get next and previous post IDs
|
|
705
|
+
* @param id - Current Post ID
|
|
706
|
+
*/
|
|
707
|
+
getNextAndPrevious(id: string): Promise<ISocialPublisherPostNextPreviousResponse>;
|
|
708
|
+
/**
|
|
709
|
+
* Create a new post (publish video)
|
|
710
|
+
* @param data - Post creation data
|
|
711
|
+
* @param id - Optional ID for updating/retrying? (Based on route :id?)
|
|
712
|
+
*/
|
|
713
|
+
private createToWorkspaceByFile;
|
|
714
|
+
/**
|
|
715
|
+
* Create a new post (publish video)
|
|
716
|
+
* @param data - Post creation data
|
|
717
|
+
* @param id - Optional ID for updating/retrying? (Based on route :id?)
|
|
718
|
+
*/
|
|
719
|
+
private createToWorkspaceByURL;
|
|
720
|
+
/**
|
|
721
|
+
* Create a new post (publish video to account)
|
|
722
|
+
* @param data - Post creation data
|
|
723
|
+
* @param id - Optional ID for updating/retrying?
|
|
724
|
+
*/
|
|
725
|
+
private createToAccountByFile;
|
|
726
|
+
/**
|
|
727
|
+
* Create a new post (publish video to account)
|
|
728
|
+
* @param data - Post creation data
|
|
729
|
+
* @param id - Optional ID for updating/retrying?
|
|
730
|
+
*/
|
|
731
|
+
private createToAccountByURL;
|
|
732
|
+
/**
|
|
733
|
+
* Handle thumbnail upload - accepts either File or URL string
|
|
734
|
+
* @param thumb - Thumbnail as File (will be uploaded) or URL string (will be passed directly)
|
|
735
|
+
* @returns Thumbnail URL or undefined
|
|
736
|
+
*/
|
|
737
|
+
private handleThumbnailUpload;
|
|
738
|
+
/**
|
|
739
|
+
* Publish a short video by uploading a video file and optional thumbnail
|
|
740
|
+
* @param settings - Post creation settings
|
|
741
|
+
* @param video - Video file to upload (.mp4, .mov, .avi, .mkv, .webm)
|
|
742
|
+
* @param thumb - Optional thumbnail image file or URL string
|
|
743
|
+
* @returns Created post response
|
|
744
|
+
*/
|
|
745
|
+
private publishShortVideoToWorkspaceByFile;
|
|
746
|
+
/**
|
|
747
|
+
* Publish a short video by providing a video URL and optional thumbnail
|
|
748
|
+
* @param settings - Post creation settings
|
|
749
|
+
* @param videoURL - Video URL (.mp4, .mov, .avi, .mkv, .webm)
|
|
750
|
+
* @param thumb - Optional thumbnail image file or URL string
|
|
751
|
+
* @returns Created post response
|
|
752
|
+
*/
|
|
753
|
+
private publishShortVideoToWorkspaceByURL;
|
|
754
|
+
/**
|
|
755
|
+
* Publish a repost video from TikTok
|
|
756
|
+
* @param settings - Post creation settings
|
|
757
|
+
* @param videoURL - TikTok video URL (tiktok.com, vm.tiktok.com)
|
|
758
|
+
* @param thumb - Optional thumbnail image file or URL string
|
|
759
|
+
* @returns Created post response
|
|
760
|
+
*/
|
|
761
|
+
private publishRepostVideoToWorkspace;
|
|
762
|
+
/**
|
|
763
|
+
* Publish a short video to account by uploading a video file
|
|
764
|
+
*/
|
|
765
|
+
private publishShortVideoToAccountByFile;
|
|
766
|
+
/**
|
|
767
|
+
* Publish a short video to account by URL
|
|
768
|
+
*/
|
|
769
|
+
private publishShortVideoToAccountByURL;
|
|
770
|
+
/**
|
|
771
|
+
* Publish a repost video to account
|
|
772
|
+
*/
|
|
773
|
+
private publishRepostVideoToAccount;
|
|
774
|
+
/**
|
|
775
|
+
* Publish a video to multiple social media platforms with auto-detection
|
|
776
|
+
* This is the recommended method for most use cases.
|
|
777
|
+
*
|
|
778
|
+
* @param options - Simplified publishing options
|
|
779
|
+
* @returns Created post response
|
|
780
|
+
*
|
|
781
|
+
* @example
|
|
782
|
+
* ```typescript
|
|
783
|
+
* // Publish video file to YouTube
|
|
784
|
+
* await client.publish({
|
|
785
|
+
* workspaceId: 'workspace-123',
|
|
786
|
+
* video: videoFile,
|
|
787
|
+
* thumbnail: thumbFile,
|
|
788
|
+
* platforms: ['youtube'],
|
|
789
|
+
* youtube: {
|
|
790
|
+
* title: 'My Video',
|
|
791
|
+
* description: 'Description',
|
|
792
|
+
* tags: ['tag1', 'tag2']
|
|
793
|
+
* }
|
|
794
|
+
* });
|
|
795
|
+
*
|
|
796
|
+
* // Publish to multiple platforms
|
|
797
|
+
* await client.publish({
|
|
798
|
+
* workspaceId: 'workspace-123',
|
|
799
|
+
* video: 'https://example.com/video.mp4',
|
|
800
|
+
* thumbnail: 'https://example.com/thumb.jpg',
|
|
801
|
+
* platforms: ['youtube', 'tiktok'],
|
|
802
|
+
* youtube: { title: 'Video', description: 'Desc', tags: [] },
|
|
803
|
+
* tiktok: { caption: 'Caption', privacy_level: 'public', disable_duet: false, disable_stitch: false, disable_comment: false }
|
|
804
|
+
* });
|
|
805
|
+
*
|
|
806
|
+
* // Repost from Facebook (auto-detected)
|
|
807
|
+
* await client.publish({
|
|
808
|
+
* workspaceId: 'workspace-123',
|
|
809
|
+
* video: 'https://facebook.com/video/12345',
|
|
810
|
+
* platforms: ['youtube'],
|
|
811
|
+
* youtube: { title: 'Reposted', description: 'From FB', tags: [] }
|
|
812
|
+
* });
|
|
813
|
+
* ```
|
|
814
|
+
*/
|
|
815
|
+
publishShortVideoToWorkspace(options: IPublishOptions): Promise<string>;
|
|
816
|
+
/**
|
|
817
|
+
* Publish a video to multiple social media platforms with auto-detection (Account)
|
|
818
|
+
*
|
|
819
|
+
* @param options - Simplified publishing options for account
|
|
820
|
+
* @returns Created post response
|
|
821
|
+
*/
|
|
822
|
+
publishShortVideoToAccount(options: IPublishToAccountOptions): Promise<string>;
|
|
823
|
+
/**
|
|
824
|
+
* @deprecated Use publishShortVideoToWorkspace instead
|
|
825
|
+
*/
|
|
826
|
+
publishShortVideo(options: IPublishOptions): Promise<string>;
|
|
827
|
+
/**
|
|
828
|
+
* Auto-detect video source type
|
|
829
|
+
* @param video - File or URL string
|
|
830
|
+
* @returns Detected source type and video
|
|
831
|
+
*/
|
|
832
|
+
private detectVideoSource;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
export { type IAccountPostSetting, type IBaseStatusHistoryGroupedDay, type IBaseStatusHistoryGroupedItem, type ICreateSocialPublisherAccountPostRequest, type ICreateSocialPublisherPostRequest, type IDefaultSettingsResponse, type IFacebookPageConfig, type IGenerateUploadUrlsRequest, type IGenerateUploadUrlsResponse, type IInstagramConfig, type IListParams, type IPostSetting, type IPublishOptions, type IPublishToAccountOptions, type IQuickPublishAllOptions, type IQuickPublishBaseOptions, type IQuickPublishFacebookOptions, type IQuickPublishInstagramOptions, type IQuickPublishTikTokOptions, type IQuickPublishYouTubeOptions, type IScheduleConfig, type ISearchSocialPublisherPostResponse, type ISocialPublisherAccount, type ISocialPublisherPostAccount, type ISocialPublisherPostFacebookPagePostDetails, type ISocialPublisherPostInfo, type ISocialPublisherPostInstagramPostDetails, type ISocialPublisherPostNextPreviousResponse, type ISocialPublisherPostPlatform, type ISocialPublisherPostResponse, type ISocialPublisherPostStatusLog, type ISocialPublisherPostStatusResponse, type ISocialPublisherPostTikTokPostDetails, type ISocialPublisherPostYouTubePostDetails, type ISocialPublisherWorkspace, type ITikTokConfig, type IUploadConfig, type IYouTubeConfig, type SocialPublisherAccountAccountType, type SocialPublisherAccountPlatformType, type SocialPublisherAccountStatusType, type SocialPublisherPostAccountType, SocialPublisherPostClient, type SocialPublisherPostScheduleType, type SocialPublisherPostSourceType, type SocialPublisherPostStatusType, type SocialPublisherPostType };
|