export type DeviceId = string; export type LocationTrackerId = string; export type DeleteApiLocationHistoryDeviceIdIdArgs = {deviceId: DeviceId, id: LocationTrackerId}; export type DeleteApiLocationHistoryDeviceIdIdOptions = {baseUrl?: string | undefined, SimpleToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * DeleteLocationHistory * * DELETE /location/history/{deviceId}/{id} * * Also accepts auth: Organization Auth Token */ export const deleteApiLocationHistoryDeviceIdId = async (args: DeleteApiLocationHistoryDeviceIdIdArgs, options?: DeleteApiLocationHistoryDeviceIdIdOptions) => { 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(/\/+$/, '')}/location/history/${encodeURIComponent(String(args.deviceId))}/${encodeURIComponent(String(args.id))}${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 };