export type DeleteApiThingsThingUIDArgs = {'Accept-Language'?: string | undefined, thingUID: string, force?: boolean | undefined}; export type DeleteApiThingsThingUIDOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Removes a thing from the registry. Set 'force' to __true__ if you want the thing to be removed immediately. * * DELETE /things/{thingUID} */ export const deleteApiThingsThingUID = async (args: DeleteApiThingsThingUIDArgs, options: DeleteApiThingsThingUIDOptions) => { 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 (args.force != null) query.append("force", String(args.force)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/things/${encodeURIComponent(String(args.thingUID))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };