export type Trainer = {trainer_id?: string | undefined, trainer_name?: string | undefined, unit_price?: number | undefined, business_start_at?: string | undefined, business_end_at?: string | undefined, public_mail_addr?: string | undefined, public_tel?: string | undefined, store_name?: string | undefined, gym_name?: string | undefined, star_count?: number | undefined}; export type UpdateApiTrainerArgs = {body: Trainer}; export type UpdateApiTrainerOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * API022 トレーナー属性更新 * * PUT /trainer */ export const updateApiTrainer = async (args: UpdateApiTrainerArgs, options: UpdateApiTrainerOptions) => { 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(/\/+$/, '')}/trainer${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 };