export type NoteRequest = {content: string, leadId: number, isPin: boolean}; export type UpdateApiV10NotesNoteIdArgs = {noteId: number, Authorization: string, 'Content-Type': string, body: NoteRequest}; export type UpdateApiV10NotesNoteIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Note * * PUT /v1.0/notes/{noteId} */ export const updateApiV10NotesNoteId = async (args: UpdateApiV10NotesNoteIdArgs, options?: UpdateApiV10NotesNoteIdOptions) => { const {baseUrl = "https://api.lofty.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1.0/notes/${encodeURIComponent(String(args.noteId))}${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 };