/**
  * @param User $user
  * @param string $domain
  * @param int $groupId
  * @param null|string $accessToken
  * @return User
  */
 public function addGroupMember(User $user, $domain, $groupId, $accessToken = null)
 {
     return $this->postJson($accessToken, ['id' => $user->getId()], '/workspaces/:domain/groups/:group_id/members', ['domain' => $domain, 'group_id' => $groupId])->getAsUser();
 }
 /**
  * @param User $user
  * @param string $domain
  * @param string $projectName
  * @param null|string $accessToken
  * @return User
  * @throws BuddySDKException
  */
 public function addProjectMember(User $user, $domain, $projectName, $accessToken = null)
 {
     if (!$user->getPermissionSet() instanceof PermissionSet) {
         throw new BuddySDKException('PermissionSet must be set');
     }
     return $this->postJson($accessToken, ['id' => $user->getId(), 'permission_set' => ['id' => $user->getPermissionSet()->getId()]], '/workspaces/:domain/projects/:project_name/members', ['domain' => $domain, 'project_name' => $projectName])->getAsUser();
 }