createFavorite

abstract fun createFavorite(    peerId: String,     type: PeerType,     position: Int? = null,     listener: RainbowListener<IRainbowFavorite, CreateFavoriteError>? = null)

Creates a new favorite entry.

This method adds a new favorite to the list, based on the provided peerId and type. 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

peerId

The unique ID of the contact or room to be added as a favorite.

type

The type of the peer, indicating whether it is a contact or a room.

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.