User Manager for profile management, consent handling, and identity verification
User Manager for profile management, consent handling, and identity verification. Provides methods for managing user data, including FHIR Consent.
Methods
getProfile()
getProfile():
Promise<BWellQueryResult<Person,BaseManagerError>>
Retrieves the current user's profile information. Gets demographic data for the authenticated user.
Returns
Promise<BWellQueryResult<Person, BaseManagerError>>
- The user's profile information
Example
const profile = await sdk.user.getProfile();delete()
delete():
Promise<BWellTransactionResult<null,BaseManagerError>>
Deletes the current user's account and all associated data. Permanently removes the user from the system.
Returns
Promise<BWellTransactionResult<null, BaseManagerError>>
- The result of the deletion operation
Example
await sdk.user.delete();updateProfile()
updateProfile(
request):Promise<BWellTransactionResult<Person,BaseManagerError>>
Updates the user's profile information. Modifies demographic data for the authenticated user.
Parameters
request
Request class instance containing the profile fields to update
Returns
Promise<BWellTransactionResult<Person, BaseManagerError>>
- The updated user profile
Example
await sdk.user.updateProfile(
new UpdateProfileRequest({
firstName: 'John',
lastName: 'Doe'
})
);getConsents()
getConsents(
request?):Promise<BWellQueryResult<ConsentBundle,BaseManagerError>>
Retrieves a list of consents for the current user, optionally filtered by category.
Parameters
request?
Optional request class instance to filter consents by category
Returns
Promise<BWellQueryResult<ConsentBundle, BaseManagerError>>
- A promise that resolves to a query result containing a bundle of consents
Example
const consents = await sdk.user.getConsents(
new GetConsentsRequest({
category: 'research'
})
);createConsent()
createConsent(
request):Promise<BWellTransactionResult<Consent,BaseManagerError|ValidationError>>
Creates a new user consent. Stores consent preferences for the authenticated user.
Parameters
request
Request class instance containing the consent details to create
Returns
Promise<BWellTransactionResult<Consent, BaseManagerError | ValidationError>>
- The created consent object
Example
await sdk.user.createConsent(
new CreateConsentRequest({
status: 'active',
provision: 'permit',
category: 'research'
})
);createVerificationUrl()
createVerificationUrl(
request):Promise<BWellTransactionResult<string,BaseManagerError>>
Creates a verification URL for identity verification. Generates a URL for IAL2 verification flow.
Parameters
request
Request class instance containing verification URL configuration including callback URL
Returns
Promise<BWellTransactionResult<string, BaseManagerError>>
- The generated verification URL
Example
const verificationUrl = await sdk.user.createVerificationUrl(
new CreateVerificationUrlRequest({
callbackUrl: 'https://myapp.com/callback'
})
);getVerificationStatus()
getVerificationStatus():
Promise<BWellTransactionResult<VerificationResult,BaseManagerError>>
Retrieves the user's identity verification status. Gets the current state of IAL2 verification.
Returns
Promise<BWellTransactionResult<VerificationResult, BaseManagerError>>
- The user's current verification status
Example
const status = await sdk.user.getVerificationStatus();createDataExportDirectDownloadUrl()
createDataExportDirectDownloadUrl(
request):Promise<BWellTransactionResult<null|string,BaseManagerError>>
Generates a URL to download exported user data. Requires a data export and associated web-hook to be set up first (see docs). Please reach out to bwell customer support for further details.
Parameters
request
CreateDataExportDirectDownloadUrlRequest
Request class instance containing export ID and password for data export access
Returns
Promise<BWellTransactionResult<null | string, BaseManagerError>>
- The generated download URL or null if not available
Example
const downloadUrl = await sdk.user.createDataExportDirectDownloadUrl(
new CreateDataExportDirectDownloadUrlRequest({
exportId: 'export123',
password: 'securePassword'
})
);