addContactsToGroup

abstract suspend fun addContactsToGroup(groupId: String?, contactIds: List<String?>): RainbowResult<Unit>

Adds multiple contacts to a specific group.

This method adds a list of contacts, identified by contactIds, to a group specified by groupId. The result is returned as a RainbowResult, indicating success or failure. Upon success, the group's details are updated in the groups property.

Validation Rules:

  • groupId must not be null or empty.

  • contactIds must not be empty. Null or empty IDs within the list will be ignored.

Behavior:

  • If groupId is null or empty, the function returns a Failure with an appropriate error message.

  • If contactIds is empty, the function fails with an error.

  • If all contacts are successfully added, a RainbowResult success is returned.

  • If some contacts fail to be added, a Failure containing a list of errors is returned.

Return

A RainbowResult indicating success or failure (list of errors).

Parameters

groupId

The unique identifier of the group to which the contacts will be added. Must not be null or empty.

contactIds

A list of unique identifiers for the contacts to add. Must not be empty after filtering out null/empty values.