export type DeleteApiAudiencesAudienceIdSegmentsSegmentIdArgs = {audienceId: number, segmentId: number}; export type DeleteApiAudiencesAudienceIdSegmentsSegmentIdOptions = {baseUrl?: string | undefined, TdApikeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete segment (legacy) * * DELETE /audiences/{audienceId}/segments/{segmentId} */ export const deleteApiAudiencesAudienceIdSegmentsSegmentId = async (args: DeleteApiAudiencesAudienceIdSegmentsSegmentIdArgs, options?: DeleteApiAudiencesAudienceIdSegmentsSegmentIdOptions) => { const {baseUrl = "https://api-cdp.treasuredata.com", fetch: fetchFn = fetch, TdApikeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (TdApikeyAuth !== undefined) headers.set("Authorization", TdApikeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/audiences/${encodeURIComponent(String(args.audienceId))}/segments/${encodeURIComponent(String(args.segmentId))}${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 };