createGroup

abstract suspend fun createGroup(@Size(min = 0, max = 255) name: String?, @Size(min = 0, max = 255) description: String?): RainbowResult<Group>

Creates a new group with the specified name and description.

This method allows the creation of a new group by providing a name and an optional description. The result is returned as a RainbowResult, containing either the newly created Group or an error in case of failure.

Validation Rules:

  • name must be between 1 and 255 characters. If null or empty, the operation will fail.

  • description (optional) must not exceed 255 characters.

Behavior:

  • If the provided name is invalid, the function returns a Failure with an appropriate error message.

  • If the group is successfully created, it is added to the groups property.

Return

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

Parameters

name

The name of the group. Must be between 1 and 255 characters. If null or empty, the operation fails.

description

An optional description for the group, up to 255 characters.