export type CreateApiAppCreateGSearchCreationDraftIdRebuildArgs = {draftId: number, body: {url?: (string | null) | undefined, prompt?: (string | null) | undefined, languages?: (Array | null) | undefined, locations?: (Array | null) | undefined}}; export type CreateApiAppCreateGSearchCreationDraftIdRebuildOptions = {baseUrl: string, token?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /app/create/g/searchCreation/{draftId}/rebuild */ export const createApiAppCreateGSearchCreationDraftIdRebuild = async (args: CreateApiAppCreateGSearchCreationDraftIdRebuildArgs, options: CreateApiAppCreateGSearchCreationDraftIdRebuildOptions) => { const {baseUrl, fetch: fetchFn = fetch, token} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (token !== undefined) headers.set("authorization", token) const url = `${baseUrl.replace(/\/+$/, '')}/app/create/g/searchCreation/${encodeURIComponent(String(args.draftId))}/rebuild${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 };