Skip to main content
Version: 11.14.0

User Profile

The User Profile module (v2 API) provides functions to manage user profiles stored on the backend. It supports full CRUD operations on profile data and individual properties.

Types

UserProfile

type UserProfile = {
data: UserProfileData;
customData?: Record<string, unknown>;
created?: string;
modified?: string;
};
PropertyTypeRequiredDescription
dataUserProfileDataMain static profile fields
customDataRecord<string, unknown>Arbitrary custom data
createdstringProfile creation date
modifiedstringProfile last modification date

UserProfileData

type UserProfileData = {
id: string;
mail: string;
fullName: string;
jobTitle?: string;
group?: string;
organisation?: string;
location?: string;
profilePhoto?: string;
skills?: string;
};
PropertyTypeRequiredDescription
idstringUser identifier
mailstringE-mail address
fullNamestringFull name
jobTitlestringJob title (e.g. Product Owner)
groupstringCompany group (e.g. R&D)
organisationstringOrganisation name
locationstringLocation
profilePhotostringProfile photo URL
skillsstringList of skills

Functions

fetchUserProfile()

Fetches the profile for a given user ID.

Parameters

ParameterTypeRequiredDescription
userIdstringUnique identifier of the user

Returns Promise<UserProfile> — the user's profile.

Example

fetch-user-profile.ts
import { fetchUserProfile } from '@sinequa/atomic';

const profile = await fetchUserProfile('user123');
console.log(profile.data.fullName);

createUserProfile()

Creates a new user profile.

Parameters

ParameterTypeRequiredDescription
userProfilePartial<UserProfile>Profile data to create. Must include data.id.

Returns Promise<UserProfile> — the created profile as returned by the API.

Example

create-user-profile.ts
import { createUserProfile } from '@sinequa/atomic';

const newProfile = await createUserProfile({
data: { id: 'user123', mail: 'john@example.com', fullName: 'John Doe' }
});
console.log(newProfile);

patchUserProfile()

Updates a specific property within a user profile category.

Parameters

ParameterTypeRequiredDescription
userProfilePartial<Omit<UserProfile, 'created' | 'modified'>>Profile data to update. Must include data.id.
categorystringThe category of the property to update (e.g. 'data', 'customData')
propertyNamestringThe name of the specific property to update within the category

Returns Promise<UserProfile> — the updated profile.

Example

patch-user-profile.ts
import { patchUserProfile } from '@sinequa/atomic';

const updated = await patchUserProfile(
{ data: { id: 'user123', mail: 'john@example.com', fullName: 'Jane Doe' } },
'data',
'fullName'
);
console.log(updated.data.fullName); // 'Jane Doe'

deleteUserProfileProperty()

Deletes a specific property from a user profile category.

Parameters

ParameterTypeRequiredDescription
userProfilePartial<Omit<UserProfile, 'created' | 'modified'>>Profile data. Must include data.id.
categorystringThe category of the property to delete
propertyNamestringThe name of the property to delete within the category

Returns Promise<boolean>true if the property was deleted, false otherwise.

Example

delete-user-profile-property.ts
import { deleteUserProfileProperty } from '@sinequa/atomic';

const deleted = await deleteUserProfileProperty(
{ data: { id: 'user123', mail: 'john@example.com', fullName: 'John Doe' } },
'customData',
'preferredTheme'
);
console.log(deleted); // true