public async Task AddUserToGroup()

in src/YouTrackSharp/Management/UserManagementService.cs [240:260]


        public async Task AddUserToGroup(string username, string group)
        {
            var client = await _connection.GetAuthenticatedApiClient();
            
            var user = await GetUser(username);
            var apiGroups = await client.HubApiUsergroupsGetAsync("name:{" + group + "}", "id", 0, -1);
            var apiGroup = apiGroups.Usergroups.FirstOrDefault();
            
            if (user == null)
            {
                throw new YouTrackErrorException(Strings.Exception_BadRequest, (int)HttpStatusCode.BadRequest,
                    "Could not find user with login " + username, null, null);
            }
            if (apiGroup == null)
            {
                throw new YouTrackErrorException(Strings.Exception_BadRequest, (int)HttpStatusCode.BadRequest,
                    "Could not find group with name " + group, null, null);
            }

            await client.HubUsergroupsUsersPostAsync(apiGroup.Id, "id", new HubApiUser(){Id = user.RingId});
        }