export type PatchApiV20ProfilesProfileIdArgs = {Accept?: ('application/json' | 'application/hal+json' | 'application/xml' | 'text/xml' | 'text/csv') | undefined, profileId: string, body: {profile?: ({prevent_data_collection?: boolean | undefined, accepted_gdpr?: boolean | undefined, privacy_policy?: Record | undefined, tasks?: Array | undefined, memories?: (Array<{id?: string | undefined, timestamp?: string | undefined, text?: string | undefined}>) | undefined, firstname?: string | undefined, lastname?: string | undefined, email?: string | undefined, profilepic?: string | undefined}) | undefined, active?: boolean | undefined, contactIds?: Array | undefined}}; export type PatchApiV20ProfilesProfileIdOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a Contact Profile * * PATCH /v2.0/profiles/{profileId} * * Also accepts auth: APIKeyQueryParam, CXoneTokenHeader, OAuth2 */ export const patchApiV20ProfilesProfileId = async (args: PatchApiV20ProfilesProfileIdArgs, options?: PatchApiV20ProfilesProfileIdOptions) => { const {baseUrl = "https://api-trial.cognigy.ai/testing", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (APIKeyHeader !== undefined) headers.set("X-API-Key", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v2.0/profiles/${encodeURIComponent(String(args.profileId))}${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 };