export type DeleteApiApiV4AssetsTrackingArgs = {'equipmentIdentifier.type': string, 'equipmentIdentifier.value': string}; export type DeleteApiApiV4AssetsTrackingOptions = {baseUrl?: string | undefined, oAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Unenroll an asset for tracking. * * DELETE /api/v4/assets/tracking */ export const deleteApiApiV4AssetsTracking = async (args: DeleteApiApiV4AssetsTrackingArgs, options?: DeleteApiApiV4AssetsTrackingOptions) => { const {baseUrl = "https://na12.api.project44.com", fetch: fetchFn = fetch, oAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['equipmentIdentifier.type'] != null) query.append("equipmentIdentifier.type", String(args['equipmentIdentifier.type'])) if (args['equipmentIdentifier.value'] != null) query.append("equipmentIdentifier.value", String(args['equipmentIdentifier.value'])) if (oAuth2 !== undefined) headers.set('authorization', `Bearer ${oAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v4/assets/tracking${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 };