@dracoonghost/trndup-sdk 1.3.19 → 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");
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
+ );
447
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