Skip to main content
Version: Next 🚧

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
dataUserProfileData✓Main 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
idstring✓User identifier
mailstring✓E-mail address
fullNamestring✓Full 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
userIdstring✓Unique 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.
categorystring✓The category of the property to update (e.g. 'data', 'customData')
propertyNamestring✓The 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.
categorystring✓The category of the property to delete
propertyNamestring✓The 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