export type DeleteApiFleetsFidRemoteCallbacksCbidArgs = {fid: string, cbid: string}; export type DeleteApiFleetsFidRemoteCallbacksCbidOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, ClientId?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an existing callback. * * DELETE /fleets/{fid}/remote/callbacks/{cbid} */ export const deleteApiFleetsFidRemoteCallbacksCbid = async (args: DeleteApiFleetsFidRemoteCallbacksCbidArgs, options?: DeleteApiFleetsFidRemoteCallbacksCbidOptions) => { const {baseUrl = "https://api-cert.groupe-psa.com/connectedcar/v3", fetch: fetchFn = fetch, BasicAuth, ClientId} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) if (ClientId !== undefined) query.set("client_id", ClientId) const url = `${baseUrl.replace(/\/+$/, '')}/fleets/${encodeURIComponent(String(args.fid))}/remote/callbacks/${encodeURIComponent(String(args.cbid))}${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 };