export type DeviceId = string; export type DeleteApiDevicesDeviceIdArgs = {deviceId: DeviceId}; export type DeleteApiDevicesDeviceIdOptions = {baseUrl?: string | undefined, SimpleToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * DeleteDevice * * DELETE /devices/{deviceId} */ export const deleteApiDevicesDeviceId = async (args: DeleteApiDevicesDeviceIdArgs, options?: DeleteApiDevicesDeviceIdOptions) => { const {baseUrl = "https://api.nrfcloud.com/v1", fetch: fetchFn = fetch, SimpleToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (SimpleToken !== undefined) headers.set('authorization', `Bearer ${SimpleToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/devices/${encodeURIComponent(String(args.deviceId))}${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 };