@dracoonghost/trndup-sdk 1.4.0 → 1.5.1

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
@@ -139,6 +139,63 @@ declare namespace Auth {
139
139
  youtube: PlatformSyncInfo;
140
140
  instagram: PlatformSyncInfo;
141
141
  }
142
+ interface LinkPhoneSendOTPRequest {
143
+ phoneNumber: string;
144
+ }
145
+ interface LinkPhoneSendOTPResponse {
146
+ message: string;
147
+ expiresIn: number;
148
+ }
149
+ interface LinkPhoneVerifyRequest {
150
+ phoneNumber: string;
151
+ code: string;
152
+ }
153
+ interface LinkPhoneVerifyResponse {
154
+ message: string;
155
+ user: User;
156
+ }
157
+ interface UnlinkPhoneResponse {
158
+ message: string;
159
+ }
160
+ interface DeleteAccountRequest {
161
+ reason?: string;
162
+ }
163
+ interface DeleteAccountResponse {
164
+ message: string;
165
+ deletedAt: string;
166
+ scheduledDeletionAt: string;
167
+ daysUntilPermanentDeletion: number;
168
+ canReactivate: boolean;
169
+ reactivationInfo: string;
170
+ }
171
+ interface ReactivateAccountResponse {
172
+ message: string;
173
+ user: User;
174
+ }
175
+ interface DataExportResponse {
176
+ exportedAt: string;
177
+ user: User;
178
+ connectedAccounts: Array<{
179
+ provider: string;
180
+ accountName?: string;
181
+ username?: string;
182
+ connectedAt: string;
183
+ }>;
184
+ dataCategories: string[];
185
+ }
186
+ interface NotificationPreferences {
187
+ push: boolean;
188
+ email: boolean;
189
+ whatsapp: boolean;
190
+ }
191
+ interface UpdateNotificationPreferencesRequest {
192
+ push?: boolean;
193
+ email?: boolean;
194
+ whatsapp?: boolean;
195
+ }
196
+ interface NotificationPreferencesResponse {
197
+ notificationPreferences: NotificationPreferences;
198
+ }
142
199
  }
143
200
  declare namespace Social {
144
201
  /**
@@ -2094,6 +2151,61 @@ declare class AuthModule {
2094
2151
  * @param redirectUri - URL to redirect to after OAuth
2095
2152
  */
2096
2153
  buildInstagramOAuthUrl(redirectUri?: string): Promise<string>;
2154
+ /**
2155
+ * Send OTP to link phone number to existing account
2156
+ * POST /auth/phone/link/send-otp
2157
+ *
2158
+ * @param phoneNumber - Phone number to link (E.164 format)
2159
+ */
2160
+ linkPhoneSendOTP(phoneNumber: string): Promise<Auth.LinkPhoneSendOTPResponse>;
2161
+ /**
2162
+ * Verify OTP and link phone to account
2163
+ * POST /auth/phone/link/verify
2164
+ *
2165
+ * @param phoneNumber - Phone number to link
2166
+ * @param code - 6-digit verification code
2167
+ */
2168
+ linkPhoneVerify(phoneNumber: string, code: string): Promise<Auth.LinkPhoneVerifyResponse>;
2169
+ /**
2170
+ * Remove phone number from account
2171
+ * DELETE /auth/phone
2172
+ */
2173
+ unlinkPhone(): Promise<Auth.UnlinkPhoneResponse>;
2174
+ /**
2175
+ * Delete account (soft delete - 30 day grace period)
2176
+ * DELETE /auth/account
2177
+ *
2178
+ * Account is scheduled for permanent deletion after 30 days.
2179
+ * User can reactivate by logging in within the grace period.
2180
+ * Required for App Store compliance.
2181
+ *
2182
+ * @param reason - Optional reason for deletion (sent as query param)
2183
+ */
2184
+ deleteAccount(reason?: string): Promise<Auth.DeleteAccountResponse>;
2185
+ /**
2186
+ * Reactivate deleted account (within 30 day grace period)
2187
+ * POST /auth/account/reactivate
2188
+ */
2189
+ reactivateAccount(): Promise<Auth.ReactivateAccountResponse>;
2190
+ /**
2191
+ * Export user data (GDPR compliance)
2192
+ * GET /auth/privacy-export
2193
+ *
2194
+ * Returns all user data for GDPR data portability requirements.
2195
+ */
2196
+ exportUserData(): Promise<Auth.DataExportResponse>;
2197
+ /**
2198
+ * Get notification preferences
2199
+ * GET /auth/notifications
2200
+ */
2201
+ getNotificationPreferences(): Promise<Auth.NotificationPreferencesResponse>;
2202
+ /**
2203
+ * Update notification preferences
2204
+ * PATCH /auth/notifications
2205
+ *
2206
+ * @param preferences - Notification channels to enable/disable
2207
+ */
2208
+ updateNotificationPreferences(preferences: Auth.UpdateNotificationPreferencesRequest): Promise<Auth.NotificationPreferencesResponse>;
2097
2209
  }
2098
2210
 
2099
2211
  /**
@@ -2694,6 +2806,156 @@ declare class InsightsModule {
2694
2806
  * GET /v1/insights/youtube/all
2695
2807
  */
2696
2808
  getYouTubeAllInsights(): Promise<Insights.AllInsightsResponse>;
2809
+ /**
2810
+ * Instagram insights sub-module
2811
+ */
2812
+ instagram: {
2813
+ /**
2814
+ * Get all Instagram insights in one call
2815
+ *
2816
+ * Efficient for dashboard display - fetches all insights in parallel.
2817
+ *
2818
+ * @example
2819
+ * ```typescript
2820
+ * const all = await client.insights.instagram.getAll({ range: '30d' });
2821
+ *
2822
+ * // Check which insights are available
2823
+ * if (all.data.health.hasData) {
2824
+ * console.log(`Health Score: ${all.data.health.data.overall}/100`);
2825
+ * }
2826
+ *
2827
+ * if (all.data.bestPost.hasData) {
2828
+ * console.log(`Best Post: ${all.data.bestPost.data.post.caption}`);
2829
+ * }
2830
+ * ```
2831
+ *
2832
+ * GET /v1/insights/instagram
2833
+ */
2834
+ getAll: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.InstagramAllInsightsResponse>;
2835
+ /**
2836
+ * Get Instagram health score
2837
+ *
2838
+ * Overall account health based on consistency, engagement, growth, and reach.
2839
+ * Score ranges from 0-100 with labels: excellent, good, fair, needs_attention, poor.
2840
+ *
2841
+ * @example
2842
+ * ```typescript
2843
+ * const health = await client.insights.instagram.getHealthScore({ range: '30d' });
2844
+ *
2845
+ * if (health.hasData) {
2846
+ * console.log(`Score: ${health.data.overall}/100 (${health.data.label})`);
2847
+ * console.log(`Consistency: ${health.data.components.consistency.score}`);
2848
+ * console.log(`Engagement: ${health.data.components.engagement.score}`);
2849
+ * console.log(`Growth: ${health.data.components.growth.score}`);
2850
+ * console.log(`Reach: ${health.data.components.reach.score}`);
2851
+ * }
2852
+ * ```
2853
+ *
2854
+ * GET /v1/insights/instagram/health
2855
+ */
2856
+ getHealthScore: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.InstagramHealthScoreResponse>;
2857
+ /**
2858
+ * Get best performing post
2859
+ *
2860
+ * Identifies the top performing post in the period based on engagement rate.
2861
+ * Includes analysis of why it worked and comparison to average.
2862
+ *
2863
+ * @example
2864
+ * ```typescript
2865
+ * const best = await client.insights.instagram.getBestPost({ range: '30d' });
2866
+ *
2867
+ * if (best.hasData) {
2868
+ * console.log(`Post: ${best.data.post.caption}`);
2869
+ * console.log(`Engagement: ${best.data.post.metrics.engagementRate}%`);
2870
+ * console.log(`Above average: ${best.data.comparison.vsAverage.engagement}%`);
2871
+ * }
2872
+ * ```
2873
+ *
2874
+ * GET /v1/insights/instagram/best-post
2875
+ */
2876
+ getBestPost: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.BestPerformingPostResponse>;
2877
+ /**
2878
+ * Get posting consistency analysis
2879
+ *
2880
+ * Analyzes posting frequency patterns and consistency.
2881
+ * Identifies best posting days and gaps in schedule.
2882
+ *
2883
+ * @example
2884
+ * ```typescript
2885
+ * const consistency = await client.insights.instagram.getConsistency({ range: '90d' });
2886
+ *
2887
+ * if (consistency.hasData) {
2888
+ * console.log(`Posts/week: ${consistency.data.frequency.current.postsPerWeek}`);
2889
+ * console.log(`Score: ${consistency.data.consistency.score}/100`);
2890
+ * console.log(`Best day: ${consistency.data.patterns.mostActiveDay}`);
2891
+ * }
2892
+ * ```
2893
+ *
2894
+ * GET /v1/insights/instagram/consistency
2895
+ */
2896
+ getConsistency: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.PostingConsistencyResponse>;
2897
+ /**
2898
+ * Get follower quality analysis
2899
+ *
2900
+ * Measures the quality and engagement of followers.
2901
+ * Shows growth metrics and engagement rates.
2902
+ *
2903
+ * @example
2904
+ * ```typescript
2905
+ * const quality = await client.insights.instagram.getFollowerQuality({ range: '30d' });
2906
+ *
2907
+ * if (quality.hasData) {
2908
+ * console.log(`Quality: ${quality.data.qualityScore}/100`);
2909
+ * console.log(`Engagement rate: ${quality.data.metrics.engagementRate}%`);
2910
+ * console.log(`Growth: +${quality.data.growth.netChange} followers`);
2911
+ * }
2912
+ * ```
2913
+ *
2914
+ * GET /v1/insights/instagram/follower-quality
2915
+ */
2916
+ getFollowerQuality: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.FollowerQualityResponse>;
2917
+ /**
2918
+ * Get account momentum
2919
+ *
2920
+ * Shows current account trajectory: surging, growing, stable, declining, or stalling.
2921
+ * Compares recent performance to previous periods.
2922
+ *
2923
+ * @example
2924
+ * ```typescript
2925
+ * const momentum = await client.insights.instagram.getMomentum();
2926
+ *
2927
+ * if (momentum.hasData) {
2928
+ * console.log(`Status: ${momentum.data.current.status}`);
2929
+ * console.log(`Score: ${momentum.data.current.score}`);
2930
+ * console.log(`vs Last Week: ${momentum.data.comparison.vsLastWeek}%`);
2931
+ * }
2932
+ * ```
2933
+ *
2934
+ * GET /v1/insights/instagram/momentum
2935
+ */
2936
+ getMomentum: () => Promise<Insights.InstagramMomentumResponse>;
2937
+ /**
2938
+ * Get engagement breakdown
2939
+ *
2940
+ * Breaks down engagement by type: likes, comments, shares, saves.
2941
+ * Identifies engagement style and opportunities.
2942
+ *
2943
+ * @example
2944
+ * ```typescript
2945
+ * const engagement = await client.insights.instagram.getEngagement({ range: '30d' });
2946
+ *
2947
+ * if (engagement.hasData) {
2948
+ * console.log(`Total: ${engagement.data.totalEngagement}`);
2949
+ * console.log(`Style: ${engagement.data.engagementStyle}`);
2950
+ * console.log(`Likes: ${engagement.data.breakdown.likes.percent}%`);
2951
+ * console.log(`Comments: ${engagement.data.breakdown.comments.percent}%`);
2952
+ * }
2953
+ * ```
2954
+ *
2955
+ * GET /v1/insights/instagram/engagement
2956
+ */
2957
+ getEngagement: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.EngagementBreakdownResponse>;
2958
+ };
2697
2959
  }
2698
2960
 
2699
2961
  /**
package/dist/index.d.ts CHANGED
@@ -139,6 +139,63 @@ declare namespace Auth {
139
139
  youtube: PlatformSyncInfo;
140
140
  instagram: PlatformSyncInfo;
141
141
  }
142
+ interface LinkPhoneSendOTPRequest {
143
+ phoneNumber: string;
144
+ }
145
+ interface LinkPhoneSendOTPResponse {
146
+ message: string;
147
+ expiresIn: number;
148
+ }
149
+ interface LinkPhoneVerifyRequest {
150
+ phoneNumber: string;
151
+ code: string;
152
+ }
153
+ interface LinkPhoneVerifyResponse {
154
+ message: string;
155
+ user: User;
156
+ }
157
+ interface UnlinkPhoneResponse {
158
+ message: string;
159
+ }
160
+ interface DeleteAccountRequest {
161
+ reason?: string;
162
+ }
163
+ interface DeleteAccountResponse {
164
+ message: string;
165
+ deletedAt: string;
166
+ scheduledDeletionAt: string;
167
+ daysUntilPermanentDeletion: number;
168
+ canReactivate: boolean;
169
+ reactivationInfo: string;
170
+ }
171
+ interface ReactivateAccountResponse {
172
+ message: string;
173
+ user: User;
174
+ }
175
+ interface DataExportResponse {
176
+ exportedAt: string;
177
+ user: User;
178
+ connectedAccounts: Array<{
179
+ provider: string;
180
+ accountName?: string;
181
+ username?: string;
182
+ connectedAt: string;
183
+ }>;
184
+ dataCategories: string[];
185
+ }
186
+ interface NotificationPreferences {
187
+ push: boolean;
188
+ email: boolean;
189
+ whatsapp: boolean;
190
+ }
191
+ interface UpdateNotificationPreferencesRequest {
192
+ push?: boolean;
193
+ email?: boolean;
194
+ whatsapp?: boolean;
195
+ }
196
+ interface NotificationPreferencesResponse {
197
+ notificationPreferences: NotificationPreferences;
198
+ }
142
199
  }
143
200
  declare namespace Social {
144
201
  /**
@@ -2094,6 +2151,61 @@ declare class AuthModule {
2094
2151
  * @param redirectUri - URL to redirect to after OAuth
2095
2152
  */
2096
2153
  buildInstagramOAuthUrl(redirectUri?: string): Promise<string>;
2154
+ /**
2155
+ * Send OTP to link phone number to existing account
2156
+ * POST /auth/phone/link/send-otp
2157
+ *
2158
+ * @param phoneNumber - Phone number to link (E.164 format)
2159
+ */
2160
+ linkPhoneSendOTP(phoneNumber: string): Promise<Auth.LinkPhoneSendOTPResponse>;
2161
+ /**
2162
+ * Verify OTP and link phone to account
2163
+ * POST /auth/phone/link/verify
2164
+ *
2165
+ * @param phoneNumber - Phone number to link
2166
+ * @param code - 6-digit verification code
2167
+ */
2168
+ linkPhoneVerify(phoneNumber: string, code: string): Promise<Auth.LinkPhoneVerifyResponse>;
2169
+ /**
2170
+ * Remove phone number from account
2171
+ * DELETE /auth/phone
2172
+ */
2173
+ unlinkPhone(): Promise<Auth.UnlinkPhoneResponse>;
2174
+ /**
2175
+ * Delete account (soft delete - 30 day grace period)
2176
+ * DELETE /auth/account
2177
+ *
2178
+ * Account is scheduled for permanent deletion after 30 days.
2179
+ * User can reactivate by logging in within the grace period.
2180
+ * Required for App Store compliance.
2181
+ *
2182
+ * @param reason - Optional reason for deletion (sent as query param)
2183
+ */
2184
+ deleteAccount(reason?: string): Promise<Auth.DeleteAccountResponse>;
2185
+ /**
2186
+ * Reactivate deleted account (within 30 day grace period)
2187
+ * POST /auth/account/reactivate
2188
+ */
2189
+ reactivateAccount(): Promise<Auth.ReactivateAccountResponse>;
2190
+ /**
2191
+ * Export user data (GDPR compliance)
2192
+ * GET /auth/privacy-export
2193
+ *
2194
+ * Returns all user data for GDPR data portability requirements.
2195
+ */
2196
+ exportUserData(): Promise<Auth.DataExportResponse>;
2197
+ /**
2198
+ * Get notification preferences
2199
+ * GET /auth/notifications
2200
+ */
2201
+ getNotificationPreferences(): Promise<Auth.NotificationPreferencesResponse>;
2202
+ /**
2203
+ * Update notification preferences
2204
+ * PATCH /auth/notifications
2205
+ *
2206
+ * @param preferences - Notification channels to enable/disable
2207
+ */
2208
+ updateNotificationPreferences(preferences: Auth.UpdateNotificationPreferencesRequest): Promise<Auth.NotificationPreferencesResponse>;
2097
2209
  }
2098
2210
 
2099
2211
  /**
@@ -2694,6 +2806,156 @@ declare class InsightsModule {
2694
2806
  * GET /v1/insights/youtube/all
2695
2807
  */
2696
2808
  getYouTubeAllInsights(): Promise<Insights.AllInsightsResponse>;
2809
+ /**
2810
+ * Instagram insights sub-module
2811
+ */
2812
+ instagram: {
2813
+ /**
2814
+ * Get all Instagram insights in one call
2815
+ *
2816
+ * Efficient for dashboard display - fetches all insights in parallel.
2817
+ *
2818
+ * @example
2819
+ * ```typescript
2820
+ * const all = await client.insights.instagram.getAll({ range: '30d' });
2821
+ *
2822
+ * // Check which insights are available
2823
+ * if (all.data.health.hasData) {
2824
+ * console.log(`Health Score: ${all.data.health.data.overall}/100`);
2825
+ * }
2826
+ *
2827
+ * if (all.data.bestPost.hasData) {
2828
+ * console.log(`Best Post: ${all.data.bestPost.data.post.caption}`);
2829
+ * }
2830
+ * ```
2831
+ *
2832
+ * GET /v1/insights/instagram
2833
+ */
2834
+ getAll: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.InstagramAllInsightsResponse>;
2835
+ /**
2836
+ * Get Instagram health score
2837
+ *
2838
+ * Overall account health based on consistency, engagement, growth, and reach.
2839
+ * Score ranges from 0-100 with labels: excellent, good, fair, needs_attention, poor.
2840
+ *
2841
+ * @example
2842
+ * ```typescript
2843
+ * const health = await client.insights.instagram.getHealthScore({ range: '30d' });
2844
+ *
2845
+ * if (health.hasData) {
2846
+ * console.log(`Score: ${health.data.overall}/100 (${health.data.label})`);
2847
+ * console.log(`Consistency: ${health.data.components.consistency.score}`);
2848
+ * console.log(`Engagement: ${health.data.components.engagement.score}`);
2849
+ * console.log(`Growth: ${health.data.components.growth.score}`);
2850
+ * console.log(`Reach: ${health.data.components.reach.score}`);
2851
+ * }
2852
+ * ```
2853
+ *
2854
+ * GET /v1/insights/instagram/health
2855
+ */
2856
+ getHealthScore: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.InstagramHealthScoreResponse>;
2857
+ /**
2858
+ * Get best performing post
2859
+ *
2860
+ * Identifies the top performing post in the period based on engagement rate.
2861
+ * Includes analysis of why it worked and comparison to average.
2862
+ *
2863
+ * @example
2864
+ * ```typescript
2865
+ * const best = await client.insights.instagram.getBestPost({ range: '30d' });
2866
+ *
2867
+ * if (best.hasData) {
2868
+ * console.log(`Post: ${best.data.post.caption}`);
2869
+ * console.log(`Engagement: ${best.data.post.metrics.engagementRate}%`);
2870
+ * console.log(`Above average: ${best.data.comparison.vsAverage.engagement}%`);
2871
+ * }
2872
+ * ```
2873
+ *
2874
+ * GET /v1/insights/instagram/best-post
2875
+ */
2876
+ getBestPost: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.BestPerformingPostResponse>;
2877
+ /**
2878
+ * Get posting consistency analysis
2879
+ *
2880
+ * Analyzes posting frequency patterns and consistency.
2881
+ * Identifies best posting days and gaps in schedule.
2882
+ *
2883
+ * @example
2884
+ * ```typescript
2885
+ * const consistency = await client.insights.instagram.getConsistency({ range: '90d' });
2886
+ *
2887
+ * if (consistency.hasData) {
2888
+ * console.log(`Posts/week: ${consistency.data.frequency.current.postsPerWeek}`);
2889
+ * console.log(`Score: ${consistency.data.consistency.score}/100`);
2890
+ * console.log(`Best day: ${consistency.data.patterns.mostActiveDay}`);
2891
+ * }
2892
+ * ```
2893
+ *
2894
+ * GET /v1/insights/instagram/consistency
2895
+ */
2896
+ getConsistency: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.PostingConsistencyResponse>;
2897
+ /**
2898
+ * Get follower quality analysis
2899
+ *
2900
+ * Measures the quality and engagement of followers.
2901
+ * Shows growth metrics and engagement rates.
2902
+ *
2903
+ * @example
2904
+ * ```typescript
2905
+ * const quality = await client.insights.instagram.getFollowerQuality({ range: '30d' });
2906
+ *
2907
+ * if (quality.hasData) {
2908
+ * console.log(`Quality: ${quality.data.qualityScore}/100`);
2909
+ * console.log(`Engagement rate: ${quality.data.metrics.engagementRate}%`);
2910
+ * console.log(`Growth: +${quality.data.growth.netChange} followers`);
2911
+ * }
2912
+ * ```
2913
+ *
2914
+ * GET /v1/insights/instagram/follower-quality
2915
+ */
2916
+ getFollowerQuality: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.FollowerQualityResponse>;
2917
+ /**
2918
+ * Get account momentum
2919
+ *
2920
+ * Shows current account trajectory: surging, growing, stable, declining, or stalling.
2921
+ * Compares recent performance to previous periods.
2922
+ *
2923
+ * @example
2924
+ * ```typescript
2925
+ * const momentum = await client.insights.instagram.getMomentum();
2926
+ *
2927
+ * if (momentum.hasData) {
2928
+ * console.log(`Status: ${momentum.data.current.status}`);
2929
+ * console.log(`Score: ${momentum.data.current.score}`);
2930
+ * console.log(`vs Last Week: ${momentum.data.comparison.vsLastWeek}%`);
2931
+ * }
2932
+ * ```
2933
+ *
2934
+ * GET /v1/insights/instagram/momentum
2935
+ */
2936
+ getMomentum: () => Promise<Insights.InstagramMomentumResponse>;
2937
+ /**
2938
+ * Get engagement breakdown
2939
+ *
2940
+ * Breaks down engagement by type: likes, comments, shares, saves.
2941
+ * Identifies engagement style and opportunities.
2942
+ *
2943
+ * @example
2944
+ * ```typescript
2945
+ * const engagement = await client.insights.instagram.getEngagement({ range: '30d' });
2946
+ *
2947
+ * if (engagement.hasData) {
2948
+ * console.log(`Total: ${engagement.data.totalEngagement}`);
2949
+ * console.log(`Style: ${engagement.data.engagementStyle}`);
2950
+ * console.log(`Likes: ${engagement.data.breakdown.likes.percent}%`);
2951
+ * console.log(`Comments: ${engagement.data.breakdown.comments.percent}%`);
2952
+ * }
2953
+ * ```
2954
+ *
2955
+ * GET /v1/insights/instagram/engagement
2956
+ */
2957
+ getEngagement: (params?: Insights.GetInstagramInsightParams) => Promise<Insights.EngagementBreakdownResponse>;
2958
+ };
2697
2959
  }
2698
2960
 
2699
2961
  /**