export type ExperimentImpactRequest = {goalId: number, impact?: ('POSITIVE' | 'NEGATIVE' | 'NEUTRAL') | undefined, cursor?: string | undefined, pageSize?: number | undefined}; export type CreateApiGoalCampaignExperimentsArgs = {body: ExperimentImpactRequest}; export type CreateApiGoalCampaignExperimentsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get experiments impacted by a goal * * POST /goal-campaign/experiments */ export const createApiGoalCampaignExperiments = async (args: CreateApiGoalCampaignExperimentsArgs, options?: CreateApiGoalCampaignExperimentsOptions) => { const {baseUrl = "https://api.kameleoon.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/goal-campaign/experiments${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };