@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.d.mts +260 -31
- package/dist/index.d.ts +260 -31
- package/dist/index.js +141 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +141 -16
- 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 {
|
|
@@ -1023,6 +1114,61 @@ declare namespace Insights {
|
|
|
1023
1114
|
data: OptimalVideoLengthData;
|
|
1024
1115
|
_meta: InsightMeta;
|
|
1025
1116
|
};
|
|
1117
|
+
/** Consistency status levels */
|
|
1118
|
+
type ConsistencyStatus = 'excellent' | 'good' | 'needs_improvement' | 'poor' | 'inactive';
|
|
1119
|
+
/** Monthly upload breakdown */
|
|
1120
|
+
interface MonthlyUploadData {
|
|
1121
|
+
month: string;
|
|
1122
|
+
uploads: number;
|
|
1123
|
+
avgGap: number | null;
|
|
1124
|
+
}
|
|
1125
|
+
/** Upload consistency insight data */
|
|
1126
|
+
interface UploadConsistencyData {
|
|
1127
|
+
/** Period analyzed */
|
|
1128
|
+
period: {
|
|
1129
|
+
start: string;
|
|
1130
|
+
end: string;
|
|
1131
|
+
days: number;
|
|
1132
|
+
};
|
|
1133
|
+
/** Overall consistency score (0-100) */
|
|
1134
|
+
consistencyScore: number;
|
|
1135
|
+
/** Status label */
|
|
1136
|
+
status: ConsistencyStatus;
|
|
1137
|
+
/** Key metrics */
|
|
1138
|
+
metrics: {
|
|
1139
|
+
totalUploads: number;
|
|
1140
|
+
avgDaysBetweenUploads: number;
|
|
1141
|
+
uploadVariance: number;
|
|
1142
|
+
daysSinceLastUpload: number;
|
|
1143
|
+
lastUploadDate: string | null;
|
|
1144
|
+
};
|
|
1145
|
+
/** Upload pattern analysis */
|
|
1146
|
+
pattern: {
|
|
1147
|
+
isRegular: boolean;
|
|
1148
|
+
typicalGap: string;
|
|
1149
|
+
longestStreak: number;
|
|
1150
|
+
currentStreak: number;
|
|
1151
|
+
trend: 'increasing' | 'stable' | 'decreasing';
|
|
1152
|
+
trendDescription: string;
|
|
1153
|
+
};
|
|
1154
|
+
/** Monthly breakdown */
|
|
1155
|
+
monthlyBreakdown: MonthlyUploadData[];
|
|
1156
|
+
/** Frequency recommendation */
|
|
1157
|
+
recommendation: {
|
|
1158
|
+
suggested: string;
|
|
1159
|
+
current: string;
|
|
1160
|
+
reason: string;
|
|
1161
|
+
};
|
|
1162
|
+
/** Human-readable summary */
|
|
1163
|
+
insight: string;
|
|
1164
|
+
/** Actionable recommendations */
|
|
1165
|
+
recommendations: string[];
|
|
1166
|
+
}
|
|
1167
|
+
type UploadConsistencyResponse = (InsufficientDataResponse) | {
|
|
1168
|
+
hasData: true;
|
|
1169
|
+
data: UploadConsistencyData;
|
|
1170
|
+
_meta: InsightMeta;
|
|
1171
|
+
};
|
|
1026
1172
|
interface AllInsightsData {
|
|
1027
1173
|
bestPerformingVideo: BestPerformingVideoResponse;
|
|
1028
1174
|
contentDecay: ContentDecayResponse;
|
|
@@ -1031,6 +1177,7 @@ declare namespace Insights {
|
|
|
1031
1177
|
fadingHits: FadingHitsResponse;
|
|
1032
1178
|
audienceFatigue: AudienceFatigueResponse;
|
|
1033
1179
|
optimalLength: OptimalVideoLengthResponse;
|
|
1180
|
+
uploadConsistency: UploadConsistencyResponse;
|
|
1034
1181
|
}
|
|
1035
1182
|
interface AllInsightsResponse {
|
|
1036
1183
|
data: AllInsightsData;
|
|
@@ -1287,6 +1434,44 @@ declare class AuthModule {
|
|
|
1287
1434
|
* GET /user/platforms/status
|
|
1288
1435
|
*/
|
|
1289
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>;
|
|
1290
1475
|
}
|
|
1291
1476
|
|
|
1292
1477
|
/**
|
|
@@ -1416,38 +1601,48 @@ declare class InstagramModule {
|
|
|
1416
1601
|
constructor(client: TrndUpClient);
|
|
1417
1602
|
/**
|
|
1418
1603
|
* Get Instagram initialization status
|
|
1419
|
-
* GET /v1/platforms/instagram/init
|
|
1604
|
+
* GET /v1/platforms/instagram/status/init
|
|
1420
1605
|
*/
|
|
1421
1606
|
getInitStatus(): Promise<Instagram.InitStatusResponse>;
|
|
1422
1607
|
/**
|
|
1423
1608
|
* Initialize Instagram data sync
|
|
1424
|
-
*
|
|
1609
|
+
* GET /v1/platforms/instagram/init
|
|
1425
1610
|
*/
|
|
1426
|
-
initialize(): Promise<
|
|
1427
|
-
|
|
1428
|
-
|
|
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>;
|
|
1429
1618
|
/**
|
|
1430
1619
|
* Get Instagram posts
|
|
1431
1620
|
* GET /v1/platforms/instagram/posts
|
|
1432
1621
|
*/
|
|
1433
1622
|
getPosts(params?: Instagram.GetPostsParams): Promise<Instagram.GetPostsResponse>;
|
|
1434
1623
|
/**
|
|
1435
|
-
* Get specific post
|
|
1436
|
-
* GET /v1/platforms/instagram/posts/:postId
|
|
1624
|
+
* Get insights for a specific post
|
|
1625
|
+
* GET /v1/platforms/instagram/posts/:postId/insights
|
|
1437
1626
|
*/
|
|
1438
|
-
|
|
1627
|
+
getPostInsights(postId: string): Promise<Instagram.PostInsightsResponse>;
|
|
1439
1628
|
/**
|
|
1440
|
-
* Get
|
|
1441
|
-
* GET /v1/platforms/instagram/
|
|
1629
|
+
* Get active stories
|
|
1630
|
+
* GET /v1/platforms/instagram/stories
|
|
1442
1631
|
*/
|
|
1443
|
-
|
|
1632
|
+
getStories(): Promise<Instagram.StoriesResponse>;
|
|
1444
1633
|
/**
|
|
1445
|
-
*
|
|
1446
|
-
* POST /v1/platforms/instagram/
|
|
1634
|
+
* Trigger manual data sync
|
|
1635
|
+
* POST /v1/platforms/instagram/sync
|
|
1447
1636
|
*/
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
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>;
|
|
1451
1646
|
}
|
|
1452
1647
|
|
|
1453
1648
|
/**
|
|
@@ -1761,6 +1956,40 @@ declare class InsightsModule {
|
|
|
1761
1956
|
* GET /v1/insights/youtube/optimal-length
|
|
1762
1957
|
*/
|
|
1763
1958
|
getYouTubeOptimalLength(): Promise<Insights.OptimalVideoLengthResponse>;
|
|
1959
|
+
/**
|
|
1960
|
+
* Analyze your upload schedule consistency
|
|
1961
|
+
*
|
|
1962
|
+
* Measures how regularly you upload and provides recommendations
|
|
1963
|
+
* for maintaining a consistent schedule that helps algorithm performance.
|
|
1964
|
+
*
|
|
1965
|
+
* @example
|
|
1966
|
+
* ```typescript
|
|
1967
|
+
* const result = await client.insights.getYouTubeUploadConsistency();
|
|
1968
|
+
*
|
|
1969
|
+
* if (result.hasData) {
|
|
1970
|
+
* console.log(`Consistency Score: ${result.data.consistencyScore}/100`);
|
|
1971
|
+
* console.log(`Status: ${result.data.status}`);
|
|
1972
|
+
* console.log(`Avg gap: ${result.data.metrics.avgDaysBetweenUploads} days`);
|
|
1973
|
+
* console.log(`Days since last upload: ${result.data.metrics.daysSinceLastUpload}`);
|
|
1974
|
+
*
|
|
1975
|
+
* // Pattern analysis
|
|
1976
|
+
* console.log(`Pattern: ${result.data.pattern.typicalGap}`);
|
|
1977
|
+
* console.log(`Trend: ${result.data.pattern.trendDescription}`);
|
|
1978
|
+
*
|
|
1979
|
+
* // Recommendation
|
|
1980
|
+
* console.log(`Current: ${result.data.recommendation.current}`);
|
|
1981
|
+
* console.log(`Suggested: ${result.data.recommendation.suggested}`);
|
|
1982
|
+
*
|
|
1983
|
+
* // Monthly breakdown
|
|
1984
|
+
* for (const month of result.data.monthlyBreakdown) {
|
|
1985
|
+
* console.log(`${month.month}: ${month.uploads} uploads`);
|
|
1986
|
+
* }
|
|
1987
|
+
* }
|
|
1988
|
+
* ```
|
|
1989
|
+
*
|
|
1990
|
+
* GET /v1/insights/youtube/upload-consistency
|
|
1991
|
+
*/
|
|
1992
|
+
getYouTubeUploadConsistency(): Promise<Insights.UploadConsistencyResponse>;
|
|
1764
1993
|
/**
|
|
1765
1994
|
* Get all YouTube insights in one call
|
|
1766
1995
|
*
|
|
@@ -1783,8 +2012,8 @@ declare class InsightsModule {
|
|
|
1783
2012
|
* console.log(`Fatigue: ${all.data.audienceFatigue.data.fatigueLevel}`);
|
|
1784
2013
|
* }
|
|
1785
2014
|
*
|
|
1786
|
-
* if (all.data.
|
|
1787
|
-
* console.log(`
|
|
2015
|
+
* if (all.data.uploadConsistency.hasData) {
|
|
2016
|
+
* console.log(`Consistency: ${all.data.uploadConsistency.data.consistencyScore}/100`);
|
|
1788
2017
|
* }
|
|
1789
2018
|
* ```
|
|
1790
2019
|
*
|