export type UpdateApiThingsThingUIDFirmwareFirmwareVersionArgs = {'Accept-Language'?: string | undefined, thingUID: string, firmwareVersion: string}; export type UpdateApiThingsThingUIDFirmwareFirmwareVersionOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update thing firmware. * * PUT /things/{thingUID}/firmware/{firmwareVersion} */ export const updateApiThingsThingUIDFirmwareFirmwareVersion = async (args: UpdateApiThingsThingUIDFirmwareFirmwareVersionArgs, options: UpdateApiThingsThingUIDFirmwareFirmwareVersionOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/things/${encodeURIComponent(String(args.thingUID))}/firmware/${encodeURIComponent(String(args.firmwareVersion))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };