export type Scenario = {id?: number | undefined, scenarioConfiguration?: ('NO_OTHER_PERSO' | 'AT_LEAST_ONE_OTHER_PERSO' | 'NUMBER_OF_OTHER_PERSOS' | 'ALL_OTHER_PERSOS' | 'ID_PERSO') | undefined, scenarioDisplayOthersPersos?: boolean | undefined, scenarioDisplayPerso?: boolean | undefined, scenarioIdPerso?: number | undefined, scenarioNumberOtherPersos?: number | undefined, scenarioNumberOtherPersosMatchType?: ('EQUAL' | 'GREATER' | 'LOWER' | 'GREATER_THAN_EQUAL' | 'LOWER_THAN_EQUAL') | undefined, scenarioVisitsConfiguration?: ('SAME_PAGE' | 'CURRENT_VISIT' | 'PREVIOUS_VISIT' | 'ALL_VISITS') | undefined}; export type TargetingRule = {id?: number | undefined, segmentConfiguration?: ('ALL_VISITORS' | 'AUTOPROMO_AUTODEFINED' | 'GRAPHICAL_PAGES' | 'HEAT_SLICE' | 'PAGE' | 'SAVED_TEMPLATE' | 'SITE' | 'URL') | undefined, segmentId?: number | undefined, siteId: number, targetingConfigurationParam?: string | undefined, triggerConfiguration?: ('ALL_VISITORS' | 'AUTOPROMO_AUTODEFINED' | 'GRAPHICAL_PAGES' | 'HEAT_SLICE' | 'PAGE' | 'SAVED_TEMPLATE' | 'SITE' | 'URL') | undefined, triggerId?: number | undefined}; export type PersonalizationUpdateIO = {baseURL?: string | undefined, cssCode?: string | undefined, description?: string | undefined, globalScript?: string | undefined, isArchived?: boolean | undefined, javaScriptCode?: string | undefined, mainGoalId?: string | undefined, metaReadOnly?: string | undefined, name?: string | undefined, scenarios?: Array | undefined, tags?: Array | undefined, targetingRule?: TargetingRule | undefined}; export type PatchApiPersonalizationsPersonalizationIdArgs = {personalizationId: number, action?: ('ACTIVATE' | 'PAUSE' | 'RESUME' | 'STOP' | 'SCHEDULE' | 'DEACTIVATE' | 'REVERT_TO_DRAFT') | undefined, body: PersonalizationUpdateIO}; export type PatchApiPersonalizationsPersonalizationIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Partially update personalization * * PATCH /personalizations/{personalizationId} */ export const patchApiPersonalizationsPersonalizationId = async (args: PatchApiPersonalizationsPersonalizationIdArgs, options?: PatchApiPersonalizationsPersonalizationIdOptions) => { const {baseUrl = "https://api.kameleoon.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.action != null) query.append("action", String(args.action)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/personalizations/${encodeURIComponent(String(args.personalizationId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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() };