// Utility to fetch content from IndeeHub API // Update with your actual API endpoints const INDEEDHUB_API = 'https://indeehub.studio/api' export interface IndeeHubFilm { id: string title: string description: string thumbnailUrl: string backdropUrl?: string type: 'film' | 'series' | 'short' duration?: number releaseYear?: number rating?: string creator?: { name: string npub?: string } nostrEventId?: string categories: string[] } /** * Fetch films from IndeeHub screening room. * For authenticated requests, use indeehub-api.service which attaches NIP-98 tokens. */ export async function fetchFilms(): Promise { try { const response = await fetch(`${INDEEDHUB_API}/screening-room?type=film`, { headers: { // Add your auth headers here // 'Authorization': 'Bearer ...' } }) if (!response.ok) { throw new Error('Failed to fetch films') } return await response.json() } catch (error) { console.error('Error fetching films:', error) // Return mock data for development return getMockFilms() } } /** * Mock data for development * Replace with real IndeeHub data */ function getMockFilms(): IndeeHubFilm[] { return [ { id: '1', title: 'Sample Film 1', description: 'Replace with actual IndeeHub film data', thumbnailUrl: 'https://images.unsplash.com/photo-1518546305927-5a555bb7020d?w=400', backdropUrl: 'https://images.unsplash.com/photo-1518546305927-5a555bb7020d?w=1920', type: 'film', duration: 120, releaseYear: 2024, categories: ['Drama'] }, // Add more mock films... ] } /** * Fetch featured content */ export async function fetchFeaturedContent(): Promise { try { const response = await fetch(`${INDEEDHUB_API}/featured`) if (!response.ok) return null return await response.json() } catch (error) { console.error('Error fetching featured:', error) return null } } /** * Fetch films by category */ export async function fetchFilmsByCategory(category: string): Promise { try { const response = await fetch(`${INDEEDHUB_API}/films?category=${category}`) if (!response.ok) return [] return await response.json() } catch (error) { console.error('Error fetching category:', error) return [] } }