@posty5/social-publisher-post 4.1.0 → 4.2.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 +231 -15
- package/dist/index.d.mts +695 -54
- package/dist/index.d.ts +695 -54
- package/dist/index.js +1364 -194
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1356 -195
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { IPaginationResponse, HttpClient, IPaginationParams } from '@posty5/core';
|
|
2
2
|
export { HttpClient, IHttpClientConfig, IPosty5Config, uploadToR2 } from '@posty5/core';
|
|
3
3
|
|
|
4
|
-
type SocialPublisherPostStatusType = "pending" | "processing" | "processingInPlatform" | "failedByPlatform" | "done" | "error" | "canceled" | "needsMaintenance" | "invalidVideoURL" | "invalidPostVideoURL" | "retrying";
|
|
5
|
-
|
|
4
|
+
type SocialPublisherPostStatusType = "pending" | "processing" | "processingInPlatform" | "failedByPlatform" | "done" | "error" | "canceled" | "needsMaintenance" | "invalidVideoURL" | "invalidPostVideoURL" | "retrying" | "removing" | "removed" | "removeFailed";
|
|
5
|
+
/**
|
|
6
|
+
* Content type of a post.
|
|
7
|
+
*
|
|
8
|
+
* `longVideo` was added in 4.2.0; `image` and `text` were always returned by
|
|
9
|
+
* the API but missing from this union. Code that switches on this field must
|
|
10
|
+
* handle values it does not recognise — the set grows as the platform does.
|
|
11
|
+
*/
|
|
12
|
+
type SocialPublisherPostType = "shortVideo" | "longVideo" | "image" | "text";
|
|
6
13
|
type SocialPublisherPostAccountType = "youtube" | "facebook" | "instagram" | "tiktok";
|
|
7
14
|
type SocialPublisherPostScheduleType = "now" | "schedule";
|
|
8
15
|
type SocialPublisherPostSourceType = "video-file" | "video-url";
|
|
@@ -72,7 +79,10 @@ interface IImageMediaRequest {
|
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
74
81
|
* Image-post create request (workspace target).
|
|
75
|
-
* Image posts cost **
|
|
82
|
+
* Image posts cost **50 credits**, and each comment that actually posts is a
|
|
83
|
+
* further **25**. Both numbers come from the API's plan data
|
|
84
|
+
* (`socialMediaPublisher.imagePost` and `socialMediaPublisher.commentOnPost`);
|
|
85
|
+
* the "5 credits + 1" this line used to carry was wrong on both halves.
|
|
76
86
|
* YouTube community posts are always reported as `notSupported`.
|
|
77
87
|
*/
|
|
78
88
|
interface ICreateImagePostToWorkspaceRequest {
|
|
@@ -89,7 +99,24 @@ interface ICreateImagePostToWorkspaceRequest {
|
|
|
89
99
|
facebook?: IFacebookPageConfig;
|
|
90
100
|
instagram?: IInstagramConfig;
|
|
91
101
|
schedule?: IScheduleConfig;
|
|
102
|
+
/**
|
|
103
|
+
* A single post-publish comment.
|
|
104
|
+
*
|
|
105
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
106
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
107
|
+
* so send one or the other.
|
|
108
|
+
*/
|
|
92
109
|
comment?: ICommentRequest;
|
|
110
|
+
/**
|
|
111
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
112
|
+
* post.
|
|
113
|
+
*
|
|
114
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
115
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
116
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
117
|
+
* dropped before it is charged.
|
|
118
|
+
*/
|
|
119
|
+
comments?: ICommentRequest[];
|
|
93
120
|
tag?: string;
|
|
94
121
|
refId?: string;
|
|
95
122
|
}
|
|
@@ -107,21 +134,80 @@ interface ICreateImagePostToAccountRequest {
|
|
|
107
134
|
facebook?: IFacebookPageConfig;
|
|
108
135
|
instagram?: IInstagramConfig;
|
|
109
136
|
schedule?: IScheduleConfig;
|
|
137
|
+
/**
|
|
138
|
+
* A single post-publish comment.
|
|
139
|
+
*
|
|
140
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
141
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
142
|
+
* so send one or the other.
|
|
143
|
+
*/
|
|
110
144
|
comment?: ICommentRequest;
|
|
145
|
+
/**
|
|
146
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
147
|
+
* post.
|
|
148
|
+
*
|
|
149
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
150
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
151
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
152
|
+
* dropped before it is charged.
|
|
153
|
+
*/
|
|
154
|
+
comments?: ICommentRequest[];
|
|
111
155
|
tag?: string;
|
|
112
156
|
refId?: string;
|
|
113
157
|
}
|
|
158
|
+
/** At most this many comments may ride on one post. Enforced server-side. */
|
|
159
|
+
declare const MAX_POST_COMMENTS = 5;
|
|
160
|
+
/** Longest a comment may be. */
|
|
161
|
+
declare const MAX_COMMENT_LENGTH = 2200;
|
|
162
|
+
/** Longest a comment may wait after the post before it is published. */
|
|
163
|
+
declare const MAX_COMMENT_DELAY_MINUTES: number;
|
|
114
164
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
165
|
+
* One post-publish comment.
|
|
166
|
+
*
|
|
167
|
+
* Posted under each enabled platform post once the post itself is live, either
|
|
168
|
+
* immediately or after a delay.
|
|
169
|
+
*
|
|
170
|
+
* **Pricing: 25 credits per comment**, charged per comment that actually posts —
|
|
171
|
+
* not per post, and not "+1". Earlier versions of this file documented "+1
|
|
172
|
+
* credit", which was never the price: the API charges
|
|
173
|
+
* `socialMediaPublisher.commentOnPost`, which its plan data prices at 25. A
|
|
174
|
+
* comment aimed at no enabled platform is dropped before it is charged.
|
|
175
|
+
*
|
|
176
|
+
* **TikTok is not supported** and never will be through this API: TikTok exposes
|
|
177
|
+
* no public comment-posting endpoint. A comment aimed at it reports
|
|
178
|
+
* `notSupported` rather than failing.
|
|
117
179
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
180
|
+
* **An image is Facebook only.** Instagram's and YouTube's comment endpoints are
|
|
181
|
+
* text-only, so an image bound for either is dropped with a reason rather than
|
|
182
|
+
* failing the comment.
|
|
121
183
|
*/
|
|
122
184
|
interface ICommentRequest {
|
|
123
|
-
/** Comment text (1..
|
|
185
|
+
/** Comment text (1..{@link MAX_COMMENT_LENGTH} characters). Required. */
|
|
124
186
|
text: string;
|
|
187
|
+
/**
|
|
188
|
+
* How long to wait after the post is published, in minutes.
|
|
189
|
+
*
|
|
190
|
+
* `0` or omitted posts it as soon as the post is live. Maximum
|
|
191
|
+
* {@link MAX_COMMENT_DELAY_MINUTES} (24 hours) — the API refuses more.
|
|
192
|
+
*/
|
|
193
|
+
delayMinutes?: number;
|
|
194
|
+
/**
|
|
195
|
+
* A publicly reachable image to attach. **Facebook only** (see above).
|
|
196
|
+
*
|
|
197
|
+
* Use this OR {@link imageStorageKey}, not both. A URL costs us no storage and
|
|
198
|
+
* is available on every plan; uploading is plan-gated.
|
|
199
|
+
*/
|
|
200
|
+
imageUrl?: string;
|
|
201
|
+
/**
|
|
202
|
+
* The storage key of an image uploaded through the account's
|
|
203
|
+
* `default-comments/upload-urls` endpoint.
|
|
204
|
+
*
|
|
205
|
+
* Prefer {@link imageUrl} unless you have uploaded the bytes yourself: the key
|
|
206
|
+
* is what tells the API the object is OURS, which is what its cleanup path
|
|
207
|
+
* uses when the post or the comment is deleted. Sending a public URL in this
|
|
208
|
+
* field makes the image read as external and it will never be cleaned up.
|
|
209
|
+
*/
|
|
210
|
+
imageStorageKey?: string;
|
|
125
211
|
/** Post the comment on Facebook (default: true). */
|
|
126
212
|
postToFacebook?: boolean;
|
|
127
213
|
/** Post the comment on Instagram (default: true). */
|
|
@@ -143,11 +229,23 @@ interface ICreateSocialPublisherPostRequest {
|
|
|
143
229
|
thumbURL?: string;
|
|
144
230
|
schedule?: IScheduleConfig;
|
|
145
231
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
232
|
+
* A single post-publish comment.
|
|
233
|
+
*
|
|
234
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
235
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
236
|
+
* so send one or the other.
|
|
149
237
|
*/
|
|
150
238
|
comment?: ICommentRequest;
|
|
239
|
+
/**
|
|
240
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
241
|
+
* post.
|
|
242
|
+
*
|
|
243
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
244
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
245
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
246
|
+
* dropped before it is charged.
|
|
247
|
+
*/
|
|
248
|
+
comments?: ICommentRequest[];
|
|
151
249
|
/**
|
|
152
250
|
* Tag (optional)
|
|
153
251
|
* Use this field to filter posts by tag.
|
|
@@ -173,11 +271,23 @@ interface ICreateSocialPublisherAccountPostRequest {
|
|
|
173
271
|
thumbURL?: string;
|
|
174
272
|
schedule?: IScheduleConfig;
|
|
175
273
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
274
|
+
* A single post-publish comment.
|
|
275
|
+
*
|
|
276
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
277
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
278
|
+
* so send one or the other.
|
|
179
279
|
*/
|
|
180
280
|
comment?: ICommentRequest;
|
|
281
|
+
/**
|
|
282
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
283
|
+
* post.
|
|
284
|
+
*
|
|
285
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
286
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
287
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
288
|
+
* dropped before it is charged.
|
|
289
|
+
*/
|
|
290
|
+
comments?: ICommentRequest[];
|
|
181
291
|
/**
|
|
182
292
|
* Tag (optional)
|
|
183
293
|
* Use this field to filter posts by tag.
|
|
@@ -200,8 +310,24 @@ interface IPostSetting {
|
|
|
200
310
|
instagram?: IInstagramConfig;
|
|
201
311
|
schedule?: IScheduleConfig;
|
|
202
312
|
source: SocialPublisherPostSourceType;
|
|
203
|
-
/**
|
|
313
|
+
/**
|
|
314
|
+
* A single post-publish comment.
|
|
315
|
+
*
|
|
316
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
317
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
318
|
+
* so send one or the other.
|
|
319
|
+
*/
|
|
204
320
|
comment?: ICommentRequest;
|
|
321
|
+
/**
|
|
322
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
323
|
+
* post.
|
|
324
|
+
*
|
|
325
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
326
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
327
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
328
|
+
* dropped before it is charged.
|
|
329
|
+
*/
|
|
330
|
+
comments?: ICommentRequest[];
|
|
205
331
|
/** Optional caller-supplied tag, persisted on the created post for filtering. */
|
|
206
332
|
tag?: string;
|
|
207
333
|
/** Optional caller-supplied reference ID, persisted on the created post for filtering. */
|
|
@@ -216,8 +342,24 @@ interface IAccountPostSetting {
|
|
|
216
342
|
instagram?: IInstagramConfig;
|
|
217
343
|
schedule?: IScheduleConfig;
|
|
218
344
|
source: SocialPublisherPostSourceType;
|
|
219
|
-
/**
|
|
345
|
+
/**
|
|
346
|
+
* A single post-publish comment.
|
|
347
|
+
*
|
|
348
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
349
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
350
|
+
* so send one or the other.
|
|
351
|
+
*/
|
|
220
352
|
comment?: ICommentRequest;
|
|
353
|
+
/**
|
|
354
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
355
|
+
* post.
|
|
356
|
+
*
|
|
357
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
358
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
359
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
360
|
+
* dropped before it is charged.
|
|
361
|
+
*/
|
|
362
|
+
comments?: ICommentRequest[];
|
|
221
363
|
/** Optional caller-supplied tag, persisted on the created post for filtering. */
|
|
222
364
|
tag?: string;
|
|
223
365
|
/** Optional caller-supplied reference ID, persisted on the created post for filtering. */
|
|
@@ -226,6 +368,13 @@ interface IAccountPostSetting {
|
|
|
226
368
|
interface IGenerateUploadUrlsRequest {
|
|
227
369
|
thumbFileType?: string;
|
|
228
370
|
videoFileType?: string;
|
|
371
|
+
/**
|
|
372
|
+
* Post type these uploads are for. Sending `"longVideo"` makes the server
|
|
373
|
+
* check plan gating and affordability now, before you spend an hour
|
|
374
|
+
* uploading something that cannot be published. The duration-accurate
|
|
375
|
+
* charge still happens when the post is created.
|
|
376
|
+
*/
|
|
377
|
+
postType?: SocialPublisherPostType;
|
|
229
378
|
}
|
|
230
379
|
/**
|
|
231
380
|
* Simplified options for the unified publish() method
|
|
@@ -287,10 +436,23 @@ interface IPublishOptions {
|
|
|
287
436
|
*/
|
|
288
437
|
refId?: string;
|
|
289
438
|
/**
|
|
290
|
-
*
|
|
291
|
-
*
|
|
439
|
+
* A single post-publish comment.
|
|
440
|
+
*
|
|
441
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
442
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
443
|
+
* so send one or the other.
|
|
292
444
|
*/
|
|
293
445
|
comment?: ICommentRequest;
|
|
446
|
+
/**
|
|
447
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
448
|
+
* post.
|
|
449
|
+
*
|
|
450
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
451
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
452
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
453
|
+
* dropped before it is charged.
|
|
454
|
+
*/
|
|
455
|
+
comments?: ICommentRequest[];
|
|
294
456
|
}
|
|
295
457
|
/**
|
|
296
458
|
* Options for publishing to an account
|
|
@@ -351,10 +513,23 @@ interface IPublishToAccountOptions {
|
|
|
351
513
|
*/
|
|
352
514
|
refId?: string;
|
|
353
515
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
516
|
+
* A single post-publish comment.
|
|
517
|
+
*
|
|
518
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
519
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
520
|
+
* so send one or the other.
|
|
356
521
|
*/
|
|
357
522
|
comment?: ICommentRequest;
|
|
523
|
+
/**
|
|
524
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
525
|
+
* post.
|
|
526
|
+
*
|
|
527
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
528
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
529
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
530
|
+
* dropped before it is charged.
|
|
531
|
+
*/
|
|
532
|
+
comments?: ICommentRequest[];
|
|
358
533
|
}
|
|
359
534
|
/**
|
|
360
535
|
* Base interface for quick publish options
|
|
@@ -407,10 +582,23 @@ interface IQuickPublishBaseOptions {
|
|
|
407
582
|
*/
|
|
408
583
|
refId?: string;
|
|
409
584
|
/**
|
|
410
|
-
*
|
|
411
|
-
*
|
|
585
|
+
* A single post-publish comment.
|
|
586
|
+
*
|
|
587
|
+
* @deprecated Use {@link comments} instead. Kept for one major version so
|
|
588
|
+
* existing callers keep compiling; the API refuses a request carrying BOTH,
|
|
589
|
+
* so send one or the other.
|
|
412
590
|
*/
|
|
413
591
|
comment?: ICommentRequest;
|
|
592
|
+
/**
|
|
593
|
+
* Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
|
|
594
|
+
* post.
|
|
595
|
+
*
|
|
596
|
+
* Each carries its own delay, its own optional image and its own per-platform
|
|
597
|
+
* flags — see {@link ICommentRequest}. **25 credits each**, charged per
|
|
598
|
+
* comment that actually posts; a comment aimed at no enabled platform is
|
|
599
|
+
* dropped before it is charged.
|
|
600
|
+
*/
|
|
601
|
+
comments?: ICommentRequest[];
|
|
414
602
|
}
|
|
415
603
|
/**
|
|
416
604
|
* Quick publish options for YouTube only
|
|
@@ -572,41 +760,144 @@ interface IListParams {
|
|
|
572
760
|
"instagram.postInfo.isAllow"?: boolean;
|
|
573
761
|
"tiktok.postInfo.isAllow"?: boolean;
|
|
574
762
|
}
|
|
763
|
+
/**
|
|
764
|
+
* Longest video the API accepts for a `longVideo` post: 60 minutes.
|
|
765
|
+
* Exported so callers can check a file before starting an upload, but the
|
|
766
|
+
* server measures the real duration and is the only authority on it.
|
|
767
|
+
*/
|
|
768
|
+
declare const LONG_VIDEO_MAX_DURATION_SECONDS = 3600;
|
|
769
|
+
/** One charge unit covers each started 5 minutes of video. */
|
|
770
|
+
declare const LONG_VIDEO_CREDIT_UNIT_SECONDS = 300;
|
|
771
|
+
/**
|
|
772
|
+
* Options for {@link SocialPublisherPostClient.publishLongVideoToWorkspace}.
|
|
773
|
+
*
|
|
774
|
+
* Identical to {@link IPublishOptions} apart from `onProgress` — a 60-minute
|
|
775
|
+
* upload is long enough that a caller needs to report it — and the absence of
|
|
776
|
+
* any duration field. The duration is measured server-side from the file, and
|
|
777
|
+
* the price is derived from that measurement, so a client-supplied duration
|
|
778
|
+
* would be a client-supplied price.
|
|
779
|
+
*/
|
|
780
|
+
interface ILongVideoUploadControls {
|
|
781
|
+
/**
|
|
782
|
+
* Called once the upload exists on the server, with its URL.
|
|
783
|
+
*
|
|
784
|
+
* Persist this if you want to resume the same transfer after a crash or a
|
|
785
|
+
* page reload: the ticket expires in minutes, but an upload that already
|
|
786
|
+
* exists resumes by its own URL and is unaffected. Pass it back as
|
|
787
|
+
* `resumeFrom`.
|
|
788
|
+
*/
|
|
789
|
+
onUploadUrl?: (uploadUrl: string) => void;
|
|
790
|
+
/**
|
|
791
|
+
* Resume a previous attempt instead of starting a new upload. Use the URL
|
|
792
|
+
* handed to `onUploadUrl` on the earlier run.
|
|
793
|
+
*/
|
|
794
|
+
resumeFrom?: string;
|
|
795
|
+
/**
|
|
796
|
+
* Abort the transfer. What has already been uploaded stays on the server and
|
|
797
|
+
* can be resumed with `resumeFrom`; no post is created, so nothing is
|
|
798
|
+
* charged.
|
|
799
|
+
*/
|
|
800
|
+
signal?: AbortSignal;
|
|
801
|
+
/**
|
|
802
|
+
* Discard the partial upload when `signal` fires, instead of leaving it
|
|
803
|
+
* resumable.
|
|
804
|
+
*
|
|
805
|
+
* Off by default: in most interfaces "pause" and "cancel" are the same
|
|
806
|
+
* button, and a user who paused a 40-minute video does not expect to start
|
|
807
|
+
* over. Set it where the abort really is final — a closed wizard, a replaced
|
|
808
|
+
* file — so the server stops holding megabytes nobody will claim.
|
|
809
|
+
*
|
|
810
|
+
* Best-effort. A failed termination is not reported, because the server
|
|
811
|
+
* expires abandoned uploads after 24 hours regardless.
|
|
812
|
+
*/
|
|
813
|
+
terminateOnAbort?: boolean;
|
|
814
|
+
}
|
|
815
|
+
interface IPublishLongVideoOptions extends IPublishOptions, ILongVideoUploadControls {
|
|
816
|
+
/**
|
|
817
|
+
* Called as the upload proceeds, with a percentage.
|
|
818
|
+
*
|
|
819
|
+
* Resumable transfers report per chunk — 8MiB of an hour-long file at a time
|
|
820
|
+
* — so this moves continuously. It falls back to 0 then 100 only on a server
|
|
821
|
+
* without the resumable service, where the single signed PUT would need
|
|
822
|
+
* `XMLHttpRequest` to report anything in between.
|
|
823
|
+
*/
|
|
824
|
+
onProgress?: (progress: number) => void;
|
|
825
|
+
}
|
|
826
|
+
/** Account-targeted counterpart of {@link IPublishLongVideoOptions}. */
|
|
827
|
+
interface IPublishLongVideoToAccountOptions extends IPublishToAccountOptions, ILongVideoUploadControls {
|
|
828
|
+
/** See the note on {@link IPublishLongVideoOptions.onProgress}. */
|
|
829
|
+
onProgress?: (progress: number) => void;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Re-schedule (or edit) a post that has not published yet.
|
|
833
|
+
*
|
|
834
|
+
* Only posts still pending with a future publish time accept this; anything
|
|
835
|
+
* that has started publishing is refused by the server.
|
|
836
|
+
*/
|
|
837
|
+
interface IReschedulePostRequest {
|
|
838
|
+
/** New publish moment. Pass a `Date`, or `"now"` to publish immediately. */
|
|
839
|
+
schedule: "now" | Date;
|
|
840
|
+
/** Optionally replace the caption at the same time. */
|
|
841
|
+
caption?: string;
|
|
842
|
+
}
|
|
575
843
|
|
|
576
844
|
interface IUploadConfig {
|
|
577
845
|
url: string;
|
|
578
846
|
fields: Record<string, string>;
|
|
579
847
|
}
|
|
848
|
+
/**
|
|
849
|
+
* One upload destination the API authorized.
|
|
850
|
+
*
|
|
851
|
+
* The same slot is offered two ways. `uploadFileURL` is a signed R2 PUT — one
|
|
852
|
+
* request, no resume. The `tus*` fields describe the same destination as a
|
|
853
|
+
* resumable transfer. Both land the file at `fileURL`, so nothing downstream
|
|
854
|
+
* cares which was used.
|
|
855
|
+
*
|
|
856
|
+
* The resumable fields are optional on purpose: an API not deployed with the
|
|
857
|
+
* resumable service omits them, and clients fall back to the signed PUT.
|
|
858
|
+
*/
|
|
859
|
+
interface IUploadTarget {
|
|
860
|
+
/** Public URL of the finished object. Known before the upload starts. */
|
|
861
|
+
fileURL: string | undefined;
|
|
862
|
+
/** Signed URL for a single PUT. */
|
|
863
|
+
uploadFileURL: string | undefined;
|
|
864
|
+
/** Object key inside the bucket. */
|
|
865
|
+
bucketFilePath: string | undefined;
|
|
866
|
+
/**
|
|
867
|
+
* Absolute tus endpoint for this same destination, when resumable uploads
|
|
868
|
+
* are configured.
|
|
869
|
+
*/
|
|
870
|
+
tusEndpoint?: string;
|
|
871
|
+
/**
|
|
872
|
+
* Signed capability naming this exact destination, sent as the tus
|
|
873
|
+
* `Upload-Metadata` key `ticket`. Short-lived, and never to be logged or
|
|
874
|
+
* persisted.
|
|
875
|
+
*/
|
|
876
|
+
ticket?: string;
|
|
877
|
+
/** When the ticket stops being accepted for creating an upload. */
|
|
878
|
+
ticketExpiresAt?: string;
|
|
879
|
+
/** Maximum accepted size in bytes, so a client can fail fast. */
|
|
880
|
+
maxSize?: number;
|
|
881
|
+
}
|
|
580
882
|
interface IGenerateUploadUrlsResponse {
|
|
581
883
|
postId: string;
|
|
582
|
-
thumb:
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
*/
|
|
600
|
-
fileURL: string | undefined;
|
|
601
|
-
/**
|
|
602
|
-
* Upload URL to upload file to Cloud Bucket (Signed URL)
|
|
603
|
-
*/
|
|
604
|
-
uploadFileURL: string | undefined;
|
|
605
|
-
/**
|
|
606
|
-
* Path in Cloud Bucket
|
|
607
|
-
*/
|
|
608
|
-
bucketFilePath: string | undefined;
|
|
609
|
-
};
|
|
884
|
+
thumb: IUploadTarget;
|
|
885
|
+
video: IUploadTarget;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Per-platform outcome of a {@link SocialPublisherPostClient.removePost} call.
|
|
889
|
+
* `notSupported` marks platforms (Instagram, TikTok) whose API can't delete a
|
|
890
|
+
* published post; `skipped` marks platforms that had nothing to delete.
|
|
891
|
+
*/
|
|
892
|
+
interface IRemovePostPlatformResult {
|
|
893
|
+
success: boolean;
|
|
894
|
+
notSupported?: boolean;
|
|
895
|
+
skipped?: boolean;
|
|
896
|
+
error?: string;
|
|
897
|
+
}
|
|
898
|
+
interface IRemovePostResponse {
|
|
899
|
+
_id: string;
|
|
900
|
+
results: Partial<Record<"youtube" | "facebook" | "instagram" | "tiktok", IRemovePostPlatformResult>>;
|
|
610
901
|
}
|
|
611
902
|
interface ISocialPublisherPostStatusLog {
|
|
612
903
|
status: SocialPublisherPostStatusType;
|
|
@@ -646,7 +937,11 @@ interface IImageDTO {
|
|
|
646
937
|
}
|
|
647
938
|
/**
|
|
648
939
|
* Per-platform comment status block returned on the post status response.
|
|
649
|
-
* Present only when the post was created with a
|
|
940
|
+
* Present only when the post was created with a comment payload.
|
|
941
|
+
*
|
|
942
|
+
* With a LIST of comments this describes the first one; the whole list, one
|
|
943
|
+
* entry per comment, is {@link ICommentStatusDTO}[] on `comments`. The singular
|
|
944
|
+
* block is kept so a caller written against one comment keeps reading.
|
|
650
945
|
*
|
|
651
946
|
* TikTok always returns `currentStatus = "notSupported"`.
|
|
652
947
|
*/
|
|
@@ -666,6 +961,25 @@ interface ICommentInfoDTO {
|
|
|
666
961
|
/** Grouped history of status transitions for this platform comment. */
|
|
667
962
|
statusHistoryGrouped?: IBaseStatusHistoryGroupedDay<CommentStatusType>[];
|
|
668
963
|
}
|
|
964
|
+
/**
|
|
965
|
+
* One comment's status on one platform.
|
|
966
|
+
*
|
|
967
|
+
* `order` is the position it posts in, which is also the position it was sent
|
|
968
|
+
* in — the API takes the order from the array rather than from a field on the
|
|
969
|
+
* comment, so two comments cannot claim the same slot.
|
|
970
|
+
*/
|
|
971
|
+
interface ICommentStatusDTO extends ICommentInfoDTO {
|
|
972
|
+
/** Position in the list, from 0. Also the order it posts in. */
|
|
973
|
+
order: number;
|
|
974
|
+
/** The text as it was sent, so a status row is readable without the request. */
|
|
975
|
+
text?: string;
|
|
976
|
+
/** Minutes waited after the post went live. `0` means immediately. */
|
|
977
|
+
delayMinutes?: number;
|
|
978
|
+
/** The image attached, if any. Facebook only; dropped elsewhere with a reason. */
|
|
979
|
+
imageUrl?: string;
|
|
980
|
+
/** Set when this comment was copied from the account's saved defaults. */
|
|
981
|
+
defaultCommentId?: string;
|
|
982
|
+
}
|
|
669
983
|
interface ISocialPublisherPostPlatform {
|
|
670
984
|
postInfo: ISocialPublisherPostInfo;
|
|
671
985
|
}
|
|
@@ -699,11 +1013,22 @@ interface ISocialPublisherPostResponse {
|
|
|
699
1013
|
};
|
|
700
1014
|
refId: string;
|
|
701
1015
|
tag: string;
|
|
1016
|
+
type?: "shortVideo" | "longVideo" | "image" | string;
|
|
1017
|
+
source?: SocialPublisherPostSourceType | string;
|
|
1018
|
+
sourceURLs?: {
|
|
1019
|
+
thumbURL?: string;
|
|
1020
|
+
videoURL?: string;
|
|
1021
|
+
postURL?: string;
|
|
1022
|
+
imageURL?: string;
|
|
1023
|
+
};
|
|
1024
|
+
image?: {
|
|
1025
|
+
externalUrl?: string;
|
|
1026
|
+
};
|
|
702
1027
|
}
|
|
703
1028
|
interface ISocialPublisherPostStatusResponse {
|
|
704
1029
|
_id: string;
|
|
705
1030
|
numbering: string;
|
|
706
|
-
type: "shortVideo" | "image";
|
|
1031
|
+
type: "shortVideo" | "longVideo" | "image";
|
|
707
1032
|
source: SocialPublisherPostSourceType;
|
|
708
1033
|
sourceURLs: {
|
|
709
1034
|
/**
|
|
@@ -721,6 +1046,8 @@ interface ISocialPublisherPostStatusResponse {
|
|
|
721
1046
|
};
|
|
722
1047
|
/** Image-post metadata — only present when `type === "image"`. */
|
|
723
1048
|
image?: IImageDTO;
|
|
1049
|
+
/** Long-video metadata — only present when `type === "longVideo"`. */
|
|
1050
|
+
video?: IVideoDTO;
|
|
724
1051
|
currentStatus: SocialPublisherPostStatusType;
|
|
725
1052
|
currentError: string;
|
|
726
1053
|
currentStatusChangedAt: string;
|
|
@@ -737,6 +1064,10 @@ interface ISocialPublisherPostStatusResponse {
|
|
|
737
1064
|
scheduledAt: Date;
|
|
738
1065
|
executedAt: Date;
|
|
739
1066
|
};
|
|
1067
|
+
/** Custom reference id supplied when the post was created. */
|
|
1068
|
+
refId?: string;
|
|
1069
|
+
/** Custom tag supplied when the post was created. */
|
|
1070
|
+
tag?: string;
|
|
740
1071
|
}
|
|
741
1072
|
interface ISocialPublisherWorkspace {
|
|
742
1073
|
_id: string;
|
|
@@ -776,12 +1107,22 @@ interface ISocialPublisherPostTikTokPostDetails extends ISocialPublisherPostAcco
|
|
|
776
1107
|
privacy_level: string;
|
|
777
1108
|
/** Per-platform comment status — TikTok always reports `notSupported`. */
|
|
778
1109
|
commentInfo?: ICommentInfoDTO;
|
|
1110
|
+
/** One entry per comment, every one of them `notSupported` on TikTok. */
|
|
1111
|
+
comments?: ICommentStatusDTO[];
|
|
779
1112
|
}
|
|
780
1113
|
interface ISocialPublisherPostFacebookPagePostDetails extends ISocialPublisherPostAccount {
|
|
781
1114
|
description: string;
|
|
782
1115
|
title: string;
|
|
783
1116
|
/** Per-platform comment status (only present when a comment was requested). */
|
|
784
1117
|
commentInfo?: ICommentInfoDTO;
|
|
1118
|
+
/**
|
|
1119
|
+
* One entry per comment on this platform, in posting order.
|
|
1120
|
+
*
|
|
1121
|
+
* Present when the post was created with `comments[]`. `commentInfo` above
|
|
1122
|
+
* mirrors the first entry, so a caller written before the list existed keeps
|
|
1123
|
+
* working.
|
|
1124
|
+
*/
|
|
1125
|
+
comments?: ICommentStatusDTO[];
|
|
785
1126
|
}
|
|
786
1127
|
interface ISocialPublisherPostInstagramPostDetails extends ISocialPublisherPostAccount {
|
|
787
1128
|
description: string;
|
|
@@ -789,6 +1130,14 @@ interface ISocialPublisherPostInstagramPostDetails extends ISocialPublisherPostA
|
|
|
789
1130
|
is_published_to_both_feed_and_story: boolean;
|
|
790
1131
|
/** Per-platform comment status (only present when a comment was requested). */
|
|
791
1132
|
commentInfo?: ICommentInfoDTO;
|
|
1133
|
+
/**
|
|
1134
|
+
* One entry per comment on this platform, in posting order.
|
|
1135
|
+
*
|
|
1136
|
+
* Present when the post was created with `comments[]`. `commentInfo` above
|
|
1137
|
+
* mirrors the first entry, so a caller written before the list existed keeps
|
|
1138
|
+
* working.
|
|
1139
|
+
*/
|
|
1140
|
+
comments?: ICommentStatusDTO[];
|
|
792
1141
|
}
|
|
793
1142
|
interface ISocialPublisherPostYouTubePostDetails extends ISocialPublisherPostAccount {
|
|
794
1143
|
title: string;
|
|
@@ -802,6 +1151,14 @@ interface ISocialPublisherPostYouTubePostDetails extends ISocialPublisherPostAcc
|
|
|
802
1151
|
localizations: any;
|
|
803
1152
|
/** Per-platform comment status (only present when a comment was requested). */
|
|
804
1153
|
commentInfo?: ICommentInfoDTO;
|
|
1154
|
+
/**
|
|
1155
|
+
* One entry per comment on this platform, in posting order.
|
|
1156
|
+
*
|
|
1157
|
+
* Present when the post was created with `comments[]`. `commentInfo` above
|
|
1158
|
+
* mirrors the first entry, so a caller written before the list existed keeps
|
|
1159
|
+
* working.
|
|
1160
|
+
*/
|
|
1161
|
+
comments?: ICommentStatusDTO[];
|
|
805
1162
|
}
|
|
806
1163
|
interface ISocialPublisherPostNextPreviousResponse {
|
|
807
1164
|
nextId?: string;
|
|
@@ -819,6 +1176,89 @@ interface IBaseStatusHistoryGroupedItem<StatusType> {
|
|
|
819
1176
|
time: Date;
|
|
820
1177
|
status: StatusType;
|
|
821
1178
|
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Long-video metadata carried on a post. Present only when the post's `type`
|
|
1181
|
+
* is `longVideo`.
|
|
1182
|
+
*/
|
|
1183
|
+
interface IVideoDTO {
|
|
1184
|
+
/** Duration measured server-side, in seconds. */
|
|
1185
|
+
durationSeconds: number;
|
|
1186
|
+
/** Charge units billed — one per started 5 minutes. */
|
|
1187
|
+
creditUnits?: number;
|
|
1188
|
+
container?: string;
|
|
1189
|
+
videoCodec?: string;
|
|
1190
|
+
audioCodec?: string;
|
|
1191
|
+
width?: number;
|
|
1192
|
+
height?: number;
|
|
1193
|
+
sizeBytes?: number;
|
|
1194
|
+
}
|
|
1195
|
+
/** What one platform would do with a video of a given length. */
|
|
1196
|
+
interface ILongVideoPlatformVerdict {
|
|
1197
|
+
platform: "youtube" | "facebook" | "instagram" | "tiktok";
|
|
1198
|
+
accepted: boolean;
|
|
1199
|
+
/** The limit that applied, in seconds, when one did. */
|
|
1200
|
+
limitSeconds?: number;
|
|
1201
|
+
/** Why the platform refused. Present only when `accepted` is false. */
|
|
1202
|
+
reason?: string;
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Result of {@link SocialPublisherPostClient.getLongVideoQuote} — what the
|
|
1206
|
+
* post will cost, before committing to it.
|
|
1207
|
+
*/
|
|
1208
|
+
interface ILongVideoQuoteResponse {
|
|
1209
|
+
/** Duration measured server-side, in seconds, rounded up. */
|
|
1210
|
+
durationSeconds: number;
|
|
1211
|
+
/** The ceiling the API enforces (3600). */
|
|
1212
|
+
maxDurationSeconds: number;
|
|
1213
|
+
/** False when the video is over the ceiling; `reason` then says by how much. */
|
|
1214
|
+
withinLimit: boolean;
|
|
1215
|
+
/** Charge units — one per started 5 minutes. Zero when over the limit. */
|
|
1216
|
+
units: number;
|
|
1217
|
+
/** This plan's cost per unit (50 by default). */
|
|
1218
|
+
creditsPerUnit: number;
|
|
1219
|
+
/** Total credits the post will cost. */
|
|
1220
|
+
credits: number;
|
|
1221
|
+
/** True when the plan does not include long video posting. */
|
|
1222
|
+
isGated: boolean;
|
|
1223
|
+
container?: string;
|
|
1224
|
+
videoCodec?: string;
|
|
1225
|
+
width?: number;
|
|
1226
|
+
height?: number;
|
|
1227
|
+
/** What each platform would do with a video this long. */
|
|
1228
|
+
platforms: ILongVideoPlatformVerdict[];
|
|
1229
|
+
/** Present only when `withinLimit` is false. */
|
|
1230
|
+
reason?: string;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* A connected platform dropped from a workspace post because the video is too
|
|
1234
|
+
* long for it. The rest of the post still publishes.
|
|
1235
|
+
*/
|
|
1236
|
+
interface ILongVideoRefusedTarget {
|
|
1237
|
+
platform: "youtube" | "facebook" | "instagram" | "tiktok";
|
|
1238
|
+
/** Names that platform's limit and this video's length. */
|
|
1239
|
+
reason: string;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Result of publishing a long video. Unlike the short-video helpers, which
|
|
1243
|
+
* return just an id, this carries what was measured and what was charged —
|
|
1244
|
+
* and which targets, if any, were dropped for exceeding their own limit.
|
|
1245
|
+
*/
|
|
1246
|
+
interface IPublishLongVideoResult {
|
|
1247
|
+
/** Created post ID. */
|
|
1248
|
+
_id: string;
|
|
1249
|
+
/** Duration measured server-side, in seconds. */
|
|
1250
|
+
durationSeconds: number;
|
|
1251
|
+
/** Charge units billed. */
|
|
1252
|
+
creditUnits: number;
|
|
1253
|
+
/** Credits actually charged. */
|
|
1254
|
+
credits: number;
|
|
1255
|
+
/**
|
|
1256
|
+
* Targets dropped because the video exceeded their duration limit. Empty
|
|
1257
|
+
* when every connected account accepted it. Always empty for account-targeted
|
|
1258
|
+
* posts, which are refused outright rather than partially published.
|
|
1259
|
+
*/
|
|
1260
|
+
refusedTargets: ILongVideoRefusedTarget[];
|
|
1261
|
+
}
|
|
822
1262
|
|
|
823
1263
|
/**
|
|
824
1264
|
* Social Publisher Post Client
|
|
@@ -849,6 +1289,26 @@ declare class SocialPublisherPostClient {
|
|
|
849
1289
|
* @param data - File information
|
|
850
1290
|
*/
|
|
851
1291
|
private generateUploadUrls;
|
|
1292
|
+
/**
|
|
1293
|
+
* Remove (delete) a post's published media directly from the connected
|
|
1294
|
+
* platform pages. Runs synchronously on the server — the media is deleted
|
|
1295
|
+
* from the platform immediately, not via a background job.
|
|
1296
|
+
*
|
|
1297
|
+
* Cost: 50 credits, charged ONLY when the removal succeeds (at least one
|
|
1298
|
+
* platform cleared and no delete-capable platform failed). Instagram and
|
|
1299
|
+
* TikTok expose no delete API, so a post published only to those platforms
|
|
1300
|
+
* cannot be removed programmatically and no credits are charged.
|
|
1301
|
+
*
|
|
1302
|
+
* @param id - Post ID
|
|
1303
|
+
* @returns Per-platform removal results
|
|
1304
|
+
*
|
|
1305
|
+
* @example
|
|
1306
|
+
* ```ts
|
|
1307
|
+
* const { results } = await client.removePost("post_123");
|
|
1308
|
+
* // results.youtube?.success === true
|
|
1309
|
+
* ```
|
|
1310
|
+
*/
|
|
1311
|
+
removePost(id: string): Promise<IRemovePostResponse>;
|
|
852
1312
|
/**
|
|
853
1313
|
* Get next and previous post IDs
|
|
854
1314
|
* @param id - Current Post ID
|
|
@@ -981,6 +1441,108 @@ declare class SocialPublisherPostClient {
|
|
|
981
1441
|
* @deprecated Use publishShortVideoToWorkspace instead
|
|
982
1442
|
*/
|
|
983
1443
|
publishShortVideo(options: IPublishOptions): Promise<string>;
|
|
1444
|
+
/**
|
|
1445
|
+
* Price a long video before publishing it. Neither creates nor charges
|
|
1446
|
+
* anything.
|
|
1447
|
+
*
|
|
1448
|
+
* The server reads the video, measures its duration, and returns the exact
|
|
1449
|
+
* cost plus what each platform would do with a video that long. Show this
|
|
1450
|
+
* before the user commits — the units come from the same function the create
|
|
1451
|
+
* call charges with, so the quote and the bill cannot disagree.
|
|
1452
|
+
*
|
|
1453
|
+
* @param videoURL - URL of an uploaded or externally hosted video
|
|
1454
|
+
*
|
|
1455
|
+
* @example
|
|
1456
|
+
* ```ts
|
|
1457
|
+
* const quote = await client.getLongVideoQuote(fileURL);
|
|
1458
|
+
* if (!quote.withinLimit) throw new Error(quote.reason);
|
|
1459
|
+
* console.log(`${quote.durationSeconds}s costs ${quote.credits} credits`);
|
|
1460
|
+
* const blocked = quote.platforms.filter((p) => !p.accepted);
|
|
1461
|
+
* ```
|
|
1462
|
+
*/
|
|
1463
|
+
getLongVideoQuote(videoURL: string): Promise<ILongVideoQuoteResponse>;
|
|
1464
|
+
/**
|
|
1465
|
+
* Publish a video of up to 60 minutes to every account connected to a
|
|
1466
|
+
* workspace.
|
|
1467
|
+
*
|
|
1468
|
+
* Handles the whole sequence for an uploaded file: request an upload
|
|
1469
|
+
* destination, push the bytes, then create the post. Pass a URL instead of a
|
|
1470
|
+
* `File` to publish something already hosted elsewhere.
|
|
1471
|
+
*
|
|
1472
|
+
* Cost is duration-based — 50 credits per started 5 minutes — so a 12-minute
|
|
1473
|
+
* video costs 150. Call {@link getLongVideoQuote} first if you need to show
|
|
1474
|
+
* the price. The duration is measured server-side; there is no duration
|
|
1475
|
+
* option here because a client-supplied one would be a client-supplied price.
|
|
1476
|
+
*
|
|
1477
|
+
* Platforms differ on what they accept: a 40-minute video publishes to
|
|
1478
|
+
* YouTube and Facebook but is refused by Instagram, whose Reels cap at 15
|
|
1479
|
+
* minutes. Those targets come back in `refusedTargets` — the post still
|
|
1480
|
+
* publishes to the rest.
|
|
1481
|
+
*
|
|
1482
|
+
* @example
|
|
1483
|
+
* ```ts
|
|
1484
|
+
* const result = await client.publishLongVideoToWorkspace({
|
|
1485
|
+
* workspaceId: "ws_123",
|
|
1486
|
+
* video: recordingFile,
|
|
1487
|
+
* youtube: { title: "Full session", description: "...", tags: ["workshop"] },
|
|
1488
|
+
* onProgress: (p) => console.log(`${p}%`),
|
|
1489
|
+
* });
|
|
1490
|
+
* console.log(`Charged ${result.credits} credits for ${result.durationSeconds}s`);
|
|
1491
|
+
* for (const t of result.refusedTargets) console.warn(t.reason);
|
|
1492
|
+
* ```
|
|
1493
|
+
*/
|
|
1494
|
+
publishLongVideoToWorkspace(options: IPublishLongVideoOptions): Promise<IPublishLongVideoResult>;
|
|
1495
|
+
/**
|
|
1496
|
+
* Publish a video of up to 60 minutes to a single connected account.
|
|
1497
|
+
*
|
|
1498
|
+
* With one target there is no partial success: if that platform will not take
|
|
1499
|
+
* a video this long, the whole call is refused and nothing is charged. See
|
|
1500
|
+
* {@link publishLongVideoToWorkspace} for the cost model.
|
|
1501
|
+
*/
|
|
1502
|
+
publishLongVideoToAccount(options: IPublishLongVideoToAccountOptions): Promise<IPublishLongVideoResult>;
|
|
1503
|
+
/**
|
|
1504
|
+
* Re-schedule a post that has not published yet, or send it out now.
|
|
1505
|
+
*
|
|
1506
|
+
* Free — this costs no credits. Only posts still pending with a future
|
|
1507
|
+
* publish time are eligible; anything that has started publishing is refused
|
|
1508
|
+
* by the server with a reason.
|
|
1509
|
+
*
|
|
1510
|
+
* @example
|
|
1511
|
+
* ```ts
|
|
1512
|
+
* await client.reschedulePost("post_123", { schedule: new Date("2026-09-01T09:00:00Z") });
|
|
1513
|
+
* await client.reschedulePost("post_123", { schedule: "now" });
|
|
1514
|
+
* ```
|
|
1515
|
+
*/
|
|
1516
|
+
reschedulePost(id: string, data: IReschedulePostRequest): Promise<void>;
|
|
1517
|
+
/**
|
|
1518
|
+
* Delete a post that has not published yet, releasing its uploaded media in
|
|
1519
|
+
* the same request.
|
|
1520
|
+
*
|
|
1521
|
+
* Free, and nothing is refunded — nothing was charged for a post that never
|
|
1522
|
+
* went out. A post that HAS published is refused; use {@link removePost} to
|
|
1523
|
+
* take down media that is already live.
|
|
1524
|
+
*
|
|
1525
|
+
* @example
|
|
1526
|
+
* ```ts
|
|
1527
|
+
* await client.deletePost("post_123");
|
|
1528
|
+
* ```
|
|
1529
|
+
*/
|
|
1530
|
+
deletePost(id: string): Promise<void>;
|
|
1531
|
+
/**
|
|
1532
|
+
* Upload a long video and return the URL to publish from.
|
|
1533
|
+
*
|
|
1534
|
+
* Declares `postType: "longVideo"` so the server refuses now — on plan gating
|
|
1535
|
+
* or an empty balance — rather than after an hour of transfer.
|
|
1536
|
+
*/
|
|
1537
|
+
private uploadLongVideo;
|
|
1538
|
+
/** Translate the friendly `"now" | Date` form into the wire shape. */
|
|
1539
|
+
private buildSchedule;
|
|
1540
|
+
/**
|
|
1541
|
+
* Guarantee the shape callers destructure. An older server that does not yet
|
|
1542
|
+
* return the duration fields would otherwise hand back `undefined` where the
|
|
1543
|
+
* types promise numbers.
|
|
1544
|
+
*/
|
|
1545
|
+
private normaliseLongVideoResult;
|
|
984
1546
|
/**
|
|
985
1547
|
* Auto-detect video source type.
|
|
986
1548
|
*
|
|
@@ -990,4 +1552,83 @@ declare class SocialPublisherPostClient {
|
|
|
990
1552
|
private detectVideoSource;
|
|
991
1553
|
}
|
|
992
1554
|
|
|
993
|
-
|
|
1555
|
+
/**
|
|
1556
|
+
* Resumable uploads (tus 1.0.0) for large media.
|
|
1557
|
+
*
|
|
1558
|
+
* A signed PUT is all-or-nothing: a dropped connection at 90% of an hour-long
|
|
1559
|
+
* video starts again from zero. The API offers the same destination as a
|
|
1560
|
+
* resumable transfer, and this is the client for it.
|
|
1561
|
+
*
|
|
1562
|
+
* The protocol subset needed here is small — create, patch, head — so it is
|
|
1563
|
+
* implemented directly rather than by pulling `tus-js-client` into a published
|
|
1564
|
+
* SDK's dependency tree. What is deliberately NOT implemented is fingerprint
|
|
1565
|
+
* storage: resuming across page loads needs somewhere to persist the upload
|
|
1566
|
+
* URL, which is the caller's decision, not a library's. Pass `uploadUrl` back
|
|
1567
|
+
* in to resume an earlier attempt yourself.
|
|
1568
|
+
*/
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* 8MiB matches the server's multipart part size, so one PATCH becomes one R2
|
|
1572
|
+
* part with no server-side re-buffering. It also caps how much progress a
|
|
1573
|
+
* dropped connection can cost.
|
|
1574
|
+
*/
|
|
1575
|
+
declare const DEFAULT_CHUNK_SIZE: number;
|
|
1576
|
+
interface IResumableUploadOptions {
|
|
1577
|
+
/** Called with 0-100 as the transfer proceeds. */
|
|
1578
|
+
onProgress?: (progress: number) => void;
|
|
1579
|
+
/**
|
|
1580
|
+
* Called once the upload exists on the server, with its URL. Persist this to
|
|
1581
|
+
* resume the same transfer later — the ticket expires, but an upload that
|
|
1582
|
+
* already exists resumes by its own URL and is unaffected.
|
|
1583
|
+
*/
|
|
1584
|
+
onUploadUrl?: (uploadUrl: string) => void;
|
|
1585
|
+
/** Resume a previous attempt instead of creating a new upload. */
|
|
1586
|
+
uploadUrl?: string;
|
|
1587
|
+
/** Bytes per PATCH. Defaults to the server's 8MiB part size. */
|
|
1588
|
+
chunkSize?: number;
|
|
1589
|
+
/** Abort the transfer. A partially uploaded file can be resumed later. */
|
|
1590
|
+
signal?: AbortSignal;
|
|
1591
|
+
/**
|
|
1592
|
+
* Tell the server to discard the partial upload when `signal` fires.
|
|
1593
|
+
*
|
|
1594
|
+
* Off by default, and deliberately so: the reason abort leaves the bytes in
|
|
1595
|
+
* place is that "cancel" and "pause" are the same gesture in most UIs, and a
|
|
1596
|
+
* user who paused a 40-minute video does not expect to start over. Turn this
|
|
1597
|
+
* on where the abort really is final — a wizard the user closed, a file they
|
|
1598
|
+
* replaced — so the server stops holding megabytes nobody will claim.
|
|
1599
|
+
*
|
|
1600
|
+
* Best-effort: a failed termination is swallowed, because the caller is
|
|
1601
|
+
* already being handed an AbortError and the server expires the upload on its
|
|
1602
|
+
* own after 24h regardless.
|
|
1603
|
+
*/
|
|
1604
|
+
terminateOnAbort?: boolean;
|
|
1605
|
+
/** Content type stamped on the request when the blob does not carry one. */
|
|
1606
|
+
fallbackType?: string;
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Whether this target can be uploaded resumably. A server without the resumable
|
|
1610
|
+
* service configured simply omits these fields, and callers fall back.
|
|
1611
|
+
*/
|
|
1612
|
+
declare function supportsResumableUpload(target: IUploadTarget): boolean;
|
|
1613
|
+
/**
|
|
1614
|
+
* Discard an upload the server is still holding (tus Termination extension).
|
|
1615
|
+
*
|
|
1616
|
+
* Exported because the decision is the caller's: an upload URL persisted from
|
|
1617
|
+
* `onUploadUrl` outlives the transfer that created it, and only the caller knows
|
|
1618
|
+
* whether the user means to come back to it. Without this the bytes sit on the
|
|
1619
|
+
* server until its 24h expiry sweep.
|
|
1620
|
+
*
|
|
1621
|
+
* Resolves `true` when the server confirms, `false` when it refuses or is
|
|
1622
|
+
* unreachable — never throws, since nothing useful can be done about a failed
|
|
1623
|
+
* cleanup of something that expires on its own.
|
|
1624
|
+
*/
|
|
1625
|
+
declare function terminateUpload(uploadUrl: string): Promise<boolean>;
|
|
1626
|
+
/**
|
|
1627
|
+
* Upload a file resumably, returning the public URL it lands at.
|
|
1628
|
+
*
|
|
1629
|
+
* `target.fileURL` came back with the ticket, so the final URL is known up
|
|
1630
|
+
* front and there is no completion body to parse.
|
|
1631
|
+
*/
|
|
1632
|
+
declare function uploadResumable(target: IUploadTarget, file: Blob, options?: IResumableUploadOptions): Promise<string>;
|
|
1633
|
+
|
|
1634
|
+
export { type CommentStatusType, DEFAULT_CHUNK_SIZE, type IAccountPostSetting, type IBaseStatusHistoryGroupedDay, type IBaseStatusHistoryGroupedItem, type ICommentInfoDTO, type ICommentRequest, type ICommentStatusDTO, type ICreateImagePostToAccountRequest, type ICreateImagePostToWorkspaceRequest, type ICreateSocialPublisherAccountPostRequest, type ICreateSocialPublisherPostRequest, type IDefaultSettingsResponse, type IFacebookPageConfig, type IGenerateUploadUrlsRequest, type IGenerateUploadUrlsResponse, type IImageDTO, type IImageMediaRequest, type IInstagramConfig, type IListParams, type ILongVideoPlatformVerdict, type ILongVideoQuoteResponse, type ILongVideoRefusedTarget, type ILongVideoUploadControls, type IPostSetting, type IPublishLongVideoOptions, type IPublishLongVideoResult, type IPublishLongVideoToAccountOptions, type IPublishOptions, type IPublishToAccountOptions, type IQuickPublishAllOptions, type IQuickPublishBaseOptions, type IQuickPublishFacebookOptions, type IQuickPublishInstagramOptions, type IQuickPublishTikTokOptions, type IQuickPublishYouTubeOptions, type IRemovePostPlatformResult, type IRemovePostResponse, type IReschedulePostRequest, type IResumableUploadOptions, 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 IUploadTarget, type IVideoDTO, type IYouTubeConfig, type ImageSourceType, LONG_VIDEO_CREDIT_UNIT_SECONDS, LONG_VIDEO_MAX_DURATION_SECONDS, MAX_COMMENT_DELAY_MINUTES, MAX_COMMENT_LENGTH, MAX_POST_COMMENTS, type SocialPublisherAccountAccountType, type SocialPublisherAccountPlatformType, type SocialPublisherAccountStatusType, type SocialPublisherPostAccountType, SocialPublisherPostClient, type SocialPublisherPostScheduleType, type SocialPublisherPostSourceType, type SocialPublisherPostStatusType, type SocialPublisherPostType, supportsResumableUpload, terminateUpload, uploadResumable };
|