export type DeleteApiV2ZonesIdArgs = {'x-customer-api-key'?: string | undefined, body: {reason: 'STORE_CLOSED' | 'TECHNICAL_ISSUES' | 'MUSICAL_DECISION'}}; export type DeleteApiV2ZonesIdOptions = {baseUrl: string, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a zone * * DELETE /v2/zones/{id} */ export const deleteApiV2ZonesId = async (args: DeleteApiV2ZonesIdArgs, options: DeleteApiV2ZonesIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, defaultValue} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-customer-api-key'] != null) headers.set("x-customer-api-key", String(args['x-customer-api-key'])) if (defaultValue !== undefined) headers.set("x-customer-api-key", defaultValue) const url = `${baseUrl.replace(/\/+$/, '')}/v2/zones/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };