export type CreateApiNodesReindexArgs = {max_batch?: number | undefined, min_age?: string | undefined}; export type CreateApiNodesReindexOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reindex all nodes for searching. * * POST /nodes/reindex */ export const createApiNodesReindex = async (args: CreateApiNodesReindexArgs, options?: CreateApiNodesReindexOptions) => { const {baseUrl = "https://api.comfy.org", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.max_batch != null) query.append("max_batch", String(args.max_batch)) if (args.min_age != null) query.append("min_age", String(args.min_age)) const url = `${baseUrl.replace(/\/+$/, '')}/nodes/reindex${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };