export type CreateApi30AudiencesAudienceIdContactsContactIdActionsArchiveArgs = {audience_id: string, contact_id: string}; export type CreateApi30AudiencesAudienceIdContactsContactIdActionsArchiveOptions = {baseUrl?: string | undefined, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Archive Contact * * POST /3.0/audiences/{audience_id}/contacts/{contact_id}/actions/archive * * Also accepts auth: oauth2 */ export const createApi30AudiencesAudienceIdContactsContactIdActionsArchive = async (args: CreateApi30AudiencesAudienceIdContactsContactIdActionsArchiveArgs, options?: CreateApi30AudiencesAudienceIdContactsContactIdActionsArchiveOptions) => { 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/audiences/${encodeURIComponent(String(args.audience_id))}/contacts/${encodeURIComponent(String(args.contact_id))}/actions/archive${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };