Пример #1
0
        /// <summary>
        /// Initializes a new Organization Members API client.
        /// </summary>
        /// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param>
        public ObservableOrganizationMembersClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _client     = client.Organization.Member;
            _connection = client.Connection;
        }
        /// <summary>
        /// Initializes a new Organization Members API client.
        /// </summary>
        /// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param>
        public ObservableOrganizationMembersClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _client = client.Organization.Member;
            _connection = client.Connection;
        }
Пример #3
0
        /// <summary>
        /// Query GitHub to get users in organization. This is not done
        /// in the constructor so that async capabilities can be used
        /// </summary>
        /// <param name="githubCredentials"></param>
        /// <returns></returns>
        private async Task <User[]> InitUsers(Credentials githubCredentials)
        {
            GitHubClient ghClient = new GitHubClient(new ProductHeaderValue("git-hub-client-for-byu-skills-test"));

            ghClient.Credentials = githubCredentials;

            // get the organization members
            IOrganizationMembersClient omc             = ghClient.Organization.Member;
            IReadOnlyList <User>       diminishedUsers = await omc.GetAll(orgName);

            // the users returned from an organization do not have all meta data. Get
            // the complete users using the direct user client
            IUsersClient uc = ghClient.User;

            return(await Task.WhenAll(diminishedUsers.Select(x => uc.Get(x.Login))));
        }