export type Coordinates = {latitude?: number | undefined, longitude?: number | undefined}; export type Location = {countryName?: string | undefined, countryCode?: string | undefined, stateName?: string | undefined, stateCode?: string | undefined, city?: string | undefined, street?: string | undefined, postalCode?: string | undefined, continent?: string | undefined, regionName?: string | undefined, timeZone?: string | undefined, coordinates?: Coordinates | undefined}; export type ChannelMetric = {groupId?: string | undefined, channel?: number | undefined, environment?: number | undefined, firstSeenDate?: number | undefined, lastSeenDate?: number | undefined}; export type UserAgent = {rawUserAgent?: string | undefined, device?: string | undefined, platformType?: string | undefined, platformVersion?: string | undefined, browserType?: string | undefined, browserVersion?: string | undefined}; export type UserAgentByProduct = {propertyKey?: string | undefined, userAgent?: UserAgent | undefined}; export type User = {aptrinsicId?: string | undefined, identifyId: string, type?: ('LEAD' | 'USER' | 'VISITOR' | 'EMPTY_USER_TYPE') | undefined, gender?: ('MALE' | 'FEMALE' | 'OTHER' | 'EMPTY_GENDER') | undefined, email?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, lastSeenDate?: number | undefined, signUpDate?: number | undefined, firstVisitDate?: number | undefined, title?: string | undefined, phone?: string | undefined, score?: number | undefined, role?: string | undefined, subscriptionId?: string | undefined, accountId?: string | undefined, numberOfVisits?: number | undefined, location?: Location | undefined, propertyKeys: Array, createDate?: number | undefined, lastModifiedDate?: number | undefined, customAttributes?: Record | undefined, globalUnsubscribe?: boolean | undefined, sfdcContactId?: string | undefined, channelMetricList?: Array | undefined, lastVisitedUserAgentData?: Array | undefined, id?: string | undefined, lastInferredLocation?: Location | undefined, globalId?: string | undefined}; export type UpdateApiV1UsersUpdateArgs = {body: User}; export type UpdateApiV1UsersUpdateOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update user (identifyId passed via request body) * * PUT /v1/users/update */ export const updateApiV1UsersUpdate = async (args: UpdateApiV1UsersUpdateArgs, options?: UpdateApiV1UsersUpdateOptions) => { const {baseUrl = "https://app.aptrinsic.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v1/users/update${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 res.blob() };