export type GetApiV5ZonesZoneNameArgs = {zone_name: string}; export type GetApiV5ZonesZoneNameOptions = {baseUrl?: string | undefined, HEADER?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch a rendered zone * * GET /v5/zones/{zone_name} * * Also accepts auth: QUERY, COOKIE */ export const getApiV5ZonesZoneName = async (args: GetApiV5ZonesZoneNameArgs, options?: GetApiV5ZonesZoneNameOptions) => { const {baseUrl = "https://api.extole.io", fetch: fetchFn = fetch, HEADER} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (HEADER !== undefined) headers.set("Authorization", HEADER) const url = `${baseUrl.replace(/\/+$/, '')}/v5/zones/${encodeURIComponent(String(args.zone_name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };