export type ProfileRequest = {trainee_name?: string | undefined, display_name?: string | undefined, self_introduction?: string | undefined}; export type UpdateApiProfileTraineeIdArgs = {trainee_id: string, body: ProfileRequest}; export type UpdateApiProfileTraineeIdOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * API006 プロフィール更新 * * PUT /profile/{trainee_id} */ export const updateApiProfileTraineeId = async (args: UpdateApiProfileTraineeIdArgs, options: UpdateApiProfileTraineeIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/profile/${encodeURIComponent(String(args.trainee_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 };