export type UpdateApiApiContainerSettingsV1AppAppIdSettingsSettingNameArgs = {body: {data: {id: 'automatic_scroll_tracking', type: 'container/app/setting', attributes: {value: {is_enabled: boolean, thresholds: Array}}} | {id: 'spa_tracking', type: 'container/app/setting', attributes: {value: {is_enabled: boolean}}} | {id: 'container_js_path', type: 'container/app/setting', attributes: {value: unknown}} | {id: 'fpc', type: 'container/app/setting', attributes: {value: {is_enabled: boolean}}} | {id: 'secure_cookies', type: 'container/app/setting', attributes: {value: {is_enabled: boolean}}} | {id: 'static_resources_domain', type: 'container/app/setting', attributes: {value: string}} | {id: 'tracking_domain', type: 'container/app/setting', attributes: {value: string}} | {id: 'tracking_script_path', type: 'container/app/setting', attributes: {value: unknown}} | {id: 'tracking_endpoint_path', type: 'container/app/setting', attributes: {value: unknown}} | {id: 'ui_apis_domain', type: 'container/app/setting', attributes: {value: string}}}}; export type UpdateApiApiContainerSettingsV1AppAppIdSettingsSettingNameOptions = {baseUrl?: string | undefined, OAuth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Modify App's container setting * * PUT /api/container-settings/v1/app/{app_id}/settings/{setting_name} */ export const updateApiApiContainerSettingsV1AppAppIdSettingsSettingName = async (args: UpdateApiApiContainerSettingsV1AppAppIdSettingsSettingNameArgs, options?: UpdateApiApiContainerSettingsV1AppAppIdSettingsSettingNameOptions) => { const {baseUrl = "https://example.piwik.pro", fetch: fetchFn = fetch, OAuth2ClientCredentials} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") if (OAuth2ClientCredentials !== undefined) headers.set('authorization', `Bearer ${OAuth2ClientCredentials}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/container-settings/v1/app/${encodeURIComponent(String(args.app_id))}/settings/${encodeURIComponent(String(args.setting_name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 undefined };