import api from "@/lib/api"; import type { Content, PaginatedResponse } from "@/types/content"; export const ContentService = { async getExplore(params: { limit?: number; offset?: number; sort?: "trend" | "recent"; tag?: string; category?: string; query?: string; }): Promise> { const { data } = await api.get>("/contents/explore", { params, }); return data; }, async getTrends(limit = 10, offset = 0): Promise> { const { data } = await api.get>("/contents/trends", { params: { limit, offset }, }); return data; }, async getRecent(limit = 10, offset = 0): Promise> { const { data } = await api.get>("/contents/recent", { params: { limit, offset }, }); return data; }, async getOne(idOrSlug: string): Promise { const { data } = await api.get(`/contents/${idOrSlug}`); return data; }, async incrementViews(id: string): Promise { await api.post(`/contents/${id}/view`); }, async incrementUsage(id: string): Promise { await api.post(`/contents/${id}/use`); }, async upload(formData: FormData): Promise { const { data } = await api.post("/contents/upload", formData, { headers: { "Content-Type": "multipart/form-data", }, }); return data; }, };