File size: 1,543 Bytes
e45ae58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import express from 'express';
import axios from 'axios';
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
const TrendingNewRoutes = express.Router();

const protectedUsers = [6477856957, 1191668125, 1448273246, 1054295664, 6444305696]; 

const ComboTrending = async (limit) => {
  const options = {
    method: 'GET',
    url: 'https://randydev-meta-ai.hf.space/combo-trending',
    params: {
      limit: limit
    }
  };
  try {
    const response = await axios.request(options);
    return response.data;
  } catch (error) {
    console.error(error);
    return null;
  }
}

/**
 * @swagger
 * /api/v1/trending/combo:
 *   get:
 *     summary: Combo Trending
 *     tags: [Trending]
 *     parameters:
 *       - in: query
 *         name: limit
 *         required: true
 *         description: null
 *         schema:
 *           type: number
 *       - in: header
 *         name: x-api-key
 *         required: true
 *         description: API key for authentication
 *         schema:
 *           type: string
 *     responses:
 *       200:
 *         description: Success
 */
TrendingNewRoutes.get("/api/v1/trending/combo", authenticateApiKey, apiLimiter, async (req, res) => {
    const limit = req.query.limit;
    if (!limit) {
        return res.status(400).json({ error: "Invalid or missing username" });
    }
    try {
        const result = await ComboTrending(limit);
        res.json(result);
    } catch (error) {
        res.status(500).json({ error: "Failed to fetch user info" });
    }
});