@dracoonghost/trndup-sdk 1.5.0 → 1.5.2

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
  /**
@@ -2947,7 +3059,7 @@ declare class TrendsModule {
2947
3059
  * console.log(trend.topExamples);
2948
3060
  * ```
2949
3061
  */
2950
- getById(trendId: string): Promise<Trends.TrendDetail>;
3062
+ get(trendId: string): Promise<Trends.TrendDetail>;
2951
3063
  /**
2952
3064
  * Get all categories with trend counts
2953
3065
  *
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
  /**
@@ -2947,7 +3059,7 @@ declare class TrendsModule {
2947
3059
  * console.log(trend.topExamples);
2948
3060
  * ```
2949
3061
  */
2950
- getById(trendId: string): Promise<Trends.TrendDetail>;
3062
+ get(trendId: string): Promise<Trends.TrendDetail>;
2951
3063
  /**
2952
3064
  * Get all categories with trend counts
2953
3065
  *
package/dist/index.js CHANGED
@@ -367,6 +367,93 @@ var AuthModule = class {
367
367
  const response = await this.getInstagramOAuthUrl(redirectUri);
368
368
  return response.authUrl;
369
369
  }
370
+ // =========================================================================
371
+ // PHONE LINKING (for existing authenticated users)
372
+ // =========================================================================
373
+ /**
374
+ * Send OTP to link phone number to existing account
375
+ * POST /auth/phone/link/send-otp
376
+ *
377
+ * @param phoneNumber - Phone number to link (E.164 format)
378
+ */
379
+ async linkPhoneSendOTP(phoneNumber) {
380
+ return this.client.post(
381
+ "/auth/phone/link/send-otp",
382
+ { phoneNumber }
383
+ );
384
+ }
385
+ /**
386
+ * Verify OTP and link phone to account
387
+ * POST /auth/phone/link/verify
388
+ *
389
+ * @param phoneNumber - Phone number to link
390
+ * @param code - 6-digit verification code
391
+ */
392
+ async linkPhoneVerify(phoneNumber, code) {
393
+ return this.client.post(
394
+ "/auth/phone/link/verify",
395
+ { phoneNumber, code }
396
+ );
397
+ }
398
+ /**
399
+ * Remove phone number from account
400
+ * DELETE /auth/phone
401
+ */
402
+ async unlinkPhone() {
403
+ return this.client.delete("/auth/phone");
404
+ }
405
+ // =========================================================================
406
+ // ACCOUNT MANAGEMENT (App Store & GDPR compliance)
407
+ // =========================================================================
408
+ /**
409
+ * Delete account (soft delete - 30 day grace period)
410
+ * DELETE /auth/account
411
+ *
412
+ * Account is scheduled for permanent deletion after 30 days.
413
+ * User can reactivate by logging in within the grace period.
414
+ * Required for App Store compliance.
415
+ *
416
+ * @param reason - Optional reason for deletion (sent as query param)
417
+ */
418
+ async deleteAccount(reason) {
419
+ const path = reason ? `/auth/account?reason=${encodeURIComponent(reason)}` : "/auth/account";
420
+ return this.client.delete(path);
421
+ }
422
+ /**
423
+ * Reactivate deleted account (within 30 day grace period)
424
+ * POST /auth/account/reactivate
425
+ */
426
+ async reactivateAccount() {
427
+ return this.client.post("/auth/account/reactivate");
428
+ }
429
+ /**
430
+ * Export user data (GDPR compliance)
431
+ * GET /auth/privacy-export
432
+ *
433
+ * Returns all user data for GDPR data portability requirements.
434
+ */
435
+ async exportUserData() {
436
+ return this.client.get("/auth/privacy-export");
437
+ }
438
+ // =========================================================================
439
+ // NOTIFICATION PREFERENCES
440
+ // =========================================================================
441
+ /**
442
+ * Get notification preferences
443
+ * GET /auth/notifications
444
+ */
445
+ async getNotificationPreferences() {
446
+ return this.client.get("/auth/notifications");
447
+ }
448
+ /**
449
+ * Update notification preferences
450
+ * PATCH /auth/notifications
451
+ *
452
+ * @param preferences - Notification channels to enable/disable
453
+ */
454
+ async updateNotificationPreferences(preferences) {
455
+ return this.client.patch("/auth/notifications", preferences);
456
+ }
370
457
  };
371
458
 
372
459
  // modules/youtube.ts
@@ -1464,7 +1551,7 @@ var TrendsModule = class {
1464
1551
  * console.log(trend.topExamples);
1465
1552
  * ```
1466
1553
  */
1467
- async getById(trendId) {
1554
+ async get(trendId) {
1468
1555
  return this.client.get(`/v1/trends/${trendId}`);
1469
1556
  }
1470
1557
  /**