export type DeleteApi30ListsListIdSurveysSurveyIdArgs = {list_id: string, survey_id: string}; export type DeleteApi30ListsListIdSurveysSurveyIdOptions = {baseUrl?: string | undefined, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete survey * * DELETE /3.0/lists/{list_id}/surveys/{survey_id} * * Also accepts auth: oauth2 */ export const deleteApi30ListsListIdSurveysSurveyId = async (args: DeleteApi30ListsListIdSurveysSurveyIdArgs, options?: DeleteApi30ListsListIdSurveysSurveyIdOptions) => { const {baseUrl = "https://api.mailchimp.com", fetch: fetchFn = fetch, bearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerToken !== undefined) headers.set('authorization', `Bearer ${bearerToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/3.0/lists/${encodeURIComponent(String(args.list_id))}/surveys/${encodeURIComponent(String(args.survey_id))}${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 };