export type DeleteApiAccountDatasetsDatasetArgs = {account: string, dataset: string}; export type DeleteApiAccountDatasetsDatasetOptions = {baseUrl?: string | undefined, accessTokenAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete a Dataset * * DELETE /{account}/datasets/{dataset} */ export const deleteApiAccountDatasetsDataset = async (args: DeleteApiAccountDatasetsDatasetArgs, options?: DeleteApiAccountDatasetsDatasetOptions) => { const {baseUrl = "https://modeanalytics.com/api", fetch: fetchFn = fetch, accessTokenAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (accessTokenAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${accessTokenAuth.username}:${accessTokenAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.account))}/datasets/${encodeURIComponent(String(args.dataset))}${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 };