Пример #1
0
        async private Task <IEnumerable <MergeRequest> > loadByAuthor(GitLab gl, string username)
        {
            User user = GlobalCache.GetUser(gl.Host, username);

            if (user == null)
            {
                IEnumerable <User> users = await gl.Users.SearchByUsernameTaskAsync(username);

                if (users == null || !users.Any())
                {
                    return(System.Array.Empty <MergeRequest>());
                }
                user = users.First();
                GlobalCache.AddUser(gl.Host, user);
            }

            return(await load(gl, null, new MergeRequestsFilter(
                                  null, _wipFilter, _stateFilter, false, null, null, null, user.Id)));
        }
        async private Task <int?> getAuthorId(GitLab gl)
        {
            if (!String.IsNullOrEmpty(_query.AuthorUserName))
            {
                User user = GlobalCache.GetUser(gl.Host, _query.AuthorUserName);
                if (user == null)
                {
                    IEnumerable <User> users = await gl.Users.SearchByUsernameTaskAsync(_query.AuthorUserName);

                    if (users == null || !users.Any())
                    {
                        return(null);
                    }
                    user = users.First();
                    GlobalCache.AddUser(gl.Host, user);
                }
                return(user.Id);
            }
            return(null);
        }