Skip to main content
Glama
trendingContentService.ts1.06 kB
import type { TrendingResponse } from "../types/trending.js"; export interface TrendingContentOptions { networks?: string; limit?: number; apiKey?: string; } export class TrendingContentService { private readonly baseUrl = "https://hyperfeeds.xyz/api/trending"; /** * Fetch trending content from the HyperFeed API */ async fetchTrendingContent( options: TrendingContentOptions = {}, ): Promise<TrendingResponse> { const { networks = "twitter", limit, apiKey } = options; // Build the API URL let apiUrl = `${this.baseUrl}?networks=${encodeURIComponent(networks)}`; if (limit) { apiUrl += `&limit=${limit}`; } // Prepare headers const headers: Record<string, string> = {}; if (apiKey) { headers.Authorization = `Bearer ${apiKey}`; } // Make the API request const response = await fetch(apiUrl, { headers, }); if (!response.ok) { throw new Error( `Failed to fetch trending content: ${response.status} ${response.statusText}`, ); } return (await response.json()) as TrendingResponse; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/synthetic-ci/vibe-marketing'

If you have feedback or need assistance with the MCP directory API, please join our Discord server