export type PatchApiApiTrackerV1SettingsAppGlobalArgs = {body: {data: {type: 'tracker/settings/app/global', id: 'global', attributes: {updated_at?: string | undefined, anonymize_visitor_ip_level: unknown, excluded_ips?: Array | undefined, excluded_url_params?: Array | undefined, excluded_user_agents?: Array | undefined, site_search_query_params?: Array | undefined, site_search_category_params?: Array | undefined, visitor_geolocation_based_on_anonymized_ip?: boolean | undefined}}}}; export type PatchApiApiTrackerV1SettingsAppGlobalOptions = {baseUrl?: string | undefined, OAuth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Edit global, tracker related settings of apps * * PATCH /api/tracker/v1/settings/app/global */ export const patchApiApiTrackerV1SettingsAppGlobal = async (args: PatchApiApiTrackerV1SettingsAppGlobalArgs, options?: PatchApiApiTrackerV1SettingsAppGlobalOptions) => { 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/tracker/v1/settings/app/global${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 undefined };