@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.d.mts +168 -29
- package/dist/index.d.ts +168 -29
- package/dist/index.js +98 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -86,6 +86,22 @@ declare namespace Auth {
|
|
|
86
86
|
interface UpdateProfileResponse {
|
|
87
87
|
user: User;
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Response from OAuth URL request
|
|
91
|
+
*/
|
|
92
|
+
interface OAuthUrlResponse {
|
|
93
|
+
/** URL to redirect user to for OAuth consent */
|
|
94
|
+
authUrl: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* OAuth callback result (returned in redirect URL params)
|
|
98
|
+
*/
|
|
99
|
+
interface OAuthCallbackResult {
|
|
100
|
+
success: boolean;
|
|
101
|
+
provider: 'facebook' | 'instagram';
|
|
102
|
+
message?: string;
|
|
103
|
+
error?: string;
|
|
104
|
+
}
|
|
89
105
|
/**
|
|
90
106
|
* Status for a single sync step
|
|
91
107
|
*/
|
|
@@ -432,38 +448,113 @@ declare namespace YouTube {
|
|
|
432
448
|
}
|
|
433
449
|
declare namespace Instagram {
|
|
434
450
|
interface InitStatusResponse {
|
|
451
|
+
connected: boolean;
|
|
452
|
+
needsInit: boolean;
|
|
453
|
+
isInitialSyncDone?: boolean;
|
|
454
|
+
lastSyncedAt?: string | null;
|
|
455
|
+
authMethod?: 'facebook' | 'instagram';
|
|
456
|
+
account?: {
|
|
457
|
+
username?: string;
|
|
458
|
+
name?: string;
|
|
459
|
+
profilePictureUrl?: string;
|
|
460
|
+
followersCount?: number;
|
|
461
|
+
mediaCount?: number;
|
|
462
|
+
} | null;
|
|
463
|
+
syncedMediaCount?: number;
|
|
464
|
+
message?: string;
|
|
465
|
+
}
|
|
466
|
+
interface InitResponse {
|
|
435
467
|
needsInit: boolean;
|
|
436
468
|
message: string;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
469
|
+
profile?: {
|
|
470
|
+
username?: string;
|
|
471
|
+
name?: string;
|
|
472
|
+
profilePictureUrl?: string;
|
|
473
|
+
followersCount?: number;
|
|
474
|
+
mediaCount?: number;
|
|
475
|
+
};
|
|
476
|
+
syncedMedia?: number;
|
|
477
|
+
lastSyncedAt?: string;
|
|
478
|
+
}
|
|
479
|
+
interface GetAccountInsightsParams {
|
|
480
|
+
range?: '7d' | '14d' | '28d' | '30d';
|
|
481
|
+
}
|
|
482
|
+
interface AccountInsightsResponse {
|
|
483
|
+
range: string;
|
|
484
|
+
aggregated: Record<string, number>;
|
|
485
|
+
timeSeries: Record<string, Array<{
|
|
486
|
+
date: string;
|
|
487
|
+
value: number;
|
|
488
|
+
}>>;
|
|
440
489
|
}
|
|
441
490
|
interface Post {
|
|
442
491
|
id: string;
|
|
492
|
+
media_id: string;
|
|
443
493
|
caption?: string;
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
494
|
+
media_type: 'IMAGE' | 'VIDEO' | 'CAROUSEL_ALBUM' | 'REELS';
|
|
495
|
+
media_url?: string;
|
|
496
|
+
thumbnail_url?: string;
|
|
497
|
+
permalink?: string;
|
|
447
498
|
timestamp: string;
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
engagementRate?: number;
|
|
499
|
+
like_count?: number;
|
|
500
|
+
comments_count?: number;
|
|
451
501
|
}
|
|
452
502
|
interface GetPostsParams {
|
|
453
503
|
limit?: number;
|
|
454
504
|
offset?: number;
|
|
505
|
+
mediaType?: string;
|
|
506
|
+
sortBy?: 'timestamp' | 'like_count' | 'comments_count';
|
|
507
|
+
sortOrder?: 'asc' | 'desc';
|
|
455
508
|
}
|
|
456
509
|
interface GetPostsResponse {
|
|
457
510
|
posts: Post[];
|
|
458
|
-
|
|
459
|
-
|
|
511
|
+
pagination: {
|
|
512
|
+
limit: number;
|
|
513
|
+
offset: number;
|
|
514
|
+
total: number;
|
|
515
|
+
hasMore: boolean;
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
interface PostInsightsResponse {
|
|
519
|
+
postId: string;
|
|
520
|
+
mediaType: string;
|
|
521
|
+
insights: {
|
|
522
|
+
data: Array<{
|
|
523
|
+
name: string;
|
|
524
|
+
title: string;
|
|
525
|
+
values: Array<{
|
|
526
|
+
value: number;
|
|
527
|
+
}>;
|
|
528
|
+
}>;
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
interface Story {
|
|
532
|
+
id: string;
|
|
533
|
+
media_type: 'IMAGE' | 'VIDEO';
|
|
534
|
+
media_url?: string;
|
|
535
|
+
timestamp: string;
|
|
536
|
+
permalink?: string;
|
|
537
|
+
}
|
|
538
|
+
interface StoriesResponse {
|
|
539
|
+
stories: Story[];
|
|
540
|
+
count: number;
|
|
541
|
+
}
|
|
542
|
+
interface SyncResponse {
|
|
543
|
+
message: string;
|
|
544
|
+
profile?: {
|
|
545
|
+
username?: string;
|
|
546
|
+
followersCount?: number;
|
|
547
|
+
mediaCount?: number;
|
|
548
|
+
};
|
|
549
|
+
syncedMedia?: number;
|
|
460
550
|
}
|
|
551
|
+
/** @deprecated Use InitStatusResponse */
|
|
461
552
|
interface AccountMetrics {
|
|
462
553
|
followersCount: number;
|
|
463
554
|
followsCount: number;
|
|
464
555
|
mediaCount: number;
|
|
465
|
-
averageLikes
|
|
466
|
-
engagementRate
|
|
556
|
+
averageLikes?: number;
|
|
557
|
+
engagementRate?: number;
|
|
467
558
|
}
|
|
468
559
|
}
|
|
469
560
|
declare namespace Insights {
|
|
@@ -1343,6 +1434,44 @@ declare class AuthModule {
|
|
|
1343
1434
|
* GET /user/platforms/status
|
|
1344
1435
|
*/
|
|
1345
1436
|
getPlatformStatus(): Promise<Auth.PlatformStatus>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Get Facebook OAuth URL for connecting Instagram Business accounts
|
|
1439
|
+
* GET /auth/facebook
|
|
1440
|
+
*
|
|
1441
|
+
* After receiving the authUrl, redirect/open this URL in a browser.
|
|
1442
|
+
* User will authenticate with Facebook and grant Instagram permissions.
|
|
1443
|
+
* After completion, user is redirected to the specified redirect_uri.
|
|
1444
|
+
*
|
|
1445
|
+
* @param redirectUri - URL to redirect to after OAuth (your app's deep link)
|
|
1446
|
+
* @returns OAuth authorization URL to redirect user to
|
|
1447
|
+
*/
|
|
1448
|
+
getFacebookOAuthUrl(redirectUri?: string): Promise<Auth.OAuthUrlResponse>;
|
|
1449
|
+
/**
|
|
1450
|
+
* Get Instagram OAuth URL for connecting Instagram Professional accounts
|
|
1451
|
+
* GET /auth/instagram
|
|
1452
|
+
*
|
|
1453
|
+
* After receiving the authUrl, redirect/open this URL in a browser.
|
|
1454
|
+
* User will authenticate with Instagram and grant permissions.
|
|
1455
|
+
* After completion, user is redirected to the specified redirect_uri.
|
|
1456
|
+
*
|
|
1457
|
+
* @param redirectUri - URL to redirect to after OAuth (your app's deep link)
|
|
1458
|
+
* @returns OAuth authorization URL to redirect user to
|
|
1459
|
+
*/
|
|
1460
|
+
getInstagramOAuthUrl(redirectUri?: string): Promise<Auth.OAuthUrlResponse>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Build OAuth URL for Facebook (Instagram Business)
|
|
1463
|
+
* Convenience method that returns just the URL string
|
|
1464
|
+
*
|
|
1465
|
+
* @param redirectUri - URL to redirect to after OAuth
|
|
1466
|
+
*/
|
|
1467
|
+
buildFacebookOAuthUrl(redirectUri?: string): Promise<string>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Build OAuth URL for Instagram
|
|
1470
|
+
* Convenience method that returns just the URL string
|
|
1471
|
+
*
|
|
1472
|
+
* @param redirectUri - URL to redirect to after OAuth
|
|
1473
|
+
*/
|
|
1474
|
+
buildInstagramOAuthUrl(redirectUri?: string): Promise<string>;
|
|
1346
1475
|
}
|
|
1347
1476
|
|
|
1348
1477
|
/**
|
|
@@ -1472,38 +1601,48 @@ declare class InstagramModule {
|
|
|
1472
1601
|
constructor(client: TrndUpClient);
|
|
1473
1602
|
/**
|
|
1474
1603
|
* Get Instagram initialization status
|
|
1475
|
-
* GET /v1/platforms/instagram/init
|
|
1604
|
+
* GET /v1/platforms/instagram/status/init
|
|
1476
1605
|
*/
|
|
1477
1606
|
getInitStatus(): Promise<Instagram.InitStatusResponse>;
|
|
1478
1607
|
/**
|
|
1479
1608
|
* Initialize Instagram data sync
|
|
1480
|
-
*
|
|
1609
|
+
* GET /v1/platforms/instagram/init
|
|
1481
1610
|
*/
|
|
1482
|
-
initialize(): Promise<
|
|
1483
|
-
|
|
1484
|
-
|
|
1611
|
+
initialize(): Promise<Instagram.InitResponse>;
|
|
1612
|
+
/**
|
|
1613
|
+
* Get account-level insights
|
|
1614
|
+
* GET /v1/platforms/instagram/account/insights
|
|
1615
|
+
* @param range Time range: '7d', '14d', '28d', '30d'
|
|
1616
|
+
*/
|
|
1617
|
+
getAccountInsights(params?: Instagram.GetAccountInsightsParams): Promise<Instagram.AccountInsightsResponse>;
|
|
1485
1618
|
/**
|
|
1486
1619
|
* Get Instagram posts
|
|
1487
1620
|
* GET /v1/platforms/instagram/posts
|
|
1488
1621
|
*/
|
|
1489
1622
|
getPosts(params?: Instagram.GetPostsParams): Promise<Instagram.GetPostsResponse>;
|
|
1490
1623
|
/**
|
|
1491
|
-
* Get specific post
|
|
1492
|
-
* GET /v1/platforms/instagram/posts/:postId
|
|
1624
|
+
* Get insights for a specific post
|
|
1625
|
+
* GET /v1/platforms/instagram/posts/:postId/insights
|
|
1493
1626
|
*/
|
|
1494
|
-
|
|
1627
|
+
getPostInsights(postId: string): Promise<Instagram.PostInsightsResponse>;
|
|
1495
1628
|
/**
|
|
1496
|
-
* Get
|
|
1497
|
-
* GET /v1/platforms/instagram/
|
|
1629
|
+
* Get active stories
|
|
1630
|
+
* GET /v1/platforms/instagram/stories
|
|
1498
1631
|
*/
|
|
1499
|
-
|
|
1632
|
+
getStories(): Promise<Instagram.StoriesResponse>;
|
|
1500
1633
|
/**
|
|
1501
|
-
*
|
|
1502
|
-
* POST /v1/platforms/instagram/
|
|
1634
|
+
* Trigger manual data sync
|
|
1635
|
+
* POST /v1/platforms/instagram/sync
|
|
1503
1636
|
*/
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1637
|
+
sync(): Promise<Instagram.SyncResponse>;
|
|
1638
|
+
/**
|
|
1639
|
+
* @deprecated Use getAccountInsights instead
|
|
1640
|
+
*/
|
|
1641
|
+
getAccountMetrics(): Promise<Instagram.AccountInsightsResponse>;
|
|
1642
|
+
/**
|
|
1643
|
+
* @deprecated Use sync instead
|
|
1644
|
+
*/
|
|
1645
|
+
refresh(): Promise<Instagram.SyncResponse>;
|
|
1507
1646
|
}
|
|
1508
1647
|
|
|
1509
1648
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -86,6 +86,22 @@ declare namespace Auth {
|
|
|
86
86
|
interface UpdateProfileResponse {
|
|
87
87
|
user: User;
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Response from OAuth URL request
|
|
91
|
+
*/
|
|
92
|
+
interface OAuthUrlResponse {
|
|
93
|
+
/** URL to redirect user to for OAuth consent */
|
|
94
|
+
authUrl: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* OAuth callback result (returned in redirect URL params)
|
|
98
|
+
*/
|
|
99
|
+
interface OAuthCallbackResult {
|
|
100
|
+
success: boolean;
|
|
101
|
+
provider: 'facebook' | 'instagram';
|
|
102
|
+
message?: string;
|
|
103
|
+
error?: string;
|
|
104
|
+
}
|
|
89
105
|
/**
|
|
90
106
|
* Status for a single sync step
|
|
91
107
|
*/
|
|
@@ -432,38 +448,113 @@ declare namespace YouTube {
|
|
|
432
448
|
}
|
|
433
449
|
declare namespace Instagram {
|
|
434
450
|
interface InitStatusResponse {
|
|
451
|
+
connected: boolean;
|
|
452
|
+
needsInit: boolean;
|
|
453
|
+
isInitialSyncDone?: boolean;
|
|
454
|
+
lastSyncedAt?: string | null;
|
|
455
|
+
authMethod?: 'facebook' | 'instagram';
|
|
456
|
+
account?: {
|
|
457
|
+
username?: string;
|
|
458
|
+
name?: string;
|
|
459
|
+
profilePictureUrl?: string;
|
|
460
|
+
followersCount?: number;
|
|
461
|
+
mediaCount?: number;
|
|
462
|
+
} | null;
|
|
463
|
+
syncedMediaCount?: number;
|
|
464
|
+
message?: string;
|
|
465
|
+
}
|
|
466
|
+
interface InitResponse {
|
|
435
467
|
needsInit: boolean;
|
|
436
468
|
message: string;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
469
|
+
profile?: {
|
|
470
|
+
username?: string;
|
|
471
|
+
name?: string;
|
|
472
|
+
profilePictureUrl?: string;
|
|
473
|
+
followersCount?: number;
|
|
474
|
+
mediaCount?: number;
|
|
475
|
+
};
|
|
476
|
+
syncedMedia?: number;
|
|
477
|
+
lastSyncedAt?: string;
|
|
478
|
+
}
|
|
479
|
+
interface GetAccountInsightsParams {
|
|
480
|
+
range?: '7d' | '14d' | '28d' | '30d';
|
|
481
|
+
}
|
|
482
|
+
interface AccountInsightsResponse {
|
|
483
|
+
range: string;
|
|
484
|
+
aggregated: Record<string, number>;
|
|
485
|
+
timeSeries: Record<string, Array<{
|
|
486
|
+
date: string;
|
|
487
|
+
value: number;
|
|
488
|
+
}>>;
|
|
440
489
|
}
|
|
441
490
|
interface Post {
|
|
442
491
|
id: string;
|
|
492
|
+
media_id: string;
|
|
443
493
|
caption?: string;
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
494
|
+
media_type: 'IMAGE' | 'VIDEO' | 'CAROUSEL_ALBUM' | 'REELS';
|
|
495
|
+
media_url?: string;
|
|
496
|
+
thumbnail_url?: string;
|
|
497
|
+
permalink?: string;
|
|
447
498
|
timestamp: string;
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
engagementRate?: number;
|
|
499
|
+
like_count?: number;
|
|
500
|
+
comments_count?: number;
|
|
451
501
|
}
|
|
452
502
|
interface GetPostsParams {
|
|
453
503
|
limit?: number;
|
|
454
504
|
offset?: number;
|
|
505
|
+
mediaType?: string;
|
|
506
|
+
sortBy?: 'timestamp' | 'like_count' | 'comments_count';
|
|
507
|
+
sortOrder?: 'asc' | 'desc';
|
|
455
508
|
}
|
|
456
509
|
interface GetPostsResponse {
|
|
457
510
|
posts: Post[];
|
|
458
|
-
|
|
459
|
-
|
|
511
|
+
pagination: {
|
|
512
|
+
limit: number;
|
|
513
|
+
offset: number;
|
|
514
|
+
total: number;
|
|
515
|
+
hasMore: boolean;
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
interface PostInsightsResponse {
|
|
519
|
+
postId: string;
|
|
520
|
+
mediaType: string;
|
|
521
|
+
insights: {
|
|
522
|
+
data: Array<{
|
|
523
|
+
name: string;
|
|
524
|
+
title: string;
|
|
525
|
+
values: Array<{
|
|
526
|
+
value: number;
|
|
527
|
+
}>;
|
|
528
|
+
}>;
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
interface Story {
|
|
532
|
+
id: string;
|
|
533
|
+
media_type: 'IMAGE' | 'VIDEO';
|
|
534
|
+
media_url?: string;
|
|
535
|
+
timestamp: string;
|
|
536
|
+
permalink?: string;
|
|
537
|
+
}
|
|
538
|
+
interface StoriesResponse {
|
|
539
|
+
stories: Story[];
|
|
540
|
+
count: number;
|
|
541
|
+
}
|
|
542
|
+
interface SyncResponse {
|
|
543
|
+
message: string;
|
|
544
|
+
profile?: {
|
|
545
|
+
username?: string;
|
|
546
|
+
followersCount?: number;
|
|
547
|
+
mediaCount?: number;
|
|
548
|
+
};
|
|
549
|
+
syncedMedia?: number;
|
|
460
550
|
}
|
|
551
|
+
/** @deprecated Use InitStatusResponse */
|
|
461
552
|
interface AccountMetrics {
|
|
462
553
|
followersCount: number;
|
|
463
554
|
followsCount: number;
|
|
464
555
|
mediaCount: number;
|
|
465
|
-
averageLikes
|
|
466
|
-
engagementRate
|
|
556
|
+
averageLikes?: number;
|
|
557
|
+
engagementRate?: number;
|
|
467
558
|
}
|
|
468
559
|
}
|
|
469
560
|
declare namespace Insights {
|
|
@@ -1343,6 +1434,44 @@ declare class AuthModule {
|
|
|
1343
1434
|
* GET /user/platforms/status
|
|
1344
1435
|
*/
|
|
1345
1436
|
getPlatformStatus(): Promise<Auth.PlatformStatus>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Get Facebook OAuth URL for connecting Instagram Business accounts
|
|
1439
|
+
* GET /auth/facebook
|
|
1440
|
+
*
|
|
1441
|
+
* After receiving the authUrl, redirect/open this URL in a browser.
|
|
1442
|
+
* User will authenticate with Facebook and grant Instagram permissions.
|
|
1443
|
+
* After completion, user is redirected to the specified redirect_uri.
|
|
1444
|
+
*
|
|
1445
|
+
* @param redirectUri - URL to redirect to after OAuth (your app's deep link)
|
|
1446
|
+
* @returns OAuth authorization URL to redirect user to
|
|
1447
|
+
*/
|
|
1448
|
+
getFacebookOAuthUrl(redirectUri?: string): Promise<Auth.OAuthUrlResponse>;
|
|
1449
|
+
/**
|
|
1450
|
+
* Get Instagram OAuth URL for connecting Instagram Professional accounts
|
|
1451
|
+
* GET /auth/instagram
|
|
1452
|
+
*
|
|
1453
|
+
* After receiving the authUrl, redirect/open this URL in a browser.
|
|
1454
|
+
* User will authenticate with Instagram and grant permissions.
|
|
1455
|
+
* After completion, user is redirected to the specified redirect_uri.
|
|
1456
|
+
*
|
|
1457
|
+
* @param redirectUri - URL to redirect to after OAuth (your app's deep link)
|
|
1458
|
+
* @returns OAuth authorization URL to redirect user to
|
|
1459
|
+
*/
|
|
1460
|
+
getInstagramOAuthUrl(redirectUri?: string): Promise<Auth.OAuthUrlResponse>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Build OAuth URL for Facebook (Instagram Business)
|
|
1463
|
+
* Convenience method that returns just the URL string
|
|
1464
|
+
*
|
|
1465
|
+
* @param redirectUri - URL to redirect to after OAuth
|
|
1466
|
+
*/
|
|
1467
|
+
buildFacebookOAuthUrl(redirectUri?: string): Promise<string>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Build OAuth URL for Instagram
|
|
1470
|
+
* Convenience method that returns just the URL string
|
|
1471
|
+
*
|
|
1472
|
+
* @param redirectUri - URL to redirect to after OAuth
|
|
1473
|
+
*/
|
|
1474
|
+
buildInstagramOAuthUrl(redirectUri?: string): Promise<string>;
|
|
1346
1475
|
}
|
|
1347
1476
|
|
|
1348
1477
|
/**
|
|
@@ -1472,38 +1601,48 @@ declare class InstagramModule {
|
|
|
1472
1601
|
constructor(client: TrndUpClient);
|
|
1473
1602
|
/**
|
|
1474
1603
|
* Get Instagram initialization status
|
|
1475
|
-
* GET /v1/platforms/instagram/init
|
|
1604
|
+
* GET /v1/platforms/instagram/status/init
|
|
1476
1605
|
*/
|
|
1477
1606
|
getInitStatus(): Promise<Instagram.InitStatusResponse>;
|
|
1478
1607
|
/**
|
|
1479
1608
|
* Initialize Instagram data sync
|
|
1480
|
-
*
|
|
1609
|
+
* GET /v1/platforms/instagram/init
|
|
1481
1610
|
*/
|
|
1482
|
-
initialize(): Promise<
|
|
1483
|
-
|
|
1484
|
-
|
|
1611
|
+
initialize(): Promise<Instagram.InitResponse>;
|
|
1612
|
+
/**
|
|
1613
|
+
* Get account-level insights
|
|
1614
|
+
* GET /v1/platforms/instagram/account/insights
|
|
1615
|
+
* @param range Time range: '7d', '14d', '28d', '30d'
|
|
1616
|
+
*/
|
|
1617
|
+
getAccountInsights(params?: Instagram.GetAccountInsightsParams): Promise<Instagram.AccountInsightsResponse>;
|
|
1485
1618
|
/**
|
|
1486
1619
|
* Get Instagram posts
|
|
1487
1620
|
* GET /v1/platforms/instagram/posts
|
|
1488
1621
|
*/
|
|
1489
1622
|
getPosts(params?: Instagram.GetPostsParams): Promise<Instagram.GetPostsResponse>;
|
|
1490
1623
|
/**
|
|
1491
|
-
* Get specific post
|
|
1492
|
-
* GET /v1/platforms/instagram/posts/:postId
|
|
1624
|
+
* Get insights for a specific post
|
|
1625
|
+
* GET /v1/platforms/instagram/posts/:postId/insights
|
|
1493
1626
|
*/
|
|
1494
|
-
|
|
1627
|
+
getPostInsights(postId: string): Promise<Instagram.PostInsightsResponse>;
|
|
1495
1628
|
/**
|
|
1496
|
-
* Get
|
|
1497
|
-
* GET /v1/platforms/instagram/
|
|
1629
|
+
* Get active stories
|
|
1630
|
+
* GET /v1/platforms/instagram/stories
|
|
1498
1631
|
*/
|
|
1499
|
-
|
|
1632
|
+
getStories(): Promise<Instagram.StoriesResponse>;
|
|
1500
1633
|
/**
|
|
1501
|
-
*
|
|
1502
|
-
* POST /v1/platforms/instagram/
|
|
1634
|
+
* Trigger manual data sync
|
|
1635
|
+
* POST /v1/platforms/instagram/sync
|
|
1503
1636
|
*/
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1637
|
+
sync(): Promise<Instagram.SyncResponse>;
|
|
1638
|
+
/**
|
|
1639
|
+
* @deprecated Use getAccountInsights instead
|
|
1640
|
+
*/
|
|
1641
|
+
getAccountMetrics(): Promise<Instagram.AccountInsightsResponse>;
|
|
1642
|
+
/**
|
|
1643
|
+
* @deprecated Use sync instead
|
|
1644
|
+
*/
|
|
1645
|
+
refresh(): Promise<Instagram.SyncResponse>;
|
|
1507
1646
|
}
|
|
1508
1647
|
|
|
1509
1648
|
/**
|
package/dist/index.js
CHANGED
|
@@ -264,6 +264,59 @@ var AuthModule = class {
|
|
|
264
264
|
async getPlatformStatus() {
|
|
265
265
|
return this.client.get("/user/platforms/status");
|
|
266
266
|
}
|
|
267
|
+
// =========================================================================
|
|
268
|
+
// OAUTH FLOWS
|
|
269
|
+
// =========================================================================
|
|
270
|
+
/**
|
|
271
|
+
* Get Facebook OAuth URL for connecting Instagram Business accounts
|
|
272
|
+
* GET /auth/facebook
|
|
273
|
+
*
|
|
274
|
+
* After receiving the authUrl, redirect/open this URL in a browser.
|
|
275
|
+
* User will authenticate with Facebook and grant Instagram permissions.
|
|
276
|
+
* After completion, user is redirected to the specified redirect_uri.
|
|
277
|
+
*
|
|
278
|
+
* @param redirectUri - URL to redirect to after OAuth (your app's deep link)
|
|
279
|
+
* @returns OAuth authorization URL to redirect user to
|
|
280
|
+
*/
|
|
281
|
+
async getFacebookOAuthUrl(redirectUri) {
|
|
282
|
+
const params = redirectUri ? { redirect_uri: redirectUri } : void 0;
|
|
283
|
+
return this.client.get("/auth/facebook", params);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get Instagram OAuth URL for connecting Instagram Professional accounts
|
|
287
|
+
* GET /auth/instagram
|
|
288
|
+
*
|
|
289
|
+
* After receiving the authUrl, redirect/open this URL in a browser.
|
|
290
|
+
* User will authenticate with Instagram and grant permissions.
|
|
291
|
+
* After completion, user is redirected to the specified redirect_uri.
|
|
292
|
+
*
|
|
293
|
+
* @param redirectUri - URL to redirect to after OAuth (your app's deep link)
|
|
294
|
+
* @returns OAuth authorization URL to redirect user to
|
|
295
|
+
*/
|
|
296
|
+
async getInstagramOAuthUrl(redirectUri) {
|
|
297
|
+
const params = redirectUri ? { redirect_uri: redirectUri } : void 0;
|
|
298
|
+
return this.client.get("/auth/instagram", params);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Build OAuth URL for Facebook (Instagram Business)
|
|
302
|
+
* Convenience method that returns just the URL string
|
|
303
|
+
*
|
|
304
|
+
* @param redirectUri - URL to redirect to after OAuth
|
|
305
|
+
*/
|
|
306
|
+
async buildFacebookOAuthUrl(redirectUri) {
|
|
307
|
+
const response = await this.getFacebookOAuthUrl(redirectUri);
|
|
308
|
+
return response.authUrl;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Build OAuth URL for Instagram
|
|
312
|
+
* Convenience method that returns just the URL string
|
|
313
|
+
*
|
|
314
|
+
* @param redirectUri - URL to redirect to after OAuth
|
|
315
|
+
*/
|
|
316
|
+
async buildInstagramOAuthUrl(redirectUri) {
|
|
317
|
+
const response = await this.getInstagramOAuthUrl(redirectUri);
|
|
318
|
+
return response.authUrl;
|
|
319
|
+
}
|
|
267
320
|
};
|
|
268
321
|
|
|
269
322
|
// modules/youtube.ts
|
|
@@ -433,20 +486,34 @@ var InstagramModule = class {
|
|
|
433
486
|
constructor(client) {
|
|
434
487
|
this.client = client;
|
|
435
488
|
}
|
|
489
|
+
// ===== INITIALIZATION =====
|
|
436
490
|
/**
|
|
437
491
|
* Get Instagram initialization status
|
|
438
|
-
* GET /v1/platforms/instagram/init
|
|
492
|
+
* GET /v1/platforms/instagram/status/init
|
|
439
493
|
*/
|
|
440
494
|
async getInitStatus() {
|
|
441
|
-
return this.client.get("/v1/platforms/instagram/init
|
|
495
|
+
return this.client.get("/v1/platforms/instagram/status/init");
|
|
442
496
|
}
|
|
443
497
|
/**
|
|
444
498
|
* Initialize Instagram data sync
|
|
445
|
-
*
|
|
499
|
+
* GET /v1/platforms/instagram/init
|
|
446
500
|
*/
|
|
447
501
|
async initialize() {
|
|
448
|
-
return this.client.
|
|
502
|
+
return this.client.get("/v1/platforms/instagram/init");
|
|
503
|
+
}
|
|
504
|
+
// ===== ACCOUNT INSIGHTS =====
|
|
505
|
+
/**
|
|
506
|
+
* Get account-level insights
|
|
507
|
+
* GET /v1/platforms/instagram/account/insights
|
|
508
|
+
* @param range Time range: '7d', '14d', '28d', '30d'
|
|
509
|
+
*/
|
|
510
|
+
async getAccountInsights(params) {
|
|
511
|
+
return this.client.get(
|
|
512
|
+
"/v1/platforms/instagram/account/insights",
|
|
513
|
+
params
|
|
514
|
+
);
|
|
449
515
|
}
|
|
516
|
+
// ===== MEDIA / POSTS =====
|
|
450
517
|
/**
|
|
451
518
|
* Get Instagram posts
|
|
452
519
|
* GET /v1/platforms/instagram/posts
|
|
@@ -458,25 +525,42 @@ var InstagramModule = class {
|
|
|
458
525
|
);
|
|
459
526
|
}
|
|
460
527
|
/**
|
|
461
|
-
* Get specific post
|
|
462
|
-
* GET /v1/platforms/instagram/posts/:postId
|
|
528
|
+
* Get insights for a specific post
|
|
529
|
+
* GET /v1/platforms/instagram/posts/:postId/insights
|
|
530
|
+
*/
|
|
531
|
+
async getPostInsights(postId) {
|
|
532
|
+
return this.client.get(
|
|
533
|
+
`/v1/platforms/instagram/posts/${postId}/insights`
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
// ===== STORIES =====
|
|
537
|
+
/**
|
|
538
|
+
* Get active stories
|
|
539
|
+
* GET /v1/platforms/instagram/stories
|
|
540
|
+
*/
|
|
541
|
+
async getStories() {
|
|
542
|
+
return this.client.get("/v1/platforms/instagram/stories");
|
|
543
|
+
}
|
|
544
|
+
// ===== SYNC =====
|
|
545
|
+
/**
|
|
546
|
+
* Trigger manual data sync
|
|
547
|
+
* POST /v1/platforms/instagram/sync
|
|
463
548
|
*/
|
|
464
|
-
async
|
|
465
|
-
return this.client.
|
|
549
|
+
async sync() {
|
|
550
|
+
return this.client.post("/v1/platforms/instagram/sync");
|
|
466
551
|
}
|
|
552
|
+
// ===== LEGACY (backward compat) =====
|
|
467
553
|
/**
|
|
468
|
-
*
|
|
469
|
-
* GET /v1/platforms/instagram/account/metrics
|
|
554
|
+
* @deprecated Use getAccountInsights instead
|
|
470
555
|
*/
|
|
471
556
|
async getAccountMetrics() {
|
|
472
|
-
return this.
|
|
557
|
+
return this.getAccountInsights();
|
|
473
558
|
}
|
|
474
559
|
/**
|
|
475
|
-
*
|
|
476
|
-
* POST /v1/platforms/instagram/refresh
|
|
560
|
+
* @deprecated Use sync instead
|
|
477
561
|
*/
|
|
478
562
|
async refresh() {
|
|
479
|
-
return this.
|
|
563
|
+
return this.sync();
|
|
480
564
|
}
|
|
481
565
|
};
|
|
482
566
|
|