@dracoonghost/trndup-sdk 1.5.2 → 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.d.mts CHANGED
@@ -135,9 +135,10 @@ declare namespace Auth {
135
135
  */
136
136
  interface PlatformStatus {
137
137
  hasConnectedPlatforms: boolean;
138
- connectedPlatforms: Array<'youtube' | 'instagram'>;
138
+ connectedPlatforms: Array<'youtube' | 'instagram' | 'facebook'>;
139
139
  youtube: PlatformSyncInfo;
140
140
  instagram: PlatformSyncInfo;
141
+ facebook: PlatformSyncInfo;
141
142
  }
142
143
  interface LinkPhoneSendOTPRequest {
143
144
  phoneNumber: string;
@@ -2431,6 +2432,169 @@ declare class InstagramModule {
2431
2432
  sync(): Promise<Instagram.SyncResponse>;
2432
2433
  }
2433
2434
 
2435
+ /**
2436
+ * TrndUp SDK - Facebook Module
2437
+ *
2438
+ * Facebook Page analytics and data methods
2439
+ */
2440
+
2441
+ interface FacebookPageProfile {
2442
+ id: string;
2443
+ name: string;
2444
+ about?: string;
2445
+ category?: string;
2446
+ profilePictureUrl?: string;
2447
+ coverPhotoUrl?: string;
2448
+ followersCount?: number;
2449
+ fanCount?: number;
2450
+ website?: string;
2451
+ isVerified?: boolean;
2452
+ }
2453
+ interface FacebookPost {
2454
+ id: string;
2455
+ message?: string;
2456
+ story?: string;
2457
+ fullPicture?: string;
2458
+ permalinkUrl: string;
2459
+ reactionsCount: number;
2460
+ commentsCount: number;
2461
+ sharesCount: number;
2462
+ createdTime: string;
2463
+ postType?: string;
2464
+ statusType?: string;
2465
+ attachments?: Array<{
2466
+ type: string;
2467
+ title?: string;
2468
+ description?: string;
2469
+ imageUrl?: string;
2470
+ url?: string;
2471
+ }>;
2472
+ }
2473
+ interface FacebookStats {
2474
+ range: string;
2475
+ pageViews: number;
2476
+ pageImpressions: number;
2477
+ pageImpressionsUnique: number;
2478
+ pageEngagedUsers: number;
2479
+ pagePostEngagements: number;
2480
+ pageFanAdds: number;
2481
+ pageFanRemoves: number;
2482
+ netFanChange: number;
2483
+ }
2484
+ interface FacebookInitResponse {
2485
+ success: boolean;
2486
+ data?: {
2487
+ needsInit: boolean;
2488
+ message: string;
2489
+ page?: FacebookPageProfile;
2490
+ syncedPosts?: number;
2491
+ lastSyncedAt?: string;
2492
+ };
2493
+ error?: string;
2494
+ code?: string;
2495
+ }
2496
+ interface FacebookInitStatusResponse {
2497
+ success: boolean;
2498
+ data?: {
2499
+ connected: boolean;
2500
+ needsInit: boolean;
2501
+ isInitialSyncDone?: boolean;
2502
+ lastSyncedAt?: string;
2503
+ page?: {
2504
+ pageId: string;
2505
+ pageName?: string;
2506
+ profilePictureUrl?: string;
2507
+ followersCount?: number;
2508
+ fanCount?: number;
2509
+ };
2510
+ syncedPostsCount?: number;
2511
+ };
2512
+ error?: string;
2513
+ }
2514
+ interface FacebookPageResponse {
2515
+ success: boolean;
2516
+ data?: FacebookPageProfile & {
2517
+ cached?: boolean;
2518
+ cachedAt?: string;
2519
+ };
2520
+ error?: string;
2521
+ }
2522
+ interface FacebookAccountOverviewResponse {
2523
+ success: boolean;
2524
+ data?: {
2525
+ page: FacebookPageProfile;
2526
+ stats: FacebookStats;
2527
+ topPosts: FacebookPost[];
2528
+ syncedPostsCount: number;
2529
+ };
2530
+ error?: string;
2531
+ code?: string;
2532
+ }
2533
+ interface FacebookPostsResponse {
2534
+ success: boolean;
2535
+ data?: {
2536
+ posts: FacebookPost[];
2537
+ pagination: {
2538
+ limit: number;
2539
+ offset: number;
2540
+ total: number;
2541
+ hasMore: boolean;
2542
+ };
2543
+ };
2544
+ error?: string;
2545
+ }
2546
+ declare class FacebookModule {
2547
+ private client;
2548
+ constructor(client: TrndUpClient);
2549
+ /**
2550
+ * Initialize Facebook Page data sync
2551
+ * GET /v1/platforms/facebook/init
2552
+ *
2553
+ * Fetches page profile and recent posts, stores in database.
2554
+ * Call this when user first accesses Facebook dashboard.
2555
+ */
2556
+ init(): Promise<FacebookInitResponse>;
2557
+ /**
2558
+ * Get Facebook initialization status
2559
+ * GET /v1/platforms/facebook/status/init
2560
+ *
2561
+ * Check if Facebook is connected and if initial sync is done.
2562
+ */
2563
+ getInitStatus(): Promise<FacebookInitStatusResponse>;
2564
+ /**
2565
+ * Get Facebook Page profile
2566
+ * GET /v1/platforms/facebook/page
2567
+ *
2568
+ * Returns cached data if less than 1 hour old, else fetches fresh.
2569
+ */
2570
+ getPage(): Promise<FacebookPageResponse>;
2571
+ /**
2572
+ * Get account overview for dashboard
2573
+ * GET /v1/platforms/facebook/account/overview
2574
+ *
2575
+ * Returns page profile, aggregated stats, and top posts.
2576
+ * @param range Time range: '7d', '14d', '30d' (default '7d')
2577
+ */
2578
+ getAccountOverview(params?: {
2579
+ range?: string;
2580
+ }): Promise<FacebookAccountOverviewResponse>;
2581
+ /**
2582
+ * Get Facebook Page posts
2583
+ * GET /v1/platforms/facebook/posts
2584
+ *
2585
+ * @param options.limit Number of posts to return (default 20)
2586
+ * @param options.offset Offset for pagination (default 0)
2587
+ * @param options.sortBy Sort by field: 'createdTime', 'reactionsCount', 'commentsCount'
2588
+ * @param options.sortOrder Sort order: 'asc', 'desc'
2589
+ */
2590
+ getPosts(options?: {
2591
+ limit?: number;
2592
+ offset?: number;
2593
+ sortBy?: 'createdTime' | 'reactionsCount' | 'commentsCount';
2594
+ sortOrder?: 'asc' | 'desc';
2595
+ }): Promise<FacebookPostsResponse>;
2596
+ }
2597
+
2434
2598
  /**
2435
2599
  * TrndUp SDK - Social Module
2436
2600
  *
@@ -3165,6 +3329,7 @@ declare class TrndUpSDK extends TrndUpClient {
3165
3329
  auth: AuthModule;
3166
3330
  youtube: YouTubeModule;
3167
3331
  instagram: InstagramModule;
3332
+ facebook: FacebookModule;
3168
3333
  social: SocialModule;
3169
3334
  insights: InsightsModule;
3170
3335
  activity: ActivityModule;
package/dist/index.d.ts CHANGED
@@ -135,9 +135,10 @@ declare namespace Auth {
135
135
  */
136
136
  interface PlatformStatus {
137
137
  hasConnectedPlatforms: boolean;
138
- connectedPlatforms: Array<'youtube' | 'instagram'>;
138
+ connectedPlatforms: Array<'youtube' | 'instagram' | 'facebook'>;
139
139
  youtube: PlatformSyncInfo;
140
140
  instagram: PlatformSyncInfo;
141
+ facebook: PlatformSyncInfo;
141
142
  }
142
143
  interface LinkPhoneSendOTPRequest {
143
144
  phoneNumber: string;
@@ -2431,6 +2432,169 @@ declare class InstagramModule {
2431
2432
  sync(): Promise<Instagram.SyncResponse>;
2432
2433
  }
2433
2434
 
2435
+ /**
2436
+ * TrndUp SDK - Facebook Module
2437
+ *
2438
+ * Facebook Page analytics and data methods
2439
+ */
2440
+
2441
+ interface FacebookPageProfile {
2442
+ id: string;
2443
+ name: string;
2444
+ about?: string;
2445
+ category?: string;
2446
+ profilePictureUrl?: string;
2447
+ coverPhotoUrl?: string;
2448
+ followersCount?: number;
2449
+ fanCount?: number;
2450
+ website?: string;
2451
+ isVerified?: boolean;
2452
+ }
2453
+ interface FacebookPost {
2454
+ id: string;
2455
+ message?: string;
2456
+ story?: string;
2457
+ fullPicture?: string;
2458
+ permalinkUrl: string;
2459
+ reactionsCount: number;
2460
+ commentsCount: number;
2461
+ sharesCount: number;
2462
+ createdTime: string;
2463
+ postType?: string;
2464
+ statusType?: string;
2465
+ attachments?: Array<{
2466
+ type: string;
2467
+ title?: string;
2468
+ description?: string;
2469
+ imageUrl?: string;
2470
+ url?: string;
2471
+ }>;
2472
+ }
2473
+ interface FacebookStats {
2474
+ range: string;
2475
+ pageViews: number;
2476
+ pageImpressions: number;
2477
+ pageImpressionsUnique: number;
2478
+ pageEngagedUsers: number;
2479
+ pagePostEngagements: number;
2480
+ pageFanAdds: number;
2481
+ pageFanRemoves: number;
2482
+ netFanChange: number;
2483
+ }
2484
+ interface FacebookInitResponse {
2485
+ success: boolean;
2486
+ data?: {
2487
+ needsInit: boolean;
2488
+ message: string;
2489
+ page?: FacebookPageProfile;
2490
+ syncedPosts?: number;
2491
+ lastSyncedAt?: string;
2492
+ };
2493
+ error?: string;
2494
+ code?: string;
2495
+ }
2496
+ interface FacebookInitStatusResponse {
2497
+ success: boolean;
2498
+ data?: {
2499
+ connected: boolean;
2500
+ needsInit: boolean;
2501
+ isInitialSyncDone?: boolean;
2502
+ lastSyncedAt?: string;
2503
+ page?: {
2504
+ pageId: string;
2505
+ pageName?: string;
2506
+ profilePictureUrl?: string;
2507
+ followersCount?: number;
2508
+ fanCount?: number;
2509
+ };
2510
+ syncedPostsCount?: number;
2511
+ };
2512
+ error?: string;
2513
+ }
2514
+ interface FacebookPageResponse {
2515
+ success: boolean;
2516
+ data?: FacebookPageProfile & {
2517
+ cached?: boolean;
2518
+ cachedAt?: string;
2519
+ };
2520
+ error?: string;
2521
+ }
2522
+ interface FacebookAccountOverviewResponse {
2523
+ success: boolean;
2524
+ data?: {
2525
+ page: FacebookPageProfile;
2526
+ stats: FacebookStats;
2527
+ topPosts: FacebookPost[];
2528
+ syncedPostsCount: number;
2529
+ };
2530
+ error?: string;
2531
+ code?: string;
2532
+ }
2533
+ interface FacebookPostsResponse {
2534
+ success: boolean;
2535
+ data?: {
2536
+ posts: FacebookPost[];
2537
+ pagination: {
2538
+ limit: number;
2539
+ offset: number;
2540
+ total: number;
2541
+ hasMore: boolean;
2542
+ };
2543
+ };
2544
+ error?: string;
2545
+ }
2546
+ declare class FacebookModule {
2547
+ private client;
2548
+ constructor(client: TrndUpClient);
2549
+ /**
2550
+ * Initialize Facebook Page data sync
2551
+ * GET /v1/platforms/facebook/init
2552
+ *
2553
+ * Fetches page profile and recent posts, stores in database.
2554
+ * Call this when user first accesses Facebook dashboard.
2555
+ */
2556
+ init(): Promise<FacebookInitResponse>;
2557
+ /**
2558
+ * Get Facebook initialization status
2559
+ * GET /v1/platforms/facebook/status/init
2560
+ *
2561
+ * Check if Facebook is connected and if initial sync is done.
2562
+ */
2563
+ getInitStatus(): Promise<FacebookInitStatusResponse>;
2564
+ /**
2565
+ * Get Facebook Page profile
2566
+ * GET /v1/platforms/facebook/page
2567
+ *
2568
+ * Returns cached data if less than 1 hour old, else fetches fresh.
2569
+ */
2570
+ getPage(): Promise<FacebookPageResponse>;
2571
+ /**
2572
+ * Get account overview for dashboard
2573
+ * GET /v1/platforms/facebook/account/overview
2574
+ *
2575
+ * Returns page profile, aggregated stats, and top posts.
2576
+ * @param range Time range: '7d', '14d', '30d' (default '7d')
2577
+ */
2578
+ getAccountOverview(params?: {
2579
+ range?: string;
2580
+ }): Promise<FacebookAccountOverviewResponse>;
2581
+ /**
2582
+ * Get Facebook Page posts
2583
+ * GET /v1/platforms/facebook/posts
2584
+ *
2585
+ * @param options.limit Number of posts to return (default 20)
2586
+ * @param options.offset Offset for pagination (default 0)
2587
+ * @param options.sortBy Sort by field: 'createdTime', 'reactionsCount', 'commentsCount'
2588
+ * @param options.sortOrder Sort order: 'asc', 'desc'
2589
+ */
2590
+ getPosts(options?: {
2591
+ limit?: number;
2592
+ offset?: number;
2593
+ sortBy?: 'createdTime' | 'reactionsCount' | 'commentsCount';
2594
+ sortOrder?: 'asc' | 'desc';
2595
+ }): Promise<FacebookPostsResponse>;
2596
+ }
2597
+
2434
2598
  /**
2435
2599
  * TrndUp SDK - Social Module
2436
2600
  *
@@ -3165,6 +3329,7 @@ declare class TrndUpSDK extends TrndUpClient {
3165
3329
  auth: AuthModule;
3166
3330
  youtube: YouTubeModule;
3167
3331
  instagram: InstagramModule;
3332
+ facebook: FacebookModule;
3168
3333
  social: SocialModule;
3169
3334
  insights: InsightsModule;
3170
3335
  activity: ActivityModule;
package/dist/index.js CHANGED
@@ -777,6 +777,78 @@ var InstagramModule = class {
777
777
  }
778
778
  };
779
779
 
780
+ // modules/facebook.ts
781
+ var FacebookModule = class {
782
+ constructor(client) {
783
+ this.client = client;
784
+ }
785
+ // ===== INITIALIZATION =====
786
+ /**
787
+ * Initialize Facebook Page data sync
788
+ * GET /v1/platforms/facebook/init
789
+ *
790
+ * Fetches page profile and recent posts, stores in database.
791
+ * Call this when user first accesses Facebook dashboard.
792
+ */
793
+ async init() {
794
+ return this.client.get("/v1/platforms/facebook/init");
795
+ }
796
+ /**
797
+ * Get Facebook initialization status
798
+ * GET /v1/platforms/facebook/status/init
799
+ *
800
+ * Check if Facebook is connected and if initial sync is done.
801
+ */
802
+ async getInitStatus() {
803
+ return this.client.get("/v1/platforms/facebook/status/init");
804
+ }
805
+ // ===== PAGE PROFILE =====
806
+ /**
807
+ * Get Facebook Page profile
808
+ * GET /v1/platforms/facebook/page
809
+ *
810
+ * Returns cached data if less than 1 hour old, else fetches fresh.
811
+ */
812
+ async getPage() {
813
+ return this.client.get("/v1/platforms/facebook/page");
814
+ }
815
+ // ===== ACCOUNT OVERVIEW =====
816
+ /**
817
+ * Get account overview for dashboard
818
+ * GET /v1/platforms/facebook/account/overview
819
+ *
820
+ * Returns page profile, aggregated stats, and top posts.
821
+ * @param range Time range: '7d', '14d', '30d' (default '7d')
822
+ */
823
+ async getAccountOverview(params) {
824
+ const queryParams = params?.range ? `?range=${params.range}` : "";
825
+ return this.client.get(
826
+ `/v1/platforms/facebook/account/overview${queryParams}`
827
+ );
828
+ }
829
+ // ===== POSTS =====
830
+ /**
831
+ * Get Facebook Page posts
832
+ * GET /v1/platforms/facebook/posts
833
+ *
834
+ * @param options.limit Number of posts to return (default 20)
835
+ * @param options.offset Offset for pagination (default 0)
836
+ * @param options.sortBy Sort by field: 'createdTime', 'reactionsCount', 'commentsCount'
837
+ * @param options.sortOrder Sort order: 'asc', 'desc'
838
+ */
839
+ async getPosts(options) {
840
+ const params = new URLSearchParams();
841
+ if (options?.limit) params.append("limit", String(options.limit));
842
+ if (options?.offset) params.append("offset", String(options.offset));
843
+ if (options?.sortBy) params.append("sortBy", options.sortBy);
844
+ if (options?.sortOrder) params.append("sortOrder", options.sortOrder);
845
+ const queryString = params.toString();
846
+ return this.client.get(
847
+ `/v1/platforms/facebook/posts${queryString ? `?${queryString}` : ""}`
848
+ );
849
+ }
850
+ };
851
+
780
852
  // modules/social.ts
781
853
  var SocialModule = class {
782
854
  constructor(client) {
@@ -1653,6 +1725,7 @@ var TrndUpSDK = class extends TrndUpClient {
1653
1725
  this.auth = new AuthModule(this);
1654
1726
  this.youtube = new YouTubeModule(this);
1655
1727
  this.instagram = new InstagramModule(this);
1728
+ this.facebook = new FacebookModule(this);
1656
1729
  this.social = new SocialModule(this);
1657
1730
  this.insights = new InsightsModule(this);
1658
1731
  this.activity = new ActivityModule(this);