export type CreateApiTargetingSegmentsTaxonomyUploadApplyArgs = {body: BodyInit}; export type CreateApiTargetingSegmentsTaxonomyUploadApplyOptions = {baseUrl?: string | undefined, Auth0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Apply Taxonomy Upload * * POST /targeting_segments/taxonomy_upload/apply */ export const createApiTargetingSegmentsTaxonomyUploadApply = async (args: CreateApiTargetingSegmentsTaxonomyUploadApplyArgs, options?: CreateApiTargetingSegmentsTaxonomyUploadApplyOptions) => { const {baseUrl = "https://api.mediamath.com/api/v3.0", fetch: fetchFn = fetch, Auth0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/csv") if (Auth0 !== undefined) headers.set('authorization', `Bearer ${Auth0}`) const url = `${baseUrl.replace(/\/+$/, '')}/targeting_segments/taxonomy_upload/apply${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };