@postpeer/node 0.8.6 → 0.9.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/dist/index.js CHANGED
@@ -926,6 +926,22 @@ var Integrations = class extends HeyApiClient {
926
926
  ...options
927
927
  });
928
928
  }
929
+ /**
930
+ * Move an integration to another profile
931
+ *
932
+ * Reassigns an existing integration to another profile in the same project. Pass profileId=null to leave the integration unassigned. OAuth credentials and existing posts are unchanged.
933
+ */
934
+ move(options) {
935
+ return (options.client ?? this.client).patch({
936
+ security: [{ name: "x-access-key", type: "apiKey" }],
937
+ url: "/v1/connect/integrations/{id}",
938
+ ...options,
939
+ headers: {
940
+ "Content-Type": "application/json",
941
+ ...options.headers
942
+ }
943
+ });
944
+ }
929
945
  };
930
946
  var Connect = class extends HeyApiClient {
931
947
  static {
@@ -1005,7 +1021,7 @@ var Profiles = class extends HeyApiClient {
1005
1021
  /**
1006
1022
  * Delete a profile
1007
1023
  *
1008
- * Soft-deletes the profile. Existing integrations bound to it keep their profileId — they are not orphaned, but listing /v1/profiles will no longer surface this row.
1024
+ * Soft-deletes an empty profile. Move or disconnect active integrations before deleting their profile.
1009
1025
  */
1010
1026
  delete(options) {
1011
1027
  return (options.client ?? this.client).delete({
@@ -1245,7 +1261,9 @@ var Scheduled = class extends HeyApiClient {
1245
1261
  /**
1246
1262
  * Edit a scheduled post (content, media, platforms, time)
1247
1263
  *
1248
- * Replaces the editable fields of a scheduled post: text content, media attachments, target platforms + platform-specific data, and optionally the scheduled time/timezone. Re-validates each platform and reconciles the credit difference. Only works while the post is still scheduled.
1264
+ * Deprecated: use PUT /v1/posts/:postId. Replaces the editable fields of a scheduled post and reconciles credits.
1265
+ *
1266
+ * @deprecated
1249
1267
  */
1250
1268
  edit(options) {
1251
1269
  return (options.client ?? this.client).put({
@@ -1276,7 +1294,9 @@ var Posts = class extends HeyApiClient {
1276
1294
  });
1277
1295
  }
1278
1296
  /**
1279
- * Publish a post to one or more social media platforms
1297
+ * Create, publish, or schedule a post
1298
+ *
1299
+ * Set saveAsDraft=true to save without accounts or credits, publishNow=true to publish immediately, or provide scheduledFor to schedule it.
1280
1300
  */
1281
1301
  create(options) {
1282
1302
  return (options.client ?? this.client).post({
@@ -1325,6 +1345,38 @@ var Posts = class extends HeyApiClient {
1325
1345
  ...options
1326
1346
  });
1327
1347
  }
1348
+ /**
1349
+ * Edit a draft or scheduled post
1350
+ *
1351
+ * Replaces an editable post. Drafts remain drafts with saveAsDraft=true, publish immediately with publishNow=true, or become scheduled with scheduledFor. Scheduled posts keep their schedule.
1352
+ */
1353
+ edit(options) {
1354
+ return (options.client ?? this.client).put({
1355
+ security: [{ name: "x-access-key", type: "apiKey" }],
1356
+ url: "/v1/posts/{postId}",
1357
+ ...options,
1358
+ headers: {
1359
+ "Content-Type": "application/json",
1360
+ ...options.headers
1361
+ }
1362
+ });
1363
+ }
1364
+ /**
1365
+ * Sync recent posts published outside PostPeer
1366
+ *
1367
+ * Fetches at most the 50 most recent posts from one connected account and stores posts published outside PostPeer. Existing PostPeer posts are updated instead of duplicated. Provide url or postId to verify one post. Requests are debounced per account for 15 seconds. Supported accounts: Twitter, YouTube, Pinterest, LinkedIn organization pages, TikTok, Facebook, Instagram, Threads, and Google Business.
1368
+ */
1369
+ syncExternal(options) {
1370
+ return (options.client ?? this.client).post({
1371
+ security: [{ name: "x-access-key", type: "apiKey" }],
1372
+ url: "/v1/posts/sync-external",
1373
+ ...options,
1374
+ headers: {
1375
+ "Content-Type": "application/json",
1376
+ ...options.headers
1377
+ }
1378
+ });
1379
+ }
1328
1380
  _scheduled;
1329
1381
  get scheduled() {
1330
1382
  return this._scheduled ??= new Scheduled({ client: this.client });
@@ -1411,68 +1463,59 @@ var Analytics = class extends HeyApiClient {
1411
1463
  return this._instagram ??= new Instagram({ client: this.client });
1412
1464
  }
1413
1465
  };
1414
- var Usage = class extends HeyApiClient {
1466
+ var Comments = class extends HeyApiClient {
1415
1467
  static {
1416
- __name(this, "Usage");
1468
+ __name(this, "Comments");
1417
1469
  }
1418
1470
  /**
1419
- * Get credit usage
1471
+ * List comments on a post
1420
1472
  *
1421
- * Returns credit usage history for the project. Without filters, returns project-level totals. Add `profileId` to scope to a specific profile, or `integrationId` to scope to a specific connected account. Use `from`/`to` (YYYY-MM) to slice the history. Each entry contains the monthly credit count and a per-platform breakdown.
1473
+ * Fetch comments (and first-level replies) on a post from a connected Facebook Page, Instagram Business account, Threads account, or LinkedIn account. Requires the account to have the relevant permissions approved (pages_read_user_content for Facebook, instagram_business_manage_comments for Instagram, threads_manage_replies for Threads, Community Management social-feed scopes for LinkedIn).
1422
1474
  */
1423
- get(options) {
1424
- return (options?.client ?? this.client).get({
1475
+ list(options) {
1476
+ return (options.client ?? this.client).get({
1425
1477
  security: [{ name: "x-access-key", type: "apiKey" }],
1426
- url: "/v1/usage/",
1478
+ url: "/v1/comments/",
1427
1479
  ...options
1428
1480
  });
1429
1481
  }
1430
- };
1431
- var Pinterest = class extends HeyApiClient {
1432
- static {
1433
- __name(this, "Pinterest");
1434
- }
1435
1482
  /**
1436
- * List Pinterest boards for a connected account
1483
+ * Create a comment or reply
1484
+ *
1485
+ * Post a top-level comment on an Instagram, Facebook, or LinkedIn post, or a top-level post on Threads (provide `postId`), or reply to an existing comment on Facebook, Instagram, Threads, or LinkedIn (provide `commentId`).
1437
1486
  */
1438
- getBoards(options) {
1439
- return (options?.client ?? this.client).get({
1487
+ create(options) {
1488
+ return (options.client ?? this.client).post({
1440
1489
  security: [{ name: "x-access-key", type: "apiKey" }],
1441
- url: "/v1/pinterest/boards",
1442
- ...options
1490
+ url: "/v1/comments/",
1491
+ ...options,
1492
+ headers: {
1493
+ "Content-Type": "application/json",
1494
+ ...options.headers
1495
+ }
1443
1496
  });
1444
1497
  }
1445
- };
1446
- var Tiktok = class extends HeyApiClient {
1447
- static {
1448
- __name(this, "Tiktok");
1449
- }
1450
1498
  /**
1451
- * Fetch TikTok creator info for a connected account
1499
+ * Delete a comment
1452
1500
  *
1453
- * Proxies TikTok's /v2/post/publish/creator_info/query/ endpoint. Use the returned `privacyLevelOptions`, `commentDisabled`, `duetDisabled`, `stitchDisabled`, and `maxVideoPostDurationSec` to build a compliant "Post to TikTok" UX.
1501
+ * Delete a comment on a Facebook Page post, Instagram Business post, or LinkedIn post. Not supported on Threads (the API does not allow deleting others' replies).
1454
1502
  */
1455
- getCreatorInfo(options) {
1456
- return (options?.client ?? this.client).get({
1503
+ delete(options) {
1504
+ return (options.client ?? this.client).delete({
1457
1505
  security: [{ name: "x-access-key", type: "apiKey" }],
1458
- url: "/v1/tiktok/creator-info",
1506
+ url: "/v1/comments/{commentId}",
1459
1507
  ...options
1460
1508
  });
1461
1509
  }
1462
- };
1463
- var Ai = class extends HeyApiClient {
1464
- static {
1465
- __name(this, "Ai");
1466
- }
1467
1510
  /**
1468
- * Generate a social media caption from a description
1511
+ * Hide or unhide a comment
1469
1512
  *
1470
- * Generates a caption tailored to the platforms you'll post to. Costs 2 credits per successful generation. Failed calls do not deduct credits.
1513
+ * Hide or unhide a comment on an Instagram Business post. Pass `hidden: true` to hide, `hidden: false` to unhide. Instagram only.
1471
1514
  */
1472
- write(options) {
1473
- return (options.client ?? this.client).post({
1515
+ hide(options) {
1516
+ return (options.client ?? this.client).patch({
1474
1517
  security: [{ name: "x-access-key", type: "apiKey" }],
1475
- url: "/v1/ai/write",
1518
+ url: "/v1/comments/{commentId}",
1476
1519
  ...options,
1477
1520
  headers: {
1478
1521
  "Content-Type": "application/json",
@@ -1480,15 +1523,32 @@ var Ai = class extends HeyApiClient {
1480
1523
  }
1481
1524
  });
1482
1525
  }
1526
+ };
1527
+ var Messages = class extends HeyApiClient {
1528
+ static {
1529
+ __name(this, "Messages");
1530
+ }
1483
1531
  /**
1484
- * Generate a social media image from a description
1532
+ * List conversations
1485
1533
  *
1486
- * Generates a square or vertical image suitable for social media. Costs 10 credits per successful generation. Failed calls do not deduct credits.
1534
+ * List DM conversations for a connected Instagram Business account. Requires instagram_business_manage_messages.
1487
1535
  */
1488
- generateImage(options) {
1536
+ listConversations(options) {
1537
+ return (options.client ?? this.client).get({
1538
+ security: [{ name: "x-access-key", type: "apiKey" }],
1539
+ url: "/v1/messages/",
1540
+ ...options
1541
+ });
1542
+ }
1543
+ /**
1544
+ * Send a message
1545
+ *
1546
+ * Send a DM reply on Instagram.
1547
+ */
1548
+ send(options) {
1489
1549
  return (options.client ?? this.client).post({
1490
1550
  security: [{ name: "x-access-key", type: "apiKey" }],
1491
- url: "/v1/ai/image",
1551
+ url: "/v1/messages/",
1492
1552
  ...options,
1493
1553
  headers: {
1494
1554
  "Content-Type": "application/json",
@@ -1496,25 +1556,56 @@ var Ai = class extends HeyApiClient {
1496
1556
  }
1497
1557
  });
1498
1558
  }
1559
+ /**
1560
+ * Get messages in a conversation
1561
+ */
1562
+ getConversation(options) {
1563
+ return (options.client ?? this.client).get({
1564
+ security: [{ name: "x-access-key", type: "apiKey" }],
1565
+ url: "/v1/messages/{conversationId}",
1566
+ ...options
1567
+ });
1568
+ }
1499
1569
  };
1500
- var PostPeer = class _PostPeer extends HeyApiClient {
1570
+ var Posts2 = class extends HeyApiClient {
1501
1571
  static {
1502
- __name(this, "PostPeer");
1572
+ __name(this, "Posts2");
1503
1573
  }
1504
- static __registry = new HeyApiRegistry();
1505
- constructor(args) {
1506
- super(args);
1507
- _PostPeer.__registry.set(this, args?.key);
1574
+ list(options) {
1575
+ return (options.client ?? this.client).get({
1576
+ security: [{ name: "x-access-key", type: "apiKey" }],
1577
+ url: "/v1/comment-automations/posts",
1578
+ ...options
1579
+ });
1508
1580
  }
1509
- /**
1510
- * Move an integration to another profile
1511
- *
1512
- * Reassigns an existing integration to another profile in the same project. Pass profileId=null to leave the integration unassigned. OAuth credentials and existing posts are unchanged.
1513
- */
1514
- moveIntegration(options) {
1515
- return (options.client ?? this.client).patch({
1581
+ };
1582
+ var Logs = class extends HeyApiClient {
1583
+ static {
1584
+ __name(this, "Logs");
1585
+ }
1586
+ list(options) {
1587
+ return (options.client ?? this.client).get({
1516
1588
  security: [{ name: "x-access-key", type: "apiKey" }],
1517
- url: "/v1/connect/integrations/{id}",
1589
+ url: "/v1/comment-automations/{id}/logs",
1590
+ ...options
1591
+ });
1592
+ }
1593
+ };
1594
+ var CommentAutomations = class extends HeyApiClient {
1595
+ static {
1596
+ __name(this, "CommentAutomations");
1597
+ }
1598
+ list(options) {
1599
+ return (options?.client ?? this.client).get({
1600
+ security: [{ name: "x-access-key", type: "apiKey" }],
1601
+ url: "/v1/comment-automations/",
1602
+ ...options
1603
+ });
1604
+ }
1605
+ create(options) {
1606
+ return (options.client ?? this.client).post({
1607
+ security: [{ name: "x-access-key", type: "apiKey" }],
1608
+ url: "/v1/comment-automations/",
1518
1609
  ...options,
1519
1610
  headers: {
1520
1611
  "Content-Type": "application/json",
@@ -1522,27 +1613,17 @@ var PostPeer = class _PostPeer extends HeyApiClient {
1522
1613
  }
1523
1614
  });
1524
1615
  }
1525
- /**
1526
- * List comments on a post
1527
- *
1528
- * Fetch comments (and first-level replies) on a post from a connected Facebook Page, Instagram Business account, or Threads account. Requires the account to have the relevant Meta permissions approved (pages_read_user_content for Facebook, instagram_business_manage_comments for Instagram, threads_manage_replies for Threads).
1529
- */
1530
- listComments(options) {
1531
- return (options.client ?? this.client).get({
1616
+ delete(options) {
1617
+ return (options.client ?? this.client).delete({
1532
1618
  security: [{ name: "x-access-key", type: "apiKey" }],
1533
- url: "/v1/comments/",
1619
+ url: "/v1/comment-automations/{id}",
1534
1620
  ...options
1535
1621
  });
1536
1622
  }
1537
- /**
1538
- * Create a comment or reply
1539
- *
1540
- * Post a top-level comment on an Instagram or Facebook post, or a top-level post on Threads (provide `postId`), or reply to an existing comment on Facebook, Instagram, or Threads (provide `commentId`).
1541
- */
1542
- createComment(options) {
1543
- return (options.client ?? this.client).post({
1623
+ update(options) {
1624
+ return (options.client ?? this.client).patch({
1544
1625
  security: [{ name: "x-access-key", type: "apiKey" }],
1545
- url: "/v1/comments/",
1626
+ url: "/v1/comment-automations/{id}",
1546
1627
  ...options,
1547
1628
  headers: {
1548
1629
  "Content-Type": "application/json",
@@ -1550,55 +1631,92 @@ var PostPeer = class _PostPeer extends HeyApiClient {
1550
1631
  }
1551
1632
  });
1552
1633
  }
1634
+ _posts;
1635
+ get posts() {
1636
+ return this._posts ??= new Posts2({ client: this.client });
1637
+ }
1638
+ _logs;
1639
+ get logs() {
1640
+ return this._logs ??= new Logs({ client: this.client });
1641
+ }
1642
+ };
1643
+ var Usage = class extends HeyApiClient {
1644
+ static {
1645
+ __name(this, "Usage");
1646
+ }
1553
1647
  /**
1554
- * Delete a comment
1648
+ * Get credit usage
1555
1649
  *
1556
- * Delete a comment on a Facebook Page post or Instagram Business post. Not supported on Threads (the API does not allow deleting others' replies).
1650
+ * Returns credit usage history for the project. Without filters, returns project-level totals. Add `profileId` to scope to a specific profile, or `integrationId` to scope to a specific connected account. Use `from`/`to` (YYYY-MM) to slice the history. Each entry contains the monthly credit count and a per-platform breakdown.
1557
1651
  */
1558
- deleteComment(options) {
1559
- return (options.client ?? this.client).delete({
1652
+ get(options) {
1653
+ return (options?.client ?? this.client).get({
1560
1654
  security: [{ name: "x-access-key", type: "apiKey" }],
1561
- url: "/v1/comments/{commentId}",
1655
+ url: "/v1/usage/",
1562
1656
  ...options
1563
1657
  });
1564
1658
  }
1659
+ };
1660
+ var Pinterest = class extends HeyApiClient {
1661
+ static {
1662
+ __name(this, "Pinterest");
1663
+ }
1565
1664
  /**
1566
- * Hide or unhide a comment
1567
- *
1568
- * Hide or unhide a comment on an Instagram Business post. Pass `hidden: true` to hide, `hidden: false` to unhide. Instagram only.
1665
+ * List Pinterest boards for a connected account
1569
1666
  */
1570
- hideComment(options) {
1571
- return (options.client ?? this.client).patch({
1667
+ getBoards(options) {
1668
+ return (options?.client ?? this.client).get({
1572
1669
  security: [{ name: "x-access-key", type: "apiKey" }],
1573
- url: "/v1/comments/{commentId}",
1574
- ...options,
1575
- headers: {
1576
- "Content-Type": "application/json",
1577
- ...options.headers
1578
- }
1670
+ url: "/v1/pinterest/boards",
1671
+ ...options
1579
1672
  });
1580
1673
  }
1674
+ };
1675
+ var Tiktok = class extends HeyApiClient {
1676
+ static {
1677
+ __name(this, "Tiktok");
1678
+ }
1581
1679
  /**
1582
- * List conversations
1680
+ * Fetch TikTok creator info for a connected account
1583
1681
  *
1584
- * List DM conversations for a connected Instagram Business account. Requires instagram_business_manage_messages.
1682
+ * Proxies TikTok's /v2/post/publish/creator_info/query/ endpoint. Use the returned `privacyLevelOptions`, `commentDisabled`, `duetDisabled`, `stitchDisabled`, and `maxVideoPostDurationSec` to build a compliant "Post to TikTok" UX.
1585
1683
  */
1586
- listConversations(options) {
1684
+ getCreatorInfo(options) {
1685
+ return (options?.client ?? this.client).get({
1686
+ security: [{ name: "x-access-key", type: "apiKey" }],
1687
+ url: "/v1/tiktok/creator-info",
1688
+ ...options
1689
+ });
1690
+ }
1691
+ };
1692
+ var Linkedin2 = class extends HeyApiClient {
1693
+ static {
1694
+ __name(this, "Linkedin2");
1695
+ }
1696
+ /**
1697
+ * Find a LinkedIn organization ID and URN by company URL or slug
1698
+ */
1699
+ lookupOrganization(options) {
1587
1700
  return (options.client ?? this.client).get({
1588
1701
  security: [{ name: "x-access-key", type: "apiKey" }],
1589
- url: "/v1/messages/",
1702
+ url: "/v1/linkedin/organization-lookup",
1590
1703
  ...options
1591
1704
  });
1592
1705
  }
1706
+ };
1707
+ var Ai = class extends HeyApiClient {
1708
+ static {
1709
+ __name(this, "Ai");
1710
+ }
1593
1711
  /**
1594
- * Send a message
1712
+ * Generate a social media caption from a description
1595
1713
  *
1596
- * Send a DM reply on Instagram.
1714
+ * Generates a caption tailored to the platforms you'll post to. Costs 2 credits per successful generation. Failed calls do not deduct credits.
1597
1715
  */
1598
- sendMessage(options) {
1716
+ write(options) {
1599
1717
  return (options.client ?? this.client).post({
1600
1718
  security: [{ name: "x-access-key", type: "apiKey" }],
1601
- url: "/v1/messages/",
1719
+ url: "/v1/ai/write",
1602
1720
  ...options,
1603
1721
  headers: {
1604
1722
  "Content-Type": "application/json",
@@ -1607,15 +1725,31 @@ var PostPeer = class _PostPeer extends HeyApiClient {
1607
1725
  });
1608
1726
  }
1609
1727
  /**
1610
- * Get messages in a conversation
1728
+ * Generate a social media image from a description
1729
+ *
1730
+ * Generates a square or vertical image suitable for social media. Costs 10 credits per successful generation. Failed calls do not deduct credits.
1611
1731
  */
1612
- getConversationMessages(options) {
1613
- return (options.client ?? this.client).get({
1732
+ generateImage(options) {
1733
+ return (options.client ?? this.client).post({
1614
1734
  security: [{ name: "x-access-key", type: "apiKey" }],
1615
- url: "/v1/messages/{conversationId}",
1616
- ...options
1735
+ url: "/v1/ai/image",
1736
+ ...options,
1737
+ headers: {
1738
+ "Content-Type": "application/json",
1739
+ ...options.headers
1740
+ }
1617
1741
  });
1618
1742
  }
1743
+ };
1744
+ var PostPeer = class _PostPeer extends HeyApiClient {
1745
+ static {
1746
+ __name(this, "PostPeer");
1747
+ }
1748
+ static __registry = new HeyApiRegistry();
1749
+ constructor(args) {
1750
+ super(args);
1751
+ _PostPeer.__registry.set(this, args?.key);
1752
+ }
1619
1753
  _health;
1620
1754
  get health() {
1621
1755
  return this._health ??= new Health({ client: this.client });
@@ -1652,6 +1786,18 @@ var PostPeer = class _PostPeer extends HeyApiClient {
1652
1786
  get analytics() {
1653
1787
  return this._analytics ??= new Analytics({ client: this.client });
1654
1788
  }
1789
+ _comments;
1790
+ get comments() {
1791
+ return this._comments ??= new Comments({ client: this.client });
1792
+ }
1793
+ _messages;
1794
+ get messages() {
1795
+ return this._messages ??= new Messages({ client: this.client });
1796
+ }
1797
+ _commentAutomations;
1798
+ get commentAutomations() {
1799
+ return this._commentAutomations ??= new CommentAutomations({ client: this.client });
1800
+ }
1655
1801
  _usage;
1656
1802
  get usage() {
1657
1803
  return this._usage ??= new Usage({ client: this.client });
@@ -1664,6 +1810,10 @@ var PostPeer = class _PostPeer extends HeyApiClient {
1664
1810
  get tiktok() {
1665
1811
  return this._tiktok ??= new Tiktok({ client: this.client });
1666
1812
  }
1813
+ _linkedin;
1814
+ get linkedin() {
1815
+ return this._linkedin ??= new Linkedin2({ client: this.client });
1816
+ }
1667
1817
  _ai;
1668
1818
  get ai() {
1669
1819
  return this._ai ??= new Ai({ client: this.client });
@@ -1809,7 +1959,7 @@ var createAPIError = /* @__PURE__ */ __name((response, body) => {
1809
1959
  }, "createAPIError");
1810
1960
 
1811
1961
  // src/version.ts
1812
- var VERSION = "0.8.6";
1962
+ var VERSION = "0.9.0";
1813
1963
 
1814
1964
  // src/client.ts
1815
1965
  var DEFAULT_BASE_URL = "https://api.postpeer.dev";