add_persona_from_details


Description:

public async Persona? add_persona_from_details (Individual? parent, PersonaStore persona_store, HashTable<string,Value?> details) throws IndividualAggregatorError

Add a new persona in the given PersonaStore based on the details provided.

If the target store is offline, this function will throw IndividualAggregatorError.STORE_OFFLINE. It's the responsibility of the caller to cache details and re-try this function if it wishes to make offline adds work.

The details hash is a backend-specific mapping of key, value strings. Common keys include:

  • contact - service-specific contact ID
  • message - a user-readable message to pass to the persona being added

If a Persona with the given details already exists in the store, no error will be thrown and this function will return null.

Parameters:

parent

an optional Individual to add the new Persona to. This persona will be appended to its ordered list of personas.

persona_store

the PersonaStore to add the persona to

details

a key-value map of details to use in creating the new Persona

Returns:

the new Persona or null if the corresponding Persona already existed. If non-null, the new Persona will also be added to a new or existing Individual as necessary.

Exceptions:

IndividualAggregatorError.STORE_OFFLINE

if the persona store was offline

IndividualAggregatorError.ADD_FAILED

if any other error occurred while adding the persona

Since:

0.3.5