@dracoonghost/trndup-sdk 1.5.1 → 1.5.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/dist/index.mjs CHANGED
@@ -775,6 +775,78 @@ var InstagramModule = class {
775
775
  }
776
776
  };
777
777
 
778
+ // modules/facebook.ts
779
+ var FacebookModule = class {
780
+ constructor(client) {
781
+ this.client = client;
782
+ }
783
+ // ===== INITIALIZATION =====
784
+ /**
785
+ * Initialize Facebook Page data sync
786
+ * GET /v1/platforms/facebook/init
787
+ *
788
+ * Fetches page profile and recent posts, stores in database.
789
+ * Call this when user first accesses Facebook dashboard.
790
+ */
791
+ async init() {
792
+ return this.client.get("/v1/platforms/facebook/init");
793
+ }
794
+ /**
795
+ * Get Facebook initialization status
796
+ * GET /v1/platforms/facebook/status/init
797
+ *
798
+ * Check if Facebook is connected and if initial sync is done.
799
+ */
800
+ async getInitStatus() {
801
+ return this.client.get("/v1/platforms/facebook/status/init");
802
+ }
803
+ // ===== PAGE PROFILE =====
804
+ /**
805
+ * Get Facebook Page profile
806
+ * GET /v1/platforms/facebook/page
807
+ *
808
+ * Returns cached data if less than 1 hour old, else fetches fresh.
809
+ */
810
+ async getPage() {
811
+ return this.client.get("/v1/platforms/facebook/page");
812
+ }
813
+ // ===== ACCOUNT OVERVIEW =====
814
+ /**
815
+ * Get account overview for dashboard
816
+ * GET /v1/platforms/facebook/account/overview
817
+ *
818
+ * Returns page profile, aggregated stats, and top posts.
819
+ * @param range Time range: '7d', '14d', '30d' (default '7d')
820
+ */
821
+ async getAccountOverview(params) {
822
+ const queryParams = params?.range ? `?range=${params.range}` : "";
823
+ return this.client.get(
824
+ `/v1/platforms/facebook/account/overview${queryParams}`
825
+ );
826
+ }
827
+ // ===== POSTS =====
828
+ /**
829
+ * Get Facebook Page posts
830
+ * GET /v1/platforms/facebook/posts
831
+ *
832
+ * @param options.limit Number of posts to return (default 20)
833
+ * @param options.offset Offset for pagination (default 0)
834
+ * @param options.sortBy Sort by field: 'createdTime', 'reactionsCount', 'commentsCount'
835
+ * @param options.sortOrder Sort order: 'asc', 'desc'
836
+ */
837
+ async getPosts(options) {
838
+ const params = new URLSearchParams();
839
+ if (options?.limit) params.append("limit", String(options.limit));
840
+ if (options?.offset) params.append("offset", String(options.offset));
841
+ if (options?.sortBy) params.append("sortBy", options.sortBy);
842
+ if (options?.sortOrder) params.append("sortOrder", options.sortOrder);
843
+ const queryString = params.toString();
844
+ return this.client.get(
845
+ `/v1/platforms/facebook/posts${queryString ? `?${queryString}` : ""}`
846
+ );
847
+ }
848
+ };
849
+
778
850
  // modules/social.ts
779
851
  var SocialModule = class {
780
852
  constructor(client) {
@@ -1549,7 +1621,7 @@ var TrendsModule = class {
1549
1621
  * console.log(trend.topExamples);
1550
1622
  * ```
1551
1623
  */
1552
- async getById(trendId) {
1624
+ async get(trendId) {
1553
1625
  return this.client.get(`/v1/trends/${trendId}`);
1554
1626
  }
1555
1627
  /**
@@ -1651,6 +1723,7 @@ var TrndUpSDK = class extends TrndUpClient {
1651
1723
  this.auth = new AuthModule(this);
1652
1724
  this.youtube = new YouTubeModule(this);
1653
1725
  this.instagram = new InstagramModule(this);
1726
+ this.facebook = new FacebookModule(this);
1654
1727
  this.social = new SocialModule(this);
1655
1728
  this.insights = new InsightsModule(this);
1656
1729
  this.activity = new ActivityModule(this);