export type PropertyStreamRequest = {languages?: Array | undefined, updated_since?: string | undefined, image_size?: ('thumbnail' | 'thumbnail_large' | 'standard' | 'large') | undefined}; export type CreateApiInventoryPropertiesArgs = {'Accept-Encoding'?: string | undefined, body: PropertyStreamRequest}; export type CreateApiInventoryPropertiesOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List accommodation properties * * POST /inventory/properties */ export const createApiInventoryProperties = async (args: CreateApiInventoryPropertiesArgs, options?: CreateApiInventoryPropertiesOptions) => { const {baseUrl = "https://metasearch-connect-api.booking.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/x-ndjson") if (args['Accept-Encoding'] != null) headers.set("Accept-Encoding", String(args['Accept-Encoding'])) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/inventory/properties${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 res.blob() };