export type DeleteApiSectionsSectionIdArgs = {section_id: number, body: {preserveTasks?: boolean | undefined, section?: number | undefined}}; export type DeleteApiSectionsSectionIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Section * * DELETE /sections/{section_id} */ export const deleteApiSectionsSectionId = async (args: DeleteApiSectionsSectionIdArgs, options?: DeleteApiSectionsSectionIdOptions) => { const {baseUrl = "https://api.everhour.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/sections/${encodeURIComponent(String(args.section_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };