export type UpdateApiLinksPageIdArgs = {id: string, body: {prompt: string}}; export type UpdateApiLinksPageIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Regenerate AI page * * PUT /links/page/{id} */ export const updateApiLinksPageId = async (args: UpdateApiLinksPageIdArgs, options?: UpdateApiLinksPageIdOptions) => { const {baseUrl = "https://api.short.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/links/page/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };