export type PatchApiApiAppsV2AppIdArgs = {app_id: string, body: {data?: ({type?: string | undefined, id?: string | undefined, attributes?: ({name?: string | undefined, urls?: Array | undefined, timezone?: string | undefined, currency?: string | undefined, excludeUnknownUrls?: boolean | undefined, keepUrlFragment?: boolean | undefined, eCommerceTracking?: boolean | undefined, siteSearchTracking?: boolean | undefined, siteSearchQueryParams?: Array | undefined, siteSearchCategoryParams?: Array | undefined, delay?: number | undefined, excludedIps?: Array | undefined, excludedUrlParams?: Array | undefined, excludedUserAgents?: Array | undefined, gdpr?: boolean | undefined, gdprUserModeEnabled?: boolean | undefined, privacyCookieDomainsEnabled?: boolean | undefined, privacyCookieExpirationPeriod?: number | undefined, privacyCookieDomains?: Array | undefined, gdprLocationRecognition?: boolean | undefined, gdprDataAnonymization?: boolean | undefined, sharepointIntegration?: boolean | undefined, gdprDataAnonymizationMode?: ('no_device_storage' | 'session_cookie_id') | undefined, privacyUseCookies?: boolean | undefined, privacyUseFingerprinting?: boolean | undefined, cnil?: boolean | undefined, sessionIdStrictPrivacyMode?: boolean | undefined, realTimeDashboards?: boolean | undefined, cmp?: ('piwik' | 'cookie_information' | null) | undefined}) | undefined}) | undefined}}; export type PatchApiApiAppsV2AppIdOptions = {baseUrl?: string | undefined, OAuth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * App edit * * PATCH /api/apps/v2/{app_id} */ export const patchApiApiAppsV2AppId = async (args: PatchApiApiAppsV2AppIdArgs, options?: PatchApiApiAppsV2AppIdOptions) => { 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/apps/v2/${encodeURIComponent(String(args.app_id))}${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 };