upload-post 2.15.0 → 2.16.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 CHANGED
@@ -191,6 +191,14 @@ await client.editScheduled('job-id', {
191
191
  },
192
192
  });
193
193
 
194
+ // Change any other option by its API form name (null removes it), schedule the
195
+ // video natively on YouTube, or replace the Reels cover
196
+ await client.editScheduled('job-id', {
197
+ fields: { privacyStatus: 'unlisted', disable_comment: true, instagram_first_comment: 'Link in bio' },
198
+ youtubePublishAt: '2026-11-01T09:00:00Z',
199
+ coverImageBase64: 'data:image/jpeg;base64,...', // or removeCover: true
200
+ });
201
+
194
202
  // Cancel a scheduled post
195
203
  await client.cancelScheduled('job-id');
196
204
  ```
package/index.d.ts CHANGED
@@ -968,6 +968,50 @@ declare module 'upload-post' {
968
968
  [key: string]: any;
969
969
  }
970
970
 
971
+ /** Body of PATCH /api/uploadposts/schedule/<job_id>. Every key is optional. */
972
+ export interface EditScheduledOptions {
973
+ /** New publish date (ISO 8601); must be in the future and within 1 year */
974
+ scheduledDate?: string;
975
+ /** IANA timezone `scheduledDate` is read in (default UTC) */
976
+ timezone?: string;
977
+ /** New title for every platform */
978
+ title?: string;
979
+ /** New caption/description for every platform */
980
+ caption?: string;
981
+ /** Alias of caption */
982
+ description?: string;
983
+ /** Per-platform text; only the platforms listed are touched */
984
+ platformContent?: Record<string, { title?: string; caption?: string }>;
985
+ /**
986
+ * Any other editable upload option, keyed by its API form name
987
+ * (e.g. `privacyStatus`, `tags`, `disable_comment`, `instagram_first_comment`,
988
+ * `gbp_cta_url`). `null` removes the option; unknown or internal keys are ignored.
989
+ */
990
+ fields?: Record<string, string | number | boolean | string[] | null>;
991
+ /** Native YouTube scheduling (RFC3339), sent as `fields.youtube_publish_at`; `null` removes it */
992
+ youtubePublishAt?: string | null;
993
+ /** New cover image (Instagram / Facebook Reels) as base64 or a data URL */
994
+ coverImageBase64?: string;
995
+ /** File name of the new cover (default `cover.jpg`) */
996
+ coverFilename?: string;
997
+ /** MIME type of the new cover (default `image/jpeg`) */
998
+ coverContentType?: string;
999
+ /** Remove the custom cover */
1000
+ removeCover?: boolean;
1001
+ }
1002
+
1003
+ export interface EditScheduledResponse {
1004
+ success: boolean;
1005
+ job_id?: string;
1006
+ scheduled_date?: string;
1007
+ title?: string;
1008
+ caption?: string;
1009
+ platform_content?: Record<string, { title: string; caption: string }>;
1010
+ error?: string;
1011
+ error_code?: string;
1012
+ [key: string]: any;
1013
+ }
1014
+
971
1015
  export interface UserProfile {
972
1016
  username: string;
973
1017
  social_accounts?: Record<string, any>;
@@ -1412,18 +1456,7 @@ declare module 'upload-post' {
1412
1456
  * @param jobId - Scheduled job ID
1413
1457
  * @param options - Edit options
1414
1458
  */
1415
- editScheduled(jobId: string, options: {
1416
- scheduledDate?: string;
1417
- timezone?: string;
1418
- /** New title for every platform */
1419
- title?: string;
1420
- /** New caption/description for every platform */
1421
- caption?: string;
1422
- /** Alias of caption */
1423
- description?: string;
1424
- /** Per-platform text; only the platforms listed are touched */
1425
- platformContent?: Record<string, { title?: string; caption?: string }>;
1426
- }): Promise<{ success: boolean }>;
1459
+ editScheduled(jobId: string, options?: EditScheduledOptions): Promise<EditScheduledResponse>;
1427
1460
 
1428
1461
  // User Management
1429
1462
  /**
package/index.js CHANGED
@@ -1425,9 +1425,20 @@ export class UploadPost {
1425
1425
  * @param {Object} [options.platformContent] - Per-platform text, e.g.
1426
1426
  * { instagram: { caption: '...' }, tiktok: { caption: '...' }, youtube: { title: '...' } }.
1427
1427
  * Only the platforms listed are touched.
1428
+ * @param {Object} [options.fields] - Any other editable upload option, keyed by the
1429
+ * API form name (e.g. { privacyStatus: 'unlisted', tags: '["a","b"]', disable_comment: true,
1430
+ * instagram_first_comment: '...' }). `null` removes an option. Unknown or internal keys
1431
+ * are ignored by the API.
1432
+ * @param {string|null} [options.youtubePublishAt] - Native YouTube scheduling (RFC3339),
1433
+ * sent as fields.youtube_publish_at; `null` removes it. Wins over the same key in `fields`.
1434
+ * @param {string} [options.coverImageBase64] - New cover image (Instagram / Facebook Reels),
1435
+ * base64 or a data URL
1436
+ * @param {string} [options.coverFilename] - File name of the new cover (default cover.jpg)
1437
+ * @param {string} [options.coverContentType] - MIME type of the new cover (default image/jpeg)
1438
+ * @param {boolean} [options.removeCover] - Remove the custom cover
1428
1439
  * @returns {Promise<Object>} Edit result
1429
1440
  */
1430
- async editScheduled(jobId, options) {
1441
+ async editScheduled(jobId, options = {}) {
1431
1442
  const body = {};
1432
1443
  if (options.scheduledDate) body.scheduled_date = options.scheduledDate;
1433
1444
  if (options.timezone) body.timezone = options.timezone;
@@ -1435,6 +1446,15 @@ export class UploadPost {
1435
1446
  if (options.caption !== undefined) body.caption = options.caption;
1436
1447
  else if (options.description !== undefined) body.description = options.description;
1437
1448
  if (options.platformContent) body.platform_content = options.platformContent;
1449
+ const fields = { ...(options.fields || {}) };
1450
+ if (options.youtubePublishAt !== undefined) fields.youtube_publish_at = options.youtubePublishAt;
1451
+ if (Object.keys(fields).length) body.fields = fields;
1452
+ if (options.removeCover === true) body.remove_cover = true;
1453
+ else if (options.coverImageBase64) {
1454
+ body.cover_image_base64 = options.coverImageBase64;
1455
+ if (options.coverFilename) body.cover_filename = options.coverFilename;
1456
+ if (options.coverContentType) body.cover_content_type = options.coverContentType;
1457
+ }
1438
1458
  return this._request(`/uploadposts/schedule/${jobId}`, 'PATCH', body);
1439
1459
  }
1440
1460
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "upload-post",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "Official client library for Upload-Post API - Cross-platform social media upload for TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",