export type DeliveryPoolHours = {monday: {closed?: boolean | undefined, poolTimes: Array<{startTime: string, endTime: string}>}, tuesday: {closed?: boolean | undefined, poolTimes: Array<{startTime: string, endTime: string}>}, wednesday: {closed?: boolean | undefined, poolTimes: Array<{startTime: string, endTime: string}>}, thursday: {closed?: boolean | undefined, poolTimes: Array<{startTime: string, endTime: string}>}, friday: {closed?: boolean | undefined, poolTimes: Array<{startTime: string, endTime: string}>}, saturday: {closed?: boolean | undefined, poolTimes: Array<{startTime: string, endTime: string}>}, sunday: {closed?: boolean | undefined, poolTimes: Array<{startTime: string, endTime: string}>}}; export type UpdateApiDeliveryPoolsDeliveryPoolIdHoursArgs = {body: DeliveryPoolHours}; export type UpdateApiDeliveryPoolsDeliveryPoolIdHoursOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set the delivery pools daily start and end times * * PUT /delivery/pools/{deliveryPoolId}/hours */ export const updateApiDeliveryPoolsDeliveryPoolIdHours = async (args: UpdateApiDeliveryPoolsDeliveryPoolIdHoursArgs, options?: UpdateApiDeliveryPoolsDeliveryPoolIdHoursOptions) => { const {baseUrl = "https://uk.api.just-eat.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/delivery/pools/${encodeURIComponent(String(args.deliveryPoolId))}/hours${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };