export type DeleteApiPagesPageIdArgs = {token: unknown, pageId: number}; export type DeleteApiPagesPageIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete page * * DELETE /pages/{pageId} */ export const deleteApiPagesPageId = async (args: DeleteApiPagesPageIdArgs, options: DeleteApiPagesPageIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.token != null) query.append("token", String(args.token)) const url = `${baseUrl.replace(/\/+$/, '')}/pages/${encodeURIComponent(String(args.pageId))}${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 };