fetchGroupById

abstract suspend fun fetchGroupById(groupId: String?): RainbowResult<Group>

Fetches a group by its unique ID.

Retrieves the details of a specific group identified by the given groupId. The returned RainbowResult contains either a Group object with all relevant information (including members, name, and other properties) or an error in case of failure.

Behavior:

  • If groupId is null or empty, the method returns an error wrapped in a Failure object.

  • If the group exists in the local cache (groups property), its information is updated with the newly fetched data.

  • Otherwise, the fetched group is added to the groups property.

This method is useful for retrieving the details of a specific group, such as when navigating to a group's details screen or performing actions based on a group's information.

Return

A RainbowResult containing the fetched Group on success or an error on failure.

Parameters

groupId

The unique identifier of the group to fetch. If null or empty, the function returns an error.