export type DeleteApiDataServicesDeleteSubscriptionArgs = {subscriptionId: string}; export type DeleteApiDataServicesDeleteSubscriptionOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * $viva->dataServices->deleteSubscription() * * DELETE /DataServices/deleteSubscription */ export const deleteApiDataServicesDeleteSubscription = async (args: DeleteApiDataServicesDeleteSubscriptionArgs, options: DeleteApiDataServicesDeleteSubscriptionOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.subscriptionId != null) query.append("subscriptionId", String(args.subscriptionId)) const url = `${baseUrl.replace(/\/+$/, '')}/DataServices/deleteSubscription${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 };