export type UpdateListItemRequest = {name?: string | undefined, parentId?: number | undefined}; export type UpdateApiCompanyNamedListsListNameItemIdArgs = {listName: string, itemId: string, body: UpdateListItemRequest}; export type UpdateApiCompanyNamedListsListNameItemIdOptions = {baseUrl?: string | undefined, Basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update an existing item from a list. * * PUT /company/named-lists/{listName}/{itemId} * * Also accepts auth: Bearer */ export const updateApiCompanyNamedListsListNameItemId = async (args: UpdateApiCompanyNamedListsListNameItemIdArgs, options?: UpdateApiCompanyNamedListsListNameItemIdOptions) => { const {baseUrl = "https://api.hibob.com/v1", fetch: fetchFn = fetch, Basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Basic !== undefined) headers.set('authorization', `Basic ${btoa(`${Basic.username}:${Basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/company/named-lists/${encodeURIComponent(String(args.listName))}/${encodeURIComponent(String(args.itemId))}${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 };