code: public BoxCollaboration.Info collaborate(BoxCollaborator collaborator, BoxCollaboration.Role role) {
          JsonObject accessibleByField = new JsonObject();
          accessibleByField.add("id", collaborator.getID());
  
          if (collaborator instanceof BoxUser) {
              accessibleByField.add("type", "user");
          } else if (collaborator instanceof BoxGroup) {
              accessibleByField.add("type", "group");
          } else {
              throw new IllegalArgumentException("The given collaborator is of an unknown type.");
          }
  
          return this.collaborate(accessibleByField, role, null, null);
      }
docs: Adds a collaborator to this folder.
  
  @param collaborator the collaborator to add.
  @param role         the role of the collaborator.
  @return info about the new collaboration.