export type DeleteApiApiV1AdminPartsPartIdDrawingsArgs = {part_id: string, reason?: (string | null) | undefined}; export type DeleteApiApiV1AdminPartsPartIdDrawingsOptions = {baseUrl: string, OAuth2PasswordBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Admin Delete Drawing * * DELETE /api/v1/admin/parts/{part_id}/drawings */ export const deleteApiApiV1AdminPartsPartIdDrawings = async (args: DeleteApiApiV1AdminPartsPartIdDrawingsArgs, options: DeleteApiApiV1AdminPartsPartIdDrawingsOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2PasswordBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.reason != null) query.append("reason", String(args.reason)) if (OAuth2PasswordBearer !== undefined) headers.set('authorization', `Bearer ${OAuth2PasswordBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/admin/parts/${encodeURIComponent(String(args.part_id))}/drawings${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 };