export type ComfyNodeCloudBuildInfo = {build_id?: string | undefined, location?: string | undefined, project_id?: string | undefined, project_number?: string | undefined}; export type CreateApiNodesNodeIdVersionsVersionComfyNodesArgs = {body: {cloud_build_info?: ComfyNodeCloudBuildInfo | undefined, nodes: unknown, reason?: string | undefined, status?: string | undefined, success?: boolean | undefined}}; export type CreateApiNodesNodeIdVersionsVersionComfyNodesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * create comfy-nodes for certain node * * POST /nodes/{nodeId}/versions/{version}/comfy-nodes */ export const createApiNodesNodeIdVersionsVersionComfyNodes = async (args: CreateApiNodesNodeIdVersionsVersionComfyNodesArgs, options?: CreateApiNodesNodeIdVersionsVersionComfyNodesOptions) => { const {baseUrl = "https://api.comfy.org", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/nodes/${encodeURIComponent(String(args.nodeId))}/versions/${encodeURIComponent(String(args.version))}/comfy-nodes${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };