const response = await fetch("https://api.dev.repp.co.il/v1/spaces/b1c2d3e4-f5a6-4b7c-8d9e-0f1a2b3c4d5e");
if (!response.ok) thrownew Error((await response.json()).error.message);
const data = await response.json();
/** A space for rent by the hour. */
interface Space {
id: string;
name: string;
photo_url: string | null;
region: Region;
city: string | null;
price_per_hour: number;
capacity: number;
days: number[];
open_from: string;
open_to: string;
business: Business;
}
/** A region of Israel: one of the keys in Catalog. */
type Region = "gush_dan" | "shfela" | "sharon" | "haifa" | "jerusalem" | "north" | "south" | "judea_samaria";
/** A business, as the public index shows it. */
interface Business {
id: string;
name: string;
photo_url: string | null;
}
interface ApiError {
error: { code: string; message: string; reason?: string };
}
const response = await fetch("https://api.dev.repp.co.il/v1/spaces/b1c2d3e4-f5a6-4b7c-8d9e-0f1a2b3c4d5e");
if (!response.ok) thrownew Error(((await response.json()) as ApiError).error.message);
const data = (await response.json()) as Space;