export type EaseeCloudAPILifetimeEnergyMeasurementSettingsRequest = {intervalInMinutes?: number | undefined, alsoSendWhenNotCharging?: boolean | undefined}; export type UpdateApiApiChargersLifetimeEnergyChargerIdConfigureArgs = {chargerId: string, body: EaseeCloudAPILifetimeEnergyMeasurementSettingsRequest}; export type UpdateApiApiChargersLifetimeEnergyChargerIdConfigureOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Configure energy measurements * * PUT /api/chargers/lifetime-energy/{chargerId}/configure */ export const updateApiApiChargersLifetimeEnergyChargerIdConfigure = async (args: UpdateApiApiChargersLifetimeEnergyChargerIdConfigureArgs, options?: UpdateApiApiChargersLifetimeEnergyChargerIdConfigureOptions) => { const {baseUrl = "https://api.easee.com", 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) const url = `${baseUrl.replace(/\/+$/, '')}/api/chargers/lifetime-energy/${encodeURIComponent(String(args.chargerId))}/configure${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 };