export type Address = {address1?: string | undefined, address2?: string | undefined, address3?: string | undefined, address4?: string | undefined, address5?: string | undefined, address6?: string | undefined, address7?: string | undefined, zip?: string | undefined, city?: string | undefined, country_code?: string | undefined}; export type GPSCoordinates = {gps_longitude: number, gps_latitude: number}; export type TimeInterval = {from: string, to: string}; export type OpeningDay = {day_id: string, time_intervals: Array}; export type Store = {store_id: string, store_code: string, name: string, store_address?: Address | undefined, contact_email?: string | undefined, manager_name?: string | undefined, phone_number?: string | undefined, partner_id: string, system_id: string, gps_coordinates?: GPSCoordinates | undefined, url_address?: string | undefined, opening?: Array | undefined, image_urls?: Array | undefined, visibility_for_customer?: (0 | 1) | undefined, short_description?: string | undefined, description?: string | undefined, registration_id?: string | undefined, last_change?: string | undefined, state?: (0 | 1 | 2) | undefined}; export type UpdateApiStoresStoreIdArgs = {'Accept-Language'?: string | undefined, store_id: string, body: {store: Store}}; export type UpdateApiStoresStoreIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a store * * PUT /stores/{store_id} * * Also accepts auth: basicAuth */ export const updateApiStoresStoreId = async (args: UpdateApiStoresStoreIdArgs, options?: UpdateApiStoresStoreIdOptions) => { const {baseUrl = "https://sandbox.crmcarecloud.com/webservice/rest-api/enterprise-interface/v1.0", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/stores/${encodeURIComponent(String(args.store_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 };