export type DeleteApiLibrariesLibraryIdArgs = {library_id: number, cookie_name?: (string | null) | undefined}; export type DeleteApiLibrariesLibraryIdOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a library * * DELETE /libraries/{library_id} */ export const deleteApiLibrariesLibraryId = async (args: DeleteApiLibrariesLibraryIdArgs, options?: DeleteApiLibrariesLibraryIdOptions) => { const {baseUrl = "https://api.your-domain.com", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.cookie_name != null) query.append("cookie_name", String(args.cookie_name)) if (APIKeyHeader !== undefined) headers.set("X-API-KEY", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/libraries/${encodeURIComponent(String(args.library_id))}${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 };