class_docstr: The `Workspace` class is used to manage workspaces in Argilla. It provides
  methods to create new workspaces, add users to them, list the linked users,
  and delete users from the workspace. While it's not allowed to delete a workspace
  neither to update the workspace name.
  
  Args:
      name: the name of the workspace to be managed. Defaults to None.
      id: the ID of the workspace to be managed. Defaults to None.
  
  Attributes:
      _client: the `httpx.Client` initialized to interact with the Argilla API.
      id: the ID of the workspace.
      name: the name of the workspace.
      users: the list of users linked to the workspace. Defaults to None.
      inserted_at: the datetime when the workspace was created.
      updated_at: the datetime when the workspace was last updated.
  
  Examples:
      >>> from argilla import rg
      >>> workspace = rg.Workspace.from_name("my-workspace") # or `Workspace.from_id("...")`
      >>> workspace.add_user("my-user")
      >>> print(workspace.users)
      [UserModel(id='...', first_name='Luke', last_name="Skywalker', full_name='Luke Skywalker', username='my-user', role='annotator', workspaces=['my-workspace'], api_key='...', inserted_at=datetime.datetime(2021, 8, 31, 10, 0, 0), updated_at=datetime.datetime(2021, 8, 31, 10, 0, 0))]
      >>> workspace.delete_user("my-user")
      >>> print(workspace.users)
      []
class_docstr_tok: ["The","`","Workspace","`","class","is","used","to","manage","workspaces","in","Argilla",".","It","provides","methods","to","create","new","workspaces",",","add","users","to","them",",","list","the","linked","users",",","and","delete","users","from","the","workspace",".","While","it","'s","not","allowed","to","delete","a","workspace","neither","to","update","the","workspace","name",".","Args",":","name",":","the","name","of","the","workspace","to","be","managed",".","Defaults","to","None",".","id",":","the","ID","of","the","workspace","to","be","managed",".","Defaults","to","None",".","Attributes",":","_client",":","the","`","httpx.Client","`","initialized","to","interact","with","the","Argilla","API",".","id",":","the","ID","of","the","workspace",".","name",":","the","name","of","the","workspace",".","users",":","the","list","of","users","linked","to","the","workspace",".","Defaults","to","None",".","inserted_at",":","the","datetime","when","the","workspace","was","created",".","updated_at",":","the","datetime","when","the","workspace","was","last","updated",".","Examples",":",">",">",">","from","argilla","import","rg",">",">",">","workspace","=","rg.Workspace.from_name","(","``","my-workspace","''",")","#","or","`","Workspace.from_id","(","``","...","''",")","`",">",">",">","workspace.add_user","(","``","my-user","''",")",">",">",">","print","(","workspace.users",")","[","UserModel","(","id=","'","...","'",",","first_name='Luke","'",",","last_name=","''","Skywalker","'",",","full_name='Luke","Skywalker","'",",","username='my-user","'",",","role='annotator","'",",","workspaces=","[","'my-workspace","'","]",",","api_key=","'","...","'",",","inserted_at=datetime.datetime","(","2021",",","8",",","31",",","10",",","0",",","0",")",",","updated_at=datetime.datetime","(","2021",",","8",",","31",",","10",",","0",",","0",")",")","]",">",">",">","workspace.delete_user","(","``","my-user","''",")",">",">",">","print","(","workspace.users",")","[","]"]
docstr: Adds an existing user to the workspace in Argilla.
  
  Note that users with the `owner` role are excluded from the `add_user` method, as they
  are superusers and they can access all the workspaces and datasets in Argilla.
  
  Args:
      user_id: the ID of the user to be added to the workspace. The user must exist in Argilla.
  
  Raises:
      ValueError: if the user with the provided ID either doesn't exist in Argilla or
          already exists in the workspace.
      RuntimeError: if there was an error while either fetching the user from Argilla or
          adding the user to the workspace.
  
  Examples:
      >>> from argilla import rg
      >>> workspace = rg.Workspace.from_name("my-workspace")
      >>> workspace.add_user("my-user-id")
docstr_tok: ["Adds","an","existing","user","to","the","workspace","in","Argilla",".","Note","that","users","with","the","`","owner","`","role","are","excluded","from","the","`","add_user","`","method",",","as","they","are","superusers","and","they","can","access","all","the","workspaces","and","datasets","in","Argilla",".","Args",":","user_id",":","the","ID","of","the","user","to","be","added","to","the","workspace",".","The","user","must","exist","in","Argilla",".","Raises",":","ValueError",":","if","the","user","with","the","provided","ID","either","does","n't","exist","in","Argilla","or","already","exists","in","the","workspace",".","RuntimeError",":","if","there","was","an","error","while","either","fetching","the","user","from","Argilla","or","adding","the","user","to","the","workspace",".","Examples",":",">",">",">","from","argilla","import","rg",">",">",">","workspace","=","rg.Workspace.from_name","(","``","my-workspace","''",")",">",">",">","workspace.add_user","(","``","my-user-id","''",")"]
code: def add_user(self, user_id: UUID) -> None:
      """Adds an existing user to the workspace in Argilla.
  
      Note that users with the `owner` role are excluded from the `add_user` method, as they
      are superusers and they can access all the workspaces and datasets in Argilla.
  
      Args:
          user_id: the ID of the user to be added to the workspace. The user must exist in Argilla.
  
      Raises:
          ValueError: if the user with the provided ID either doesn't exist in Argilla or
              already exists in the workspace.
          RuntimeError: if there was an error while either fetching the user from Argilla or
              adding the user to the workspace.
  
      Examples:
          >>> from argilla import rg
          >>> workspace = rg.Workspace.from_name("my-workspace")
          >>> workspace.add_user("my-user-id")
      """
      try:
          user = User.from_id(user_id)
      except ValueError as e:
          raise ValueError(
              f"User with id=`{user_id}` doesn't exist in Argilla, so please"
              " make sure that the ID you provided is a valid one. Otherwise,"
              " you can create a new one via the `User.create` method."
          ) from e
      except RuntimeError as e:
          raise RuntimeError(
              f"Error while retrieving user with id=`{user_id}` from Argilla."
          ) from e
  
      if user.is_owner:
          warnings.warn(
              "The user you are trying to add to the workspace has the `owner` role, so it"
              " will be excluded from the workspace. Note that users with the `owner` role are"
              " superusers and they can access all the workspaces and datasets in Argilla.",
              UserWarning,
              stacklevel=2,
          )
          return
  
      try:
          workspaces_api.create_workspace_user(
              client=self._client, id=self.id, user_id=user_id
          )
      except AlreadyExistsApiError as e:
          raise ValueError(
              f"User with id=`{user_id}` already exists in workspace with id=`{self.id}`."
          ) from e
      except BaseClientError as e:
          raise RuntimeError(
              f"Error while adding user with id=`{user_id}` to workspace with id=`{self.id}`."
          ) from e
  
imports: import warnings
  from datetime import datetime
  from typing import TYPE_CHECKING, Iterator, List, Optional, Union
  from uuid import UUID
  from argilla.client.sdk.commons.errors import AlreadyExistsApiError, BaseClientError, NotFoundApiError, ValidationApiError
  from argilla.client.sdk.users.models import UserRole
  from argilla.client.sdk.v1.workspaces import api
  from argilla.client.sdk.v1.workspaces.models import WorkspaceModel
  from argilla.client.sdk.workspaces import api
  from argilla.client.sdk.workspaces.models import WorkspaceModel
  from argilla.client.singleton import active_client
  from argilla.client.users import User
  from argilla.client.utils import allowed_for_roles
label_desc: Use image node_id 4 for calling the Workspace obj's underlying member method code with example usage: obj.add_user(user_id) without return types