import "server-only"; import { winofyFetch, type PaginatedResponse } from "./winofy"; import type { City, Neighborhood } from "@/types/api"; export async function getCities(): Promise { const res = await winofyFetch>("/v1/cities/", { auth: false, params: { limit: 100 } }); return res.results; } export async function getCity(uuid: string): Promise { return winofyFetch(`/v1/cities/${uuid}/`, { auth: false }); } export interface GetNeighborhoodsParams { city?: string; /** * Forwarded to the API for forward-compatibility, but confirmed against * staging (2026-08-22) to currently have no effect — the endpoint returns * the same unfiltered results with or without it. Callers must still filter * client-side (see NeighborhoodSearch) until the backend actually supports it. */ search?: string; limit?: number; } export async function getNeighborhoods(params: GetNeighborhoodsParams = {}): Promise { const res = await winofyFetch>("/v1/neighborhoods/", { auth: false, params: { limit: 200, ...params }, }); return res.results; } export async function getNeighborhood(uuid: string): Promise { return winofyFetch(`/v1/neighborhoods/${uuid}/`, { auth: false }); }