upload-post 1.0.3 → 2.0.3
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/.github/workflows/publish.yml +45 -0
- package/README.md +285 -219
- package/index.d.ts +551 -139
- package/index.js +683 -281
- package/package.json +28 -5
package/index.d.ts
CHANGED
|
@@ -1,175 +1,587 @@
|
|
|
1
1
|
declare module 'upload-post' {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// ==================== Common Types ====================
|
|
3
|
+
|
|
4
|
+
/** Supported platforms for video upload */
|
|
5
|
+
export type VideoPlatform = 'tiktok' | 'instagram' | 'youtube' | 'linkedin' | 'facebook' | 'pinterest' | 'threads' | 'bluesky' | 'x';
|
|
6
|
+
|
|
7
|
+
/** Supported platforms for photo upload */
|
|
8
|
+
export type PhotoPlatform = 'tiktok' | 'instagram' | 'linkedin' | 'facebook' | 'pinterest' | 'threads' | 'reddit' | 'bluesky' | 'x';
|
|
9
|
+
|
|
10
|
+
/** Supported platforms for text upload */
|
|
11
|
+
export type TextPlatform = 'x' | 'linkedin' | 'facebook' | 'threads' | 'reddit' | 'bluesky';
|
|
12
|
+
|
|
13
|
+
/** TikTok privacy levels */
|
|
14
|
+
export type TikTokPrivacyLevel = 'PUBLIC_TO_EVERYONE' | 'MUTUAL_FOLLOW_FRIENDS' | 'FOLLOWER_OF_CREATOR' | 'SELF_ONLY';
|
|
15
|
+
|
|
16
|
+
/** TikTok post modes */
|
|
17
|
+
export type TikTokPostMode = 'DIRECT_POST' | 'MEDIA_UPLOAD';
|
|
18
|
+
|
|
19
|
+
/** Instagram media types for video */
|
|
20
|
+
export type InstagramVideoMediaType = 'REELS' | 'STORIES';
|
|
21
|
+
|
|
22
|
+
/** Instagram media types for photos */
|
|
23
|
+
export type InstagramPhotoMediaType = 'IMAGE' | 'STORIES';
|
|
24
|
+
|
|
25
|
+
/** YouTube privacy status */
|
|
26
|
+
export type YouTubePrivacyStatus = 'public' | 'unlisted' | 'private';
|
|
27
|
+
|
|
28
|
+
/** YouTube license */
|
|
29
|
+
export type YouTubeLicense = 'youtube' | 'creativeCommon';
|
|
30
|
+
|
|
31
|
+
/** LinkedIn visibility */
|
|
32
|
+
export type LinkedInVisibility = 'PUBLIC' | 'CONNECTIONS' | 'LOGGED_IN' | 'CONTAINER';
|
|
33
|
+
|
|
34
|
+
/** Facebook video state */
|
|
35
|
+
export type FacebookVideoState = 'PUBLISHED' | 'DRAFT';
|
|
36
|
+
|
|
37
|
+
/** Facebook media type */
|
|
38
|
+
export type FacebookMediaType = 'REELS' | 'STORIES';
|
|
39
|
+
|
|
40
|
+
/** X (Twitter) reply settings */
|
|
41
|
+
export type XReplySettings = 'everyone' | 'following' | 'mentionedUsers' | 'subscribers' | 'verified';
|
|
42
|
+
|
|
43
|
+
// ==================== Common Options ====================
|
|
44
|
+
|
|
45
|
+
export interface CommonUploadOptions {
|
|
46
|
+
/** Post title/caption */
|
|
4
47
|
title: string;
|
|
5
|
-
/** User identifier */
|
|
6
|
-
user: string;
|
|
7
|
-
/** Array of target platforms. Supported: tiktok, instagram, linkedin, youtube, facebook, twitter, threads, pinterest */
|
|
8
|
-
platforms: string[];
|
|
9
|
-
/** The video file to upload (can be a file upload or a video URL) */
|
|
10
|
-
video?: string; // Already handled by videoPath parameter, but good to have for consistency if API supports 'video' form field directly for URLs
|
|
11
|
-
|
|
12
|
-
// TikTok specific
|
|
13
|
-
privacy_level?: 'PUBLIC_TO_EVERYONE' | 'MUTUAL_FOLLOW_FRIENDS' | 'FOLLOWER_OF_CREATOR' | 'SELF_ONLY';
|
|
14
|
-
disable_duet?: boolean;
|
|
15
|
-
disable_comment?: boolean; // Note: also a common param for photos on TikTok
|
|
16
|
-
disable_stitch?: boolean;
|
|
17
|
-
cover_timestamp?: number;
|
|
18
|
-
brand_content_toggle?: boolean;
|
|
19
|
-
brand_organic?: boolean;
|
|
20
|
-
branded_content?: boolean; // Note: also a common param for photos on TikTok
|
|
21
|
-
brand_organic_toggle?: boolean;
|
|
22
|
-
is_aigc?: boolean;
|
|
23
|
-
|
|
24
|
-
// Instagram specific
|
|
25
|
-
media_type?: 'REELS' | 'STORIES'; // Note: also a param for photos, but with different values
|
|
26
|
-
share_to_feed?: boolean;
|
|
27
|
-
collaborators?: string; // Comma-separated list
|
|
28
|
-
cover_url?: string;
|
|
29
|
-
audio_name?: string;
|
|
30
|
-
user_tags?: string; // Comma-separated list
|
|
31
|
-
location_id?: string;
|
|
32
|
-
thumb_offset?: string;
|
|
33
|
-
|
|
34
|
-
// LinkedIn specific
|
|
35
|
-
description?: string; // Note: also a common param for photos on TikTok & FB videos
|
|
36
|
-
visibility?: 'CONNECTIONS' | 'PUBLIC' | 'LOGGED_IN' | 'CONTAINER'; // Note: different values than photo visibility
|
|
37
|
-
target_linkedin_page_id?: string; // Note: also a param for photos
|
|
38
|
-
|
|
39
|
-
// YouTube specific
|
|
40
|
-
// description?: string; // Already listed under LinkedIn, will be used if provided
|
|
41
|
-
tags?: string[];
|
|
42
|
-
categoryId?: string;
|
|
43
|
-
privacyStatus?: 'public' | 'unlisted' | 'private';
|
|
44
|
-
embeddable?: boolean;
|
|
45
|
-
license?: 'youtube' | 'creativeCommon';
|
|
46
|
-
publicStatsViewable?: boolean;
|
|
47
|
-
madeForKids?: boolean;
|
|
48
|
-
|
|
49
|
-
// Facebook specific
|
|
50
|
-
facebook_page_id?: string; // Note: also a param for photos
|
|
51
|
-
// description?: string; // Already listed under LinkedIn
|
|
52
|
-
video_state?: 'DRAFT' | 'PUBLISHED' | 'SCHEDULED';
|
|
53
|
-
|
|
54
|
-
// Threads specific
|
|
55
|
-
// description?: string; // Already listed under LinkedIn
|
|
56
|
-
|
|
57
|
-
// X (Twitter) specific
|
|
58
|
-
tagged_user_ids?: string[];
|
|
59
|
-
reply_settings?: 'following' | 'mentionedUsers' | 'everyone';
|
|
60
|
-
nullcast?: boolean;
|
|
61
|
-
place_id?: string;
|
|
62
|
-
poll_duration?: number; // in minutes
|
|
63
|
-
poll_options?: string[];
|
|
64
|
-
poll_reply_settings?: 'following' | 'mentionedUsers' | 'everyone';
|
|
65
|
-
|
|
66
|
-
// Pinterest specific
|
|
67
|
-
pinterest_board_id?: string; // Note: also a param for photos
|
|
68
|
-
pinterest_link?: string; // Note: also a param for photos
|
|
69
|
-
pinterest_cover_image_url?: string;
|
|
70
|
-
pinterest_cover_image_content_type?: string;
|
|
71
|
-
pinterest_cover_image_data?: string; // Base64 encoded
|
|
72
|
-
pinterest_cover_image_key_frame_time?: number; // in milliseconds
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface UploadPhotosOptions {
|
|
76
|
-
/** User identifier */
|
|
48
|
+
/** User identifier (profile name) */
|
|
77
49
|
user: string;
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
branded_content?: boolean;
|
|
104
|
-
/** Disclose the commercial nature of the post (used with branded_content) */
|
|
105
|
-
disclose_commercial?: boolean;
|
|
106
|
-
/** Index (starting at 0) of the photo to use as the cover/thumbnail for the TikTok photo post */
|
|
107
|
-
photo_cover_index?: number;
|
|
108
|
-
/** Description for the TikTok post. If not provided, the title value will be used by default. */
|
|
50
|
+
/** First comment to post after publishing */
|
|
51
|
+
firstComment?: string;
|
|
52
|
+
/** Alt text for accessibility */
|
|
53
|
+
altText?: string;
|
|
54
|
+
/** ISO date for scheduling (e.g., "2024-12-25T10:00:00Z") */
|
|
55
|
+
scheduledDate?: string;
|
|
56
|
+
/** Timezone for scheduled date (e.g., "Europe/Madrid") */
|
|
57
|
+
timezone?: string;
|
|
58
|
+
/** Add to posting queue instead of immediate post */
|
|
59
|
+
addToQueue?: boolean;
|
|
60
|
+
/** Process upload asynchronously (default: true) */
|
|
61
|
+
asyncUpload?: boolean;
|
|
62
|
+
|
|
63
|
+
// Platform-specific title overrides
|
|
64
|
+
blueskyTitle?: string;
|
|
65
|
+
instagramTitle?: string;
|
|
66
|
+
facebookTitle?: string;
|
|
67
|
+
tiktokTitle?: string;
|
|
68
|
+
linkedinTitle?: string;
|
|
69
|
+
xTitle?: string;
|
|
70
|
+
youtubeTitle?: string;
|
|
71
|
+
pinterestTitle?: string;
|
|
72
|
+
threadsTitle?: string;
|
|
73
|
+
|
|
74
|
+
// Platform-specific description overrides
|
|
109
75
|
description?: string;
|
|
76
|
+
linkedinDescription?: string;
|
|
77
|
+
youtubeDescription?: string;
|
|
78
|
+
facebookDescription?: string;
|
|
79
|
+
tiktokDescription?: string;
|
|
80
|
+
pinterestDescription?: string;
|
|
81
|
+
|
|
82
|
+
// Platform-specific first comment overrides
|
|
83
|
+
instagramFirstComment?: string;
|
|
84
|
+
facebookFirstComment?: string;
|
|
85
|
+
xFirstComment?: string;
|
|
86
|
+
threadsFirstComment?: string;
|
|
87
|
+
youtubeFirstComment?: string;
|
|
88
|
+
redditFirstComment?: string;
|
|
89
|
+
blueskyFirstComment?: string;
|
|
90
|
+
}
|
|
110
91
|
|
|
111
|
-
|
|
112
|
-
/** Type of media ("IMAGE" or "STORIES") */
|
|
113
|
-
media_type?: 'IMAGE' | 'STORIES';
|
|
92
|
+
// ==================== TikTok Options ====================
|
|
114
93
|
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
|
|
94
|
+
export interface TikTokVideoOptions {
|
|
95
|
+
/** Privacy setting */
|
|
96
|
+
tiktokPrivacyLevel?: TikTokPrivacyLevel;
|
|
97
|
+
/** Disable duet */
|
|
98
|
+
tiktokDisableDuet?: boolean;
|
|
99
|
+
/** Disable comments */
|
|
100
|
+
tiktokDisableComment?: boolean;
|
|
101
|
+
/** Disable stitch */
|
|
102
|
+
tiktokDisableStitch?: boolean;
|
|
103
|
+
/** Timestamp in ms for video cover */
|
|
104
|
+
tiktokCoverTimestamp?: number;
|
|
105
|
+
/** AI-generated content flag */
|
|
106
|
+
tiktokIsAigc?: boolean;
|
|
107
|
+
/** Post mode */
|
|
108
|
+
tiktokPostMode?: TikTokPostMode;
|
|
109
|
+
/** Branded content toggle */
|
|
110
|
+
brandContentToggle?: boolean;
|
|
111
|
+
/** Brand organic toggle */
|
|
112
|
+
brandOrganicToggle?: boolean;
|
|
122
113
|
}
|
|
123
114
|
|
|
124
|
-
export interface
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
|
|
129
|
-
/**
|
|
115
|
+
export interface TikTokPhotoOptions {
|
|
116
|
+
/** Auto add music */
|
|
117
|
+
tiktokAutoAddMusic?: boolean;
|
|
118
|
+
/** Disable comments */
|
|
119
|
+
tiktokDisableComment?: boolean;
|
|
120
|
+
/** Index of photo for cover (0-based) */
|
|
121
|
+
tiktokPhotoCoverIndex?: number;
|
|
122
|
+
/** Branded content toggle */
|
|
123
|
+
brandContentToggle?: boolean;
|
|
124
|
+
/** Brand organic toggle */
|
|
125
|
+
brandOrganicToggle?: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ==================== Instagram Options ====================
|
|
129
|
+
|
|
130
|
+
export interface InstagramVideoOptions {
|
|
131
|
+
/** Media type */
|
|
132
|
+
instagramMediaType?: InstagramVideoMediaType;
|
|
133
|
+
/** Share to feed */
|
|
134
|
+
instagramShareToFeed?: boolean;
|
|
135
|
+
/** Comma-separated collaborator usernames */
|
|
136
|
+
instagramCollaborators?: string;
|
|
137
|
+
/** Custom cover URL */
|
|
138
|
+
instagramCoverUrl?: string;
|
|
139
|
+
/** Audio track name */
|
|
140
|
+
instagramAudioName?: string;
|
|
141
|
+
/** Comma-separated user tags */
|
|
142
|
+
instagramUserTags?: string;
|
|
143
|
+
/** Location ID */
|
|
144
|
+
instagramLocationId?: string;
|
|
145
|
+
/** Thumbnail offset */
|
|
146
|
+
instagramThumbOffset?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface InstagramPhotoOptions {
|
|
150
|
+
/** Media type */
|
|
151
|
+
instagramMediaType?: InstagramPhotoMediaType;
|
|
152
|
+
/** Comma-separated collaborator usernames */
|
|
153
|
+
instagramCollaborators?: string;
|
|
154
|
+
/** Comma-separated user tags */
|
|
155
|
+
instagramUserTags?: string;
|
|
156
|
+
/** Location ID */
|
|
157
|
+
instagramLocationId?: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ==================== YouTube Options ====================
|
|
161
|
+
|
|
162
|
+
export interface YouTubeOptions {
|
|
163
|
+
/** Video tags */
|
|
164
|
+
youtubeTags?: string | string[];
|
|
165
|
+
/** Category ID (e.g., "22" for People & Blogs) */
|
|
166
|
+
youtubeCategoryId?: string;
|
|
167
|
+
/** Privacy status */
|
|
168
|
+
youtubePrivacyStatus?: YouTubePrivacyStatus;
|
|
169
|
+
/** Allow embedding */
|
|
170
|
+
youtubeEmbeddable?: boolean;
|
|
171
|
+
/** Video license */
|
|
172
|
+
youtubeLicense?: YouTubeLicense;
|
|
173
|
+
/** Show public stats */
|
|
174
|
+
youtubePublicStatsViewable?: boolean;
|
|
175
|
+
/** Custom thumbnail URL */
|
|
176
|
+
youtubeThumbnailUrl?: string;
|
|
177
|
+
/** Made for kids flag (COPPA) */
|
|
178
|
+
youtubeSelfDeclaredMadeForKids?: boolean;
|
|
179
|
+
/** AI/synthetic content flag */
|
|
180
|
+
youtubeContainsSyntheticMedia?: boolean;
|
|
181
|
+
/** Title/description language (BCP-47) */
|
|
182
|
+
youtubeDefaultLanguage?: string;
|
|
183
|
+
/** Audio language (BCP-47) */
|
|
184
|
+
youtubeDefaultAudioLanguage?: string;
|
|
185
|
+
/** Comma-separated allowed country codes */
|
|
186
|
+
youtubeAllowedCountries?: string;
|
|
187
|
+
/** Comma-separated blocked country codes */
|
|
188
|
+
youtubeBlockedCountries?: string;
|
|
189
|
+
/** Paid product placement flag */
|
|
190
|
+
youtubeHasPaidProductPlacement?: boolean;
|
|
191
|
+
/** Recording date (ISO 8601) */
|
|
192
|
+
youtubeRecordingDate?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ==================== LinkedIn Options ====================
|
|
196
|
+
|
|
197
|
+
export interface LinkedInOptions {
|
|
198
|
+
/** Visibility setting */
|
|
199
|
+
linkedinVisibility?: LinkedInVisibility;
|
|
200
|
+
/** Page ID for organization posts */
|
|
201
|
+
targetLinkedinPageId?: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ==================== Facebook Options ====================
|
|
205
|
+
|
|
206
|
+
export interface FacebookVideoOptions {
|
|
207
|
+
/** Facebook Page ID */
|
|
208
|
+
facebookPageId?: string;
|
|
209
|
+
/** Video state */
|
|
210
|
+
facebookVideoState?: FacebookVideoState;
|
|
211
|
+
/** Media type */
|
|
212
|
+
facebookMediaType?: FacebookMediaType;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface FacebookPhotoOptions {
|
|
216
|
+
/** Facebook Page ID */
|
|
217
|
+
facebookPageId?: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface FacebookTextOptions {
|
|
221
|
+
/** Facebook Page ID */
|
|
222
|
+
facebookPageId?: string;
|
|
223
|
+
/** URL to attach as link preview */
|
|
224
|
+
facebookLinkUrl?: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ==================== Pinterest Options ====================
|
|
228
|
+
|
|
229
|
+
export interface PinterestVideoOptions {
|
|
230
|
+
/** Board ID */
|
|
231
|
+
pinterestBoardId?: string;
|
|
232
|
+
/** Destination link */
|
|
233
|
+
pinterestLink?: string;
|
|
234
|
+
/** Cover image URL */
|
|
235
|
+
pinterestCoverImageUrl?: string;
|
|
236
|
+
/** Cover image content type */
|
|
237
|
+
pinterestCoverImageContentType?: string;
|
|
238
|
+
/** Base64-encoded cover image data */
|
|
239
|
+
pinterestCoverImageData?: string;
|
|
240
|
+
/** Key frame time in ms for cover */
|
|
241
|
+
pinterestCoverImageKeyFrameTime?: number;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface PinterestPhotoOptions {
|
|
245
|
+
/** Board ID */
|
|
246
|
+
pinterestBoardId?: string;
|
|
247
|
+
/** Alt text */
|
|
248
|
+
pinterestAltText?: string;
|
|
249
|
+
/** Destination link */
|
|
250
|
+
pinterestLink?: string;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// ==================== X (Twitter) Options ====================
|
|
254
|
+
|
|
255
|
+
export interface XBaseOptions {
|
|
256
|
+
/** Who can reply */
|
|
257
|
+
xReplySettings?: XReplySettings;
|
|
258
|
+
/** Promoted-only post */
|
|
259
|
+
xNullcast?: boolean;
|
|
260
|
+
/** Geographic place ID */
|
|
261
|
+
xGeoPlaceId?: string;
|
|
262
|
+
/** Exclusive for super followers */
|
|
263
|
+
xForSuperFollowersOnly?: boolean;
|
|
264
|
+
/** Community ID */
|
|
265
|
+
xCommunityId?: string;
|
|
266
|
+
/** Share community post with followers */
|
|
267
|
+
xShareWithFollowers?: boolean;
|
|
268
|
+
/** Direct message deep link */
|
|
269
|
+
xDirectMessageDeepLink?: string;
|
|
270
|
+
/** Post long text as single post */
|
|
271
|
+
xLongTextAsPost?: boolean;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface XMediaOptions extends XBaseOptions {
|
|
275
|
+
/** User IDs to tag */
|
|
276
|
+
xTaggedUserIds?: string | string[];
|
|
277
|
+
/** Location place ID */
|
|
278
|
+
xPlaceId?: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface XTextOptions extends XBaseOptions {
|
|
282
|
+
/** URL to attach */
|
|
283
|
+
xPostUrl?: string;
|
|
284
|
+
/** Tweet ID to quote */
|
|
285
|
+
xQuoteTweetId?: string;
|
|
286
|
+
/** Poll options (2-4 options) */
|
|
287
|
+
xPollOptions?: string | string[];
|
|
288
|
+
/** Poll duration in minutes (5-10080) */
|
|
289
|
+
xPollDuration?: number;
|
|
290
|
+
/** Who can reply to poll */
|
|
291
|
+
xPollReplySettings?: XReplySettings;
|
|
292
|
+
/** Card URI for Twitter Cards */
|
|
293
|
+
xCardUri?: string;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// ==================== Threads Options ====================
|
|
297
|
+
|
|
298
|
+
export interface ThreadsOptions {
|
|
299
|
+
/** Post long text as single post (vs thread) */
|
|
300
|
+
threadsLongTextAsPost?: boolean;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// ==================== Reddit Options ====================
|
|
304
|
+
|
|
305
|
+
export interface RedditOptions {
|
|
306
|
+
/** Subreddit name (without r/) */
|
|
307
|
+
redditSubreddit?: string;
|
|
308
|
+
/** Flair template ID */
|
|
309
|
+
redditFlairId?: string;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// ==================== Combined Upload Options ====================
|
|
313
|
+
|
|
314
|
+
export interface UploadVideoOptions extends CommonUploadOptions,
|
|
315
|
+
TikTokVideoOptions,
|
|
316
|
+
InstagramVideoOptions,
|
|
317
|
+
YouTubeOptions,
|
|
318
|
+
LinkedInOptions,
|
|
319
|
+
FacebookVideoOptions,
|
|
320
|
+
PinterestVideoOptions,
|
|
321
|
+
XMediaOptions,
|
|
322
|
+
ThreadsOptions {
|
|
323
|
+
/** Target platforms */
|
|
324
|
+
platforms: VideoPlatform[];
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface UploadPhotosOptions extends CommonUploadOptions,
|
|
328
|
+
TikTokPhotoOptions,
|
|
329
|
+
InstagramPhotoOptions,
|
|
330
|
+
LinkedInOptions,
|
|
331
|
+
FacebookPhotoOptions,
|
|
332
|
+
PinterestPhotoOptions,
|
|
333
|
+
XMediaOptions,
|
|
334
|
+
ThreadsOptions,
|
|
335
|
+
RedditOptions {
|
|
336
|
+
/** Target platforms */
|
|
337
|
+
platforms: PhotoPlatform[];
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface UploadTextOptions extends CommonUploadOptions,
|
|
341
|
+
LinkedInOptions,
|
|
342
|
+
FacebookTextOptions,
|
|
343
|
+
XTextOptions,
|
|
344
|
+
ThreadsOptions,
|
|
345
|
+
RedditOptions {
|
|
346
|
+
/** Target platforms */
|
|
347
|
+
platforms: TextPlatform[];
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface UploadDocumentOptions {
|
|
351
|
+
/** Post title/caption */
|
|
130
352
|
title: string;
|
|
353
|
+
/** User identifier (profile name) */
|
|
354
|
+
user: string;
|
|
355
|
+
/** Document description/commentary */
|
|
356
|
+
description?: string;
|
|
357
|
+
/** Visibility setting */
|
|
358
|
+
linkedinVisibility?: LinkedInVisibility;
|
|
359
|
+
/** Page ID for organization posts */
|
|
360
|
+
targetLinkedinPageId?: string;
|
|
361
|
+
/** ISO date for scheduling */
|
|
362
|
+
scheduledDate?: string;
|
|
363
|
+
/** Timezone for scheduled date */
|
|
364
|
+
timezone?: string;
|
|
365
|
+
/** Add to posting queue */
|
|
366
|
+
addToQueue?: boolean;
|
|
367
|
+
/** Process upload asynchronously */
|
|
368
|
+
asyncUpload?: boolean;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// ==================== Response Types ====================
|
|
131
372
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
373
|
+
export interface UploadResponse {
|
|
374
|
+
success: boolean;
|
|
375
|
+
request_id?: string;
|
|
376
|
+
message?: string;
|
|
377
|
+
data?: {
|
|
378
|
+
status?: string;
|
|
379
|
+
platforms?: Array<{
|
|
380
|
+
name: string;
|
|
381
|
+
url?: string;
|
|
382
|
+
error?: string;
|
|
383
|
+
}>;
|
|
384
|
+
[key: string]: any;
|
|
385
|
+
};
|
|
386
|
+
[key: string]: any;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface StatusResponse {
|
|
390
|
+
success: boolean;
|
|
391
|
+
status?: string;
|
|
392
|
+
request_id?: string;
|
|
393
|
+
data?: any;
|
|
394
|
+
[key: string]: any;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface HistoryResponse {
|
|
398
|
+
success: boolean;
|
|
399
|
+
uploads?: any[];
|
|
400
|
+
page?: number;
|
|
401
|
+
total?: number;
|
|
402
|
+
[key: string]: any;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export interface AnalyticsResponse {
|
|
406
|
+
success: boolean;
|
|
407
|
+
analytics?: any;
|
|
408
|
+
[key: string]: any;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface ScheduledResponse {
|
|
412
|
+
success: boolean;
|
|
413
|
+
scheduled?: any[];
|
|
414
|
+
[key: string]: any;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface UserProfile {
|
|
418
|
+
username: string;
|
|
419
|
+
social_accounts?: Record<string, any>;
|
|
420
|
+
created_at?: string;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export interface UsersResponse {
|
|
424
|
+
success: boolean;
|
|
425
|
+
profiles?: UserProfile[];
|
|
426
|
+
[key: string]: any;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export interface JwtResponse {
|
|
430
|
+
success: boolean;
|
|
431
|
+
jwt?: string;
|
|
432
|
+
connection_url?: string;
|
|
433
|
+
[key: string]: any;
|
|
434
|
+
}
|
|
135
435
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
436
|
+
export interface PagesResponse {
|
|
437
|
+
success: boolean;
|
|
438
|
+
pages?: Array<{ id: string; name?: string }>;
|
|
439
|
+
[key: string]: any;
|
|
440
|
+
}
|
|
139
441
|
|
|
140
|
-
|
|
442
|
+
export interface BoardsResponse {
|
|
443
|
+
success: boolean;
|
|
444
|
+
boards?: Array<{ id: string; name?: string }>;
|
|
445
|
+
[key: string]: any;
|
|
141
446
|
}
|
|
142
447
|
|
|
448
|
+
// ==================== Client Class ====================
|
|
449
|
+
|
|
143
450
|
/**
|
|
144
451
|
* Upload-Post API client
|
|
452
|
+
*
|
|
453
|
+
* Supports uploading to: TikTok, Instagram, YouTube, LinkedIn, Facebook,
|
|
454
|
+
* Pinterest, Threads, Reddit, Bluesky, X (Twitter)
|
|
145
455
|
*/
|
|
146
456
|
export class UploadPost {
|
|
147
457
|
/**
|
|
458
|
+
* Create a new Upload-Post client
|
|
148
459
|
* @param apiKey - Your API key from Upload-Post
|
|
149
460
|
*/
|
|
150
461
|
constructor(apiKey: string);
|
|
151
462
|
|
|
463
|
+
// Upload methods
|
|
152
464
|
/**
|
|
153
|
-
* Upload video to social media platforms
|
|
154
|
-
* @param
|
|
465
|
+
* Upload a video to social media platforms
|
|
466
|
+
* @param videoPathOrUrl - Path to video file or video URL
|
|
155
467
|
* @param options - Upload options
|
|
156
|
-
* @returns Promise with API response
|
|
157
468
|
*/
|
|
158
|
-
upload(
|
|
469
|
+
upload(videoPathOrUrl: string, options: UploadVideoOptions): Promise<UploadResponse>;
|
|
159
470
|
|
|
160
471
|
/**
|
|
161
472
|
* Upload photos to social media platforms
|
|
162
|
-
* @param
|
|
163
|
-
* @param options - Upload
|
|
164
|
-
* @returns Promise with API response
|
|
473
|
+
* @param photosPathsOrUrls - Array of photo file paths or URLs
|
|
474
|
+
* @param options - Upload options
|
|
165
475
|
*/
|
|
166
|
-
uploadPhotos(
|
|
476
|
+
uploadPhotos(photosPathsOrUrls: string[], options: UploadPhotosOptions): Promise<UploadResponse>;
|
|
167
477
|
|
|
168
478
|
/**
|
|
169
479
|
* Upload text posts to social media platforms
|
|
170
|
-
* @param options - Upload
|
|
171
|
-
|
|
480
|
+
* @param options - Upload options
|
|
481
|
+
*/
|
|
482
|
+
uploadText(options: UploadTextOptions): Promise<UploadResponse>;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Upload a document to LinkedIn (PDF, PPT, PPTX, DOC, DOCX)
|
|
486
|
+
* @param documentPathOrUrl - Path to document file or document URL
|
|
487
|
+
* @param options - Upload options
|
|
488
|
+
*/
|
|
489
|
+
uploadDocument(documentPathOrUrl: string, options: UploadDocumentOptions): Promise<UploadResponse>;
|
|
490
|
+
|
|
491
|
+
// Status & History
|
|
492
|
+
/**
|
|
493
|
+
* Get the status of an async upload
|
|
494
|
+
* @param requestId - The request_id from an async upload
|
|
495
|
+
*/
|
|
496
|
+
getStatus(requestId: string): Promise<StatusResponse>;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Get upload history
|
|
500
|
+
* @param options - Query options
|
|
501
|
+
*/
|
|
502
|
+
getHistory(options?: { page?: number; limit?: number }): Promise<HistoryResponse>;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Get analytics for a profile
|
|
506
|
+
* @param profileUsername - Profile username
|
|
507
|
+
* @param options - Query options
|
|
172
508
|
*/
|
|
173
|
-
|
|
509
|
+
getAnalytics(profileUsername: string, options?: { platforms?: string[] }): Promise<AnalyticsResponse>;
|
|
510
|
+
|
|
511
|
+
// Scheduled Posts
|
|
512
|
+
/**
|
|
513
|
+
* List scheduled posts
|
|
514
|
+
*/
|
|
515
|
+
listScheduled(): Promise<ScheduledResponse>;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Cancel a scheduled post
|
|
519
|
+
* @param jobId - Scheduled job ID
|
|
520
|
+
*/
|
|
521
|
+
cancelScheduled(jobId: string): Promise<{ success: boolean }>;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Edit a scheduled post
|
|
525
|
+
* @param jobId - Scheduled job ID
|
|
526
|
+
* @param options - Edit options
|
|
527
|
+
*/
|
|
528
|
+
editScheduled(jobId: string, options: { scheduledDate?: string; timezone?: string }): Promise<{ success: boolean }>;
|
|
529
|
+
|
|
530
|
+
// User Management
|
|
531
|
+
/**
|
|
532
|
+
* List all users/profiles
|
|
533
|
+
*/
|
|
534
|
+
listUsers(): Promise<UsersResponse>;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Create a new user/profile
|
|
538
|
+
* @param username - Profile name to create
|
|
539
|
+
*/
|
|
540
|
+
createUser(username: string): Promise<{ success: boolean; username?: string }>;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Delete a user/profile
|
|
544
|
+
* @param username - Profile name to delete
|
|
545
|
+
*/
|
|
546
|
+
deleteUser(username: string): Promise<{ success: boolean }>;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Generate a JWT for platform integration
|
|
550
|
+
* @param username - Profile username
|
|
551
|
+
* @param options - JWT options
|
|
552
|
+
*/
|
|
553
|
+
generateJwt(username: string, options?: {
|
|
554
|
+
redirectUrl?: string;
|
|
555
|
+
logoImage?: string;
|
|
556
|
+
redirectButtonText?: string;
|
|
557
|
+
platforms?: string[];
|
|
558
|
+
}): Promise<JwtResponse>;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Validate a JWT token
|
|
562
|
+
* @param jwt - JWT token to validate
|
|
563
|
+
*/
|
|
564
|
+
validateJwt(jwt: string): Promise<{ success: boolean; valid?: boolean }>;
|
|
565
|
+
|
|
566
|
+
// Helper Endpoints
|
|
567
|
+
/**
|
|
568
|
+
* Get Facebook pages for a profile
|
|
569
|
+
* @param profile - Profile username
|
|
570
|
+
*/
|
|
571
|
+
getFacebookPages(profile?: string): Promise<PagesResponse>;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Get LinkedIn pages for a profile
|
|
575
|
+
* @param profile - Profile username
|
|
576
|
+
*/
|
|
577
|
+
getLinkedinPages(profile?: string): Promise<PagesResponse>;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Get Pinterest boards for a profile
|
|
581
|
+
* @param profile - Profile username
|
|
582
|
+
*/
|
|
583
|
+
getPinterestBoards(profile?: string): Promise<BoardsResponse>;
|
|
174
584
|
}
|
|
585
|
+
|
|
586
|
+
export default UploadPost;
|
|
175
587
|
}
|