export type UserRole = 'System' | 'Operations' | 'Restaurant'; export type DeleteApiV1TenantRestaurantsIdEventOfflineArgs = {tenant: string, id: string, 'X-JE-Requester': string, 'X-JE-User-Role': UserRole}; export type DeleteApiV1TenantRestaurantsIdEventOfflineOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Offline Event * * DELETE /v1/{tenant}/restaurants/{id}/event/offline */ export const deleteApiV1TenantRestaurantsIdEventOffline = async (args: DeleteApiV1TenantRestaurantsIdEventOfflineArgs, options?: DeleteApiV1TenantRestaurantsIdEventOfflineOptions) => { const {baseUrl = "https://uk.api.just-eat.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-JE-Requester'] != null) headers.set("X-JE-Requester", String(args['X-JE-Requester'])) if (args['X-JE-User-Role'] != null) headers.set("X-JE-User-Role", String(args['X-JE-User-Role'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/${encodeURIComponent(String(args.tenant))}/restaurants/${encodeURIComponent(String(args.id))}/event/offline${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };