export type SystemUserUpdateWithRequiredBody = {name: string}; export type PatchApiBusinessesBusinessIdSystemUsersSystemUserIdArgs = {business_id: string, system_user_id: string, body: SystemUserUpdateWithRequiredBody}; export type PatchApiBusinessesBusinessIdSystemUsersSystemUserIdOptions = {baseUrl?: string | undefined, pinterestOauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a system user information. * * PATCH /businesses/{business_id}/system_users/{system_user_id} */ export const patchApiBusinessesBusinessIdSystemUsersSystemUserId = async (args: PatchApiBusinessesBusinessIdSystemUsersSystemUserIdArgs, options?: PatchApiBusinessesBusinessIdSystemUsersSystemUserIdOptions) => { const {baseUrl = "https://api.pinterest.com/v5", fetch: fetchFn = fetch, pinterestOauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (pinterestOauth2 !== undefined) headers.set('authorization', `Bearer ${pinterestOauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/businesses/${encodeURIComponent(String(args.business_id))}/system_users/${encodeURIComponent(String(args.system_user_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };