createFavoriteFromContact

abstract fun createFavoriteFromContact(    contact: IRainbowContact,     position: Int? = null,     listener: RainbowListener<IRainbowFavorite, CreateFavoriteError>? = null)

Creates a new favorite entry from a contact.

This method adds a new favorite to the list based on the provided contact. Optionally, you can specify the position of the new favorite in the list with the position parameter. The position must be in the range from 0 to the current size of the favorites list. If no position is provided or if the position is out of range, the favorite will be added at the end of the list.

If a listener is provided, it will be notified with the result of the creation operation. The listener will receive an IRainbowFavorite object if the creation is successful or a CreateFavoriteError if an error occurs.

Parameters

contact

The IRainbowContact object representing the contact to be added as a favorite.

position

Optional position in the favorites list where the new favorite should be inserted. It must be in the range from 0 to the current size of the favorites list. If null or out of range, the favorite is added at the end of the list.

listener

An optional RainbowListener that will be notified with the result of the creation operation. The listener receives an IRainbowFavorite object on success or a CreateFavoriteError on failure.