@dracoonghost/trndup-sdk 1.3.26 → 1.4.0

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
@@ -1216,6 +1216,133 @@ var ActivityModule = class {
1216
1216
  }
1217
1217
  };
1218
1218
 
1219
+ // modules/trends.ts
1220
+ var TrendsModule = class {
1221
+ constructor(client) {
1222
+ this.client = client;
1223
+ }
1224
+ /**
1225
+ * List trending topics with optional filters
1226
+ *
1227
+ * @param params - Filter and pagination options
1228
+ * @returns Paginated list of trends sorted by relevance
1229
+ *
1230
+ * @example
1231
+ * ```typescript
1232
+ * // Get top trends
1233
+ * const trends = await sdk.trends.list();
1234
+ *
1235
+ * // Filter by category
1236
+ * const sportsTrends = await sdk.trends.list({ category: 'SPORTS' });
1237
+ *
1238
+ * // Filter by velocity
1239
+ * const viralTrends = await sdk.trends.list({ velocity: 'VIRAL' });
1240
+ *
1241
+ * // Paginate
1242
+ * const page2 = await sdk.trends.list({ limit: 20, offset: 20 });
1243
+ * ```
1244
+ */
1245
+ async list(params = {}) {
1246
+ const queryParams = {};
1247
+ if (params.category) queryParams.category = params.category;
1248
+ if (params.velocity) queryParams.velocity = params.velocity;
1249
+ if (params.status) queryParams.status = params.status;
1250
+ if (params.platform) queryParams.platform = params.platform;
1251
+ if (params.limit) queryParams.limit = params.limit;
1252
+ if (params.offset) queryParams.offset = params.offset;
1253
+ return this.client.get("/v1/trends", queryParams);
1254
+ }
1255
+ /**
1256
+ * Get full details of a specific trend
1257
+ *
1258
+ * @param trendId - The unique trend ID
1259
+ * @returns Full trend details including content ideas and examples
1260
+ *
1261
+ * @example
1262
+ * ```typescript
1263
+ * const trend = await sdk.trends.getById('trend_123');
1264
+ * console.log(trend.contentIdeas);
1265
+ * console.log(trend.topExamples);
1266
+ * ```
1267
+ */
1268
+ async getById(trendId) {
1269
+ return this.client.get(`/v1/trends/${trendId}`);
1270
+ }
1271
+ /**
1272
+ * Get all categories with trend counts
1273
+ *
1274
+ * @returns List of categories and their trend counts
1275
+ *
1276
+ * @example
1277
+ * ```typescript
1278
+ * const categories = await sdk.trends.getCategories();
1279
+ * // [{ category: 'SPORTS', count: 15 }, { category: 'TECH', count: 12 }, ...]
1280
+ * ```
1281
+ */
1282
+ async getCategories() {
1283
+ return this.client.get("/v1/trends/meta/categories");
1284
+ }
1285
+ /**
1286
+ * Get all platforms with trend counts
1287
+ *
1288
+ * @returns List of platforms and their trend counts
1289
+ *
1290
+ * @example
1291
+ * ```typescript
1292
+ * const platforms = await sdk.trends.getPlatforms();
1293
+ * // [{ platform: 'YouTube', count: 25 }, { platform: 'Instagram', count: 18 }, ...]
1294
+ * ```
1295
+ */
1296
+ async getPlatforms() {
1297
+ return this.client.get("/v1/trends/meta/platforms");
1298
+ }
1299
+ /**
1300
+ * Get sync status information
1301
+ *
1302
+ * @returns Current sync status and statistics
1303
+ *
1304
+ * @example
1305
+ * ```typescript
1306
+ * const status = await sdk.trends.getSyncStatus();
1307
+ * console.log(status.lastSyncedAt);
1308
+ * console.log(status.totalTrends);
1309
+ * ```
1310
+ */
1311
+ async getSyncStatus() {
1312
+ return this.client.get("/v1/trends/meta/sync-status");
1313
+ }
1314
+ /**
1315
+ * Get viral trends (velocity = VIRAL)
1316
+ * Convenience method for filtering viral trends
1317
+ *
1318
+ * @param limit - Max results (default: 10)
1319
+ * @returns List of viral trends
1320
+ */
1321
+ async getViral(limit = 10) {
1322
+ return this.list({ velocity: "VIRAL", limit });
1323
+ }
1324
+ /**
1325
+ * Get peaking trends (status = PEAKING)
1326
+ * Convenience method for filtering trends at peak
1327
+ *
1328
+ * @param limit - Max results (default: 10)
1329
+ * @returns List of peaking trends
1330
+ */
1331
+ async getPeaking(limit = 10) {
1332
+ return this.list({ status: "PEAKING", limit });
1333
+ }
1334
+ /**
1335
+ * Get trends for a specific platform
1336
+ *
1337
+ * @param platform - Platform name (e.g., 'YouTube', 'Instagram')
1338
+ * @param limit - Max results (default: 20)
1339
+ * @returns List of trends for the platform
1340
+ */
1341
+ async getByPlatform(platform, limit = 20) {
1342
+ return this.list({ platform, limit });
1343
+ }
1344
+ };
1345
+
1219
1346
  // types.ts
1220
1347
  var YOUTUBE_SCOPES = [
1221
1348
  "openid",
@@ -1243,6 +1370,7 @@ var TrndUpSDK = class extends TrndUpClient {
1243
1370
  this.social = new SocialModule(this);
1244
1371
  this.insights = new InsightsModule(this);
1245
1372
  this.activity = new ActivityModule(this);
1373
+ this.trends = new TrendsModule(this);
1246
1374
  }
1247
1375
  };
1248
1376
  var SDK_VERSION = "1.0.0";