export type DeleteApiApiV5PhoneDevicesArgs = {fcm_token: string}; export type DeleteApiApiV5PhoneDevicesOptions = {baseUrl?: string | undefined, RWAPIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove phone device * * DELETE /api/v5/phone-devices/ */ export const deleteApiApiV5PhoneDevices = async (args: DeleteApiApiV5PhoneDevicesArgs, options?: DeleteApiApiV5PhoneDevicesOptions) => { const {baseUrl = "https://api.pavlok.com", fetch: fetchFn = fetch, RWAPIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.fcm_token != null) query.append("fcm_token", String(args.fcm_token)) if (RWAPIKeyHeader !== undefined) headers.set("Authorization", RWAPIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/api/v5/phone-devices/${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 };