export type CustomDataUpdateIO = {adobeAnalyticsVariableName?: string | undefined, advancedProposedValues?: string | undefined, customEvalCode?: string | undefined, description?: string | undefined, gtmVariableName?: string | undefined, isConstant?: boolean | undefined, isFiltrableVentilable?: boolean | undefined, isLocalOnly?: boolean | undefined, learnable?: boolean | undefined, method?: ('ADOBE_ANALYTICS' | 'CLIENT' | 'CUSTOM_CODE' | 'GTM' | 'SDK' | 'TC' | 'TEALIUM') | undefined, name?: string | undefined, tags?: string | undefined, tcVariableName?: string | undefined, tealiumVariableName?: string | undefined, type?: ('BOOLEAN' | 'COUNT_LIST' | 'LIST' | 'NUMBER' | 'STRING' | 'UNIQUE') | undefined}; export type PatchApiCustomDatasCustomDataIdArgs = {customDataId: number, optionalFields?: Array | undefined, body: CustomDataUpdateIO}; export type PatchApiCustomDatasCustomDataIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Partially update the custom data * * PATCH /custom-datas/{customDataId} */ export const patchApiCustomDatasCustomDataId = async (args: PatchApiCustomDatasCustomDataIdArgs, options?: PatchApiCustomDatasCustomDataIdOptions) => { 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', "*/*") for (const item of args.optionalFields ?? []) query.append("optionalFields", String(item)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/custom-datas/${encodeURIComponent(String(args.customDataId))}${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() };