export type UpdateApiThingsThingUIDEnableArgs = {'Accept-Language'?: string | undefined, thingUID: string, body: BodyInit}; export type UpdateApiThingsThingUIDEnableOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sets the thing enabled status. * * PUT /things/{thingUID}/enable */ export const updateApiThingsThingUIDEnable = async (args: UpdateApiThingsThingUIDEnableArgs, options: UpdateApiThingsThingUIDEnableOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "text/plain") headers.set('accept', "*/*") 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))}/enable${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };