@publishq/sdk 0.0.2 → 0.0.4

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
@@ -79,7 +79,7 @@ await publishq.posts.removeAccount('<post-id>', '<account-id>');
79
79
  // List connected social accounts (filter by workspace / platform)
80
80
  const { data } = await publishq.accounts.list({ platform: ['TIKTOK'] });
81
81
 
82
- // TikTok requires fetching creator info before posting — the privacyLevel you
82
+ // TikTok requires fetching creator info before posting. The privacyLevel you
83
83
  // set must be one of the returned privacyLevelOptions.
84
84
  const { data: info } = await publishq.accounts.getTikTokCreatorInfo('<account-id>');
85
85
  ```
@@ -128,8 +128,8 @@ const publishq = new PublishQ({
128
128
 
129
129
  ## Related
130
130
 
131
- - [`@publishq/cli`](https://www.npmjs.com/package/@publishq/cli) — command-line interface built on this SDK.
132
- - [`@publishq/mcp`](https://www.npmjs.com/package/@publishq/mcp) — Model Context Protocol server for Claude Desktop and other AI agents.
131
+ - [`@publishq/cli`](https://www.npmjs.com/package/@publishq/cli): command-line interface built on this SDK.
132
+ - [`@publishq/mcp`](https://www.npmjs.com/package/@publishq/mcp): Model Context Protocol server for Claude Desktop and other AI agents.
133
133
  - [API reference](https://publishq.com/docs)
134
134
 
135
135
  ## License
package/dist/index.cjs CHANGED
@@ -100,7 +100,9 @@ __export(index_exports, {
100
100
  zTikTokCreatorInfoResponse: () => zTikTokCreatorInfoResponse,
101
101
  zTikTokPlatformSpecificSettings: () => zTikTokPlatformSpecificSettings,
102
102
  zTwitterPlatformSpecificSettings: () => zTwitterPlatformSpecificSettings,
103
+ zUpdatePostAccount: () => zUpdatePostAccount,
103
104
  zUpdatePostBody: () => zUpdatePostBody,
105
+ zUpdatePostOverrides: () => zUpdatePostOverrides,
104
106
  zUpdatePostPath: () => zUpdatePostPath,
105
107
  zUpdatePostRequest: () => zUpdatePostRequest,
106
108
  zUpdatePostResponse: () => zUpdatePostResponse,
@@ -1314,6 +1316,9 @@ var zYouTubePlatformSpecificSettings = z.object({
1314
1316
  })),
1315
1317
  playlistId: z.optional(z.string().register(z.globalRegistry, {
1316
1318
  description: "Playlist ID to add the video to after upload."
1319
+ })),
1320
+ thumbnailMediaId: z.optional(z.uuid().register(z.globalRegistry, {
1321
+ description: "ID of an image in your media library to set as the custom thumbnail of this video. JPEG or PNG, up to 50MB; YouTube recommends 1280x720 (16:9). Upload the image with the media endpoints first. The thumbnail is set right after the video uploads. If YouTube refuses it (custom thumbnails need a verified channel), the video still publishes and `thumbnail` on the account says why. To replace it on a draft or scheduled post, update the account with the new id; to remove it, send `thumbnailMediaId: null`."
1317
1322
  }))
1318
1323
  }).register(z.globalRegistry, {
1319
1324
  description: "YouTube-specific upload settings, such as description and privacy."
@@ -1531,6 +1536,9 @@ var zPlatformSpecificSettings = z.union([
1531
1536
  })),
1532
1537
  playlistId: z.optional(z.string().register(z.globalRegistry, {
1533
1538
  description: "Playlist ID to add the video to after upload."
1539
+ })),
1540
+ thumbnailMediaId: z.optional(z.uuid().register(z.globalRegistry, {
1541
+ description: "ID of an image in your media library to set as the custom thumbnail of this video. JPEG or PNG, up to 50MB; YouTube recommends 1280x720 (16:9). Upload the image with the media endpoints first. The thumbnail is set right after the video uploads. If YouTube refuses it (custom thumbnails need a verified channel), the video still publishes and `thumbnail` on the account says why. To replace it on a draft or scheduled post, update the account with the new id; to remove it, send `thumbnailMediaId: null`."
1534
1542
  }))
1535
1543
  }).register(z.globalRegistry, {
1536
1544
  description: "YouTube-specific upload settings, such as description and privacy."
@@ -1675,6 +1683,12 @@ var zPostAccount = z.object({
1675
1683
  errorMessage: z.optional(z.string().register(z.globalRegistry, {
1676
1684
  description: "Error message from the platform if publishing failed for this account."
1677
1685
  })),
1686
+ thumbnail: z.optional(z.object({
1687
+ status: z.enum(["APPLIED", "FAILED"]),
1688
+ errorMessage: z.optional(z.string())
1689
+ }).register(z.globalRegistry, {
1690
+ description: "Present on a published account whose post set a custom thumbnail: whether the platform applied it, and if not, why. The post itself is live either way."
1691
+ })),
1678
1692
  failure: z.optional(z.intersection(zPublishFailure, z.unknown().register(z.globalRegistry, {
1679
1693
  description: "The same failure read as an action: what happened and the one thing to do about it. Present whenever status is FAILED, including when the platform gave no reason. The wording is what the app and the failure email show, so a client does not have to interpret `errorMessage` itself."
1680
1694
  }))),
@@ -1752,6 +1766,22 @@ var zCreatePostRequest = z.object({
1752
1766
  }).register(z.globalRegistry, {
1753
1767
  description: "Create a post across one or more connected social accounts."
1754
1768
  });
1769
+ var zUpdatePostOverrides = z.object({
1770
+ content: z.nullish(z.string()),
1771
+ mediaIds: z.nullish(z.array(z.uuid()).check(z.maxLength(35))),
1772
+ thumbnailTimestamp: z.nullish(z.int().check(z.gte(0)))
1773
+ }).register(z.globalRegistry, {
1774
+ description: "Override the post-level content, media or thumbnail timestamp for this specific account."
1775
+ });
1776
+ var zUpdatePostAccount = z.object({
1777
+ accountId: z.uuid().register(z.globalRegistry, {
1778
+ description: "ID of a connected social account to post to."
1779
+ }),
1780
+ postOverrides: z.optional(zUpdatePostOverrides),
1781
+ platformSpecificSettings: z.optional(z.intersection(zPlatformSpecificSettings, z.unknown().register(z.globalRegistry, {
1782
+ description: "Platform-specific settings to change. Only the settings you send change, and every setting you leave out keeps its current value. Send a setting as null to remove it. Nested objects merge the same way (JSON Merge Patch, RFC 7396). The resulting settings must still be valid for the platform, so a required setting cannot be removed."
1783
+ })))
1784
+ });
1755
1785
  var zUpdatePostRequest = z.object({
1756
1786
  content: z.optional(z.string().register(z.globalRegistry, {
1757
1787
  description: "New shared text content for the post."
@@ -1765,14 +1795,14 @@ var zUpdatePostRequest = z.object({
1765
1795
  thumbnailTimestamp: z.optional(z.int().check(z.gte(0)).register(z.globalRegistry, {
1766
1796
  description: "New video thumbnail timestamp in milliseconds for Instagram and TikTok media. Does not change which media files are attached. Combine with mediaIds if you want to replace media and set the new thumbnail timestamp in the same request."
1767
1797
  })),
1768
- accounts: z.optional(z.array(zCreatePostAccount).check(z.minLength(1)).register(z.globalRegistry, {
1769
- description: "Accounts whose content overrides or platform-specific settings should be updated, plus any additional connected accounts to add to the post. Existing accounts omitted from this array remain unchanged and must be removed through the account-specific delete endpoint."
1798
+ accounts: z.optional(z.array(zUpdatePostAccount).check(z.minLength(1)).register(z.globalRegistry, {
1799
+ description: "Accounts to change, plus any connected accounts to add to the post. For an account already in the post, only the fields you send change: omitted fields keep their current value and a field sent as null is removed. Existing accounts left out of this array stay unchanged; remove an account through the account-specific delete endpoint."
1770
1800
  })),
1771
1801
  publishNow: z.optional(z.boolean().register(z.globalRegistry, {
1772
1802
  description: "Publish an existing draft immediately. Cannot be combined with scheduledAt."
1773
1803
  }))
1774
1804
  }).register(z.globalRegistry, {
1775
- description: "Update a draft or scheduled post. Published and publishing posts cannot be updated. Media behavior is explicit: omit mediaIds to keep existing media unchanged, provide mediaIds to replace all current media, or provide an empty mediaIds array to remove all media."
1805
+ description: "Update a draft or scheduled post. Published and publishing posts cannot be updated. Only the fields you send change; everything you leave out keeps its current value. To remove an account setting, or an account's own text, media or thumbnail timestamp, send it as null. Media behavior is explicit: omit mediaIds to keep existing media unchanged, provide mediaIds to replace all current media, or provide an empty mediaIds array to remove all media. The post that results from the update is validated as a whole before anything is saved."
1776
1806
  });
1777
1807
  var zSuccessMessage = z.object({
1778
1808
  deleted: z.literal(true),
@@ -2269,7 +2299,9 @@ var index_default = PublishQ;
2269
2299
  zTikTokCreatorInfoResponse,
2270
2300
  zTikTokPlatformSpecificSettings,
2271
2301
  zTwitterPlatformSpecificSettings,
2302
+ zUpdatePostAccount,
2272
2303
  zUpdatePostBody,
2304
+ zUpdatePostOverrides,
2273
2305
  zUpdatePostPath,
2274
2306
  zUpdatePostRequest,
2275
2307
  zUpdatePostResponse,