@dracoonghost/trndup-sdk 1.3.21 → 1.3.23
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 +174 -14
- package/dist/index.d.ts +174 -14
- package/dist/index.js +83 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -595,6 +595,125 @@ declare namespace Instagram {
|
|
|
595
595
|
stories: Story[];
|
|
596
596
|
count: number;
|
|
597
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
|
+
* Post insights are queued for background processing via BullMQ
|
|
678
|
+
*/
|
|
679
|
+
interface PostInsightsSyncResponse {
|
|
680
|
+
message: string;
|
|
681
|
+
totalPosts: number;
|
|
682
|
+
jobsQueued: number;
|
|
683
|
+
status: SyncStatus;
|
|
684
|
+
queuedAt: string;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Response when sync is already in progress
|
|
688
|
+
*/
|
|
689
|
+
interface PostInsightsInProgressResponse {
|
|
690
|
+
message: string;
|
|
691
|
+
status: 'in_progress';
|
|
692
|
+
progress: {
|
|
693
|
+
waiting: number;
|
|
694
|
+
active: number;
|
|
695
|
+
completed: number;
|
|
696
|
+
failed: number;
|
|
697
|
+
delayed: number;
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Response from GET /v1/platforms/instagram/analytics/posts/sync/status
|
|
702
|
+
*/
|
|
703
|
+
interface PostInsightsSyncStatusResponse {
|
|
704
|
+
needsSync: boolean;
|
|
705
|
+
status: SyncStatus;
|
|
706
|
+
totalPosts: number;
|
|
707
|
+
postsWithInsights: number;
|
|
708
|
+
coverage: number;
|
|
709
|
+
lastSyncAt: string | null;
|
|
710
|
+
metadata?: {
|
|
711
|
+
postsWithInsights?: number;
|
|
712
|
+
totalPosts?: number;
|
|
713
|
+
lastCheckedAt?: string;
|
|
714
|
+
} | null;
|
|
715
|
+
message: string;
|
|
716
|
+
}
|
|
598
717
|
interface SyncResponse {
|
|
599
718
|
message: string;
|
|
600
719
|
profile?: {
|
|
@@ -1650,21 +1769,69 @@ declare class YouTubeModule {
|
|
|
1650
1769
|
* TrndUp SDK - Instagram Module
|
|
1651
1770
|
*
|
|
1652
1771
|
* Instagram analytics and data methods
|
|
1772
|
+
* Route structure mirrors YouTube for UI consistency
|
|
1653
1773
|
*/
|
|
1654
1774
|
|
|
1655
1775
|
declare class InstagramModule {
|
|
1656
1776
|
private client;
|
|
1657
1777
|
constructor(client: TrndUpClient);
|
|
1658
1778
|
/**
|
|
1659
|
-
* Get Instagram
|
|
1660
|
-
* GET /v1/platforms/instagram/status
|
|
1779
|
+
* Get unified sync status for all Instagram data types
|
|
1780
|
+
* GET /v1/platforms/instagram/sync/status
|
|
1781
|
+
*
|
|
1782
|
+
* Shows when each type was last synced and when next sync is due.
|
|
1661
1783
|
*/
|
|
1662
|
-
|
|
1784
|
+
getSyncStatus(): Promise<Instagram.UnifiedSyncStatusResponse>;
|
|
1663
1785
|
/**
|
|
1664
1786
|
* Initialize Instagram data sync
|
|
1665
|
-
*
|
|
1787
|
+
* POST /v1/platforms/instagram/init
|
|
1666
1788
|
*/
|
|
1667
1789
|
initialize(): Promise<Instagram.InitResponse>;
|
|
1790
|
+
/**
|
|
1791
|
+
* Get Instagram initialization status
|
|
1792
|
+
* GET /v1/platforms/instagram/init/status
|
|
1793
|
+
*/
|
|
1794
|
+
getInitStatus(): Promise<Instagram.InitStatusResponse>;
|
|
1795
|
+
/**
|
|
1796
|
+
* Sync all posts from Instagram to database
|
|
1797
|
+
* POST /v1/platforms/instagram/posts/sync
|
|
1798
|
+
*/
|
|
1799
|
+
syncPosts(): Promise<Instagram.PostsSyncResponse>;
|
|
1800
|
+
/**
|
|
1801
|
+
* Check posts sync status without triggering a sync
|
|
1802
|
+
* GET /v1/platforms/instagram/posts/sync/status
|
|
1803
|
+
*/
|
|
1804
|
+
getPostsSyncStatus(): Promise<Instagram.PostsSyncStatusResponse>;
|
|
1805
|
+
/**
|
|
1806
|
+
* Sync account-level analytics (reach, impressions, engagement)
|
|
1807
|
+
* POST /v1/platforms/instagram/analytics/account/sync
|
|
1808
|
+
* @param range Time range: '7d', '14d', '30d' (default '30d')
|
|
1809
|
+
*/
|
|
1810
|
+
syncAccountAnalytics(params?: {
|
|
1811
|
+
range?: string;
|
|
1812
|
+
}): Promise<Instagram.AccountAnalyticsSyncResponse>;
|
|
1813
|
+
/**
|
|
1814
|
+
* Get account analytics sync status
|
|
1815
|
+
* GET /v1/platforms/instagram/analytics/account/sync/status
|
|
1816
|
+
*/
|
|
1817
|
+
getAccountAnalyticsSyncStatus(): Promise<Instagram.AccountAnalyticsSyncStatusResponse>;
|
|
1818
|
+
/**
|
|
1819
|
+
* Queue post-level insights sync for all posts (BullMQ-based)
|
|
1820
|
+
* POST /v1/platforms/instagram/analytics/posts/sync
|
|
1821
|
+
*
|
|
1822
|
+
* Jobs are queued and processed in the background.
|
|
1823
|
+
* Poll getPostInsightsSyncStatus() to check progress.
|
|
1824
|
+
*
|
|
1825
|
+
* @returns Response with jobsQueued count and status
|
|
1826
|
+
*/
|
|
1827
|
+
syncPostInsights(): Promise<Instagram.PostInsightsSyncResponse>;
|
|
1828
|
+
/**
|
|
1829
|
+
* Get post insights sync status
|
|
1830
|
+
* GET /v1/platforms/instagram/analytics/posts/sync/status
|
|
1831
|
+
*
|
|
1832
|
+
* Use to poll progress while sync is in_progress
|
|
1833
|
+
*/
|
|
1834
|
+
getPostInsightsSyncStatus(): Promise<Instagram.PostInsightsSyncStatusResponse>;
|
|
1668
1835
|
/**
|
|
1669
1836
|
* Get user profile info
|
|
1670
1837
|
* GET /v1/platforms/instagram/profile
|
|
@@ -1677,7 +1844,7 @@ declare class InstagramModule {
|
|
|
1677
1844
|
*/
|
|
1678
1845
|
getAccountOverview(params?: Instagram.GetAccountOverviewParams): Promise<Instagram.AccountOverviewResponse>;
|
|
1679
1846
|
/**
|
|
1680
|
-
* Get account-level insights
|
|
1847
|
+
* Get account-level insights (historical data)
|
|
1681
1848
|
* GET /v1/platforms/instagram/account/insights
|
|
1682
1849
|
* @param range Time range: '7d', '14d', '28d', '30d'
|
|
1683
1850
|
*/
|
|
@@ -1698,18 +1865,11 @@ declare class InstagramModule {
|
|
|
1698
1865
|
*/
|
|
1699
1866
|
getStories(): Promise<Instagram.StoriesResponse>;
|
|
1700
1867
|
/**
|
|
1701
|
-
* Trigger manual data sync
|
|
1868
|
+
* Trigger manual data sync (legacy - use specific sync methods)
|
|
1702
1869
|
* POST /v1/platforms/instagram/sync
|
|
1870
|
+
* @deprecated Use syncPosts, syncAccountAnalytics, syncPostInsights instead
|
|
1703
1871
|
*/
|
|
1704
1872
|
sync(): Promise<Instagram.SyncResponse>;
|
|
1705
|
-
/**
|
|
1706
|
-
* @deprecated Use getAccountInsights instead
|
|
1707
|
-
*/
|
|
1708
|
-
getAccountMetrics(): Promise<Instagram.AccountInsightsResponse>;
|
|
1709
|
-
/**
|
|
1710
|
-
* @deprecated Use sync instead
|
|
1711
|
-
*/
|
|
1712
|
-
refresh(): Promise<Instagram.SyncResponse>;
|
|
1713
1873
|
}
|
|
1714
1874
|
|
|
1715
1875
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -595,6 +595,125 @@ declare namespace Instagram {
|
|
|
595
595
|
stories: Story[];
|
|
596
596
|
count: number;
|
|
597
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
|
+
* Post insights are queued for background processing via BullMQ
|
|
678
|
+
*/
|
|
679
|
+
interface PostInsightsSyncResponse {
|
|
680
|
+
message: string;
|
|
681
|
+
totalPosts: number;
|
|
682
|
+
jobsQueued: number;
|
|
683
|
+
status: SyncStatus;
|
|
684
|
+
queuedAt: string;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Response when sync is already in progress
|
|
688
|
+
*/
|
|
689
|
+
interface PostInsightsInProgressResponse {
|
|
690
|
+
message: string;
|
|
691
|
+
status: 'in_progress';
|
|
692
|
+
progress: {
|
|
693
|
+
waiting: number;
|
|
694
|
+
active: number;
|
|
695
|
+
completed: number;
|
|
696
|
+
failed: number;
|
|
697
|
+
delayed: number;
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Response from GET /v1/platforms/instagram/analytics/posts/sync/status
|
|
702
|
+
*/
|
|
703
|
+
interface PostInsightsSyncStatusResponse {
|
|
704
|
+
needsSync: boolean;
|
|
705
|
+
status: SyncStatus;
|
|
706
|
+
totalPosts: number;
|
|
707
|
+
postsWithInsights: number;
|
|
708
|
+
coverage: number;
|
|
709
|
+
lastSyncAt: string | null;
|
|
710
|
+
metadata?: {
|
|
711
|
+
postsWithInsights?: number;
|
|
712
|
+
totalPosts?: number;
|
|
713
|
+
lastCheckedAt?: string;
|
|
714
|
+
} | null;
|
|
715
|
+
message: string;
|
|
716
|
+
}
|
|
598
717
|
interface SyncResponse {
|
|
599
718
|
message: string;
|
|
600
719
|
profile?: {
|
|
@@ -1650,21 +1769,69 @@ declare class YouTubeModule {
|
|
|
1650
1769
|
* TrndUp SDK - Instagram Module
|
|
1651
1770
|
*
|
|
1652
1771
|
* Instagram analytics and data methods
|
|
1772
|
+
* Route structure mirrors YouTube for UI consistency
|
|
1653
1773
|
*/
|
|
1654
1774
|
|
|
1655
1775
|
declare class InstagramModule {
|
|
1656
1776
|
private client;
|
|
1657
1777
|
constructor(client: TrndUpClient);
|
|
1658
1778
|
/**
|
|
1659
|
-
* Get Instagram
|
|
1660
|
-
* GET /v1/platforms/instagram/status
|
|
1779
|
+
* Get unified sync status for all Instagram data types
|
|
1780
|
+
* GET /v1/platforms/instagram/sync/status
|
|
1781
|
+
*
|
|
1782
|
+
* Shows when each type was last synced and when next sync is due.
|
|
1661
1783
|
*/
|
|
1662
|
-
|
|
1784
|
+
getSyncStatus(): Promise<Instagram.UnifiedSyncStatusResponse>;
|
|
1663
1785
|
/**
|
|
1664
1786
|
* Initialize Instagram data sync
|
|
1665
|
-
*
|
|
1787
|
+
* POST /v1/platforms/instagram/init
|
|
1666
1788
|
*/
|
|
1667
1789
|
initialize(): Promise<Instagram.InitResponse>;
|
|
1790
|
+
/**
|
|
1791
|
+
* Get Instagram initialization status
|
|
1792
|
+
* GET /v1/platforms/instagram/init/status
|
|
1793
|
+
*/
|
|
1794
|
+
getInitStatus(): Promise<Instagram.InitStatusResponse>;
|
|
1795
|
+
/**
|
|
1796
|
+
* Sync all posts from Instagram to database
|
|
1797
|
+
* POST /v1/platforms/instagram/posts/sync
|
|
1798
|
+
*/
|
|
1799
|
+
syncPosts(): Promise<Instagram.PostsSyncResponse>;
|
|
1800
|
+
/**
|
|
1801
|
+
* Check posts sync status without triggering a sync
|
|
1802
|
+
* GET /v1/platforms/instagram/posts/sync/status
|
|
1803
|
+
*/
|
|
1804
|
+
getPostsSyncStatus(): Promise<Instagram.PostsSyncStatusResponse>;
|
|
1805
|
+
/**
|
|
1806
|
+
* Sync account-level analytics (reach, impressions, engagement)
|
|
1807
|
+
* POST /v1/platforms/instagram/analytics/account/sync
|
|
1808
|
+
* @param range Time range: '7d', '14d', '30d' (default '30d')
|
|
1809
|
+
*/
|
|
1810
|
+
syncAccountAnalytics(params?: {
|
|
1811
|
+
range?: string;
|
|
1812
|
+
}): Promise<Instagram.AccountAnalyticsSyncResponse>;
|
|
1813
|
+
/**
|
|
1814
|
+
* Get account analytics sync status
|
|
1815
|
+
* GET /v1/platforms/instagram/analytics/account/sync/status
|
|
1816
|
+
*/
|
|
1817
|
+
getAccountAnalyticsSyncStatus(): Promise<Instagram.AccountAnalyticsSyncStatusResponse>;
|
|
1818
|
+
/**
|
|
1819
|
+
* Queue post-level insights sync for all posts (BullMQ-based)
|
|
1820
|
+
* POST /v1/platforms/instagram/analytics/posts/sync
|
|
1821
|
+
*
|
|
1822
|
+
* Jobs are queued and processed in the background.
|
|
1823
|
+
* Poll getPostInsightsSyncStatus() to check progress.
|
|
1824
|
+
*
|
|
1825
|
+
* @returns Response with jobsQueued count and status
|
|
1826
|
+
*/
|
|
1827
|
+
syncPostInsights(): Promise<Instagram.PostInsightsSyncResponse>;
|
|
1828
|
+
/**
|
|
1829
|
+
* Get post insights sync status
|
|
1830
|
+
* GET /v1/platforms/instagram/analytics/posts/sync/status
|
|
1831
|
+
*
|
|
1832
|
+
* Use to poll progress while sync is in_progress
|
|
1833
|
+
*/
|
|
1834
|
+
getPostInsightsSyncStatus(): Promise<Instagram.PostInsightsSyncStatusResponse>;
|
|
1668
1835
|
/**
|
|
1669
1836
|
* Get user profile info
|
|
1670
1837
|
* GET /v1/platforms/instagram/profile
|
|
@@ -1677,7 +1844,7 @@ declare class InstagramModule {
|
|
|
1677
1844
|
*/
|
|
1678
1845
|
getAccountOverview(params?: Instagram.GetAccountOverviewParams): Promise<Instagram.AccountOverviewResponse>;
|
|
1679
1846
|
/**
|
|
1680
|
-
* Get account-level insights
|
|
1847
|
+
* Get account-level insights (historical data)
|
|
1681
1848
|
* GET /v1/platforms/instagram/account/insights
|
|
1682
1849
|
* @param range Time range: '7d', '14d', '28d', '30d'
|
|
1683
1850
|
*/
|
|
@@ -1698,18 +1865,11 @@ declare class InstagramModule {
|
|
|
1698
1865
|
*/
|
|
1699
1866
|
getStories(): Promise<Instagram.StoriesResponse>;
|
|
1700
1867
|
/**
|
|
1701
|
-
* Trigger manual data sync
|
|
1868
|
+
* Trigger manual data sync (legacy - use specific sync methods)
|
|
1702
1869
|
* POST /v1/platforms/instagram/sync
|
|
1870
|
+
* @deprecated Use syncPosts, syncAccountAnalytics, syncPostInsights instead
|
|
1703
1871
|
*/
|
|
1704
1872
|
sync(): Promise<Instagram.SyncResponse>;
|
|
1705
|
-
/**
|
|
1706
|
-
* @deprecated Use getAccountInsights instead
|
|
1707
|
-
*/
|
|
1708
|
-
getAccountMetrics(): Promise<Instagram.AccountInsightsResponse>;
|
|
1709
|
-
/**
|
|
1710
|
-
* @deprecated Use sync instead
|
|
1711
|
-
*/
|
|
1712
|
-
refresh(): Promise<Instagram.SyncResponse>;
|
|
1713
1873
|
}
|
|
1714
1874
|
|
|
1715
1875
|
/**
|
package/dist/index.js
CHANGED
|
@@ -486,22 +486,94 @@ var InstagramModule = class {
|
|
|
486
486
|
constructor(client) {
|
|
487
487
|
this.client = client;
|
|
488
488
|
}
|
|
489
|
+
// ===== UNIFIED SYNC STATUS =====
|
|
490
|
+
/**
|
|
491
|
+
* Get unified sync status for all Instagram data types
|
|
492
|
+
* GET /v1/platforms/instagram/sync/status
|
|
493
|
+
*
|
|
494
|
+
* Shows when each type was last synced and when next sync is due.
|
|
495
|
+
*/
|
|
496
|
+
async getSyncStatus() {
|
|
497
|
+
return this.client.get("/v1/platforms/instagram/sync/status");
|
|
498
|
+
}
|
|
489
499
|
// ===== INITIALIZATION =====
|
|
500
|
+
/**
|
|
501
|
+
* Initialize Instagram data sync
|
|
502
|
+
* POST /v1/platforms/instagram/init
|
|
503
|
+
*/
|
|
504
|
+
async initialize() {
|
|
505
|
+
return this.client.post("/v1/platforms/instagram/init");
|
|
506
|
+
}
|
|
490
507
|
/**
|
|
491
508
|
* Get Instagram initialization status
|
|
492
|
-
* GET /v1/platforms/instagram/status
|
|
509
|
+
* GET /v1/platforms/instagram/init/status
|
|
493
510
|
*/
|
|
494
511
|
async getInitStatus() {
|
|
495
|
-
return this.client.get("/v1/platforms/instagram/status
|
|
512
|
+
return this.client.get("/v1/platforms/instagram/init/status");
|
|
496
513
|
}
|
|
514
|
+
// ===== POSTS SYNC =====
|
|
497
515
|
/**
|
|
498
|
-
*
|
|
499
|
-
*
|
|
516
|
+
* Sync all posts from Instagram to database
|
|
517
|
+
* POST /v1/platforms/instagram/posts/sync
|
|
500
518
|
*/
|
|
501
|
-
async
|
|
502
|
-
return this.client.
|
|
519
|
+
async syncPosts() {
|
|
520
|
+
return this.client.post("/v1/platforms/instagram/posts/sync");
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Check posts sync status without triggering a sync
|
|
524
|
+
* GET /v1/platforms/instagram/posts/sync/status
|
|
525
|
+
*/
|
|
526
|
+
async getPostsSyncStatus() {
|
|
527
|
+
return this.client.get("/v1/platforms/instagram/posts/sync/status");
|
|
528
|
+
}
|
|
529
|
+
// ===== ACCOUNT ANALYTICS SYNC =====
|
|
530
|
+
/**
|
|
531
|
+
* Sync account-level analytics (reach, impressions, engagement)
|
|
532
|
+
* POST /v1/platforms/instagram/analytics/account/sync
|
|
533
|
+
* @param range Time range: '7d', '14d', '30d' (default '30d')
|
|
534
|
+
*/
|
|
535
|
+
async syncAccountAnalytics(params) {
|
|
536
|
+
const queryParams = params?.range ? `?range=${params.range}` : "";
|
|
537
|
+
return this.client.post(
|
|
538
|
+
`/v1/platforms/instagram/analytics/account/sync${queryParams}`
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Get account analytics sync status
|
|
543
|
+
* GET /v1/platforms/instagram/analytics/account/sync/status
|
|
544
|
+
*/
|
|
545
|
+
async getAccountAnalyticsSyncStatus() {
|
|
546
|
+
return this.client.get(
|
|
547
|
+
"/v1/platforms/instagram/analytics/account/sync/status"
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
// ===== POST INSIGHTS SYNC =====
|
|
551
|
+
/**
|
|
552
|
+
* Queue post-level insights sync for all posts (BullMQ-based)
|
|
553
|
+
* POST /v1/platforms/instagram/analytics/posts/sync
|
|
554
|
+
*
|
|
555
|
+
* Jobs are queued and processed in the background.
|
|
556
|
+
* Poll getPostInsightsSyncStatus() to check progress.
|
|
557
|
+
*
|
|
558
|
+
* @returns Response with jobsQueued count and status
|
|
559
|
+
*/
|
|
560
|
+
async syncPostInsights() {
|
|
561
|
+
return this.client.post(
|
|
562
|
+
"/v1/platforms/instagram/analytics/posts/sync"
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Get post insights sync status
|
|
567
|
+
* GET /v1/platforms/instagram/analytics/posts/sync/status
|
|
568
|
+
*
|
|
569
|
+
* Use to poll progress while sync is in_progress
|
|
570
|
+
*/
|
|
571
|
+
async getPostInsightsSyncStatus() {
|
|
572
|
+
return this.client.get(
|
|
573
|
+
"/v1/platforms/instagram/analytics/posts/sync/status"
|
|
574
|
+
);
|
|
503
575
|
}
|
|
504
|
-
// =====
|
|
576
|
+
// ===== DATA RETRIEVAL =====
|
|
505
577
|
/**
|
|
506
578
|
* Get user profile info
|
|
507
579
|
* GET /v1/platforms/instagram/profile
|
|
@@ -521,7 +593,7 @@ var InstagramModule = class {
|
|
|
521
593
|
);
|
|
522
594
|
}
|
|
523
595
|
/**
|
|
524
|
-
* Get account-level insights
|
|
596
|
+
* Get account-level insights (historical data)
|
|
525
597
|
* GET /v1/platforms/instagram/account/insights
|
|
526
598
|
* @param range Time range: '7d', '14d', '28d', '30d'
|
|
527
599
|
*/
|
|
@@ -531,7 +603,6 @@ var InstagramModule = class {
|
|
|
531
603
|
params
|
|
532
604
|
);
|
|
533
605
|
}
|
|
534
|
-
// ===== MEDIA / POSTS =====
|
|
535
606
|
/**
|
|
536
607
|
* Get Instagram posts
|
|
537
608
|
* GET /v1/platforms/instagram/posts
|
|
@@ -551,7 +622,6 @@ var InstagramModule = class {
|
|
|
551
622
|
`/v1/platforms/instagram/posts/${postId}/insights`
|
|
552
623
|
);
|
|
553
624
|
}
|
|
554
|
-
// ===== STORIES =====
|
|
555
625
|
/**
|
|
556
626
|
* Get active stories
|
|
557
627
|
* GET /v1/platforms/instagram/stories
|
|
@@ -559,27 +629,15 @@ var InstagramModule = class {
|
|
|
559
629
|
async getStories() {
|
|
560
630
|
return this.client.get("/v1/platforms/instagram/stories");
|
|
561
631
|
}
|
|
562
|
-
// ===== SYNC =====
|
|
632
|
+
// ===== LEGACY SYNC (backward compat) =====
|
|
563
633
|
/**
|
|
564
|
-
* Trigger manual data sync
|
|
634
|
+
* Trigger manual data sync (legacy - use specific sync methods)
|
|
565
635
|
* POST /v1/platforms/instagram/sync
|
|
636
|
+
* @deprecated Use syncPosts, syncAccountAnalytics, syncPostInsights instead
|
|
566
637
|
*/
|
|
567
638
|
async sync() {
|
|
568
639
|
return this.client.post("/v1/platforms/instagram/sync");
|
|
569
640
|
}
|
|
570
|
-
// ===== LEGACY (backward compat) =====
|
|
571
|
-
/**
|
|
572
|
-
* @deprecated Use getAccountInsights instead
|
|
573
|
-
*/
|
|
574
|
-
async getAccountMetrics() {
|
|
575
|
-
return this.getAccountInsights();
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* @deprecated Use sync instead
|
|
579
|
-
*/
|
|
580
|
-
async refresh() {
|
|
581
|
-
return this.sync();
|
|
582
|
-
}
|
|
583
641
|
};
|
|
584
642
|
|
|
585
643
|
// modules/social.ts
|