@dracoonghost/trndup-sdk 1.3.20 → 1.3.22

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.d.mts CHANGED
@@ -487,6 +487,62 @@ declare namespace Instagram {
487
487
  value: number;
488
488
  }>>;
489
489
  }
490
+ interface ProfileResponse {
491
+ id: string;
492
+ username: string;
493
+ name?: string;
494
+ biography?: string;
495
+ profilePictureUrl?: string;
496
+ followersCount: number;
497
+ followingCount: number;
498
+ mediaCount: number;
499
+ accountType?: 'BUSINESS' | 'CREATOR' | 'PERSONAL';
500
+ website?: string;
501
+ cached?: boolean;
502
+ cachedAt?: string;
503
+ }
504
+ interface GetAccountOverviewParams {
505
+ range?: '7d' | '14d' | '28d' | '30d';
506
+ }
507
+ interface AccountOverviewResponse {
508
+ profile: {
509
+ id: string;
510
+ username: string;
511
+ name?: string;
512
+ biography?: string;
513
+ profilePictureUrl?: string;
514
+ followersCount: number;
515
+ followingCount: number;
516
+ mediaCount: number;
517
+ accountType?: string;
518
+ website?: string;
519
+ };
520
+ stats: {
521
+ range: string;
522
+ reach: number;
523
+ impressions: number;
524
+ profileViews: number;
525
+ websiteClicks: number;
526
+ totalLikes: number;
527
+ totalComments: number;
528
+ totalShares: number;
529
+ totalSaves: number;
530
+ engagementRate: number;
531
+ accountsEngaged: number;
532
+ };
533
+ topPosts: Array<{
534
+ id: string;
535
+ mediaType: string;
536
+ mediaUrl?: string;
537
+ thumbnailUrl?: string;
538
+ caption?: string;
539
+ likeCount?: number;
540
+ commentsCount?: number;
541
+ timestamp?: string;
542
+ permalink?: string;
543
+ }>;
544
+ syncedMediaCount: number;
545
+ }
490
546
  interface Post {
491
547
  id: string;
492
548
  media_id: string;
@@ -539,6 +595,110 @@ declare namespace Instagram {
539
595
  stories: Story[];
540
596
  count: number;
541
597
  }
598
+ /** Sync status enum matching backend */
599
+ type SyncStatus = 'NEVER_SYNCED' | 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
600
+ /** Individual sync type info */
601
+ interface SyncTypeInfo {
602
+ status: SyncStatus;
603
+ lastSyncAt: string | null;
604
+ lastError?: string | null;
605
+ failedAttempts?: number;
606
+ isStale: boolean;
607
+ nextSyncAt: string | null;
608
+ timeUntilNextSync: string;
609
+ interval: string;
610
+ }
611
+ /**
612
+ * Unified sync status response
613
+ * GET /v1/platforms/instagram/sync/status
614
+ */
615
+ interface UnifiedSyncStatusResponse {
616
+ isConnected: boolean;
617
+ igUserId: string | null;
618
+ username: string | null;
619
+ totalPosts: number;
620
+ syncs: {
621
+ accountInfo: SyncTypeInfo;
622
+ posts: SyncTypeInfo;
623
+ accountAnalytics: SyncTypeInfo;
624
+ postInsights: SyncTypeInfo;
625
+ stories: SyncTypeInfo;
626
+ };
627
+ }
628
+ /**
629
+ * Response from POST /v1/platforms/instagram/posts/sync
630
+ */
631
+ interface PostsSyncResponse {
632
+ posts: {
633
+ total: number;
634
+ synced: number;
635
+ oldestPostDate: string | null;
636
+ };
637
+ syncStatus: {
638
+ isFirstSync: boolean;
639
+ lastSyncAt: string;
640
+ };
641
+ }
642
+ /**
643
+ * Response from GET /v1/platforms/instagram/posts/sync/status
644
+ */
645
+ interface PostsSyncStatusResponse {
646
+ needsSync: boolean;
647
+ status: SyncStatus;
648
+ lastSyncAt: string | null;
649
+ postCount: number;
650
+ oldestPostDate: string | null;
651
+ }
652
+ /**
653
+ * Response from POST /v1/platforms/instagram/analytics/account/sync
654
+ */
655
+ interface AccountAnalyticsSyncResponse {
656
+ range: string;
657
+ metricsCount: number;
658
+ syncStatus: SyncStatus;
659
+ lastSyncAt: string;
660
+ }
661
+ /**
662
+ * Response from GET /v1/platforms/instagram/analytics/account/sync/status
663
+ */
664
+ interface AccountAnalyticsSyncStatusResponse {
665
+ needsSync: boolean;
666
+ status: SyncStatus;
667
+ insightRecords: number;
668
+ dateRange: {
669
+ start: string;
670
+ end: string;
671
+ } | null;
672
+ lastSyncAt: string | null;
673
+ message: string;
674
+ }
675
+ /**
676
+ * Response from POST /v1/platforms/instagram/analytics/posts/sync
677
+ */
678
+ interface PostInsightsSyncResponse {
679
+ totalPosts: number;
680
+ postsWithInsights: number;
681
+ errorCount: number;
682
+ syncStatus: SyncStatus;
683
+ lastSyncAt: string;
684
+ }
685
+ /**
686
+ * Response from GET /v1/platforms/instagram/analytics/posts/sync/status
687
+ */
688
+ interface PostInsightsSyncStatusResponse {
689
+ needsSync: boolean;
690
+ status: SyncStatus;
691
+ totalPosts: number;
692
+ postsWithInsights: number;
693
+ coverage: number;
694
+ lastSyncAt: string | null;
695
+ metadata?: {
696
+ postsWithInsights?: number;
697
+ totalPosts?: number;
698
+ lastCheckedAt?: string;
699
+ } | null;
700
+ message: string;
701
+ }
542
702
  interface SyncResponse {
543
703
  message: string;
544
704
  profile?: {
@@ -1594,23 +1754,75 @@ declare class YouTubeModule {
1594
1754
  * TrndUp SDK - Instagram Module
1595
1755
  *
1596
1756
  * Instagram analytics and data methods
1757
+ * Route structure mirrors YouTube for UI consistency
1597
1758
  */
1598
1759
 
1599
1760
  declare class InstagramModule {
1600
1761
  private client;
1601
1762
  constructor(client: TrndUpClient);
1602
1763
  /**
1603
- * Get Instagram initialization status
1604
- * GET /v1/platforms/instagram/status/init
1764
+ * Get unified sync status for all Instagram data types
1765
+ * GET /v1/platforms/instagram/sync/status
1766
+ *
1767
+ * Shows when each type was last synced and when next sync is due.
1605
1768
  */
1606
- getInitStatus(): Promise<Instagram.InitStatusResponse>;
1769
+ getSyncStatus(): Promise<Instagram.UnifiedSyncStatusResponse>;
1607
1770
  /**
1608
1771
  * Initialize Instagram data sync
1609
- * GET /v1/platforms/instagram/init
1772
+ * POST /v1/platforms/instagram/init
1610
1773
  */
1611
1774
  initialize(): Promise<Instagram.InitResponse>;
1612
1775
  /**
1613
- * Get account-level insights
1776
+ * Get Instagram initialization status
1777
+ * GET /v1/platforms/instagram/init/status
1778
+ */
1779
+ getInitStatus(): Promise<Instagram.InitStatusResponse>;
1780
+ /**
1781
+ * Sync all posts from Instagram to database
1782
+ * POST /v1/platforms/instagram/posts/sync
1783
+ */
1784
+ syncPosts(): Promise<Instagram.PostsSyncResponse>;
1785
+ /**
1786
+ * Check posts sync status without triggering a sync
1787
+ * GET /v1/platforms/instagram/posts/sync/status
1788
+ */
1789
+ getPostsSyncStatus(): Promise<Instagram.PostsSyncStatusResponse>;
1790
+ /**
1791
+ * Sync account-level analytics (reach, impressions, engagement)
1792
+ * POST /v1/platforms/instagram/analytics/account/sync
1793
+ * @param range Time range: '7d', '14d', '30d' (default '30d')
1794
+ */
1795
+ syncAccountAnalytics(params?: {
1796
+ range?: string;
1797
+ }): Promise<Instagram.AccountAnalyticsSyncResponse>;
1798
+ /**
1799
+ * Get account analytics sync status
1800
+ * GET /v1/platforms/instagram/analytics/account/sync/status
1801
+ */
1802
+ getAccountAnalyticsSyncStatus(): Promise<Instagram.AccountAnalyticsSyncStatusResponse>;
1803
+ /**
1804
+ * Sync post-level insights for all posts
1805
+ * POST /v1/platforms/instagram/analytics/posts/sync
1806
+ */
1807
+ syncPostInsights(): Promise<Instagram.PostInsightsSyncResponse>;
1808
+ /**
1809
+ * Get post insights sync status
1810
+ * GET /v1/platforms/instagram/analytics/posts/sync/status
1811
+ */
1812
+ getPostInsightsSyncStatus(): Promise<Instagram.PostInsightsSyncStatusResponse>;
1813
+ /**
1814
+ * Get user profile info
1815
+ * GET /v1/platforms/instagram/profile
1816
+ */
1817
+ getProfile(): Promise<Instagram.ProfileResponse>;
1818
+ /**
1819
+ * Get account overview for dashboard
1820
+ * GET /v1/platforms/instagram/account/overview
1821
+ * @param range Time range: '7d', '14d', '28d', '30d'
1822
+ */
1823
+ getAccountOverview(params?: Instagram.GetAccountOverviewParams): Promise<Instagram.AccountOverviewResponse>;
1824
+ /**
1825
+ * Get account-level insights (historical data)
1614
1826
  * GET /v1/platforms/instagram/account/insights
1615
1827
  * @param range Time range: '7d', '14d', '28d', '30d'
1616
1828
  */
@@ -1631,18 +1843,11 @@ declare class InstagramModule {
1631
1843
  */
1632
1844
  getStories(): Promise<Instagram.StoriesResponse>;
1633
1845
  /**
1634
- * Trigger manual data sync
1846
+ * Trigger manual data sync (legacy - use specific sync methods)
1635
1847
  * POST /v1/platforms/instagram/sync
1848
+ * @deprecated Use syncPosts, syncAccountAnalytics, syncPostInsights instead
1636
1849
  */
1637
1850
  sync(): Promise<Instagram.SyncResponse>;
1638
- /**
1639
- * @deprecated Use getAccountInsights instead
1640
- */
1641
- getAccountMetrics(): Promise<Instagram.AccountInsightsResponse>;
1642
- /**
1643
- * @deprecated Use sync instead
1644
- */
1645
- refresh(): Promise<Instagram.SyncResponse>;
1646
1851
  }
1647
1852
 
1648
1853
  /**
package/dist/index.d.ts CHANGED
@@ -487,6 +487,62 @@ declare namespace Instagram {
487
487
  value: number;
488
488
  }>>;
489
489
  }
490
+ interface ProfileResponse {
491
+ id: string;
492
+ username: string;
493
+ name?: string;
494
+ biography?: string;
495
+ profilePictureUrl?: string;
496
+ followersCount: number;
497
+ followingCount: number;
498
+ mediaCount: number;
499
+ accountType?: 'BUSINESS' | 'CREATOR' | 'PERSONAL';
500
+ website?: string;
501
+ cached?: boolean;
502
+ cachedAt?: string;
503
+ }
504
+ interface GetAccountOverviewParams {
505
+ range?: '7d' | '14d' | '28d' | '30d';
506
+ }
507
+ interface AccountOverviewResponse {
508
+ profile: {
509
+ id: string;
510
+ username: string;
511
+ name?: string;
512
+ biography?: string;
513
+ profilePictureUrl?: string;
514
+ followersCount: number;
515
+ followingCount: number;
516
+ mediaCount: number;
517
+ accountType?: string;
518
+ website?: string;
519
+ };
520
+ stats: {
521
+ range: string;
522
+ reach: number;
523
+ impressions: number;
524
+ profileViews: number;
525
+ websiteClicks: number;
526
+ totalLikes: number;
527
+ totalComments: number;
528
+ totalShares: number;
529
+ totalSaves: number;
530
+ engagementRate: number;
531
+ accountsEngaged: number;
532
+ };
533
+ topPosts: Array<{
534
+ id: string;
535
+ mediaType: string;
536
+ mediaUrl?: string;
537
+ thumbnailUrl?: string;
538
+ caption?: string;
539
+ likeCount?: number;
540
+ commentsCount?: number;
541
+ timestamp?: string;
542
+ permalink?: string;
543
+ }>;
544
+ syncedMediaCount: number;
545
+ }
490
546
  interface Post {
491
547
  id: string;
492
548
  media_id: string;
@@ -539,6 +595,110 @@ declare namespace Instagram {
539
595
  stories: Story[];
540
596
  count: number;
541
597
  }
598
+ /** Sync status enum matching backend */
599
+ type SyncStatus = 'NEVER_SYNCED' | 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
600
+ /** Individual sync type info */
601
+ interface SyncTypeInfo {
602
+ status: SyncStatus;
603
+ lastSyncAt: string | null;
604
+ lastError?: string | null;
605
+ failedAttempts?: number;
606
+ isStale: boolean;
607
+ nextSyncAt: string | null;
608
+ timeUntilNextSync: string;
609
+ interval: string;
610
+ }
611
+ /**
612
+ * Unified sync status response
613
+ * GET /v1/platforms/instagram/sync/status
614
+ */
615
+ interface UnifiedSyncStatusResponse {
616
+ isConnected: boolean;
617
+ igUserId: string | null;
618
+ username: string | null;
619
+ totalPosts: number;
620
+ syncs: {
621
+ accountInfo: SyncTypeInfo;
622
+ posts: SyncTypeInfo;
623
+ accountAnalytics: SyncTypeInfo;
624
+ postInsights: SyncTypeInfo;
625
+ stories: SyncTypeInfo;
626
+ };
627
+ }
628
+ /**
629
+ * Response from POST /v1/platforms/instagram/posts/sync
630
+ */
631
+ interface PostsSyncResponse {
632
+ posts: {
633
+ total: number;
634
+ synced: number;
635
+ oldestPostDate: string | null;
636
+ };
637
+ syncStatus: {
638
+ isFirstSync: boolean;
639
+ lastSyncAt: string;
640
+ };
641
+ }
642
+ /**
643
+ * Response from GET /v1/platforms/instagram/posts/sync/status
644
+ */
645
+ interface PostsSyncStatusResponse {
646
+ needsSync: boolean;
647
+ status: SyncStatus;
648
+ lastSyncAt: string | null;
649
+ postCount: number;
650
+ oldestPostDate: string | null;
651
+ }
652
+ /**
653
+ * Response from POST /v1/platforms/instagram/analytics/account/sync
654
+ */
655
+ interface AccountAnalyticsSyncResponse {
656
+ range: string;
657
+ metricsCount: number;
658
+ syncStatus: SyncStatus;
659
+ lastSyncAt: string;
660
+ }
661
+ /**
662
+ * Response from GET /v1/platforms/instagram/analytics/account/sync/status
663
+ */
664
+ interface AccountAnalyticsSyncStatusResponse {
665
+ needsSync: boolean;
666
+ status: SyncStatus;
667
+ insightRecords: number;
668
+ dateRange: {
669
+ start: string;
670
+ end: string;
671
+ } | null;
672
+ lastSyncAt: string | null;
673
+ message: string;
674
+ }
675
+ /**
676
+ * Response from POST /v1/platforms/instagram/analytics/posts/sync
677
+ */
678
+ interface PostInsightsSyncResponse {
679
+ totalPosts: number;
680
+ postsWithInsights: number;
681
+ errorCount: number;
682
+ syncStatus: SyncStatus;
683
+ lastSyncAt: string;
684
+ }
685
+ /**
686
+ * Response from GET /v1/platforms/instagram/analytics/posts/sync/status
687
+ */
688
+ interface PostInsightsSyncStatusResponse {
689
+ needsSync: boolean;
690
+ status: SyncStatus;
691
+ totalPosts: number;
692
+ postsWithInsights: number;
693
+ coverage: number;
694
+ lastSyncAt: string | null;
695
+ metadata?: {
696
+ postsWithInsights?: number;
697
+ totalPosts?: number;
698
+ lastCheckedAt?: string;
699
+ } | null;
700
+ message: string;
701
+ }
542
702
  interface SyncResponse {
543
703
  message: string;
544
704
  profile?: {
@@ -1594,23 +1754,75 @@ declare class YouTubeModule {
1594
1754
  * TrndUp SDK - Instagram Module
1595
1755
  *
1596
1756
  * Instagram analytics and data methods
1757
+ * Route structure mirrors YouTube for UI consistency
1597
1758
  */
1598
1759
 
1599
1760
  declare class InstagramModule {
1600
1761
  private client;
1601
1762
  constructor(client: TrndUpClient);
1602
1763
  /**
1603
- * Get Instagram initialization status
1604
- * GET /v1/platforms/instagram/status/init
1764
+ * Get unified sync status for all Instagram data types
1765
+ * GET /v1/platforms/instagram/sync/status
1766
+ *
1767
+ * Shows when each type was last synced and when next sync is due.
1605
1768
  */
1606
- getInitStatus(): Promise<Instagram.InitStatusResponse>;
1769
+ getSyncStatus(): Promise<Instagram.UnifiedSyncStatusResponse>;
1607
1770
  /**
1608
1771
  * Initialize Instagram data sync
1609
- * GET /v1/platforms/instagram/init
1772
+ * POST /v1/platforms/instagram/init
1610
1773
  */
1611
1774
  initialize(): Promise<Instagram.InitResponse>;
1612
1775
  /**
1613
- * Get account-level insights
1776
+ * Get Instagram initialization status
1777
+ * GET /v1/platforms/instagram/init/status
1778
+ */
1779
+ getInitStatus(): Promise<Instagram.InitStatusResponse>;
1780
+ /**
1781
+ * Sync all posts from Instagram to database
1782
+ * POST /v1/platforms/instagram/posts/sync
1783
+ */
1784
+ syncPosts(): Promise<Instagram.PostsSyncResponse>;
1785
+ /**
1786
+ * Check posts sync status without triggering a sync
1787
+ * GET /v1/platforms/instagram/posts/sync/status
1788
+ */
1789
+ getPostsSyncStatus(): Promise<Instagram.PostsSyncStatusResponse>;
1790
+ /**
1791
+ * Sync account-level analytics (reach, impressions, engagement)
1792
+ * POST /v1/platforms/instagram/analytics/account/sync
1793
+ * @param range Time range: '7d', '14d', '30d' (default '30d')
1794
+ */
1795
+ syncAccountAnalytics(params?: {
1796
+ range?: string;
1797
+ }): Promise<Instagram.AccountAnalyticsSyncResponse>;
1798
+ /**
1799
+ * Get account analytics sync status
1800
+ * GET /v1/platforms/instagram/analytics/account/sync/status
1801
+ */
1802
+ getAccountAnalyticsSyncStatus(): Promise<Instagram.AccountAnalyticsSyncStatusResponse>;
1803
+ /**
1804
+ * Sync post-level insights for all posts
1805
+ * POST /v1/platforms/instagram/analytics/posts/sync
1806
+ */
1807
+ syncPostInsights(): Promise<Instagram.PostInsightsSyncResponse>;
1808
+ /**
1809
+ * Get post insights sync status
1810
+ * GET /v1/platforms/instagram/analytics/posts/sync/status
1811
+ */
1812
+ getPostInsightsSyncStatus(): Promise<Instagram.PostInsightsSyncStatusResponse>;
1813
+ /**
1814
+ * Get user profile info
1815
+ * GET /v1/platforms/instagram/profile
1816
+ */
1817
+ getProfile(): Promise<Instagram.ProfileResponse>;
1818
+ /**
1819
+ * Get account overview for dashboard
1820
+ * GET /v1/platforms/instagram/account/overview
1821
+ * @param range Time range: '7d', '14d', '28d', '30d'
1822
+ */
1823
+ getAccountOverview(params?: Instagram.GetAccountOverviewParams): Promise<Instagram.AccountOverviewResponse>;
1824
+ /**
1825
+ * Get account-level insights (historical data)
1614
1826
  * GET /v1/platforms/instagram/account/insights
1615
1827
  * @param range Time range: '7d', '14d', '28d', '30d'
1616
1828
  */
@@ -1631,18 +1843,11 @@ declare class InstagramModule {
1631
1843
  */
1632
1844
  getStories(): Promise<Instagram.StoriesResponse>;
1633
1845
  /**
1634
- * Trigger manual data sync
1846
+ * Trigger manual data sync (legacy - use specific sync methods)
1635
1847
  * POST /v1/platforms/instagram/sync
1848
+ * @deprecated Use syncPosts, syncAccountAnalytics, syncPostInsights instead
1636
1849
  */
1637
1850
  sync(): Promise<Instagram.SyncResponse>;
1638
- /**
1639
- * @deprecated Use getAccountInsights instead
1640
- */
1641
- getAccountMetrics(): Promise<Instagram.AccountInsightsResponse>;
1642
- /**
1643
- * @deprecated Use sync instead
1644
- */
1645
- refresh(): Promise<Instagram.SyncResponse>;
1646
1851
  }
1647
1852
 
1648
1853
  /**