export type UpdateNoteLabelDto = {name?: string | undefined, colorHex?: string | undefined}; export type UpdateApiLabelsNoteIdArgs = {id: string, body: UpdateNoteLabelDto}; export type UpdateApiLabelsNoteIdOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update note label * * PUT /labels/note/{id} */ export const updateApiLabelsNoteId = async (args: UpdateApiLabelsNoteIdArgs, options: UpdateApiLabelsNoteIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/labels/note/${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 };