export type ServiceChannelServicesMessagingLocationUpdateLocationExRequest = {StoreId: string, Name: string, Latitude?: number | undefined, Longitude?: number | undefined, Distance?: number | undefined, Address1?: string | undefined, Address2?: string | undefined, City?: string | undefined, State?: string | undefined, StateId?: number | undefined, Region?: string | undefined, District?: string | undefined, Zip?: string | undefined, Country?: string | undefined, CountryId?: number | undefined, ClosedDate?: string | undefined, OpenDate?: string | undefined, Email?: string | undefined, Phone?: string | undefined, Contact?: string | undefined, FaxNumber?: string | undefined, LocationTypeId?: number | undefined, SquareValue?: number | undefined, SquareMeasure?: string | undefined}; export type UpdateApiLocationsLocationIdArgs = {locationId: number, body: ServiceChannelServicesMessagingLocationUpdateLocationExRequest}; export type UpdateApiLocationsLocationIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a location * * PUT /locations/{locationId} */ export const updateApiLocationsLocationId = async (args: UpdateApiLocationsLocationIdArgs, options?: UpdateApiLocationsLocationIdOptions) => { const {baseUrl = "https://sb2api.servicechannel.com/v3", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/locations/${encodeURIComponent(String(args.locationId))}${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 };