export type AddCustomCriteria = {productType: string, summary: string, title: string, description: string, price: number, currency: string, adults?: number | undefined, children?: number | undefined, infants?: number | undefined}; export type CreateApiAccountHotlistIdKeyCustomArgs = {id: number, key: string, body: AddCustomCriteria}; export type CreateApiAccountHotlistIdKeyCustomOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add custom item to hotlist * * POST /account/hotlist/{id}/{key}/custom */ export const createApiAccountHotlistIdKeyCustom = async (args: CreateApiAccountHotlistIdKeyCustomArgs, options?: CreateApiAccountHotlistIdKeyCustomOptions) => { const {baseUrl = "https://api.travelify.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/account/hotlist/${encodeURIComponent(String(args.id))}/${encodeURIComponent(String(args.key))}/custom${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };