export type LastName = string; export type FirstName = string; export type PhoneNumber = string; export type WhatIDo = string; export type BeezUPTimeZoneId = number; export type PersonalInfo = {lastName: LastName, firstName: FirstName, phoneNumber: PhoneNumber, whatIDo?: WhatIDo | undefined, beezUPTimeZoneId: BeezUPTimeZoneId}; export type UpdateApiV2UserCustomerAccountPersonalInfoArgs = {body: PersonalInfo}; export type UpdateApiV2UserCustomerAccountPersonalInfoOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Save user personal information * * PUT /v2/user/customer/account/personalInfo */ export const updateApiV2UserCustomerAccountPersonalInfo = async (args: UpdateApiV2UserCustomerAccountPersonalInfoArgs, options?: UpdateApiV2UserCustomerAccountPersonalInfoOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/customer/account/personalInfo${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 };