@dracoonghost/trndup-sdk 1.3.18 → 1.3.20

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
@@ -262,6 +262,59 @@ var AuthModule = class {
262
262
  async getPlatformStatus() {
263
263
  return this.client.get("/user/platforms/status");
264
264
  }
265
+ // =========================================================================
266
+ // OAUTH FLOWS
267
+ // =========================================================================
268
+ /**
269
+ * Get Facebook OAuth URL for connecting Instagram Business accounts
270
+ * GET /auth/facebook
271
+ *
272
+ * After receiving the authUrl, redirect/open this URL in a browser.
273
+ * User will authenticate with Facebook and grant Instagram permissions.
274
+ * After completion, user is redirected to the specified redirect_uri.
275
+ *
276
+ * @param redirectUri - URL to redirect to after OAuth (your app's deep link)
277
+ * @returns OAuth authorization URL to redirect user to
278
+ */
279
+ async getFacebookOAuthUrl(redirectUri) {
280
+ const params = redirectUri ? { redirect_uri: redirectUri } : void 0;
281
+ return this.client.get("/auth/facebook", params);
282
+ }
283
+ /**
284
+ * Get Instagram OAuth URL for connecting Instagram Professional accounts
285
+ * GET /auth/instagram
286
+ *
287
+ * After receiving the authUrl, redirect/open this URL in a browser.
288
+ * User will authenticate with Instagram and grant permissions.
289
+ * After completion, user is redirected to the specified redirect_uri.
290
+ *
291
+ * @param redirectUri - URL to redirect to after OAuth (your app's deep link)
292
+ * @returns OAuth authorization URL to redirect user to
293
+ */
294
+ async getInstagramOAuthUrl(redirectUri) {
295
+ const params = redirectUri ? { redirect_uri: redirectUri } : void 0;
296
+ return this.client.get("/auth/instagram", params);
297
+ }
298
+ /**
299
+ * Build OAuth URL for Facebook (Instagram Business)
300
+ * Convenience method that returns just the URL string
301
+ *
302
+ * @param redirectUri - URL to redirect to after OAuth
303
+ */
304
+ async buildFacebookOAuthUrl(redirectUri) {
305
+ const response = await this.getFacebookOAuthUrl(redirectUri);
306
+ return response.authUrl;
307
+ }
308
+ /**
309
+ * Build OAuth URL for Instagram
310
+ * Convenience method that returns just the URL string
311
+ *
312
+ * @param redirectUri - URL to redirect to after OAuth
313
+ */
314
+ async buildInstagramOAuthUrl(redirectUri) {
315
+ const response = await this.getInstagramOAuthUrl(redirectUri);
316
+ return response.authUrl;
317
+ }
265
318
  };
266
319
 
267
320
  // modules/youtube.ts
@@ -431,20 +484,34 @@ var InstagramModule = class {
431
484
  constructor(client) {
432
485
  this.client = client;
433
486
  }
487
+ // ===== INITIALIZATION =====
434
488
  /**
435
489
  * Get Instagram initialization status
436
- * GET /v1/platforms/instagram/init/status
490
+ * GET /v1/platforms/instagram/status/init
437
491
  */
438
492
  async getInitStatus() {
439
- return this.client.get("/v1/platforms/instagram/init/status");
493
+ return this.client.get("/v1/platforms/instagram/status/init");
440
494
  }
441
495
  /**
442
496
  * Initialize Instagram data sync
443
- * POST /v1/platforms/instagram/init
497
+ * GET /v1/platforms/instagram/init
444
498
  */
445
499
  async initialize() {
446
- return this.client.post("/v1/platforms/instagram/init");
500
+ return this.client.get("/v1/platforms/instagram/init");
447
501
  }
502
+ // ===== ACCOUNT INSIGHTS =====
503
+ /**
504
+ * Get account-level insights
505
+ * GET /v1/platforms/instagram/account/insights
506
+ * @param range Time range: '7d', '14d', '28d', '30d'
507
+ */
508
+ async getAccountInsights(params) {
509
+ return this.client.get(
510
+ "/v1/platforms/instagram/account/insights",
511
+ params
512
+ );
513
+ }
514
+ // ===== MEDIA / POSTS =====
448
515
  /**
449
516
  * Get Instagram posts
450
517
  * GET /v1/platforms/instagram/posts
@@ -456,25 +523,42 @@ var InstagramModule = class {
456
523
  );
457
524
  }
458
525
  /**
459
- * Get specific post by ID
460
- * GET /v1/platforms/instagram/posts/:postId
526
+ * Get insights for a specific post
527
+ * GET /v1/platforms/instagram/posts/:postId/insights
528
+ */
529
+ async getPostInsights(postId) {
530
+ return this.client.get(
531
+ `/v1/platforms/instagram/posts/${postId}/insights`
532
+ );
533
+ }
534
+ // ===== STORIES =====
535
+ /**
536
+ * Get active stories
537
+ * GET /v1/platforms/instagram/stories
538
+ */
539
+ async getStories() {
540
+ return this.client.get("/v1/platforms/instagram/stories");
541
+ }
542
+ // ===== SYNC =====
543
+ /**
544
+ * Trigger manual data sync
545
+ * POST /v1/platforms/instagram/sync
461
546
  */
462
- async getPost(postId) {
463
- return this.client.get(`/v1/platforms/instagram/posts/${postId}`);
547
+ async sync() {
548
+ return this.client.post("/v1/platforms/instagram/sync");
464
549
  }
550
+ // ===== LEGACY (backward compat) =====
465
551
  /**
466
- * Get account metrics
467
- * GET /v1/platforms/instagram/account/metrics
552
+ * @deprecated Use getAccountInsights instead
468
553
  */
469
554
  async getAccountMetrics() {
470
- return this.client.get("/v1/platforms/instagram/account/metrics");
555
+ return this.getAccountInsights();
471
556
  }
472
557
  /**
473
- * Refresh Instagram data
474
- * POST /v1/platforms/instagram/refresh
558
+ * @deprecated Use sync instead
475
559
  */
476
560
  async refresh() {
477
- return this.client.post("/v1/platforms/instagram/refresh");
561
+ return this.sync();
478
562
  }
479
563
  };
480
564
 
@@ -857,6 +941,47 @@ var InsightsModule = class {
857
941
  );
858
942
  }
859
943
  // =========================================================================
944
+ // YOUTUBE UPLOAD CONSISTENCY
945
+ // =========================================================================
946
+ /**
947
+ * Analyze your upload schedule consistency
948
+ *
949
+ * Measures how regularly you upload and provides recommendations
950
+ * for maintaining a consistent schedule that helps algorithm performance.
951
+ *
952
+ * @example
953
+ * ```typescript
954
+ * const result = await client.insights.getYouTubeUploadConsistency();
955
+ *
956
+ * if (result.hasData) {
957
+ * console.log(`Consistency Score: ${result.data.consistencyScore}/100`);
958
+ * console.log(`Status: ${result.data.status}`);
959
+ * console.log(`Avg gap: ${result.data.metrics.avgDaysBetweenUploads} days`);
960
+ * console.log(`Days since last upload: ${result.data.metrics.daysSinceLastUpload}`);
961
+ *
962
+ * // Pattern analysis
963
+ * console.log(`Pattern: ${result.data.pattern.typicalGap}`);
964
+ * console.log(`Trend: ${result.data.pattern.trendDescription}`);
965
+ *
966
+ * // Recommendation
967
+ * console.log(`Current: ${result.data.recommendation.current}`);
968
+ * console.log(`Suggested: ${result.data.recommendation.suggested}`);
969
+ *
970
+ * // Monthly breakdown
971
+ * for (const month of result.data.monthlyBreakdown) {
972
+ * console.log(`${month.month}: ${month.uploads} uploads`);
973
+ * }
974
+ * }
975
+ * ```
976
+ *
977
+ * GET /v1/insights/youtube/upload-consistency
978
+ */
979
+ async getYouTubeUploadConsistency() {
980
+ return this.client.get(
981
+ "/v1/insights/youtube/upload-consistency"
982
+ );
983
+ }
984
+ // =========================================================================
860
985
  // YOUTUBE ALL INSIGHTS
861
986
  // =========================================================================
862
987
  /**
@@ -881,8 +1006,8 @@ var InsightsModule = class {
881
1006
  * console.log(`Fatigue: ${all.data.audienceFatigue.data.fatigueLevel}`);
882
1007
  * }
883
1008
  *
884
- * if (all.data.optimalLength.hasData) {
885
- * console.log(`Optimal Length: ${all.data.optimalLength.data.optimalLength.bucket}`);
1009
+ * if (all.data.uploadConsistency.hasData) {
1010
+ * console.log(`Consistency: ${all.data.uploadConsistency.data.consistencyScore}/100`);
886
1011
  * }
887
1012
  * ```
888
1013
  *