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